@nclamvn/vibecode-cli 1.6.0 → 1.8.0

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.
Files changed (70) hide show
  1. package/bin/vibecode.js +101 -1
  2. package/docs-site/README.md +41 -0
  3. package/docs-site/blog/2019-05-28-first-blog-post.md +12 -0
  4. package/docs-site/blog/2019-05-29-long-blog-post.md +44 -0
  5. package/docs-site/blog/2021-08-01-mdx-blog-post.mdx +24 -0
  6. package/docs-site/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
  7. package/docs-site/blog/2021-08-26-welcome/index.md +29 -0
  8. package/docs-site/blog/authors.yml +25 -0
  9. package/docs-site/blog/tags.yml +19 -0
  10. package/docs-site/docs/commands/agent.md +162 -0
  11. package/docs-site/docs/commands/assist.md +71 -0
  12. package/docs-site/docs/commands/build.md +53 -0
  13. package/docs-site/docs/commands/config.md +30 -0
  14. package/docs-site/docs/commands/debug.md +173 -0
  15. package/docs-site/docs/commands/doctor.md +34 -0
  16. package/docs-site/docs/commands/go.md +128 -0
  17. package/docs-site/docs/commands/index.md +79 -0
  18. package/docs-site/docs/commands/init.md +42 -0
  19. package/docs-site/docs/commands/learn.md +82 -0
  20. package/docs-site/docs/commands/lock.md +33 -0
  21. package/docs-site/docs/commands/plan.md +29 -0
  22. package/docs-site/docs/commands/review.md +31 -0
  23. package/docs-site/docs/commands/snapshot.md +34 -0
  24. package/docs-site/docs/commands/start.md +32 -0
  25. package/docs-site/docs/commands/status.md +37 -0
  26. package/docs-site/docs/commands/undo.md +83 -0
  27. package/docs-site/docs/configuration.md +72 -0
  28. package/docs-site/docs/faq.md +83 -0
  29. package/docs-site/docs/getting-started.md +119 -0
  30. package/docs-site/docs/guides/agent-mode.md +94 -0
  31. package/docs-site/docs/guides/debug-mode.md +83 -0
  32. package/docs-site/docs/guides/magic-mode.md +107 -0
  33. package/docs-site/docs/installation.md +98 -0
  34. package/docs-site/docs/intro.md +67 -0
  35. package/docs-site/docusaurus.config.ts +141 -0
  36. package/docs-site/package-lock.json +18039 -0
  37. package/docs-site/package.json +48 -0
  38. package/docs-site/sidebars.ts +70 -0
  39. package/docs-site/src/components/HomepageFeatures/index.tsx +72 -0
  40. package/docs-site/src/components/HomepageFeatures/styles.module.css +16 -0
  41. package/docs-site/src/css/custom.css +30 -0
  42. package/docs-site/src/pages/index.module.css +23 -0
  43. package/docs-site/src/pages/index.tsx +44 -0
  44. package/docs-site/src/pages/markdown-page.md +7 -0
  45. package/docs-site/src/theme/Footer/index.tsx +127 -0
  46. package/docs-site/src/theme/Footer/styles.module.css +285 -0
  47. package/docs-site/static/.nojekyll +0 -0
  48. package/docs-site/static/img/docusaurus-social-card.jpg +0 -0
  49. package/docs-site/static/img/docusaurus.png +0 -0
  50. package/docs-site/static/img/favicon.ico +0 -0
  51. package/docs-site/static/img/logo.svg +1 -0
  52. package/docs-site/static/img/undraw_docusaurus_mountain.svg +171 -0
  53. package/docs-site/static/img/undraw_docusaurus_react.svg +170 -0
  54. package/docs-site/static/img/undraw_docusaurus_tree.svg +40 -0
  55. package/docs-site/tsconfig.json +8 -0
  56. package/package.json +2 -1
  57. package/src/commands/ask.js +230 -0
  58. package/src/commands/debug.js +109 -1
  59. package/src/commands/docs.js +167 -0
  60. package/src/commands/git.js +1024 -0
  61. package/src/commands/migrate.js +341 -0
  62. package/src/commands/refactor.js +205 -0
  63. package/src/commands/review.js +126 -1
  64. package/src/commands/security.js +229 -0
  65. package/src/commands/shell.js +486 -0
  66. package/src/commands/test.js +194 -0
  67. package/src/commands/watch.js +556 -0
  68. package/src/debug/image-analyzer.js +304 -0
  69. package/src/index.js +27 -0
  70. package/src/utils/image.js +222 -0
@@ -8,8 +8,10 @@ import ora from 'ora';
8
8
  import path from 'path';
9
9
  import fs from 'fs-extra';
10
10
  import readline from 'readline';
11
+ import inquirer from 'inquirer';
11
12
  import { printBox, printError, printSuccess, printWarning, printNextStep } from '../ui/output.js';
12
13
  import { createDebugEngine } from '../debug/index.js';
14
+ import { ImageAnalyzer } from '../debug/image-analyzer.js';
13
15
 
14
16
  /**
15
17
  * Debug Command Entry Point
@@ -24,6 +26,15 @@ export async function debugCommand(args = [], options = {}) {
24
26
  try {
25
27
  const projectPath = process.cwd();
26
28
 
29
+ // Handle image input modes first
30
+ if (options.image) {
31
+ return handleImageDebug(options.image, projectPath, options);
32
+ }
33
+
34
+ if (options.clipboard) {
35
+ return handleClipboardDebug(projectPath, options);
36
+ }
37
+
27
38
  // Parse command arguments
28
39
  const input = parseDebugInput(args, options);
29
40
 
@@ -177,6 +188,100 @@ Prevention rules added to:
177
188
  }
178
189
  }
179
190
 
191
+ /**
192
+ * Handle image file debug
193
+ */
194
+ async function handleImageDebug(imagePath, projectPath, options) {
195
+ const analyzer = new ImageAnalyzer(projectPath);
196
+
197
+ try {
198
+ const analysis = await analyzer.analyzeImage(imagePath);
199
+ console.log(analyzer.formatAnalysis(analysis));
200
+
201
+ // If error detected, ask to fix
202
+ if (analysis.errorType && analysis.suggestedFix) {
203
+ const { fix } = await inquirer.prompt([{
204
+ type: 'confirm',
205
+ name: 'fix',
206
+ message: 'Apply suggested fix?',
207
+ default: true
208
+ }]);
209
+
210
+ if (fix) {
211
+ return debugWithAnalysis(analysis, projectPath, options);
212
+ }
213
+ }
214
+ } catch (error) {
215
+ printError(error.message);
216
+ }
217
+ }
218
+
219
+ /**
220
+ * Handle clipboard image debug
221
+ */
222
+ async function handleClipboardDebug(projectPath, options) {
223
+ const analyzer = new ImageAnalyzer(projectPath);
224
+
225
+ try {
226
+ const analysis = await analyzer.analyzeClipboard();
227
+ console.log(analyzer.formatAnalysis(analysis));
228
+
229
+ // If error detected, ask to fix
230
+ if (analysis.errorType && analysis.suggestedFix) {
231
+ const { fix } = await inquirer.prompt([{
232
+ type: 'confirm',
233
+ name: 'fix',
234
+ message: 'Apply suggested fix?',
235
+ default: true
236
+ }]);
237
+
238
+ if (fix) {
239
+ return debugWithAnalysis(analysis, projectPath, options);
240
+ }
241
+ }
242
+ } catch (error) {
243
+ printError(error.message);
244
+ }
245
+ }
246
+
247
+ /**
248
+ * Debug with analysis from image
249
+ */
250
+ async function debugWithAnalysis(analysis, projectPath, options) {
251
+ // Build error description from analysis
252
+ const errorDescription = [
253
+ analysis.errorType,
254
+ analysis.errorMessage,
255
+ analysis.location ? `at ${analysis.location}` : '',
256
+ analysis.rootCause ? `Cause: ${analysis.rootCause}` : ''
257
+ ].filter(Boolean).join(' - ');
258
+
259
+ console.log(chalk.cyan(`\n Attempting to fix: ${analysis.errorType}\n`));
260
+
261
+ // Create debug engine and run
262
+ const engine = createDebugEngine(projectPath, {
263
+ autoFix: true,
264
+ maxAttempts: options.attempts || 3,
265
+ verbose: options.verbose || false,
266
+ interactive: !options.quiet
267
+ });
268
+
269
+ const input = {
270
+ description: errorDescription,
271
+ suggestedFix: analysis.suggestedFix,
272
+ fromImage: true
273
+ };
274
+
275
+ const result = await engine.debug(input);
276
+
277
+ // Show result
278
+ if (result.status === 'resolved') {
279
+ printSuccess('Bug fixed successfully!');
280
+ } else {
281
+ printWarning('Could not auto-fix. Try: vibecode assist "' + analysis.errorMessage + '"');
282
+ }
283
+ }
284
+
180
285
  /**
181
286
  * Show debug command help
182
287
  */
@@ -191,11 +296,13 @@ Usage:
191
296
  vibecode debug --auto Auto-scan project for errors
192
297
  vibecode debug --log "error text" Fix from error log
193
298
  vibecode debug --image path/to/img Fix from screenshot
299
+ vibecode debug --clipboard Fix from clipboard image
194
300
 
195
301
  Options:
196
302
  --auto Auto-scan mode - find and fix errors
197
303
  --log <text> Provide error log directly
198
304
  --image <path> Provide error screenshot
305
+ --clipboard Analyze image from clipboard
199
306
  --attempts <n> Max fix attempts (default: 3)
200
307
  --verbose Show detailed output
201
308
  --quiet Minimal output
@@ -204,7 +311,8 @@ Examples:
204
311
  vibecode debug "Cannot read property of undefined"
205
312
  vibecode debug --auto
206
313
  vibecode debug --log "TypeError: x is not a function"
207
- vibecode debug --attempts 5 "module not found"`, { borderColor: 'cyan' });
314
+ vibecode debug --image ./error-screenshot.png
315
+ vibecode debug --clipboard`, { borderColor: 'cyan' });
208
316
  console.log();
209
317
  }
210
318
 
@@ -0,0 +1,167 @@
1
+ // ═══════════════════════════════════════════════════════════════════════════════
2
+ // VIBECODE CLI - Docs Command
3
+ // Phase K3: AI Documentation Generation
4
+ // ═══════════════════════════════════════════════════════════════════════════════
5
+
6
+ import { spawn } from 'child_process';
7
+ import fs from 'fs/promises';
8
+ import path from 'path';
9
+ import chalk from 'chalk';
10
+ import inquirer from 'inquirer';
11
+
12
+ export async function docsCommand(options = {}) {
13
+ const cwd = process.cwd();
14
+
15
+ if (options.generate || options.type) {
16
+ return generateDocs(cwd, options);
17
+ }
18
+
19
+ // Interactive menu
20
+ const { action } = await inquirer.prompt([{
21
+ type: 'list',
22
+ name: 'action',
23
+ message: 'Documentation options:',
24
+ choices: [
25
+ { name: 'šŸ“ Generate README.md', value: 'readme' },
26
+ { name: 'šŸ“š Generate API docs', value: 'api' },
27
+ { name: 'šŸ—ļø Generate Architecture docs', value: 'architecture' },
28
+ { name: 'šŸ’¬ Add JSDoc comments', value: 'jsdoc' },
29
+ { name: 'šŸ“¦ Generate all docs', value: 'all' },
30
+ { name: 'šŸ‘‹ Exit', value: 'exit' }
31
+ ]
32
+ }]);
33
+
34
+ if (action === 'exit') return;
35
+
36
+ return generateDocs(cwd, { ...options, type: action });
37
+ }
38
+
39
+ async function generateDocs(cwd, options) {
40
+ const docType = options.type || 'all';
41
+
42
+ console.log(chalk.cyan(`
43
+ ╭────────────────────────────────────────────────────────────────────╮
44
+ │ šŸ“š DOCUMENTATION GENERATION │
45
+ │ │
46
+ │ Type: ${docType.padEnd(56)}│
47
+ │ │
48
+ ╰────────────────────────────────────────────────────────────────────╯
49
+ `));
50
+
51
+ const prompts = {
52
+ readme: `
53
+ # Generate README.md
54
+
55
+ Analyze this project and generate a comprehensive README.md:
56
+
57
+ 1. **Project Title & Description**: What does this project do?
58
+ 2. **Features**: Key features list with brief descriptions
59
+ 3. **Installation**: Step-by-step installation guide
60
+ 4. **Usage**: Basic usage examples with code snippets
61
+ 5. **API Reference**: Main functions/endpoints (brief overview)
62
+ 6. **Configuration**: Environment variables, config files
63
+ 7. **Contributing**: How to contribute
64
+ 8. **License**: MIT or detected license
65
+
66
+ Make it professional, clear, and helpful. Include badges if appropriate.
67
+ `,
68
+ api: `
69
+ # Generate API Documentation
70
+
71
+ Analyze the codebase and generate API documentation:
72
+
73
+ 1. For each public function/method:
74
+ - Name, description
75
+ - Parameters with types
76
+ - Return value
77
+ - Example usage
78
+ - Throws/errors
79
+
80
+ 2. For REST endpoints (if any):
81
+ - Method, path
82
+ - Request body
83
+ - Response format
84
+ - Status codes
85
+ - Example requests/responses
86
+
87
+ 3. For React components (if any):
88
+ - Props with types
89
+ - Usage examples
90
+
91
+ Output in Markdown format suitable for docs site.
92
+ Create docs/API.md
93
+ `,
94
+ architecture: `
95
+ # Generate Architecture Documentation
96
+
97
+ Analyze and document the architecture:
98
+
99
+ 1. **System Overview**: High-level description
100
+ 2. **Directory Structure**: Explain each folder's purpose
101
+ 3. **Core Components**: Main modules and their responsibilities
102
+ 4. **Data Flow**: How data moves through the system
103
+ 5. **Dependencies**: Key dependencies and why they're used
104
+ 6. **Diagrams**: Generate Mermaid diagrams for:
105
+ - Component diagram
106
+ - Sequence diagram for main flows
107
+ - Data model (if applicable)
108
+
109
+ Output in Markdown with Mermaid blocks.
110
+ Create docs/ARCHITECTURE.md
111
+ `,
112
+ jsdoc: `
113
+ # Add JSDoc Comments
114
+
115
+ For each function, class, and method in the codebase:
116
+
117
+ 1. Add JSDoc comments with:
118
+ - @description - What it does
119
+ - @param for each parameter with type and description
120
+ - @returns - Return value with type
121
+ - @throws (if applicable)
122
+ - @example - Usage example
123
+
124
+ 2. Add type annotations where missing
125
+ 3. Don't modify function logic, only add comments
126
+ 4. Use TypeScript types in JSDoc if .ts files
127
+
128
+ Apply to all .js/.ts files in src/
129
+ `,
130
+ all: `
131
+ # Generate Complete Documentation
132
+
133
+ Create comprehensive documentation:
134
+
135
+ 1. **README.md** - Project overview, installation, usage
136
+ 2. **docs/API.md** - API reference
137
+ 3. **docs/ARCHITECTURE.md** - System architecture with diagrams
138
+ 4. Add JSDoc comments to key source files
139
+
140
+ Make documentation professional and thorough.
141
+ `
142
+ };
143
+
144
+ const prompt = prompts[docType] || prompts.all;
145
+
146
+ const promptFile = path.join(cwd, '.vibecode', 'docs-prompt.md');
147
+ await fs.mkdir(path.dirname(promptFile), { recursive: true });
148
+ await fs.writeFile(promptFile, prompt);
149
+
150
+ console.log(chalk.gray(' Generating documentation with Claude Code...\n'));
151
+
152
+ await runClaudeCode(prompt, cwd);
153
+
154
+ console.log(chalk.green('\nāœ… Documentation generated!\n'));
155
+ }
156
+
157
+ async function runClaudeCode(prompt, cwd) {
158
+ return new Promise((resolve) => {
159
+ const child = spawn('claude', ['-p', prompt, '--dangerously-skip-permissions'], {
160
+ cwd,
161
+ stdio: 'inherit'
162
+ });
163
+
164
+ child.on('close', resolve);
165
+ child.on('error', () => resolve());
166
+ });
167
+ }