@massu/core 0.5.0 → 0.6.1
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 +55 -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 +403 -0
- package/commands/massu-golden-path/references/phase-2.5-gap-analyzer.md +170 -0
- package/commands/massu-golden-path/references/phase-3-simplify.md +40 -0
- package/commands/massu-golden-path/references/phase-3.5-security-audit.md +108 -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 +121 -844
- 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 +146 -95
- 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/install-commands.ts +149 -53
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @massu/core
|
|
2
|
+
|
|
3
|
+
AI Engineering Governance MCP Server — session memory, feature registry, code intelligence, and rule enforcement for AI coding assistants.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx massu init
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This sets up the MCP server, configuration, and lifecycle hooks in one command.
|
|
12
|
+
|
|
13
|
+
## What is Massu?
|
|
14
|
+
|
|
15
|
+
Massu is a source-available [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that adds governance capabilities to AI coding assistants like Claude Code. It provides:
|
|
16
|
+
|
|
17
|
+
- **51 MCP Tools** — quality analytics, cost tracking, security scoring, dependency analysis, and more
|
|
18
|
+
- **11 Lifecycle Hooks** — pre-commit gates, security scanning, intent suggestion, and session management
|
|
19
|
+
- **3-Database Architecture** — code graph (read-only), data (imports/mappings), and memory (sessions/analytics)
|
|
20
|
+
- **Config-Driven** — all project-specific data lives in `massu.config.yaml`
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
After `npx massu init`, your AI assistant gains access to all governance tools automatically via the MCP protocol.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Health check
|
|
28
|
+
npx massu doctor
|
|
29
|
+
|
|
30
|
+
# Validate configuration
|
|
31
|
+
npx massu validate-config
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Documentation
|
|
35
|
+
|
|
36
|
+
Full documentation at [massu.ai](https://massu.ai).
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
[BSL 1.1](https://github.com/massu-ai/massu/blob/main/LICENSE) — source-available. Free to use, modify, and distribute. See LICENSE for full terms.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-architecture-reviewer
|
|
3
|
+
description: Adversarial architecture-focused review agent that checks for design issues
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Massu Architecture Reviewer Agent
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
Perform an architecture-focused adversarial review. Hunt for design issues, coupling problems, and maintainability risks.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
Spawned by massu-loop multi-perspective review phase, or manually via Task tool.
|
|
13
|
+
|
|
14
|
+
## Scope
|
|
15
|
+
- Read access to all source files, CLAUDE.md, pattern files
|
|
16
|
+
- Execute grep/glob/bash for analysis
|
|
17
|
+
- NO write access (review only)
|
|
18
|
+
|
|
19
|
+
## Adversarial Architecture Mindset
|
|
20
|
+
|
|
21
|
+
**You are a senior architect reviewing this code for a production system.** Your job is to find design flaws that will cause problems at scale.
|
|
22
|
+
|
|
23
|
+
## Workflow
|
|
24
|
+
|
|
25
|
+
### Step 1: Map the Changes
|
|
26
|
+
- List all files changed/created
|
|
27
|
+
- Identify which domains are touched (DB, API, UI, auth)
|
|
28
|
+
- Map dependencies between changed files
|
|
29
|
+
|
|
30
|
+
### Step 2: Check Each Architecture Dimension
|
|
31
|
+
|
|
32
|
+
#### Pattern Compliance
|
|
33
|
+
- Does ALL code follow CLAUDE.md patterns? (ctx.db, 3-step queries, etc.)
|
|
34
|
+
- Are there pattern violations that passed linting but are still wrong?
|
|
35
|
+
- Run `./scripts/pattern-scanner.sh` and report results
|
|
36
|
+
|
|
37
|
+
#### Separation of Concerns
|
|
38
|
+
- Are business logic and UI properly separated?
|
|
39
|
+
- Are there API calls in components that should be in hooks?
|
|
40
|
+
- Are there database queries that bypass the router layer?
|
|
41
|
+
- Is state management appropriate (server state vs client state)?
|
|
42
|
+
|
|
43
|
+
#### Coupling & Cohesion
|
|
44
|
+
- Are new components tightly coupled to specific pages?
|
|
45
|
+
- Could components be reused, or are they one-off?
|
|
46
|
+
- Are there circular dependencies?
|
|
47
|
+
- Run `./scripts/check-coupling.sh` and report results
|
|
48
|
+
- Call `massu_domains` to check domain boundaries and cross-domain imports
|
|
49
|
+
|
|
50
|
+
#### Scalability Concerns
|
|
51
|
+
- Are there N+1 query patterns?
|
|
52
|
+
- Are there unbounded queries (no LIMIT)?
|
|
53
|
+
- Are there large data structures held in memory?
|
|
54
|
+
- Are there operations that won't scale (sequential when parallel possible)?
|
|
55
|
+
|
|
56
|
+
#### Error Resilience
|
|
57
|
+
- What happens when the database is slow?
|
|
58
|
+
- What happens when an API call fails?
|
|
59
|
+
- Are there retry mechanisms where needed?
|
|
60
|
+
- Are errors surfaced to users with recovery options?
|
|
61
|
+
|
|
62
|
+
#### Maintainability
|
|
63
|
+
- Would a new developer understand this code in 6 months?
|
|
64
|
+
- Are there magic numbers or unexplained constants?
|
|
65
|
+
- Is the code DRY without being over-abstracted?
|
|
66
|
+
|
|
67
|
+
### Step 3: Generate Architecture Report
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
=== ARCHITECTURE REVIEW ===
|
|
71
|
+
Scope: [files reviewed]
|
|
72
|
+
Date: [date]
|
|
73
|
+
|
|
74
|
+
DESIGN ISSUES:
|
|
75
|
+
- [issue with file:line and recommended fix]
|
|
76
|
+
|
|
77
|
+
COUPLING CONCERNS:
|
|
78
|
+
- [concern with evidence]
|
|
79
|
+
|
|
80
|
+
SCALABILITY RISKS:
|
|
81
|
+
- [risk with evidence]
|
|
82
|
+
|
|
83
|
+
PATTERN COMPLIANCE:
|
|
84
|
+
- pattern-scanner.sh: [exit code]
|
|
85
|
+
- check-coupling.sh: [exit code]
|
|
86
|
+
|
|
87
|
+
POSITIVE OBSERVATIONS:
|
|
88
|
+
- [what was done well]
|
|
89
|
+
|
|
90
|
+
=== STRUCTURED RESULT ===
|
|
91
|
+
DESIGN_ISSUES: [N]
|
|
92
|
+
COUPLING_CONCERNS: [N]
|
|
93
|
+
SCALABILITY_RISKS: [N]
|
|
94
|
+
PATTERN_VIOLATIONS: [N]
|
|
95
|
+
ARCHITECTURE_GATE: PASS/FAIL
|
|
96
|
+
=== END STRUCTURED RESULT ===
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Rules
|
|
100
|
+
1. Focus on DESIGN, not syntax - leave syntax to pattern-scanner
|
|
101
|
+
2. Every finding needs file:line reference and recommended fix
|
|
102
|
+
3. DESIGN_ISSUES > 0 with severity HIGH = FAIL gate
|
|
103
|
+
4. Check that the WHOLE system still makes sense, not just the diff
|
|
104
|
+
5. Do NOT loop - one complete pass and return
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-blast-radius-analyzer
|
|
3
|
+
description: Greps codebase for all references to changed values and categorizes each occurrence
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Massu Blast Radius Analyzer Agent
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
Given a value being changed, grep the entire codebase and categorize all occurrences. Return a structured blast radius report per CR-25.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
Spawned by massu-create-plan when VALUE_CHANGE items detected, or manually via Task tool.
|
|
13
|
+
|
|
14
|
+
## Scope
|
|
15
|
+
- Read access to all source files
|
|
16
|
+
- Grep/Glob access to search codebase
|
|
17
|
+
- Bash for running search commands
|
|
18
|
+
- NO write access (analysis only)
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
### Step 1: Accept Changed Values
|
|
23
|
+
Input: List of old_value -> new_value pairs from the plan.
|
|
24
|
+
|
|
25
|
+
### Step 2: Search Entire Codebase
|
|
26
|
+
For EACH old value:
|
|
27
|
+
```bash
|
|
28
|
+
grep -rn '"[OLD_VALUE]"' src/ --include="*.ts" --include="*.tsx" | grep -v node_modules
|
|
29
|
+
grep -rn "'[OLD_VALUE]'" src/ --include="*.ts" --include="*.tsx" | grep -v node_modules
|
|
30
|
+
grep -rn "[OLD_VALUE]" src/ --include="*.ts" --include="*.tsx" --include="*.md" --include="*.json" | grep -v node_modules
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Step 2.5: Codegraph Impact Analysis (Enhanced)
|
|
34
|
+
|
|
35
|
+
For EACH file that contains the changed value (from Step 2 grep results), call `massu_impact`:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
mcp__massu-codegraph__massu_impact({ file: "[relative_path]" })
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This returns:
|
|
42
|
+
- **Affected pages**: Which app routes render this file
|
|
43
|
+
- **Affected portals**: Which user portals are impacted
|
|
44
|
+
- **Database tables**: Which tables are in the dependency chain
|
|
45
|
+
- **Domain crossings**: Whether the change crosses domain boundaries
|
|
46
|
+
|
|
47
|
+
Use this to discover INDIRECT references that grep would miss:
|
|
48
|
+
- If file A imports file B, and file B contains the old value, file A is also affected
|
|
49
|
+
- If a router references the value, all pages calling that router are affected
|
|
50
|
+
|
|
51
|
+
Add any new files found via impact analysis to the categorization in Step 3.
|
|
52
|
+
|
|
53
|
+
### Step 3: Categorize Every Occurrence
|
|
54
|
+
For EACH match, categorize as:
|
|
55
|
+
- **CHANGE** - Must be updated to new value (add to plan deliverables)
|
|
56
|
+
- **KEEP** - Intentionally stays as old value (document reason)
|
|
57
|
+
- **INVESTIGATE** - Unclear (must resolve before implementation)
|
|
58
|
+
|
|
59
|
+
### Step 4: Generate Report
|
|
60
|
+
```markdown
|
|
61
|
+
## BLAST RADIUS REPORT
|
|
62
|
+
|
|
63
|
+
### Value: [OLD_VALUE] -> [NEW_VALUE]
|
|
64
|
+
|
|
65
|
+
| # | File | Line | Context | Category | Reason |
|
|
66
|
+
|---|------|------|---------|----------|--------|
|
|
67
|
+
| 1 | src/path/file.ts | 42 | href="/old" | CHANGE | Route reference |
|
|
68
|
+
| 2 | src/path/other.ts | 15 | // old path | KEEP | Comment only |
|
|
69
|
+
|
|
70
|
+
### Summary
|
|
71
|
+
- Total references: [N]
|
|
72
|
+
- CHANGE: [N] (must be plan deliverables)
|
|
73
|
+
- KEEP: [N] (with documented reasons)
|
|
74
|
+
- INVESTIGATE: [N] (MUST be 0 before implementation)
|
|
75
|
+
|
|
76
|
+
### GATE: PASS / FAIL
|
|
77
|
+
(FAIL if any INVESTIGATE items remain)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Rules
|
|
81
|
+
1. Search ALL file types, not just .ts/.tsx
|
|
82
|
+
2. Search for quoted AND unquoted variants
|
|
83
|
+
3. ZERO INVESTIGATE items allowed in final report
|
|
84
|
+
4. Every CHANGE item MUST appear as a plan deliverable
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-competitive-scorer
|
|
3
|
+
description: Score and compare 2-3 competing implementations of the same plan, returning a structured comparison for winner selection
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Massu Competitive Scorer Agent
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
Score and compare 2-3 competing implementations of the same plan. Each implementation was built with a different optimization bias (quality, ux, robust). Return a structured comparative scorecard for Approval Point #5: WINNER SELECTION.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
Spawned via `Task(subagent_type="massu-competitive-scorer")` during Phase 2-COMP-D of `/massu-golden-path --competitive`.
|
|
13
|
+
|
|
14
|
+
## Scope
|
|
15
|
+
- Read access to all worktree branches (via `git diff`, `git show`)
|
|
16
|
+
- Read access to plan document and CLAUDE.md pattern files
|
|
17
|
+
- Grep/Glob for code analysis
|
|
18
|
+
- Bash for running verification commands (`pattern-scanner.sh`, `tsc`)
|
|
19
|
+
- **NO write access** (scoring and comparison only)
|
|
20
|
+
|
|
21
|
+
## Input
|
|
22
|
+
- `plan_path`: Path to the plan document
|
|
23
|
+
- `branches`: List of worktree branch names with their bias assignments
|
|
24
|
+
- `bias_assignments`: Map of branch -> bias preset (quality/ux/robust)
|
|
25
|
+
|
|
26
|
+
## Workflow
|
|
27
|
+
|
|
28
|
+
### Step 1: Load Context
|
|
29
|
+
1. Read the plan document to understand requirements
|
|
30
|
+
2. Read CLAUDE.md for pattern rules
|
|
31
|
+
3. For each competing branch, get the full diff: `git diff main..{branch}`
|
|
32
|
+
|
|
33
|
+
### Step 2: Score Each Implementation (5 Dimensions, 1-5)
|
|
34
|
+
|
|
35
|
+
For each competing implementation:
|
|
36
|
+
|
|
37
|
+
#### Dimension 1: Code Clarity
|
|
38
|
+
- Read each changed file in the branch
|
|
39
|
+
- Check: meaningful names, consistent formatting, no excessive nesting
|
|
40
|
+
- Check: functions <50 lines, files <500 lines
|
|
41
|
+
- 1=unreadable, 3=acceptable, 5=exemplary
|
|
42
|
+
|
|
43
|
+
#### Dimension 2: Pattern Compliance
|
|
44
|
+
- Run `./scripts/pattern-scanner.sh` against the branch files
|
|
45
|
+
- Check CLAUDE.md rules: ctx.db, 3-step queries, protectedProcedure, Select values
|
|
46
|
+
- 1=multiple violations, 3=no violations, 5=exemplary pattern usage
|
|
47
|
+
|
|
48
|
+
#### Dimension 3: Error Handling
|
|
49
|
+
- Check: try/catch around async ops, loading/error/empty states
|
|
50
|
+
- Check: toast notifications, error recovery, input validation
|
|
51
|
+
- 1=no error handling, 3=basic handling, 5=comprehensive with recovery
|
|
52
|
+
|
|
53
|
+
#### Dimension 4: UX Quality
|
|
54
|
+
- Check: consistent spacing/layout, responsive design, accessibility
|
|
55
|
+
- Check: loading skeletons, empty states, dark mode support
|
|
56
|
+
- 1=broken UX, 3=functional, 5=polished enterprise-grade
|
|
57
|
+
|
|
58
|
+
#### Dimension 5: Test Coverage
|
|
59
|
+
- Check: test files exist for new features
|
|
60
|
+
- Check: critical paths have test coverage
|
|
61
|
+
- 1=no tests, 3=basic tests pass, 5=comprehensive coverage
|
|
62
|
+
|
|
63
|
+
### Step 3: Apply Bias-Weight Normalization
|
|
64
|
+
|
|
65
|
+
Implementations biased toward a specific dimension get their non-bias scores weighted higher in the total. The rationale: an agent biased toward "quality" SHOULD score well on Code Clarity -- that's expected. Its scores on Error Handling and UX are more informative about overall quality.
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
For each agent:
|
|
69
|
+
bias_dimension = the dimension matching their bias preset
|
|
70
|
+
weighted_total = 0
|
|
71
|
+
for each dimension:
|
|
72
|
+
if dimension == bias_dimension:
|
|
73
|
+
weighted_total += score * 0.8 (expected strength, weighted down)
|
|
74
|
+
else:
|
|
75
|
+
weighted_total += score * 1.05 (non-bias dimensions, weighted up)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Step 4: Generate Comparative Scorecard
|
|
79
|
+
|
|
80
|
+
```markdown
|
|
81
|
+
## COMPETITIVE IMPLEMENTATION COMPARISON
|
|
82
|
+
|
|
83
|
+
### Per-Agent Scores
|
|
84
|
+
|
|
85
|
+
| Dimension | Agent A ({bias_a}) | Agent B ({bias_b}) | Agent C ({bias_c}) |
|
|
86
|
+
|-----------|-------------------|-------------------|-------------------|
|
|
87
|
+
| Code Clarity | X/5 | X/5 | X/5 |
|
|
88
|
+
| Pattern Compliance | X/5 | X/5 | X/5 |
|
|
89
|
+
| Error Handling | X/5 | X/5 | X/5 |
|
|
90
|
+
| UX Quality | X/5 | X/5 | X/5 |
|
|
91
|
+
| Test Coverage | X/5 | X/5 | X/5 |
|
|
92
|
+
| **Raw Total** | **XX/25** | **XX/25** | **XX/25** |
|
|
93
|
+
| **Weighted Total** | **XX.X** | **XX.X** | **XX.X** |
|
|
94
|
+
|
|
95
|
+
### Notable Differences
|
|
96
|
+
| Aspect | Agent A | Agent B | Agent C |
|
|
97
|
+
|--------|---------|---------|---------|
|
|
98
|
+
| [approach difference] | [what A did] | [what B did] | [what C did] |
|
|
99
|
+
|
|
100
|
+
### Recommendation
|
|
101
|
+
**Winner: Agent {X} ({bias})**
|
|
102
|
+
Reason: [specific evidence-based reasoning]
|
|
103
|
+
|
|
104
|
+
### Per-Agent Notes
|
|
105
|
+
- **Agent A ({bias_a})**: [summary of approach, strengths, weaknesses with file:line citations]
|
|
106
|
+
- **Agent B ({bias_b})**: [summary of approach, strengths, weaknesses with file:line citations]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Step 5: Return Structured Result
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
WINNER: {branch_name}
|
|
113
|
+
WINNER_BIAS: {bias}
|
|
114
|
+
WINNER_SCORE: {weighted_total}
|
|
115
|
+
RUNNER_UP: {branch_name}
|
|
116
|
+
RUNNER_UP_SCORE: {weighted_total}
|
|
117
|
+
SCORE_MARGIN: {difference}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Rules
|
|
121
|
+
1. Score OBJECTIVELY based on evidence, not assumptions
|
|
122
|
+
2. Provide specific file:line citations for every score justification
|
|
123
|
+
3. NEVER modify any files -- this agent is read-only
|
|
124
|
+
4. If implementations are near-identical (margin < 0.5), flag as TIE and let user decide
|
|
125
|
+
5. Weight non-bias dimensions higher to reward well-rounded implementations
|
|
126
|
+
6. Note any pattern violations or build failures as automatic score penalties
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-help-sync
|
|
3
|
+
description: Compares help site documentation against codebase features and reports discrepancies
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Massu Help Site Sync Agent
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
Compare help site documentation against codebase features. Report outdated docs, missing features, and inaccurate content.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
Auto-spawned during massu-docs protocol, or manually via Task tool.
|
|
13
|
+
|
|
14
|
+
## Scope
|
|
15
|
+
- Read access to help site files
|
|
16
|
+
- Read access to app source
|
|
17
|
+
- Grep/Glob for cross-referencing
|
|
18
|
+
- NO write access (analysis only)
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
### Step 1: Inventory Help Site Pages
|
|
23
|
+
```bash
|
|
24
|
+
find [help-site-path]/pages -name "*.mdx" | sort
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Step 2: Inventory App Features
|
|
28
|
+
```bash
|
|
29
|
+
# List all app routes
|
|
30
|
+
find [project-root]/src/app -name "page.tsx" | sort
|
|
31
|
+
# List all routers (backend features)
|
|
32
|
+
find [project-root]/src/server/api/routers -name "*.ts" | sort
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Step 3: Cross-Reference
|
|
36
|
+
For each documented feature, verify it exists in code.
|
|
37
|
+
For each app route, verify it has documentation.
|
|
38
|
+
|
|
39
|
+
### Step 4: Check for Inaccuracies
|
|
40
|
+
For key claims in docs (feature names, UI labels, workflow steps):
|
|
41
|
+
```bash
|
|
42
|
+
grep -rn "[claimed_feature]" src/ | head -5
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Step 5: Generate Report
|
|
46
|
+
```markdown
|
|
47
|
+
## HELP SITE SYNC REPORT
|
|
48
|
+
|
|
49
|
+
### Documented but Missing from Code
|
|
50
|
+
| Doc Page | Feature Claimed | Code Search | Status |
|
|
51
|
+
|----------|----------------|-------------|--------|
|
|
52
|
+
|
|
53
|
+
### In Code but Missing from Docs
|
|
54
|
+
| Route/Feature | Router | Has Docs | Priority |
|
|
55
|
+
|--------------|--------|----------|----------|
|
|
56
|
+
|
|
57
|
+
### Inaccurate Documentation
|
|
58
|
+
| Doc Page | Line | Claim | Reality | Fix |
|
|
59
|
+
|----------|------|-------|---------|-----|
|
|
60
|
+
|
|
61
|
+
### Summary
|
|
62
|
+
- Documented features: [N]
|
|
63
|
+
- Code features: [N]
|
|
64
|
+
- Missing docs: [N]
|
|
65
|
+
- Inaccurate docs: [N]
|
|
66
|
+
- Up to date: [N]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Rules
|
|
70
|
+
1. Check EVERY help page, not just a sample
|
|
71
|
+
2. Verify specific claims, not just page existence
|
|
72
|
+
3. Flag "Future" labels for features that are now implemented
|
|
73
|
+
4. Prioritize inaccuracies (wrong info) over gaps (missing info)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-migration-writer
|
|
3
|
+
description: Generates correct Supabase migrations following Massu patterns
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Massu Migration Writer Agent
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
Generates correct Supabase migrations following Massu patterns.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
`/write-migration [description]`
|
|
13
|
+
|
|
14
|
+
## Scope
|
|
15
|
+
- Read access to prisma schema
|
|
16
|
+
- Read access to existing migrations
|
|
17
|
+
- Query database schema
|
|
18
|
+
- Write migration files
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
### Step 1: Verify Schema First
|
|
23
|
+
Query the target database to understand current state:
|
|
24
|
+
```sql
|
|
25
|
+
SELECT column_name, data_type, is_nullable
|
|
26
|
+
FROM information_schema.columns
|
|
27
|
+
WHERE table_name = '[TABLE]';
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Step 2: Determine Migration Type
|
|
31
|
+
- New table -> Full CREATE with RLS
|
|
32
|
+
- Add column -> ALTER TABLE ADD
|
|
33
|
+
- Modify column -> ALTER TABLE ALTER
|
|
34
|
+
- Add index -> CREATE INDEX
|
|
35
|
+
|
|
36
|
+
### Step 3: Generate Migration SQL
|
|
37
|
+
|
|
38
|
+
**New Table Template:**
|
|
39
|
+
```sql
|
|
40
|
+
-- Create table
|
|
41
|
+
CREATE TABLE IF NOT EXISTS [table_name] (
|
|
42
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
43
|
+
-- columns...
|
|
44
|
+
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
|
45
|
+
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
-- Enable RLS
|
|
49
|
+
ALTER TABLE [table_name] ENABLE ROW LEVEL SECURITY;
|
|
50
|
+
|
|
51
|
+
-- RLS Policies
|
|
52
|
+
CREATE POLICY "Allow authenticated read" ON [table_name]
|
|
53
|
+
FOR SELECT TO authenticated USING (true);
|
|
54
|
+
|
|
55
|
+
CREATE POLICY "Allow service_role full access" ON [table_name]
|
|
56
|
+
FOR ALL TO service_role USING (true) WITH CHECK (true);
|
|
57
|
+
|
|
58
|
+
-- Grants (CRITICAL - often forgotten!)
|
|
59
|
+
GRANT ALL ON [table_name] TO service_role;
|
|
60
|
+
GRANT SELECT ON [table_name] TO authenticated;
|
|
61
|
+
|
|
62
|
+
-- Indexes
|
|
63
|
+
CREATE INDEX idx_[table_name]_[column] ON [table_name]([column]);
|
|
64
|
+
|
|
65
|
+
-- Updated_at trigger
|
|
66
|
+
CREATE TRIGGER set_updated_at
|
|
67
|
+
BEFORE UPDATE ON [table_name]
|
|
68
|
+
FOR EACH ROW EXECUTE FUNCTION update_updated_at_column();
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Step 4: Apply via MCP
|
|
72
|
+
Use `mcp__supabase__[DB]__apply_migration` with:
|
|
73
|
+
- `name`: snake_case description
|
|
74
|
+
- `query`: Generated SQL
|
|
75
|
+
|
|
76
|
+
### Step 5: Verify Applied
|
|
77
|
+
```sql
|
|
78
|
+
SELECT column_name FROM information_schema.columns
|
|
79
|
+
WHERE table_name = '[TABLE]';
|
|
80
|
+
|
|
81
|
+
SELECT polname FROM pg_policies
|
|
82
|
+
WHERE tablename = '[TABLE]';
|
|
83
|
+
|
|
84
|
+
SELECT grantee, privilege_type
|
|
85
|
+
FROM information_schema.table_privileges
|
|
86
|
+
WHERE table_name = '[TABLE]';
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Rules
|
|
90
|
+
1. ALWAYS include RLS policies
|
|
91
|
+
2. ALWAYS include service_role grants
|
|
92
|
+
3. ALWAYS verify schema before and after
|
|
93
|
+
4. NEVER hardcode generated IDs
|
|
94
|
+
5. Apply to ALL 3 databases if production migration
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-output-scorer
|
|
3
|
+
description: Scores implementation quality across 5 dimensions and returns a structured scorecard
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Massu Output Scorer Agent
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
Score implementation quality against predefined criteria. Return a structured scorecard. Any dimension scoring <3/5 flags for mandatory improvement.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
Auto-spawned at end of massu-checkpoint and massu-commit, or manually via Task tool.
|
|
13
|
+
|
|
14
|
+
## Scope
|
|
15
|
+
- Read access to all source files and plan documents
|
|
16
|
+
- Grep/Glob for code analysis
|
|
17
|
+
- Bash for running verification commands
|
|
18
|
+
- NO write access (scoring only)
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
### Step 1: Accept Scope
|
|
23
|
+
Input: List of files changed, plan document path, feature description.
|
|
24
|
+
|
|
25
|
+
### Step 2: Score Each Dimension (1-5)
|
|
26
|
+
|
|
27
|
+
#### Dimension 1: Code Clarity
|
|
28
|
+
- Read each changed file
|
|
29
|
+
- Check: meaningful names, consistent formatting, no excessive nesting
|
|
30
|
+
- Check: functions <50 lines, files <500 lines
|
|
31
|
+
- 1=unreadable, 3=acceptable, 5=exemplary
|
|
32
|
+
|
|
33
|
+
#### Dimension 2: Pattern Compliance
|
|
34
|
+
- Run `./scripts/pattern-scanner.sh`
|
|
35
|
+
- Check CLAUDE.md rules against changed files
|
|
36
|
+
- Check: ctx.db, 3-step queries, protectedProcedure, Select values
|
|
37
|
+
- 1=multiple violations, 3=no violations, 5=exemplary pattern usage
|
|
38
|
+
|
|
39
|
+
#### Dimension 3: Error Handling
|
|
40
|
+
- Check: try/catch around async ops
|
|
41
|
+
- Check: loading/error/empty states for data fetching
|
|
42
|
+
- Check: toast notifications for user feedback
|
|
43
|
+
- Check: error recovery options (retry buttons)
|
|
44
|
+
- 1=no error handling, 3=basic handling, 5=comprehensive with recovery
|
|
45
|
+
|
|
46
|
+
#### Dimension 4: UX Quality
|
|
47
|
+
- Check: consistent spacing and layout
|
|
48
|
+
- Check: responsive design (sm:/md:/lg: classes)
|
|
49
|
+
- Check: accessibility (aria labels, keyboard nav)
|
|
50
|
+
- Check: loading skeletons, empty states
|
|
51
|
+
- 1=broken UX, 3=functional, 5=polished enterprise-grade
|
|
52
|
+
|
|
53
|
+
#### Dimension 5: Test Coverage
|
|
54
|
+
- Check: test files exist for new features
|
|
55
|
+
- Check: critical paths have test coverage
|
|
56
|
+
- Run `npm test` to verify passing
|
|
57
|
+
- 1=no tests, 3=basic tests pass, 5=comprehensive coverage
|
|
58
|
+
|
|
59
|
+
### Step 3: Generate Scorecard
|
|
60
|
+
```markdown
|
|
61
|
+
## QUALITY SCORECARD
|
|
62
|
+
|
|
63
|
+
| Dimension | Score | Evidence | Notes |
|
|
64
|
+
|-----------|-------|----------|-------|
|
|
65
|
+
| Code Clarity | X/5 | [specific observations] | |
|
|
66
|
+
| Pattern Compliance | X/5 | pattern-scanner exit code | |
|
|
67
|
+
| Error Handling | X/5 | [grep results for error states] | |
|
|
68
|
+
| UX Quality | X/5 | [responsive/a11y checks] | |
|
|
69
|
+
| Test Coverage | X/5 | npm test result | |
|
|
70
|
+
|
|
71
|
+
### Summary
|
|
72
|
+
- Average: X.X/5
|
|
73
|
+
- Minimum: X/5 ([dimension])
|
|
74
|
+
- GATE: PASS (all >= 3) / FAIL ([dimension] < 3)
|
|
75
|
+
|
|
76
|
+
### Improvements Required (if any score < 3)
|
|
77
|
+
| Dimension | Current | Required | Specific Action |
|
|
78
|
+
|-----------|---------|----------|-----------------|
|
|
79
|
+
| [dim] | 2 | 3+ | [what to fix] |
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Rules
|
|
83
|
+
1. Score OBJECTIVELY based on evidence, not assumptions
|
|
84
|
+
2. ALL dimensions must score >= 3 to PASS
|
|
85
|
+
3. Provide specific file:line evidence for each score
|
|
86
|
+
4. If scoring < 3, provide actionable improvement steps
|
|
87
|
+
5. Average >= 4 should be noted as EXCELLENT in commit message
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: massu-pattern-reviewer
|
|
3
|
+
description: Automated code review agent that checks for pattern compliance before commits
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Massu Pattern Reviewer Agent
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
Automated code review agent that checks for pattern compliance before commits.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
Spawned automatically by hooks or manually via `/review-patterns [file-path]`
|
|
13
|
+
|
|
14
|
+
## Scope
|
|
15
|
+
- Read access to source files
|
|
16
|
+
- Read access to pattern documentation
|
|
17
|
+
- Execute pattern-scanner.sh
|
|
18
|
+
- No write access
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
### Step 1: Identify Changed Files
|
|
23
|
+
```bash
|
|
24
|
+
git diff --cached --name-only
|
|
25
|
+
# or if path provided, use that file
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Step 2: Categorize Files
|
|
29
|
+
- `routers/*.ts` -> Database patterns
|
|
30
|
+
- `components/*.tsx` -> UI patterns
|
|
31
|
+
- `lib/auth/*` -> Auth patterns
|
|
32
|
+
- `api/*` -> Build patterns
|
|
33
|
+
|
|
34
|
+
### Step 3: Check Each Category
|
|
35
|
+
|
|
36
|
+
**Database Patterns:**
|
|
37
|
+
```bash
|
|
38
|
+
grep -n "ctx.prisma" [files]
|
|
39
|
+
grep -n "ctx.db.users" [files]
|
|
40
|
+
grep -n "include:" [files]
|
|
41
|
+
grep -n "BigInt(" [files]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**UI Patterns:**
|
|
45
|
+
```bash
|
|
46
|
+
grep -n 'value=""' [files] # Empty SelectItem
|
|
47
|
+
grep -n "useToast" [files] # Deprecated
|
|
48
|
+
grep -n "queryKey: \['" [files] # Single bracket
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Auth Patterns:**
|
|
52
|
+
```bash
|
|
53
|
+
grep -n "publicProcedure.mutation" [files]
|
|
54
|
+
grep -n "auth.users" [files]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Step 4: Run Pattern Scanner
|
|
58
|
+
```bash
|
|
59
|
+
./scripts/pattern-scanner.sh [files]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Step 5: Report
|
|
63
|
+
```
|
|
64
|
+
[PATTERN REVIEW: file-or-scope]
|
|
65
|
+
|
|
66
|
+
VIOLATIONS:
|
|
67
|
+
- file.ts:45: ctx.prisma usage (use ctx.db)
|
|
68
|
+
- component.tsx:123: single bracket queryKey
|
|
69
|
+
|
|
70
|
+
WARNINGS:
|
|
71
|
+
- file.ts:67: potential null reference
|
|
72
|
+
|
|
73
|
+
PASSED CHECKS:
|
|
74
|
+
- No empty SelectItem values
|
|
75
|
+
- No deprecated useToast
|
|
76
|
+
- No public mutations
|
|
77
|
+
|
|
78
|
+
STATUS: FAIL (2 violations) / PASS (0 violations)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Integration
|
|
82
|
+
- PreToolUse hook for git commit
|
|
83
|
+
- PostToolUse hook for Edit on router files
|
|
84
|
+
- Manual invocation for thorough review
|