@massu/core 2.5.2 → 2.5.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.
Files changed (93) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/agents/massu-output-scorer.md +2 -2
  3. package/agents/massu-plan-auditor.md +1 -1
  4. package/commands/_shared-references/test-first-protocol.md +4 -4
  5. package/commands/_shared-references/verification-table.md +5 -5
  6. package/commands/massu-audit-deps.md +2 -2
  7. package/commands/massu-batch.md +3 -3
  8. package/commands/massu-checkpoint.md +7 -7
  9. package/commands/massu-ci-fix.md +1 -1
  10. package/commands/massu-cleanup.md +16 -16
  11. package/commands/massu-commit.md +7 -7
  12. package/commands/massu-create-plan.md +7 -7
  13. package/commands/massu-dead-code.md +3 -3
  14. package/commands/massu-debug/references/common-shortcuts.md +1 -1
  15. package/commands/massu-debug/references/investigation-phases.md +4 -4
  16. package/commands/massu-debug/references/report-format.md +2 -2
  17. package/commands/massu-deploy.md +1 -1
  18. package/commands/massu-deps.md +5 -5
  19. package/commands/massu-doc-gen.md +3 -3
  20. package/commands/massu-docs.md +6 -6
  21. package/commands/massu-estimate.md +3 -3
  22. package/commands/massu-golden-path/references/competitive-mode.md +2 -2
  23. package/commands/massu-golden-path/references/phase-1-plan-creation.md +1 -1
  24. package/commands/massu-golden-path/references/phase-2-implementation.md +2 -2
  25. package/commands/massu-golden-path/references/phase-4-commit.md +3 -3
  26. package/commands/massu-golden-path/references/phase-5-push.md +5 -5
  27. package/commands/massu-guide.md +3 -3
  28. package/commands/massu-hotfix.md +14 -14
  29. package/commands/massu-loop/references/checkpoint-audit.md +3 -3
  30. package/commands/massu-loop/references/iteration-structure.md +3 -3
  31. package/commands/massu-loop/references/loop-controller.md +5 -5
  32. package/commands/massu-loop/references/plan-extraction.md +4 -4
  33. package/commands/massu-loop/references/vr-plan-spec.md +3 -3
  34. package/commands/massu-loop-playwright.md +5 -5
  35. package/commands/massu-loop.md +1 -1
  36. package/commands/massu-new-feature.md +6 -24
  37. package/commands/massu-perf.md +1 -1
  38. package/commands/massu-plan.md +21 -21
  39. package/commands/massu-push-light.md +9 -9
  40. package/commands/massu-recap.md +1 -1
  41. package/commands/massu-refactor.md +8 -8
  42. package/commands/massu-release.md +3 -3
  43. package/commands/massu-review.md +1 -1
  44. package/commands/massu-rollback.md +6 -6
  45. package/commands/massu-scaffold-page.md +1 -1
  46. package/commands/massu-scaffold-router.md +1 -1
  47. package/commands/massu-status.md +9 -9
  48. package/commands/massu-tdd.md +2 -2
  49. package/commands/massu-test.md +13 -13
  50. package/commands/massu-verify-playwright.md +1 -1
  51. package/commands/massu-verify.md +20 -20
  52. package/dist/cli.js +1265 -876
  53. package/dist/hooks/auto-learning-pipeline.js +517 -56
  54. package/dist/hooks/classify-failure.js +495 -47
  55. package/dist/hooks/cost-tracker.js +65 -27
  56. package/dist/hooks/fix-detector.js +496 -47
  57. package/dist/hooks/incident-pipeline.js +72 -28
  58. package/dist/hooks/intent-suggester.js +65 -27
  59. package/dist/hooks/memory-recall.js +65 -27
  60. package/dist/hooks/post-edit-context.js +65 -27
  61. package/dist/hooks/post-tool-use.js +70 -29
  62. package/dist/hooks/pre-compact.js +65 -27
  63. package/dist/hooks/pre-delete-check.js +65 -27
  64. package/dist/hooks/pre-tool-use-gate.js +193 -37
  65. package/dist/hooks/quality-event.js +65 -27
  66. package/dist/hooks/rule-enforcement-pipeline.js +65 -27
  67. package/dist/hooks/security-gate.js +197 -38
  68. package/dist/hooks/session-end.js +68 -27
  69. package/dist/hooks/session-start.js +116 -61
  70. package/dist/hooks/user-prompt.js +65 -27
  71. package/docs/SECURITY.md +1 -1
  72. package/fragments/feature-components.md +15 -0
  73. package/fragments/feature-components.python.md +15 -0
  74. package/fragments/feature-components.typescript.md +15 -0
  75. package/package.json +6 -5
  76. package/patterns/testing-patterns.md +8 -8
  77. package/protocols/plan-implementation.md +2 -2
  78. package/protocols/verification.md +4 -4
  79. package/reference/lessons-learned.md +4 -4
  80. package/reference/vr-verification-reference.md +9 -9
  81. package/templates/aspnet/massu.config.yaml +2 -0
  82. package/templates/go-chi/massu.config.yaml +2 -0
  83. package/templates/multi-runtime/massu.config.yaml +4 -2
  84. package/templates/phoenix/massu.config.yaml +2 -0
  85. package/templates/python-django/massu.config.yaml +3 -1
  86. package/templates/python-fastapi/massu.config.yaml +3 -1
  87. package/templates/python-flask/massu.config.yaml +3 -1
  88. package/templates/rails/massu.config.yaml +4 -2
  89. package/templates/rust-actix/massu.config.yaml +2 -0
  90. package/templates/spring/massu.config.yaml +2 -0
  91. package/templates/swift-ios/massu.config.yaml +3 -1
  92. package/templates/ts-nestjs/massu.config.yaml +2 -0
  93. package/templates/ts-nextjs/massu.config.yaml +2 -0
@@ -92,10 +92,10 @@ Compare tools found in codebase against README documentation.
92
92
  ### 2.1 Extract Tool Output Strings
93
93
  ```bash
94
94
  # Find tool output text
95
- grep -rn "text:" packages/core/src/ --include="*.ts" | grep -v "__tests__" | head -30
95
+ grep -rn "text:" {{paths.source}}/ --include="*.ts" | grep -v "__tests__" | head -30
96
96
 
97
97
  # Find error messages
98
- grep -rn "Error\|error\|Invalid\|invalid" packages/core/src/ --include="*.ts" | grep -v "__tests__" | head -20
98
+ grep -rn "Error\|error\|Invalid\|invalid" {{paths.source}}/ --include="*.ts" | grep -v "__tests__" | head -20
99
99
  ```
100
100
 
101
101
  ### 2.2 Terminology Matrix
@@ -159,7 +159,7 @@ grep -c "description\|comment\|//" packages/core/src/config.ts
159
159
  ### 4.2 API Documentation
160
160
  ```bash
161
161
  # Check if tool inputSchema has descriptions for all properties
162
- grep -rn "description:" packages/core/src/ --include="*.ts" | grep -v "__tests__" | wc -l
162
+ grep -rn "description:" {{paths.source}}/ --include="*.ts" | grep -v "__tests__" | wc -l
163
163
  ```
164
164
 
165
165
  ### 4.3 Config Documentation Matrix
@@ -204,7 +204,7 @@ grep -c "tool\|hook\|config\|install\|usage" packages/core/README.md 2>/dev/null
204
204
  ### 6.1 CLAUDE.md Accuracy
205
205
  ```bash
206
206
  # Check if CLAUDE.md file locations match actual
207
- grep "packages/core/src/" .claude/CLAUDE.md | while read line; do
207
+ grep "{{paths.source}}/" .claude/CLAUDE.md | while read line; do
208
208
  path=$(echo "$line" | sed -n 's/.*\(packages\/core\/src\/[a-zA-Z0-9_.\/-]*\).*/\1/p')
209
209
  if [ -n "$path" ]; then
210
210
  [ -f "$path" ] && echo "OK: $path" || echo "MISSING: $path"
@@ -218,8 +218,8 @@ grep -c "\.ts" .claude/CLAUDE.md
218
218
  ### 6.2 Build & Test Commands Accuracy
219
219
  ```bash
220
220
  # Verify each documented build command works
221
- npm run build --dry-run 2>/dev/null
222
- npm test --help 2>/dev/null
221
+ {{verify.build | default("(this stack declares no build step)")}} --dry-run 2>/dev/null
222
+ {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}} --help 2>/dev/null
223
223
  ```
224
224
 
225
225
  ### 6.3 Developer Docs Matrix
@@ -70,7 +70,7 @@ Determine what the change will touch.
70
70
 
71
71
  ```bash
72
72
  # Search for related code to the requested feature
73
- grep -rn "$ARGUMENTS" packages/core/src/ --include="*.ts" | head -20
73
+ grep -rn "$ARGUMENTS" {{paths.source}}/ --include="*.ts" | head -20
74
74
  grep -rn "$ARGUMENTS" website/src/ --include="*.ts" --include="*.tsx" | head -20
75
75
  ```
76
76
 
@@ -106,7 +106,7 @@ grep -A 30 "interface.*Config\|type.*Config" packages/core/src/config.ts 2>/dev/
106
106
 
107
107
  ```bash
108
108
  # How many files import from core modules that would change
109
- grep -rn "from.*tools\|from.*server\|from.*config" packages/core/src/ --include="*.ts" | wc -l
109
+ grep -rn "from.*tools\|from.*server\|from.*config" {{paths.source}}/ --include="*.ts" | wc -l
110
110
  ```
111
111
 
112
112
  ```markdown
@@ -162,7 +162,7 @@ Score: [1-5] — Justification: [number of integration points]
162
162
 
163
163
  ```bash
164
164
  # Existing test patterns for reference
165
- ls packages/core/src/__tests__/ 2>/dev/null
165
+ ls {{paths.tests | default("tests")}}/ 2>/dev/null
166
166
  wc -l packages/core/src/__tests__/*.test.ts 2>/dev/null | sort -rn | head -5
167
167
  ```
168
168
 
@@ -78,7 +78,7 @@ IMPLEMENTATION RULES:
78
78
  2. Follow ALL CLAUDE.md patterns (ctx.db, protectedProcedure, etc.)
79
79
  3. Do NOT run database migrations (handled separately)
80
80
  4. Run pattern-scanner after each file: bash scripts/massu-pattern-scanner.sh
81
- 5. Run tsc after implementation: cd packages/core && npx tsc --noEmit
81
+ 5. Run tsc after implementation: {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}
82
82
  6. Fix any issues before declaring done
83
83
 
84
84
  OUTPUT FORMAT (at completion):
@@ -252,7 +252,7 @@ IF cleanup fails:
252
252
 
253
253
  ```
254
254
  1. Run bash scripts/massu-pattern-scanner.sh (exit 0 required)
255
- 2. Run cd packages/core && npx tsc --noEmit (0 errors required)
255
+ 2. Run {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}} (0 errors required)
256
256
  3. IF either fails:
257
257
  Fix issues from merge
258
258
  Re-run verification
@@ -34,7 +34,7 @@ If feature uses config-driven values:
34
34
 
35
35
  ```bash
36
36
  # Check config keys used in code
37
- grep -rn "getConfig()" packages/core/src/ | grep -o 'config\.\w\+' | sort -u
37
+ grep -rn "getConfig()" {{paths.source}}/ | grep -o 'config\.\w\+' | sort -u
38
38
  # Compare to massu.config.yaml structure
39
39
  ```
40
40
 
@@ -61,8 +61,8 @@ For each plan item:
61
61
  CHECKPOINT:
62
62
  [1] READ plan section [2] GREP tool registrations [3] LS modules
63
63
  [4] VR-CONFIG check [5] VR-TOOL-REG check [6] VR-HOOK-BUILD check
64
- [7] Pattern scanner [8] npm run build [9] cd packages/core && npx tsc --noEmit
65
- [10] npm test [11] VR-GENERIC check [12] Security scanner
64
+ [7] Pattern scanner [8] {{verify.build | default("(this stack declares no build step)")}} [9] {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}
65
+ [10] {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}} [11] VR-GENERIC check [12] Security scanner
66
66
  [13] COUNT gaps -> IF > 0: FIX and return to [1]
67
67
  ```
68
68
 
@@ -13,9 +13,9 @@
13
13
  | Gate | Command | Expected |
14
14
  |------|---------|----------|
15
15
  | 1. Pattern Scanner | `bash scripts/massu-pattern-scanner.sh` | Exit 0 |
16
- | 2. Type Safety (VR-TYPE) | `cd packages/core && npx tsc --noEmit` | 0 errors |
17
- | 3. Build (VR-BUILD) | `npm run build` | Exit 0 |
18
- | 4. Tests (VR-TEST) | `npm test` | ALL pass |
16
+ | 2. Type Safety (VR-TYPE) | `{{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}` | 0 errors |
17
+ | 3. Build (VR-BUILD) | `{{verify.build | default("(this stack declares no build step)")}}` | Exit 0 |
18
+ | 4. Tests (VR-TEST) | `{{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}` | ALL pass |
19
19
  | 5. Hook Compilation (VR-HOOK-BUILD) | `cd packages/core && npm run build:hooks` | Exit 0 |
20
20
  | 6. Generalization (VR-GENERIC) | `bash scripts/massu-generalization-scanner.sh` | Exit 0 |
21
21
  | 7. Security Scanner | `bash scripts/massu-security-scanner.sh` | Exit 0 |
@@ -22,8 +22,8 @@ Run in parallel where possible:
22
22
  |-------|---------|
23
23
  | Pattern Scanner | `bash scripts/massu-pattern-scanner.sh` |
24
24
  | Generalization | `bash scripts/massu-generalization-scanner.sh` |
25
- | TypeScript | `cd packages/core && npx tsc --noEmit` |
26
- | Build | `npm run build` |
25
+ | TypeScript | `{{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}` |
26
+ | Build | `{{verify.build | default("(this stack declares no build step)")}}` |
27
27
  | Hook Compilation | `cd packages/core && npm run build:hooks` |
28
28
 
29
29
  ## 5.3 Tier 2: Test Suite (CRITICAL)
@@ -33,11 +33,11 @@ Run in parallel where possible:
33
33
  ```bash
34
34
  # Establish baseline on main
35
35
  git stash && git checkout main -q
36
- npm test 2>&1 | tee /tmp/baseline-tests.txt
36
+ {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}} 2>&1 | tee /tmp/baseline-tests.txt
37
37
  git checkout - -q && git stash pop -q
38
38
 
39
39
  # Run on current branch
40
- npm test 2>&1 | tee /tmp/current-tests.txt
40
+ {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}} 2>&1 | tee /tmp/current-tests.txt
41
41
 
42
42
  # Compare: any test passing on main but failing now = REGRESSION
43
43
  # Regressions MUST be fixed before push
@@ -49,7 +49,7 @@ Use **parallel Task agents** for independent checks:
49
49
 
50
50
  ```
51
51
  Agent Group A (parallel):
52
- - Agent 1: npm test (unit tests)
52
+ - Agent 1: {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}} (unit tests)
53
53
  - Agent 2: npm audit --audit-level=high
54
54
  - Agent 3: bash scripts/massu-security-scanner.sh
55
55
 
@@ -109,9 +109,9 @@ Present the standard development workflow:
109
109
  ```
110
110
 
111
111
  Explain the verification system:
112
- - **VR-BUILD**: `npm run build` must exit 0
113
- - **VR-TYPE**: `npx tsc --noEmit` must have 0 errors
114
- - **VR-TEST**: `npm test` must pass (MANDATORY)
112
+ - **VR-BUILD**: `{{verify.build | default("(this stack declares no build step)")}}` must exit 0
113
+ - **VR-TYPE**: `{{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}` must have 0 errors
114
+ - **VR-TEST**: `{{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}` must pass (MANDATORY)
115
115
  - **VR-SCHEMA**: Query database before using column names
116
116
  - **VR-NEGATIVE**: grep returns 0 matches for removed code
117
117
 
@@ -128,7 +128,7 @@ ORDER BY ordinal_position;
128
128
  ```bash
129
129
  # VR-CONFIG: Verify config values match code expectations
130
130
  cat massu.config.yaml
131
- grep -rn "getConfig()" packages/core/src/ | head -10
131
+ grep -rn "getConfig()" {{paths.source}}/ | head -10
132
132
  ```
133
133
 
134
134
  ---
@@ -226,8 +226,8 @@ git checkout -b hotfix/[issue-name]
226
226
  ### 3.3 Verify Fix Locally
227
227
  ```bash
228
228
  # Quick verification
229
- npx tsc --noEmit
230
- npm run build
229
+ {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}
230
+ {{verify.build | default("(this stack declares no build step)")}}
231
231
 
232
232
  # Pattern check
233
233
  bash scripts/massu-pattern-scanner.sh
@@ -240,16 +240,16 @@ bash scripts/massu-pattern-scanner.sh
240
240
  ### 4.1 Essential Checks Only
241
241
  ```bash
242
242
  # Type safety
243
- npx tsc --noEmit
243
+ {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}
244
244
 
245
245
  # Build integrity
246
- npm run build
246
+ {{verify.build | default("(this stack declares no build step)")}}
247
247
 
248
248
  # Pattern scanner
249
249
  bash scripts/massu-pattern-scanner.sh
250
250
 
251
251
  # Tests
252
- npm test
252
+ {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}
253
253
 
254
254
  # Security check
255
255
  git diff --cached --name-only | grep -E '\.(env|pem|key)' && echo "FAIL" || echo "PASS"
@@ -261,10 +261,10 @@ git diff --cached --name-only | grep -E '\.(env|pem|key)' && echo "FAIL" || echo
261
261
 
262
262
  | Check | Command | Result | Status |
263
263
  |-------|---------|--------|--------|
264
- | Types | npx tsc --noEmit | 0 errors | PASS |
265
- | Build | npm run build | Exit 0 | PASS |
264
+ | Types | {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}} | 0 errors | PASS |
265
+ | Build | {{verify.build | default("(this stack declares no build step)")}} | Exit 0 | PASS |
266
266
  | Patterns | massu-pattern-scanner.sh | Exit 0 | PASS |
267
- | Tests | npm test | All pass | PASS |
267
+ | Tests | {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}} | All pass | PASS |
268
268
  | Secrets | git diff check | 0 files | PASS |
269
269
 
270
270
  **ALL CRITICAL CHECKS: PASS/FAIL**
@@ -351,7 +351,7 @@ git push origin main
351
351
  ```bash
352
352
  # Check for new errors in output/logs
353
353
  # Run tests again post-deploy
354
- npm test
354
+ {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}
355
355
  ```
356
356
 
357
357
  ---
@@ -448,7 +448,7 @@ After hotfix, update `session-state/CURRENT.md`:
448
448
  ## Verification Evidence
449
449
 
450
450
  ### Hotfix: [Name]
451
- - Command: `npm run build && npm test`
451
+ - Command: `{{verify.build | default("(this stack declares no build step)")}} && {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}`
452
452
  - Result: Exit 0
453
453
  - Status: VERIFIED COMPLETE
454
454
  ```
@@ -469,8 +469,8 @@ git push origin main
469
469
  ### Verify Rollback
470
470
  ```bash
471
471
  # Confirm no new issues from hotfix revert
472
- npm test
473
- npx tsc --noEmit
472
+ {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}
473
+ {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}
474
474
  ```
475
475
 
476
476
  ---
@@ -551,7 +551,7 @@ This ensures that if the session compacts, the recovery protocol knows only `/ma
551
551
  1. **Ingest into massu memory**: Use `mcp__massu-codegraph__massu_memory_ingest` with type="bugfix", importance=5 (hotfixes are always high importance), description of root cause + fix
552
552
  2. **Record in session state**: Add the wrong pattern and correct pattern to `.claude/session-state/CURRENT.md`
553
553
  3. **Add to pattern scanner**: If the bad pattern is grep-able, add detection to `scripts/massu-pattern-scanner.sh`
554
- 4. **Search codebase-wide**: `grep -rn "[bad_pattern]" packages/core/src/` and fix ALL instances (CR-9)
554
+ 4. **Search codebase-wide**: `grep -rn "[bad_pattern]" {{paths.source}}/` and fix ALL instances (CR-9)
555
555
  5. **Consider new CR rule**: If this is a class of bug (not one-off), propose a new CR rule for CLAUDE.md
556
556
 
557
557
  **Hotfixes without learning are wasted crises. Every outage teaches something -- capture it.**
@@ -13,9 +13,9 @@ CHECKPOINT AUDIT FLOW:
13
13
  [3] LS files to verify they exist
14
14
  [4] VR-TOOL-REG: Verify tools are WIRED in tools.ts (not just created)
15
15
  [5] GREP for pattern violations
16
- [6] RUN build verification (npm run build)
17
- [7] RUN type verification (cd packages/core && npx tsc --noEmit)
18
- [8] RUN tests (npm test) - MANDATORY, NOT optional
16
+ [6] RUN build verification ({{verify.build | default("(this stack declares no build step)")}})
17
+ [7] RUN type verification ({{verify.type | default("declare verification.LANG.type in massu.config.yaml")}})
18
+ [8] RUN tests ({{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}) - MANDATORY, NOT optional
19
19
  [9] RUN hook build (cd packages/core && npm run build:hooks)
20
20
  [10] RUN pattern scanner (bash scripts/massu-pattern-scanner.sh)
21
21
  [11] RUN security check (secrets staged)
@@ -73,10 +73,10 @@ For every file you create or modify, verify against:
73
73
  bash scripts/massu-pattern-scanner.sh
74
74
 
75
75
  # Type check
76
- cd packages/core && npx tsc --noEmit
76
+ {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}
77
77
 
78
78
  # Tests still pass
79
- npm test
79
+ {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}
80
80
  ```
81
81
 
82
82
  ### Massu-Specific Implementation Checks
@@ -99,7 +99,7 @@ Verify tools exist with 3-function pattern (getDefs, isTool, handleCall) in tool
99
99
 
100
100
  ## ENVIRONMENT & CONFIG VERIFICATION
101
101
 
102
- Verify env vars documented, no hardcoded secrets (`grep -rn "sk-\|password.*=" packages/core/src/` = 0), config files exist.
102
+ Verify env vars documented, no hardcoded secrets (`grep -rn "sk-\|password.*=" {{paths.source}}/` = 0), config files exist.
103
103
 
104
104
  ---
105
105
 
@@ -140,8 +140,8 @@ WHILE true:
140
140
  Fix any gaps you find (code or plan document).
141
141
 
142
142
  CONTEXT: Massu is a TypeScript monorepo with:
143
- - packages/core/src/ (MCP server source)
144
- - packages/core/src/__tests__/ (vitest tests)
143
+ - {{paths.source}}/ (MCP server source)
144
+ - {{paths.tests | default("tests")}}/ (vitest tests)
145
145
  - packages/core/src/hooks/ (esbuild-compiled hooks)
146
146
  - website/ (Next.js + Supabase website)
147
147
  - massu.config.yaml (project config)
@@ -149,13 +149,13 @@ WHILE true:
149
149
 
150
150
  VERIFICATION COMMANDS:
151
151
  - Pattern scanner: bash scripts/massu-pattern-scanner.sh
152
- - Type check: cd packages/core && npx tsc --noEmit
153
- - Tests: npm test
152
+ - Type check: {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}
153
+ - Tests: {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}
154
154
  - Hook build: cd packages/core && npm run build:hooks
155
155
 
156
156
  VR-* CHECKS (use ONLY these, per CLAUDE.md):
157
157
  - VR-FILE, VR-GREP, VR-NEGATIVE, VR-COUNT (generic)
158
- - VR-BUILD: npm run build (tsc + hooks)
158
+ - VR-BUILD: {{verify.build | default("(this stack declares no build step)")}} (tsc + hooks)
159
159
  - VR-TYPE, VR-TEST, VR-TOOL-REG, VR-HOOK-BUILD, VR-CONFIG, VR-PATTERN
160
160
 
161
161
  CRITICAL INSTRUCTION FOR GAPS_DISCOVERED:
@@ -31,9 +31,9 @@ For EACH section of the plan, extract concrete items into a table:
31
31
  ### Extracted Items
32
32
  | Item # | Type | Description | Location | Verification Command | Status |
33
33
  |--------|------|-------------|----------|---------------------|--------|
34
- | P1-001 | MODULE_CREATE | foo-tools.ts | packages/core/src/ | ls -la [path] | PENDING |
34
+ | P1-001 | MODULE_CREATE | foo-tools.ts | {{paths.source}}/ | ls -la [path] | PENDING |
35
35
  | P1-002 | TOOL_WIRE | Wire into tools.ts | packages/core/src/tools.ts | grep [module] tools.ts | PENDING |
36
- | P2-001 | TEST | foo.test.ts | packages/core/src/__tests__/ | npm test | PENDING |
36
+ | P2-001 | TEST | foo.test.ts | {{paths.tests | default("tests")}}/ | {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}} | PENDING |
37
37
 
38
38
  ### Item Types
39
39
  - MODULE_CREATE: New TypeScript module
@@ -55,10 +55,10 @@ For EACH section of the plan, extract concrete items into a table:
55
55
  | MODULE_CREATE | `ls -la [path]` | File exists, size > 0 |
56
56
  | MODULE_MODIFY | `grep "[change]" [file]` | Pattern found |
57
57
  | TOOL_WIRE | `grep "getXDefs\|isXTool\|handleXCall" tools.ts` | All 3 present |
58
- | TEST | `npm test` | All pass |
58
+ | TEST | `{{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}` | All pass |
59
59
  | CONFIG | Parse YAML, grep interface | Valid |
60
60
  | HOOK | `cd packages/core && npm run build:hooks` | Exit 0 |
61
- | REMOVAL | `grep -rn "[old]" packages/core/src/ | wc -l` | 0 matches |
61
+ | REMOVAL | `grep -rn "[old]" {{paths.source}}/ | wc -l` | 0 matches |
62
62
 
63
63
  ### Step 0.4: Track Coverage Throughout
64
64
 
@@ -110,9 +110,9 @@ CS Loop is COMPLETE **only when BOTH gates pass: Code Quality AND Plan Coverage*
110
110
  | Gate | Command | Result |
111
111
  |------|---------|--------|
112
112
  | Pattern scanner | `bash scripts/massu-pattern-scanner.sh` | Exit 0 |
113
- | Type check | `cd packages/core && npx tsc --noEmit` | 0 errors |
114
- | Build | `npm run build` | Exit 0 |
115
- | Tests | `npm test` | All pass |
113
+ | Type check | `{{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}` | 0 errors |
114
+ | Build | `{{verify.build | default("(this stack declares no build step)")}}` | Exit 0 |
115
+ | Tests | `{{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}` | All pass |
116
116
  | Hook build | `cd packages/core && npm run build:hooks` | Exit 0 |
117
117
 
118
118
  ### GATE 2: Plan Coverage Evidence
@@ -500,8 +500,8 @@ FOR EACH issue in issues WHERE priority <= P2:
500
500
  - For code-level verification: run applicable VR-* checks
501
501
  - VR-GREP: Confirm correct pattern is present
502
502
  - VR-NEGATIVE: Confirm incorrect pattern is removed
503
- - VR-BUILD: npm run build (must pass)
504
- - VR-TYPE: npx tsc --noEmit (must pass)
503
+ - VR-BUILD: {{verify.build | default("(this stack declares no build step)")}} (must pass)
504
+ - VR-TYPE: {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}} (must pass)
505
505
 
506
506
  4. LOG the fix
507
507
  - Record in fix log table (see report format below)
@@ -629,7 +629,7 @@ Timestamps MUST be in PST (America/Los_Angeles).
629
629
 
630
630
  | # | Issue | Severity | File(s) Changed | Fix Applied | VR Check | Verified |
631
631
  |---|-------|----------|-----------------|-------------|----------|----------|
632
- | 1 | TypeError in DocsPage | P0 | packages/core/src/... | Added null guard | VR-GREP | YES |
632
+ | 1 | TypeError in DocsPage | P0 | {{paths.source}}/... | Added null guard | VR-GREP | YES |
633
633
 
634
634
  ---
635
635
 
@@ -653,8 +653,8 @@ Timestamps MUST be in PST (America/Los_Angeles).
653
653
 
654
654
  | Check | Command | Result |
655
655
  |-------|---------|--------|
656
- | Build | npm run build | Exit 0 / PENDING |
657
- | Types | npx tsc --noEmit | 0 errors / PENDING |
656
+ | Build | {{verify.build | default("(this stack declares no build step)")}} | Exit 0 / PENDING |
657
+ | Types | {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}} | 0 errors / PENDING |
658
658
  | Browser Retest | Console errors after reload | 0 / PENDING DEPLOY |
659
659
  ```
660
660
 
@@ -59,7 +59,7 @@ Execute task/plan autonomously with **verified proof at every step**. Continue u
59
59
 
60
60
  ## COMPLETION MANDATE
61
61
 
62
- Loop does NOT stop until: (1) every plan item verified 100%, (2) every VR-* check passes with proof, (3) pattern scanner 0 violations, (4) type check passes, (5) ALL tests pass (npm test exit 0), (6) hook build succeeds. Test failures must be fixed regardless of origin. No deferral, no "should I continue?", no partial progress reports. Register features with massu_sentinel (CR-11).
62
+ Loop does NOT stop until: (1) every plan item verified 100%, (2) every VR-* check passes with proof, (3) pattern scanner 0 violations, (4) type check passes, (5) ALL tests pass ({{verify.test | default("declare verification.LANG.test in massu.config.yaml")}} exit 0), (6) hook build succeeds. Test failures must be fixed regardless of origin. No deferral, no "should I continue?", no partial progress reports. Register features with massu_sentinel (CR-11).
63
63
 
64
64
  ---
65
65
 
@@ -172,25 +172,7 @@ Before starting, determine what the feature needs:
172
172
  ```markdown
173
173
  ### Feature: [FEATURE_NAME]
174
174
 
175
- #### Components Needed
176
- - [ ] Tool module file (packages/core/src/[feature].ts)
177
- - [ ] Tool definitions (getXToolDefinitions)
178
- - [ ] Tool name matcher (isXTool)
179
- - [ ] Tool handler (handleXToolCall)
180
- - [ ] Wire into tools.ts
181
- - [ ] Input schemas
182
- - [ ] Config integration
183
- - [ ] Tests (packages/core/src/__tests__/[feature].test.ts)
184
- - [ ] Documentation
185
-
186
- #### Patterns to Apply (MANDATORY)
187
-
188
- **Tool Registration Patterns:**
189
- - [ ] 3-function pattern (getDefs + isTool + handleCall)
190
- - [ ] Config-driven tool prefix via getConfig().toolPrefix
191
- - [ ] Wire definitions into getToolDefinitions() in tools.ts
192
- - [ ] Wire handler into handleToolCall() in tools.ts
193
- - [ ] stripPrefix() for base name matching
175
+ {{> feature-components}}
194
176
 
195
177
  **Database Patterns:**
196
178
  - [ ] getMemoryDb() with try/finally for memory operations
@@ -234,7 +216,7 @@ Based on feature type, load relevant patterns from CLAUDE.md:
234
216
  ls packages/core/src/*[feature]* 2>/dev/null
235
217
 
236
218
  # Find modules with similar functionality
237
- grep -rln "[functionality]" packages/core/src/ | head -20
219
+ grep -rln "[functionality]" {{paths.source}}/ | head -20
238
220
 
239
221
  # Check existing tool modules
240
222
  grep "ToolDefinitions" packages/core/src/*.ts
@@ -359,7 +341,7 @@ describe('[feature] tools', () => {
359
341
  ### 2.2 Verify Tests
360
342
  ```bash
361
343
  # Run tests
362
- npm test
344
+ {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}
363
345
 
364
346
  # Verify test file exists
365
347
  ls -la packages/core/src/__tests__/[feature].test.ts
@@ -375,16 +357,16 @@ ls -la packages/core/src/__tests__/[feature].test.ts
375
357
  bash scripts/massu-pattern-scanner.sh
376
358
 
377
359
  # Type check
378
- cd packages/core && npx tsc --noEmit
360
+ {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}
379
361
 
380
362
  # Build (includes hook compilation)
381
- npm run build
363
+ {{verify.build | default("(this stack declares no build step)")}}
382
364
 
383
365
  # Hook build
384
366
  cd packages/core && npm run build:hooks
385
367
 
386
368
  # Tests
387
- npm test
369
+ {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}
388
370
  ```
389
371
 
390
372
  ### 3.2 Tool Registration Verification (VR-TOOL-REG)
@@ -141,7 +141,7 @@ grep -rn "take:\s*[0-9]\{3,\}" src/
141
141
  ### 2.1 Bundle Analysis
142
142
  ```bash
143
143
  # Analyze bundle size
144
- npm run build 2>&1 | grep -A 50 "Route\|Size"
144
+ {{verify.build | default("(this stack declares no build step)")}} 2>&1 | grep -A 50 "Route\|Size"
145
145
 
146
146
  # Check for large dependencies
147
147
  npm ls --depth=0 | head -30
@@ -127,17 +127,17 @@ WHILE true:
127
127
  Fix any plan document gaps you find.
128
128
 
129
129
  CONTEXT: Massu is a TypeScript monorepo with:
130
- - packages/core/src/ (MCP server source)
131
- - packages/core/src/__tests__/ (vitest tests)
130
+ - {{paths.source}}/ (MCP server source)
131
+ - {{paths.tests | default("tests")}}/ (vitest tests)
132
132
  - packages/core/src/hooks/ (esbuild-compiled hooks)
133
133
  - massu.config.yaml (project config)
134
134
  - Tool registration: 3-function pattern (getDefs, isTool, handleCall) wired in tools.ts
135
135
 
136
136
  VR-* CHECKS (use ONLY these, per CLAUDE.md):
137
137
  - VR-FILE, VR-GREP, VR-NEGATIVE, VR-COUNT (generic)
138
- - VR-BUILD: npm run build (tsc + hooks)
139
- - VR-TYPE: cd packages/core && npx tsc --noEmit
140
- - VR-TEST: npm test (vitest)
138
+ - VR-BUILD: {{verify.build | default("(this stack declares no build step)")}} (tsc + hooks)
139
+ - VR-TYPE: {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}
140
+ - VR-TEST: {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}} (vitest)
141
141
  - VR-TOOL-REG: tool definitions + handler wired in tools.ts
142
142
  - VR-HOOK-BUILD: cd packages/core && npm run build:hooks
143
143
  - VR-CONFIG: massu.config.yaml parses
@@ -243,9 +243,9 @@ Run a repeatable audit->fix->re-audit loop that verifies the entire plan against
243
243
 
244
244
  | Item # | Type | Description | Expected Location | Verification Command |
245
245
  |--------|------|-------------|-------------------|---------------------|
246
- | P1-001 | MODULE | foo-tools.ts | packages/core/src/ | ls -la [path] |
246
+ | P1-001 | MODULE | foo-tools.ts | {{paths.source}}/ | ls -la [path] |
247
247
  | P1-002 | TOOL_WIRE | Wire into tools.ts | packages/core/src/tools.ts | grep [module] tools.ts |
248
- | P2-001 | TEST | foo-tools.test.ts | packages/core/src/__tests__/ | npm test |
248
+ | P2-001 | TEST | foo-tools.test.ts | {{paths.tests | default("tests")}}/ | {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}} |
249
249
  | P-003 | REMOVAL | Remove pattern | all files | grep -rn "pattern" = 0 |
250
250
 
251
251
  ### Item Types: MODULE (exists), TOOL_WIRE (registered), TEST (passes), CONFIG (parses), HOOK (compiles), REMOVAL (0 matches)
@@ -271,7 +271,7 @@ For files plan modifies: `ls -la [file_path]`. For directories plan creates in:
271
271
  If ANY feature uses config-stored values, verify VALUES match code expectations:
272
272
  ```bash
273
273
  # Find what the CODE expects
274
- grep -rn "getConfig\(\)\." packages/core/src/ | grep -oE 'getConfig\(\)\.\w+' | sort -u
274
+ grep -rn "getConfig\(\)\." {{paths.source}}/ | grep -oE 'getConfig\(\)\.\w+' | sort -u
275
275
  ```
276
276
  Compare config keys to code expectations. Mismatches = FAIL. Add plan items to fix alignment BEFORE implementation.
277
277
 
@@ -442,10 +442,10 @@ grep -rn "[violation pattern]" [directories] | wc -l
442
442
 
443
443
  ```bash
444
444
  # Module inventory
445
- find packages/core/src -name "*.ts" -not -path "*__tests__*" -not -path "*node_modules*" | sort
445
+ find {{paths.source}} -name "*.ts" -not -path "*__tests__*" -not -path "*node_modules*" | sort
446
446
 
447
447
  # Tool definition files
448
- find packages/core/src -name "*-tools.ts" | sort
448
+ find {{paths.source}} -name "*-tools.ts" | sort
449
449
 
450
450
  # Hook files
451
451
  find packages/core/src/hooks -name "*.ts" 2>/dev/null | sort
@@ -457,10 +457,10 @@ Verify: all planned modules exist, all tool files follow naming convention, hook
457
457
 
458
458
  ```bash
459
459
  # Tool definitions in each module
460
- grep -rn "getToolDefinitions\|getDefs" packages/core/src/ | grep -v node_modules | grep -v __tests__
460
+ grep -rn "getToolDefinitions\|getDefs" {{paths.source}}/ | grep -v node_modules | grep -v __tests__
461
461
 
462
462
  # Handler registrations
463
- grep -rn "handleToolCall\|handleCall" packages/core/src/ | grep -v node_modules | grep -v __tests__
463
+ grep -rn "handleToolCall\|handleCall" {{paths.source}}/ | grep -v node_modules | grep -v __tests__
464
464
 
465
465
  # Wiring in tools.ts
466
466
  grep -rn "import\|getDefs\|isTool\|handleCall" packages/core/src/tools.ts
@@ -481,7 +481,7 @@ Verify: all tools have definitions + handlers + wiring in tools.ts. A tool that
481
481
  #### B3. Data Layer Integrity
482
482
 
483
483
  ```bash
484
- cd packages/core && npx tsc --noEmit
484
+ {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}
485
485
  # Compare module interfaces to usage
486
486
  grep -A 10 "export interface\|export type" packages/core/src/[MODULE].ts
487
487
  ```
@@ -533,13 +533,13 @@ Reuse existing modules per CLAUDE.md. Do NOT create one-off modules when reusabl
533
533
  #### B8. Import/Export Integrity
534
534
 
535
535
  ```bash
536
- cd packages/core && npx tsc --noEmit 2>&1 | grep -i "cannot find module\|not found"
536
+ {{verify.type | default("declare verification.LANG.type in massu.config.yaml")}} 2>&1 | grep -i "cannot find module\|not found"
537
537
  ```
538
538
 
539
539
  #### B9. Environment & Configuration
540
540
 
541
541
  ```bash
542
- grep -rn "process.env\." packages/core/src/ | grep -v node_modules | grep -oE 'process\.env\.\w+' | sort -u
542
+ grep -rn "process.env\." {{paths.source}}/ | grep -v node_modules | grep -oE 'process\.env\.\w+' | sort -u
543
543
  ls -la tsconfig.json package.json massu.config.yaml 2>/dev/null
544
544
  ```
545
545
 
@@ -547,10 +547,10 @@ ls -la tsconfig.json package.json massu.config.yaml 2>/dev/null
547
547
 
548
548
  ```bash
549
549
  # Test files
550
- find packages/core/src/__tests__ -name "*.test.ts" | sort
550
+ find {{paths.tests | default("tests")}} -name "*.test.ts" | sort
551
551
 
552
552
  # Run tests
553
- npm test
553
+ {{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}
554
554
  ```
555
555
 
556
556
  Verify: all new modules have corresponding test files, all tests pass.
@@ -558,8 +558,8 @@ Verify: all new modules have corresponding test files, all tests pass.
558
558
  #### B11. Third-Party Integration
559
559
 
560
560
  ```bash
561
- grep -rn "fetch(\|axios\." packages/core/src/ | grep -v node_modules | grep -v __tests__ | head -20
562
- grep -rn "https://\|http://" packages/core/src/ | grep -v node_modules | grep -v ".env\|localhost" | head -10
561
+ grep -rn "fetch(\|axios\." {{paths.source}}/ | grep -v node_modules | grep -v __tests__ | head -20
562
+ grep -rn "https://\|http://" {{paths.source}}/ | grep -v node_modules | grep -v ".env\|localhost" | head -10
563
563
  ```
564
564
 
565
565
  ### Blast Radius Verification
@@ -567,7 +567,7 @@ grep -rn "https://\|http://" packages/core/src/ | grep -v node_modules | grep -v
567
567
  When plan changes ANY constant/path/value:
568
568
  ```bash
569
569
  # For EACH changed value:
570
- grep -rn '"[OLD_VALUE]"' packages/core/src/ --include="*.ts" | grep -v node_modules
570
+ grep -rn '"[OLD_VALUE]"' {{paths.source}}/ --include="*.ts" | grep -v node_modules
571
571
  # ALL matches must be accounted for in blast radius analysis
572
572
  ```
573
573
 
@@ -605,7 +605,7 @@ ITERATION N:
605
605
  **Plan Coverage**: 100% items verified with VR-* proof.
606
606
  **Requirements**: 100% Implemented with evidence.
607
607
  **Pattern Compliance**: massu-pattern-scanner exits 0, all VR-NEGATIVE checks pass.
608
- **Build & Types**: `npm run build` exit 0, `cd packages/core && npx tsc --noEmit` 0 errors, `npm test` passes.
608
+ **Build & Types**: `{{verify.build | default("(this stack declares no build step)")}}` exit 0, `{{verify.type | default("declare verification.LANG.type in massu.config.yaml")}}` 0 errors, `{{verify.test | default("declare verification.LANG.test in massu.config.yaml")}}` passes.
609
609
  **Blast Radius** (if applicable): Zero uncategorized references.
610
610
  **Technical Debt**: Empty OR fully planned with cleanup steps.
611
611