cc-dev-template 0.1.42 → 0.1.43

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/bin/install.js CHANGED
@@ -233,8 +233,7 @@ if (fs.existsSync(mergeSettingsPath)) {
233
233
  { file: 'read-guard-hook.json', name: 'Context guard for large reads' },
234
234
  { file: 'statusline-config.json', name: 'Custom status line' },
235
235
  { file: 'bash-overflow-hook.json', name: 'Bash overflow guard hook' },
236
- { file: 'bash-precheck-hook.json', name: 'Bash precheck hook' },
237
- { file: 'plan-agent-hook.json', name: 'Plan agent context injection hook' }
236
+ { file: 'bash-precheck-hook.json', name: 'Bash precheck hook' }
238
237
  ];
239
238
 
240
239
  configs.forEach(({ file, name }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-dev-template",
3
- "version": "0.1.42",
3
+ "version": "0.1.43",
4
4
  "description": "Structured AI-assisted development framework for Claude Code",
5
5
  "bin": {
6
6
  "cc-dev-template": "./bin/install.js"
@@ -21,14 +21,9 @@ This requires full conversation context. Handle it yourself rather than delegati
21
21
 
22
22
  **1. Run the code simplifier**
23
23
 
24
- Run the code-simplifier agent on your staged changes before committing. This refines code for clarity and consistency.
24
+ Stage your changes, then use the code simplifier agent to refine them for clarity and consistency. Run tests afterward to verify nothing broke.
25
25
 
26
- 1. Stage your changes with `git add`
27
- 2. Launch the code-simplifier agent (look for it in available subagent types) targeting the staged files
28
- 3. Run the build and tests to verify nothing broke
29
- 4. Fix any issues before proceeding to commit
30
-
31
- Note: The code-simplifier is a plugin. If no code-simplifier agent is available, proceed to step 2.
26
+ Skip this step if no code simplifier agent is available.
32
27
 
33
28
  **2. Commit your work**
34
29
 
@@ -1,154 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * plan-agent-context.js - PreToolUse hook for Task sub-agents
4
- *
5
- * Intercepts ALL Task calls and:
6
- * 1. Forces model: "opus" on every Task call
7
- * 2. For Plan agents (subagent_type: "Plan"), also injects ADRs and planning guidance
8
- */
9
-
10
- const fs = require('fs');
11
- const path = require('path');
12
-
13
- // js-yaml is loaded lazily in collectADRs() to handle missing dependency gracefully
14
-
15
- // Read hook input from stdin
16
- let input = '';
17
- process.stdin.setEncoding('utf8');
18
- process.stdin.on('data', chunk => input += chunk);
19
- process.stdin.on('end', () => {
20
- try {
21
- const hookInput = JSON.parse(input);
22
- const result = processHook(hookInput);
23
- console.log(JSON.stringify(result));
24
- } catch (err) {
25
- // On error, allow the tool call to proceed unchanged
26
- console.log(JSON.stringify({
27
- hookSpecificOutput: {
28
- hookEventName: "PreToolUse",
29
- permissionDecision: "allow"
30
- }
31
- }));
32
- }
33
- });
34
-
35
- function processHook(hookInput) {
36
- const toolInput = hookInput.tool_input || {};
37
-
38
- // Base override: force opus model on ALL Task calls
39
- const updatedInput = {
40
- ...toolInput,
41
- model: "opus"
42
- };
43
-
44
- // For Plan agent calls, also inject ADRs and planning guidance
45
- if (toolInput.subagent_type === 'Plan') {
46
- const adrs = collectADRs();
47
- const planningGuidance = buildPlanningGuidance(adrs);
48
- const originalPrompt = toolInput.prompt || '';
49
- updatedInput.prompt = `${planningGuidance}\n\n---\n\nORIGINAL TASK:\n${originalPrompt}`;
50
- }
51
-
52
- return {
53
- hookSpecificOutput: {
54
- hookEventName: "PreToolUse",
55
- permissionDecision: "allow",
56
- updatedInput
57
- }
58
- };
59
- }
60
-
61
- function collectADRs() {
62
- const adrDir = path.join(process.cwd(), '.claude', 'adrs');
63
- const adrs = [];
64
-
65
- // Try to load js-yaml - if unavailable, skip ADR collection entirely
66
- let yaml;
67
- try {
68
- yaml = require('js-yaml');
69
- } catch (err) {
70
- // js-yaml not available - return empty array (ADR injection is best-effort)
71
- return adrs;
72
- }
73
-
74
- if (!fs.existsSync(adrDir)) {
75
- return adrs;
76
- }
77
-
78
- const files = fs.readdirSync(adrDir).filter(f => f.endsWith('.yaml'));
79
-
80
- for (const file of files) {
81
- try {
82
- const content = fs.readFileSync(path.join(adrDir, file), 'utf8');
83
- const adr = yaml.load(content);
84
- if (adr && adr.status !== 'Superseded') {
85
- adrs.push({
86
- id: adr.id,
87
- title: adr.title,
88
- description: adr.description,
89
- constraints: adr.constraints,
90
- decision: adr.decision
91
- });
92
- }
93
- } catch (err) {
94
- // Skip malformed ADRs
95
- }
96
- }
97
-
98
- return adrs;
99
- }
100
-
101
- function buildPlanningGuidance(adrs) {
102
- let guidance = `<plan-agent-context>
103
- ## Planning Guidelines
104
-
105
- You are creating an implementation plan. Follow these principles:
106
-
107
- ### Research Before Planning
108
- - If the plan involves third-party libraries, APIs, or features not yet in the codebase, use WebSearch or WebFetch to get current documentation
109
- - Do not assume library APIs - verify them with up-to-date sources
110
- - Check compatibility with the project's infrastructure and existing patterns
111
-
112
- ### Remove Ambiguity
113
- - Each step in your plan should be concrete and actionable
114
- - If requirements are unclear, surface the ambiguity rather than making assumptions
115
- - Identify decision points that need user input before execution
116
-
117
- ### ADR Compliance
118
- The plan must respect these architectural decisions:
119
-
120
- `;
121
-
122
- if (adrs.length === 0) {
123
- guidance += `(No ADRs found in this project)\n`;
124
- } else {
125
- for (const adr of adrs) {
126
- guidance += `### ${adr.id}: ${adr.title}\n`;
127
- if (adr.description) {
128
- guidance += `${adr.description.trim()}\n`;
129
- }
130
- if (adr.constraints) {
131
- if (adr.constraints.must && adr.constraints.must.length > 0) {
132
- guidance += `**MUST:**\n`;
133
- for (const c of adr.constraints.must) {
134
- guidance += `- ${c}\n`;
135
- }
136
- }
137
- if (adr.constraints.must_not && adr.constraints.must_not.length > 0) {
138
- guidance += `**MUST NOT:**\n`;
139
- for (const c of adr.constraints.must_not) {
140
- guidance += `- ${c}\n`;
141
- }
142
- }
143
- }
144
- if (adr.decision) {
145
- guidance += `**Decision:** ${adr.decision.trim()}\n`;
146
- }
147
- guidance += `\n`;
148
- }
149
- }
150
-
151
- guidance += `</plan-agent-context>`;
152
-
153
- return guidance;
154
- }
@@ -1,15 +0,0 @@
1
- {
2
- "hooks": {
3
- "PreToolUse": [
4
- {
5
- "matcher": "Task",
6
- "hooks": [
7
- {
8
- "type": "command",
9
- "command": "node $HOME/.claude/hooks/plan-agent-context.js"
10
- }
11
- ]
12
- }
13
- ]
14
- }
15
- }