ccstart 3.0.1 → 3.0.2

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.
@@ -566,8 +566,9 @@ async function initializeClaudeDirectory(selectedAgentFiles, selectedSkillDirs,
566
566
  // Copy .claude/hooks directory
567
567
  const claudeHooksDir = path.join(claudeDir, 'hooks');
568
568
  const templateHooksDir = path.join(templateDir, 'claude', 'hooks');
569
-
570
- if (fs.existsSync(templateHooksDir)) {
569
+ const copiedHookFiles = [];
570
+
571
+ if (fs.existsSync(templateHooksDir) && selectedHookFiles.length > 0) {
571
572
  // Create .claude/hooks directory
572
573
  if (!fs.existsSync(claudeHooksDir)) {
573
574
  if (!dryRun) {
@@ -578,14 +579,13 @@ async function initializeClaudeDirectory(selectedAgentFiles, selectedSkillDirs,
578
579
  console.log(' 📁 Would create directory: .claude/hooks/');
579
580
  }
580
581
  }
581
-
582
- // Copy all files from template hooks directory
583
- const hookFiles = fs.readdirSync(templateHooksDir);
584
- for (const hookFile of hookFiles) {
582
+
583
+ // Copy only selected hook files
584
+ for (const hookFile of selectedHookFiles) {
585
585
  const hookSrc = path.join(templateHooksDir, hookFile);
586
586
  const hookDest = path.join(claudeHooksDir, hookFile);
587
-
588
- if (fs.statSync(hookSrc).isFile()) {
587
+
588
+ if (fs.existsSync(hookSrc) && fs.statSync(hookSrc).isFile()) {
589
589
  if (!fs.existsSync(hookDest)) {
590
590
  if (!dryRun) {
591
591
  fs.copyFileSync(hookSrc, hookDest);
@@ -594,6 +594,7 @@ async function initializeClaudeDirectory(selectedAgentFiles, selectedSkillDirs,
594
594
  fs.chmodSync(hookDest, '755');
595
595
  }
596
596
  }
597
+ copiedHookFiles.push(hookFile);
597
598
  createdItems.push(`.claude/hooks/${hookFile}`);
598
599
  if (dryRun) {
599
600
  console.log(` ✨ Would copy: .claude/hooks/${hookFile}`);
@@ -606,6 +607,7 @@ async function initializeClaudeDirectory(selectedAgentFiles, selectedSkillDirs,
606
607
  fs.chmodSync(hookDest, '755');
607
608
  }
608
609
  }
610
+ copiedHookFiles.push(hookFile);
609
611
  if (dryRun) {
610
612
  console.log(` ♻️ Would replace: .claude/hooks/${hookFile}`);
611
613
  }
@@ -624,6 +626,8 @@ async function initializeClaudeDirectory(selectedAgentFiles, selectedSkillDirs,
624
626
  fs.chmodSync(newDest, '755');
625
627
  }
626
628
  }
629
+ const renamedFile = path.basename(newDest);
630
+ copiedHookFiles.push(renamedFile);
627
631
  const relativePath = path.relative(claudeDir, newDest);
628
632
  createdItems.push(relativePath);
629
633
  if (dryRun) {
@@ -639,6 +643,46 @@ async function initializeClaudeDirectory(selectedAgentFiles, selectedSkillDirs,
639
643
  }
640
644
  }
641
645
  }
646
+
647
+ // Create settings.local.json with hooks configuration
648
+ const settingsLocalDest = path.join(claudeDir, 'settings.local.json');
649
+ if (copiedHookFiles.length > 0) {
650
+ const hooksConfig = {
651
+ hooks: {
652
+ UserPromptSubmit: []
653
+ }
654
+ };
655
+
656
+ // Add each copied hook to UserPromptSubmit (all current hooks use this event)
657
+ for (const hookFile of copiedHookFiles) {
658
+ hooksConfig.hooks.UserPromptSubmit.push({
659
+ hooks: [{
660
+ type: "command",
661
+ command: `.claude/hooks/${hookFile}`
662
+ }]
663
+ });
664
+ }
665
+
666
+ // Merge with existing settings.local.json if it exists
667
+ if (fs.existsSync(settingsLocalDest)) {
668
+ const existingSettings = JSON.parse(fs.readFileSync(settingsLocalDest, 'utf8'));
669
+ existingSettings.hooks = hooksConfig.hooks;
670
+ if (!dryRun) {
671
+ fs.writeFileSync(settingsLocalDest, JSON.stringify(existingSettings, null, 2));
672
+ }
673
+ if (dryRun) {
674
+ console.log(' ♻️ Would update: .claude/settings.local.json with hooks config');
675
+ }
676
+ } else {
677
+ if (!dryRun) {
678
+ fs.writeFileSync(settingsLocalDest, JSON.stringify(hooksConfig, null, 2));
679
+ }
680
+ if (dryRun) {
681
+ console.log(' ✨ Would create: .claude/settings.local.json with hooks config');
682
+ }
683
+ }
684
+ createdItems.push('.claude/settings.local.json');
685
+ }
642
686
 
643
687
  // Copy settings.json.example if it doesn't exist
644
688
  const settingsExampleSrc = path.join(templateDir, 'settings.json.example');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccstart",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Start your Claude Code projects with a well-organized structure including agents, tickets, and skills",
5
5
  "bin": {
6
6
  "ccstart": "bin/create-project.js"
@@ -11,5 +11,6 @@ cat << 'EOF'
11
11
  REMINDER: Before responding to this prompt:
12
12
  1. Review and respect all instructions in CLAUDE.md
13
13
  2. Ask clarifying questions if any requirements are unclear - do not make assumptions
14
+ 3. If you just exited plan mode and the user approved a significant feature or bug fix, consider using /create-ticket to capture the implementation plan
14
15
  </user-prompt-submit-hook>
15
16
  EOF
@@ -1,19 +0,0 @@
1
- #!/bin/bash
2
- : <<'FRONTMATTER'
3
- ---
4
- name: ticket-reminder
5
- description: Reminds Claude to create a ticket for significant features or bug fixes after plan approval
6
- hooks:
7
- - event: PostToolUse
8
- matcher: ExitPlanMode
9
- ---
10
- FRONTMATTER
11
-
12
- cat << 'EOF'
13
- <post-tool-use-hook>
14
- REMINDER: After the user approves this plan, consider whether this feature or bug fix justifies creating a ticket:
15
- - If this is a significant feature, enhancement, or bug fix, use /create-ticket to create a ticket that captures the plan
16
- - Include the implementation details from the plan in the ticket
17
- - Skip ticket creation for trivial changes (typos, minor tweaks, quick fixes)
18
- </post-tool-use-hook>
19
- EOF