claude-devkit-cli 1.4.3 → 1.4.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-devkit-cli",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "CLI toolkit for spec-first development with Claude Code — hooks, commands, guards, and test runners",
5
5
  "bin": {
6
6
  "claude-devkit": "./bin/devkit.js",
@@ -8,14 +8,35 @@ Bug: $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
+ ## Iron Law
12
+
13
+ **NEVER fix without finding the root cause first.**
14
+
15
+ Fixing symptoms creates whack-a-mole debugging. Every fix that doesn't address the root cause makes the next bug harder to find.
16
+
17
+ ---
18
+
11
19
  ## Phase 0: Investigate
12
20
 
13
21
  Don't jump to code. Understand the bug first:
14
22
 
15
- 1. **Parse the report.** Symptom? Expected vs actual? Repro steps?
23
+ 1. **Parse the report.** Symptom? Expected vs actual? Repro steps? If context is missing → ask ONE question via AskUserQuestion before proceeding.
16
24
  2. **Locate the code.** If `codebase-memory-mcp` is available, use `search_code("<error message or function name>")` to find related files faster, and `trace_call_path` to map callers and impact radius. Fallback: Grep for keywords from the bug (error messages, function names).
17
- 3. **Check history.** `git log --oneline -5 -- <file>` and `git blame -L <range> <file>` who changed this last and why?
18
- 4. **Form a hypothesis:** "I believe the bug is caused by [X] in [file:function] because [evidence]."
25
+ 3. **Check history.** `git log --oneline -20 -- <affected-files>` was this working before? What changed? Regression = root cause is in the diff.
26
+ 4. **Pattern check.** Match the symptom against known bug patterns:
27
+
28
+ | Pattern | Signature | Where to look |
29
+ |---------|-----------|---------------|
30
+ | Race condition | Intermittent, timing-dependent | Concurrent access to shared state |
31
+ | Nil/null propagation | NoMethodError, TypeError, NullPointerException | Missing guards on optional values |
32
+ | State corruption | Inconsistent data, partial updates | Transactions, callbacks, hooks |
33
+ | Integration failure | Timeout, unexpected response | External API calls, service boundaries |
34
+ | Config drift | Works locally, fails in staging/prod | Env vars, feature flags, DB state |
35
+ | Stale cache | Shows old data, fixes on cache clear | Redis, CDN, browser cache |
36
+
37
+ 5. **Reproduce deterministically.** If you can't trigger the bug reliably → gather more evidence. Do NOT guess.
38
+
39
+ **Required output:** `Root cause hypothesis: ...` — a specific, testable claim about what is wrong and why.
19
40
 
20
41
  If the bug is in a dependency/config/data (not project code), say so before proceeding.
21
42
 
@@ -52,6 +73,10 @@ bash scripts/build-test.sh --filter "<test name>"
52
73
  }
53
74
  ```
54
75
 
76
+ **3-strike rule:** If 3 hypotheses all fail to reproduce the bug → STOP. Use AskUserQuestion:
77
+ "3 hypotheses tested, none confirmed. This may be architectural — not a simple bug."
78
+ Options: A) New hypothesis (describe new evidence), B) Escalate for human review, C) Instrument the area and catch it next time
79
+
55
80
  ---
56
81
 
57
82
  ## Phase 2: Fix
@@ -64,6 +89,9 @@ Make the **minimal change** needed.
64
89
  | Add a guard for the edge case | Rewrite the function |
65
90
  | Explain what and why before editing | Silently change code |
66
91
 
92
+ **Blast radius check:** If the fix requires touching >5 files → stop and use AskUserQuestion before editing anything:
93
+ "This fix touches N files — that's a large blast radius for a bug fix. A) Proceed — root cause genuinely spans these files, B) Split — fix critical path now, defer the rest, C) Rethink — there may be a more targeted approach"
94
+
67
95
  ---
68
96
 
69
97
  ## Phase 3: Verify
@@ -93,13 +121,17 @@ This is non-optional for serious bugs. For trivial bugs, the fix summary is enou
93
121
  ## Phase 5: Summary
94
122
 
95
123
  ```
96
- Bug: <description>
97
- Hypothesis: <what you predicted> → <confirmed or actual cause>
98
- Test added: <file>:<test name>
99
- Fix: <file>:<lines> <what changed>
100
- Root cause: <1 sentence>
101
- Prevention: <suggestion>
102
- Full suite: All passing ✓
124
+ DEBUG REPORT
125
+ ════════════════════════════════════════
126
+ Bug: <description>
127
+ Hypothesis: <what you predicted> <confirmed or actual cause>
128
+ Root cause: <what was actually wrong>
129
+ Fix: <file:line — what changed>
130
+ Evidence: <test output>
131
+ Regression test: <file:test name>
132
+ Full suite: All passing ✓
133
+ Status: DONE | DONE_WITH_CONCERNS | BLOCKED
134
+ ════════════════════════════════════════
103
135
  ```
104
136
 
105
137
  ### Spec Update Signal
@@ -129,8 +161,14 @@ Reason: [S1 | S2 | S3] — <one line: what is missing or mismatched>
129
161
  If `$ARGUMENTS` describes multiple bugs: triage by severity, fix one at a time, commit each separately.
130
162
 
131
163
  ## Rules
132
- 1. **Investigate before coding.** Hypothesis before test. Evidence before fix.
164
+ 1. **Investigate before coding.** Root cause hypothesis before test. Evidence before fix.
133
165
  2. **Minimal fix.** One bug, one change. Don't improve the neighborhood.
134
166
  3. **Never weaken tests.** If existing tests break, the fix is wrong.
135
167
  4. **Ask before touching production code** if unsure.
136
168
  5. **One bug, one commit.** Each fix independently revertable.
169
+
170
+ **Red flags — slow down if you see these:**
171
+ - "Quick fix for now" — there is no "for now". Fix it right or escalate.
172
+ - Proposing a fix before tracing data flow — you're guessing, not debugging.
173
+ - Each fix reveals a new problem elsewhere — wrong layer, not wrong code.
174
+ - Never say "this should fix it" — verify and prove it. Run the tests.