Coding
PromptBeginner5 minmarkdown
Markdown Converter
Agent skill for markdown-converter
7
This is a multi-stage TypeScript project for analyzing Perplexity AI SPA static assets and generating:
Sign in to like and favorite skills
This is a multi-stage TypeScript project for analyzing Perplexity AI SPA static assets and generating:
src/ ├── browser/ │ ├── browser-automation.ts # Chrome automation orchestrator │ ├── cdp-client.ts # Chrome DevTools Protocol client │ └── capture-config.ts # Browser capture configurations ├── fetchers/ │ └── asset-fetcher.ts # Download SPA assets from CDN ├── parsers/ │ ├── asset-parser.ts # Basic chunking parser │ └── typescript-ast-parser.ts # AST-based TypeScript parsing (ts-morph) ├── generators/ │ ├── openapi-generator.ts # OpenAPI v3.1 specs │ ├── asyncapi-generator.ts # AsyncAPI v3.0 specs │ ├── jsonschema-generator.ts # JSON Schema definitions │ └── automcp-generator.ts # MCP server code generation ├── knowledge/ │ └── kb-builder.ts # Knowledge base construction ├── types/ │ └── index.ts # Shared TypeScript definitions └── cli.ts # Command-line interface
# Clone and install git clone https://github.com/pv-udpv/pplx-spa-assets-knowledge cd pplx-spa-assets-knowledge npm install # Create .env for testing echo "API_BASE_URL=https://pplx-next-static-public.perplexity.ai" > .env echo "API_KEY=" >> .env
npm run build npm run dev # Watch mode
# Launch browser with Chrome DevTools Protocol npm run cli browser -- \ --preset apiReversing \ --url https://www.perplexity.ai \ --output ./captures # Available presets: minimal, apiReversing, full, development # Captures HAR files, WebSocket messages, network timings, storage data
npm run fetch -- \ --source https://pplx-next-static-public.perplexity.ai \ --output ./assets-cache \ --concurrency 5
# Note: Parse command not yet fully implemented npm run parse -- \ --input ./assets-cache \ --output ./parsed
# Note: Generate command not yet fully implemented # Generate all specs npm run generate -- \ --type all \ --input ./parsed \ --output ./specs # Or specific types npm run generate -- --type openapi npm run generate -- --type asyncapi npm run generate -- --type jsonschema
# Note: MCP generation command not yet fully implemented npm run mcp:generate -- \ --spec ./specs/openapi/api-v1.yaml \ --output ./mcp/pplx-api \ --name pplx-api
node dist/cli.js automcp \ --spec ./specs/openapi/api-v1.yaml \ --output ./automcp.config.json
ts-morph for accurate TypeScript AST extractionpackage.json with dependenciessrc/index.ts - MCP server with tool registrationsrc/tools.ts - Tool implementations with API callssrc/types.ts - Type definitions from OpenAPI schemasREADME.md and .env.examplesrc/generators/generate() methodsrc/cli.tsAssetChunk.type in src/types/index.tsAssetParser.detectContentType()chunkifyAsset()Update
TypeScriptASTParser.extractEndpointFromFunction() with new regex patterns:
const patterns = [ { regex: /new_library\.method\s*\(\s*['"]([^'"]+)['"]/g, type: 'new_library' }, // ... ];
# Test browser automation npm run build node dist/cli.js browser --preset minimal --url https://www.perplexity.ai # Fetch a small subset echo "/_next/static/chunks/main.js" > manifest.txt npm run fetch -- --manifest manifest.txt # Note: Parse and generate commands are placeholders and not fully implemented yet
npm install
This will install all required dependencies including:
The repository includes GitHub Actions workflows. Ensure
package-lock.json is committed to the repository for workflow caching to work properly.
# Enable verbose logging (TODO: implement) DEBUG=pplx-assets:* npm run fetch # Check generated MCP server cd ./mcp/pplx-api npm run build node dist/index.js
mainnpm run build