@massu/core 0.4.1 → 0.4.2

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.
@@ -0,0 +1,480 @@
1
+ ---
2
+ name: massu-gap-enhancement-analyzer
3
+ description: "When user says 'analyze gaps', 'find enhancements', 'gap analysis', or has completed a massu-loop implementation and needs to identify remaining gaps and enhancement opportunities"
4
+ allowed-tools: Bash(*), Read(*), Write(*), Grep(*), Glob(*)
5
+ ---
6
+ name: massu-gap-enhancement-analyzer
7
+
8
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding.
9
+
10
+ # Massu Gap & Enhancement Analyzer
11
+
12
+ ## Objective
13
+
14
+ Perform a comprehensive post-implementation review of a plan executed through massu-loop to identify:
15
+ 1. **Gaps**: Missing functionality, incomplete implementations, untested paths, or deviations from plan
16
+ 2. **Enhancements**: Opportunities to improve UX, performance, security, or functionality beyond the original scope
17
+
18
+ This is a READ-ONLY analysis tool. It does NOT make changes - it produces a detailed report for user review.
19
+
20
+ ---
21
+
22
+ ## WHEN TO USE THIS COMMAND
23
+
24
+ Use this command AFTER a plan has been implemented through `/massu-loop` to:
25
+ - Validate that ALL plan items were actually implemented
26
+ - Identify gaps that may have been missed during implementation
27
+ - Discover enhancement opportunities that became apparent during implementation
28
+ - Create a prioritized action list for follow-up work
29
+
30
+ ---
31
+
32
+ ## INPUT REQUIREMENTS
33
+
34
+ The user MUST provide:
35
+ 1. **Plan file path**: The original plan document that was implemented
36
+ 2. **Implementation scope**: Files/directories that were touched during implementation
37
+
38
+ If not provided, ask for these inputs before proceeding.
39
+
40
+ ---
41
+
42
+ ## PHASE 1: PLAN EXTRACTION & INVENTORY
43
+
44
+ ### Step 1.1: Read the Complete Plan
45
+
46
+ ```bash
47
+ # Read the entire plan document
48
+ cat [PLAN_FILE_PATH]
49
+ ```
50
+
51
+ **Extract ALL of the following into structured inventory:**
52
+
53
+ | Category | What to Extract |
54
+ |----------|-----------------|
55
+ | **Database** | Tables, columns, migrations, RLS policies, grants |
56
+ | **API/Routers** | Procedures, inputs, outputs, mutations, queries |
57
+ | **Components** | UI components, their locations, dependencies |
58
+ | **Pages** | Routes, page files, layouts |
59
+ | **Features** | User-facing functionality, workflows, integrations |
60
+ | **Configuration** | Environment variables, feature flags, settings |
61
+ | **Tests** | Test files, test coverage requirements |
62
+ | **Documentation** | Help site updates, README changes |
63
+
64
+ ### Step 1.2: Create Plan Item Checklist
65
+
66
+ ```markdown
67
+ ## PLAN ITEM INVENTORY
68
+
69
+ | ID | Category | Item Description | Expected Location | Status |
70
+ |----|----------|------------------|-------------------|--------|
71
+ | P-001 | DB | [table_name] table | migration file | PENDING |
72
+ | P-002 | API | [procedure_name] procedure | routers/[file].ts | PENDING |
73
+ | P-003 | UI | [ComponentName] component | components/[path]/ | PENDING |
74
+ | P-004 | Feature | [Feature description] | [location] | PENDING |
75
+ ```
76
+
77
+ ---
78
+
79
+ ## PHASE 2: IMPLEMENTATION VERIFICATION
80
+
81
+ ### Step 2.1: Database Verification
82
+
83
+ For EACH database item in the plan:
84
+
85
+ ```sql
86
+ -- Verify table exists
87
+ SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tablename = '[TABLE]';
88
+
89
+ -- Verify columns match plan
90
+ SELECT column_name, data_type, is_nullable
91
+ FROM information_schema.columns
92
+ WHERE table_name = '[TABLE]'
93
+ ORDER BY ordinal_position;
94
+
95
+ -- Verify RLS policies
96
+ SELECT polname, polcmd FROM pg_policies WHERE tablename = '[TABLE]';
97
+
98
+ -- Verify grants
99
+ SELECT grantee, privilege_type FROM information_schema.table_privileges
100
+ WHERE table_name = '[TABLE]' AND grantee IN ('authenticated', 'service_role');
101
+ ```
102
+
103
+ ### Step 2.2: API/Router Verification
104
+
105
+ For EACH procedure in the plan:
106
+
107
+ ```bash
108
+ # Verify procedure exists
109
+ grep -n "[procedure_name]:" src/server/api/routers/[router].ts
110
+
111
+ # Verify uses correct procedure type
112
+ grep -B 2 "[procedure_name]:" src/server/api/routers/[router].ts | grep "protectedProcedure\|publicProcedure"
113
+
114
+ # Verify input schema
115
+ grep -A 20 "[procedure_name]:" src/server/api/routers/[router].ts | grep -A 10 "input:"
116
+
117
+ # Verify router is exported in root
118
+ grep "[router]" src/server/api/root.ts
119
+ ```
120
+
121
+ ### Step 2.3: Component Verification
122
+
123
+ For EACH UI component in the plan:
124
+
125
+ ```bash
126
+ # Verify component file exists
127
+ ls -la src/components/[path]/[ComponentName].tsx
128
+
129
+ # CRITICAL: Verify component is RENDERED in a page
130
+ grep -rn "<[ComponentName]" src/app/
131
+
132
+ # Verify component imports are correct
133
+ grep -n "import.*[ComponentName]" src/app/**/page.tsx
134
+ ```
135
+
136
+ ### Step 2.4: Backend-Frontend Coupling Verification (CRITICAL)
137
+
138
+ **MANDATORY**: Verify ALL backend features are exposed in frontend.
139
+
140
+ ```bash
141
+ # Run automated coupling check
142
+ ./scripts/check-coupling.sh
143
+ ```
144
+
145
+ **Manual verification for plan-specific items:**
146
+
147
+ | Backend Item | Frontend Requirement | Verification |
148
+ |--------------|---------------------|--------------|
149
+ | z.enum values in router | SELECT options in form | grep values in constants.ts |
150
+ | New API procedure | UI component calls it | grep api.[router].[proc] in components |
151
+ | Input schema fields | Form has all fields | grep field names in form component |
152
+ | Type definitions | Frontend types match | compare router types to component types |
153
+
154
+ ```markdown
155
+ ### Backend-Frontend Coupling Status
156
+ | Backend Feature | Frontend Exposure | Status |
157
+ |-----------------|-------------------|--------|
158
+ | [feature] | [component/form] | PRESENT/MISSING |
159
+ ```
160
+
161
+ ---
162
+
163
+ ## PHASE 3: GAP ANALYSIS
164
+
165
+ ### Gap Categories
166
+
167
+ | Category | Definition | Severity |
168
+ |----------|------------|----------|
169
+ | **CRITICAL** | Feature doesn't work, data loss risk, security issue | P0 |
170
+ | **COUPLING** | Backend feature not exposed in UI (users can't access it) | P0 |
171
+ | **MAJOR** | Significant functionality missing, UX broken | P1 |
172
+ | **MINOR** | Small missing piece, cosmetic issue | P2 |
173
+ | **DEVIATION** | Implemented differently than planned (may be intentional) | P3 |
174
+
175
+ ### Gap Detection Methods
176
+
177
+ #### 3.1: Plan-to-Implementation Gaps
178
+
179
+ Compare plan items against actual implementation:
180
+
181
+ ```markdown
182
+ ### PLAN-TO-IMPLEMENTATION GAPS
183
+
184
+ | Plan Item | Expected | Actual | Gap Type | Severity |
185
+ |-----------|----------|--------|----------|----------|
186
+ | P-001 | Table X with columns A,B,C | Only A,B exist | MISSING_COLUMN | MAJOR |
187
+ | P-002 | Procedure Y | Not found | MISSING_PROCEDURE | CRITICAL |
188
+ | P-003 | Component Z | File exists but not rendered | NOT_RENDERED | CRITICAL |
189
+ ```
190
+
191
+ #### 3.2: Cross-Reference Gaps
192
+
193
+ Check for inconsistencies between layers:
194
+
195
+ ```bash
196
+ # API procedures without UI consumers
197
+ grep -rn "api\.[router]\.[procedure]" src/components/ src/app/ | wc -l
198
+ # If 0, procedure may be unused
199
+
200
+ # Components without page integration
201
+ find src/components/[feature]/ -name "*.tsx" | while read f; do
202
+ name=$(basename "$f" .tsx)
203
+ grep -rn "<$name" src/app/ || echo "ORPHAN: $name"
204
+ done
205
+ ```
206
+
207
+ #### 3.3: Error Handling Gaps
208
+
209
+ ```bash
210
+ # Check for try/catch in async operations
211
+ grep -rn "async.*=>" src/server/api/routers/[feature]*.ts | grep -v "try" | head -20
212
+
213
+ # Check for loading states
214
+ grep -rn "useState.*loading\|isLoading\|isPending" src/components/[feature]/ | wc -l
215
+ ```
216
+
217
+ ---
218
+
219
+ ## PHASE 4: ENHANCEMENT ANALYSIS
220
+
221
+ ### Enhancement Categories
222
+
223
+ | Category | Description | Priority Framework |
224
+ |----------|-------------|-------------------|
225
+ | **UX** | User experience improvements | Impact vs Effort |
226
+ | **Performance** | Speed, efficiency optimizations | Measurable benefit |
227
+ | **Security** | Hardening, additional checks | Risk reduction |
228
+ | **Functionality** | Feature extensions | User value |
229
+ | **Developer Experience** | Code quality, maintainability | Long-term value |
230
+ | **Accessibility** | A11y improvements | Compliance + UX |
231
+
232
+ ### Enhancement Detection Methods
233
+
234
+ #### 4.1: UX Enhancements
235
+
236
+ ```bash
237
+ # Empty states - are they helpful?
238
+ grep -rn "length === 0\|EmptyState" src/components/[feature]/
239
+
240
+ # Loading states - are they smooth?
241
+ grep -rn "isLoading\|Skeleton\|Spinner" src/components/[feature]/
242
+
243
+ # Success feedback - is it clear?
244
+ grep -rn "toast.success" src/components/[feature]/
245
+ ```
246
+
247
+ #### 4.2: Performance Enhancements
248
+
249
+ ```bash
250
+ # Large list rendering - virtualization needed?
251
+ grep -rn "map.*=>" src/components/[feature]/ | grep -v "slice\|virtualized"
252
+
253
+ # API calls - batching opportunity?
254
+ grep -rn "useQuery\|useMutation" src/components/[feature]/ | wc -l
255
+ ```
256
+
257
+ #### 4.3: Security Enhancements
258
+
259
+ ```bash
260
+ # Input sanitization
261
+ grep -rn "z\.string()" src/server/api/routers/[feature]*.ts | grep -v "min\|max\|regex"
262
+ ```
263
+
264
+ #### 4.4: Accessibility Enhancements
265
+
266
+ ```bash
267
+ # ARIA attributes
268
+ grep -rn "aria-\|role=" src/components/[feature]/
269
+
270
+ # Alt text
271
+ grep -rn "<img\|<Image" src/components/[feature]/ | grep -v "alt="
272
+ ```
273
+
274
+ ---
275
+
276
+ ## PHASE 5: REPORT GENERATION
277
+
278
+ ### Report Structure
279
+
280
+ ```markdown
281
+ # Gap & Enhancement Analysis Report
282
+
283
+ ## Executive Summary
284
+
285
+ | Metric | Count |
286
+ |--------|-------|
287
+ | Plan Items | [N] |
288
+ | Verified Complete | [X] |
289
+ | Gaps Found | [G] |
290
+ | Critical Gaps | [C] |
291
+ | Enhancements Identified | [E] |
292
+
293
+ **Overall Score**: [X/N] items verified ([%]%)
294
+ **Gap Severity Distribution**: [C] Critical, [M] Major, [m] Minor
295
+
296
+ ---
297
+
298
+ ## Section 1: Plan Coverage Analysis
299
+
300
+ ### Coverage Matrix
301
+
302
+ | Phase | Items | Complete | Gaps | Coverage |
303
+ |-------|-------|----------|------|----------|
304
+ | Phase 1 | [N] | [X] | [G] | [%]% |
305
+ | Phase 2 | [N] | [X] | [G] | [%]% |
306
+ | **TOTAL** | [N] | [X] | [G] | [%]% |
307
+
308
+ ---
309
+
310
+ ## Section 2: Gap Report
311
+
312
+ ### Critical Gaps (P0) - Must Fix
313
+
314
+ | ID | Gap Description | Expected | Actual | Impact | Remediation |
315
+ |----|-----------------|----------|--------|--------|-------------|
316
+ | G-001 | [description] | [expected] | [actual] | [impact] | [fix steps] |
317
+
318
+ ### Major Gaps (P1) - Should Fix
319
+
320
+ | ID | Gap Description | Expected | Actual | Impact | Remediation |
321
+ |----|-----------------|----------|--------|--------|-------------|
322
+
323
+ ### Minor Gaps (P2) - Nice to Fix
324
+
325
+ | ID | Gap Description | Expected | Actual | Impact | Remediation |
326
+ |----|-----------------|----------|--------|--------|-------------|
327
+
328
+ ---
329
+
330
+ ## Section 3: Enhancement Recommendations
331
+
332
+ ### High-Impact Enhancements (Recommended)
333
+
334
+ | ID | Enhancement | Category | Impact | Effort | Priority |
335
+ |----|-------------|----------|--------|--------|----------|
336
+ | E-001 | [description] | UX/Perf/Sec | High/Med/Low | High/Med/Low | [1-5] |
337
+
338
+ ---
339
+
340
+ ## Section 4: Technical Debt Identified
341
+
342
+ | ID | Debt Type | Location | Description | Risk if Unaddressed |
343
+ |----|-----------|----------|-------------|---------------------|
344
+ | TD-001 | [type] | [file:line] | [description] | [risk] |
345
+
346
+ ---
347
+
348
+ ## Section 5: Action Items
349
+
350
+ ### Immediate Actions (Gaps)
351
+
352
+ - [ ] G-001: [fix description]
353
+
354
+ ### Recommended Enhancements
355
+
356
+ - [ ] E-001: [enhancement description]
357
+
358
+ ### Technical Debt Items
359
+
360
+ - [ ] TD-001: [debt resolution]
361
+ ```
362
+
363
+ ---
364
+
365
+ ## EXECUTION FLOW
366
+
367
+ ```
368
+ START
369
+ |
370
+ v
371
+ [PHASE 1: Plan Extraction]
372
+ - Read complete plan file
373
+ - Extract all items into inventory
374
+ - Create checklist
375
+ |
376
+ v
377
+ [PHASE 2: Implementation Verification]
378
+ - Database verification
379
+ - API/Router verification
380
+ - Component verification
381
+ - Feature verification
382
+ - Configuration verification
383
+ |
384
+ v
385
+ [PHASE 3: Gap Analysis]
386
+ - Plan-to-implementation gaps
387
+ - Cross-reference gaps
388
+ - Error handling gaps
389
+ |
390
+ v
391
+ [PHASE 4: Enhancement Analysis]
392
+ - UX enhancements
393
+ - Performance enhancements
394
+ - Security enhancements
395
+ - Accessibility enhancements
396
+ |
397
+ v
398
+ [PHASE 5: Report Generation]
399
+ - Executive summary
400
+ - Detailed gap report
401
+ - Enhancement recommendations
402
+ - Action items
403
+ |
404
+ v
405
+ [PHASE 6: Report Saving]
406
+ - Save report to .claude/reports/gap-analysis/
407
+ - Verify file saved
408
+ |
409
+ v
410
+ OUTPUT: Full analysis report (displayed AND saved)
411
+ ```
412
+
413
+ ---
414
+
415
+ ## OUTPUT REQUIREMENTS
416
+
417
+ The final output MUST include:
418
+
419
+ 1. **Executive Summary** with key metrics
420
+ 2. **Coverage Matrix** showing plan completion percentage
421
+ 3. **Gap Report** with severity, impact, and remediation for each gap
422
+ 4. **Enhancement Recommendations** prioritized by impact/effort
423
+ 5. **Action Items** checklist for follow-up work
424
+ 6. **Verification Evidence** proving each check was performed
425
+
426
+ ---
427
+
428
+ ## PHASE 6: REPORT SAVING (MANDATORY)
429
+
430
+ ### Report Storage Location
431
+
432
+ ```
433
+ .claude/reports/gap-analysis/
434
+ ```
435
+
436
+ ### Report Naming Convention
437
+
438
+ ```
439
+ [YYYY-MM-DD]-[plan-name-slug]-gap-analysis.md
440
+ ```
441
+
442
+ ### Step 6.1: Create Reports Directory (if needed)
443
+
444
+ ```bash
445
+ mkdir -p .claude/reports/gap-analysis
446
+ ```
447
+
448
+ ### Step 6.2: Save the Complete Report
449
+
450
+ Write the full report (from Phase 5) to the report file.
451
+
452
+ ### Step 6.3: Verification
453
+
454
+ ```bash
455
+ # Verify report was saved
456
+ ls -la .claude/reports/gap-analysis/[REPORT_FILE]
457
+
458
+ # Verify report has content
459
+ wc -l .claude/reports/gap-analysis/[REPORT_FILE]
460
+ ```
461
+
462
+ ---
463
+
464
+ ## IMPORTANT NOTES
465
+
466
+ - This command is READ-ONLY - it does NOT make changes
467
+ - All findings are recommendations - user decides what to act on
468
+ - Enhancements are optional - focus on gaps first
469
+ - Document evidence for every finding
470
+
471
+ ---
472
+
473
+ ## START NOW
474
+
475
+ 1. Confirm plan file path with user
476
+ 2. Read the complete plan document
477
+ 3. Execute Phase 1-5 in order
478
+ 4. Generate comprehensive report
479
+ 5. Save report to `.claude/reports/gap-analysis/`
480
+ 6. Present findings to user with report location
@@ -0,0 +1,111 @@
1
+ ---
2
+ name: massu-hooks
3
+ description: "When user asks about hook status, profile configuration, or wants to see which hooks are active — 'hooks', 'hook status', 'what hooks are running'"
4
+ allowed-tools: Bash(*), Read(*)
5
+ ---
6
+ name: massu-hooks
7
+
8
+ # Massu Hooks: Profile & Status Dashboard
9
+
10
+ > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding.
11
+
12
+ ## Objective
13
+
14
+ Display hook infrastructure status, profile configuration, and per-hook gating information.
15
+
16
+ ---
17
+
18
+ ## USAGE
19
+
20
+ ```
21
+ /massu-hooks # Show current profile and all hooks
22
+ /massu-hooks status # Same as above
23
+ /massu-hooks minimal # Show what runs under minimal profile
24
+ /massu-hooks standard # Show what runs under standard profile
25
+ /massu-hooks strict # Show what runs under strict profile
26
+ ```
27
+
28
+ ---
29
+
30
+ ## EXECUTION
31
+
32
+ ### Step 1: Read Current Profile
33
+
34
+ ```bash
35
+ echo "Current LIMN_HOOK_PROFILE: ${LIMN_HOOK_PROFILE:-strict}"
36
+ echo "Disabled hooks: ${LIMN_DISABLED_HOOKS:-none}"
37
+ ```
38
+
39
+ ### Step 2: Display Hook Inventory
40
+
41
+ Show ALL hooks grouped by tier with their source (project vs user settings):
42
+
43
+ #### Critical Tier (Always Run)
44
+ | Hook | Source | Type | Trigger |
45
+ |------|--------|------|---------|
46
+ | output-secret-filter.sh | Project | Script | PostToolUse (Bash/Read/MCP) |
47
+ | mcp-rate-limiter.sh | Project | Script | PreToolUse (MCP) |
48
+ | memory-integrity-check.sh | Project | Script | SessionStart |
49
+ | Secret file detector | User | Inline | PreToolUse (Bash) |
50
+ | Staged secrets blocker | User | Inline | PreToolUse (Bash) |
51
+ | Auto-approve Read/Glob/Grep | User | Inline | PreToolUse |
52
+ | Auto-approve safe Bash | User | Inline | PreToolUse |
53
+
54
+ #### Standard Tier (Skipped in minimal)
55
+ | Hook | Source | Type | Trigger |
56
+ |------|--------|------|---------|
57
+ | pattern-feedback.sh | Project | Script | PostToolUse (Edit/Write) |
58
+ | Pattern scanner on push | Project | Inline | PreToolUse (Bash) |
59
+ | Validate features on commit | Project | Inline | PreToolUse (Bash) |
60
+ | Incident detection | Project | Inline | UserPromptSubmit |
61
+ | Uncommitted changes warning | Project | Inline | Stop |
62
+ | memory-enforcement.sh | User | Script | UserPromptSubmit |
63
+ | post-commit-memory.sh | User | Script | PostToolUse (Bash) |
64
+
65
+ #### Advisory Tier (Skipped in minimal AND standard)
66
+ | Hook | Source | Type | Trigger |
67
+ |------|--------|------|---------|
68
+ | auto-review-on-stop.sh | Project | Script | Stop |
69
+ | pattern-scanner single-file | Project | Inline | PostToolUse (Edit/Write) |
70
+ | pattern-extractor.sh | Project | Script | Stop |
71
+ | audit-css-tokens.sh | User | Script | PostToolUse (Edit/Write) |
72
+ | Context size warning | User | Inline | UserPromptSubmit |
73
+
74
+ ### Step 3: Profile Comparison
75
+
76
+ If a specific profile was requested, highlight which hooks are ACTIVE vs SKIPPED under that profile.
77
+
78
+ ### Step 4: Hook Health Check
79
+
80
+ ```bash
81
+ # Verify hook-gate.sh exists and is valid
82
+ bash -n scripts/hooks/hook-gate.sh && echo "hook-gate.sh: OK" || echo "hook-gate.sh: SYNTAX ERROR"
83
+
84
+ # Verify key hook scripts exist
85
+ for hook in pattern-feedback output-secret-filter mcp-rate-limiter; do
86
+ [ -f "scripts/hooks/${hook}.sh" ] && echo "${hook}.sh: EXISTS" || echo "${hook}.sh: MISSING"
87
+ done
88
+ ```
89
+
90
+ ---
91
+
92
+ ## OUTPUT FORMAT
93
+
94
+ ```
95
+ ═══════════════════════════════════════════════════════════════════════════════
96
+ MASSU HOOK INFRASTRUCTURE
97
+ ═══════════════════════════════════════════════════════════════════════════════
98
+
99
+ Profile: strict (default)
100
+ Disabled hooks: none
101
+ Hook gate: scripts/hooks/hook-gate.sh (OK)
102
+
103
+ HOOK COUNTS BY PROFILE:
104
+ minimal: 7 hooks (critical only)
105
+ standard: 14 hooks (critical + standard)
106
+ strict: 19 hooks (all — current)
107
+
108
+ [Full hook table as above]
109
+
110
+ ═══════════════════════════════════════════════════════════════════════════════
111
+ ```