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,482 @@
1
+ /**
2
+ * CCASP Setup Wizard
3
+ *
4
+ * Vibe-code friendly setup wizard with minimal typing.
5
+ * Designed for mobile/remote use with numbered options.
6
+ */
7
+
8
+ import inquirer from 'inquirer';
9
+ import chalk from 'chalk';
10
+ import ora from 'ora';
11
+ import boxen from 'boxen';
12
+ import { existsSync, mkdirSync, writeFileSync, readFileSync } from 'fs';
13
+ import { join } from 'path';
14
+ import { runInit } from './init.js';
15
+ import { detectTechStack } from './detect-tech-stack.js';
16
+ import { runClaudeAudit, runEnhancement } from './claude-audit.js';
17
+ import { runSetup as runGitHubSetup } from './setup.js';
18
+ import { runList } from './list.js';
19
+ import { showProjectSettingsMenu } from '../cli/menu.js';
20
+
21
+ /**
22
+ * Display setup header
23
+ */
24
+ function showSetupHeader() {
25
+ console.log(
26
+ boxen(
27
+ chalk.bold.cyan('🚀 CCASP Setup Wizard\n\n') +
28
+ chalk.dim('Vibe-code friendly • Minimal typing • Mobile-ready'),
29
+ {
30
+ padding: 1,
31
+ borderStyle: 'round',
32
+ borderColor: 'cyan',
33
+ }
34
+ )
35
+ );
36
+ }
37
+
38
+ /**
39
+ * Quick setup options - numbered for easy mobile input
40
+ */
41
+ const SETUP_OPTIONS = [
42
+ {
43
+ name: `${chalk.yellow('1.')} Quick Start ${chalk.dim('- Detect stack + init .claude')}`,
44
+ value: 'quick',
45
+ short: 'Quick Start',
46
+ },
47
+ {
48
+ name: `${chalk.yellow('2.')} Full Setup ${chalk.dim('- All features + customization')}`,
49
+ value: 'full',
50
+ short: 'Full Setup',
51
+ },
52
+ {
53
+ name: `${chalk.yellow('3.')} GitHub Setup ${chalk.dim('- Connect project board')}`,
54
+ value: 'github',
55
+ short: 'GitHub',
56
+ },
57
+ {
58
+ name: `${chalk.yellow('4.')} Audit CLAUDE.md ${chalk.dim('- Check existing config')}`,
59
+ value: 'audit',
60
+ short: 'Audit',
61
+ },
62
+ {
63
+ name: `${chalk.yellow('5.')} Enhance CLAUDE.md ${chalk.dim('- Generate/improve docs')}`,
64
+ value: 'enhance',
65
+ short: 'Enhance',
66
+ },
67
+ {
68
+ name: `${chalk.yellow('6.')} Detect Tech Stack ${chalk.dim('- Auto-detect project')}`,
69
+ value: 'detect',
70
+ short: 'Detect',
71
+ },
72
+ {
73
+ name: `${chalk.yellow('7.')} View Templates ${chalk.dim('- Browse available items')}`,
74
+ value: 'templates',
75
+ short: 'Templates',
76
+ },
77
+ {
78
+ name: `${chalk.yellow('8.')} Project Settings ${chalk.dim('- Configure deployment, tunnels, etc.')}`,
79
+ value: 'settings',
80
+ short: 'Settings',
81
+ },
82
+ {
83
+ name: `${chalk.yellow('0.')} Exit`,
84
+ value: 'exit',
85
+ short: 'Exit',
86
+ },
87
+ ];
88
+
89
+ /**
90
+ * Feature selection for quick setup - simplified for vibe coding
91
+ */
92
+ const QUICK_FEATURE_PRESETS = [
93
+ {
94
+ name: `${chalk.green('A.')} Minimal ${chalk.dim('- Menu + help only')}`,
95
+ value: 'minimal',
96
+ features: [], // Essential commands always included
97
+ },
98
+ {
99
+ name: `${chalk.green('B.')} Standard ${chalk.dim('- GitHub + phased dev (recommended)')}`,
100
+ value: 'standard',
101
+ features: ['githubIntegration', 'phasedDevelopment'],
102
+ },
103
+ {
104
+ name: `${chalk.green('C.')} Full ${chalk.dim('- All features including deployment')}`,
105
+ value: 'full',
106
+ features: ['githubIntegration', 'phasedDevelopment', 'deploymentAutomation', 'tunnelServices', 'tokenManagement'],
107
+ },
108
+ {
109
+ name: `${chalk.green('D.')} Custom ${chalk.dim('- Pick individual features')}`,
110
+ value: 'custom',
111
+ features: [],
112
+ },
113
+ ];
114
+
115
+ /**
116
+ * Individual features for custom selection
117
+ * NOTE: These values MUST match the feature names in init.js OPTIONAL_FEATURES
118
+ */
119
+ const INDIVIDUAL_FEATURES = [
120
+ { name: 'Essential commands (menu, help)', value: 'essential', checked: true },
121
+ { name: 'GitHub Project Board integration (*)', value: 'githubIntegration', checked: false },
122
+ { name: 'Token Budget Management', value: 'tokenManagement', checked: false },
123
+ { name: 'Phased Development System', value: 'phasedDevelopment', checked: false },
124
+ { name: 'Deployment Automation (*)', value: 'deploymentAutomation', checked: false },
125
+ { name: 'Tunnel Services (*)', value: 'tunnelServices', checked: false },
126
+ { name: 'Happy Mode Integration (*)', value: 'happyMode', checked: false },
127
+ ];
128
+
129
+ /**
130
+ * Map generic preset feature names to init.js OPTIONAL_FEATURES names
131
+ */
132
+ const FEATURE_NAME_MAP = {
133
+ essential: 'essential',
134
+ github: 'githubIntegration',
135
+ testing: 'phasedDevelopment', // Testing uses phased dev for Ralph loop
136
+ deployment: 'deploymentAutomation',
137
+ agents: 'agents', // Not a direct feature, handled separately
138
+ hooks: 'hooks', // Not a direct feature, handled separately
139
+ tunnel: 'tunnelServices',
140
+ token: 'tokenManagement',
141
+ happy: 'happyMode',
142
+ phasedDev: 'phasedDevelopment',
143
+ };
144
+
145
+ /**
146
+ * Translate preset features to init.js compatible feature names
147
+ */
148
+ function translateFeatures(presetFeatures) {
149
+ return presetFeatures
150
+ .map((f) => FEATURE_NAME_MAP[f] || f)
151
+ .filter((f) => f !== 'essential'); // essential is always included
152
+ }
153
+
154
+ /**
155
+ * Run quick setup with auto-detection
156
+ */
157
+ async function runQuickSetup() {
158
+ const spinner = ora('Detecting tech stack...').start();
159
+
160
+ try {
161
+ const techStack = await detectTechStack(process.cwd());
162
+ spinner.succeed('Tech stack detected!');
163
+
164
+ // Show detected stack
165
+ console.log('\n' + chalk.bold('Detected:'));
166
+ if (techStack.frontend?.framework) {
167
+ console.log(` ${chalk.cyan('Frontend:')} ${techStack.frontend.framework}`);
168
+ }
169
+ if (techStack.backend?.framework) {
170
+ console.log(` ${chalk.cyan('Backend:')} ${techStack.backend.framework}`);
171
+ }
172
+ if (techStack.database?.type) {
173
+ console.log(` ${chalk.cyan('Database:')} ${techStack.database.type}`);
174
+ }
175
+ if (techStack.testing?.framework) {
176
+ console.log(` ${chalk.cyan('Testing:')} ${techStack.testing.framework}`);
177
+ }
178
+ if (techStack.deployment?.platform) {
179
+ console.log(` ${chalk.cyan('Deploy:')} ${techStack.deployment.platform}`);
180
+ }
181
+ console.log('');
182
+
183
+ // Preset selection - vibe-code friendly (single letter/number)
184
+ const { preset } = await inquirer.prompt([
185
+ {
186
+ type: 'list',
187
+ name: 'preset',
188
+ message: 'Select feature preset:',
189
+ choices: QUICK_FEATURE_PRESETS,
190
+ pageSize: 10,
191
+ },
192
+ ]);
193
+
194
+ let features;
195
+ const selectedPreset = QUICK_FEATURE_PRESETS.find((p) => p.value === preset);
196
+
197
+ if (preset === 'custom') {
198
+ const { customFeatures } = await inquirer.prompt([
199
+ {
200
+ type: 'checkbox',
201
+ name: 'customFeatures',
202
+ message: 'Select features (Space to toggle):',
203
+ choices: INDIVIDUAL_FEATURES,
204
+ pageSize: 10,
205
+ },
206
+ ]);
207
+ features = customFeatures;
208
+ } else {
209
+ features = selectedPreset.features;
210
+ }
211
+
212
+ // Run init with selected features
213
+ // Features are already in init.js-compatible format (INDIVIDUAL_FEATURES uses correct names)
214
+ spinner.start('Initializing .claude folder...');
215
+
216
+ // Check if any features require post-configuration
217
+ const featuresRequiringConfig = features.filter((f) =>
218
+ ['githubIntegration', 'deploymentAutomation', 'tunnelServices', 'happyMode'].includes(f)
219
+ );
220
+
221
+ await runInit({
222
+ techStack,
223
+ features,
224
+ minimal: preset === 'minimal',
225
+ skipPrompts: true,
226
+ });
227
+
228
+ spinner.succeed('.claude folder created!');
229
+
230
+ // Show which features need post-configuration
231
+ if (featuresRequiringConfig.length > 0) {
232
+ console.log(
233
+ chalk.yellow('\n⚠️ Some features require additional configuration:')
234
+ );
235
+ featuresRequiringConfig.forEach((f) => {
236
+ const labels = {
237
+ githubIntegration: 'GitHub Project Board',
238
+ deploymentAutomation: 'Deployment Platforms',
239
+ tunnelServices: 'Tunnel Service',
240
+ happyMode: 'Happy Mode',
241
+ };
242
+ console.log(` • ${labels[f] || f}`);
243
+ });
244
+ console.log(chalk.dim('\n Configure via: npx ccasp menu → Project Settings'));
245
+ }
246
+
247
+ // Offer to generate CLAUDE.md
248
+ const { generateClaudeMd } = await inquirer.prompt([
249
+ {
250
+ type: 'confirm',
251
+ name: 'generateClaudeMd',
252
+ message: 'Generate CLAUDE.md from detected stack?',
253
+ default: true,
254
+ },
255
+ ]);
256
+
257
+ if (generateClaudeMd) {
258
+ await runEnhancement({ techStack, mode: 'generate' });
259
+ }
260
+
261
+ showCompletionMessage();
262
+ return true;
263
+ } catch (error) {
264
+ spinner.fail('Setup failed');
265
+ console.error(chalk.red(error.message));
266
+ return false;
267
+ }
268
+ }
269
+
270
+ /**
271
+ * Show session restart reminder
272
+ */
273
+ function showRestartReminder() {
274
+ console.log(
275
+ boxen(
276
+ chalk.bold.yellow('⚠️ RESTART REQUIRED\n\n') +
277
+ chalk.white('Changes to .claude/ require a new session.\n\n') +
278
+ chalk.dim('To apply changes:\n') +
279
+ ` ${chalk.cyan('1.')} Exit Claude Code CLI (${chalk.yellow('Ctrl+C')} or ${chalk.yellow('/exit')})\n` +
280
+ ` ${chalk.cyan('2.')} Restart: ${chalk.yellow('claude')} or ${chalk.yellow('claude .')}\n` +
281
+ ` ${chalk.cyan('3.')} New commands will be available`,
282
+ {
283
+ padding: 1,
284
+ borderStyle: 'round',
285
+ borderColor: 'yellow',
286
+ }
287
+ )
288
+ );
289
+ }
290
+
291
+ /**
292
+ * Show completion message
293
+ */
294
+ function showCompletionMessage() {
295
+ console.log(
296
+ boxen(
297
+ chalk.bold.green('✅ Setup Complete!\n\n') +
298
+ chalk.white('Your .claude folder is ready.\n\n') +
299
+ chalk.dim('Next steps:\n') +
300
+ ` ${chalk.cyan('1.')} ${chalk.bold.yellow('RESTART')} Claude Code CLI for changes to take effect\n` +
301
+ ` ${chalk.cyan('2.')} Type ${chalk.yellow('/menu')} to see commands\n` +
302
+ ` ${chalk.cyan('3.')} Or type ${chalk.yellow('/ccasp-setup')} for this menu`,
303
+ {
304
+ padding: 1,
305
+ borderStyle: 'round',
306
+ borderColor: 'green',
307
+ }
308
+ )
309
+ );
310
+
311
+ // Show restart reminder
312
+ showRestartReminder();
313
+ }
314
+
315
+ /**
316
+ * Show available templates
317
+ */
318
+ async function showTemplates() {
319
+ console.log(chalk.bold('\n📦 Available Templates:\n'));
320
+
321
+ const templates = [
322
+ { name: 'Agent Template', desc: 'L1/L2/L3 agent hierarchy', cmd: 'ccasp create agent' },
323
+ { name: 'Hook Template', desc: 'Pre/Post tool hooks', cmd: 'ccasp create hook' },
324
+ { name: 'Skill Template', desc: 'RAG-enhanced skills', cmd: 'ccasp create skill' },
325
+ { name: 'Command Template', desc: 'Slash commands', cmd: 'ccasp create command' },
326
+ { name: 'Phase Dev Plan', desc: 'Phased development', cmd: 'ccasp create phase' },
327
+ ];
328
+
329
+ templates.forEach((t, i) => {
330
+ console.log(` ${chalk.yellow(i + 1 + '.')} ${chalk.cyan(t.name)}`);
331
+ console.log(` ${chalk.dim(t.desc)}`);
332
+ console.log(` ${chalk.dim('$')} ${t.cmd}\n`);
333
+ });
334
+
335
+ // Offer to run list command
336
+ const { viewMore } = await inquirer.prompt([
337
+ {
338
+ type: 'confirm',
339
+ name: 'viewMore',
340
+ message: 'View all available items?',
341
+ default: false,
342
+ },
343
+ ]);
344
+
345
+ if (viewMore) {
346
+ await runList();
347
+ }
348
+ }
349
+
350
+ /**
351
+ * Main setup wizard - entry point
352
+ */
353
+ export async function runSetupWizard(options = {}) {
354
+ showSetupHeader();
355
+
356
+ // Check if .claude already exists
357
+ const claudeDir = join(process.cwd(), '.claude');
358
+ const claudeMd = join(process.cwd(), 'CLAUDE.md');
359
+
360
+ if (existsSync(claudeDir)) {
361
+ console.log(chalk.yellow('\n⚠️ .claude folder exists in this project.\n'));
362
+ }
363
+ if (existsSync(claudeMd)) {
364
+ console.log(chalk.green('✓ CLAUDE.md exists\n'));
365
+ }
366
+
367
+ // Main menu loop
368
+ let running = true;
369
+ while (running) {
370
+ const { action } = await inquirer.prompt([
371
+ {
372
+ type: 'list',
373
+ name: 'action',
374
+ message: 'What would you like to do?',
375
+ choices: SETUP_OPTIONS,
376
+ pageSize: 10,
377
+ },
378
+ ]);
379
+
380
+ switch (action) {
381
+ case 'quick':
382
+ const quickSuccess = await runQuickSetup();
383
+ if (quickSuccess) running = false;
384
+ break;
385
+
386
+ case 'full':
387
+ await runInit({ interactive: true });
388
+ showRestartReminder();
389
+ running = false;
390
+ break;
391
+
392
+ case 'github':
393
+ await runGitHubSetup({});
394
+ // GitHub setup modifies .claude/ config
395
+ showRestartReminder();
396
+ break;
397
+
398
+ case 'audit':
399
+ await runClaudeAudit();
400
+ // Audit doesn't modify files, no restart needed
401
+ break;
402
+
403
+ case 'enhance':
404
+ await runEnhancement();
405
+ // Enhancement modifies CLAUDE.md which requires restart
406
+ showRestartReminder();
407
+ break;
408
+
409
+ case 'detect':
410
+ const spinner = ora('Detecting tech stack...').start();
411
+ try {
412
+ const techStack = await detectTechStack(process.cwd());
413
+ spinner.succeed('Detection complete!');
414
+ console.log(chalk.bold('\nDetected Tech Stack:'));
415
+ console.log(JSON.stringify(techStack, null, 2));
416
+ } catch (error) {
417
+ spinner.fail('Detection failed');
418
+ console.error(chalk.red(error.message));
419
+ }
420
+ console.log('');
421
+ break;
422
+
423
+ case 'templates':
424
+ await showTemplates();
425
+ break;
426
+
427
+ case 'settings':
428
+ // Check if .claude folder exists first
429
+ if (!existsSync(join(process.cwd(), '.claude'))) {
430
+ console.log(chalk.yellow('\n⚠️ No .claude folder found. Run Quick Start (1) or Full Setup (2) first.\n'));
431
+ } else {
432
+ await showProjectSettingsMenu();
433
+ // Settings modify tech-stack.json which may require restart
434
+ showRestartReminder();
435
+ }
436
+ break;
437
+
438
+ case 'exit':
439
+ running = false;
440
+ console.log(chalk.dim('\nRun `ccasp wizard` anytime to return.\n'));
441
+ break;
442
+ }
443
+ }
444
+ }
445
+
446
+ /**
447
+ * Generate slash command content for /ccasp-setup
448
+ */
449
+ export function generateSlashCommand() {
450
+ return `# CCASP Setup
451
+
452
+ Run the Claude CLI Advanced Starter Pack setup wizard.
453
+
454
+ ## Usage
455
+
456
+ This command launches the interactive setup wizard for configuring:
457
+ - .claude folder structure
458
+ - CLAUDE.md generation
459
+ - Tech stack detection
460
+ - GitHub project integration
461
+ - Agents, hooks, and skills
462
+
463
+ ## Quick Options
464
+
465
+ Reply with a number to jump to that option:
466
+ 1. Quick Start - Auto-detect and initialize
467
+ 2. Full Setup - All features with customization
468
+ 3. GitHub Setup - Connect to project board
469
+ 4. Audit - Check existing CLAUDE.md
470
+ 5. Enhance - Generate/improve CLAUDE.md
471
+ 6. Detect - Show detected tech stack
472
+ 7. Templates - Browse available templates
473
+
474
+ ## From Terminal
475
+
476
+ \`\`\`bash
477
+ npx ccasp wizard
478
+ \`\`\`
479
+ `;
480
+ }
481
+
482
+ export default runSetupWizard;