shadowdocs 2.1.5 → 2.1.7
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/CONTRIBUTING.md +34 -66
- package/LICENSE +1 -1
- package/README.md +119 -78
- package/SECURITY.md +25 -42
- package/dist/services/ai.d.ts +7 -0
- package/dist/services/ai.d.ts.map +1 -1
- package/dist/services/ai.js +167 -77
- package/dist/services/ai.js.map +1 -1
- package/dist/ui/components/Generator.d.ts.map +1 -1
- package/dist/ui/components/Generator.js +22 -10
- package/dist/ui/components/Generator.js.map +1 -1
- package/dist/ui/components/Menu.d.ts.map +1 -1
- package/dist/ui/components/Menu.js +3 -3
- package/dist/ui/components/Menu.js.map +1 -1
- package/package.json +1 -1
- package/src/services/ai.ts +185 -80
- package/src/ui/components/Generator.tsx +30 -12
- package/src/ui/components/Menu.tsx +6 -11
package/dist/services/ai.js
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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
|
|
73
|
-
return `Generate a
|
|
112
|
+
function buildContributingPrompt(projectData) {
|
|
113
|
+
return `Generate a professional CONTRIBUTING.md for this project.
|
|
74
114
|
|
|
75
|
-
|
|
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
|
-
|
|
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
|
-
|
|
81
|
-
|
|
129
|
+
Project Data:
|
|
130
|
+
${JSON.stringify(projectData, null, 2)}
|
|
82
131
|
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
-
|
|
91
|
-
|
|
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
|
-
|
|
94
|
-
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
If frontend: document components/hooks
|
|
99
|
-
If library: document exports/functions
|
|
159
|
+
Project Data:
|
|
160
|
+
${JSON.stringify(projectData, null, 2)}
|
|
100
161
|
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
110
|
-
|
|
178
|
+
EXISTING README:
|
|
179
|
+
${projectData.existingReadme || 'No existing README'}
|
|
111
180
|
|
|
112
|
-
|
|
113
|
-
|
|
181
|
+
Project Data:
|
|
182
|
+
${JSON.stringify(projectData, null, 2)}
|
|
114
183
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
-
|
|
123
|
-
|
|
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
|
-
|
|
126
|
-
|
|
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
|
|
202
|
+
Return ONLY improved CONTRIBUTING.md markdown.`;
|
|
132
203
|
}
|
|
133
|
-
function
|
|
134
|
-
return `
|
|
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
|
-
|
|
137
|
-
${projectData.
|
|
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
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
-
|
|
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.
|
|
262
|
+
temperature: 0.5,
|
|
173
263
|
max_tokens: 8192
|
|
174
264
|
}, {
|
|
175
265
|
headers: {
|
package/dist/services/ai.js.map
CHANGED
|
@@ -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,
|
|
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,kSAAkS,C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C,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAc;IACjD,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,IAAI,CACd,YAAY,EACZ;YACE,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE;gBACR,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,8BAA8B,EAAE;gBAC3D,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;aAChC;YACD,UAAU,EAAE,EAAE;SACf,EACD;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,eAAe,EAAE,UAAU,MAAM,EAAE;aACpC;YACD,OAAO,EAAE,KAAK;SACf,CACF,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,GAAG,CAAC,EAAE,CAAC;YAC9F,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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
|
|
12
|
-
improve: 'Improve
|
|
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
|
|
53
|
-
|
|
54
|
-
|
|
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,
|
|
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,EAAiB,MAAM,sBAAsB,CAAC;AACnE,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;IAC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AE,OAAO,CAAC,GAAG,EAAE,GAAQ,EACrC,KAAC,IAAI,cAAE,IAAI,GAAQ,EAElB,MAAM,KAAK,UAAU,IAAI,KAAC,IAAI,sCAA2B,EACzD,MAAM,KAAK,UAAU,IAAI,KAAC,IAAI,sCAA2B,EACzD,MAAM,KAAK,WAAW,IAAI,KAAC,IAAI,uCAA4B,EAC3D,MAAM,KAAK,YAAY,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/ui/components/Menu.tsx"],"names":[],"mappings":"AASA,UAAU,SAAS;IAClB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAWD,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/ui/components/Menu.tsx"],"names":[],"mappings":"AASA,UAAU,SAAS;IAClB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAWD,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,SAAS,2CAqDnD"}
|
|
@@ -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
|
|
6
|
-
{ key: 'i', label: 'Improve
|
|
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: "
|
|
31
|
+
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: ".-. . . .-. .-. .-. . . . .-. .-. .-. .-. `-. |-| |-| | ) | | | | | | ) | | | `-. `-' ' ` ` ' `-' `-' `.'.' `-' `-' `-' `-'" }), _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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../src/ui/components/Menu.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAY1C,MAAM,SAAS,GAAe;IAC7B,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Menu.js","sourceRoot":"","sources":["../../../src/ui/components/Menu.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAY1C,MAAM,SAAS,GAAe;IAC7B,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,gDAAgD,EAAE;IAC5F,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,gCAAgC,EAAE;IAC3E,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,sBAAsB,EAAE;IACpE,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,mBAAmB,EAAE;IAC1D,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE;IAChD,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE;CACrD,CAAC;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