@massu/core 0.5.0 → 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.
Files changed (118) hide show
  1. package/README.md +40 -0
  2. package/agents/massu-architecture-reviewer.md +104 -0
  3. package/agents/massu-blast-radius-analyzer.md +84 -0
  4. package/agents/massu-competitive-scorer.md +126 -0
  5. package/agents/massu-help-sync.md +73 -0
  6. package/agents/massu-migration-writer.md +94 -0
  7. package/agents/massu-output-scorer.md +87 -0
  8. package/agents/massu-pattern-reviewer.md +84 -0
  9. package/agents/massu-plan-auditor.md +170 -0
  10. package/agents/massu-schema-sync-verifier.md +70 -0
  11. package/agents/massu-security-reviewer.md +98 -0
  12. package/agents/massu-ux-reviewer.md +106 -0
  13. package/commands/_shared-preamble.md +53 -23
  14. package/commands/_shared-references/auto-learning-protocol.md +71 -0
  15. package/commands/_shared-references/blast-radius-protocol.md +76 -0
  16. package/commands/_shared-references/security-pre-screen.md +64 -0
  17. package/commands/_shared-references/test-first-protocol.md +87 -0
  18. package/commands/_shared-references/verification-table.md +52 -0
  19. package/commands/massu-article-review.md +343 -0
  20. package/commands/massu-autoresearch/references/eval-runner.md +84 -0
  21. package/commands/massu-autoresearch/references/safety-rails.md +125 -0
  22. package/commands/massu-autoresearch/references/scoring-protocol.md +151 -0
  23. package/commands/massu-autoresearch.md +258 -0
  24. package/commands/massu-batch.md +44 -12
  25. package/commands/massu-bearings.md +42 -8
  26. package/commands/massu-checkpoint.md +588 -0
  27. package/commands/massu-ci-fix.md +2 -2
  28. package/commands/massu-command-health.md +132 -0
  29. package/commands/massu-command-improve.md +232 -0
  30. package/commands/massu-commit.md +205 -44
  31. package/commands/massu-create-plan.md +239 -57
  32. package/commands/massu-data/references/common-queries.md +79 -0
  33. package/commands/massu-data/references/table-guide.md +50 -0
  34. package/commands/massu-data.md +66 -0
  35. package/commands/massu-dead-code.md +29 -34
  36. package/commands/massu-debug/references/auto-learning.md +61 -0
  37. package/commands/massu-debug/references/codegraph-tracing.md +80 -0
  38. package/commands/massu-debug/references/common-shortcuts.md +98 -0
  39. package/commands/massu-debug/references/investigation-phases.md +294 -0
  40. package/commands/massu-debug/references/report-format.md +107 -0
  41. package/commands/massu-debug.md +105 -386
  42. package/commands/massu-docs.md +1 -1
  43. package/commands/massu-full-audit.md +61 -0
  44. package/commands/massu-gap-enhancement-analyzer.md +276 -16
  45. package/commands/massu-golden-path/references/approval-points.md +216 -0
  46. package/commands/massu-golden-path/references/competitive-mode.md +273 -0
  47. package/commands/massu-golden-path/references/error-handling.md +121 -0
  48. package/commands/massu-golden-path/references/phase-0-requirements.md +53 -0
  49. package/commands/massu-golden-path/references/phase-1-plan-creation.md +168 -0
  50. package/commands/massu-golden-path/references/phase-2-implementation.md +397 -0
  51. package/commands/massu-golden-path/references/phase-2.5-gap-analyzer.md +156 -0
  52. package/commands/massu-golden-path/references/phase-3-simplify.md +40 -0
  53. package/commands/massu-golden-path/references/phase-4-commit.md +94 -0
  54. package/commands/massu-golden-path/references/phase-5-push.md +116 -0
  55. package/commands/massu-golden-path/references/phase-5.5-production-verify.md +170 -0
  56. package/commands/massu-golden-path/references/phase-6-completion.md +113 -0
  57. package/commands/massu-golden-path/references/qa-evaluator-spec.md +137 -0
  58. package/commands/massu-golden-path/references/sprint-contract-protocol.md +117 -0
  59. package/commands/massu-golden-path/references/vr-visual-calibration.md +73 -0
  60. package/commands/massu-golden-path.md +114 -848
  61. package/commands/massu-guide.md +72 -69
  62. package/commands/massu-hooks.md +27 -12
  63. package/commands/massu-hotfix.md +221 -144
  64. package/commands/massu-incident.md +49 -20
  65. package/commands/massu-infra-audit.md +187 -0
  66. package/commands/massu-learning-audit.md +211 -0
  67. package/commands/massu-loop/references/auto-learning.md +49 -0
  68. package/commands/massu-loop/references/checkpoint-audit.md +40 -0
  69. package/commands/massu-loop/references/guardrails.md +17 -0
  70. package/commands/massu-loop/references/iteration-structure.md +115 -0
  71. package/commands/massu-loop/references/loop-controller.md +188 -0
  72. package/commands/massu-loop/references/plan-extraction.md +78 -0
  73. package/commands/massu-loop/references/vr-plan-spec.md +140 -0
  74. package/commands/massu-loop-playwright.md +9 -9
  75. package/commands/massu-loop.md +115 -670
  76. package/commands/massu-new-pattern.md +423 -0
  77. package/commands/massu-perf.md +422 -0
  78. package/commands/massu-plan-audit.md +1 -1
  79. package/commands/massu-plan.md +389 -122
  80. package/commands/massu-production-verify.md +433 -0
  81. package/commands/massu-push.md +62 -378
  82. package/commands/massu-recap.md +29 -3
  83. package/commands/massu-rollback.md +613 -0
  84. package/commands/massu-scaffold-hook.md +2 -4
  85. package/commands/massu-scaffold-page.md +2 -3
  86. package/commands/massu-scaffold-router.md +1 -2
  87. package/commands/massu-security.md +619 -0
  88. package/commands/massu-simplify.md +115 -85
  89. package/commands/massu-squirrels.md +2 -2
  90. package/commands/massu-tdd.md +38 -22
  91. package/commands/massu-test.md +3 -3
  92. package/commands/massu-type-mismatch-audit.md +469 -0
  93. package/commands/massu-ui-audit.md +587 -0
  94. package/commands/massu-verify-playwright.md +287 -32
  95. package/commands/massu-verify.md +150 -46
  96. package/dist/cli.js +146 -95
  97. package/package.json +6 -2
  98. package/patterns/build-patterns.md +302 -0
  99. package/patterns/component-patterns.md +246 -0
  100. package/patterns/display-patterns.md +185 -0
  101. package/patterns/form-patterns.md +890 -0
  102. package/patterns/integration-testing-checklist.md +445 -0
  103. package/patterns/security-patterns.md +219 -0
  104. package/patterns/testing-patterns.md +569 -0
  105. package/patterns/tool-routing.md +81 -0
  106. package/patterns/ui-patterns.md +371 -0
  107. package/protocols/plan-implementation.md +267 -0
  108. package/protocols/recovery.md +225 -0
  109. package/protocols/verification.md +404 -0
  110. package/reference/command-taxonomy.md +178 -0
  111. package/reference/cr-rules-reference.md +76 -0
  112. package/reference/hook-execution-order.md +148 -0
  113. package/reference/lessons-learned.md +175 -0
  114. package/reference/patterns-quickref.md +208 -0
  115. package/reference/standards.md +135 -0
  116. package/reference/subagents-reference.md +17 -0
  117. package/reference/vr-verification-reference.md +867 -0
  118. package/src/commands/install-commands.ts +149 -53
@@ -0,0 +1,156 @@
1
+ # Phase 2.5: Gap & Enhancement Analyzer Loop
2
+
3
+ > Reference doc for `/massu-golden-path`. Return to main file for overview.
4
+
5
+ ```
6
+ [GOLDEN PATH -- PHASE 2.5: GAP & ENHANCEMENT ANALYSIS]
7
+ ```
8
+
9
+ ## Purpose
10
+
11
+ After implementation (Phase 2) completes successfully, run a continuous gap and enhancement analysis loop. This phase catches everything implementation missed: incomplete features, missing edge cases, UX gaps, untested paths, accessibility issues, and enhancement opportunities.
12
+
13
+ **This phase loops until a FULL PASS discovers ZERO gaps/enhancements.**
14
+
15
+ ---
16
+
17
+ ## LOOP CONTROLLER
18
+
19
+ ```
20
+ iteration = 0
21
+ MAX_ITERATIONS = 10
22
+
23
+ WHILE iteration < MAX_ITERATIONS:
24
+ iteration += 1
25
+
26
+ result = Task(subagent_type="gap-analyzer", prompt="
27
+ Gap & Enhancement Analysis — Iteration {iteration}
28
+
29
+ CONTEXT:
30
+ - Plan file: {PLAN_PATH}
31
+ - Implementation is COMPLETE (Phase 2 passed)
32
+ - Your job: find gaps and enhancements the implementation missed
33
+
34
+ INSTRUCTIONS:
35
+ 1. Read the plan from disk
36
+ 2. Read CLAUDE.md and relevant patterns
37
+ 3. Review ALL files changed in this session: git diff origin/main --name-only
38
+ 4. Run the analysis categories below
39
+ 5. For each gap/enhancement found: FIX IT immediately
40
+ 6. Report GAPS_DISCOVERED as total found (even if fixed)
41
+
42
+ ANALYSIS CATEGORIES:
43
+
44
+ A. FUNCTIONAL GAPS
45
+ - Missing error handling (try/catch, error boundaries, toast notifications)
46
+ - Missing loading states (Skeleton, Spinner, disabled buttons during submit)
47
+ - Missing empty states ('No items found' messaging)
48
+ - Missing null guards on nullable fields
49
+ - Missing form validation (required fields, format validation)
50
+ - Incomplete CRUD (create exists but no edit/delete, or vice versa)
51
+
52
+ B. UX GAPS
53
+ - Missing success feedback after mutations (toast.success)
54
+ - Missing confirmation for destructive actions (AlertDialog)
55
+ - Missing keyboard navigation (tabIndex, onKeyDown for Enter)
56
+ - Missing responsive behavior (sm:/md:/lg: breakpoints)
57
+ - Inconsistent spacing (page-container class, gap values)
58
+ - Missing breadcrumbs or navigation context
59
+ - VR-VISUAL weighted score < 3.0 on affected routes
60
+
61
+ C. DATA INTEGRITY GAPS
62
+ - Optimistic updates without rollback
63
+ - Missing query invalidation after mutations
64
+ - Stale data after navigation (missing refetch)
65
+ - Missing pagination for large datasets
66
+ - Unhandled BigInt/Decimal serialization
67
+
68
+ D. SECURITY GAPS
69
+ - Missing protectedProcedure on mutations
70
+ - Missing input validation on router inputs
71
+ - Missing RLS policies on new tables
72
+ - Exposed sensitive data in client responses
73
+
74
+ E. PATTERN COMPLIANCE
75
+ - Run ./scripts/pattern-scanner.sh on changed files
76
+ - Check for pattern violations
77
+ - Check for hardcoded colors (should use design tokens)
78
+
79
+ F. ENHANCEMENT OPPORTUNITIES
80
+ - Type safety improvements (replace 'any' with proper types)
81
+ - Code deduplication (extract shared logic)
82
+ - Performance (unnecessary re-renders, missing useMemo/useCallback)
83
+ - Accessibility (aria-labels, alt text, focus management)
84
+
85
+ G. E2E WIRING GAPS
86
+ - For each data flow in changed files, verify VR-ROUNDTRIP:
87
+ WRITE: mutation/action reachable from UI or cron
88
+ STORE: data persists in a real table
89
+ READ: query reads from that same table
90
+ DISPLAY: component renders the query data (or cron logs output)
91
+ - Background-only features (crons, webhooks): WRITE->STORE->READ sufficient
92
+ - Query-only features (read views): READ->DISPLAY sufficient
93
+
94
+ H. SPRINT CONTRACT COMPLIANCE (if contracts exist from Phase 2A.5)
95
+ - Read the sprint contracts from the Phase 2A tracking table
96
+ - For EACH plan item with a sprint contract:
97
+ 1. List all acceptance criteria from the contract
98
+ 2. Verify EACH criterion with specific evidence (grep, screenshot, DOM state, network response)
99
+ 3. Any unmet criterion = GAP (P1 severity minimum)
100
+ - Contract criteria are IN ADDITION TO categories A-G — both must pass
101
+ - Skip condition: items marked `Contract: N/A` in the tracking table
102
+ - If no sprint contracts were negotiated (Phase 2A.5 skipped), skip this category
103
+
104
+ FOR EACH FINDING:
105
+ 1. Classify: GAP (must fix) or ENHANCEMENT (should fix)
106
+ 2. Severity: P0 (broken) / P1 (incorrect) / P2 (polish)
107
+ 3. Fix it immediately
108
+ 4. Verify the fix
109
+
110
+ RETURN STRUCTURED RESULT:
111
+ ```
112
+ GAPS_DISCOVERED: [N]
113
+ ENHANCEMENTS_APPLIED: [N]
114
+ ITEMS_FIXED: [N]
115
+
116
+ | # | Type | Severity | Description | File | Fixed |
117
+ |---|------|----------|-------------|------|-------|
118
+ | 1 | GAP | P0 | Missing error boundary | src/app/.../page.tsx | YES |
119
+ ```
120
+ ")
121
+
122
+ gaps = parse GAPS_DISCOVERED from result
123
+
124
+ IF gaps == 0:
125
+ Output: "Gap analysis clean in iteration {iteration} — zero gaps found"
126
+ BREAK
127
+ ELSE:
128
+ Output: "Iteration {iteration}: {gaps} gaps found and fixed, re-analyzing..."
129
+ CONTINUE
130
+
131
+ IF iteration == MAX_ITERATIONS AND gaps > 0:
132
+ Output: "WARNING: Gap analyzer did not converge after {MAX_ITERATIONS} iterations. {gaps} gaps remain."
133
+ ```
134
+
135
+ ---
136
+
137
+ ## RULES
138
+
139
+ | Rule | Meaning |
140
+ |------|---------|
141
+ | **Fix during analysis** | The analyzer fixes gaps as it finds them, not just reports |
142
+ | **Full re-pass required** | After fixes, a fresh pass must find ZERO to exit |
143
+ | **P0 gaps block** | Any P0 gap that can't be fixed stops the golden path |
144
+ | **Enhancements are mandatory** | Enhancements found MUST be applied (this is golden path, not quick fix) |
145
+ | **Pattern scanner gates** | `./scripts/pattern-scanner.sh` must exit 0 after each iteration |
146
+ | **No new files without reason** | Don't create helper files that aren't needed |
147
+
148
+ ---
149
+
150
+ ## WHEN TO SKIP
151
+
152
+ This phase can be skipped ONLY if:
153
+ - The implementation was documentation-only (no source files changed)
154
+ - User explicitly says "skip gap analysis"
155
+
156
+ Otherwise, it runs automatically as part of the golden path.
@@ -0,0 +1,40 @@
1
+ # Phase 3: Simplification
2
+
3
+ > Reference doc for `/massu-golden-path`. Return to main file for overview.
4
+
5
+ ```
6
+ [GOLDEN PATH -- PHASE 3: SIMPLIFICATION]
7
+ ```
8
+
9
+ ## 3.1 Fast Gate
10
+
11
+ ```bash
12
+ ./scripts/pattern-scanner.sh # Fix ALL violations before semantic analysis
13
+ ```
14
+
15
+ ## 3.1.5 Dead Code Detection
16
+
17
+ ```bash
18
+ npx knip --no-exit-code --reporter compact 2>/dev/null | head -50
19
+ # OR use /massu-dead-code for full analysis
20
+ ```
21
+
22
+ Review output for unused exports, files, and dependencies. Remove dead code before semantic review. Skip if knip is not installed (advisory gate, not blocking).
23
+
24
+ ## 3.2 Parallel Semantic Review (3 Agents)
25
+
26
+ Spawn IN PARALLEL (Principle #20 -- one task per agent):
27
+
28
+ **Efficiency Reviewer** (haiku): Query inefficiency (findMany.length -> SQL COUNT, N+1, unbounded queries), React inefficiency (useState for derived, useEffect->setState, missing useMemo/useCallback), algorithmic inefficiency (O(n^2), repeated sort/filter).
29
+
30
+ **Reuse Reviewer** (haiku): Known utilities (formatFileSize, serializeUnifiedProduct, mergeWhereWithTenant, emptyToNull, PhoneInputField, sanitizeContentHtml), component duplication against src/components/shared/ and ui/, pattern duplication across new files.
31
+
32
+ **Pattern Compliance Reviewer** (haiku): React Query v5 (no onSuccess in useQuery), DB patterns (Object.assign->mergeWhereWithTenant, include:->3-step, BigInt Number()), UI patterns (Select value="", missing states, Suspense), security (z.string()->z.enum() for orderBy, CR-5 precedence, CRON_SECRET guard), architecture (link table scoping, SQL aggregates, client/server boundary).
33
+
34
+ ## 3.3 Apply ALL Findings
35
+
36
+ Sort by SEVERITY (CRITICAL -> LOW). Fix ALL (CR-9). Re-run pattern scanner.
37
+
38
+ ```
39
+ SIMPLIFY_GATE: PASS (N findings, N fixed, 0 remaining)
40
+ ```
@@ -0,0 +1,94 @@
1
+ # Phase 4: Pre-Commit Verification
2
+
3
+ > Reference doc for `/massu-golden-path`. Return to main file for overview.
4
+
5
+ ```
6
+ [GOLDEN PATH -- PHASE 4: PRE-COMMIT VERIFICATION]
7
+ ```
8
+
9
+ ## 4.1 Auto-Verification Gates (ALL must pass in SINGLE run)
10
+
11
+ | Gate | Command | Expected |
12
+ |------|---------|----------|
13
+ | 1. Pattern Scanner | `./scripts/pattern-scanner.sh` | Exit 0 |
14
+ | 2. Type Safety (VR-TYPE) | `NODE_OPTIONS="--max-old-space-size=8192" npx tsc --noEmit` | 0 errors |
15
+ | 3. Build (VR-BUILD) | `npm run build` | Exit 0 |
16
+ | 4. Lint | `npm run lint` | Exit 0 |
17
+ | 5. Prisma Validate | `npx prisma validate` | Exit 0 |
18
+ | 6. Secrets Staged | `git diff --cached --name-only \| grep -E '\.(env\|pem\|key\|secret)'` | 0 files |
19
+ | 7. Credentials in Code | `grep -rn "sk-\|password.*=.*['\"]" --include="*.ts" --include="*.tsx" src/ \| grep -v "process.env" \| wc -l` | 0 |
20
+ | 8. Schema Mismatch | Extract tables from staged routers -> query columns via MCP | All exist |
21
+ | 9. VR-RENDER | For EACH staged component: `grep "<ComponentName" src/app/**/page.tsx` | Match found |
22
+ | 9.5. VR-COLOR | `git diff --cached \| grep "text-red-\|bg-green-\|..."` | 0 matches |
23
+ | 9.6. VR-COUPLING | `massu_coupling_check` or `./scripts/check-coupling.sh` | Exit 0 |
24
+ | 10. Plan Coverage | Verify ALL plan items with VR-* proof | 100% |
25
+ | 11. VR-PLAN-STATUS | `grep "IMPLEMENTATION STATUS" [plan]` | Match |
26
+ | 12. Dependency Security | `npm audit --audit-level=high` | 0 high/crit |
27
+ | 13. Test Coverage | Check test files exist for new code | WARN level |
28
+ | 14. VR-VISUAL | `bash scripts/ui-review.sh [route]` (if UI files changed) | VR_VISUAL_STATUS: PASS |
29
+
30
+ For each modified file: `massu_validate_file`, `massu_security_score`, `massu_security_heatmap`. If any file scores > 7/10 risk, flag for review.
31
+
32
+ Spawn `massu-pattern-reviewer` agent for deep CR rule checks, import chain validation, semantic pattern matching.
33
+
34
+ ## 4.2 Database Verification (All Environments)
35
+
36
+ For EACH affected table, query all configured environments via MCP:
37
+
38
+ | Env | MCP Prefix | Verify |
39
+ |-----|-----------|--------|
40
+ | DEV | `mcp__supabase__DEV__execute_sql` | Table, columns, RLS, grants |
41
+ | PROD | `mcp__supabase__PROD__execute_sql` | Table, columns, RLS, grants |
42
+
43
+ VR-DATA: If config-driven features, query actual config values and compare to code expectations.
44
+
45
+ ## 4.3 Help Site Auto-Sync
46
+
47
+ 1. Get staged files -> pass to `massu_docs_audit`
48
+ 2. For STALE/NEW pages: update MDX, set `lastVerified`, add changelog
49
+ 3. Commit to help site repo (separate git)
50
+ 4. Return to main app repo
51
+
52
+ ## 4.4 Quality Scoring Gate
53
+
54
+ Spawn `massu-output-scorer` (sonnet): Code Clarity, Pattern Compliance, Error Handling, UX Quality, Test Coverage (1-5 each). All >= 3: PASS. Any < 3: FAIL.
55
+
56
+ ## 4.5 If ANY Gate Fails
57
+
58
+ **DO NOT PAUSE** -- Fix automatically, re-run ALL gates, repeat until all pass.
59
+
60
+ ## 4.6 Auto-Learning Protocol
61
+
62
+ - For each bug fixed: `massu_memory_ingest` type="bugfix", update MEMORY.md
63
+ - For new patterns: `massu_memory_ingest` type="pattern"
64
+ - Add detection to `scripts/pattern-scanner.sh` if grep-able
65
+ - Codebase-wide search: no other instances of same bad pattern (CR-9)
66
+ - Record user corrections to `memory/corrections.md`
67
+
68
+ ---
69
+
70
+ ## Phase 4 Complete -> APPROVAL POINT #3: COMMIT
71
+
72
+ See `approval-points.md` for the exact format.
73
+
74
+ ### Commit Format
75
+
76
+ ```bash
77
+ git commit -m "$(cat <<'EOF'
78
+ [type]: [description]
79
+
80
+ [Body]
81
+
82
+ Changes:
83
+ - [Change 1]
84
+ - [Change 2]
85
+
86
+ Verified:
87
+ - Pattern scanner: PASS | Type check: 0 errors | Build: PASS
88
+ - DB: All environments verified
89
+ - Help site: UP TO DATE
90
+
91
+ Co-Authored-By: Claude <noreply@anthropic.com>
92
+ EOF
93
+ )"
94
+ ```
@@ -0,0 +1,116 @@
1
+ # Phase 5: Push Verification & Push
2
+
3
+ > Reference doc for `/massu-golden-path`. Return to main file for overview.
4
+
5
+ ```
6
+ [GOLDEN PATH -- PHASE 5: PUSH VERIFICATION]
7
+ ```
8
+
9
+ ## 5.1 Pre-Flight
10
+
11
+ ```bash
12
+ git log origin/main..HEAD --oneline # Commits to push
13
+ ```
14
+
15
+ ## 5.2 Tier 1: Quick Re-Verification
16
+
17
+ Run in parallel where possible:
18
+
19
+ | Check | Command |
20
+ |-------|---------|
21
+ | Pattern Scanner | `./scripts/pattern-scanner.sh` |
22
+ | VR-COUPLING | `./scripts/check-coupling.sh` |
23
+ | VR-UX | `./scripts/check-ux-quality.sh` |
24
+ | TypeScript | `NODE_OPTIONS="--max-old-space-size=8192" npx tsc --noEmit` |
25
+ | Build | `npm run build` |
26
+ | Prisma | `npx prisma validate` |
27
+ | Schema Mismatch | `./scripts/check-schema-mismatches.sh` |
28
+
29
+ ## 5.3 Tier 2: Test Suite (CRITICAL)
30
+
31
+ ### 5.3.0 Regression Detection (MANDATORY FIRST)
32
+
33
+ ```bash
34
+ # Establish baseline on main
35
+ git stash && git checkout main -q
36
+ npm run test:run 2>&1 | tee /tmp/baseline-tests.txt
37
+ git checkout - -q && git stash pop -q
38
+
39
+ # Run on current branch
40
+ npm run test:run 2>&1 | tee /tmp/current-tests.txt
41
+
42
+ # Compare: any test passing on main but failing now = REGRESSION
43
+ # Regressions MUST be fixed before push
44
+ ```
45
+
46
+ ### 5.3.1-5.3.5 Test Execution
47
+
48
+ Use **parallel Task agents** for independent checks:
49
+
50
+ ```
51
+ Agent Group A (parallel):
52
+ - Agent 1: npm run test:run (unit tests)
53
+ - Agent 2: npm audit --audit-level=high
54
+ - Agent 3: npx tsx scripts/detect-secrets.ts
55
+
56
+ Agent Group B (parallel, after A):
57
+ - Agent 1: npm run test:e2e (E2E tests)
58
+ - Agent 2: npm run test:visual:run (visual regression)
59
+
60
+ Sequential:
61
+ - ./scripts/validate-router-contracts.sh
62
+ - VR-RENDER: verify ALL new components rendered in pages
63
+ ```
64
+
65
+ ## 5.4 Tier 3: Security & Compliance
66
+
67
+ | Check | Command |
68
+ |-------|---------|
69
+ | npm audit | `npm audit --audit-level=high` |
70
+ | Secrets scan | `npx tsx scripts/detect-secrets.ts` |
71
+ | Accessibility | `./scripts/verify-accessibility.sh` |
72
+ | DB sync | Verify schema match across all environments |
73
+
74
+ ### VR-STORED-PROC (If migrations in push)
75
+
76
+ ```sql
77
+ SELECT proname, prosrc FROM pg_proc
78
+ JOIN pg_namespace n ON n.oid = pronamespace
79
+ WHERE n.nspname = 'public' AND prosrc LIKE '%old_table_name%';
80
+ -- Run on all environments. Expected: 0 rows.
81
+ ```
82
+
83
+ ### VR-RLS-AUDIT (CR-33)
84
+
85
+ ```sql
86
+ SELECT c.relname FROM pg_class c
87
+ JOIN pg_namespace n ON c.relnamespace = n.oid
88
+ WHERE n.nspname = 'public' AND c.relkind = 'r' AND c.relrowsecurity = false;
89
+ -- Run on all environments. Expected: 0 rows.
90
+ ```
91
+
92
+ ### VR-DATA (Config-Code Alignment)
93
+
94
+ If push includes config-driven features, verify config keys match code expectations.
95
+
96
+ ### Compliance Audit Trail
97
+
98
+ Generate: `massu_audit_log`, `massu_audit_report`, `massu_validation_report`.
99
+
100
+ ## 5.5 Tier 4: Final Gate
101
+
102
+ All tiers must pass:
103
+
104
+ | Tier | Status |
105
+ |------|--------|
106
+ | Tier 1: Quick Checks | PASS/FAIL |
107
+ | Tier 2: Test Suite + Regression | PASS/FAIL |
108
+ | Tier 3: Security & Compliance | PASS/FAIL |
109
+
110
+ ---
111
+
112
+ ## Phase 5 Gate -> APPROVAL POINT #4: PUSH
113
+
114
+ See `approval-points.md` for the exact format.
115
+
116
+ After approval: `git push origin [branch]`, then monitor CI with `./scripts/ci-status.sh --wait --max-wait 300`. If CI fails, auto-run `/massu-ci-fix` protocol.
@@ -0,0 +1,170 @@
1
+ # Phase 5.5: Production Verification
2
+
3
+ > Reference doc for `/massu-golden-path`. Return to main file for overview.
4
+
5
+ ```
6
+ [GOLDEN PATH -- PHASE 5.5: PRODUCTION VERIFICATION]
7
+ ```
8
+
9
+ **Core Principle**: A feature is NOT complete until it is verified working in production with real data. "Deployed" and "working" are two completely different things.
10
+
11
+ ---
12
+
13
+ ## 5.5.1 Wait for Deployment
14
+
15
+ After push and CI success, verify the deployment landed:
16
+
17
+ ```bash
18
+ # Check Vercel deployment status via MCP
19
+ # list_deployments — confirm latest is READY state
20
+ # get_runtime_logs — check for startup errors
21
+ ```
22
+
23
+ If deployment failed or errored: diagnose, fix, and re-push (loop back to Phase 5).
24
+
25
+ ---
26
+
27
+ ## 5.5.2 Auto-Detect Changed Routes
28
+
29
+ Before categorizing, auto-detect which production routes were affected:
30
+
31
+ ```bash
32
+ # Extract changed app routes from git diff
33
+ git diff origin/main --name-only -- 'src/app/' | grep -E 'page\.tsx|route\.ts' | \
34
+ sed 's|src/app/||; s|/page\.tsx||; s|/route\.ts||; s|\[([^]]*)\]|:$1|g'
35
+
36
+ # Extract changed routers (for API verification)
37
+ git diff origin/main --name-only -- 'src/server/api/routers/' | \
38
+ sed 's|src/server/api/routers/||; s|\.ts||'
39
+
40
+ # Extract changed cron jobs
41
+ git diff origin/main --name-only -- 'src/app/api/cron/'
42
+ ```
43
+
44
+ Each detected route becomes a verification target. UI routes get Playwright checks, API routers get data-flow checks, crons get deferred verification entries.
45
+
46
+ ---
47
+
48
+ ## 5.5.3 Categorize Verifications
49
+
50
+ Review ALL plan items and changed files. Categorize each into:
51
+
52
+ | Category | Timing | Examples |
53
+ |----------|--------|---------|
54
+ | **Immediate** | Verify now | UI pages, API endpoints, DB schema+data, feature flags, env vars |
55
+ | **Deferred** | Verify later | Cron jobs (wait for cycle), webhooks (wait for trigger), external API syncs, email delivery |
56
+
57
+ Build a verification matrix:
58
+
59
+ ```markdown
60
+ | # | Feature/Change | Category | Method | Expected Result | Status |
61
+ |---|----------------|----------|--------|-----------------|--------|
62
+ | PV-001 | [desc] | Immediate | Playwright | Page loads, data visible | PENDING |
63
+ | PV-002 | [desc] | Immediate | DB query (PROD) | Row count > 0 | PENDING |
64
+ | DV-001 | [desc] | Deferred | DB query after cron | New rows after deploy | PENDING |
65
+ ```
66
+
67
+ ---
68
+
69
+ ## 5.5.4 Run Immediate Verifications
70
+
71
+ For each immediate item, verify with proof:
72
+
73
+ ### UI Changes
74
+ Use Playwright MCP against production URL:
75
+ 1. `browser_navigate` to production page
76
+ 2. `browser_snapshot` — verify renders correctly
77
+ 3. `browser_console_messages` — check for JS errors
78
+ 4. `browser_click` / `browser_fill_form` — test interactions
79
+ 5. Verify data displays (not empty, not placeholder, not "undefined")
80
+
81
+ ### API/tRPC Changes
82
+ - Hit production endpoints or navigate to pages that use them
83
+ - Verify data loads and mutations work
84
+
85
+ ### Database Changes
86
+ Query PROD (`mcp__supabase__PROD__execute_sql`):
87
+ ```sql
88
+ -- Verify data flows, not just schema
89
+ SELECT COUNT(*), MAX(created_at) FROM [table]
90
+ WHERE created_at > '[deploy_timestamp]';
91
+ ```
92
+
93
+ ### Feature Flags / Config
94
+ ```sql
95
+ -- Verify flags are set correctly
96
+ SELECT key, enabled FROM feature_flags WHERE key IN ('[flags]');
97
+ ```
98
+
99
+ ### Integration Chains
100
+ Trace the full chain: trigger -> process -> store -> display
101
+
102
+ ```markdown
103
+ | Step | System | Verification | Status |
104
+ |------|--------|-------------|--------|
105
+ | Trigger | [source] | [how verified] | PASS/FAIL |
106
+ | Process | [handler] | [how verified] | PASS/FAIL |
107
+ | Store | [database] | [query result] | PASS/FAIL |
108
+ | Display | [UI page] | [screenshot] | PASS/FAIL |
109
+ ```
110
+
111
+ ---
112
+
113
+ ## 5.5.5 Generate Deferred Checklist
114
+
115
+ For items that can't be verified immediately, write to `session-state/deferred-verifications.md`:
116
+
117
+ ```markdown
118
+ # Deferred Production Verifications
119
+
120
+ **Generated**: [YYYY-MM-DD HH:MM PST]
121
+ **Deploy Commit**: [hash]
122
+ **Feature**: [name]
123
+
124
+ ## Pending
125
+
126
+ ### DV-001: [Description]
127
+ - **Type**: Cron / Webhook / External API / Background Job
128
+ - **Expected By**: [YYYY-MM-DD HH:MM PST]
129
+ - **Query**:
130
+ ```sql
131
+ SELECT COUNT(*) FROM [table] WHERE [condition] AND created_at > '[deploy_time]';
132
+ ```
133
+ - **Expected Result**: [specific condition]
134
+ - **Status**: PENDING
135
+ ```
136
+
137
+ These are surfaced by `/massu-bearings` in the next session and verified by `/massu-production-verify --deferred`.
138
+
139
+ ---
140
+
141
+ ## 5.5.6 Phase 5.5 Gate
142
+
143
+ | Condition | Result |
144
+ |-----------|--------|
145
+ | All immediate verifications PASS, no deferred items | **PRODUCTION VERIFIED** — proceed to Phase 6 |
146
+ | All immediate verifications PASS, deferred items exist | **VERIFIED + DEFERRED** — proceed to Phase 6, deferred items tracked |
147
+ | Any immediate verification FAILS | **BLOCKED** — diagnose, fix, re-push, re-verify |
148
+
149
+ **If BLOCKED**: Loop back. Fix the issue, commit, push (Phase 5 again), then re-run Phase 5.5.
150
+
151
+ ---
152
+
153
+ ## 5.5.7 Report Format
154
+
155
+ ```
156
+ PHASE 5.5: PRODUCTION VERIFICATION
157
+ --------------------------------------------------------------------------
158
+ Deploy: [hash] — READY on Vercel
159
+ Production URL: [url]
160
+
161
+ Immediate Verifications: [X]/[Y] PASSED
162
+ PV-001: [feature] — PASS (proof: [detail])
163
+ PV-002: [feature] — PASS (proof: [detail])
164
+
165
+ Deferred Verifications: [N] pending
166
+ DV-001: [feature] — check after [time] (saved to deferred-verifications.md)
167
+
168
+ Status: VERIFIED / VERIFIED + DEFERRED / BLOCKED
169
+ --------------------------------------------------------------------------
170
+ ```
@@ -0,0 +1,113 @@
1
+ # Phase 6: Completion
2
+
3
+ > Reference doc for `/massu-golden-path`. Return to main file for overview.
4
+
5
+ ## 6.1 Final Report
6
+
7
+ ```
8
+ ===============================================================================
9
+ GOLDEN PATH COMPLETE
10
+ ===============================================================================
11
+
12
+ SUMMARY:
13
+ --------------------------------------------------------------------------
14
+ Phase 0: Requirements & Context D1-D10 resolved
15
+ Phase 1: Plan Creation & Audit [N] items, [M] audit passes
16
+ Phase 2: Implementation [N] audit loops, 3 reviewers passed
17
+ Phase 2A.5: Sprint Contracts [N] contracts negotiated, [M] criteria total
18
+ Phase 2C.2: QA Evaluator [N] sprints evaluated, [M] bugs caught / SKIPPED (no UI)
19
+ Phase 2G: Browser Verification [N] pages tested, [M] issues fixed / SKIPPED
20
+ Phase 2.5: Gap & Enhancement [N] iterations, [M] gaps fixed, [K] enhancements
21
+ Phase 3: Simplification [N] findings fixed
22
+ Phase 4: Pre-Commit Verification 13 gates passed
23
+ Phase 5: Push Verification 3 tiers passed, 0 regressions
24
+ Phase 5.5: Production Verification [N]/[M] immediate PASS, [K] deferred pending
25
+ --------------------------------------------------------------------------
26
+
27
+ DELIVERABLES:
28
+ Plan: [plan path]
29
+ Commit: [hash]
30
+ Branch: [branch]
31
+ Pushed: YES
32
+ Production: [VERIFIED / VERIFIED + DEFERRED / BLOCKED]
33
+ Files changed: [N]
34
+
35
+ ===============================================================================
36
+ ```
37
+
38
+ ## 6.2 Plan Document Update (MANDATORY)
39
+
40
+ Add to TOP of plan document:
41
+
42
+ ```markdown
43
+ # IMPLEMENTATION STATUS
44
+
45
+ **Plan**: [Name]
46
+ **Status**: COMPLETE -- PRODUCTION VERIFIED / COMPLETE -- PENDING DEFERRED VERIFICATION
47
+ **Last Updated**: [YYYY-MM-DD HH:MM]
48
+ **Push Commit**: [hash]
49
+ **Production Verified**: [YYYY-MM-DD HH:MM] / PENDING (deferred items in session-state/deferred-verifications.md)
50
+ **Completed By**: Claude Code (Massu Golden Path)
51
+
52
+ ## Task Completion Summary
53
+ | # | Task/Phase | Status | Verification | Date |
54
+ |---|------------|--------|--------------|------|
55
+ | 1 | [description] | 100% COMPLETE | VR-BUILD: Pass | [date] |
56
+ ```
57
+
58
+ ## 6.2.1 Sprint Contract Results (if Phase 2A.5 was executed)
59
+
60
+ Add after Task Completion Summary:
61
+
62
+ ```markdown
63
+ ## Sprint Contract Results
64
+ | Item | Criteria Count | Met | Unmet | Renegotiated | Final Status |
65
+ |------|---------------|-----|-------|--------------|--------------|
66
+ | P-XXX | N | N | 0 | 0 | FULFILLED |
67
+
68
+ **Contracts Fulfilled**: N/N (100%)
69
+ **Criteria Met**: N/N total acceptance criteria
70
+ **Renegotiations**: N (with reasons documented in tracking table)
71
+ ```
72
+
73
+ Skip this section if no sprint contracts were negotiated (Phase 2A.5 skipped).
74
+
75
+ ## 6.2.2 QA Evaluator Summary (if Phase 2C.2 was executed)
76
+
77
+ Add after Sprint Contract Results:
78
+
79
+ ```markdown
80
+ ## QA Evaluator Summary
81
+ | Sprint | Product Depth | Functionality | Visual Design | Code Quality | Bugs Found | Verdict |
82
+ |--------|--------------|---------------|---------------|-------------|------------|---------|
83
+ | 1 | 4 | 3 | 4 | 4 | 2 | PASS |
84
+
85
+ **Sprints Evaluated**: N
86
+ **Total Bugs Caught by QA**: N (N fixed before merge)
87
+ **Average Scores**: PD=X.X FN=X.X VD=X.X CQ=X.X
88
+ **QA Gate Failures**: N (required re-implementation)
89
+ ```
90
+
91
+ Skip this section if the plan had no UI files (QA evaluator not triggered).
92
+
93
+ ## 6.3 Auto-Learning Protocol (MANDATORY)
94
+
95
+ 1. Review ALL fixes: `git diff origin/main..HEAD`
96
+ 2. For each fix: verify ingested into limn memory (`massu_memory_ingest`)
97
+ 3. For each fix: verify MEMORY.md updated
98
+ 4. For each new pattern: verify recorded
99
+ 5. For each failed approach: verify recorded as `failed_attempt`
100
+ 6. Record user corrections to `memory/corrections.md`
101
+ 7. Consider new CR rule if a class of bug was found
102
+
103
+ ## 6.4 Quality & Observability Report
104
+
105
+ Generate: `massu_quality_score`, `massu_quality_trend`, `massu_quality_report`, `massu_prompt_effectiveness`, `massu_session_stats`, `massu_prompt_analysis`, `massu_tool_patterns`.
106
+
107
+ ## 6.5 Feature Registration (CR-32)
108
+
109
+ Call `massu_sentinel_register` with feature name, file list, domain, test status.
110
+
111
+ ## 6.6 Update Session State
112
+
113
+ Update `session-state/CURRENT.md` with completion status.