claude-cli-advanced-starter-pack 1.0.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 (67) hide show
  1. package/LICENSE +21 -0
  2. package/OVERVIEW.md +597 -0
  3. package/README.md +439 -0
  4. package/bin/gtask.js +282 -0
  5. package/bin/postinstall.js +53 -0
  6. package/package.json +69 -0
  7. package/src/agents/phase-dev-templates.js +1011 -0
  8. package/src/agents/templates.js +668 -0
  9. package/src/analysis/checklist-parser.js +414 -0
  10. package/src/analysis/codebase.js +481 -0
  11. package/src/cli/menu.js +958 -0
  12. package/src/commands/claude-audit.js +1482 -0
  13. package/src/commands/claude-settings.js +2243 -0
  14. package/src/commands/create-agent.js +681 -0
  15. package/src/commands/create-command.js +337 -0
  16. package/src/commands/create-hook.js +262 -0
  17. package/src/commands/create-phase-dev/codebase-analyzer.js +813 -0
  18. package/src/commands/create-phase-dev/documentation-generator.js +352 -0
  19. package/src/commands/create-phase-dev/post-completion.js +404 -0
  20. package/src/commands/create-phase-dev/scale-calculator.js +344 -0
  21. package/src/commands/create-phase-dev/wizard.js +492 -0
  22. package/src/commands/create-phase-dev.js +481 -0
  23. package/src/commands/create-skill.js +313 -0
  24. package/src/commands/create.js +446 -0
  25. package/src/commands/decompose.js +392 -0
  26. package/src/commands/detect-tech-stack.js +768 -0
  27. package/src/commands/explore-mcp/claude-md-updater.js +252 -0
  28. package/src/commands/explore-mcp/mcp-installer.js +346 -0
  29. package/src/commands/explore-mcp/mcp-registry.js +438 -0
  30. package/src/commands/explore-mcp.js +638 -0
  31. package/src/commands/gtask-init.js +641 -0
  32. package/src/commands/help.js +128 -0
  33. package/src/commands/init.js +1890 -0
  34. package/src/commands/install.js +250 -0
  35. package/src/commands/list.js +116 -0
  36. package/src/commands/roadmap.js +750 -0
  37. package/src/commands/setup-wizard.js +482 -0
  38. package/src/commands/setup.js +351 -0
  39. package/src/commands/sync.js +534 -0
  40. package/src/commands/test-run.js +456 -0
  41. package/src/commands/test-setup.js +456 -0
  42. package/src/commands/validate.js +67 -0
  43. package/src/config/tech-stack.defaults.json +182 -0
  44. package/src/config/tech-stack.schema.json +502 -0
  45. package/src/github/client.js +359 -0
  46. package/src/index.js +84 -0
  47. package/src/templates/claude-command.js +244 -0
  48. package/src/templates/issue-body.js +284 -0
  49. package/src/testing/config.js +411 -0
  50. package/src/utils/template-engine.js +398 -0
  51. package/src/utils/validate-templates.js +223 -0
  52. package/src/utils.js +396 -0
  53. package/templates/commands/ccasp-setup.template.md +113 -0
  54. package/templates/commands/context-audit.template.md +97 -0
  55. package/templates/commands/create-task-list.template.md +382 -0
  56. package/templates/commands/deploy-full.template.md +261 -0
  57. package/templates/commands/github-task-start.template.md +99 -0
  58. package/templates/commands/github-update.template.md +69 -0
  59. package/templates/commands/happy-start.template.md +117 -0
  60. package/templates/commands/phase-track.template.md +142 -0
  61. package/templates/commands/tunnel-start.template.md +127 -0
  62. package/templates/commands/tunnel-stop.template.md +106 -0
  63. package/templates/hooks/context-guardian.template.js +173 -0
  64. package/templates/hooks/deployment-orchestrator.template.js +219 -0
  65. package/templates/hooks/github-progress-hook.template.js +197 -0
  66. package/templates/hooks/happy-checkpoint-manager.template.js +222 -0
  67. package/templates/hooks/phase-dev-enforcer.template.js +183 -0
@@ -0,0 +1,481 @@
1
+ /**
2
+ * Create Phase Dev Command
3
+ *
4
+ * Main orchestrator for phased development plan generation.
5
+ * Creates comprehensive documentation with 95%+ success probability.
6
+ */
7
+
8
+ import chalk from 'chalk';
9
+ import inquirer from 'inquirer';
10
+ import { showHeader } from '../cli/menu.js';
11
+ import { runWizard, promptEnhancements } from './create-phase-dev/wizard.js';
12
+ import {
13
+ calculateProjectScale,
14
+ adjustForEnhancements,
15
+ forceScale,
16
+ } from './create-phase-dev/scale-calculator.js';
17
+ import {
18
+ generatePhaseDevDocumentation,
19
+ displayGenerationResults,
20
+ generateBackendConfig,
21
+ createGitCheckpoint,
22
+ } from './create-phase-dev/documentation-generator.js';
23
+ import { showPostCompletionHandler } from './create-phase-dev/post-completion.js';
24
+
25
+ /**
26
+ * Run the create-phase-dev command
27
+ *
28
+ * @param {Object} options - CLI options
29
+ */
30
+ export async function runCreatePhaseDev(options = {}) {
31
+ showHeader('Phased Development Plan Generator');
32
+
33
+ console.log(chalk.dim('Create comprehensive development plans with 95%+ success probability.'));
34
+ console.log(chalk.dim('Generates documentation, RAG agents, and enforcement hooks.\n'));
35
+
36
+ // Check for autonomous mode
37
+ if (options.autonomous) {
38
+ return await runAutonomousMode(options);
39
+ }
40
+
41
+ // Step 0A: Enhancement options
42
+ const enhancements = await promptEnhancements();
43
+
44
+ // Step 0B: Git checkpoint (optional)
45
+ const { createCheckpoint } = await inquirer.prompt([
46
+ {
47
+ type: 'confirm',
48
+ name: 'createCheckpoint',
49
+ message: 'Create git checkpoint before generation?',
50
+ default: false,
51
+ },
52
+ ]);
53
+
54
+ let checkpoint = null;
55
+ if (createCheckpoint) {
56
+ checkpoint = await createGitCheckpoint(options.name || 'unnamed');
57
+ }
58
+
59
+ // Check for forced scale
60
+ if (options.scale) {
61
+ return await runWithForcedScale(options, enhancements, checkpoint);
62
+ }
63
+
64
+ // Steps 1-5: Interactive wizard
65
+ const wizardResult = await runWizard(options);
66
+
67
+ if (!wizardResult) {
68
+ console.log(chalk.yellow('\nPlan generation cancelled.'));
69
+ return null;
70
+ }
71
+
72
+ // Adjust for enhancements
73
+ const config = adjustForEnhancements(wizardResult, enhancements);
74
+
75
+ // Add backend configuration
76
+ config.backendConfig = generateBackendConfig(config.architecture);
77
+
78
+ // Step 5: Generate documentation
79
+ console.log('');
80
+ const results = await generatePhaseDevDocumentation(config, enhancements);
81
+
82
+ // Display results
83
+ displayGenerationResults(results);
84
+
85
+ // Step 6: Post-completion handler (MANDATORY)
86
+ await showPostCompletionHandler(config, results);
87
+
88
+ return {
89
+ config,
90
+ results,
91
+ checkpoint,
92
+ };
93
+ }
94
+
95
+ /**
96
+ * Run with forced scale (skip wizard but still auto-detect stack)
97
+ */
98
+ async function runWithForcedScale(options, enhancements, checkpoint) {
99
+ console.log(chalk.yellow(`\n⚡ Using forced scale: ${options.scale.toUpperCase()}\n`));
100
+
101
+ // Import codebase analyzer
102
+ const { analyzeCodebase, generateStackSummary, displayAnalysisResults } = await import(
103
+ './create-phase-dev/codebase-analyzer.js'
104
+ );
105
+
106
+ // Auto-detect tech stack
107
+ console.log(chalk.dim('Analyzing codebase...\n'));
108
+ const analysis = await analyzeCodebase(process.cwd());
109
+ displayAnalysisResults(analysis);
110
+
111
+ // Get minimal project info
112
+ const { projectName, projectSlug, description } = await inquirer.prompt([
113
+ {
114
+ type: 'input',
115
+ name: 'projectName',
116
+ message: 'Project name:',
117
+ default: options.name || '',
118
+ validate: (input) => input.length > 0 || 'Required',
119
+ },
120
+ {
121
+ type: 'input',
122
+ name: 'projectSlug',
123
+ message: 'Project slug (kebab-case):',
124
+ default: (answers) =>
125
+ answers.projectName
126
+ .toLowerCase()
127
+ .replace(/[^a-z0-9]+/g, '-')
128
+ .replace(/^-|-$/g, ''),
129
+ },
130
+ {
131
+ type: 'input',
132
+ name: 'description',
133
+ message: 'Brief description:',
134
+ default: 'Phased development project',
135
+ },
136
+ ]);
137
+
138
+ // Confirm or override detected stack
139
+ const { useDetected } = await inquirer.prompt([
140
+ {
141
+ type: 'confirm',
142
+ name: 'useDetected',
143
+ message: 'Use detected tech stack?',
144
+ default: analysis.confidence !== 'low',
145
+ },
146
+ ]);
147
+
148
+ let architecture;
149
+ if (useDetected && analysis.confidence !== 'low') {
150
+ // Build architecture from analysis
151
+ architecture = {
152
+ frontend: analysis.frontend.detected
153
+ ? { framework: analysis.frontend.framework, language: analysis.frontend.language }
154
+ : null,
155
+ backend: analysis.backend.detected
156
+ ? { framework: analysis.backend.framework, language: analysis.backend.language }
157
+ : null,
158
+ database: analysis.database.detected
159
+ ? { type: analysis.database.type, orm: analysis.database.orm }
160
+ : null,
161
+ deployment: analysis.deployment.detected
162
+ ? { platform: analysis.deployment.platform }
163
+ : null,
164
+ needsAuth: true,
165
+ needsRealtime: false,
166
+ summary: generateStackSummary(analysis),
167
+ autoDetected: true,
168
+ };
169
+ } else {
170
+ // Minimal manual prompts
171
+ const manualArch = await inquirer.prompt([
172
+ {
173
+ type: 'list',
174
+ name: 'frontend',
175
+ message: 'Frontend:',
176
+ choices: [
177
+ { name: 'React', value: 'react' },
178
+ { name: 'Vue', value: 'vue' },
179
+ { name: 'Angular', value: 'angular' },
180
+ { name: 'Next.js', value: 'nextjs' },
181
+ { name: 'None', value: 'none' },
182
+ { name: 'Other', value: 'other' },
183
+ ],
184
+ },
185
+ {
186
+ type: 'list',
187
+ name: 'backend',
188
+ message: 'Backend:',
189
+ choices: [
190
+ { name: 'Express (Node)', value: 'express' },
191
+ { name: 'FastAPI (Python)', value: 'fastapi' },
192
+ { name: 'Django (Python)', value: 'django' },
193
+ { name: 'Rails (Ruby)', value: 'rails' },
194
+ { name: 'None', value: 'none' },
195
+ { name: 'Other', value: 'other' },
196
+ ],
197
+ },
198
+ {
199
+ type: 'list',
200
+ name: 'database',
201
+ message: 'Database:',
202
+ choices: [
203
+ { name: 'PostgreSQL', value: 'postgresql' },
204
+ { name: 'MySQL', value: 'mysql' },
205
+ { name: 'MongoDB', value: 'mongodb' },
206
+ { name: 'SQLite', value: 'sqlite' },
207
+ { name: 'None', value: 'none' },
208
+ ],
209
+ },
210
+ {
211
+ type: 'confirm',
212
+ name: 'needsAuth',
213
+ message: 'Requires auth?',
214
+ default: true,
215
+ },
216
+ {
217
+ type: 'confirm',
218
+ name: 'needsRealtime',
219
+ message: 'Requires WebSocket?',
220
+ default: false,
221
+ },
222
+ ]);
223
+
224
+ const parts = [];
225
+ if (manualArch.frontend !== 'none') parts.push(manualArch.frontend);
226
+ if (manualArch.backend !== 'none') parts.push(manualArch.backend);
227
+ if (manualArch.database !== 'none') parts.push(manualArch.database);
228
+
229
+ architecture = {
230
+ frontend: manualArch.frontend !== 'none' ? { framework: manualArch.frontend } : null,
231
+ backend: manualArch.backend !== 'none' ? { framework: manualArch.backend } : null,
232
+ database: manualArch.database !== 'none' ? { type: manualArch.database } : null,
233
+ deployment: null,
234
+ needsAuth: manualArch.needsAuth,
235
+ needsRealtime: manualArch.needsRealtime,
236
+ summary: parts.join(' | ') || 'Minimal stack',
237
+ autoDetected: false,
238
+ };
239
+ }
240
+
241
+ // Generate scale result
242
+ const scaleResult = forceScale(options.scale, {});
243
+
244
+ // Build config
245
+ const config = adjustForEnhancements(
246
+ {
247
+ projectName,
248
+ projectSlug,
249
+ description,
250
+ architecture,
251
+ analysis,
252
+ scope: { linesOfCode: 'medium', components: 'several' },
253
+ ...scaleResult,
254
+ },
255
+ enhancements
256
+ );
257
+
258
+ config.backendConfig = generateBackendConfig(architecture);
259
+
260
+ // Generate documentation
261
+ console.log('');
262
+ const results = await generatePhaseDevDocumentation(config, enhancements);
263
+
264
+ displayGenerationResults(results);
265
+
266
+ await showPostCompletionHandler(config, results);
267
+
268
+ return { config, results, checkpoint };
269
+ }
270
+
271
+ /**
272
+ * Run in autonomous mode (auto-detect stack, minimal prompts)
273
+ */
274
+ async function runAutonomousMode(options) {
275
+ console.log(chalk.yellow('\n⚡ Autonomous mode: auto-detecting stack\n'));
276
+
277
+ if (!options.name) {
278
+ console.log(chalk.red('Error: --name required for autonomous mode'));
279
+ return null;
280
+ }
281
+
282
+ // Import codebase analyzer
283
+ const { analyzeCodebase, generateStackSummary } = await import(
284
+ './create-phase-dev/codebase-analyzer.js'
285
+ );
286
+
287
+ const projectName = options.name;
288
+ const projectSlug = projectName
289
+ .toLowerCase()
290
+ .replace(/[^a-z0-9]+/g, '-')
291
+ .replace(/^-|-$/g, '');
292
+
293
+ // Default scale is Medium
294
+ const scale = options.scale || 'M';
295
+
296
+ // Auto-detect tech stack
297
+ console.log(chalk.dim('Analyzing codebase...'));
298
+ const analysis = await analyzeCodebase(process.cwd());
299
+
300
+ // Build architecture from analysis (use whatever is detected)
301
+ const architecture = {
302
+ frontend: analysis.frontend.detected
303
+ ? { framework: analysis.frontend.framework, language: analysis.frontend.language }
304
+ : null,
305
+ backend: analysis.backend.detected
306
+ ? { framework: analysis.backend.framework, language: analysis.backend.language }
307
+ : null,
308
+ database: analysis.database.detected
309
+ ? { type: analysis.database.type, orm: analysis.database.orm }
310
+ : null,
311
+ deployment: analysis.deployment.detected
312
+ ? { platform: analysis.deployment.platform }
313
+ : null,
314
+ needsAuth: true,
315
+ needsRealtime: false,
316
+ summary: generateStackSummary(analysis),
317
+ autoDetected: true,
318
+ };
319
+
320
+ console.log(chalk.dim(`Detected: ${architecture.summary}\n`));
321
+
322
+ // Default enhancements
323
+ const enhancements = ['parallel', 'testing', 'hooks'];
324
+
325
+ // Generate scale result
326
+ const scaleResult = forceScale(scale, {});
327
+
328
+ // Build config
329
+ const config = adjustForEnhancements(
330
+ {
331
+ projectName,
332
+ projectSlug,
333
+ description: `Autonomous phased development for ${projectName}`,
334
+ architecture,
335
+ analysis,
336
+ scope: { linesOfCode: 'medium', components: 'several' },
337
+ ...scaleResult,
338
+ },
339
+ enhancements
340
+ );
341
+
342
+ config.backendConfig = generateBackendConfig(architecture);
343
+
344
+ // Generate documentation
345
+ console.log('');
346
+ const results = await generatePhaseDevDocumentation(config, enhancements);
347
+
348
+ displayGenerationResults(results);
349
+
350
+ // Show summary (but skip interactive menu in autonomous mode)
351
+ console.log(chalk.green('\n✅ Plan generated successfully'));
352
+ console.log(chalk.dim(`\nTo start: /phase-dev-${projectSlug}`));
353
+ console.log(chalk.dim(`Progress: .claude/docs/${projectSlug}/PROGRESS.json`));
354
+
355
+ return { config, results };
356
+ }
357
+
358
+ /**
359
+ * Show main menu for create-phase-dev
360
+ */
361
+ export async function showPhasDevMainMenu() {
362
+ const { mode } = await inquirer.prompt([
363
+ {
364
+ type: 'list',
365
+ name: 'mode',
366
+ message: 'What would you like to do?',
367
+ choices: [
368
+ {
369
+ name: `${chalk.green('1)')} Create New Plan Full interactive wizard`,
370
+ value: 'new',
371
+ short: 'Create New',
372
+ },
373
+ {
374
+ name: `${chalk.cyan('2)')} Quick Plan (S) Small project (2 phases)`,
375
+ value: 'quick-s',
376
+ short: 'Quick S',
377
+ },
378
+ {
379
+ name: `${chalk.cyan('3)')} Quick Plan (M) Medium project (3-4 phases)`,
380
+ value: 'quick-m',
381
+ short: 'Quick M',
382
+ },
383
+ {
384
+ name: `${chalk.cyan('4)')} Quick Plan (L) Large project (5+ phases)`,
385
+ value: 'quick-l',
386
+ short: 'Quick L',
387
+ },
388
+ new inquirer.Separator(),
389
+ {
390
+ name: `${chalk.dim('H)')} Help & Examples`,
391
+ value: 'help',
392
+ short: 'Help',
393
+ },
394
+ {
395
+ name: `${chalk.dim('Q)')} Back to main menu`,
396
+ value: 'back',
397
+ short: 'Back',
398
+ },
399
+ ],
400
+ },
401
+ ]);
402
+
403
+ switch (mode) {
404
+ case 'new':
405
+ return await runCreatePhaseDev({});
406
+ case 'quick-s':
407
+ return await runCreatePhaseDev({ scale: 'S' });
408
+ case 'quick-m':
409
+ return await runCreatePhaseDev({ scale: 'M' });
410
+ case 'quick-l':
411
+ return await runCreatePhaseDev({ scale: 'L' });
412
+ case 'help':
413
+ showPhaseDevHelp();
414
+ return await showPhasDevMainMenu();
415
+ case 'back':
416
+ return null;
417
+ default:
418
+ return null;
419
+ }
420
+ }
421
+
422
+ /**
423
+ * Show help for phase-dev
424
+ */
425
+ function showPhaseDevHelp() {
426
+ console.log(chalk.cyan.bold('\n📚 Phased Development Help\n'));
427
+
428
+ console.log(chalk.white.bold('What is Phased Development?'));
429
+ console.log(
430
+ chalk.dim(`
431
+ A structured approach to complex projects that:
432
+ - Breaks work into sequential phases
433
+ - Tracks progress with PROGRESS.json
434
+ - Generates RAG agents for autonomous execution
435
+ - Creates enforcement hooks for quality
436
+ - Achieves 95%+ success rate
437
+ `)
438
+ );
439
+
440
+ console.log(chalk.white.bold('Scales:'));
441
+ console.log(
442
+ chalk.dim(`
443
+ S (Small) - 2 phases, 10-30 tasks
444
+ Focused features or bug fixes
445
+
446
+ M (Medium) - 3-4 phases, 30-80 tasks
447
+ Multi-component features
448
+
449
+ L (Large) - 5-8 phases, 80-200 tasks
450
+ Major overhauls or new modules
451
+ `)
452
+ );
453
+
454
+ console.log(chalk.white.bold('Generated Files:'));
455
+ console.log(
456
+ chalk.dim(`
457
+ .claude/docs/{slug}/
458
+ PROGRESS.json - Task tracking and state
459
+ EXECUTIVE_SUMMARY.md - Project overview
460
+ API_ENDPOINTS.md - Backend endpoints (if backend detected)
461
+ DATABASE_SCHEMA.md - Database schema (adapts to your DB)
462
+
463
+ .claude/agents/{slug}-phase-executor-agent.md
464
+ RAG agent for autonomous execution
465
+
466
+ .claude/commands/phase-dev-{slug}.md
467
+ Interactive slash command
468
+ `)
469
+ );
470
+
471
+ console.log(chalk.white.bold('CLI Usage:'));
472
+ console.log(
473
+ chalk.dim(`
474
+ gtask create-phase-dev # Interactive wizard
475
+ gtask create-phase-dev --scale M # Force medium scale
476
+ gtask create-phase-dev --autonomous --name "My Project"
477
+ `)
478
+ );
479
+
480
+ console.log('');
481
+ }