shadowdocs 2.1.5 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  # ShadowDocs
2
2
  ## Overview
3
- ShadowDocs is an AI-powered documentation generator for developer projects, designed to simplify the process of creating and maintaining high-quality documentation. The project aims to provide an efficient and effective solution for developers to generate documentation with ease. By leveraging AI technology, ShadowDocs automates the documentation process, saving developers time and effort.
3
+ ShadowDocs is an AI-powered documentation generator designed to assist developers in creating high-quality project documentation. Its primary purpose is to streamline the documentation process, making it easier for developers to focus on their core work. By leveraging AI capabilities, ShadowDocs aims to reduce the time and effort required to generate and maintain project documentation.
4
4
 
5
5
  ## Version
6
- Current version: 2.0.0
6
+ Current version: 2.1.5
7
7
 
8
8
  ## Description
9
- ShadowDocs is a module designed for developers who want to generate high-quality documentation for their projects without the hassle of manual writing. The project uses AI technology to analyze the codebase and generate documentation automatically. ShadowDocs is ideal for developers who want to focus on writing code rather than documentation. With its interactive and intuitive interface, ShadowDocs makes it easy for developers to generate documentation that is accurate, up-to-date, and easy to understand.
9
+ ShadowDocs is a module designed for developer projects, providing an efficient way to generate documentation using AI. It is particularly useful for projects that require extensive documentation, as it can significantly reduce the workload associated with creating and updating documentation. With ShadowDocs, developers can ensure that their projects have accurate, up-to-date, and comprehensive documentation, which is essential for collaboration, maintenance, and user adoption.
10
10
 
11
11
  ## Features
12
12
  - AI-powered documentation generation
13
- - Automatic code analysis
14
- - Interactive documentation interface
15
- - Support for multiple programming languages
16
- - Customizable configuration options
13
+ - Real-time documentation updates with `--watch` mode
14
+ - Command-line interface (CLI) for easy usage
15
+ - Type checking for ensuring code quality
16
+ - Interactive mode for customized documentation generation
17
17
 
18
18
  ## Installation
19
19
  To install ShadowDocs, run the following command:
@@ -22,46 +22,55 @@ npm install shadowdocs
22
22
  ```
23
23
 
24
24
  ## Usage
25
- To use ShadowDocs, follow these steps:
25
+ ShadowDocs can be used in various ways, depending on the specific requirements of your project. Here are a few examples:
26
+ ```bash
27
+ # Build documentation
28
+ npx shadowdocs build
29
+
30
+ # Start documentation generation in watch mode
31
+ npx shadowdocs dev
32
+
33
+ # Start the CLI
34
+ npx shadowdocs start
35
+ ```
36
+ In your JavaScript or TypeScript files, you can also use ShadowDocs as a module:
26
37
  ```javascript
27
- // Import ShadowDocs
28
- const { generateDocs } = require('shadowdocs');
38
+ const { generateDocumentation } = require('shadowdocs');
29
39
 
30
40
  // Generate documentation
31
- generateDocs({
32
- // Project path
33
- path: './my-project',
34
- // Output path
35
- output: './docs',
36
- });
41
+ generateDocumentation('path/to/project');
37
42
  ```
38
43
 
39
44
  ## API Reference
40
- ShadowDocs exports the following functions:
41
- - `generateDocs(options)`: Generates documentation for a project.
42
- - `options.path`: The path to the project.
43
- - `options.output`: The output path for the generated documentation.
45
+ ShadowDocs exports several functions and classes that can be used to customize and extend its functionality. Some of the key exports include:
46
+ - `generateDocumentation`: Generates documentation for a given project
47
+ - `configure`: Configures ShadowDocs with custom settings
48
+ - `Analyzer`: A class for analyzing project code and generating documentation
44
49
 
45
50
  ## Configuration
46
- ShadowDocs provides the following configuration options:
47
- - `path`: The path to the project.
48
- - `output`: The output path for the generated documentation.
49
- - `language`: The programming language of the project.
51
+ ShadowDocs provides several configuration options that can be used to customize its behavior. These options can be specified in a `config.ts` file or passed as command-line arguments. Some of the available options include:
52
+ - `outputPath`: Specifies the output path for generated documentation
53
+ - `template`: Specifies a custom template for generated documentation
54
+ - `watch`: Enables or disables watch mode
50
55
 
51
56
  ## Development
52
- To set up the development environment, run the following commands:
57
+ To set up a development environment for ShadowDocs, follow these steps:
53
58
  ```bash
59
+ # Install dependencies
54
60
  npm install
61
+
62
+ # Build and watch the code
55
63
  npm run dev
56
64
  ```
57
- This will start the development server and watch for changes to the code.
65
+ This will start the development server, and you can begin making changes to the codebase.
58
66
 
59
67
  ## Testing
60
- To run tests, use the following command:
68
+ To run tests for ShadowDocs, use the following command:
61
69
  ```bash
70
+ # Run type checking
62
71
  npm run typecheck
63
72
  ```
64
- This will run the type checker and ensure that the code is correct.
73
+ Note that ShadowDocs currently uses TypeScript for type checking, and there are no additional tests beyond type checking.
65
74
 
66
75
  ## License
67
76
  MIT License
@@ -88,13 +97,13 @@ SOFTWARE.
88
97
 
89
98
  ## Contributing
90
99
  Contribution Guidelines:
91
- - Fork the repository and create a feature branch.
92
- - Follow the existing code style and conventions.
93
- - Add tests if applicable to ensure that the code is correct.
94
- - Submit a pull request with a clear description of the changes.
100
+ - Fork the ShadowDocs repository and create a new feature branch
101
+ - Follow the existing code style and conventions
102
+ - Add tests if applicable to ensure the quality of the code
103
+ - Submit a pull request with a detailed description of the changes
95
104
 
96
105
  ## Security Policy
97
- If you discover a vulnerability in ShadowDocs, please report it to the maintainers immediately. You can report vulnerabilities by emailing the maintainers or by submitting an issue on the repository.
106
+ If you discover a vulnerability in ShadowDocs, please report it to the maintainers via email or by submitting an issue on the GitHub repository. We take security seriously and will address vulnerabilities promptly.
98
107
 
99
108
  ## Code of Conduct
100
- We are committed to creating a welcoming and inclusive environment for all contributors. We expect all contributors to be respectful, inclusive, and professional. Harassment, discrimination, or any other form of unacceptable behavior will not be tolerated and will result in immediate suspension of privileges.
109
+ We are committed to creating a welcoming and inclusive environment for all contributors. We expect all participants to be respectful, considerate, and professional. Harassment, discrimination, or other forms of unacceptable behavior will not be tolerated and may result in immediate suspension or removal from the project.
@@ -1,4 +1,11 @@
1
1
  import { DocResult } from '../core/types.js';
2
+ export interface GeneratedDocs {
3
+ content?: string;
4
+ readme: string;
5
+ contributing: string;
6
+ license: string;
7
+ security: string;
8
+ }
2
9
  export declare function generateDocs(projectData: Record<string, unknown>, mode?: 'generate' | 'improve' | 'explain'): Promise<DocResult>;
3
10
  export declare function validateApiKey(apiKey: string): Promise<boolean>;
4
11
  //# sourceMappingURL=ai.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/services/ai.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AA6D7C,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,GAAE,UAAU,GAAG,SAAS,GAAG,SAAsB,GAAG,OAAO,CAAC,SAAS,CAAC,CA8BlJ;AA0HD,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA2BrE"}
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/services/ai.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AA6D7C,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,GAAE,UAAU,GAAG,SAAS,GAAG,SAAsB,GAAG,OAAO,CAAC,SAAS,CAAC,CA+ClJ;AA0MD,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA2BrE"}
@@ -2,7 +2,7 @@ import axios from 'axios';
2
2
  import { loadApiKey } from '../core/config.js';
3
3
  const GROQ_API_URL = 'https://api.groq.com/openai/v1/chat/completions';
4
4
  const MODEL = 'llama-3.3-70b-versatile';
5
- const SYSTEM_PROMPT = `You are a senior open-source maintainer and technical documentation expert. Generate detailed, professional READMEs with proper sections, realistic content (no fake features), MIT license, contribution guidelines, and security policy.`;
5
+ const SYSTEM_PROMPT = `You are a senior open-source maintainer and technical documentation expert with 15+ years of experience. You generate comprehensive, production-grade documentation that is practical, accurate, and developer-friendly. NEVER hallucinate features - only document what exists in the codebase.`;
6
6
  const MAX_RETRIES = 3;
7
7
  const BASE_DELAY = 1000;
8
8
  async function sleep(ms) {
@@ -49,117 +49,207 @@ export async function generateDocs(projectData, mode = 'generate') {
49
49
  if (!apiKey) {
50
50
  throw new Error('API key not configured. Run shadowdocs setup.');
51
51
  }
52
- let userPrompt = '';
53
- switch (mode) {
54
- case 'generate':
55
- userPrompt = buildGeneratePrompt(projectData);
56
- break;
57
- case 'improve':
58
- userPrompt = buildImprovePrompt(projectData);
59
- break;
60
- case 'explain':
61
- userPrompt = buildExplainPrompt(projectData);
62
- break;
63
- default:
64
- userPrompt = buildGeneratePrompt(projectData);
65
- }
66
- const response = await withRetry(() => makeRequest(apiKey, userPrompt));
67
52
  if (mode === 'explain') {
53
+ const response = await withRetry(() => makeRequest(apiKey, buildExplainPrompt(projectData)));
68
54
  return { type: 'text', content: response };
69
55
  }
70
- return { type: 'markdown', content: response };
56
+ if (mode === 'generate') {
57
+ const [readme, contributing, license, security] = await Promise.all([
58
+ withRetry(() => makeRequest(apiKey, buildReadmePrompt(projectData))),
59
+ withRetry(() => makeRequest(apiKey, buildContributingPrompt(projectData))),
60
+ withRetry(() => makeRequest(apiKey, buildLicensePrompt(projectData))),
61
+ withRetry(() => makeRequest(apiKey, buildSecurityPrompt(projectData)))
62
+ ]);
63
+ return {
64
+ type: 'markdown',
65
+ content: readme,
66
+ contributing,
67
+ license,
68
+ security
69
+ };
70
+ }
71
+ if (mode === 'improve') {
72
+ const [readme, contributing, license, security] = await Promise.all([
73
+ withRetry(() => makeRequest(apiKey, buildImproveReadmePrompt(projectData))),
74
+ withRetry(() => makeRequest(apiKey, buildImproveContributingPrompt(projectData))),
75
+ withRetry(() => makeRequest(apiKey, buildImproveLicensePrompt(projectData))),
76
+ withRetry(() => makeRequest(apiKey, buildImproveSecurityPrompt(projectData)))
77
+ ]);
78
+ return {
79
+ type: 'markdown',
80
+ content: readme,
81
+ contributing,
82
+ license,
83
+ security
84
+ };
85
+ }
86
+ throw new Error('Unknown mode');
87
+ }
88
+ function buildReadmePrompt(projectData) {
89
+ return `You are an expert technical writer. Generate a comprehensive, production-ready README.md for this project.
90
+
91
+ Analyze the project structure and package.json thoroughly. Document ONLY what's actually present in the codebase.
92
+
93
+ Requirements:
94
+ 1. Overview: What the project does, target audience, primary use case
95
+ 2. Features: List ACTUAL features from package.json scripts and dependencies - NO made-up features
96
+ 3. Installation: Exact commands for npm/pnpm/yarn
97
+ 4. Usage: Real code examples based on actual entry points and exports
98
+ 5. API: Document actual functions/endpoints/components found in the code
99
+ 6. Configuration: Actual config options if any
100
+ 7. Development: Real npm scripts from package.json
101
+ 8. Testing: How tests are run (from scripts)
102
+ 9. Project Structure: Actual directory layout
103
+ 10. Technologies: Real stack based on dependencies
104
+
105
+ IMPORTANT: Use the project data provided and INFER realistic content. Don't leave placeholder text.
106
+
107
+ Project Data:
108
+ ${JSON.stringify(projectData, null, 2)}
109
+
110
+ Return ONLY complete README.md markdown.`;
71
111
  }
72
- function buildGeneratePrompt(projectData) {
73
- return `Generate a detailed, professional README.md for this project with these exact sections:
112
+ function buildContributingPrompt(projectData) {
113
+ return `Generate a professional CONTRIBUTING.md for this project.
74
114
 
75
- # Project Name
115
+ Requirements:
116
+ 1. How to contribute (fork, clone, branch workflow)
117
+ 2. Development setup steps
118
+ 3. Code style guidelines (linting, formatting)
119
+ 4. Commit message conventions
120
+ 5. PR process and requirements
121
+ 6. Testing requirements
122
+ 7. Types of contributions welcome
123
+ 8. Issue templates or guidelines
124
+ 9. Recognition for contributors
125
+ 10. Code of conduct reference
76
126
 
77
- ## Overview
78
- 2-3 sentences about what this project does and its purpose.
127
+ Base it on the project's package.json scripts and known best practices.
79
128
 
80
- ## Version
81
- Current version: X.X.X
129
+ Project Data:
130
+ ${JSON.stringify(projectData, null, 2)}
82
131
 
83
- ## Description
84
- Detailed description of what this project does, who it's for, and why to use it.
132
+ Return ONLY complete CONTRIBUTING.md markdown.`;
133
+ }
134
+ function buildLicensePrompt(projectData) {
135
+ return `Generate a complete LICENSE file. Use MIT License as default. Include:
85
136
 
86
- ## Features
87
- - List real features (infer from package.json scripts and dependencies)
88
- - Do NOT add fake features
137
+ 1. Full MIT License text
138
+ 2. Copyright year (current year: ${new Date().getFullYear()})
139
+ 3. Project name: ${projectData.name || 'Project'}
140
+ 4. Author name if available in package.json
89
141
 
90
- ## Installation
91
- Provide the exact npm/pnpm/yarn install command.
142
+ Project Data:
143
+ ${JSON.stringify(projectData, null, 2)}
144
+
145
+ Return ONLY complete LICENSE file content (plain text, not markdown).`;
146
+ }
147
+ function buildSecurityPrompt(projectData) {
148
+ return `Generate a professional SECURITY.md for this project.
92
149
 
93
- ## Usage
94
- Show actual usage examples with code snippets.
150
+ Requirements:
151
+ 1. How to report vulnerabilities
152
+ 2. Security policy scope
153
+ 3. Response timeline
154
+ 4. Disclosure guidelines
155
+ 5. Security update process
156
+ 6. Contact information
157
+ 7. Dependencies security info if applicable
95
158
 
96
- ## API Reference
97
- If backend: document endpoints
98
- If frontend: document components/hooks
99
- If library: document exports/functions
159
+ Project Data:
160
+ ${JSON.stringify(projectData, null, 2)}
100
161
 
101
- ## Configuration
102
- Any config options available.
162
+ Return ONLY complete SECURITY.md markdown.`;
163
+ }
164
+ function buildImproveReadmePrompt(projectData) {
165
+ return `Improve the existing README.md for this project.
103
166
 
104
- ## Development
105
- How to set up dev environment:
106
- npm install
107
- npm run [script] - description
167
+ Requirements:
168
+ 1. Fix unclear sections
169
+ 2. Add missing important sections
170
+ 3. Improve code examples to be more practical
171
+ 4. Make installation more clear
172
+ 5. Enhance usage examples with real code
173
+ 6. Add API documentation if missing
174
+ 7. Improve structure and readability
175
+ 8. Keep existing good content
176
+ 9. Add project structure visualization if missing
108
177
 
109
- ## Testing
110
- How to run tests.
178
+ EXISTING README:
179
+ ${projectData.existingReadme || 'No existing README'}
111
180
 
112
- ## License
113
- MIT License - include full license text
181
+ Project Data:
182
+ ${JSON.stringify(projectData, null, 2)}
114
183
 
115
- ## Contributing
116
- Contribution Guidelines:
117
- - Fork and create feature branch
118
- - Follow existing code style
119
- - Add tests if applicable
120
- - Submit PR
184
+ Return ONLY improved README.md markdown.`;
185
+ }
186
+ function buildImproveContributingPrompt(projectData) {
187
+ return `Improve the existing CONTRIBUTING.md for this project.
121
188
 
122
- ## Security Policy
123
- How to report vulnerabilities.
189
+ Requirements:
190
+ 1. Make contribution process clearer
191
+ 2. Add missing guidelines
192
+ 3. Improve development setup instructions
193
+ 4. Add testing requirements
194
+ 5. Update for current project state
124
195
 
125
- ## Code of Conduct
126
- Be respectful, inclusive, no harassment. violations will result in immediate suspension.
196
+ EXISTING CONTRIBUTING:
197
+ ${projectData.existingContributing || 'No existing CONTRIBUTING.md'}
127
198
 
128
199
  Project Data:
129
200
  ${JSON.stringify(projectData, null, 2)}
130
201
 
131
- Return ONLY complete markdown.`;
202
+ Return ONLY improved CONTRIBUTING.md markdown.`;
132
203
  }
133
- function buildImprovePrompt(projectData) {
134
- return `Improve the existing README.md for this project.
204
+ function buildImproveLicensePrompt(projectData) {
205
+ return `Review and improve the LICENSE if needed.
206
+
207
+ Requirements:
208
+ 1. Ensure correct copyright year
209
+ 2. Verify project name is correct
210
+ 3. Add any missing clauses
135
211
 
136
- Current README:
137
- ${projectData.existingReadme}
212
+ EXISTING LICENSE:
213
+ ${projectData.existingLicense || 'No existing LICENSE'}
138
214
 
139
215
  Project Data:
140
216
  ${JSON.stringify(projectData, null, 2)}
141
217
 
142
- Rules:
143
- - Keep improvements practical and factual
144
- - Do NOT add hallucinated features
145
- - Maintain existing structure
146
- - Make it more useful for developers
218
+ Return ONLY complete LICENSE file content.`;
219
+ }
220
+ function buildImproveSecurityPrompt(projectData) {
221
+ return `Improve the existing SECURITY.md for this project.
222
+
223
+ Requirements:
224
+ 1. Make reporting process clearer
225
+ 2. Add missing security information
226
+ 3. Update contact info if needed
227
+ 4. Improve response timeline clarity
228
+
229
+ EXISTING SECURITY:
230
+ ${projectData.existingSecurity || 'No existing SECURITY.md'}
147
231
 
148
- Return ONLY the improved markdown.`;
232
+ Project Data:
233
+ ${JSON.stringify(projectData, null, 2)}
234
+
235
+ Return ONLY improved SECURITY.md markdown.`;
149
236
  }
150
237
  function buildExplainPrompt(projectData) {
151
- return `Explain this project in simple terms for developers.
238
+ return `Explain this project in simple, practical terms for developers.
239
+
240
+ Requirements:
241
+ 1. What the project does (one sentence)
242
+ 2. Who it's for
243
+ 3. Main features (top 3-5)
244
+ 4. How to use it (quick start)
245
+ 5. Why someone would use it
246
+ 6. Tech stack briefly
247
+
248
+ Be conversational but professional. No markdown.
152
249
 
153
250
  Project Data:
154
251
  ${JSON.stringify(projectData, null, 2)}
155
252
 
156
- Rules:
157
- - Be concise
158
- - Explain what the project does
159
- - Explain how to use it
160
- - Mention key features
161
- - Keep it conversational
162
-
163
253
  Return as plain text explanation.`;
164
254
  }
165
255
  async function makeRequest(apiKey, userPrompt) {
@@ -169,7 +259,7 @@ async function makeRequest(apiKey, userPrompt) {
169
259
  { role: 'system', content: SYSTEM_PROMPT },
170
260
  { role: 'user', content: userPrompt }
171
261
  ],
172
- temperature: 0.7,
262
+ temperature: 0.5,
173
263
  max_tokens: 8192
174
264
  }, {
175
265
  headers: {
@@ -1 +1 @@
1
- {"version":3,"file":"ai.js","sourceRoot":"","sources":["../../src/services/ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,MAAM,YAAY,GAAG,iDAAiD,CAAC;AACvE,MAAM,KAAK,GAAG,yBAAyB,CAAC;AAExC,MAAM,aAAa,GAAG,4OAA4O,CAAC;AAEnQ,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,KAAK,UAAU,KAAK,CAAC,EAAU;IAC7B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAA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AE,cAAc,2CA+FjE"}
1
+ {"version":3,"file":"Generator.d.ts","sourceRoot":"","sources":["../../../src/ui/components/Generator.tsx"],"names":[],"mappings":"AASA,UAAU,cAAc;IACvB,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IACzC,MAAM,EAAE,MAAM,IAAI,CAAC;CACnB;AAQD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,cAAc,2CAiHjE"}
@@ -8,8 +8,8 @@ import { analyzeProject, summarizeProject } from '../../services/analyzer.js';
8
8
  import fs from 'fs/promises';
9
9
  import path from 'path';
10
10
  const titles = {
11
- generate: 'Generate README',
12
- improve: 'Improve README',
11
+ generate: 'Generate Documentation',
12
+ improve: 'Improve Documentation',
13
13
  explain: 'Explain Project',
14
14
  };
15
15
  export default function Generator({ mode, onBack }) {
@@ -48,17 +48,29 @@ export default function Generator({ mode, onBack }) {
48
48
  setStatus('generating');
49
49
  spinner.text = 'Generating documentation...';
50
50
  const docResult = await generateDocs(summary, mode);
51
- if (mode === 'generate') {
52
- const readmePath = path.join(projectPath, 'README.md');
53
- await fs.writeFile(readmePath, docResult.content);
54
- setResult('README.md created successfully!');
51
+ if (mode === 'generate' || mode === 'improve') {
52
+ const files = [];
53
+ if (docResult.content) {
54
+ await fs.writeFile(path.join(projectPath, 'README.md'), docResult.content);
55
+ files.push('README.md');
56
+ }
57
+ if (docResult.contributing) {
58
+ await fs.writeFile(path.join(projectPath, 'CONTRIBUTING.md'), docResult.contributing);
59
+ files.push('CONTRIBUTING.md');
60
+ }
61
+ if (docResult.license) {
62
+ await fs.writeFile(path.join(projectPath, 'LICENSE'), docResult.license);
63
+ files.push('LICENSE');
64
+ }
65
+ if (docResult.security) {
66
+ await fs.writeFile(path.join(projectPath, 'SECURITY.md'), docResult.security);
67
+ files.push('SECURITY.md');
68
+ }
69
+ setResult(`${files.join(', ')} ${files.length === 1 ? 'created' : 'created'} successfully!`);
55
70
  }
56
71
  else if (mode === 'explain') {
57
72
  setResult(docResult.content);
58
73
  }
59
- else {
60
- setResult('Documentation improved!');
61
- }
62
74
  spinner.succeed('Done!');
63
75
  setStatus('done');
64
76
  }
@@ -68,6 +80,6 @@ export default function Generator({ mode, onBack }) {
68
80
  setStatus('error');
69
81
  }
70
82
  };
71
- return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: titles[mode] }), _jsx(Text, { dimColor: true, children: process.cwd() }), _jsx(Text, { children: "\n" }), status === 'checking' && _jsx(Text, { children: "Checking API key..." }), status === 'scanning' && _jsx(Text, { children: "Scanning project..." }), status === 'analyzing' && _jsx(Text, { children: "Analyzing project..." }), status === 'generating' && _jsx(Text, { children: "Generating documentation..." }), status === 'done' && (_jsxs(_Fragment, { children: [_jsxs(Text, { bold: true, color: "green", children: ["\u2713 ", result] }), _jsx(Text, { children: "\n" }), _jsx(Text, { dimColor: true, children: "Press any key to continue..." })] })), status === 'error' && (_jsxs(_Fragment, { children: [_jsxs(Text, { bold: true, color: "red", children: ["\u2717 ", error] }), _jsx(Text, { children: "\n" }), _jsx(Text, { dimColor: true, children: "Press any key to go back..." })] }))] }));
83
+ return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: titles[mode] }), _jsx(Text, { dimColor: true, children: process.cwd() }), _jsx(Text, { children: "\n" }), status === 'checking' && _jsx(Text, { children: "Checking API key..." }), status === 'scanning' && _jsx(Text, { children: "Scanning project..." }), status === 'analyzing' && _jsx(Text, { children: "Analyzing project..." }), status === 'generating' && _jsx(Text, { children: "Generating documentation (README, CONTRIBUTING, LICENSE, SECURITY)..." }), status === 'done' && (_jsxs(_Fragment, { children: [_jsxs(Text, { bold: true, color: "green", children: ["\u2713 ", result] }), _jsx(Text, { children: "\n" }), _jsx(Text, { dimColor: true, children: "Press any key to continue..." })] })), status === 'error' && (_jsxs(_Fragment, { children: [_jsxs(Text, { bold: true, color: "red", children: ["\u2717 ", error] }), _jsx(Text, { children: "\n" }), _jsx(Text, { dimColor: true, children: "Press any key to go back..." })] }))] }));
72
84
  }
73
85
  //# sourceMappingURL=Generator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Generator.js","sourceRoot":"","sources":["../../../src/ui/components/Generator.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9E,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAOxB,MAAM,MAAM,GAAG;IACd,QAAQ,EAAE,iBAAiB;IAC3B,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE,iBAAiB;CAC1B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,IAAI,EAAE,MAAM,EAAkB;IACjE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAA0E,UAAU,CAAC,CAAC;IAC1H,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC7C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAE1D,SAAS,CAAC,GAAG,EAAE;QACd,YAAY,EAAE,CAAC;IAChB,CAAC,EAAE,EAAE,CAAC,CAAC;I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AY,IAAI,KAAC,IAAI,wFAA6E,EAE7G,MAAM,KAAK,MAAM,IAAI,CACrB,8BACC,MAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,OAAO,wBAAI,MAAM,IAAQ,EAC1C,KAAC,IAAI,cAAE,IAAI,GAAQ,EACnB,KAAC,IAAI,IAAC,QAAQ,mDAAoC,IAChD,CACH,EAEA,MAAM,KAAK,OAAO,IAAI,CACtB,8BACC,MAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,KAAK,wBAAI,KAAK,IAAQ,EACvC,KAAC,IAAI,cAAE,IAAI,GAAQ,EACnB,KAAC,IAAI,IAAC,QAAQ,kDAAmC,IAC/C,CACH,IACI,CACN,CAAC;AACH,CAAC"}
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { useState } from 'react';
3
3
  import { Box, Text, useInput } from 'ink';
4
4
  const menuItems = [
5
- { key: 'g', label: 'Generate README', desc: 'Create new documentation' },
6
- { key: 'i', label: 'Improve README', desc: 'Enhance existing docs' },
5
+ { key: 'g', label: 'Generate Docs', desc: 'Create README, CONTRIBUTING, LICENSE, SECURITY' },
6
+ { key: 'i', label: 'Improve Docs', desc: 'Enhance existing documentation' },
7
7
  { key: 'e', label: 'Explain Project', desc: 'Terminal explanation' },
8
8
  { key: 's', label: 'Settings', desc: 'Configure API key' },
9
9
  { key: 'h', label: 'Help', desc: 'Usage guide' },
@@ -28,6 +28,6 @@ export default function Menu({ onSelect }) {
28
28
  }
29
29
  }
30
30
  });
31
- return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D" }), _jsx(Text, { dimColor: true, children: "AI-Powered Documentation Generator" }), _jsx(Text, { children: "\n" }), _jsx(Text, { bold: true, children: "Commands" }), _jsx(Text, { dimColor: true, children: "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" }), menuItems.map((item, index) => (_jsx(Box, { flexDirection: "column", children: index === selectedIndex ? (_jsxs(_Fragment, { children: [_jsxs(Text, { bold: true, color: "red", children: [' ', "\u25B6 [", item.key, "] ", item.label] }), _jsxs(Text, { dimColor: true, children: [" ", item.desc] })] })) : (_jsxs(Text, { children: [" [", item.key, "] ", item.label] })) }, item.key))), _jsx(Text, { children: "\n" }), _jsx(Text, { dimColor: true, children: "Use w/s or arrow keys to navigate, Enter or key to select, q to quit" }), _jsx(Text, { dimColor: true, children: "Version 2.1.4" })] }));
31
+ return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2554\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551 \u255A\u2550\u2550\u255D\u255A\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D" }), _jsx(Text, { dimColor: true, children: "AI-Powered Documentation Generator" }), _jsx(Text, { children: "\n" }), _jsx(Text, { bold: true, children: "Commands" }), _jsx(Text, { dimColor: true, children: "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" }), menuItems.map((item, index) => (_jsx(Box, { flexDirection: "column", children: index === selectedIndex ? (_jsxs(_Fragment, { children: [_jsxs(Text, { bold: true, color: "red", children: [' ', "\u25B6 [", item.key, "] ", item.label] }), _jsxs(Text, { dimColor: true, children: [" ", item.desc] })] })) : (_jsxs(Text, { children: [" [", item.key, "] ", item.label] })) }, item.key))), _jsx(Text, { children: "\n" }), _jsx(Text, { dimColor: true, children: "Use w/s or arrow keys to navigate, Enter or key to select, q to quit" }), _jsx(Text, { dimColor: true, children: "Version 2.1.6" })] }));
32
32
  }
33
33
  //# sourceMappingURL=Menu.js.map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,KAAK,EAAE,EAAE,CAAC,CAC/B,KAAC,GAAG,IAAgB,aAAa,EAAC,QAAQ,YACxC,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,CAC1B,8BACC,MAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,KAAK,aACpB,GAAG,cACA,IAAI,CAAC,GAAG,QAAI,IAAI,CAAC,KAAK,IACpB,EACP,MAAC,IAAI,IAAC,QAAQ,yBAAI,IAAI,CAAC,IAAI,IAAQ,IACjC,CACH,CAAC,CAAC,CAAC,CACH,MAAC,IAAI,sBAAK,IAAI,CAAC,GAAG,QAAI,IAAI,CAAC,KAAK,IAAQ,CACxC,IAXQ,IAAI,CAAC,GAAG,CAYZ,CACN,CAAC,EAEF,KAAC,IAAI,cAAE,IAAI,GAAQ,EACnB,KAAC,IAAI,IAAC,QAAQ,2FAA4E,EAC1F,KAAC,IAAI,IAAC,QAAQ,oCAAqB,IAC9B,CACN,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shadowdocs",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "AI-powered documentation generator for developer projects",
5
5
  "type": "module",
6
6
  "main": "dist/interactive.js",
@@ -5,7 +5,7 @@ import { DocResult } from '../core/types.js';
5
5
  const GROQ_API_URL = 'https://api.groq.com/openai/v1/chat/completions';
6
6
  const MODEL = 'llama-3.3-70b-versatile';
7
7
 
8
- const SYSTEM_PROMPT = `You are a senior open-source maintainer and technical documentation expert. Generate detailed, professional READMEs with proper sections, realistic content (no fake features), MIT license, contribution guidelines, and security policy.`;
8
+ const SYSTEM_PROMPT = `You are a senior open-source maintainer and technical documentation expert with 15+ years of experience. You generate comprehensive, production-grade documentation that is practical, accurate, and developer-friendly. NEVER hallucinate features - only document what exists in the codebase.`;
9
9
 
10
10
  const MAX_RETRIES = 3;
11
11
  const BASE_DELAY = 1000;
@@ -61,6 +61,14 @@ async function withRetry<T>(
61
61
  throw lastError || new Error('Request failed after retries');
62
62
  }
63
63
 
64
+ export interface GeneratedDocs {
65
+ content?: string;
66
+ readme: string;
67
+ contributing: string;
68
+ license: string;
69
+ security: string;
70
+ }
71
+
64
72
  export async function generateDocs(projectData: Record<string, unknown>, mode: 'generate' | 'improve' | 'explain' = 'generate'): Promise<DocResult> {
65
73
  const apiKey = await loadApiKey();
66
74
 
@@ -68,124 +76,221 @@ export async function generateDocs(projectData: Record<string, unknown>, mode: '
68
76
  throw new Error('API key not configured. Run shadowdocs setup.');
69
77
  }
70
78
 
71
- let userPrompt = '';
72
-
73
- switch (mode) {
74
- case 'generate':
75
- userPrompt = buildGeneratePrompt(projectData);
76
- break;
77
- case 'improve':
78
- userPrompt = buildImprovePrompt(projectData);
79
- break;
80
- case 'explain':
81
- userPrompt = buildExplainPrompt(projectData);
82
- break;
83
- default:
84
- userPrompt = buildGeneratePrompt(projectData);
85
- }
86
-
87
- const response = await withRetry(() => makeRequest(apiKey, userPrompt));
88
-
89
79
  if (mode === 'explain') {
80
+ const response = await withRetry(() => makeRequest(apiKey, buildExplainPrompt(projectData)));
90
81
  return { type: 'text', content: response };
91
82
  }
92
-
93
- return { type: 'markdown', content: response };
83
+
84
+ if (mode === 'generate') {
85
+ const [readme, contributing, license, security] = await Promise.all([
86
+ withRetry(() => makeRequest(apiKey, buildReadmePrompt(projectData))),
87
+ withRetry(() => makeRequest(apiKey, buildContributingPrompt(projectData))),
88
+ withRetry(() => makeRequest(apiKey, buildLicensePrompt(projectData))),
89
+ withRetry(() => makeRequest(apiKey, buildSecurityPrompt(projectData)))
90
+ ]);
91
+
92
+ return {
93
+ type: 'markdown',
94
+ content: readme,
95
+ contributing,
96
+ license,
97
+ security
98
+ } as unknown as DocResult;
99
+ }
100
+
101
+ if (mode === 'improve') {
102
+ const [readme, contributing, license, security] = await Promise.all([
103
+ withRetry(() => makeRequest(apiKey, buildImproveReadmePrompt(projectData))),
104
+ withRetry(() => makeRequest(apiKey, buildImproveContributingPrompt(projectData))),
105
+ withRetry(() => makeRequest(apiKey, buildImproveLicensePrompt(projectData))),
106
+ withRetry(() => makeRequest(apiKey, buildImproveSecurityPrompt(projectData)))
107
+ ]);
108
+
109
+ return {
110
+ type: 'markdown',
111
+ content: readme,
112
+ contributing,
113
+ license,
114
+ security
115
+ } as unknown as DocResult;
116
+ }
117
+
118
+ throw new Error('Unknown mode');
94
119
  }
95
120
 
96
- function buildGeneratePrompt(projectData: Record<string, unknown>): string {
97
- return `Generate a detailed, professional README.md for this project with these exact sections:
121
+ function buildReadmePrompt(projectData: Record<string, unknown>): string {
122
+ return `You are an expert technical writer. Generate a comprehensive, production-ready README.md for this project.
123
+
124
+ Analyze the project structure and package.json thoroughly. Document ONLY what's actually present in the codebase.
98
125
 
99
- # Project Name
126
+ Requirements:
127
+ 1. Overview: What the project does, target audience, primary use case
128
+ 2. Features: List ACTUAL features from package.json scripts and dependencies - NO made-up features
129
+ 3. Installation: Exact commands for npm/pnpm/yarn
130
+ 4. Usage: Real code examples based on actual entry points and exports
131
+ 5. API: Document actual functions/endpoints/components found in the code
132
+ 6. Configuration: Actual config options if any
133
+ 7. Development: Real npm scripts from package.json
134
+ 8. Testing: How tests are run (from scripts)
135
+ 9. Project Structure: Actual directory layout
136
+ 10. Technologies: Real stack based on dependencies
100
137
 
101
- ## Overview
102
- 2-3 sentences about what this project does and its purpose.
138
+ IMPORTANT: Use the project data provided and INFER realistic content. Don't leave placeholder text.
103
139
 
104
- ## Version
105
- Current version: X.X.X
140
+ Project Data:
141
+ ${JSON.stringify(projectData, null, 2)}
106
142
 
107
- ## Description
108
- Detailed description of what this project does, who it's for, and why to use it.
143
+ Return ONLY complete README.md markdown.`;
144
+ }
109
145
 
110
- ## Features
111
- - List real features (infer from package.json scripts and dependencies)
112
- - Do NOT add fake features
146
+ function buildContributingPrompt(projectData: Record<string, unknown>): string {
147
+ return `Generate a professional CONTRIBUTING.md for this project.
113
148
 
114
- ## Installation
115
- Provide the exact npm/pnpm/yarn install command.
149
+ Requirements:
150
+ 1. How to contribute (fork, clone, branch workflow)
151
+ 2. Development setup steps
152
+ 3. Code style guidelines (linting, formatting)
153
+ 4. Commit message conventions
154
+ 5. PR process and requirements
155
+ 6. Testing requirements
156
+ 7. Types of contributions welcome
157
+ 8. Issue templates or guidelines
158
+ 9. Recognition for contributors
159
+ 10. Code of conduct reference
116
160
 
117
- ## Usage
118
- Show actual usage examples with code snippets.
161
+ Base it on the project's package.json scripts and known best practices.
119
162
 
120
- ## API Reference
121
- If backend: document endpoints
122
- If frontend: document components/hooks
123
- If library: document exports/functions
163
+ Project Data:
164
+ ${JSON.stringify(projectData, null, 2)}
124
165
 
125
- ## Configuration
126
- Any config options available.
166
+ Return ONLY complete CONTRIBUTING.md markdown.`;
167
+ }
127
168
 
128
- ## Development
129
- How to set up dev environment:
130
- npm install
131
- npm run [script] - description
169
+ function buildLicensePrompt(projectData: Record<string, unknown>): string {
170
+ return `Generate a complete LICENSE file. Use MIT License as default. Include:
132
171
 
133
- ## Testing
134
- How to run tests.
172
+ 1. Full MIT License text
173
+ 2. Copyright year (current year: ${new Date().getFullYear()})
174
+ 3. Project name: ${projectData.name || 'Project'}
175
+ 4. Author name if available in package.json
135
176
 
136
- ## License
137
- MIT License - include full license text
177
+ Project Data:
178
+ ${JSON.stringify(projectData, null, 2)}
138
179
 
139
- ## Contributing
140
- Contribution Guidelines:
141
- - Fork and create feature branch
142
- - Follow existing code style
143
- - Add tests if applicable
144
- - Submit PR
180
+ Return ONLY complete LICENSE file content (plain text, not markdown).`;
181
+ }
145
182
 
146
- ## Security Policy
147
- How to report vulnerabilities.
183
+ function buildSecurityPrompt(projectData: Record<string, unknown>): string {
184
+ return `Generate a professional SECURITY.md for this project.
148
185
 
149
- ## Code of Conduct
150
- Be respectful, inclusive, no harassment. violations will result in immediate suspension.
186
+ Requirements:
187
+ 1. How to report vulnerabilities
188
+ 2. Security policy scope
189
+ 3. Response timeline
190
+ 4. Disclosure guidelines
191
+ 5. Security update process
192
+ 6. Contact information
193
+ 7. Dependencies security info if applicable
151
194
 
152
195
  Project Data:
153
196
  ${JSON.stringify(projectData, null, 2)}
154
197
 
155
- Return ONLY complete markdown.`;
198
+ Return ONLY complete SECURITY.md markdown.`;
156
199
  }
157
200
 
158
- function buildImprovePrompt(projectData: Record<string, unknown>): string {
201
+ function buildImproveReadmePrompt(projectData: Record<string, unknown>): string {
159
202
  return `Improve the existing README.md for this project.
160
203
 
161
- Current README:
162
- ${projectData.existingReadme}
204
+ Requirements:
205
+ 1. Fix unclear sections
206
+ 2. Add missing important sections
207
+ 3. Improve code examples to be more practical
208
+ 4. Make installation more clear
209
+ 5. Enhance usage examples with real code
210
+ 6. Add API documentation if missing
211
+ 7. Improve structure and readability
212
+ 8. Keep existing good content
213
+ 9. Add project structure visualization if missing
214
+
215
+ EXISTING README:
216
+ ${projectData.existingReadme || 'No existing README'}
217
+
218
+ Project Data:
219
+ ${JSON.stringify(projectData, null, 2)}
220
+
221
+ Return ONLY improved README.md markdown.`;
222
+ }
223
+
224
+ function buildImproveContributingPrompt(projectData: Record<string, unknown>): string {
225
+ return `Improve the existing CONTRIBUTING.md for this project.
226
+
227
+ Requirements:
228
+ 1. Make contribution process clearer
229
+ 2. Add missing guidelines
230
+ 3. Improve development setup instructions
231
+ 4. Add testing requirements
232
+ 5. Update for current project state
233
+
234
+ EXISTING CONTRIBUTING:
235
+ ${projectData.existingContributing || 'No existing CONTRIBUTING.md'}
236
+
237
+ Project Data:
238
+ ${JSON.stringify(projectData, null, 2)}
239
+
240
+ Return ONLY improved CONTRIBUTING.md markdown.`;
241
+ }
242
+
243
+ function buildImproveLicensePrompt(projectData: Record<string, unknown>): string {
244
+ return `Review and improve the LICENSE if needed.
245
+
246
+ Requirements:
247
+ 1. Ensure correct copyright year
248
+ 2. Verify project name is correct
249
+ 3. Add any missing clauses
250
+
251
+ EXISTING LICENSE:
252
+ ${projectData.existingLicense || 'No existing LICENSE'}
163
253
 
164
254
  Project Data:
165
255
  ${JSON.stringify(projectData, null, 2)}
166
256
 
167
- Rules:
168
- - Keep improvements practical and factual
169
- - Do NOT add hallucinated features
170
- - Maintain existing structure
171
- - Make it more useful for developers
257
+ Return ONLY complete LICENSE file content.`;
258
+ }
259
+
260
+ function buildImproveSecurityPrompt(projectData: Record<string, unknown>): string {
261
+ return `Improve the existing SECURITY.md for this project.
262
+
263
+ Requirements:
264
+ 1. Make reporting process clearer
265
+ 2. Add missing security information
266
+ 3. Update contact info if needed
267
+ 4. Improve response timeline clarity
268
+
269
+ EXISTING SECURITY:
270
+ ${projectData.existingSecurity || 'No existing SECURITY.md'}
172
271
 
173
- Return ONLY the improved markdown.`;
272
+ Project Data:
273
+ ${JSON.stringify(projectData, null, 2)}
274
+
275
+ Return ONLY improved SECURITY.md markdown.`;
174
276
  }
175
277
 
176
278
  function buildExplainPrompt(projectData: Record<string, unknown>): string {
177
- return `Explain this project in simple terms for developers.
279
+ return `Explain this project in simple, practical terms for developers.
280
+
281
+ Requirements:
282
+ 1. What the project does (one sentence)
283
+ 2. Who it's for
284
+ 3. Main features (top 3-5)
285
+ 4. How to use it (quick start)
286
+ 5. Why someone would use it
287
+ 6. Tech stack briefly
288
+
289
+ Be conversational but professional. No markdown.
178
290
 
179
291
  Project Data:
180
292
  ${JSON.stringify(projectData, null, 2)}
181
293
 
182
- Rules:
183
- - Be concise
184
- - Explain what the project does
185
- - Explain how to use it
186
- - Mention key features
187
- - Keep it conversational
188
-
189
294
  Return as plain text explanation.`;
190
295
  }
191
296
 
@@ -198,7 +303,7 @@ async function makeRequest(apiKey: string, userPrompt: string): Promise<string>
198
303
  { role: 'system', content: SYSTEM_PROMPT },
199
304
  { role: 'user', content: userPrompt }
200
305
  ],
201
- temperature: 0.7,
306
+ temperature: 0.5,
202
307
  max_tokens: 8192
203
308
  },
204
309
  {
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
2
2
  import { Box, Text, useInput } from 'ink';
3
3
  import ora from 'ora';
4
4
  import { loadApiKey } from '../../core/config.js';
5
- import { generateDocs } from '../../services/ai.js';
5
+ import { generateDocs, GeneratedDocs } from '../../services/ai.js';
6
6
  import { analyzeProject, summarizeProject } from '../../services/analyzer.js';
7
7
  import fs from 'fs/promises';
8
8
  import path from 'path';
@@ -13,8 +13,8 @@ interface GeneratorProps {
13
13
  }
14
14
 
15
15
  const titles = {
16
- generate: 'Generate README',
17
- improve: 'Improve README',
16
+ generate: 'Generate Documentation',
17
+ improve: 'Improve Documentation',
18
18
  explain: 'Explain Project',
19
19
  };
20
20
 
@@ -64,16 +64,34 @@ export default function Generator({ mode, onBack }: GeneratorProps) {
64
64
  setStatus('generating');
65
65
  spinner.text = 'Generating documentation...';
66
66
 
67
- const docResult = await generateDocs(summary as unknown as Record<string, unknown>, mode);
67
+ const docResult = await generateDocs(summary as unknown as Record<string, unknown>, mode) as unknown as GeneratedDocs;
68
68
 
69
- if (mode === 'generate') {
70
- const readmePath = path.join(projectPath, 'README.md');
71
- await fs.writeFile(readmePath, docResult.content);
72
- setResult('README.md created successfully!');
69
+ if (mode === 'generate' || mode === 'improve') {
70
+ const files: string[] = [];
71
+
72
+ if (docResult.content) {
73
+ await fs.writeFile(path.join(projectPath, 'README.md'), docResult.content);
74
+ files.push('README.md');
75
+ }
76
+
77
+ if (docResult.contributing) {
78
+ await fs.writeFile(path.join(projectPath, 'CONTRIBUTING.md'), docResult.contributing);
79
+ files.push('CONTRIBUTING.md');
80
+ }
81
+
82
+ if (docResult.license) {
83
+ await fs.writeFile(path.join(projectPath, 'LICENSE'), docResult.license);
84
+ files.push('LICENSE');
85
+ }
86
+
87
+ if (docResult.security) {
88
+ await fs.writeFile(path.join(projectPath, 'SECURITY.md'), docResult.security);
89
+ files.push('SECURITY.md');
90
+ }
91
+
92
+ setResult(`${files.join(', ')} ${files.length === 1 ? 'created' : 'created'} successfully!`);
73
93
  } else if (mode === 'explain') {
74
- setResult(docResult.content);
75
- } else {
76
- setResult('Documentation improved!');
94
+ setResult(docResult.content as string);
77
95
  }
78
96
 
79
97
  spinner.succeed('Done!');
@@ -94,7 +112,7 @@ export default function Generator({ mode, onBack }: GeneratorProps) {
94
112
  {status === 'checking' && <Text>Checking API key...</Text>}
95
113
  {status === 'scanning' && <Text>Scanning project...</Text>}
96
114
  {status === 'analyzing' && <Text>Analyzing project...</Text>}
97
- {status === 'generating' && <Text>Generating documentation...</Text>}
115
+ {status === 'generating' && <Text>Generating documentation (README, CONTRIBUTING, LICENSE, SECURITY)...</Text>}
98
116
 
99
117
  {status === 'done' && (
100
118
  <>
@@ -12,8 +12,8 @@ interface MenuProps {
12
12
  }
13
13
 
14
14
  const menuItems: MenuItem[] = [
15
- { key: 'g', label: 'Generate README', desc: 'Create new documentation' },
16
- { key: 'i', label: 'Improve README', desc: 'Enhance existing docs' },
15
+ { key: 'g', label: 'Generate Docs', desc: 'Create README, CONTRIBUTING, LICENSE, SECURITY' },
16
+ { key: 'i', label: 'Improve Docs', desc: 'Enhance existing documentation' },
17
17
  { key: 'e', label: 'Explain Project', desc: 'Terminal explanation' },
18
18
  { key: 's', label: 'Settings', desc: 'Configure API key' },
19
19
  { key: 'h', label: 'Help', desc: 'Usage guide' },
@@ -42,12 +42,12 @@ export default function Menu({ onSelect }: MenuProps) {
42
42
  <Box flexDirection="column" padding={1}>
43
43
  <Text bold color="cyan">
44
44
 
45
- ██████╗ ██████╗ ██████╗ ██╗ ██╗██╗ ███████╗███████╗
46
- ██╔════╝ ██╔══██╗██╔══██╗██║ ██║██║ ██╔════╝██╔════╝
47
- ██║ ███╗██████╔╝██████╔╝██║ ██║██║ █████╗ ███████╗
48
- ██║ ██║██╔══██╗██╔══██╗██║ ██║██║ ██╔══╝ ╚════██║
49
- ╚██████╔╝██║ ██║██║ ██║╚██████╔╝███████╗███████╗███████║
50
- ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝╚══════╝
45
+ ██╗ ██╗███████╗██████╗ ███████╗███████╗███╗ ███╗
46
+ ██║ ██║██╔════╝██╔══██╗██╔════╝██╔════╝████╗ ████║
47
+ ██║ █╗ ██║█████╗ ██████╔╝█████╗ █████╗ ██╔████╔██║
48
+ ██║███╗██║██╔══╝ ██╔══██╗██╔══╝ ██╔══╝ ██║╚██╔╝██║
49
+ ╚███╔███╔╝███████╗██║ ██║███████╗███████╗██║ ╚═╝ ██║
50
+ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝
51
51
 
52
52
  </Text>
53
53
 
@@ -75,7 +75,7 @@ export default function Menu({ onSelect }: MenuProps) {
75
75
 
76
76
  <Text>{"\n"}</Text>
77
77
  <Text dimColor>Use w/s or arrow keys to navigate, Enter or key to select, q to quit</Text>
78
- <Text dimColor>Version 2.1.4</Text>
78
+ <Text dimColor>Version 2.1.6</Text>
79
79
  </Box>
80
80
  );
81
81
  }