claude-cli-advanced-starter-pack 1.0.5 → 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.
- package/README.md +30 -1
- package/package.json +69 -69
- package/src/commands/init.js +272 -39
- package/src/commands/setup-wizard.js +308 -46
- package/src/data/releases.json +349 -265
- package/templates/hooks/ccasp-update-check.template.js +241 -0
package/README.md
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
# Claude CLI Advanced Starter Pack
|
|
2
2
|
|
|
3
3
|
```
|
|
4
|
+
┌─────────────────────────────────────────────────────────────────────────────────┐
|
|
5
|
+
│ 📦 NEW UPDATE AVAILABLE: v1.0.5 → v1.0.7 │
|
|
6
|
+
├─────────────────────────────────────────────────────────────────────────────────┤
|
|
7
|
+
│ What's New: │
|
|
8
|
+
│ • Enhanced removal wizard with full backup/restore │
|
|
9
|
+
│ • Automatic update notifications on startup │
|
|
10
|
+
│ • Dynamic menu with version tracking │
|
|
11
|
+
├─────────────────────────────────────────────────────────────────────────────────┤
|
|
12
|
+
│ Press [N] to update now │ Press [U] for details │ Press any to continue │
|
|
13
|
+
└─────────────────────────────────────────────────────────────────────────────────┘
|
|
14
|
+
|
|
4
15
|
╔═══════════════════════════════════════════════════════════════════════════════╗
|
|
5
16
|
║ ║
|
|
6
17
|
║ ╔═╗╦ ╔═╗╦ ╦╔╦╗╔═╗ ╔═╗╔╦╗╦ ╦╔═╗╔╗╔╔═╗╔═╗╔╦╗ ╔═╗╔╦╗╔═╗╦═╗╔╦╗╔═╗╦═╗ ║
|
|
7
18
|
║ ║ ║ ╠═╣║ ║ ║║║╣ ╠═╣ ║║╚╗╔╝╠═╣║║║║ ║╣ ║║ ╚═╗ ║ ╠═╣╠╦╝ ║ ║╣ ╠╦╝ ║
|
|
8
19
|
║ ╚═╝╩═╝╩ ╩╚═╝═╩╝╚═╝ ╩ ╩═╩╝ ╚╝ ╩ ╩╝╚╝╚═╝╚═╝═╩╝ ╚═╝ ╩ ╩ ╩╩╚═ ╩ ╚═╝╩╚═ ║
|
|
9
20
|
║ ║
|
|
10
|
-
║
|
|
21
|
+
║ Your Project Name v1.0.5 [NEW UPDATE] ║
|
|
11
22
|
║ ║
|
|
12
23
|
╠═══════════════════════════════════════════════════════════════════════════════╣
|
|
13
24
|
║ ║
|
|
@@ -29,6 +40,7 @@
|
|
|
29
40
|
║ Navigation: ║
|
|
30
41
|
║ ─────────── ║
|
|
31
42
|
║ [U] Check for Updates [R] Refresh Menu [?] Help [Q] Exit ║
|
|
43
|
+
║ [N] UPDATE NOW Run: npm update -g claude-cli-advanced-starter-pack ║
|
|
32
44
|
║ ║
|
|
33
45
|
╚═══════════════════════════════════════════════════════════════════════════════╝
|
|
34
46
|
```
|
|
@@ -178,6 +190,23 @@ Select during setup - each adds specific commands and hooks:
|
|
|
178
190
|
|
|
179
191
|
Features marked with (*) require post-install configuration via `/menu` → Project Settings.
|
|
180
192
|
|
|
193
|
+
### Automatic Update Notifications
|
|
194
|
+
|
|
195
|
+
CCASP automatically checks for updates when Claude Code starts:
|
|
196
|
+
|
|
197
|
+
- **Startup hook** runs on first prompt, checks npm registry (1-hour cache)
|
|
198
|
+
- **Dynamic menu header** shows current version with `[NEW UPDATE]` badge when available
|
|
199
|
+
- **Update banner** displays what's new on first view, then compact banner on subsequent views
|
|
200
|
+
- **One-key update** - Press `[N]` in the menu to run `npm update -g` instantly
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
204
|
+
│ 📦 Update available: v1.0.5 → v1.0.7 │ [N] Update │
|
|
205
|
+
└──────────────────────────────────────────────────────────────┘
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Updates are **manual** - you control when to update. The notification simply informs you.
|
|
209
|
+
|
|
181
210
|
### MCP Server Explorer
|
|
182
211
|
|
|
183
212
|
Discover and install MCP servers based on your tech stack:
|
package/package.json
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "claude-cli-advanced-starter-pack",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Advanced Claude Code CLI toolkit - agents, hooks, skills, MCP servers, phased development, and GitHub integration",
|
|
5
|
-
"main": "src/index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"ccasp": "./bin/gtask.js",
|
|
8
|
-
"claude-advanced": "./bin/gtask.js",
|
|
9
|
-
"claude-cli-advanced-starter-pack": "./bin/gtask.js"
|
|
10
|
-
},
|
|
11
|
-
"type": "module",
|
|
12
|
-
"scripts": {
|
|
13
|
-
"start": "node bin/gtask.js",
|
|
14
|
-
"setup": "node bin/gtask.js setup",
|
|
15
|
-
"postinstall": "node bin/postinstall.js",
|
|
16
|
-
"test": "node --check bin/gtask.js && node --check bin/postinstall.js && echo 'Syntax OK'",
|
|
17
|
-
"lint": "eslint src/",
|
|
18
|
-
"prepublishOnly": "npm run test"
|
|
19
|
-
},
|
|
20
|
-
"keywords": [
|
|
21
|
-
"claude",
|
|
22
|
-
"claude-code",
|
|
23
|
-
"anthropic",
|
|
24
|
-
"cli",
|
|
25
|
-
"ai-tools",
|
|
26
|
-
"mcp",
|
|
27
|
-
"agents",
|
|
28
|
-
"hooks",
|
|
29
|
-
"skills",
|
|
30
|
-
"github",
|
|
31
|
-
"developer-tools",
|
|
32
|
-
"automation",
|
|
33
|
-
"codebase-analysis"
|
|
34
|
-
],
|
|
35
|
-
"author": "evan043",
|
|
36
|
-
"license": "MIT",
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/evan043/claude-cli-advanced-starter-pack.git"
|
|
40
|
-
},
|
|
41
|
-
"bugs": {
|
|
42
|
-
"url": "https://github.com/evan043/claude-cli-advanced-starter-pack/issues"
|
|
43
|
-
},
|
|
44
|
-
"homepage": "https://github.com/evan043/claude-cli-advanced-starter-pack#readme",
|
|
45
|
-
"engines": {
|
|
46
|
-
"node": ">=18.0.0"
|
|
47
|
-
},
|
|
48
|
-
"dependencies": {
|
|
49
|
-
"chalk": "^5.3.0",
|
|
50
|
-
"commander": "^12.1.0",
|
|
51
|
-
"inquirer": "^9.2.23",
|
|
52
|
-
"ora": "^8.0.1",
|
|
53
|
-
"boxen": "^7.1.1",
|
|
54
|
-
"yaml": "^2.4.1",
|
|
55
|
-
"glob": "^10.3.10",
|
|
56
|
-
"figures": "^6.0.1"
|
|
57
|
-
},
|
|
58
|
-
"devDependencies": {
|
|
59
|
-
"eslint": "^9.0.0"
|
|
60
|
-
},
|
|
61
|
-
"files": [
|
|
62
|
-
"bin/",
|
|
63
|
-
"src/",
|
|
64
|
-
"templates/",
|
|
65
|
-
"README.md",
|
|
66
|
-
"OVERVIEW.md",
|
|
67
|
-
"LICENSE"
|
|
68
|
-
]
|
|
69
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "claude-cli-advanced-starter-pack",
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "Advanced Claude Code CLI toolkit - agents, hooks, skills, MCP servers, phased development, and GitHub integration",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ccasp": "./bin/gtask.js",
|
|
8
|
+
"claude-advanced": "./bin/gtask.js",
|
|
9
|
+
"claude-cli-advanced-starter-pack": "./bin/gtask.js"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"start": "node bin/gtask.js",
|
|
14
|
+
"setup": "node bin/gtask.js setup",
|
|
15
|
+
"postinstall": "node bin/postinstall.js",
|
|
16
|
+
"test": "node --check bin/gtask.js && node --check bin/postinstall.js && echo 'Syntax OK'",
|
|
17
|
+
"lint": "eslint src/",
|
|
18
|
+
"prepublishOnly": "npm run test"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"claude",
|
|
22
|
+
"claude-code",
|
|
23
|
+
"anthropic",
|
|
24
|
+
"cli",
|
|
25
|
+
"ai-tools",
|
|
26
|
+
"mcp",
|
|
27
|
+
"agents",
|
|
28
|
+
"hooks",
|
|
29
|
+
"skills",
|
|
30
|
+
"github",
|
|
31
|
+
"developer-tools",
|
|
32
|
+
"automation",
|
|
33
|
+
"codebase-analysis"
|
|
34
|
+
],
|
|
35
|
+
"author": "evan043",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/evan043/claude-cli-advanced-starter-pack.git"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/evan043/claude-cli-advanced-starter-pack/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/evan043/claude-cli-advanced-starter-pack#readme",
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18.0.0"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"chalk": "^5.3.0",
|
|
50
|
+
"commander": "^12.1.0",
|
|
51
|
+
"inquirer": "^9.2.23",
|
|
52
|
+
"ora": "^8.0.1",
|
|
53
|
+
"boxen": "^7.1.1",
|
|
54
|
+
"yaml": "^2.4.1",
|
|
55
|
+
"glob": "^10.3.10",
|
|
56
|
+
"figures": "^6.0.1"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"eslint": "^9.0.0"
|
|
60
|
+
},
|
|
61
|
+
"files": [
|
|
62
|
+
"bin/",
|
|
63
|
+
"src/",
|
|
64
|
+
"templates/",
|
|
65
|
+
"README.md",
|
|
66
|
+
"OVERVIEW.md",
|
|
67
|
+
"LICENSE"
|
|
68
|
+
]
|
|
69
|
+
}
|
package/src/commands/init.js
CHANGED
|
@@ -308,12 +308,32 @@ function generateMenuCommand(projectName, installedCommands, installedAgents, in
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
const ccaspVersion = getVersion();
|
|
312
|
+
|
|
311
313
|
return `---
|
|
312
314
|
description: Interactive project menu - Quick access to all commands, agents, skills, and tools
|
|
313
315
|
---
|
|
314
316
|
|
|
315
317
|
# ${projectName} - Project Menu
|
|
316
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
|
+
|
|
317
337
|
\`\`\`
|
|
318
338
|
╔═══════════════════════════════════════════════════════════════════════════════╗
|
|
319
339
|
║ ║
|
|
@@ -321,9 +341,50 @@ description: Interactive project menu - Quick access to all commands, agents, sk
|
|
|
321
341
|
║ ║ ║ ╠═╣║ ║ ║║║╣ ╠═╣ ║║╚╗╔╝╠═╣║║║║ ║╣ ║║ ╚═╗ ║ ╠═╣╠╦╝ ║ ║╣ ╠╦╝ ║
|
|
322
342
|
║ ╚═╝╩═╝╩ ╩╚═╝═╩╝╚═╝ ╩ ╩═╩╝ ╚╝ ╩ ╩╝╚╝╚═╝╚═╝═╩╝ ╚═╝ ╩ ╩ ╩╩╚═ ╩ ╚═╝╩╚═ ║
|
|
323
343
|
║ ║
|
|
324
|
-
║
|
|
344
|
+
║ ${projectName.padEnd(35)} v{{VERSION}} {{UPDATE_STATUS}} ║
|
|
325
345
|
║ ║
|
|
326
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
|
+
\`\`\`
|
|
327
388
|
║ ║
|
|
328
389
|
║ Quick Actions: ║
|
|
329
390
|
║ ───────────── ║
|
|
@@ -343,13 +404,22 @@ description: Interactive project menu - Quick access to all commands, agents, sk
|
|
|
343
404
|
║ Navigation: ║
|
|
344
405
|
║ ─────────── ║
|
|
345
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}}
|
|
346
410
|
║ ║
|
|
347
411
|
╚═══════════════════════════════════════════════════════════════════════════════╝
|
|
348
412
|
\`\`\`
|
|
349
413
|
|
|
350
414
|
## How to Use This Menu
|
|
351
415
|
|
|
352
|
-
When the user invokes \`/menu
|
|
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
|
|
353
423
|
|
|
354
424
|
### Key Bindings
|
|
355
425
|
|
|
@@ -372,6 +442,7 @@ When the user invokes \`/menu\`, display the ASCII menu above and wait for their
|
|
|
372
442
|
| **6** | Open documentation | Read \`.claude/docs/\` |
|
|
373
443
|
| **I** | Project Implementation | \`/project-impl\` |
|
|
374
444
|
| **U** | Check for Updates | \`/update-check\` |
|
|
445
|
+
| **N** | Update Now | Run npm update (only shown when update available) |
|
|
375
446
|
| **R** | Refresh and redisplay menu | Re-invoke \`/menu\` |
|
|
376
447
|
| **?** | Show help | Display command descriptions |
|
|
377
448
|
| **Q** | Exit menu | End menu interaction |
|
|
@@ -386,48 +457,86 @@ ${hooksSection}
|
|
|
386
457
|
|
|
387
458
|
When this command is invoked:
|
|
388
459
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
- If an update is available and not dismissed, show a banner above the menu:
|
|
393
|
-
|
|
394
|
-
\`\`\`
|
|
395
|
-
┌──────────────────────────────────────────────────────────────┐
|
|
396
|
-
│ 🆕 UPDATE AVAILABLE: v1.0.X → v1.0.Y │
|
|
397
|
-
│ New features available! Press [U] to see what's new. │
|
|
398
|
-
└──────────────────────────────────────────────────────────────┘
|
|
399
|
-
\`\`\`
|
|
400
|
-
|
|
401
|
-
2. **Display the ASCII menu** exactly as shown above
|
|
402
|
-
3. **Ask the user** what they would like to do (show the key bindings)
|
|
403
|
-
4. **Wait for user input** - a single character or command name
|
|
404
|
-
5. **Execute the corresponding action**:
|
|
405
|
-
- For slash commands: Invoke the command directly
|
|
406
|
-
- For resource views: Read and display the contents
|
|
407
|
-
- For U: Invoke \`/update-check\` to show updates and add features
|
|
408
|
-
- For I: Invoke \`/project-impl\` for project implementation
|
|
409
|
-
- For R: Redisplay the menu
|
|
410
|
-
- For Q: End the menu session
|
|
411
|
-
|
|
412
|
-
### Example Interaction
|
|
460
|
+
### Step 1: Read Update State
|
|
461
|
+
|
|
462
|
+
Read \`.claude/config/ccasp-state.json\`:
|
|
413
463
|
|
|
464
|
+
\`\`\`bash
|
|
465
|
+
cat .claude/config/ccasp-state.json 2>/dev/null || echo "{}"
|
|
414
466
|
\`\`\`
|
|
415
|
-
User: /menu
|
|
416
|
-
Claude: [Shows update banner if available]
|
|
417
|
-
Claude: [Displays ASCII menu]
|
|
418
|
-
Claude: What would you like to do? Enter a key (T/G/P/A/H/S/M/C/E/1-6/I/U/R/?/Q):
|
|
419
467
|
|
|
420
|
-
|
|
421
|
-
|
|
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
|
|
476
|
+
|
|
477
|
+
Replace template variables in the menu:
|
|
478
|
+
- \`{{VERSION}}\` → currentVersion (e.g., "1.0.6")
|
|
479
|
+
- \`{{UPDATE_STATUS}}\` → "[NEW UPDATE]" if updateAvailable, else ""
|
|
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
|
|
488
|
+
\`\`\`
|
|
489
|
+
|
|
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
|
+
└─────────────────────────────────────────────────────────────┘
|
|
422
532
|
\`\`\`
|
|
423
533
|
|
|
424
534
|
### Update Check Behavior
|
|
425
535
|
|
|
426
|
-
|
|
427
|
-
-
|
|
428
|
-
-
|
|
429
|
-
-
|
|
430
|
-
- User can press [U] anytime to check manually and add new features
|
|
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)
|
|
431
540
|
|
|
432
541
|
### Dynamic Content
|
|
433
542
|
|
|
@@ -1268,7 +1377,101 @@ export default async function ${hookName.replace(/-/g, '_')}(context) {
|
|
|
1268
1377
|
}
|
|
1269
1378
|
|
|
1270
1379
|
/**
|
|
1271
|
-
* Generate
|
|
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
|
|
1272
1475
|
*/
|
|
1273
1476
|
function generateSettingsJson(projectName) {
|
|
1274
1477
|
return JSON.stringify({
|
|
@@ -1277,7 +1480,19 @@ function generateSettingsJson(projectName) {
|
|
|
1277
1480
|
"allow": [],
|
|
1278
1481
|
"deny": []
|
|
1279
1482
|
},
|
|
1280
|
-
"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
|
+
}
|
|
1281
1496
|
}, null, 2);
|
|
1282
1497
|
}
|
|
1283
1498
|
|
|
@@ -1443,6 +1658,24 @@ export async function runInit(options = {}) {
|
|
|
1443
1658
|
console.log(chalk.blue(` ○ hooks/ has ${hookFiles.length} existing hook(s) (preserved)`));
|
|
1444
1659
|
}
|
|
1445
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
|
+
|
|
1446
1679
|
console.log('');
|
|
1447
1680
|
|
|
1448
1681
|
// Step 4: Select optional features
|