claude-cli-advanced-starter-pack 1.0.4 → 1.0.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.
@@ -233,6 +233,18 @@ const AVAILABLE_COMMANDS = [
233
233
  selected: false,
234
234
  feature: 'deploymentAutomation',
235
235
  },
236
+ {
237
+ name: 'project-impl',
238
+ description: 'Agent-powered project implementation (audit, enhance, detect, configure)',
239
+ category: 'Setup',
240
+ selected: true,
241
+ },
242
+ {
243
+ name: 'update-check',
244
+ description: 'Check for CCASP updates and add new features to your project',
245
+ category: 'Maintenance',
246
+ selected: true,
247
+ },
236
248
  ];
237
249
 
238
250
  /**
@@ -296,12 +308,32 @@ function generateMenuCommand(projectName, installedCommands, installedAgents, in
296
308
  }
297
309
  }
298
310
 
311
+ const ccaspVersion = getVersion();
312
+
299
313
  return `---
300
314
  description: Interactive project menu - Quick access to all commands, agents, skills, and tools
301
315
  ---
302
316
 
303
317
  # ${projectName} - Project Menu
304
318
 
319
+ ## IMPORTANT: Check Update State First
320
+
321
+ Before displaying the menu, read \`.claude/config/ccasp-state.json\` to check for updates:
322
+
323
+ \`\`\`javascript
324
+ {
325
+ "currentVersion": "1.0.5",
326
+ "latestVersion": "1.0.6",
327
+ "updateAvailable": true,
328
+ "updateHighlights": [...],
329
+ "updateFirstDisplayed": false
330
+ }
331
+ \`\`\`
332
+
333
+ ## Dynamic Menu Header
334
+
335
+ Build the header based on update state. Replace \`{{VERSION}}\` and \`{{UPDATE_STATUS}}\` dynamically:
336
+
305
337
  \`\`\`
306
338
  ╔═══════════════════════════════════════════════════════════════════════════════╗
307
339
  ║ ║
@@ -309,9 +341,50 @@ description: Interactive project menu - Quick access to all commands, agents, sk
309
341
  ║ ║ ║ ╠═╣║ ║ ║║║╣ ╠═╣ ║║╚╗╔╝╠═╣║║║║ ║╣ ║║ ╚═╗ ║ ╠═╣╠╦╝ ║ ║╣ ╠╦╝ ║
310
342
  ║ ╚═╝╩═╝╩ ╩╚═╝═╩╝╚═╝ ╩ ╩═╩╝ ╚╝ ╩ ╩╝╚╝╚═╝╚═╝═╩╝ ╚═╝ ╩ ╩ ╩╩╚═ ╩ ╚═╝╩╚═ ║
311
343
  ║ ║
312
- ${projectName.padEnd(40)}
344
+ ${projectName.padEnd(35)} v{{VERSION}} {{UPDATE_STATUS}}
313
345
  ║ ║
314
346
  ╠═══════════════════════════════════════════════════════════════════════════════╣
347
+ \`\`\`
348
+
349
+ **If update is available**, replace:
350
+ - \`{{VERSION}}\` with current version (e.g., "1.0.5")
351
+ - \`{{UPDATE_STATUS}}\` with \`[NEW UPDATE]\` in bold/highlighted
352
+
353
+ **If up to date**, replace:
354
+ - \`{{VERSION}}\` with current version
355
+ - \`{{UPDATE_STATUS}}\` with empty string
356
+
357
+ ## Update Banner (Show When Update Available)
358
+
359
+ If \`updateAvailable: true\`, display this banner BEFORE the main menu:
360
+
361
+ \`\`\`
362
+ ┌─────────────────────────────────────────────────────────────────────────────┐
363
+ │ 📦 NEW UPDATE AVAILABLE: v{{currentVersion}} → v{{latestVersion}} │
364
+ ├─────────────────────────────────────────────────────────────────────────────┤
365
+ │ What's New: │
366
+ │ {{#each updateHighlights}} │
367
+ │ • {{summary}} │
368
+ │ {{/each}} │
369
+ ├─────────────────────────────────────────────────────────────────────────────┤
370
+ │ Press [N] to update now │ Press [U] for details │ Press any to dismiss │
371
+ └─────────────────────────────────────────────────────────────────────────────┘
372
+ \`\`\`
373
+
374
+ **IMPORTANT**: After displaying the update banner for the first time, update the state file:
375
+ \`updateFirstDisplayed: true\` - This prevents showing the full highlights again.
376
+
377
+ On subsequent displays (when \`updateFirstDisplayed: true\`), show a compact banner:
378
+
379
+ \`\`\`
380
+ ┌──────────────────────────────────────────────────────────────┐
381
+ │ 📦 Update available: v{{currentVersion}} → v{{latestVersion}} │ [N] Update │
382
+ └──────────────────────────────────────────────────────────────┘
383
+ \`\`\`
384
+
385
+ ## Main Menu Body
386
+
387
+ \`\`\`
315
388
  ║ ║
316
389
  ║ Quick Actions: ║
317
390
  ║ ───────────── ║
@@ -324,16 +397,29 @@ description: Interactive project menu - Quick access to all commands, agents, sk
324
397
  ║ [1] View Agents [2] View Skills [3] View Hooks ║
325
398
  ║ [4] View Commands [5] Settings [6] Documentation ║
326
399
  ║ ║
400
+ ║ Project Implementation: ║
401
+ ║ ─────────────────────── ║
402
+ ║ [I] /project-impl Agent-powered setup & configuration ║
403
+ ║ ║
327
404
  ║ Navigation: ║
328
405
  ║ ─────────── ║
329
- ║ [R] Refresh Menu [?] Help [Q] Exit Menu
406
+ ║ [U] Check for Updates [R] Refresh Menu [?] Help [Q] Exit
407
+ {{#if updateAvailable}}
408
+ ║ [N] UPDATE NOW Run: npm update -g claude-cli-advanced-starter-pack ║
409
+ {{/if}}
330
410
  ║ ║
331
411
  ╚═══════════════════════════════════════════════════════════════════════════════╝
332
412
  \`\`\`
333
413
 
334
414
  ## How to Use This Menu
335
415
 
336
- When the user invokes \`/menu\`, display the ASCII menu above and wait for their selection.
416
+ When the user invokes \`/menu\`:
417
+
418
+ 1. **Read update state**: Check \`.claude/config/ccasp-state.json\` for cached update info
419
+ 2. **Build dynamic header**: Include version number and update status
420
+ 3. **Show update banner**: If updates available, show banner with highlights (first time) or compact (subsequent)
421
+ 4. **Display the menu**: Show the ASCII art menu with dynamic content
422
+ 5. **Wait for input**: Accept single character or command name
337
423
 
338
424
  ### Key Bindings
339
425
 
@@ -354,6 +440,9 @@ When the user invokes \`/menu\`, display the ASCII menu above and wait for their
354
440
  | **4** | List all commands | Read \`.claude/commands/INDEX.md\` |
355
441
  | **5** | View/edit settings | Read \`.claude/settings.json\` |
356
442
  | **6** | Open documentation | Read \`.claude/docs/\` |
443
+ | **I** | Project Implementation | \`/project-impl\` |
444
+ | **U** | Check for Updates | \`/update-check\` |
445
+ | **N** | Update Now | Run npm update (only shown when update available) |
357
446
  | **R** | Refresh and redisplay menu | Re-invoke \`/menu\` |
358
447
  | **?** | Show help | Display command descriptions |
359
448
  | **Q** | Exit menu | End menu interaction |
@@ -368,26 +457,87 @@ ${hooksSection}
368
457
 
369
458
  When this command is invoked:
370
459
 
371
- 1. **Display the ASCII menu** exactly as shown above
372
- 2. **Ask the user** what they would like to do (show the key bindings)
373
- 3. **Wait for user input** - a single character or command name
374
- 4. **Execute the corresponding action**:
375
- - For slash commands: Invoke the command directly
376
- - For resource views: Read and display the contents
377
- - For R: Redisplay the menu
378
- - For Q: End the menu session
460
+ ### Step 1: Read Update State
461
+
462
+ Read \`.claude/config/ccasp-state.json\`:
463
+
464
+ \`\`\`bash
465
+ cat .claude/config/ccasp-state.json 2>/dev/null || echo "{}"
466
+ \`\`\`
467
+
468
+ Parse the JSON to extract:
469
+ - \`currentVersion\`: Installed CCASP version
470
+ - \`latestVersion\`: Latest version on npm
471
+ - \`updateAvailable\`: Boolean indicating if update exists
472
+ - \`updateHighlights\`: Array of release summaries
473
+ - \`updateFirstDisplayed\`: Whether full highlights have been shown
474
+
475
+ ### Step 2: Build Dynamic Menu
379
476
 
380
- ### Example Interaction
477
+ Replace template variables in the menu:
478
+ - \`{{VERSION}}\` → currentVersion (e.g., "1.0.6")
479
+ - \`{{UPDATE_STATUS}}\` → "[NEW UPDATE]" if updateAvailable, else ""
381
480
 
481
+ ### Step 3: Display Update Banner (If Applicable)
482
+
483
+ **First time showing update** (\`updateAvailable && !updateFirstDisplayed\`):
484
+ Show full banner with highlights, then update state:
485
+
486
+ \`\`\`bash
487
+ # After displaying, update the state file to mark as displayed
382
488
  \`\`\`
383
- User: /menu
384
- Claude: [Displays ASCII menu]
385
- Claude: What would you like to do? Enter a key (T/G/P/A/H/S/M/C/E/1-6/R/?/Q):
386
489
 
387
- User: T
388
- Claude: Running E2E tests... [Invokes /e2e-test]
490
+ Set \`updateFirstDisplayed: true\` in ccasp-state.json using Edit tool.
491
+
492
+ **Subsequent displays** (\`updateAvailable && updateFirstDisplayed\`):
493
+ Show compact banner only.
494
+
495
+ ### Step 4: Display Menu and Wait for Input
496
+
497
+ Ask: "What would you like to do? Enter a key:"
498
+
499
+ ### Step 5: Handle User Selection
500
+
501
+ | Key | Action |
502
+ |-----|--------|
503
+ | **N** | **Update Now**: Run \`npm update -g claude-cli-advanced-starter-pack\` via Bash, then show: "Update complete! Restart Claude Code CLI to use new features." |
504
+ | **U** | Invoke \`/update-check\` for detailed update info and feature management |
505
+ | **I** | Invoke \`/project-impl\` for project implementation |
506
+ | **R** | Re-invoke \`/menu\` (refresh) |
507
+ | **Q** | End menu session |
508
+ | **1-6** | Read and display the corresponding resource |
509
+ | **Other** | Invoke the corresponding slash command |
510
+
511
+ ### Example: Update Now Flow
512
+
513
+ \`\`\`
514
+ User: N
515
+
516
+ Claude: Updating CCASP...
517
+
518
+ [Runs: npm update -g claude-cli-advanced-starter-pack]
519
+
520
+ Claude:
521
+ ┌─────────────────────────────────────────────────────────────┐
522
+ │ ✅ Update Complete! │
523
+ │ │
524
+ │ Updated: v1.0.5 → v1.0.6 │
525
+ │ │
526
+ │ ⚠️ RESTART REQUIRED │
527
+ │ Exit and restart Claude Code CLI to use new features. │
528
+ │ │
529
+ │ Then run: ccasp wizard → select "Prior Releases" to add │
530
+ │ any new commands to this project. │
531
+ └─────────────────────────────────────────────────────────────┘
389
532
  \`\`\`
390
533
 
534
+ ### Update Check Behavior
535
+
536
+ - The startup hook (\`ccasp-update-check.js\`) runs automatically on first prompt
537
+ - Checks npm registry with 1-hour cache
538
+ - Stores result in \`.claude/config/ccasp-state.json\`
539
+ - Menu reads this cached state (no network call needed)
540
+
391
541
  ### Dynamic Content
392
542
 
393
543
  When displaying resource views (1-6), read the actual contents from:
@@ -1023,10 +1173,8 @@ options:
1023
1173
  description: "Auto-detect + init"
1024
1174
  - label: "Full Setup"
1025
1175
  description: "All features"
1026
- - label: "Audit"
1027
- description: "Check CLAUDE.md"
1028
- - label: "Enhance"
1029
- description: "Generate CLAUDE.md"
1176
+ - label: "Prior Releases"
1177
+ description: "Add features from updates"
1030
1178
  ---
1031
1179
 
1032
1180
  # CCASP Setup Wizard
@@ -1035,17 +1183,17 @@ Interactive setup wizard for Claude Code CLI enhancement.
1035
1183
 
1036
1184
  ## Quick Options
1037
1185
 
1038
- Reply with a **number** or **letter** to select:
1186
+ Reply with a **number** to select:
1039
1187
 
1040
1188
  | # | Action | Description |
1041
1189
  |---|--------|-------------|
1042
1190
  | **1** | Quick Start | Auto-detect stack + init .claude |
1043
1191
  | **2** | Full Setup | All features with customization |
1044
1192
  | **3** | GitHub | Connect project board |
1045
- | **4** | Audit | Check existing CLAUDE.md |
1046
- | **5** | Enhance | Generate/improve CLAUDE.md |
1047
- | **6** | Detect | Show detected tech stack |
1048
- | **7** | Templates | Browse available items |
1193
+ | **4** | Templates | Browse available items |
1194
+ | **5** | Prior Releases | Review & add features from past versions |
1195
+ | **6** | Remove CCASP | Uninstall from this project |
1196
+ | **0** | Exit | Close wizard |
1049
1197
 
1050
1198
  ## Feature Presets
1051
1199
 
@@ -1056,6 +1204,11 @@ Reply with a **number** or **letter** to select:
1056
1204
  | **C** | Full | Everything including agents |
1057
1205
  | **D** | Custom | Pick individual features |
1058
1206
 
1207
+ ## Related Commands
1208
+
1209
+ - \`/project-impl\` - Agent-powered project implementation (audit, enhance, detect, configure)
1210
+ - \`/update-check\` - Check for updates and add new features to your project
1211
+
1059
1212
  ## Instructions for Claude
1060
1213
 
1061
1214
  When this command is invoked:
@@ -1065,22 +1218,23 @@ When this command is invoked:
1065
1218
  - Does \`CLAUDE.md\` exist? (check with Bash: ls -la CLAUDE.md 2>/dev/null)
1066
1219
  - Is tech stack detected? (check for package.json, pyproject.toml, etc.)
1067
1220
 
1068
- 2. **Present the quick options menu** and wait for user selection
1221
+ 2. **Check for updates** (display banner if new version available)
1069
1222
 
1070
- 3. **Handle user selection**:
1071
- - If user types a number (1-7), execute that action
1223
+ 3. **Present the quick options menu** and wait for user selection
1224
+
1225
+ 4. **Handle user selection**:
1226
+ - If user types a number (1-6), execute that action
1072
1227
  - If user types a letter (A-D), apply that preset
1073
1228
  - For "1" (Quick Start): run tech detection, show results, apply Standard preset
1074
- - For "4" (Audit): check CLAUDE.md against best practices
1075
- - For "5" (Enhance): offer to generate missing sections
1229
+ - For "5" (Prior Releases): show release history and feature management
1076
1230
 
1077
- 4. **For Quick Start**:
1231
+ 5. **For Quick Start**:
1078
1232
  - Detect tech stack from package.json, config files
1079
1233
  - Show summary of detected stack
1080
1234
  - Create .claude/ folder with commands, settings
1081
1235
  - Generate CLAUDE.md with detected stack info
1082
1236
 
1083
- 5. **CRITICAL - Session Restart Reminder**:
1237
+ 6. **CRITICAL - Session Restart Reminder**:
1084
1238
  After ANY action that modifies \`.claude/\` or \`CLAUDE.md\`, display:
1085
1239
 
1086
1240
  ⚠️ RESTART REQUIRED
@@ -1092,8 +1246,8 @@ When this command is invoked:
1092
1246
  2. Restart: claude or claude .
1093
1247
  3. New commands will be available
1094
1248
 
1095
- Actions requiring restart: 1, 2, 3, 5
1096
- Actions NOT requiring restart: 4 (audit), 6 (detect), 7 (templates)
1249
+ Actions requiring restart: 1, 2, 3, 5 (if features added)
1250
+ Actions NOT requiring restart: 4 (templates)
1097
1251
 
1098
1252
  ## Vibe-Code Design
1099
1253
 
@@ -1223,7 +1377,101 @@ export default async function ${hookName.replace(/-/g, '_')}(context) {
1223
1377
  }
1224
1378
 
1225
1379
  /**
1226
- * Generate settings.json
1380
+ * Generate CCASP update check hook (fallback if template not found)
1381
+ */
1382
+ function generateUpdateCheckHook() {
1383
+ return `/**
1384
+ * CCASP Update Check Hook
1385
+ *
1386
+ * Checks for npm updates when Claude Code starts.
1387
+ * Runs on first UserPromptSubmit per session, caches results for 1 hour.
1388
+ *
1389
+ * Event: UserPromptSubmit
1390
+ */
1391
+
1392
+ const { execSync } = require('child_process');
1393
+ const fs = require('fs');
1394
+ const path = require('path');
1395
+
1396
+ const PACKAGE_NAME = 'claude-cli-advanced-starter-pack';
1397
+ const CACHE_DURATION = 60 * 60 * 1000;
1398
+ const STATE_FILE = '.claude/config/ccasp-state.json';
1399
+ const SESSION_MARKER = '.claude/config/.ccasp-session-checked';
1400
+
1401
+ function loadState() {
1402
+ const statePath = path.join(process.cwd(), STATE_FILE);
1403
+ if (fs.existsSync(statePath)) {
1404
+ try { return JSON.parse(fs.readFileSync(statePath, 'utf8')); } catch {}
1405
+ }
1406
+ return { lastCheckTimestamp: 0, updateAvailable: false };
1407
+ }
1408
+
1409
+ function saveState(state) {
1410
+ const statePath = path.join(process.cwd(), STATE_FILE);
1411
+ const stateDir = path.dirname(statePath);
1412
+ if (!fs.existsSync(stateDir)) fs.mkdirSync(stateDir, { recursive: true });
1413
+ fs.writeFileSync(statePath, JSON.stringify(state, null, 2), 'utf8');
1414
+ }
1415
+
1416
+ function hasCheckedThisSession() {
1417
+ const markerPath = path.join(process.cwd(), SESSION_MARKER);
1418
+ if (fs.existsSync(markerPath)) {
1419
+ try {
1420
+ const timestamp = parseInt(fs.readFileSync(markerPath, 'utf8'), 10);
1421
+ if (Date.now() - timestamp < 4 * 60 * 60 * 1000) return true;
1422
+ } catch {}
1423
+ }
1424
+ return false;
1425
+ }
1426
+
1427
+ function markSessionChecked() {
1428
+ const markerPath = path.join(process.cwd(), SESSION_MARKER);
1429
+ const markerDir = path.dirname(markerPath);
1430
+ if (!fs.existsSync(markerDir)) fs.mkdirSync(markerDir, { recursive: true });
1431
+ fs.writeFileSync(markerPath, Date.now().toString(), 'utf8');
1432
+ }
1433
+
1434
+ function compareVersions(v1, v2) {
1435
+ if (!v1 || !v2) return 0;
1436
+ const p1 = v1.split('.').map(Number), p2 = v2.split('.').map(Number);
1437
+ for (let i = 0; i < Math.max(p1.length, p2.length); i++) {
1438
+ if ((p1[i] || 0) > (p2[i] || 0)) return 1;
1439
+ if ((p1[i] || 0) < (p2[i] || 0)) return -1;
1440
+ }
1441
+ return 0;
1442
+ }
1443
+
1444
+ module.exports = async function ccaspUpdateCheck(context) {
1445
+ if (hasCheckedThisSession()) return { continue: true };
1446
+ markSessionChecked();
1447
+
1448
+ const state = loadState();
1449
+ const now = Date.now();
1450
+
1451
+ if (state.lastCheckTimestamp && (now - state.lastCheckTimestamp) < CACHE_DURATION) {
1452
+ return { continue: true };
1453
+ }
1454
+
1455
+ try {
1456
+ const current = execSync('npm list -g ' + PACKAGE_NAME + ' --json 2>/dev/null', { encoding: 'utf8', timeout: 5000 });
1457
+ const currentVersion = JSON.parse(current).dependencies?.[PACKAGE_NAME]?.version;
1458
+
1459
+ const latest = execSync('npm view ' + PACKAGE_NAME + ' version', { encoding: 'utf8', timeout: 10000 }).trim();
1460
+
1461
+ state.lastCheckTimestamp = now;
1462
+ state.currentVersion = currentVersion;
1463
+ state.latestVersion = latest;
1464
+ state.updateAvailable = compareVersions(latest, currentVersion) > 0;
1465
+ saveState(state);
1466
+ } catch {}
1467
+
1468
+ return { continue: true };
1469
+ };
1470
+ `;
1471
+ }
1472
+
1473
+ /**
1474
+ * Generate settings.json with CCASP update check hook
1227
1475
  */
1228
1476
  function generateSettingsJson(projectName) {
1229
1477
  return JSON.stringify({
@@ -1232,7 +1480,19 @@ function generateSettingsJson(projectName) {
1232
1480
  "allow": [],
1233
1481
  "deny": []
1234
1482
  },
1235
- "hooks": {}
1483
+ "hooks": {
1484
+ "UserPromptSubmit": [
1485
+ {
1486
+ "matcher": "",
1487
+ "hooks": [
1488
+ {
1489
+ "type": "command",
1490
+ "command": "node .claude/hooks/ccasp-update-check.js"
1491
+ }
1492
+ ]
1493
+ }
1494
+ ]
1495
+ }
1236
1496
  }, null, 2);
1237
1497
  }
1238
1498
 
@@ -1398,6 +1658,24 @@ export async function runInit(options = {}) {
1398
1658
  console.log(chalk.blue(` ○ hooks/ has ${hookFiles.length} existing hook(s) (preserved)`));
1399
1659
  }
1400
1660
 
1661
+ // Always deploy the CCASP update check hook (essential for update notifications)
1662
+ const updateCheckHookPath = join(hooksDir, 'ccasp-update-check.js');
1663
+ if (!existsSync(updateCheckHookPath)) {
1664
+ // Try to read from template
1665
+ const templatePath = join(__dirname, '..', '..', 'templates', 'hooks', 'ccasp-update-check.template.js');
1666
+ if (existsSync(templatePath)) {
1667
+ const hookContent = readFileSync(templatePath, 'utf8');
1668
+ writeFileSync(updateCheckHookPath, hookContent, 'utf8');
1669
+ console.log(chalk.green(' ✓ Created hooks/ccasp-update-check.js (update notifications)'));
1670
+ } else {
1671
+ // Fallback: create minimal version
1672
+ writeFileSync(updateCheckHookPath, generateUpdateCheckHook(), 'utf8');
1673
+ console.log(chalk.green(' ✓ Created hooks/ccasp-update-check.js (update notifications)'));
1674
+ }
1675
+ } else {
1676
+ console.log(chalk.blue(' ○ hooks/ccasp-update-check.js exists (preserved)'));
1677
+ }
1678
+
1401
1679
  console.log('');
1402
1680
 
1403
1681
  // Step 4: Select optional features