@massu/core 0.1.1 → 0.4.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/commands/_shared-preamble.md +76 -0
- package/commands/massu-audit-deps.md +211 -0
- package/commands/massu-changelog.md +174 -0
- package/commands/massu-cleanup.md +315 -0
- package/commands/massu-commit.md +481 -0
- package/commands/massu-create-plan.md +752 -0
- package/commands/massu-dead-code.md +131 -0
- package/commands/massu-debug.md +484 -0
- package/commands/massu-deploy.md +91 -0
- package/commands/massu-deps.md +374 -0
- package/commands/massu-doc-gen.md +279 -0
- package/commands/massu-docs.md +364 -0
- package/commands/massu-estimate.md +313 -0
- package/commands/massu-golden-path.md +973 -0
- package/commands/massu-guide.md +167 -0
- package/commands/massu-hotfix.md +480 -0
- package/commands/massu-loop-playwright.md +837 -0
- package/commands/massu-loop.md +775 -0
- package/commands/massu-new-feature.md +511 -0
- package/commands/massu-parity.md +214 -0
- package/commands/massu-plan.md +456 -0
- package/commands/massu-push-light.md +207 -0
- package/commands/massu-push.md +434 -0
- package/commands/massu-refactor.md +410 -0
- package/commands/massu-release.md +363 -0
- package/commands/massu-review.md +238 -0
- package/commands/massu-simplify.md +281 -0
- package/commands/massu-status.md +278 -0
- package/commands/massu-tdd.md +201 -0
- package/commands/massu-test.md +516 -0
- package/commands/massu-verify-playwright.md +281 -0
- package/commands/massu-verify.md +667 -0
- package/dist/cli.js +7772 -3140
- package/dist/hooks/cost-tracker.js +103 -40
- package/dist/hooks/post-edit-context.js +74 -8
- package/dist/hooks/post-tool-use.js +268 -106
- package/dist/hooks/pre-compact.js +167 -43
- package/dist/hooks/pre-delete-check.js +159 -42
- package/dist/hooks/quality-event.js +103 -40
- package/dist/hooks/security-gate.js +29 -0
- package/dist/hooks/session-end.js +143 -84
- package/dist/hooks/session-start.js +186 -49
- package/dist/hooks/user-prompt.js +189 -43
- package/package.json +10 -15
- package/src/adr-generator.ts +9 -2
- package/src/analytics.ts +9 -3
- package/src/audit-trail.ts +10 -3
- package/src/backfill-sessions.ts +5 -4
- package/src/cli.ts +6 -0
- package/src/cloud-sync.ts +14 -18
- package/src/commands/doctor.ts +193 -6
- package/src/commands/init.ts +230 -5
- package/src/commands/install-commands.ts +137 -0
- package/src/config.ts +68 -2
- package/src/cost-tracker.ts +11 -6
- package/src/db.ts +115 -2
- package/src/dependency-scorer.ts +9 -2
- package/src/docs-tools.ts +21 -16
- package/src/hooks/post-edit-context.ts +4 -4
- package/src/hooks/post-tool-use.ts +130 -0
- package/src/hooks/pre-compact.ts +23 -1
- package/src/hooks/pre-delete-check.ts +92 -4
- package/src/hooks/security-gate.ts +32 -0
- package/src/hooks/session-end.ts +3 -3
- package/src/hooks/session-start.ts +99 -6
- package/src/hooks/user-prompt.ts +46 -1
- package/src/import-resolver.ts +2 -1
- package/src/knowledge-db.ts +169 -0
- package/src/knowledge-indexer.ts +704 -0
- package/src/knowledge-tools.ts +1413 -0
- package/src/license.ts +482 -0
- package/src/memory-db.ts +1364 -23
- package/src/memory-tools.ts +14 -15
- package/src/observability-tools.ts +13 -2
- package/src/observation-extractor.ts +11 -4
- package/src/page-deps.ts +3 -2
- package/src/prompt-analyzer.ts +9 -2
- package/src/python/coupling-detector.ts +124 -0
- package/src/python/domain-enforcer.ts +83 -0
- package/src/python/impact-analyzer.ts +95 -0
- package/src/python/import-parser.ts +244 -0
- package/src/python/import-resolver.ts +135 -0
- package/src/python/migration-indexer.ts +115 -0
- package/src/python/migration-parser.ts +332 -0
- package/src/python/model-indexer.ts +70 -0
- package/src/python/model-parser.ts +279 -0
- package/src/python/route-indexer.ts +58 -0
- package/src/python/route-parser.ts +317 -0
- package/src/python-tools.ts +629 -0
- package/src/regression-detector.ts +9 -3
- package/src/security-scorer.ts +9 -2
- package/src/sentinel-db.ts +45 -89
- package/src/sentinel-tools.ts +8 -11
- package/src/server.ts +29 -7
- package/src/session-archiver.ts +4 -5
- package/src/team-knowledge.ts +9 -2
- package/src/tools.ts +1032 -44
- package/src/validate-features-runner.ts +0 -1
- package/src/validation-engine.ts +9 -2
- package/README.md +0 -40
- package/dist/server.js +0 -7008
- package/src/__tests__/adr-generator.test.ts +0 -260
- package/src/__tests__/analytics.test.ts +0 -282
- package/src/__tests__/audit-trail.test.ts +0 -382
- package/src/__tests__/backfill-sessions.test.ts +0 -690
- package/src/__tests__/cli.test.ts +0 -290
- package/src/__tests__/cloud-sync.test.ts +0 -261
- package/src/__tests__/config-sections.test.ts +0 -359
- package/src/__tests__/config.test.ts +0 -732
- package/src/__tests__/cost-tracker.test.ts +0 -348
- package/src/__tests__/db.test.ts +0 -177
- package/src/__tests__/dependency-scorer.test.ts +0 -325
- package/src/__tests__/docs-integration.test.ts +0 -178
- package/src/__tests__/docs-tools.test.ts +0 -199
- package/src/__tests__/domains.test.ts +0 -236
- package/src/__tests__/hooks.test.ts +0 -221
- package/src/__tests__/import-resolver.test.ts +0 -95
- package/src/__tests__/integration/path-traversal.test.ts +0 -134
- package/src/__tests__/integration/pricing-consistency.test.ts +0 -88
- package/src/__tests__/integration/tool-registration.test.ts +0 -146
- package/src/__tests__/memory-db.test.ts +0 -404
- package/src/__tests__/memory-enhancements.test.ts +0 -316
- package/src/__tests__/memory-tools.test.ts +0 -199
- package/src/__tests__/middleware-tree.test.ts +0 -177
- package/src/__tests__/observability-tools.test.ts +0 -595
- package/src/__tests__/observability.test.ts +0 -437
- package/src/__tests__/observation-extractor.test.ts +0 -167
- package/src/__tests__/page-deps.test.ts +0 -60
- package/src/__tests__/prompt-analyzer.test.ts +0 -298
- package/src/__tests__/regression-detector.test.ts +0 -295
- package/src/__tests__/rules.test.ts +0 -87
- package/src/__tests__/schema-mapper.test.ts +0 -29
- package/src/__tests__/security-scorer.test.ts +0 -238
- package/src/__tests__/security-utils.test.ts +0 -175
- package/src/__tests__/sentinel-db.test.ts +0 -491
- package/src/__tests__/sentinel-scanner.test.ts +0 -750
- package/src/__tests__/sentinel-tools.test.ts +0 -324
- package/src/__tests__/sentinel-types.test.ts +0 -750
- package/src/__tests__/server.test.ts +0 -452
- package/src/__tests__/session-archiver.test.ts +0 -524
- package/src/__tests__/session-state-generator.test.ts +0 -900
- package/src/__tests__/team-knowledge.test.ts +0 -327
- package/src/__tests__/tools.test.ts +0 -340
- package/src/__tests__/transcript-parser.test.ts +0 -195
- package/src/__tests__/trpc-index.test.ts +0 -25
- package/src/__tests__/validate-features-runner.test.ts +0 -517
- package/src/__tests__/validation-engine.test.ts +0 -300
- package/src/core-tools.ts +0 -685
- package/src/memory-queries.ts +0 -804
- package/src/memory-schema.ts +0 -546
- package/src/tool-helpers.ts +0 -41
|
@@ -0,0 +1,752 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-create-plan
|
|
3
|
+
description: Create a viable implementation plan aligned with Massu architecture and patterns
|
|
4
|
+
allowed-tools: Bash(*), Read(*), Grep(*), Glob(*)
|
|
5
|
+
---
|
|
6
|
+
name: massu-create-plan
|
|
7
|
+
|
|
8
|
+
> **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-9, CR-35 enforced.
|
|
9
|
+
|
|
10
|
+
# CS Create Plan: Reality-Based Plan Generation
|
|
11
|
+
|
|
12
|
+
## CRITICAL: THIS IS A PLAN-CREATION COMMAND, NOT AN IMPLEMENTATION COMMAND
|
|
13
|
+
|
|
14
|
+
**THIS COMMAND CREATES PLANS FOR USER REVIEW. IT DOES NOT IMPLEMENT ANYTHING.**
|
|
15
|
+
|
|
16
|
+
### FORBIDDEN Actions (Zero Tolerance)
|
|
17
|
+
- Writing code to source files (Edit/Write to packages/)
|
|
18
|
+
- Running npm install/build as implementation
|
|
19
|
+
- Creating modules, tools, or hooks
|
|
20
|
+
- Committing any changes
|
|
21
|
+
- Starting any implementation work
|
|
22
|
+
|
|
23
|
+
### REQUIRED Actions
|
|
24
|
+
- Research the codebase (Read, Grep, Glob)
|
|
25
|
+
- Read existing similar modules
|
|
26
|
+
- Write the PLAN DOCUMENT (Write to docs/plans/)
|
|
27
|
+
- Present plan for user approval
|
|
28
|
+
- **STOP AND WAIT** for explicit user approval
|
|
29
|
+
|
|
30
|
+
### AFTER PRESENTING PLAN: MANDATORY WAIT
|
|
31
|
+
|
|
32
|
+
**After presenting a plan summary, you MUST:**
|
|
33
|
+
1. **STOP completely** - Do not call any more tools
|
|
34
|
+
2. **WAIT** for the user to explicitly say "proceed", "implement", "approved", or similar
|
|
35
|
+
3. **Do NOT interpret ExitPlanMode's response as plan approval**
|
|
36
|
+
|
|
37
|
+
**ONLY these phrases mean you can implement:**
|
|
38
|
+
- "proceed with implementation"
|
|
39
|
+
- "implement the plan"
|
|
40
|
+
- "approved, go ahead"
|
|
41
|
+
- "start implementing"
|
|
42
|
+
|
|
43
|
+
### Command Distinction
|
|
44
|
+
| Command | Purpose | Implementation? |
|
|
45
|
+
|---------|---------|-----------------|
|
|
46
|
+
| `/massu-create-plan` | Create plan document | **NO - FORBIDDEN** |
|
|
47
|
+
| `/massu-plan` | Audit existing plan | **NO - FORBIDDEN** |
|
|
48
|
+
| `/massu-loop` | Implement plan with verification | **YES** |
|
|
49
|
+
| `/massu-commit` | Commit after implementation | After implementation only |
|
|
50
|
+
|
|
51
|
+
**If you find yourself about to edit a source file, STOP. You are violating this protocol.**
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Workflow Position
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
/massu-create-plan -> /massu-plan -> /massu-loop -> /massu-commit -> /massu-push
|
|
59
|
+
(CREATE) (AUDIT) (IMPLEMENT) (COMMIT) (PUSH)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**This command is step 1 of 5 in the standard workflow.**
|
|
63
|
+
|
|
64
|
+
### Workflow State Tracking
|
|
65
|
+
|
|
66
|
+
Write a transition entry to `.massu/workflow-log.md`:
|
|
67
|
+
```
|
|
68
|
+
| [timestamp] | - | PLAN | /massu-create-plan | [session-id] |
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Objective
|
|
74
|
+
|
|
75
|
+
Create a comprehensive, feasible implementation plan by checking REAL file structure, reading REAL code, and aligning with ESTABLISHED patterns. The output is a plan that has been pre-verified for feasibility.
|
|
76
|
+
|
|
77
|
+
**Philosophy**: A plan written without checking reality is fiction. Read first, plan second.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## NON-NEGOTIABLE RULES
|
|
82
|
+
|
|
83
|
+
- **Read before referencing** - Never reference a file without reading it
|
|
84
|
+
- **Pattern compliance** - Every plan item must align with CLAUDE.md patterns
|
|
85
|
+
- **Enumerated items** - Every deliverable must be numbered and verifiable
|
|
86
|
+
- **Feasibility pre-check** - Plan items must be possible with current codebase state
|
|
87
|
+
- **No guessing** - If uncertain, read the file or search the codebase
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## PHASE 0: REQUIREMENTS INTERVIEW (For Complex/Ambiguous Features)
|
|
92
|
+
|
|
93
|
+
For features where requirements are ambiguous or could go multiple ways,
|
|
94
|
+
INTERVIEW the user before researching.
|
|
95
|
+
|
|
96
|
+
Use AskUserQuestion to clarify:
|
|
97
|
+
- Scope boundaries (what's IN vs OUT of scope)
|
|
98
|
+
- User expectations for behavior
|
|
99
|
+
- Priority trade-offs (speed vs completeness)
|
|
100
|
+
- Any constraints not mentioned
|
|
101
|
+
|
|
102
|
+
SKIP this phase only if the user has provided crystal-clear,
|
|
103
|
+
unambiguous requirements with no interpretation needed.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## PHASE 0.5: TEMPLATE SELECTION
|
|
108
|
+
|
|
109
|
+
Based on the user's request, check if a common pattern template applies. Templates are STARTING POINTS — subsequent phases still verify feasibility and adjust details.
|
|
110
|
+
|
|
111
|
+
### Template Detection
|
|
112
|
+
|
|
113
|
+
Evaluate the request against these common patterns:
|
|
114
|
+
|
|
115
|
+
| Template | Trigger | Pre-filled Phases |
|
|
116
|
+
|----------|---------|-------------------|
|
|
117
|
+
| A: Dashboard Page | Request involves a new dashboard page/view | Migration -> Types -> Data Layer -> Server Actions -> Page + Client Component -> Nav Update -> Docs |
|
|
118
|
+
| B: API Endpoint | Request involves a new REST API endpoint | Route File -> Auth Middleware -> Input Validation -> Business Logic -> Rate Limiting -> Tests -> API Docs |
|
|
119
|
+
| C: MCP Tool Module | Request involves a new MCP tool | Module (3-function pattern) -> Wire into tools.ts -> Tests -> Config (if needed) |
|
|
120
|
+
| D: Edge Function | Request involves a Supabase edge function | Function File -> CORS Setup -> Auth -> Validation -> Business Logic -> Error Handling -> Cron Config |
|
|
121
|
+
| E: Feature Tier Addition | Request involves adding features to a pricing tier | Migration -> Types -> Data Layer -> Actions -> Pages -> Nav -> Pricing Update -> Feature Comparison -> FAQ -> Docs |
|
|
122
|
+
|
|
123
|
+
### TEMPLATE A: New Dashboard Page
|
|
124
|
+
|
|
125
|
+
If the request is for a new dashboard page:
|
|
126
|
+
|
|
127
|
+
```markdown
|
|
128
|
+
## Pre-filled Plan Structure (Dashboard Page)
|
|
129
|
+
|
|
130
|
+
### Phase 1: Database
|
|
131
|
+
- P1-001: Migration — Create table with RLS, policies, indexes, triggers
|
|
132
|
+
- P1-002: Type sync — Add type aliases to `website/src/lib/supabase/types.ts`
|
|
133
|
+
|
|
134
|
+
### Phase 2: Data Layer
|
|
135
|
+
- P2-001: Data access functions — `website/src/lib/supabase/[FILL].ts`
|
|
136
|
+
- P2-002: Server actions — `website/src/app/dashboard/[FILL]/actions.ts`
|
|
137
|
+
|
|
138
|
+
### Phase 3: UI
|
|
139
|
+
- P3-001: Page component — `website/src/app/dashboard/[FILL]/page.tsx`
|
|
140
|
+
- P3-002: Client components — `website/src/app/dashboard/[FILL]/[FILL]-client.tsx`
|
|
141
|
+
- P3-003: Loading state — `website/src/app/dashboard/[FILL]/loading.tsx`
|
|
142
|
+
|
|
143
|
+
### Phase 4: Navigation & Docs
|
|
144
|
+
- P4-001: Update dashboard nav — `website/src/components/dashboard/DashboardNav.tsx`
|
|
145
|
+
- P4-002: Update docs if needed
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### TEMPLATE B: New API Endpoint
|
|
149
|
+
|
|
150
|
+
If the request is for a new API endpoint:
|
|
151
|
+
|
|
152
|
+
```markdown
|
|
153
|
+
## Pre-filled Plan Structure (API Endpoint)
|
|
154
|
+
|
|
155
|
+
### Phase 1: Route
|
|
156
|
+
- P1-001: Route file — `website/src/app/api/[FILL]/route.ts`
|
|
157
|
+
- P1-002: Auth middleware — `createServerSupabaseClient` or `authenticateApiKey`
|
|
158
|
+
- P1-003: Input validation — Zod schema for request body/params
|
|
159
|
+
|
|
160
|
+
### Phase 2: Logic
|
|
161
|
+
- P2-001: Business logic implementation
|
|
162
|
+
- P2-002: Rate limiting — `rateLimit()` integration
|
|
163
|
+
- P2-003: Error handling — Consistent error response format
|
|
164
|
+
|
|
165
|
+
### Phase 3: Tests & Docs
|
|
166
|
+
- P3-001: API tests
|
|
167
|
+
- P3-002: API documentation update
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### TEMPLATE C: New MCP Tool Module
|
|
171
|
+
|
|
172
|
+
If the request is for a new MCP tool:
|
|
173
|
+
|
|
174
|
+
```markdown
|
|
175
|
+
## Pre-filled Plan Structure (MCP Tool Module)
|
|
176
|
+
|
|
177
|
+
### Phase 1: Module
|
|
178
|
+
- P1-001: Tool module — `packages/core/src/[FILL].ts`
|
|
179
|
+
- `get[FILL]ToolDefinitions()` — Returns tool definitions
|
|
180
|
+
- `is[FILL]Tool(name)` — Returns boolean for tool name matching
|
|
181
|
+
- `handle[FILL]ToolCall(name, args, memDb)` — Handles tool execution
|
|
182
|
+
|
|
183
|
+
### Phase 2: Registration
|
|
184
|
+
- P2-001: Wire into tools.ts — Import + definitions + handler routing
|
|
185
|
+
|
|
186
|
+
### Phase 3: Tests
|
|
187
|
+
- P3-001: Test file — `packages/core/src/__tests__/[FILL].test.ts`
|
|
188
|
+
- Test definitions, matching, handler
|
|
189
|
+
|
|
190
|
+
### Phase 4: Config (if needed)
|
|
191
|
+
- P4-001: Config interface — Add to `config.ts` + `massu.config.yaml`
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### TEMPLATE D: New Edge Function
|
|
195
|
+
|
|
196
|
+
If the request is for a Supabase edge function:
|
|
197
|
+
|
|
198
|
+
```markdown
|
|
199
|
+
## Pre-filled Plan Structure (Edge Function)
|
|
200
|
+
|
|
201
|
+
### Phase 1: Function
|
|
202
|
+
- P1-001: Function file — `website/supabase/functions/[FILL]/index.ts`
|
|
203
|
+
- P1-002: CORS setup — Standard CORS headers for the function
|
|
204
|
+
- P1-003: Auth — Verify JWT or API key
|
|
205
|
+
|
|
206
|
+
### Phase 2: Logic
|
|
207
|
+
- P2-001: Input validation — Parse and validate request body
|
|
208
|
+
- P2-002: Business logic — Core function implementation
|
|
209
|
+
- P2-003: Error handling — Structured error responses
|
|
210
|
+
|
|
211
|
+
### Phase 3: Config
|
|
212
|
+
- P3-001: Cron config (if scheduled) — Add to `supabase/config.toml`
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### TEMPLATE E: Feature Tier Addition
|
|
216
|
+
|
|
217
|
+
If the request is for adding features to a pricing tier:
|
|
218
|
+
|
|
219
|
+
```markdown
|
|
220
|
+
## Pre-filled Plan Structure (Feature Tier Addition)
|
|
221
|
+
|
|
222
|
+
### Phase 1: Database
|
|
223
|
+
- P1-001: Migration — New tables/columns for tier features
|
|
224
|
+
- P1-002: Type sync — Update type aliases
|
|
225
|
+
|
|
226
|
+
### Phase 2: Backend
|
|
227
|
+
- P2-001: Data layer — Access functions with tier checks
|
|
228
|
+
- P2-002: Server actions — CRUD with tier-based permissions
|
|
229
|
+
|
|
230
|
+
### Phase 3: UI
|
|
231
|
+
- P3-001: Feature pages — Dashboard pages for new features
|
|
232
|
+
- P3-002: Navigation update — Add to tier-appropriate nav
|
|
233
|
+
|
|
234
|
+
### Phase 4: Marketing & Docs
|
|
235
|
+
- P4-001: Pricing update — `website/src/data/pricing.ts`
|
|
236
|
+
- P4-002: Feature comparison — `FeatureComparison.tsx`
|
|
237
|
+
- P4-003: FAQ update — `PricingFAQ.tsx`
|
|
238
|
+
- P4-004: Documentation — Feature docs pages
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### If No Template Matches
|
|
242
|
+
|
|
243
|
+
Proceed directly to PHASE 1 (Feature Understanding) as normal. Not every request fits a template.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## PHASE 1: FEATURE UNDERSTANDING
|
|
248
|
+
|
|
249
|
+
### 1.1 Capture Requirements
|
|
250
|
+
|
|
251
|
+
```markdown
|
|
252
|
+
## Feature Request Analysis
|
|
253
|
+
|
|
254
|
+
### User Request
|
|
255
|
+
[Exact user request]
|
|
256
|
+
|
|
257
|
+
### Feature Type
|
|
258
|
+
[ ] New Feature (creating something new)
|
|
259
|
+
[ ] Enhancement (improving existing)
|
|
260
|
+
[ ] Bug Fix (correcting behavior)
|
|
261
|
+
[ ] Refactor (restructuring code)
|
|
262
|
+
|
|
263
|
+
### Affected Areas
|
|
264
|
+
[ ] MCP Tools (new or modified tools)
|
|
265
|
+
[ ] Hooks (new or modified hooks)
|
|
266
|
+
[ ] Config (new config sections)
|
|
267
|
+
[ ] Database (SQLite schema changes)
|
|
268
|
+
[ ] Core Library (shared utilities)
|
|
269
|
+
[ ] Tests (new or modified tests)
|
|
270
|
+
[ ] Website (Next.js pages, components, API routes)
|
|
271
|
+
[ ] Supabase (migrations, edge functions, RLS policies)
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### 1.2 Identify Similar Features
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
# Search for similar features in codebase
|
|
278
|
+
grep -rn "[feature_keyword]" packages/core/src/ --include="*.ts" | head -20
|
|
279
|
+
|
|
280
|
+
# Find similar tool modules
|
|
281
|
+
ls -la packages/core/src/*-tools.ts
|
|
282
|
+
|
|
283
|
+
# Find similar tests
|
|
284
|
+
ls -la packages/core/src/__tests__/
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**Document findings:**
|
|
288
|
+
```markdown
|
|
289
|
+
### Similar Features Found
|
|
290
|
+
| Feature | Location | Patterns Used |
|
|
291
|
+
|---------|----------|---------------|
|
|
292
|
+
| [name] | [path] | [patterns] |
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## PHASE 2: ARCHITECTURE REALITY CHECK
|
|
298
|
+
|
|
299
|
+
### 2.1 Module Structure Verification
|
|
300
|
+
|
|
301
|
+
For EACH module the feature might affect:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# Check if module exists
|
|
305
|
+
ls -la packages/core/src/[module].ts
|
|
306
|
+
|
|
307
|
+
# Check current exports
|
|
308
|
+
grep "export function\|export interface\|export type\|export const" packages/core/src/[module].ts
|
|
309
|
+
|
|
310
|
+
# Check if module is wired into tools.ts
|
|
311
|
+
grep "[module]" packages/core/src/tools.ts
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### 2.2 Tool Registration Check
|
|
315
|
+
|
|
316
|
+
If adding MCP tools, verify the registration pattern:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
# Check existing tool registration pattern
|
|
320
|
+
grep "getToolDefinitions\|handleToolCall\|isTool" packages/core/src/tools.ts | head -20
|
|
321
|
+
|
|
322
|
+
# Count current tools
|
|
323
|
+
grep -c "name:" packages/core/src/tools.ts
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### 2.3 Config Schema Check
|
|
327
|
+
|
|
328
|
+
If adding config sections, verify config.ts interface:
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
# Check current Config interface
|
|
332
|
+
grep -A 5 "export interface Config" packages/core/src/config.ts
|
|
333
|
+
|
|
334
|
+
# Check what config sections exist
|
|
335
|
+
grep "^\w\+:" massu.config.yaml | head -20
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### 2.4 Test Coverage Check
|
|
339
|
+
|
|
340
|
+
```bash
|
|
341
|
+
# Check existing tests for affected module
|
|
342
|
+
ls -la packages/core/src/__tests__/[module]*.test.ts
|
|
343
|
+
|
|
344
|
+
# Count test files
|
|
345
|
+
ls packages/core/src/__tests__/*.test.ts | wc -l
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### 2.5 Document Architecture Reality
|
|
349
|
+
|
|
350
|
+
```markdown
|
|
351
|
+
### Architecture Reality
|
|
352
|
+
|
|
353
|
+
#### Existing Modules to Modify
|
|
354
|
+
| Module | Exists | Current Purpose | Test Coverage |
|
|
355
|
+
|--------|--------|-----------------|---------------|
|
|
356
|
+
| [path] | YES/NO | [what it does] | [test file] |
|
|
357
|
+
|
|
358
|
+
#### New Modules to Create
|
|
359
|
+
| Module | Purpose | Pattern Reference |
|
|
360
|
+
|--------|---------|-------------------|
|
|
361
|
+
| [path] | [why] | [similar module] |
|
|
362
|
+
|
|
363
|
+
#### Tool Registration Required
|
|
364
|
+
| Tool Name | Definition | Handler | Test |
|
|
365
|
+
|-----------|------------|---------|------|
|
|
366
|
+
| [name] | [module]-tools.ts | [module]-tools.ts | __tests__/[module].test.ts |
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## PHASE 3: CODEBASE REALITY CHECK
|
|
372
|
+
|
|
373
|
+
### 3.1 Verify File Structure
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
# Check if target directories exist
|
|
377
|
+
ls -la packages/core/src/
|
|
378
|
+
|
|
379
|
+
# Check if files to modify exist
|
|
380
|
+
ls -la [file_path]
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### 3.2 Read Existing Patterns
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
# Always read CLAUDE.md
|
|
387
|
+
cat .claude/CLAUDE.md
|
|
388
|
+
|
|
389
|
+
# Read similar module for patterns
|
|
390
|
+
cat packages/core/src/[similar-module].ts | head -80
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
### 3.3 Document Codebase Reality
|
|
394
|
+
|
|
395
|
+
```markdown
|
|
396
|
+
### Codebase Reality
|
|
397
|
+
|
|
398
|
+
#### Existing Files to Modify
|
|
399
|
+
| File | Exists | Current Purpose |
|
|
400
|
+
|------|--------|-----------------|
|
|
401
|
+
| [path] | YES/NO | [what it does] |
|
|
402
|
+
|
|
403
|
+
#### New Files to Create
|
|
404
|
+
| File | Purpose | Pattern Reference |
|
|
405
|
+
|------|---------|-------------------|
|
|
406
|
+
| [path] | [why] | [similar module] |
|
|
407
|
+
|
|
408
|
+
#### Required Changes to tools.ts
|
|
409
|
+
| Change | Location | What |
|
|
410
|
+
|--------|----------|------|
|
|
411
|
+
| Import | top | import { get/is/handle } from './[module].ts' |
|
|
412
|
+
| Definition | getToolDefinitions() | ...getXToolDefinitions() |
|
|
413
|
+
| Handler | handleToolCall() | if (isXTool(name)) return handleXToolCall(...) |
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
## PHASE 3.5: BLAST RADIUS ANALYSIS (MANDATORY for value changes)
|
|
419
|
+
|
|
420
|
+
**MANDATORY**: When ANY plan changes a constant value, export name, config key, tool name, or file path, you MUST identify ALL occurrences across the ENTIRE codebase.
|
|
421
|
+
|
|
422
|
+
### Blast Radius Analysis Protocol
|
|
423
|
+
|
|
424
|
+
#### Step 1: Identify ALL Changed Values
|
|
425
|
+
|
|
426
|
+
```markdown
|
|
427
|
+
### Changed Values Inventory
|
|
428
|
+
|
|
429
|
+
| # | Old Value | New Value | Type | Scope |
|
|
430
|
+
|---|-----------|-----------|------|-------|
|
|
431
|
+
| 1 | [old] | [new] | export name | codebase-wide |
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
#### Step 2: Codebase-Wide Grep for EACH Changed Value
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
# For EACH old value:
|
|
438
|
+
grep -rn '[old_value]' packages/ --include="*.ts" | grep -v node_modules
|
|
439
|
+
grep -rn '[old_value]' massu.config.yaml
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
#### Step 3: Categorize EVERY Occurrence
|
|
443
|
+
|
|
444
|
+
```markdown
|
|
445
|
+
### Blast Radius: [old] -> [new]
|
|
446
|
+
|
|
447
|
+
**Total occurrences found: [N]**
|
|
448
|
+
|
|
449
|
+
| # | File | Line | Context | Action | Reason |
|
|
450
|
+
|---|------|------|---------|--------|--------|
|
|
451
|
+
| 1 | [file] | [line] | [context] | CHANGE/KEEP | [reason] |
|
|
452
|
+
|
|
453
|
+
### Blast Radius Completeness
|
|
454
|
+
- Total occurrences: [N]
|
|
455
|
+
- Categorized: [N] (MUST be 100%)
|
|
456
|
+
- Uncategorized: 0 (MUST be 0)
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
## PHASE 4: MASSU PATTERN COMPLIANCE
|
|
462
|
+
|
|
463
|
+
### 4.1 Mandatory Pattern Review
|
|
464
|
+
|
|
465
|
+
```markdown
|
|
466
|
+
### Pattern Compliance Checklist
|
|
467
|
+
|
|
468
|
+
#### Module Patterns
|
|
469
|
+
- [ ] ESM imports (no require())
|
|
470
|
+
- [ ] Config via getConfig() (no direct YAML parse)
|
|
471
|
+
- [ ] No process.exit() in library code
|
|
472
|
+
- [ ] No module.exports
|
|
473
|
+
|
|
474
|
+
#### Tool Registration Patterns (if adding tools)
|
|
475
|
+
- [ ] getXToolDefinitions() function
|
|
476
|
+
- [ ] isXTool() function
|
|
477
|
+
- [ ] handleXToolCall() function
|
|
478
|
+
- [ ] All 3 wired into tools.ts
|
|
479
|
+
- [ ] Tool names use configurable prefix via p()
|
|
480
|
+
|
|
481
|
+
#### Hook Patterns (if adding hooks)
|
|
482
|
+
- [ ] JSON stdin/stdout
|
|
483
|
+
- [ ] No heavy dependencies
|
|
484
|
+
- [ ] Compiles with esbuild
|
|
485
|
+
- [ ] Exits within 5 seconds
|
|
486
|
+
|
|
487
|
+
#### Testing Patterns
|
|
488
|
+
- [ ] Test file in __tests__/ directory
|
|
489
|
+
- [ ] Named [module].test.ts
|
|
490
|
+
- [ ] Tests cover tool definitions + handlers
|
|
491
|
+
|
|
492
|
+
#### Config Patterns (if adding config)
|
|
493
|
+
- [ ] Interface added to Config in config.ts
|
|
494
|
+
- [ ] Default values documented
|
|
495
|
+
- [ ] Example in massu.config.yaml
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
## PHASE 4.7: QUESTION FILTERING (Before Writing Plan)
|
|
501
|
+
|
|
502
|
+
After all research phases, list every open question about the feature. Then self-filter:
|
|
503
|
+
|
|
504
|
+
1. **List all questions** you have about requirements, behavior, edge cases, or architecture
|
|
505
|
+
2. **For each question, ask**: "Can I answer this by reading more code or checking config?"
|
|
506
|
+
3. **Self-answer** every question you can by reading the relevant files
|
|
507
|
+
4. **Surface only the remaining questions** to the user via AskUserQuestion
|
|
508
|
+
|
|
509
|
+
Questions that should be self-answered (do NOT ask the user):
|
|
510
|
+
- "What does this module look like?" - read the file
|
|
511
|
+
- "How does the existing feature handle X?" - read the module/test
|
|
512
|
+
- "What pattern should I follow?" - read CLAUDE.md
|
|
513
|
+
- "Does this config key exist?" - check massu.config.yaml
|
|
514
|
+
|
|
515
|
+
Questions that require the user:
|
|
516
|
+
- Business logic decisions ("Should this tool be synchronous or async?")
|
|
517
|
+
- Scope decisions ("Should this include CLI output formatting?")
|
|
518
|
+
- Priority trade-offs ("Full implementation or v1 subset?")
|
|
519
|
+
- Design preferences ("Separate module or extend existing?")
|
|
520
|
+
|
|
521
|
+
**If all questions are self-answerable, skip the user prompt entirely and proceed to plan generation.**
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
## PHASE 5: PLAN GENERATION
|
|
526
|
+
|
|
527
|
+
### 5.1 Plan Structure
|
|
528
|
+
|
|
529
|
+
```markdown
|
|
530
|
+
# Implementation Plan: [Feature Name]
|
|
531
|
+
|
|
532
|
+
## Overview
|
|
533
|
+
- **Feature**: [one-line description]
|
|
534
|
+
- **Complexity**: Low / Medium / High
|
|
535
|
+
- **Areas**: [MCP Tools, Hooks, Config, Database, Core, Tests]
|
|
536
|
+
- **Estimated Items**: [count]
|
|
537
|
+
|
|
538
|
+
## Feasibility Status
|
|
539
|
+
- File structure verified: YES
|
|
540
|
+
- Patterns reviewed: YES
|
|
541
|
+
- Similar features analyzed: YES
|
|
542
|
+
|
|
543
|
+
---
|
|
544
|
+
|
|
545
|
+
## Phase 1: Core Implementation
|
|
546
|
+
|
|
547
|
+
### P1-001: [Module Name]
|
|
548
|
+
- **Type**: MODULE_CREATE / MODULE_MODIFY
|
|
549
|
+
- **File**: packages/core/src/[module].ts
|
|
550
|
+
- **Action**: CREATE / MODIFY
|
|
551
|
+
- **Exports**:
|
|
552
|
+
- `getXToolDefinitions()`
|
|
553
|
+
- `isXTool()`
|
|
554
|
+
- `handleXToolCall()`
|
|
555
|
+
- **Pattern References**:
|
|
556
|
+
- [ ] ESM imports
|
|
557
|
+
- [ ] getConfig() for config access
|
|
558
|
+
- [ ] Tool prefix via p()
|
|
559
|
+
- **Verification**: VR-FILE + VR-GREP
|
|
560
|
+
|
|
561
|
+
### P1-002: [Tool Registration]
|
|
562
|
+
- **Type**: TOOL_WIRE
|
|
563
|
+
- **File**: packages/core/src/tools.ts
|
|
564
|
+
- **Action**: MODIFY
|
|
565
|
+
- **Changes**:
|
|
566
|
+
- Add import for new module
|
|
567
|
+
- Add definitions to getToolDefinitions()
|
|
568
|
+
- Add handler routing to handleToolCall()
|
|
569
|
+
- **Verification**: VR-TOOL-REG
|
|
570
|
+
|
|
571
|
+
---
|
|
572
|
+
|
|
573
|
+
## Phase 2: Tests
|
|
574
|
+
|
|
575
|
+
### P2-001: [Test Module]
|
|
576
|
+
- **Type**: TEST
|
|
577
|
+
- **File**: packages/core/src/__tests__/[module].test.ts
|
|
578
|
+
- **Action**: CREATE
|
|
579
|
+
- **Covers**: Tool definitions, handlers, edge cases
|
|
580
|
+
- **Verification**: VR-TEST (npm test)
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
## Phase 3: Config & Documentation (if applicable)
|
|
585
|
+
|
|
586
|
+
### P3-001: [Config Update]
|
|
587
|
+
- **Type**: CONFIG
|
|
588
|
+
- **File**: packages/core/src/config.ts + massu.config.yaml
|
|
589
|
+
- **Action**: MODIFY
|
|
590
|
+
- **Changes**: Add interface fields + example config
|
|
591
|
+
- **Verification**: VR-CONFIG
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
## Verification Commands
|
|
596
|
+
|
|
597
|
+
| Item | Type | Verification Command |
|
|
598
|
+
|------|------|---------------------|
|
|
599
|
+
| P1-001 | MODULE | `ls -la packages/core/src/[module].ts` |
|
|
600
|
+
| P1-002 | TOOL_WIRE | `grep "getXToolDefinitions" packages/core/src/tools.ts` |
|
|
601
|
+
| P2-001 | TEST | `npm test` |
|
|
602
|
+
| P3-001 | CONFIG | Parse config without error |
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## Item Summary
|
|
607
|
+
|
|
608
|
+
| Phase | Items | Description |
|
|
609
|
+
|-------|-------|-------------|
|
|
610
|
+
| Phase 1 | N | Core implementation |
|
|
611
|
+
| Phase 2 | N | Tests |
|
|
612
|
+
| Phase 3 | N | Config & documentation |
|
|
613
|
+
| **Total** | **N** | All deliverables |
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## Risk Assessment
|
|
618
|
+
|
|
619
|
+
| Risk | Likelihood | Impact | Mitigation |
|
|
620
|
+
|------|------------|--------|------------|
|
|
621
|
+
| [risk] | Low/Med/High | Low/Med/High | [how to handle] |
|
|
622
|
+
|
|
623
|
+
---
|
|
624
|
+
|
|
625
|
+
## Dependencies
|
|
626
|
+
|
|
627
|
+
| Item | Depends On | Reason |
|
|
628
|
+
|------|------------|--------|
|
|
629
|
+
| P1-002 | P1-001 | Needs module to exist |
|
|
630
|
+
| P2-001 | P1-001 | Needs module to test |
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
### 5.2 Item Numbering Convention
|
|
634
|
+
|
|
635
|
+
| Phase | Prefix | Example |
|
|
636
|
+
|-------|--------|---------|
|
|
637
|
+
| Core Implementation | P1-XXX | P1-001, P1-002 |
|
|
638
|
+
| Tests | P2-XXX | P2-001, P2-002 |
|
|
639
|
+
| Config & Docs | P3-XXX | P3-001, P3-002 |
|
|
640
|
+
|
|
641
|
+
---
|
|
642
|
+
|
|
643
|
+
## PHASE 6: FEASIBILITY VALIDATION
|
|
644
|
+
|
|
645
|
+
### 6.1 Pre-Flight Check
|
|
646
|
+
|
|
647
|
+
```markdown
|
|
648
|
+
### Feasibility Validation
|
|
649
|
+
|
|
650
|
+
#### Code Feasibility
|
|
651
|
+
| Check | Command | Result | Status |
|
|
652
|
+
|-------|---------|--------|--------|
|
|
653
|
+
| Similar module exists | grep/ls | Found | PASS/FAIL |
|
|
654
|
+
| Pattern scanner | massu-pattern-scanner.sh | Exit 0 | PASS/FAIL |
|
|
655
|
+
| Tools.ts writable | ls -la tools.ts | Exists | PASS/FAIL |
|
|
656
|
+
|
|
657
|
+
#### Config Feasibility
|
|
658
|
+
| Check | Command | Result | Status |
|
|
659
|
+
|-------|---------|--------|--------|
|
|
660
|
+
| Config parses | `node -e "require('yaml').parse(require('fs').readFileSync('massu.config.yaml','utf-8'))"` | No errors | PASS/FAIL |
|
|
661
|
+
| Required keys present | `grep -c 'toolPrefix\|paths\|framework' massu.config.yaml` | >= 3 | PASS/FAIL |
|
|
662
|
+
|
|
663
|
+
#### Build Feasibility
|
|
664
|
+
| Check | Command | Result | Status |
|
|
665
|
+
|-------|---------|--------|--------|
|
|
666
|
+
| TypeScript compiles | cd packages/core && npx tsc --noEmit | 0 errors | PASS/FAIL |
|
|
667
|
+
| Tests pass | npm test | All pass | PASS/FAIL |
|
|
668
|
+
| Hooks compile | cd packages/core && npm run build:hooks | Exit 0 | PASS/FAIL |
|
|
669
|
+
|
|
670
|
+
**FEASIBILITY GATE: PASS / FAIL**
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
### 6.2 Implementation Specificity Check (MANDATORY)
|
|
674
|
+
|
|
675
|
+
**Every plan item MUST have implementation details specific enough to execute WITHOUT guessing.**
|
|
676
|
+
|
|
677
|
+
| Requirement | Check |
|
|
678
|
+
|-------------|-------|
|
|
679
|
+
| **Exact file path** | Not "add a module" but `packages/core/src/foo.ts` |
|
|
680
|
+
| **Exact exports** | Not "export functions" but `getFooToolDefinitions, isFooTool, handleFooToolCall` |
|
|
681
|
+
| **Pattern reference** | Which existing module to follow |
|
|
682
|
+
| **Verification command** | Specific grep/ls that proves the item was implemented |
|
|
683
|
+
|
|
684
|
+
---
|
|
685
|
+
|
|
686
|
+
## OUTPUT FORMAT
|
|
687
|
+
|
|
688
|
+
### Plan Document Location
|
|
689
|
+
|
|
690
|
+
```bash
|
|
691
|
+
# Create plan document
|
|
692
|
+
# Location: docs/plans/[YYYY-MM-DD]-[feature-name].md
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
### Plan Summary for User
|
|
696
|
+
|
|
697
|
+
```markdown
|
|
698
|
+
## CS CREATE PLAN COMPLETE
|
|
699
|
+
|
|
700
|
+
### Plan Created
|
|
701
|
+
- **Feature**: [name]
|
|
702
|
+
- **File**: docs/plans/[date]-[name].md
|
|
703
|
+
- **Total Items**: [N]
|
|
704
|
+
- **Phases**: [list]
|
|
705
|
+
|
|
706
|
+
### Feasibility Status
|
|
707
|
+
| Check | Status |
|
|
708
|
+
|-------|--------|
|
|
709
|
+
| File Structure | VERIFIED |
|
|
710
|
+
| Pattern Compliance | VERIFIED |
|
|
711
|
+
| Build Feasibility | VERIFIED |
|
|
712
|
+
|
|
713
|
+
**PLAN READY FOR: /massu-plan audit**
|
|
714
|
+
|
|
715
|
+
### Next Steps
|
|
716
|
+
1. Run `/massu-plan [plan-path]` to audit the plan
|
|
717
|
+
2. Run `/massu-loop [plan-path]` to implement with verification
|
|
718
|
+
3. Run `/massu-commit` for pre-commit gates
|
|
719
|
+
4. Run `/massu-push` for full verification and push
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
---
|
|
723
|
+
|
|
724
|
+
## POST-BUILD REFLECTION QUESTIONS
|
|
725
|
+
|
|
726
|
+
Include these questions at the end of every plan document under a "## Post-Build Reflection" heading:
|
|
727
|
+
|
|
728
|
+
1. **"Now that I've built this, what would I have done differently?"**
|
|
729
|
+
- Architectural choices that caused friction during implementation
|
|
730
|
+
- Patterns that were harder to work with than expected
|
|
731
|
+
- Code that works but feels fragile or overly complex
|
|
732
|
+
|
|
733
|
+
2. **"What should be refactored before moving on?"**
|
|
734
|
+
- Concrete suggestions with file paths
|
|
735
|
+
- Technical debt introduced during implementation
|
|
736
|
+
- Opportunities to simplify or consolidate
|
|
737
|
+
|
|
738
|
+
These questions are answered by the implementing agent AFTER verification passes, capturing accumulated knowledge before context compression.
|
|
739
|
+
|
|
740
|
+
---
|
|
741
|
+
|
|
742
|
+
## START NOW
|
|
743
|
+
|
|
744
|
+
1. **Capture** the feature request
|
|
745
|
+
2. **Read** similar features in codebase
|
|
746
|
+
3. **Verify** architecture and file structure
|
|
747
|
+
4. **Check** pattern compliance requirements
|
|
748
|
+
5. **Write** plan with verified facts
|
|
749
|
+
6. **Validate** feasibility
|
|
750
|
+
7. **Output** plan document
|
|
751
|
+
|
|
752
|
+
**Remember: Read first, plan second. No assumptions, only evidence.**
|