@massu/core 0.4.2 → 0.6.0
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/README.md +40 -0
- package/agents/massu-architecture-reviewer.md +104 -0
- package/agents/massu-blast-radius-analyzer.md +84 -0
- package/agents/massu-competitive-scorer.md +126 -0
- package/agents/massu-help-sync.md +73 -0
- package/agents/massu-migration-writer.md +94 -0
- package/agents/massu-output-scorer.md +87 -0
- package/agents/massu-pattern-reviewer.md +84 -0
- package/agents/massu-plan-auditor.md +170 -0
- package/agents/massu-schema-sync-verifier.md +70 -0
- package/agents/massu-security-reviewer.md +98 -0
- package/agents/massu-ux-reviewer.md +106 -0
- package/commands/_shared-preamble.md +53 -23
- package/commands/_shared-references/auto-learning-protocol.md +71 -0
- package/commands/_shared-references/blast-radius-protocol.md +76 -0
- package/commands/_shared-references/security-pre-screen.md +64 -0
- package/commands/_shared-references/test-first-protocol.md +87 -0
- package/commands/_shared-references/verification-table.md +52 -0
- package/commands/massu-article-review.md +343 -0
- package/commands/massu-autoresearch/references/eval-runner.md +84 -0
- package/commands/massu-autoresearch/references/safety-rails.md +125 -0
- package/commands/massu-autoresearch/references/scoring-protocol.md +151 -0
- package/commands/massu-autoresearch.md +258 -0
- package/commands/massu-batch.md +44 -12
- package/commands/massu-bearings.md +42 -8
- package/commands/massu-checkpoint.md +588 -0
- package/commands/massu-ci-fix.md +2 -2
- package/commands/massu-command-health.md +132 -0
- package/commands/massu-command-improve.md +232 -0
- package/commands/massu-commit.md +205 -44
- package/commands/massu-create-plan.md +239 -57
- package/commands/massu-data/references/common-queries.md +79 -0
- package/commands/massu-data/references/table-guide.md +50 -0
- package/commands/massu-data.md +66 -0
- package/commands/massu-dead-code.md +29 -34
- package/commands/massu-debug/references/auto-learning.md +61 -0
- package/commands/massu-debug/references/codegraph-tracing.md +80 -0
- package/commands/massu-debug/references/common-shortcuts.md +98 -0
- package/commands/massu-debug/references/investigation-phases.md +294 -0
- package/commands/massu-debug/references/report-format.md +107 -0
- package/commands/massu-debug.md +105 -386
- package/commands/massu-docs.md +1 -1
- package/commands/massu-full-audit.md +61 -0
- package/commands/massu-gap-enhancement-analyzer.md +276 -16
- package/commands/massu-golden-path/references/approval-points.md +216 -0
- package/commands/massu-golden-path/references/competitive-mode.md +273 -0
- package/commands/massu-golden-path/references/error-handling.md +121 -0
- package/commands/massu-golden-path/references/phase-0-requirements.md +53 -0
- package/commands/massu-golden-path/references/phase-1-plan-creation.md +168 -0
- package/commands/massu-golden-path/references/phase-2-implementation.md +397 -0
- package/commands/massu-golden-path/references/phase-2.5-gap-analyzer.md +156 -0
- package/commands/massu-golden-path/references/phase-3-simplify.md +40 -0
- package/commands/massu-golden-path/references/phase-4-commit.md +94 -0
- package/commands/massu-golden-path/references/phase-5-push.md +116 -0
- package/commands/massu-golden-path/references/phase-5.5-production-verify.md +170 -0
- package/commands/massu-golden-path/references/phase-6-completion.md +113 -0
- package/commands/massu-golden-path/references/qa-evaluator-spec.md +137 -0
- package/commands/massu-golden-path/references/sprint-contract-protocol.md +117 -0
- package/commands/massu-golden-path/references/vr-visual-calibration.md +73 -0
- package/commands/massu-golden-path.md +114 -848
- package/commands/massu-guide.md +72 -69
- package/commands/massu-hooks.md +27 -12
- package/commands/massu-hotfix.md +221 -144
- package/commands/massu-incident.md +49 -20
- package/commands/massu-infra-audit.md +187 -0
- package/commands/massu-learning-audit.md +211 -0
- package/commands/massu-loop/references/auto-learning.md +49 -0
- package/commands/massu-loop/references/checkpoint-audit.md +40 -0
- package/commands/massu-loop/references/guardrails.md +17 -0
- package/commands/massu-loop/references/iteration-structure.md +115 -0
- package/commands/massu-loop/references/loop-controller.md +188 -0
- package/commands/massu-loop/references/plan-extraction.md +78 -0
- package/commands/massu-loop/references/vr-plan-spec.md +140 -0
- package/commands/massu-loop-playwright.md +9 -9
- package/commands/massu-loop.md +115 -670
- package/commands/massu-new-pattern.md +423 -0
- package/commands/massu-perf.md +422 -0
- package/commands/massu-plan-audit.md +1 -1
- package/commands/massu-plan.md +389 -122
- package/commands/massu-production-verify.md +433 -0
- package/commands/massu-push.md +62 -378
- package/commands/massu-recap.md +29 -3
- package/commands/massu-rollback.md +613 -0
- package/commands/massu-scaffold-hook.md +2 -4
- package/commands/massu-scaffold-page.md +2 -3
- package/commands/massu-scaffold-router.md +1 -2
- package/commands/massu-security.md +619 -0
- package/commands/massu-simplify.md +115 -85
- package/commands/massu-squirrels.md +2 -2
- package/commands/massu-tdd.md +38 -22
- package/commands/massu-test.md +3 -3
- package/commands/massu-type-mismatch-audit.md +469 -0
- package/commands/massu-ui-audit.md +587 -0
- package/commands/massu-verify-playwright.md +287 -32
- package/commands/massu-verify.md +150 -46
- package/dist/cli.js +1451 -1047
- package/dist/hooks/post-tool-use.js +75 -6
- package/dist/hooks/user-prompt.js +16 -0
- package/package.json +6 -2
- package/patterns/build-patterns.md +302 -0
- package/patterns/component-patterns.md +246 -0
- package/patterns/display-patterns.md +185 -0
- package/patterns/form-patterns.md +890 -0
- package/patterns/integration-testing-checklist.md +445 -0
- package/patterns/security-patterns.md +219 -0
- package/patterns/testing-patterns.md +569 -0
- package/patterns/tool-routing.md +81 -0
- package/patterns/ui-patterns.md +371 -0
- package/protocols/plan-implementation.md +267 -0
- package/protocols/recovery.md +225 -0
- package/protocols/verification.md +404 -0
- package/reference/command-taxonomy.md +178 -0
- package/reference/cr-rules-reference.md +76 -0
- package/reference/hook-execution-order.md +148 -0
- package/reference/lessons-learned.md +175 -0
- package/reference/patterns-quickref.md +208 -0
- package/reference/standards.md +135 -0
- package/reference/subagents-reference.md +17 -0
- package/reference/vr-verification-reference.md +867 -0
- package/src/commands/init.ts +27 -0
- package/src/commands/install-commands.ts +149 -53
- package/src/hooks/post-tool-use.ts +17 -0
- package/src/hooks/user-prompt.ts +21 -0
- package/src/memory-file-ingest.ts +127 -0
- package/src/memory-tools.ts +34 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: massu-simplify
|
|
3
|
-
description:
|
|
3
|
+
description: "When user says 'simplify', 'review my code', 'clean this up', or has finished implementation and wants quality review before commit"
|
|
4
4
|
allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*)
|
|
5
5
|
---
|
|
6
6
|
name: massu-simplify
|
|
7
7
|
|
|
8
8
|
# Massu Simplify: Enhanced Code Quality Analysis
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
**Shared rules**: Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9 enforced.
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -30,14 +30,14 @@ Code changes → /massu-simplify → /massu-commit → /massu-push
|
|
|
30
30
|
|
|
31
31
|
| Category | Example | Caught By Existing Tools? |
|
|
32
32
|
|----------|---------|--------------------------|
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
| Code duplication | Inline `
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
33
|
+
| Inefficient queries | `findMany().length` instead of SQL COUNT | NO |
|
|
34
|
+
| Unnecessary state | `useState` for derived values | NO |
|
|
35
|
+
| Code duplication | Inline `formatFileSize()` when `@/lib/formatting/fields` exists | Partially (pattern-scanner) |
|
|
36
|
+
| Over-fetching | `findMany()` without `select:` or `take:` | Partially (IN clause only) |
|
|
37
|
+
| Re-render waste | Missing `useMemo`/`useCallback` for expensive operations | NO |
|
|
38
|
+
| Existing utility ignorance | Rewriting a utility that already exists in shared code | NO |
|
|
39
|
+
| Memory leaks | Missing cleanup in `useEffect` | NO |
|
|
40
|
+
| Derived state anti-pattern | `useEffect` → `setState` for values derivable from props/queries | NO |
|
|
41
41
|
|
|
42
42
|
---
|
|
43
43
|
|
|
@@ -63,7 +63,7 @@ Filter to only `.ts`, `.tsx`, `.js`, `.jsx` files. Exclude `node_modules/`, `.ne
|
|
|
63
63
|
### Step 2: Fast Gate — Pattern Scanner
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
|
-
|
|
66
|
+
./scripts/pattern-scanner.sh
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
If violations found: **Fix them ALL before proceeding.** Pattern scanner violations are syntactic anti-patterns that should be resolved before semantic analysis begins.
|
|
@@ -76,39 +76,30 @@ Spawn 3 review agents **IN PARALLEL**. Each gets the list of changed files and a
|
|
|
76
76
|
CHANGED_FILES = [list from Step 1]
|
|
77
77
|
|
|
78
78
|
efficiency_result = Agent(subagent_type="general-purpose", model="haiku", prompt="
|
|
79
|
-
You are an EFFICIENCY REVIEWER for the Massu codebase
|
|
79
|
+
You are an EFFICIENCY REVIEWER for the Massu codebase.
|
|
80
80
|
|
|
81
81
|
Review ONLY these changed files: {CHANGED_FILES}
|
|
82
82
|
|
|
83
83
|
Check for these specific inefficiency patterns:
|
|
84
84
|
|
|
85
|
-
1.
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
85
|
+
1. QUERY INEFFICIENCY
|
|
86
|
+
- findMany().length or .filter().length instead of SQL COUNT/aggregate
|
|
87
|
+
- Loading full records when only IDs or counts are needed
|
|
88
|
+
- Missing take: limit on findMany (unbounded queries)
|
|
89
|
+
- N+1 patterns: querying in a loop instead of batch IN clause
|
|
90
|
+
- SELECT * (no select: clause) when only a few columns are needed
|
|
90
91
|
|
|
91
|
-
2.
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
92
|
+
2. REACT INEFFICIENCY
|
|
93
|
+
- useState for values derivable from props or query data
|
|
94
|
+
- useEffect → setState for derived state (should compute inline or useMemo)
|
|
95
|
+
- Missing useMemo for expensive computations in render
|
|
96
|
+
- Missing useCallback for functions passed as props to children
|
|
97
|
+
- Unnecessary re-renders from object/array literals in JSX props
|
|
96
98
|
|
|
97
99
|
3. ALGORITHMIC INEFFICIENCY
|
|
98
|
-
- O(n
|
|
100
|
+
- O(n²) patterns (nested loops, repeated .find() in .map())
|
|
99
101
|
- Repeated string concatenation in loops (use array + join)
|
|
100
102
|
- Sorting or filtering the same array multiple times
|
|
101
|
-
- Using Array.find() in a loop instead of building a Map/Set lookup
|
|
102
|
-
|
|
103
|
-
4. INEFFICIENT MAP/SET USAGE
|
|
104
|
-
- Map<string, T> where a plain Record<string, T> suffices
|
|
105
|
-
- Creating a Map/Set for single-use lookups
|
|
106
|
-
- Not using Map when doing repeated key lookups on arrays
|
|
107
|
-
|
|
108
|
-
5. GENERAL INEFFICIENCY
|
|
109
|
-
- Loading full objects when only a subset of fields is needed
|
|
110
|
-
- Repeated computation that could be cached in a local variable
|
|
111
|
-
- Unnecessary spread/destructure creating shallow copies for no reason
|
|
112
103
|
|
|
113
104
|
For each finding, return:
|
|
114
105
|
FILE: [path]
|
|
@@ -123,28 +114,28 @@ efficiency_result = Agent(subagent_type="general-purpose", model="haiku", prompt
|
|
|
123
114
|
")
|
|
124
115
|
|
|
125
116
|
reuse_result = Agent(subagent_type="general-purpose", model="haiku", prompt="
|
|
126
|
-
You are a REUSE REVIEWER for the Massu codebase
|
|
117
|
+
You are a REUSE REVIEWER for the Massu codebase.
|
|
127
118
|
|
|
128
119
|
Review ONLY these changed files: {CHANGED_FILES}
|
|
129
120
|
|
|
130
121
|
Search the codebase for existing utilities that the changed code should use instead of inline implementations. Check for:
|
|
131
122
|
|
|
132
123
|
1. KNOWN UTILITIES (check if changed code duplicates these)
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
124
|
+
- Search the project for existing utility functions (formatters, validators, sanitizers)
|
|
125
|
+
- Check shared/common directories for reusable helpers
|
|
126
|
+
- Look for canonical imports in existing code (e.g., `import { x } from '@/lib/...'`)
|
|
127
|
+
- Identify any inline implementations that duplicate existing utilities
|
|
128
|
+
- Check for deprecated aliases that should use the canonical import
|
|
137
129
|
|
|
138
130
|
2. COMPONENT DUPLICATION
|
|
139
|
-
- Search
|
|
140
|
-
that do the same thing as newly created
|
|
141
|
-
- Check if a new
|
|
131
|
+
- Search src/components/shared/ and src/components/ui/ for existing components
|
|
132
|
+
that do the same thing as newly created components
|
|
133
|
+
- Check if a new modal/dialog/drawer duplicates an existing pattern
|
|
142
134
|
|
|
143
135
|
3. PATTERN DUPLICATION
|
|
144
|
-
- Same data
|
|
145
|
-
- Same validation logic duplicated
|
|
136
|
+
- Same data fetching pattern written in multiple new files
|
|
137
|
+
- Same form validation logic duplicated
|
|
146
138
|
- Same error handling pattern repeated
|
|
147
|
-
- Same config access pattern inlined instead of using getConfig()
|
|
148
139
|
|
|
149
140
|
For each finding, return:
|
|
150
141
|
FILE: [path]
|
|
@@ -159,45 +150,41 @@ reuse_result = Agent(subagent_type="general-purpose", model="haiku", prompt="
|
|
|
159
150
|
")
|
|
160
151
|
|
|
161
152
|
pattern_result = Agent(subagent_type="general-purpose", model="haiku", prompt="
|
|
162
|
-
You are a PATTERN COMPLIANCE REVIEWER for the Massu codebase
|
|
153
|
+
You are a PATTERN COMPLIANCE REVIEWER for the Massu codebase.
|
|
163
154
|
|
|
164
155
|
Review ONLY these changed files: {CHANGED_FILES}
|
|
165
156
|
|
|
166
|
-
Check for SEMANTIC pattern violations that the pattern-scanner (grep-based) cannot catch:
|
|
167
|
-
|
|
168
|
-
1.
|
|
169
|
-
- Using
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
-
|
|
176
|
-
-
|
|
177
|
-
-
|
|
178
|
-
- Missing
|
|
179
|
-
|
|
180
|
-
3.
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
- Missing
|
|
184
|
-
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
|
|
197
|
-
6. ARCHITECTURAL VIOLATIONS
|
|
198
|
-
- Cross-package imports bypassing barrel exports
|
|
199
|
-
- Tight coupling between modules that should be independent
|
|
200
|
-
- Side effects in module-level scope (top-level await, global mutations)
|
|
157
|
+
Check for SEMANTIC pattern violations that the pattern-scanner.sh (grep-based) cannot catch:
|
|
158
|
+
|
|
159
|
+
1. REACT QUERY v5 VIOLATIONS
|
|
160
|
+
- Using onSuccess/onError/onSettled in useQuery options (removed in v5)
|
|
161
|
+
- Not destructuring data from useQuery result
|
|
162
|
+
- Using queryData?.find() in save handlers instead of checking record.id
|
|
163
|
+
|
|
164
|
+
2. DATABASE PATTERN VIOLATIONS
|
|
165
|
+
- Using raw SQL or ORM calls instead of project-standard query helpers
|
|
166
|
+
- Accessing tables through wrong aliases or deprecated accessors
|
|
167
|
+
- Missing type coercion wrappers on return values (e.g., BigInt → Number())
|
|
168
|
+
- Using eager-loading patterns the ORM ignores (check project conventions)
|
|
169
|
+
- Missing null-coercion helpers for UPDATE forms with clearable fields
|
|
170
|
+
|
|
171
|
+
3. UI PATTERN VIOLATIONS
|
|
172
|
+
- Select.Item with value='' (must use '__none__' or semantic value)
|
|
173
|
+
- Missing loading/error/empty states in data-fetching components
|
|
174
|
+
- Missing Suspense boundary for pages using use(params) or useSearchParams
|
|
175
|
+
- Using onClick instead of onPointerDown for stylus-compatible interactions
|
|
176
|
+
- Null-unsafe .replace()/.toLowerCase()/.charAt() on nullable strings
|
|
177
|
+
|
|
178
|
+
4. SECURITY PATTERN VIOLATIONS
|
|
179
|
+
- orderBy accepting z.string() instead of z.enum() with known columns
|
|
180
|
+
- Using process.env.API_KEY before getCredentials() (CR-5 precedence)
|
|
181
|
+
- publicProcedure on mutations (must be protectedProcedure)
|
|
182
|
+
- Missing CRON_SECRET guard (if (!cronSecret) check before comparison)
|
|
183
|
+
|
|
184
|
+
5. ARCHITECTURAL VIOLATIONS
|
|
185
|
+
- Scoped queries without going through link table first
|
|
186
|
+
- Full table loads for aggregate calculations (use SQL aggregates)
|
|
187
|
+
- Client components importing server-only modules (@/lib/db)
|
|
201
188
|
|
|
202
189
|
For each finding, return:
|
|
203
190
|
FILE: [path]
|
|
@@ -212,6 +199,40 @@ pattern_result = Agent(subagent_type="general-purpose", model="haiku", prompt="
|
|
|
212
199
|
")
|
|
213
200
|
```
|
|
214
201
|
|
|
202
|
+
### Step 3.5: Cross-Review Exchange (Debate Round)
|
|
203
|
+
|
|
204
|
+
**Skip condition**: If ALL three agents returned 0 findings, skip to Step 4.
|
|
205
|
+
|
|
206
|
+
If total findings > 0, spawn a single cross-reviewer agent:
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
Agent(subagent_type="general-purpose", model="haiku", prompt="
|
|
210
|
+
You are a cross-reviewer for a code quality analysis. Three independent reviewers have analyzed the same codebase changes. Your job is to find interactions between their findings that no single reviewer could catch alone.
|
|
211
|
+
|
|
212
|
+
## Reviewer Findings
|
|
213
|
+
EFFICIENCY: {efficiency_result}
|
|
214
|
+
REUSE: {reuse_result}
|
|
215
|
+
PATTERN: {pattern_result}
|
|
216
|
+
|
|
217
|
+
## Your Analysis (3 dimensions)
|
|
218
|
+
|
|
219
|
+
1. CONFLICTING RECOMMENDATIONS: Do any two reviewers suggest contradictory fixes? (e.g., one says extract a helper, another says inline the code)
|
|
220
|
+
2. COMPOUNDING ISSUES: Do findings from different reviewers combine to reveal a bigger problem? (e.g., a reuse violation + a pattern violation in the same file = architectural gap)
|
|
221
|
+
3. MISSED INTERACTIONS: Does fixing one reviewer's finding create a new issue for another? (e.g., extracting a function for reuse changes the pattern compliance)
|
|
222
|
+
|
|
223
|
+
For each finding, report:
|
|
224
|
+
CROSS_FINDING: [type: CONFLICT|COMPOUND|INTERACTION]
|
|
225
|
+
FILES: [affected files]
|
|
226
|
+
REVIEWERS: [which reviewers' findings interact]
|
|
227
|
+
RECOMMENDATION: [what to do]
|
|
228
|
+
|
|
229
|
+
If no cross-cutting issues found: return CROSS_FINDINGS: 0
|
|
230
|
+
Otherwise: return CROSS_FINDINGS: [count]
|
|
231
|
+
")
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Add any CROSS_FINDINGS to the fix queue in Step 4, sorted above individual findings.
|
|
235
|
+
|
|
215
236
|
### Step 4: Collect and Apply
|
|
216
237
|
|
|
217
238
|
1. Parse all 3 agent results
|
|
@@ -225,7 +246,7 @@ pattern_result = Agent(subagent_type="general-purpose", model="haiku", prompt="
|
|
|
225
246
|
### Step 5: Re-verify
|
|
226
247
|
|
|
227
248
|
```bash
|
|
228
|
-
|
|
249
|
+
./scripts/pattern-scanner.sh
|
|
229
250
|
```
|
|
230
251
|
|
|
231
252
|
Confirm no new violations were introduced by the fixes.
|
|
@@ -243,6 +264,7 @@ Confirm no new violations were introduced by the fixes.
|
|
|
243
264
|
| Efficiency | N | N | 0 |
|
|
244
265
|
| Reuse | N | N | 0 |
|
|
245
266
|
| Pattern Compliance | N | N | 0 |
|
|
267
|
+
| Cross-Review | N | N | 0 |
|
|
246
268
|
| Pattern Scanner | N | N | 0 |
|
|
247
269
|
| **Total** | **N** | **N** | **0** |
|
|
248
270
|
|
|
@@ -275,7 +297,15 @@ SIMPLIFY_GATE: FAIL — N issues require manual resolution
|
|
|
275
297
|
| `/massu-simplify` | After code changes, before commit | Efficiency + reuse + semantic patterns |
|
|
276
298
|
| `/massu-verify` | During /massu-loop audit phase | Full VR-* verification with plan coverage |
|
|
277
299
|
| `/massu-commit` | Before committing | Fast blocking gates (types, build, scanner) |
|
|
278
|
-
| `/massu-push` | Before pushing | Full tests + regression |
|
|
279
|
-
| `
|
|
300
|
+
| `/massu-push` | Before pushing | Full tests + regression + schema sync |
|
|
301
|
+
| `pattern-scanner.sh` | Auto-runs in /massu-commit | Syntactic anti-pattern grep |
|
|
302
|
+
|
|
303
|
+
**Key distinction**: `/massu-simplify` catches SEMANTIC issues (inefficient algorithms, missed reuse opportunities, architectural anti-patterns) while `pattern-scanner.sh` catches SYNTACTIC issues (forbidden imports, known bad column names, deprecated APIs).
|
|
304
|
+
|
|
305
|
+
## Gotchas
|
|
280
306
|
|
|
281
|
-
|
|
307
|
+
- **Run AFTER implementation, not during** — simplification reviews completed work. Running mid-implementation creates confusion about what's "done"
|
|
308
|
+
- **Parallel subagents may conflict** — when multiple review agents run simultaneously, they may propose conflicting changes. The main thread resolves conflicts
|
|
309
|
+
- **Don't simplify what you haven't read** — every file being simplified must be read first to understand context. Blind refactoring breaks things
|
|
310
|
+
- **Pattern scanner runs automatically** — PostToolUse hooks will flag violations. Fix them, don't suppress them
|
|
311
|
+
- **Reuse over rewrite** — prefer importing existing utilities over writing new implementations
|
|
@@ -7,7 +7,7 @@ name: massu-squirrels
|
|
|
7
7
|
|
|
8
8
|
# Massu Squirrels: Idea Parking Lot Manager
|
|
9
9
|
|
|
10
|
-
> **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding.
|
|
10
|
+
> **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-14, CR-5, CR-12 enforced.
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -61,7 +61,7 @@ Manage `.claude/session-state/squirrels.md` — a parking lot for stray ideas th
|
|
|
61
61
|
1. Read squirrels.md, number the ideas (1-based, top to bottom)
|
|
62
62
|
2. Display idea #N and ask: "Promote this to a plan, a task, or a session-state item?"
|
|
63
63
|
3. Based on response:
|
|
64
|
-
- **Plan**: Create a plan stub in
|
|
64
|
+
- **Plan**: Create a plan stub in the project docs plans directory
|
|
65
65
|
- **Task**: Add to CURRENT.md as an open item
|
|
66
66
|
- **Session-state**: Add to CURRENT.md as context
|
|
67
67
|
4. Remove the idea from squirrels.md
|
package/commands/massu-tdd.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: massu-tdd
|
|
3
|
-
description:
|
|
3
|
+
description: "When user wants test-driven development, says 'TDD', 'write tests first', 'red green refactor', or needs the RED-GREEN-IMPROVE cycle"
|
|
4
4
|
allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*)
|
|
5
5
|
---
|
|
6
6
|
name: massu-tdd
|
|
7
7
|
|
|
8
|
-
> **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding.
|
|
8
|
+
> **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding.
|
|
9
9
|
|
|
10
10
|
# Massu TDD: Test-Driven Development Cycle
|
|
11
11
|
|
|
@@ -23,7 +23,7 @@ Implement features or fix bugs using strict test-first development. Write the te
|
|
|
23
23
|
- **Minimal implementation** - in GREEN phase, write ONLY enough to pass the test
|
|
24
24
|
- **Refactor ONLY when green** - never refactor with failing tests
|
|
25
25
|
- **VR-proof at every step** - show test output proving RED/GREEN status
|
|
26
|
-
- **Pattern compliance** - IMPROVE phase must apply
|
|
26
|
+
- **Pattern compliance** - IMPROVE phase must apply project patterns
|
|
27
27
|
- **FIX ALL ISSUES ENCOUNTERED (CR-9)** - if tests reveal other bugs, fix them
|
|
28
28
|
|
|
29
29
|
---
|
|
@@ -42,9 +42,12 @@ Implement features or fix bugs using strict test-first development. Write the te
|
|
|
42
42
|
### Step 0: SCOPE
|
|
43
43
|
|
|
44
44
|
User provides feature description or bug report. Identify:
|
|
45
|
-
- **Test file location**:
|
|
45
|
+
- **Test file location**: Follow convention:
|
|
46
|
+
- Unit: `tests/unit/[domain]/[name].test.ts`
|
|
47
|
+
- Integration: `tests/integration/[domain]/[name].test.ts`
|
|
48
|
+
- Prevention: `scripts/tests/prevention/[name].test.ts`
|
|
46
49
|
- **Target source file**: The file that will be implemented/modified
|
|
47
|
-
- **Vitest config**: `
|
|
50
|
+
- **Vitest config**: `vitest.config.ts` (main) or `vitest.config.prevention.ts` (prevention)
|
|
48
51
|
|
|
49
52
|
### Step 1: RED (Write Failing Test)
|
|
50
53
|
|
|
@@ -52,8 +55,8 @@ Write the test file FIRST. The test defines expected behavior.
|
|
|
52
55
|
|
|
53
56
|
```bash
|
|
54
57
|
# Write test with assertions for expected behavior
|
|
55
|
-
# Then run it
|
|
56
|
-
|
|
58
|
+
# Then run it — it MUST FAIL
|
|
59
|
+
npx vitest run [test-file] --reporter=verbose
|
|
57
60
|
```
|
|
58
61
|
|
|
59
62
|
**Verification**:
|
|
@@ -75,8 +78,8 @@ Rules:
|
|
|
75
78
|
- Just make the test pass
|
|
76
79
|
|
|
77
80
|
```bash
|
|
78
|
-
# Run the test again
|
|
79
|
-
|
|
81
|
+
# Run the test again — it MUST PASS
|
|
82
|
+
npx vitest run [test-file] --reporter=verbose
|
|
80
83
|
```
|
|
81
84
|
|
|
82
85
|
**VR-proof**: Show test output with PASS status.
|
|
@@ -84,14 +87,14 @@ cd packages/core && npx vitest run src/__tests__/[test-file] --reporter=verbose
|
|
|
84
87
|
### Step 3: IMPROVE (Refactor)
|
|
85
88
|
|
|
86
89
|
Now improve code quality while keeping tests green:
|
|
87
|
-
- Apply
|
|
90
|
+
- Apply project patterns (database access, auth, etc.)
|
|
88
91
|
- Improve naming, readability, structure
|
|
89
92
|
- Add error handling
|
|
90
93
|
- Extract reusable functions
|
|
91
94
|
|
|
92
95
|
```bash
|
|
93
|
-
# Run test after refactoring
|
|
94
|
-
|
|
96
|
+
# Run test after refactoring — MUST STILL PASS
|
|
97
|
+
npx vitest run [test-file] --reporter=verbose
|
|
95
98
|
```
|
|
96
99
|
|
|
97
100
|
**VR-proof**: Show test output with PASS status.
|
|
@@ -147,6 +150,16 @@ npm test
|
|
|
147
150
|
|
|
148
151
|
---
|
|
149
152
|
|
|
153
|
+
## HELPER SCRIPT
|
|
154
|
+
|
|
155
|
+
Use the TDD runner for cleaner output:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
./scripts/tdd-runner.sh [test-file]
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
150
163
|
## TEST PATTERNS
|
|
151
164
|
|
|
152
165
|
### Unit Test Template
|
|
@@ -165,19 +178,22 @@ describe('[Feature]', () => {
|
|
|
165
178
|
});
|
|
166
179
|
```
|
|
167
180
|
|
|
168
|
-
###
|
|
181
|
+
### Integration Test Template (tRPC Router)
|
|
169
182
|
```typescript
|
|
170
183
|
import { describe, it, expect, vi } from 'vitest';
|
|
171
184
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
185
|
+
vi.mock('@/lib/db', () => ({
|
|
186
|
+
db: {
|
|
187
|
+
tableName: {
|
|
188
|
+
findMany: vi.fn().mockResolvedValue([]),
|
|
189
|
+
create: vi.fn().mockImplementation((data) => ({ id: 'test-id', ...data.data })),
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
}));
|
|
193
|
+
|
|
194
|
+
describe('[Router]', () => {
|
|
195
|
+
it('should [expected behavior]', async () => {
|
|
196
|
+
// Test router procedure
|
|
181
197
|
});
|
|
182
198
|
});
|
|
183
199
|
```
|
package/commands/massu-test.md
CHANGED
|
@@ -5,9 +5,9 @@ allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*)
|
|
|
5
5
|
---
|
|
6
6
|
name: massu-test
|
|
7
7
|
|
|
8
|
-
> **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9, CR-
|
|
8
|
+
> **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9, CR-12 enforced.
|
|
9
9
|
|
|
10
|
-
#
|
|
10
|
+
# Massu Test: Intelligent Test Runner
|
|
11
11
|
|
|
12
12
|
## Objective
|
|
13
13
|
|
|
@@ -476,7 +476,7 @@ Fix ALL instances found, not just the one that was reported.
|
|
|
476
476
|
## COMPLETION REPORT
|
|
477
477
|
|
|
478
478
|
```markdown
|
|
479
|
-
##
|
|
479
|
+
## MASSU TEST COMPLETE
|
|
480
480
|
|
|
481
481
|
### Mode: [FULL_RUN / AFFECTED / COVERAGE / GENERATE / FIX]
|
|
482
482
|
|