grok-cli-hurry-mode 1.0.4 → 1.0.5
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/dist/hooks/use-input-handler.js +588 -0
- package/dist/hooks/use-input-handler.js.map +1 -1
- package/dist/subagents/subagent-framework.d.ts +66 -0
- package/dist/subagents/subagent-framework.js +349 -0
- package/dist/subagents/subagent-framework.js.map +1 -0
- package/dist/tools/documentation/agent-system-generator.d.ts +30 -0
- package/dist/tools/documentation/agent-system-generator.js +816 -0
- package/dist/tools/documentation/agent-system-generator.js.map +1 -0
- package/dist/tools/documentation/api-docs-generator.d.ts +89 -0
- package/dist/tools/documentation/api-docs-generator.js +344 -0
- package/dist/tools/documentation/api-docs-generator.js.map +1 -0
- package/dist/tools/documentation/auto-update-system.d.ts +47 -0
- package/dist/tools/documentation/auto-update-system.js +278 -0
- package/dist/tools/documentation/auto-update-system.js.map +1 -0
- package/dist/tools/documentation/changelog-generator.d.ts +39 -0
- package/dist/tools/documentation/changelog-generator.js +255 -0
- package/dist/tools/documentation/changelog-generator.js.map +1 -0
- package/dist/tools/documentation/claude-md-parser.d.ts +25 -0
- package/dist/tools/documentation/claude-md-parser.js +108 -0
- package/dist/tools/documentation/claude-md-parser.js.map +1 -0
- package/dist/tools/documentation/comments-generator.d.ts +55 -0
- package/dist/tools/documentation/comments-generator.js +238 -0
- package/dist/tools/documentation/comments-generator.js.map +1 -0
- package/dist/tools/documentation/docs-menu.d.ts +9 -0
- package/dist/tools/documentation/docs-menu.js +57 -0
- package/dist/tools/documentation/docs-menu.js.map +1 -0
- package/dist/tools/documentation/readme-generator.d.ts +31 -0
- package/dist/tools/documentation/readme-generator.js +244 -0
- package/dist/tools/documentation/readme-generator.js.map +1 -0
- package/dist/tools/documentation/self-healing-system.d.ts +66 -0
- package/dist/tools/documentation/self-healing-system.js +444 -0
- package/dist/tools/documentation/self-healing-system.js.map +1 -0
- package/dist/tools/documentation/smart-prd-assistant.d.ts +45 -0
- package/dist/tools/documentation/smart-prd-assistant.js +325 -0
- package/dist/tools/documentation/smart-prd-assistant.js.map +1 -0
- package/dist/tools/documentation/update-agent-docs.d.ts +37 -0
- package/dist/tools/documentation/update-agent-docs.js +275 -0
- package/dist/tools/documentation/update-agent-docs.js.map +1 -0
- package/dist/tools/intelligence/ast-parser.js +22 -4
- package/dist/tools/intelligence/ast-parser.js.map +1 -1
- package/dist/ui/app.d.ts +2 -1
- package/dist/ui/app.js +27 -6
- package/dist/ui/app.js.map +1 -1
- package/dist/ui/components/api-key-input.d.ts +2 -1
- package/dist/ui/components/api-key-input.js +18 -3
- package/dist/ui/components/api-key-input.js.map +1 -1
- package/dist/ui/components/chat-history.d.ts +2 -1
- package/dist/ui/components/chat-history.js +35 -13
- package/dist/ui/components/chat-history.js.map +1 -1
- package/dist/ui/components/chat-input.d.ts +2 -1
- package/dist/ui/components/chat-input.js +36 -15
- package/dist/ui/components/chat-input.js.map +1 -1
- package/dist/ui/components/chat-interface.d.ts +2 -1
- package/dist/ui/components/chat-interface.js +39 -5
- package/dist/ui/components/chat-interface.js.map +1 -1
- package/dist/ui/components/command-suggestions.d.ts +2 -1
- package/dist/ui/components/command-suggestions.js +8 -3
- package/dist/ui/components/command-suggestions.js.map +1 -1
- package/dist/ui/components/confirmation-dialog.d.ts +2 -1
- package/dist/ui/components/confirmation-dialog.js +39 -4
- package/dist/ui/components/confirmation-dialog.js.map +1 -1
- package/dist/ui/components/diff-renderer.js +66 -57
- package/dist/ui/components/diff-renderer.js.map +1 -1
- package/dist/ui/components/loading-spinner.d.ts +2 -1
- package/dist/ui/components/loading-spinner.js +13 -3
- package/dist/ui/components/loading-spinner.js.map +1 -1
- package/dist/ui/components/mcp-status.d.ts +2 -1
- package/dist/ui/components/mcp-status.js +6 -3
- package/dist/ui/components/mcp-status.js.map +1 -1
- package/dist/ui/components/model-selection.d.ts +2 -1
- package/dist/ui/components/model-selection.js +11 -2
- package/dist/ui/components/model-selection.js.map +1 -1
- package/dist/ui/shared/max-sized-box.js +2 -2
- package/dist/ui/shared/max-sized-box.js.map +1 -1
- package/dist/ui/utils/code-colorizer.js +2 -2
- package/dist/ui/utils/code-colorizer.js.map +1 -1
- package/dist/ui/utils/markdown-renderer.d.ts +2 -1
- package/dist/ui/utils/markdown-renderer.js +3 -3
- package/dist/ui/utils/markdown-renderer.js.map +1 -1
- package/package.json +21 -12
@@ -0,0 +1,108 @@
|
|
1
|
+
import path from 'path';
|
2
|
+
import fs from 'fs/promises';
|
3
|
+
import { existsSync } from 'fs';
|
4
|
+
export class ClaudeMdParserImpl {
|
5
|
+
async parseClaude(rootPath) {
|
6
|
+
const claudePath = path.join(rootPath, 'CLAUDE.md');
|
7
|
+
if (!existsSync(claudePath)) {
|
8
|
+
return {
|
9
|
+
exists: false,
|
10
|
+
content: '',
|
11
|
+
hasDocumentationSection: false
|
12
|
+
};
|
13
|
+
}
|
14
|
+
try {
|
15
|
+
const content = await fs.readFile(claudePath, 'utf-8');
|
16
|
+
const hasDocumentationSection = content.includes('Documentation System Workflow') ||
|
17
|
+
content.includes('.agent documentation system');
|
18
|
+
return {
|
19
|
+
exists: true,
|
20
|
+
content,
|
21
|
+
hasDocumentationSection
|
22
|
+
};
|
23
|
+
}
|
24
|
+
catch (error) {
|
25
|
+
return {
|
26
|
+
exists: false,
|
27
|
+
content: '',
|
28
|
+
hasDocumentationSection: false
|
29
|
+
};
|
30
|
+
}
|
31
|
+
}
|
32
|
+
async updateClaude(rootPath, documentationSection) {
|
33
|
+
const claudePath = path.join(rootPath, 'CLAUDE.md');
|
34
|
+
try {
|
35
|
+
const { exists, content, hasDocumentationSection } = await this.parseClaude(rootPath);
|
36
|
+
if (hasDocumentationSection) {
|
37
|
+
return {
|
38
|
+
success: true,
|
39
|
+
message: '✅ CLAUDE.md already contains documentation system instructions'
|
40
|
+
};
|
41
|
+
}
|
42
|
+
let newContent;
|
43
|
+
if (exists) {
|
44
|
+
// Append to existing CLAUDE.md
|
45
|
+
newContent = content + '\n\n' + documentationSection;
|
46
|
+
}
|
47
|
+
else {
|
48
|
+
// Create new CLAUDE.md with basic header
|
49
|
+
newContent = `# CLAUDE.md
|
50
|
+
|
51
|
+
This document provides context and instructions for Claude Code when working with this project.
|
52
|
+
|
53
|
+
${documentationSection}`;
|
54
|
+
}
|
55
|
+
await fs.writeFile(claudePath, newContent);
|
56
|
+
return {
|
57
|
+
success: true,
|
58
|
+
message: exists
|
59
|
+
? '✅ Updated existing CLAUDE.md with documentation system instructions'
|
60
|
+
: '✅ Created CLAUDE.md with documentation system instructions'
|
61
|
+
};
|
62
|
+
}
|
63
|
+
catch (error) {
|
64
|
+
return {
|
65
|
+
success: false,
|
66
|
+
message: `Failed to update CLAUDE.md: ${error.message}`
|
67
|
+
};
|
68
|
+
}
|
69
|
+
}
|
70
|
+
generateDocumentationSection() {
|
71
|
+
return `## 📚 Documentation System Workflow
|
72
|
+
|
73
|
+
### Before Planning Features:
|
74
|
+
1. **Read \`.agent/README.md\`** for project overview
|
75
|
+
2. **Check \`.agent/system/\`** for architecture context
|
76
|
+
3. **Review \`.agent/tasks/\`** for related work
|
77
|
+
4. **Scan \`.agent/sop/\`** for established patterns
|
78
|
+
|
79
|
+
### During Implementation:
|
80
|
+
- Store PRDs in \`.agent/tasks/\` before coding
|
81
|
+
- Reference architecture docs for consistency
|
82
|
+
- Follow established patterns from SOPs
|
83
|
+
- Use cross-references between .agent docs
|
84
|
+
|
85
|
+
### After Implementation:
|
86
|
+
- Run \`/update-agent-docs\` to capture changes
|
87
|
+
- Update \`.agent/system/\` if architecture changed
|
88
|
+
- Add new SOPs for repeatable processes
|
89
|
+
- Link related tasks and documents
|
90
|
+
|
91
|
+
### Documentation Rules:
|
92
|
+
- Keep system docs as single source of truth
|
93
|
+
- Use relative links between .agent documents
|
94
|
+
- Maintain concise, actionable content
|
95
|
+
- Update cross-references when adding new docs
|
96
|
+
|
97
|
+
### Token Optimization:
|
98
|
+
- Read .agent docs hierarchically (README → critical-state → relevant docs)
|
99
|
+
- Expect ~600 tokens for full context vs 3000+ without system
|
100
|
+
- Use .agent structure to avoid redundant codebase scanning
|
101
|
+
- Reference existing documentation rather than recreating context
|
102
|
+
|
103
|
+
---
|
104
|
+
*This section was added by the Grok CLI documentation system*`;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
export const claudeMdParser = new ClaudeMdParserImpl();
|
108
|
+
//# sourceMappingURL=claude-md-parser.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"claude-md-parser.js","sourceRoot":"","sources":["../../../src/tools/documentation/claude-md-parser.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAQhC,MAAM,OAAO,kBAAkB;IAE7B,KAAK,CAAC,WAAW,CAAC,QAAgB;QAChC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAEpD,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5B,OAAO;gBACL,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,EAAE;gBACX,uBAAuB,EAAE,KAAK;aAC/B,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YACvD,MAAM,uBAAuB,GAAG,OAAO,CAAC,QAAQ,CAAC,+BAA+B,CAAC;gBAClD,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAC,CAAC;YAE/E,OAAO;gBACL,MAAM,EAAE,IAAI;gBACZ,OAAO;gBACP,uBAAuB;aACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,EAAE;gBACX,uBAAuB,EAAE,K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+
filePath: string;
|
3
|
+
commentType: 'functions' | 'classes' | 'all';
|
4
|
+
style: 'jsdoc' | 'inline' | 'auto';
|
5
|
+
}
|
6
|
+
export interface CodeAnalysis {
|
7
|
+
language: string;
|
8
|
+
functions: FunctionInfo[];
|
9
|
+
classes: ClassInfo[];
|
10
|
+
interfaces: InterfaceInfo[];
|
11
|
+
hasExistingComments: boolean;
|
12
|
+
}
|
13
|
+
export interface FunctionInfo {
|
14
|
+
name: string;
|
15
|
+
line: number;
|
16
|
+
parameters: string[];
|
17
|
+
returnType?: string;
|
18
|
+
isAsync: boolean;
|
19
|
+
isExported: boolean;
|
20
|
+
}
|
21
|
+
export interface ClassInfo {
|
22
|
+
name: string;
|
23
|
+
line: number;
|
24
|
+
methods: FunctionInfo[];
|
25
|
+
properties: PropertyInfo[];
|
26
|
+
isExported: boolean;
|
27
|
+
}
|
28
|
+
export interface InterfaceInfo {
|
29
|
+
name: string;
|
30
|
+
line: number;
|
31
|
+
properties: PropertyInfo[];
|
32
|
+
}
|
33
|
+
export interface PropertyInfo {
|
34
|
+
name: string;
|
35
|
+
type?: string;
|
36
|
+
optional: boolean;
|
37
|
+
}
|
38
|
+
export declare class CommentsGenerator {
|
39
|
+
private config;
|
40
|
+
constructor(config: CommentsConfig);
|
41
|
+
generateComments(): Promise<{
|
42
|
+
success: boolean;
|
43
|
+
message: string;
|
44
|
+
modifiedContent?: string;
|
45
|
+
}>;
|
46
|
+
private analyzeCode;
|
47
|
+
private detectLanguage;
|
48
|
+
private hasExtensiveComments;
|
49
|
+
private addComments;
|
50
|
+
private generateFunctionComment;
|
51
|
+
private generateClassComment;
|
52
|
+
private generateFunctionDescription;
|
53
|
+
private getIndentation;
|
54
|
+
private countAddedComments;
|
55
|
+
}
|
@@ -0,0 +1,238 @@
|
|
1
|
+
import path from 'path';
|
2
|
+
import fs from 'fs/promises';
|
3
|
+
import { existsSync } from 'fs';
|
4
|
+
export class CommentsGenerator {
|
5
|
+
constructor(config) {
|
6
|
+
this.config = config;
|
7
|
+
}
|
8
|
+
async generateComments() {
|
9
|
+
try {
|
10
|
+
if (!existsSync(this.config.filePath)) {
|
11
|
+
return {
|
12
|
+
success: false,
|
13
|
+
message: 'File not found'
|
14
|
+
};
|
15
|
+
}
|
16
|
+
const content = await fs.readFile(this.config.filePath, 'utf-8');
|
17
|
+
const analysis = this.analyzeCode(content);
|
18
|
+
if (analysis.hasExistingComments) {
|
19
|
+
return {
|
20
|
+
success: false,
|
21
|
+
message: 'File already has extensive comments. Use --force to override.'
|
22
|
+
};
|
23
|
+
}
|
24
|
+
const modifiedContent = this.addComments(content, analysis);
|
25
|
+
// Create backup
|
26
|
+
const backupPath = this.config.filePath + '.backup';
|
27
|
+
await fs.writeFile(backupPath, content);
|
28
|
+
// Write modified content
|
29
|
+
await fs.writeFile(this.config.filePath, modifiedContent);
|
30
|
+
const commentCount = this.countAddedComments(analysis);
|
31
|
+
return {
|
32
|
+
success: true,
|
33
|
+
message: `✅ Added ${commentCount} comments to ${path.basename(this.config.filePath)}\n📁 Backup created: ${path.basename(backupPath)}`,
|
34
|
+
modifiedContent
|
35
|
+
};
|
36
|
+
}
|
37
|
+
catch (error) {
|
38
|
+
return {
|
39
|
+
success: false,
|
40
|
+
message: `Failed to add comments: ${error.message}`
|
41
|
+
};
|
42
|
+
}
|
43
|
+
}
|
44
|
+
analyzeCode(content) {
|
45
|
+
const lines = content.split('\n');
|
46
|
+
const language = this.detectLanguage();
|
47
|
+
const analysis = {
|
48
|
+
language,
|
49
|
+
functions: [],
|
50
|
+
classes: [],
|
51
|
+
interfaces: [],
|
52
|
+
hasExistingComments: this.hasExtensiveComments(content)
|
53
|
+
};
|
54
|
+
// Simple regex-based parsing (could be enhanced with AST)
|
55
|
+
for (let i = 0; i < lines.length; i++) {
|
56
|
+
const line = lines[i].trim();
|
57
|
+
// Detect functions
|
58
|
+
const funcMatch = line.match(/(?:export\s+)?(?:async\s+)?function\s+(\w+)\s*\(([^)]*)\)/);
|
59
|
+
if (funcMatch) {
|
60
|
+
const [, name, params] = funcMatch;
|
61
|
+
analysis.functions.push({
|
62
|
+
name,
|
63
|
+
line: i + 1,
|
64
|
+
parameters: params.split(',').map(p => p.trim()).filter(Boolean),
|
65
|
+
isAsync: line.includes('async'),
|
66
|
+
isExported: line.includes('export')
|
67
|
+
});
|
68
|
+
}
|
69
|
+
// Detect arrow functions
|
70
|
+
const arrowMatch = line.match(/(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?\([^)]*\)\s*=>/);
|
71
|
+
if (arrowMatch) {
|
72
|
+
const [, name] = arrowMatch;
|
73
|
+
analysis.functions.push({
|
74
|
+
name,
|
75
|
+
line: i + 1,
|
76
|
+
parameters: [],
|
77
|
+
isAsync: line.includes('async'),
|
78
|
+
isExported: line.includes('export')
|
79
|
+
});
|
80
|
+
}
|
81
|
+
// Detect classes
|
82
|
+
const classMatch = line.match(/(?:export\s+)?class\s+(\w+)/);
|
83
|
+
if (classMatch) {
|
84
|
+
const [, name] = classMatch;
|
85
|
+
analysis.classes.push({
|
86
|
+
name,
|
87
|
+
line: i + 1,
|
88
|
+
methods: [],
|
89
|
+
properties: [],
|
90
|
+
isExported: line.includes('export')
|
91
|
+
});
|
92
|
+
}
|
93
|
+
// Detect interfaces (TypeScript)
|
94
|
+
const interfaceMatch = line.match(/(?:export\s+)?interface\s+(\w+)/);
|
95
|
+
if (interfaceMatch) {
|
96
|
+
const [, name] = interfaceMatch;
|
97
|
+
analysis.interfaces.push({
|
98
|
+
name,
|
99
|
+
line: i + 1,
|
100
|
+
properties: []
|
101
|
+
});
|
102
|
+
}
|
103
|
+
}
|
104
|
+
return analysis;
|
105
|
+
}
|
106
|
+
detectLanguage() {
|
107
|
+
const ext = path.extname(this.config.filePath);
|
108
|
+
switch (ext) {
|
109
|
+
case '.ts':
|
110
|
+
case '.tsx': return 'typescript';
|
111
|
+
case '.js':
|
112
|
+
case '.jsx': return 'javascript';
|
113
|
+
case '.py': return 'python';
|
114
|
+
case '.java': return 'java';
|
115
|
+
case '.cpp':
|
116
|
+
case '.cc':
|
117
|
+
case '.cxx': return 'cpp';
|
118
|
+
default: return 'unknown';
|
119
|
+
}
|
120
|
+
}
|
121
|
+
hasExtensiveComments(content) {
|
122
|
+
const lines = content.split('\n');
|
123
|
+
const commentLines = lines.filter(line => {
|
124
|
+
const trimmed = line.trim();
|
125
|
+
return trimmed.startsWith('//') ||
|
126
|
+
trimmed.startsWith('/*') ||
|
127
|
+
trimmed.startsWith('*') ||
|
128
|
+
trimmed.startsWith('#') ||
|
129
|
+
trimmed.includes('/**');
|
130
|
+
});
|
131
|
+
// Consider "extensive" if more than 20% of lines are comments
|
132
|
+
return commentLines.length / lines.length > 0.2;
|
133
|
+
}
|
134
|
+
addComments(content, analysis) {
|
135
|
+
const lines = content.split('\n');
|
136
|
+
let modifiedLines = [...lines];
|
137
|
+
let insertOffset = 0;
|
138
|
+
// Add comments to functions
|
139
|
+
if (this.config.commentType === 'functions' || this.config.commentType === 'all') {
|
140
|
+
for (const func of analysis.functions) {
|
141
|
+
const commentLines = this.generateFunctionComment(func, analysis.language);
|
142
|
+
const insertIndex = func.line - 1 + insertOffset;
|
143
|
+
// Insert comment lines before function
|
144
|
+
modifiedLines.splice(insertIndex, 0, ...commentLines);
|
145
|
+
insertOffset += commentLines.length;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
// Add comments to classes
|
149
|
+
if (this.config.commentType === 'classes' || this.config.commentType === 'all') {
|
150
|
+
for (const cls of analysis.classes) {
|
151
|
+
const commentLines = this.generateClassComment(cls, analysis.language);
|
152
|
+
const insertIndex = cls.line - 1 + insertOffset;
|
153
|
+
modifiedLines.splice(insertIndex, 0, ...commentLines);
|
154
|
+
insertOffset += commentLines.length;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
return modifiedLines.join('\n');
|
158
|
+
}
|
159
|
+
generateFunctionComment(func, language) {
|
160
|
+
const indent = this.getIndentation(func.line);
|
161
|
+
if (language === 'typescript' || language === 'javascript') {
|
162
|
+
const lines = [
|
163
|
+
`${indent}/**`,
|
164
|
+
`${indent} * ${this.generateFunctionDescription(func)}`,
|
165
|
+
];
|
166
|
+
if (func.parameters.length > 0) {
|
167
|
+
lines.push(`${indent} *`);
|
168
|
+
func.parameters.forEach(param => {
|
169
|
+
const cleanParam = param.split(':')[0].split('=')[0].trim();
|
170
|
+
lines.push(`${indent} * @param {any} ${cleanParam} - Parameter description`);
|
171
|
+
});
|
172
|
+
}
|
173
|
+
lines.push(`${indent} * @returns {${func.isAsync ? 'Promise<any>' : 'any'}} Return description`);
|
174
|
+
lines.push(`${indent} */`);
|
175
|
+
return lines;
|
176
|
+
}
|
177
|
+
return [`${indent}// ${this.generateFunctionDescription(func)}`];
|
178
|
+
}
|
179
|
+
generateClassComment(cls, language) {
|
180
|
+
const indent = this.getIndentation(cls.line);
|
181
|
+
if (language === 'typescript' || language === 'javascript') {
|
182
|
+
return [
|
183
|
+
`${indent}/**`,
|
184
|
+
`${indent} * ${cls.name} class`,
|
185
|
+
`${indent} * `,
|
186
|
+
`${indent} * @class ${cls.name}`,
|
187
|
+
`${indent} */`
|
188
|
+
];
|
189
|
+
}
|
190
|
+
return [`${indent}// ${cls.name} class`];
|
191
|
+
}
|
192
|
+
generateFunctionDescription(func) {
|
193
|
+
if (func.name === 'constructor') {
|
194
|
+
return 'Creates an instance of the class';
|
195
|
+
}
|
196
|
+
// Generate smart descriptions based on function name
|
197
|
+
const name = func.name.toLowerCase();
|
198
|
+
if (name.startsWith('get')) {
|
199
|
+
return `Gets ${name.substring(3).replace(/([A-Z])/g, ' $1').toLowerCase()}`;
|
200
|
+
}
|
201
|
+
if (name.startsWith('set')) {
|
202
|
+
return `Sets ${name.substring(3).replace(/([A-Z])/g, ' $1').toLowerCase()}`;
|
203
|
+
}
|
204
|
+
if (name.startsWith('create')) {
|
205
|
+
return `Creates a new ${name.substring(6).replace(/([A-Z])/g, ' $1').toLowerCase()}`;
|
206
|
+
}
|
207
|
+
if (name.startsWith('delete') || name.startsWith('remove')) {
|
208
|
+
const target = name.startsWith('delete') ? name.substring(6) : name.substring(6);
|
209
|
+
return `Deletes ${target.replace(/([A-Z])/g, ' $1').toLowerCase()}`;
|
210
|
+
}
|
211
|
+
if (name.startsWith('update')) {
|
212
|
+
return `Updates ${name.substring(6).replace(/([A-Z])/g, ' $1').toLowerCase()}`;
|
213
|
+
}
|
214
|
+
if (name.startsWith('is') || name.startsWith('has')) {
|
215
|
+
return `Checks if ${name.substring(2).replace(/([A-Z])/g, ' $1').toLowerCase()}`;
|
216
|
+
}
|
217
|
+
if (name.includes('handle')) {
|
218
|
+
return `Handles ${name.replace('handle', '').replace(/([A-Z])/g, ' $1').toLowerCase()}`;
|
219
|
+
}
|
220
|
+
return `${func.name} function`;
|
221
|
+
}
|
222
|
+
getIndentation(lineNumber) {
|
223
|
+
// This would need access to the original line to detect indentation
|
224
|
+
// For now, return empty string - could be enhanced
|
225
|
+
return '';
|
226
|
+
}
|
227
|
+
countAddedComments(analysis) {
|
228
|
+
let count = 0;
|
229
|
+
if (this.config.commentType === 'functions' || this.config.commentType === 'all') {
|
230
|
+
count += analysis.functions.length;
|
231
|
+
}
|
232
|
+
if (this.config.commentType === 'classes' || this.config.commentType === 'all') {
|
233
|
+
count += analysis.classes.length;
|
234
|
+
}
|
235
|
+
return count;
|
236
|
+
}
|
237
|
+
}
|
238
|
+
//# sourceMappingURL=comments-generator.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"comments-generator.js","sourceRoot":"","sources":["../../../src/tools/documentation/comments-generator.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AA6ChC,MAAM,OAAO,iBAAiB;IAG5B,YAAY,MAAsB;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,gBAAg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M,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,KAAK,KAAK,EAAE,CAAC;YAC/E,KAAK,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;QACnC,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export interface DocsMenuOption {
|
2
|
+
key: string;
|
3
|
+
title: string;
|
4
|
+
description: string;
|
5
|
+
command: string;
|
6
|
+
}
|
7
|
+
export declare const DOCS_MENU_OPTIONS: DocsMenuOption[];
|
8
|
+
export declare function generateDocsMenuText(): string;
|
9
|
+
export declare function findDocsMenuOption(input: string): DocsMenuOption | null;
|
@@ -0,0 +1,57 @@
|
|
1
|
+
export const DOCS_MENU_OPTIONS = [
|
2
|
+
{
|
3
|
+
key: "1",
|
4
|
+
title: "Generate README",
|
5
|
+
description: "Create comprehensive README.md from project structure",
|
6
|
+
command: "/readme"
|
7
|
+
},
|
8
|
+
{
|
9
|
+
key: "2",
|
10
|
+
title: "Generate API Documentation",
|
11
|
+
description: "Extract and document functions, classes, modules",
|
12
|
+
command: "/api-docs"
|
13
|
+
},
|
14
|
+
{
|
15
|
+
key: "3",
|
16
|
+
title: "Add Code Comments",
|
17
|
+
description: "Add intelligent comments to existing code",
|
18
|
+
command: "/comments"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
key: "4",
|
22
|
+
title: "Generate Changelog",
|
23
|
+
description: "Generate CHANGELOG.md from git history",
|
24
|
+
command: "/changelog"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
key: "5",
|
28
|
+
title: "Initialize .agent System",
|
29
|
+
description: "Set up AI-first documentation structure",
|
30
|
+
command: "/init-agent"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
key: "6",
|
34
|
+
title: "Update .agent Documentation",
|
35
|
+
description: "Sync docs with recent code changes",
|
36
|
+
command: "/update-agent-docs"
|
37
|
+
}
|
38
|
+
];
|
39
|
+
export function generateDocsMenuText() {
|
40
|
+
return `📚 **Documentation Menu**
|
41
|
+
|
42
|
+
Choose a documentation task:
|
43
|
+
|
44
|
+
${DOCS_MENU_OPTIONS.map(option => `**${option.key}.** ${option.title}
|
45
|
+
${option.description}
|
46
|
+
→ \`${option.command}\`
|
47
|
+
`).join('\n')}
|
48
|
+
|
49
|
+
**0.** Exit Menu
|
50
|
+
|
51
|
+
Type a number to select an option, or type any command directly.`;
|
52
|
+
}
|
53
|
+
export function findDocsMenuOption(input) {
|
54
|
+
const trimmed = input.trim();
|
55
|
+
return DOCS_MENU_OPTIONS.find(option => option.key === trimmed) || null;
|
56
|
+
}
|
57
|
+
//# sourceMappingURL=docs-menu.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"docs-menu.js","sourceRoot":"","sources":["../../../src/tools/documentation/docs-menu.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,iBAAiB,GAAqB;IACjD;QACE,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,uDAAuD;QACpE,OAAO,EAAE,SAAS;KACnB;IACD;QACE,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,4BAA4B;QACnC,WAAW,EAAE,kDAAkD;QAC/D,OAAO,EAAE,WAAW;KACrB;IACD;QACE,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,2CAA2C;QACxD,OAAO,EAAE,WAAW;KACrB;IACD;QACE,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE,wCAAwC;QACrD,OAAO,EAAE,YAAY;KACtB;IACD;QACE,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,0BAA0B;QACjC,WAAW,EAAE,yCAAyC;QACtD,OAAO,EAAE,aAAa;KACvB;IACD;QACE,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,6BAA6B;QACpC,WAAW,EAAE,oCAAoC;QACjD,OAAO,EAAE,oBAAoB;KAC9B;CACF,CAAC;AAEF,MAAM,UAAU,oBAAoB;IAClC,OAAO;;;;EAIP,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAC/B,KAAK,MAAM,CAAC,GAAG,OAAO,MAAM,CAAC,KAAK;KAC/B,MAAM,CAAC,WAAW;SACd,MAAM,CAAC,OAAO;CACtB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;iEAIoD,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,OAAO,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,KAAK,OAAO,CAAC,IAAI,IAAI,CAAC;AAC1E,CAAC"}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
export interface ReadmeConfig {
|
2
|
+
projectName: string;
|
3
|
+
rootPath: string;
|
4
|
+
updateExisting: boolean;
|
5
|
+
template: 'default' | 'api' | 'cli' | 'library';
|
6
|
+
}
|
7
|
+
export interface ProjectAnalysis {
|
8
|
+
packageJson?: any;
|
9
|
+
hasTypeScript: boolean;
|
10
|
+
hasReact: boolean;
|
11
|
+
hasTests: boolean;
|
12
|
+
hasDocs: boolean;
|
13
|
+
buildScripts: string[];
|
14
|
+
dependencies: string[];
|
15
|
+
devDependencies: string[];
|
16
|
+
mainFiles: string[];
|
17
|
+
framework?: string;
|
18
|
+
}
|
19
|
+
export declare class ReadmeGenerator {
|
20
|
+
private config;
|
21
|
+
constructor(config: ReadmeConfig);
|
22
|
+
generateReadme(): Promise<{
|
23
|
+
success: boolean;
|
24
|
+
message: string;
|
25
|
+
content?: string;
|
26
|
+
}>;
|
27
|
+
private analyzeProject;
|
28
|
+
private generateReadmeContent;
|
29
|
+
private generateBadges;
|
30
|
+
private getScriptDescription;
|
31
|
+
}
|