claude-devkit-cli 1.4.2 → 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
|
@@ -15,6 +15,9 @@ TDD delivery loop — write failing tests from spec AS, implement story by story
|
|
|
15
15
|
If no changes → "No source changes found. Specify a file or feature."
|
|
16
16
|
|
|
17
17
|
2. **Read the spec** at `docs/specs/<feature>/<feature>.md` — the `## Stories` section with acceptance scenarios is your roadmap. The `## Overview` and `## Constraints` sections tell you the INTENT behind the code.
|
|
18
|
+
|
|
19
|
+
3. **Locate related code:** If `codebase-memory-mcp` is available, use `search_code` to find all files touching this feature, and `trace_call_path` to understand dependency chain before writing tests — faster and more accurate than manual grep. Fallback: Grep for the main function/type names in the changed files.
|
|
20
|
+
|
|
18
21
|
4. **Read existing tests** for the changed files — find patterns, fixtures, naming conventions. Don't duplicate.
|
|
19
22
|
|
|
20
23
|
---
|
|
@@ -111,19 +114,32 @@ Files: [test files touched]
|
|
|
111
114
|
Stories: [AS-001 ✓, AS-002 ✓, AS-005 new]
|
|
112
115
|
```
|
|
113
116
|
|
|
114
|
-
|
|
117
|
+
### Spec Update Signal
|
|
118
|
+
|
|
119
|
+
After every build, check against these conditions. If ANY is true → **must** signal.
|
|
115
120
|
|
|
116
|
-
|
|
121
|
+
**Signal when (MUST):**
|
|
117
122
|
|
|
118
|
-
|
|
123
|
+
| # | Condition |
|
|
124
|
+
|---|-----------|
|
|
125
|
+
| S1 | A new test covers behavior, edge case, or error path with no corresponding AS in the spec |
|
|
126
|
+
| S2 | Code behavior no longer matches the Given/When/Then of an existing AS (spec is stale) |
|
|
127
|
+
| S3 | Implementation adds a new constraint or guard not documented in any AS or Constraints section |
|
|
119
128
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
129
|
+
**Do not signal when:**
|
|
130
|
+
- Pure refactor — behavior unchanged, all existing AS still map correctly
|
|
131
|
+
- Performance fix — same output, just faster
|
|
132
|
+
- Fix to match spec — code was wrong, spec was right, no new behavior added
|
|
133
|
+
|
|
134
|
+
**Signal format:**
|
|
135
|
+
```
|
|
136
|
+
⚠️ Spec Update Needed — run `/mf-plan docs/specs/<feature>/<feature>.md '<describe change>'`
|
|
137
|
+
Reason: [S1 | S2 | S3] — <one line: what is missing or mismatched>
|
|
138
|
+
```
|
|
123
139
|
|
|
124
|
-
|
|
140
|
+
If S1 applies to a failing test: state **"This failure suggests a missing acceptance scenario."** Describe the gap and prompt to run `/mf-plan` before re-running `/mf-build`. Do not silently add the test without the AS.
|
|
125
141
|
|
|
126
142
|
## Rules
|
|
127
143
|
1. **Behavior over implementation.** Test what code DOES, not how.
|
|
128
144
|
2. **Independent tests.** Each test sets up its own state, cleans up after.
|
|
129
|
-
3. **Spec stays upstream.** If a test reveals a spec gap, update the spec before adding the test.
|
|
145
|
+
3. **Spec stays upstream.** If a test reveals a spec gap (S1), signal and update the spec before adding the test. If code drifts from spec (S2), signal. If new constraint added (S3), signal.
|
|
@@ -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?
|
|
16
|
-
2. **Locate the code.** Grep for keywords from the bug (error messages, function names).
|
|
17
|
-
3. **Check history.** `git log --oneline -
|
|
18
|
-
4. **
|
|
23
|
+
1. **Parse the report.** Symptom? Expected vs actual? Repro steps? If context is missing → ask ONE question via AskUserQuestion before proceeding.
|
|
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).
|
|
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,24 +121,54 @@ 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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Root cause:
|
|
101
|
-
|
|
102
|
-
|
|
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
|
|
138
|
+
|
|
139
|
+
After fixing, check these conditions. If ANY is true → **must** signal.
|
|
140
|
+
|
|
141
|
+
**Signal when (MUST):**
|
|
142
|
+
|
|
143
|
+
| # | Condition |
|
|
144
|
+
|---|-----------|
|
|
145
|
+
| S1 | Fix covers an edge case or error path with no corresponding AS in the spec |
|
|
146
|
+
| S2 | Bug existed because an AS described wrong behavior — After fix, code and AS now conflict |
|
|
147
|
+
| S3 | Fix adds a new constraint or guard (null check, balance guard, validation) not in spec |
|
|
148
|
+
|
|
149
|
+
**Do not signal when:**
|
|
150
|
+
- Fix is a clear typo/off-by-one — code was always wrong relative to spec, no new behavior
|
|
151
|
+
- Performance-only fix — output unchanged
|
|
152
|
+
|
|
153
|
+
**Signal format:**
|
|
154
|
+
```
|
|
155
|
+
⚠️ Spec Update Needed — run `/mf-plan docs/specs/<feature>/<feature>.md '<describe change>'`
|
|
156
|
+
Reason: [S1 | S2 | S3] — <one line: what is missing or mismatched>
|
|
157
|
+
```
|
|
106
158
|
|
|
107
159
|
## Multiple Bugs
|
|
108
160
|
|
|
109
161
|
If `$ARGUMENTS` describes multiple bugs: triage by severity, fix one at a time, commit each separately.
|
|
110
162
|
|
|
111
163
|
## Rules
|
|
112
|
-
1. **Investigate before coding.**
|
|
164
|
+
1. **Investigate before coding.** Root cause hypothesis before test. Evidence before fix.
|
|
113
165
|
2. **Minimal fix.** One bug, one change. Don't improve the neighborhood.
|
|
114
166
|
3. **Never weaken tests.** If existing tests break, the fix is wrong.
|
|
115
167
|
4. **Ask before touching production code** if unsure.
|
|
116
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.
|
|
@@ -13,6 +13,7 @@ Pre-merge code review — security, correctness, spec alignment.
|
|
|
13
13
|
```
|
|
14
14
|
2. Check for spec in `docs/specs/<feature>/<feature>.md` — review against INTENT.
|
|
15
15
|
3. Read the diff: `git diff "$BASE"...HEAD`
|
|
16
|
+
4. **Expand blast radius:** If `codebase-memory-mcp` is available, use `search_code("<changed function or type>")` to find files not in the diff that may be affected, and `get_architecture()` to check if changed files belong to a sensitive layer (auth, payment, core). Fallback: skip, review diff only.
|
|
16
17
|
|
|
17
18
|
If `$ARGUMENTS` provided → scope to those files only.
|
|
18
19
|
If diff > 500 lines → review file-by-file, prioritize by smart focus below.
|