docs_generate_sales_docs
Generate sales-ready documentation for marketplace products like CodeCanyon and ThemeForest. Creates comprehensive Markdown files including README, installation guides, API references, and FAQ sections.
Instructions
Generate professional sales-ready documentation for CodeCanyon, ThemeForest, and other marketplaces. Creates comprehensive Markdown documentation (README, Installation, API Reference, Configuration, Examples, FAQ, Changelog) with optional PDF export.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | Path to the PHP project directory to analyze | |
| outputDir | No | Output directory for documentation files (default: ./sales-docs) | |
| productName | Yes | Product name for marketplace listing (e.g., 'Advanced User Management System') | |
| productVersion | No | Product version (default: '1.0.0') | |
| author | Yes | Author or company name (e.g., 'Your Company') | |
| description | Yes | Product description for the README (e.g., 'A comprehensive user management system with advanced features...') | |
| price | No | Product price (optional, e.g., '$49' or 'β¬39') | |
| demoUrl | No | Live demo URL (optional) | |
| supportEmail | No | Support email address (optional) | |
| features | No | List of key product features (e.g., ['User authentication', 'Role-based access', 'API support']) |
Implementation Reference
- src/index.ts:387-489 (handler)The primary handler function `generateSalesDocs` that executes the tool logic. It analyzes the PHP project, generates an OpenAPI spec, prepares options, generates sales documentation using helper functions, exports files, and returns a success message with stats.async function generateSalesDocs(args: any) { const projectPath = args.projectPath as string; const outputDir = (args.outputDir as string) || './sales-docs'; const productName = args.productName as string; const productVersion = (args.productVersion as string) || '1.0.0'; const author = args.author as string; const description = args.description as string; const price = args.price as string; const demoUrl = args.demoUrl as string; const supportEmail = args.supportEmail as string; const features = (args.features as string[]) || []; try { // Analyze project first const analysisResult = await analyzeProject({ projectPath, language: 'php', deep: true, }); // Extract file analysis from result const files = analysisResult.content[0].text; const analysis = JSON.parse(files); const analyzedFiles = analysis.deepAnalysis?.files || []; // Generate OpenAPI spec const openApiSpec = generateOpenApiSpec(analyzedFiles, { title: `${productName} API`, version: productVersion, description, serverUrl: demoUrl || 'https://api.example.com/v1', }) as OpenAPISpec; // Prepare sales doc options const options: SalesDocOptions = { productName, productVersion, author, description, price, demoUrl, supportEmail, features, requirements: { php: '7.4', framework: analyzedFiles[0]?.framework || 'Generic PHP', database: 'MySQL 5.7+ or PostgreSQL 10+', extensions: ['pdo', 'mbstring', 'openssl', 'curl', 'json'], }, }; // Generate all documentation const docs = generateSalesDocumentation(analyzedFiles, openApiSpec, options); // Export to files const path = await import('path'); const fullOutputDir = path.resolve(projectPath, outputDir); exportSalesDocumentation(docs, fullOutputDir); // Create combined documentation const fs = await import('fs/promises'); const combinedMd = `${docs.readme}\n\n---\n\n${docs.installation}\n\n---\n\n${docs.apiReference}\n\n---\n\n${docs.configuration}\n\n---\n\n${docs.examples}\n\n---\n\n${docs.faq}\n\n---\n\n${docs.changelog}`; const combinedPath = path.join(fullOutputDir, 'COMPLETE_DOCUMENTATION.md'); await fs.writeFile(combinedPath, combinedMd, 'utf-8'); let resultText = `β Sales documentation generated successfully!\n\n`; resultText += `π Output Directory: ${fullOutputDir}\n\n`; resultText += `π Files Created:\n`; resultText += ` - README.md (Main product documentation)\n`; resultText += ` - INSTALLATION.md (Step-by-step setup guide)\n`; resultText += ` - API_REFERENCE.md (${Object.keys(openApiSpec.paths).length} API endpoints)\n`; resultText += ` - CONFIGURATION.md (Configuration options)\n`; resultText += ` - EXAMPLES.md (Code examples in multiple languages)\n`; resultText += ` - FAQ.md (Frequently asked questions)\n`; resultText += ` - CHANGELOG.md (Version history)\n`; resultText += ` - COMPLETE_DOCUMENTATION.md (All-in-one combined docs)\n\n`; resultText += `π Documentation Stats:\n`; resultText += ` - API Endpoints: ${Object.keys(openApiSpec.paths).length}\n`; resultText += ` - Security Schemes: ${Object.keys(openApiSpec.components?.securitySchemes || {}).length}\n`; resultText += ` - Frameworks: ${analyzedFiles[0]?.framework || 'PHP'}\n`; resultText += ` - Classes Analyzed: ${analyzedFiles.length}\n\n`; resultText += `π‘ Next Steps:\n`; resultText += ` 1. Review generated documentation\n`; resultText += ` 2. Customize with your branding\n`; resultText += ` 3. Generate PDF: pandoc COMPLETE_DOCUMENTATION.md -o Documentation.pdf --toc\n`; resultText += ` 4. Upload to CodeCanyon/ThemeForest\n\n`; resultText += `π― Perfect for marketplace sales!`; return { content: [ { type: "text", text: resultText, }, ], }; } catch (error) { throw new Error(`Failed to generate sales documentation: ${error}`); } }
- src/index.ts:238-288 (registration)The tool registration object added to the MCP tools list, including name, description, and detailed input schema.{ name: "docs_generate_sales_docs", description: "Generate professional sales-ready documentation for CodeCanyon, ThemeForest, and other marketplaces. Creates comprehensive Markdown documentation (README, Installation, API Reference, Configuration, Examples, FAQ, Changelog) with optional PDF export.", inputSchema: { type: "object", properties: { projectPath: { type: "string", description: "Path to the PHP project directory to analyze", }, outputDir: { type: "string", description: "Output directory for documentation files (default: ./sales-docs)", }, productName: { type: "string", description: "Product name for marketplace listing (e.g., 'Advanced User Management System')", }, productVersion: { type: "string", description: "Product version (default: '1.0.0')", }, author: { type: "string", description: "Author or company name (e.g., 'Your Company')", }, description: { type: "string", description: "Product description for the README (e.g., 'A comprehensive user management system with advanced features...')", }, price: { type: "string", description: "Product price (optional, e.g., '$49' or 'β¬39')", }, demoUrl: { type: "string", description: "Live demo URL (optional)", }, supportEmail: { type: "string", description: "Support email address (optional)", }, features: { type: "array", items: { type: "string" }, description: "List of key product features (e.g., ['User authentication', 'Role-based access', 'API support'])", }, }, required: ["projectPath", "productName", "author", "description"], }, },
- src/index.ts:241-287 (schema)The input schema defining parameters for the docs_generate_sales_docs tool.inputSchema: { type: "object", properties: { projectPath: { type: "string", description: "Path to the PHP project directory to analyze", }, outputDir: { type: "string", description: "Output directory for documentation files (default: ./sales-docs)", }, productName: { type: "string", description: "Product name for marketplace listing (e.g., 'Advanced User Management System')", }, productVersion: { type: "string", description: "Product version (default: '1.0.0')", }, author: { type: "string", description: "Author or company name (e.g., 'Your Company')", }, description: { type: "string", description: "Product description for the README (e.g., 'A comprehensive user management system with advanced features...')", }, price: { type: "string", description: "Product price (optional, e.g., '$49' or 'β¬39')", }, demoUrl: { type: "string", description: "Live demo URL (optional)", }, supportEmail: { type: "string", description: "Support email address (optional)", }, features: { type: "array", items: { type: "string" }, description: "List of key product features (e.g., ['User authentication', 'Role-based access', 'API support'])", }, }, required: ["projectPath", "productName", "author", "description"], },
- Core helper function that orchestrates generation of all sales documentation sections (README, installation, API ref, etc.) by calling specialized generators.export function generateSalesDocumentation( files: FileAnalysis[], openApiSpec: OpenAPISpec, options: SalesDocOptions ): { readme: string; installation: string; apiReference: string; configuration: string; examples: string; faq: string; changelog: string; } { return { readme: generateReadme(files, openApiSpec, options), installation: generateInstallationGuide(files, options), apiReference: generateApiReference(openApiSpec, options), configuration: generateConfigurationGuide(files, options), examples: generateExamples(files, openApiSpec, options), faq: generateFAQ(options), changelog: generateChangelog(options) }; }
- Helper function that writes the generated documentation sections to individual Markdown files in the output directory.export async function exportSalesDocumentation( docs: ReturnType<typeof generateSalesDocumentation>, outputDir: string ): Promise<void> { const fs = await import('fs/promises'); const path = await import('path'); // Create output directory if it doesn't exist try { await fs.mkdir(outputDir, { recursive: true }); } catch (error) { // Directory might already exist } // Write all documentation files await Promise.all([ fs.writeFile(path.join(outputDir, 'README.md'), docs.readme), fs.writeFile(path.join(outputDir, 'INSTALLATION.md'), docs.installation), fs.writeFile(path.join(outputDir, 'API_REFERENCE.md'), docs.apiReference), fs.writeFile(path.join(outputDir, 'CONFIGURATION.md'), docs.configuration), fs.writeFile(path.join(outputDir, 'EXAMPLES.md'), docs.examples), fs.writeFile(path.join(outputDir, 'FAQ.md'), docs.faq), fs.writeFile(path.join(outputDir, 'CHANGELOG.md'), docs.changelog) ]); }
- TypeScript interfaces defining SalesDocOptions (input options) and OpenAPISpec (API specification structure) used throughout the sales docs generation.export interface SalesDocOptions { productName: string; productVersion: string; author: string; description: string; price?: string; demoUrl?: string; supportEmail?: string; features?: string[]; requirements?: { php?: string; framework?: string; database?: string; extensions?: string[]; }; } export interface OpenAPISpec { openapi: string; info: { title: string; version: string; description?: string; }; paths: Record<string, any>; components?: { securitySchemes?: Record<string, any>; }; servers?: Array<{ url: string; description?: string }>; }