@massu/core 1.13.0 → 1.14.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/CHANGELOG.md CHANGED
@@ -4,6 +4,48 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## [1.14.0] - 2026-06-02
8
+
9
+ **Curated Rule Packs — versioned, installable, actually-enforced (`plan-2026-06-01-curated-rule-packs`)**. Closes the inert-marketplace bug class: the rule-pack marketplace existed but enforced nothing — installing a pack flattened its rules into `org_rules`, which no core enforcement path ever read. Now an installed pack's rules materialize on the developer's machine as Ed25519-signed, provenance-tagged rule candidates that a human reviews and approves through `/massu-rule packs` (packs **propose**, humans **approve** — CR-39; no fake "active"/"enforced" state). Pack rules ride the existing `applyRuleCandidate()` chokepoint with the same Team-gated, signature-verified trust model as team-shared promotion (CR-54/55/57); executable destinations (`pattern-scanner`/`custom-destination`) route through the hardened two-operator review path and never auto-enforce. Ships the versioning + curation workflow (SemVer monotonicity, an immutable `rule_pack_versions` history, a `rule_pack_publish` SECURITY DEFINER RPC) the marketplace previously lacked. Backwards-compatible additive feature — new `/massu-rule packs` subcommand + `pack` provenance origin, zero breaking changes — minor per semver.
10
+
11
+ ### Added
12
+
13
+ - **`packages/core/src/rule-pack-sync.ts`** — `pullInstalledPackRules(db)`: pulls the org's installed-pack rules from the `installed-rules` edge function, verifies the Ed25519 envelope (`verifyPromotionEnvelope`), org-matches against `getCachedOrgId()`, and materializes each rule as a provenance-tagged (`origin:'pack'`, `pack_slug`, `pack_version`) candidate sidecar. **Materialize-never-apply** invariant: imports none of the 7 applier-write symbols (drift-guarded by pattern-scanner Check 36 + `promotion-pull-skeleton-parity.test.ts`, the lockstep guard shared with `team-rule-sync.ts`).
14
+ - **`packages/core/src/rule-pack-schema.ts`** — typed validator asserting every pack rule declares a real enforcement `destination` (imported from the `RuleDestination` SoT, `satisfies`-pinned), carries a deterministic enforcement body (no inert rules — CR-39), and flags executable destinations `requiresHardened`.
15
+ - **`/massu-rule packs`** subcommand (`commands/rule.ts` + `massu-rule.md`) — Team-gated pack pull; `list`/`show` flag `FROM PACK <slug>@<version>`.
16
+ - **pattern-scanner Check 36** — pins the rule-pack enforcement-bridge no-apply invariant; mirrored by `rule-pack-enforcement-bridge.test.ts`.
17
+ - **Website (massu_prod + massu.ai)**: migration 047 (`rule_pack_versions` history + SemVer CHECK + `curation_status` + `rule_pack_update_status` view + `rule_pack_publish` RPC), migration 048 (re-seed the 6 curated packs into the destination-mapped enforced format, v1.1.0, snapshotted), the `installed-rules` Team-gated Ed25519-signed edge function (CR-58 `verify_jwt=false`), and marketplace version/update UX.
18
+
19
+ ### Changed
20
+
21
+ - **`packages/core/src/rule-candidate-applier.ts`** — `RuleCandidateProvenance.origin` widened `'team'` → `'team' | 'pack'` (+ optional `pack_slug`/`pack_version`); the apply gate accepts `pack` candidates through the same tier/signature/destination checks as team origin.
22
+ - **`website/src/__tests__/changelog-parse.test.ts:EXPECTED_COUNT`** bumped 43 → 44.
23
+
24
+ ### Fixed
25
+
26
+ - **Destination fidelity (structural)** — `approve` previously re-derived a candidate's destination via `classifyCandidate()`, **discarding** the authored destination the publisher/pack stored on the sidecar (a pre-existing bug that also affected team origin: a `claude-md-cr` rule could be silently re-routed to `corrections-md`, or an executable rule downgraded off the hardened path). The applier now **structurally refuses** applying any provenance-bearing candidate to a destination other than its authored one (zero mutation on mismatch); `approve` uses the stored destination for `team`/`pack` origin.
27
+ - **Rule-pack publish authz** — `rule_pack_publish` RPC no longer trusts a NULL `auth.uid()` (service-role) as a platform admin for global first-party packs; global packs are published via migration only (the RPC raises), org packs require owner/admin via a user-scoped client.
28
+
29
+ ## [1.13.1] - 2026-05-20
30
+
31
+ **PreToolUse dispatcher SSOT promotion + hook docs drift closure**. Closes a customer-blocking regression introduced in 1.13.0: every fresh `npx -y @massu/core@1.13.0 init` wrote `npx -y @massu/core@1.13.0 hook-runner pre-tool-use-gate` into `.claude/settings.local.json` (the consolidated PreToolUse hook landed by P-E-019 in 1.12.0), but `commands/hook-runner.ts:HOOK_NAME_TO_FILE` was a hand-maintained map missing the entry. The dispatcher threw `Unknown hook: "pre-tool-use-gate"`, Claude Code interpreted the non-zero exit as a PreToolUse block, and Bash/Edit/Write were all gated — a catch-22 where the customer could not edit `settings.local.json` to repair the install because Edit itself was blocked. The existing 3-way parity tests (`hook-registry-parity.test.ts`) covered REGISTERED_HOOKS ↔ src/hooks/*.ts ↔ buildHooksConfig() but never asserted the 4th edge against the runtime dispatcher map.
32
+
33
+ Structural fix per CR-46 / Rule 25: `HOOK_NAME_TO_FILE` is now derived from `REGISTERED_HOOKS` (`Object.fromEntries(REGISTERED_HOOKS.map(n => [n, `${n}.js`]))`) so every future hook landed in the registry automatically appears in the dispatcher. The bug class is structurally impossible by construction.
34
+
35
+ ### Fixed
36
+
37
+ - **`packages/core/src/commands/hook-runner.ts:HOOK_NAME_TO_FILE`** — replaced the hand-maintained 16-entry map with a frozen derivation from `REGISTERED_HOOKS` (`lib/hook-registry.ts`). The dispatcher now exposes all 17 registered hooks including `pre-tool-use-gate`. Verified end-to-end: `node dist/cli.js hook-runner pre-tool-use-gate < /dev/null` → exit 0 (was exit 2 in 1.13.0 with "Unknown hook" stderr).
38
+
39
+ ### Added
40
+
41
+ - **Three new parity-test cases** in `packages/core/src/__tests__/hook-registry-parity.test.ts`: (1) `HOOK_NAME_TO_FILE keys match REGISTERED_HOOKS (dispatcher parity)` — the 4th parity edge, asserts dispatcher cannot drift from the registry; (2) `HOOK_NAME_TO_FILE values match \`${name}.js\` for every registered hook` — pins the derivation shape contract; (3) `resolveHookFile() succeeds for every hook emitted by buildHooksConfig() (closes 1.13.0 regression)` — direct fire-time regression guard that every name the installer writes is dispatchable. Test count went 5 → 8 passing. Surrounding test surface (hook-runner + cli + init-hooks) unchanged at 78/78.
42
+ - **Six previously-undocumented hook docs pages** in `website/content/docs/hooks/`: `pre-tool-use-gate.mdx`, `auto-learning-pipeline.mdx`, `fix-detector.mdx`, `classify-failure.mdx`, `incident-pipeline.mdx`, `rule-enforcement-pipeline.mdx`. The 1.13.0 dispatcher regression was able to ship in part because the consolidated `pre-tool-use-gate` hook (landed by P-E-019 in 1.12.0) had no documentation page — there was no /docs/hooks/pre-tool-use-gate URL to spot-check, and no reviewer was prompted to validate the runtime dispatch path. Closing the docs gap is part of the same structural close: every hook in `REGISTERED_HOOKS` now has a docs page.
43
+
44
+ ### Changed
45
+
46
+ - **`website/content/docs/hooks/index.mdx`** — header "11 MCP lifecycle hooks" bumped to "17 MCP lifecycle hooks". The lifecycle table and detailed-documentation list both grew by 6 rows. The session-lifecycle ASCII diagram now includes the auto-learning pipeline chain (fix-detector → classify-failure → incident-pipeline → rule-enforcement-pipeline → auto-learning-pipeline at Stop).
47
+ - **`website/src/__tests__/changelog-parse.test.ts:EXPECTED_COUNT`** bumped 42 → 43.
48
+
7
49
  ## [1.13.0] - 2026-05-20
8
50
 
9
51
  **v0.2 Interactive Rule-Approval (`plan-v0.2-interactive-rule-approval`)**. Closes the silent-self-attestation bug class in Massu's auto-learning system. v0.1 (`auto-learning.md:35-46`) was a protocol obligation the model self-enforces at `/massu-loop` end, audited post-hoc by `/massu-learning-audit`. v0.2 adds real-time correction detection (UserPromptSubmit hook, score-based threshold ≥60), side-channel rule-candidate funnel (`.massu/rule-candidates/<sha>.json`), explicit slash command `/massu-rule list|show|approve|dismiss|recurrence`, atomic write through `applyRuleCandidate()` helper with `audit_log` UNIQUE-INDEX idempotency, three-class rubric (`pattern-scanner | claude-md-cr | corrections-md`) + `autoLearning.customDestinations` config extension point. Three-layer structural enforcement: protocol gate (slash command + hook) + idempotency lock (`audit_log` UNIQUE INDEX) + drift-guard vitest (`rule-promotion-effectiveness.test.ts`). New canonical rule CR-53 codifies "auto-learned rules must be effective". Ships as `@massu/core@1.13.0` — new MCP-adjacent capability + new slash command + backwards-compatible `audit_log.event_type` CHECK extension (internal-process table, zero external schema consumers — minor justified per semver §7).
@@ -116,7 +158,7 @@ Phase 1.5 multi-perspective review surfaced 5 security + 7 architecture findings
116
158
 
117
159
  ### Added
118
160
 
119
- - **`scripts/check-claude-md-{size,structure}.sh`** (P-E-001) now resolve repo root via `git rev-parse --show-toplevel` instead of hardcoded `/Users/eko3/` paths — works for any operator regardless of `$USER`. Closes `wave2-pattern:F4`.
161
+ - **`scripts/check-claude-md-{size,structure}.sh`** (P-E-001) now resolve repo root via `git rev-parse --show-toplevel` instead of hardcoded `/Users/<user>/` paths — works for any operator regardless of `$USER`. Closes `wave2-pattern:F4`.
120
162
  - **`scripts/kb-staleness-audit.sh`** (P-E-002) incident-count parser now uses awk-based context-aware count of `### Incident #N` entries under the `## Incidents` section, properly handles empty-template case. Closes `wave2-pattern:F5`.
121
163
  - **`scripts/massu-pattern-scanner.sh`** (P-E-003) adds `gawk` shim + replaces `\(` ERE escapes with `[(]` portable form. macOS BSD-awk noise reduced from ~80 lines to 0. Allow-directive bridging now persists through block-comment + blank lines (fixes false positive on `init.ts:655` yaml-parse directive at L650). Surfaced 2 real pre-existing violations (now also fixed below).
122
164
  - **`scripts/massu-pattern-scanner.sh`** (P-E-004) Check 10 replaced count-based check with per-file leak detection — matches `?.close()` and excludes comment-line references. Closes `wave1-mcp-tools:F-MCP-008` / `wave2-pattern:F8`.
@@ -136,7 +178,7 @@ Phase 1.5 multi-perspective review surfaced 5 security + 7 architecture findings
136
178
  ### Drift-guards (CR-46 compliance)
137
179
 
138
180
  - **`website/src/__tests__/eslint-warning-budget.test.ts`** (P-E-045) — ESLint budget pinned at 90 warnings + 0 errors. Future regressions FAIL the test. Reduction over time encouraged via budget DOWN-adjustment.
139
- - **`website/src/__tests__/generic-username-scripts.test.ts`** (P-E-046) — forbids `/Users/eko3`, `/Users/ekoultra`, and any `/home/<username>/` literal in any script under `scripts/`. Allowlist for leak-pattern scan targets.
181
+ - **`website/src/__tests__/generic-username-scripts.test.ts`** (P-E-046) — forbids hardcoded operator home paths (`/Users/<user>/`, `/home/<username>/`) in any script under `scripts/`. Allowlist for leak-pattern scan targets.
140
182
  - **`website/src/__tests__/privacy-page-required-sections.test.ts`** (P-E-028 drift-guard) — 5 cases: GDPR present, CCPA present, "Do Not Sell or Share" disclosure, CCPA id anchor for deep-link, metadata description mentions both.
141
183
  - **`website/src/__tests__/logger-sanitize.test.ts`** (P-E-040 drift-guard) — 6 cases: ANSI CSI strip, OSC strip, CRLF replace, length truncate, non-string coercion, CRLF-injection attack returns single line.
142
184
  - **`website/src/__tests__/revenue-kill-switches.test.ts`** (P-E-042 drift-guard) — 17 cases (4 flags × 4 cases + 1 disabled-response shape) — default ON, explicit OFF values, fail-open on garbage, 503 response shape.
@@ -80,29 +80,34 @@ Code Quality: PASS + Plan Coverage: FAIL = NOT COMPLETE.
80
80
 
81
81
  ALWAYS run VR-SCHEMA-PRE before using any column name.
82
82
 
83
- ## MANDATORY 3-ENVIRONMENT SCHEMA SYNC (CR-36, Incident #27)
83
+ ## MANDATORY MULTI-ENVIRONMENT SCHEMA SYNC (CR-36, Incident #27)
84
84
 
85
- **ALL database migrations (ALTER TABLE, CREATE TABLE, DROP COLUMN, etc.) MUST be applied to ALL 3 environments in the SAME session.**
85
+ **ALL database migrations (ALTER TABLE, CREATE TABLE, DROP COLUMN, etc.) MUST be applied to EVERY configured environment in the SAME session.**
86
86
 
87
- | Order | Environment | MCP Tool Prefix |
88
- |-------|-------------|-----------------|
89
- | 1 | NEW PROD | `mcp__supabase__NEW_PROD__execute_sql` |
90
- | 2 | DEV | `mcp__supabase__DEV__execute_sql` |
91
- | 3 | OLD PROD | `mcp__supabase__OLD_PROD__execute_sql` |
87
+ Configure your Supabase MCP server(s) in `.mcp.json`; this command uses whatever
88
+ environment aliases you define. Apply migrations to every environment you maintain,
89
+ in a safe order (lower environments first, production last). The MCP tool names
90
+ follow the form `mcp__supabase__<your-env-alias>__execute_sql`.
91
+
92
+ | Order | Environment (your alias) | MCP Tool Prefix |
93
+ |-------|--------------------------|-----------------|
94
+ | 1 | `<dev>` | `mcp__supabase__<dev>__execute_sql` |
95
+ | 2 | `<staging>` | `mcp__supabase__<staging>__execute_sql` |
96
+ | N (last) | `<prod>` | `mcp__supabase__<prod>__execute_sql` |
92
97
 
93
98
  ### VR-SCHEMA-SYNC Protocol
94
99
 
95
- After applying ANY migration, verify all 3 environments match:
100
+ After applying ANY migration, verify all environments match:
96
101
 
97
102
  ```sql
98
- -- Run on ALL 3 environments:
103
+ -- Run on EVERY configured environment:
99
104
  SELECT column_name, data_type, is_nullable, column_default
100
105
  FROM information_schema.columns
101
106
  WHERE table_schema = 'public' AND table_name = '[TABLE]'
102
107
  ORDER BY ordinal_position;
103
108
  ```
104
109
 
105
- **Column count MUST match across all 3 environments. If it doesn't, the migration is INCOMPLETE.**
110
+ **Column count MUST match across all environments. If it doesn't, the migration is INCOMPLETE.**
106
111
 
107
112
  A migration applied to only 1 environment is NOT a completed migration. It is a schema drift time bomb.
108
113
 
@@ -44,9 +44,13 @@
44
44
 
45
45
  ## Database Environments
46
46
 
47
- | Environment | Description | MCP Tool Prefix |
48
- |-------------|-------------|-----------------|
49
- | DEV | Local development, testing | `mcp__supabase__DEV__` |
50
- | PROD | Production database | `mcp__supabase__PROD__` |
47
+ Configure your Supabase MCP server(s) in `.mcp.json`; the commands use whatever
48
+ environment aliases you define. The MCP tool names follow the form
49
+ `mcp__supabase__<your-env-alias>__execute_sql`.
51
50
 
52
- > **Note**: Project-specific Supabase project IDs should be configured in the project's CLAUDE.md or `.env` file, not in shared references.
51
+ | Environment (your alias) | Description | MCP Tool Prefix |
52
+ |--------------------------|-------------|-----------------|
53
+ | `<dev>` | Local development, testing | `mcp__supabase__<dev>__` |
54
+ | `<prod>` | Production database | `mcp__supabase__<prod>__` |
55
+
56
+ > **Note**: Project-specific Supabase project IDs and environment aliases should be configured in your `.mcp.json` (and optionally documented in the project's CLAUDE.md), not in shared references.
@@ -1,11 +1,19 @@
1
1
  ---
2
2
  name: massu-checkpoint
3
3
  description: "When user wants mid-implementation verification, says 'checkpoint', 'check progress', or needs a quality gate during a multi-phase plan"
4
- allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*), mcp__supabase__DEV__*, mcp__supabase__NEW_PROD__*, mcp__supabase__OLD_PROD__*
4
+ allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*), mcp__supabase__*
5
5
  ---
6
6
  name: massu-checkpoint
7
7
 
8
- # Massu Checkpoint: Phase Boundary Audit Protocol
8
+ ## Tier requirement (Requires Pro)
9
+
10
+ The mid-implementation checkpoint audit (multi-environment schema verification,
11
+ subagent loop, plan-coverage gate) is a **Pro** feature. Confirm entitlement
12
+ before running — this hard-fails for sub-Pro:
13
+
14
+ ```bash
15
+ npx massu license check --min pro || exit 1
16
+ ```
9
17
 
10
18
  **Shared rules**: Read `.claude/commands/_shared-preamble.md` for POST-COMPACTION (CR-12), ENTERPRISE-GRADE (CR-14), AWS SECRETS (CR-5) rules.
11
19
 
@@ -77,7 +85,7 @@ Execute full 15-step checkpoint audit for current phase. Require ZERO gaps befor
77
85
  2. ALL steps executed - no shortcuts (includes Step 0: Plan Coverage)
78
86
  3. Proof required - show verification output
79
87
  4. Session state update mandatory - record checkpoint result
80
- 5. All 3 DB environments verified (DEV, OLD PROD, NEW PROD)
88
+ 5. ALL configured DB environments verified (every alias in your `.mcp.json`)
81
89
  6. UI/UX verification required for UI changes
82
90
  7. Schema verification required - verify column names against real schema
83
91
  8. Plan Coverage required - ALL plan items verified at 100%
@@ -141,13 +149,21 @@ Read plan section for this phase. Extract requirements into checklist.
141
149
 
142
150
  ---
143
151
 
144
- ### Step 2: QUERY Database (All 3 Environments)
152
+ ### Step 2: QUERY Database (Every Configured Environment)
153
+
154
+ Query **whatever Supabase MCP server(s) you configure** in your `.mcp.json`. Use the
155
+ environment aliases you define there; the MCP tool names follow the form
156
+ `mcp__supabase__<your-env-alias>__execute_sql`. Verify EVERY environment you maintain
157
+ so no environment drifts.
158
+
159
+ | Environment (your alias) | MCP Tool Prefix |
160
+ |--------------------------|-----------------|
161
+ | `<dev>` | `mcp__supabase__<dev>__` |
162
+ | `<staging>` | `mcp__supabase__<staging>__` |
163
+ | `<prod>` | `mcp__supabase__<prod>__` |
145
164
 
146
- | Environment | Project ID | MCP Tool Prefix |
147
- |-------------|------------|-----------------|
148
- | DEV | `gwqkbjymbarkufwvdmar` | `mcp__supabase__DEV__` |
149
- | OLD PROD | `hwaxogapihsqleyzpqtj` | `mcp__supabase__OLD_PROD__` |
150
- | NEW PROD | `cnfxxvrhhvjefyvpoqlq` | `mcp__supabase__NEW_PROD__` |
165
+ > Configure your Supabase MCP server(s) in `.mcp.json`; this command uses whatever
166
+ > environment aliases you define.
151
167
 
152
168
  For EACH affected table, verify: table exists, columns match, RLS policies exist, grants present.
153
169
 
@@ -155,9 +171,9 @@ For EACH affected table, verify: table exists, columns match, RLS policies exist
155
171
  ### DB Verification: [TABLE]
156
172
  | Env | Exists | Columns | RLS | Grants | Status |
157
173
  |-----|--------|---------|-----|--------|--------|
158
- | DEV | YES | X/X | X policies | YES | PASS |
159
- | OLD PROD | YES | X/X | X policies | YES | PASS |
160
- | NEW PROD | YES | X/X | X policies | YES | PASS |
174
+ | <dev> | YES | X/X | X policies | YES | PASS |
175
+ | <staging> | YES | X/X | X policies | YES | PASS |
176
+ | <prod> | YES | X/X | X policies | YES | PASS |
161
177
  ```
162
178
 
163
179
  ---
@@ -448,7 +464,7 @@ Re-run ENTIRE checkpoint from Step 1. Partial re-checks are NOT valid.
448
464
  | R-001 | [desc] | [VR-* proof] | VERIFIED |
449
465
 
450
466
  ### Summary
451
- - Database: DEV/OLD PROD/NEW PROD verified: PASS
467
+ - Database: all configured environments verified: PASS
452
468
  - Pattern scanner exit 0: PASS
453
469
  - Build: PASS (Exit 0)
454
470
  - UI/UX: All checks passed
@@ -474,7 +490,7 @@ Verified:
474
490
  - Pattern scanner: PASS
475
491
  - Type check: 0 errors
476
492
  - Build: PASS
477
- - DB: DEV/OLD PROD/NEW PROD verified
493
+ - DB: all configured environments verified
478
494
 
479
495
  Co-Authored-By: Claude <noreply@anthropic.com>
480
496
  EOF
@@ -503,7 +519,7 @@ After checkpoint, update `session-state/CURRENT.md`:
503
519
  | Pattern scanner | PASS |
504
520
  | Type check | 0 errors |
505
521
  | Build | PASS |
506
- | DB (DEV/OLD PROD/NEW PROD) | PASS |
522
+ | DB (all configured environments) | PASS |
507
523
 
508
524
  ### Files Changed
509
525
  - [file1.ts]
@@ -1,12 +1,22 @@
1
1
  ---
2
2
  name: massu-data
3
3
  description: "When user asks about data trends, metrics, analytics, funnel analysis, cohort comparison, entity counts, storage usage, or 'what happened' questions about the database"
4
- allowed-tools: Bash(*), Read(*), Grep(*), Glob(*), mcp__supabase__DEV__*, mcp__supabase__NEW_PROD__*, mcp__supabase__OLD_PROD__*
4
+ allowed-tools: Bash(*), Read(*), Grep(*), Glob(*), mcp__supabase__*
5
5
  ---
6
6
 
7
7
  # Data Analysis
8
8
 
9
- Structured data analysis and query library for Massu databases.
9
+ Structured data analysis and query library for your project databases.
10
+
11
+ ## Tier requirement (Requires Pro)
12
+
13
+ The data-analysis query library (multi-environment querying, funnel/cohort
14
+ analytics) is a **Pro** feature. Confirm entitlement before running — this
15
+ hard-fails for sub-Pro:
16
+
17
+ ```bash
18
+ npx massu license check --min pro || exit 1
19
+ ```
10
20
 
11
21
  ## Skill Contents
12
22
 
@@ -24,20 +34,24 @@ This skill is a folder. The following files are available for reference:
24
34
  ## Process
25
35
 
26
36
  1. **Understand the question** — What data does the user need?
27
- 2. **Identify target database** — DEV (testing), NEW PROD (live data), OLD PROD (historical)
37
+ 2. **Identify target database** — pick the matching environment alias from your `.mcp.json`
28
38
  3. **Check for pre-built query** — Review `scripts/` for a matching SQL template
29
39
  4. **Verify schema** — Run VR-SCHEMA-PRE before any custom query
30
- 5. **Execute query** — Use MCP `execute_sql` tool
40
+ 5. **Execute query** — Use the `mcp__supabase__<your-env-alias>__execute_sql` MCP tool
31
41
  6. **Present results** — Format as table with clear labels
32
42
 
33
43
  ## Database Selection
34
44
 
35
- | User Says | Database |
36
- |-----------|----------|
37
- | "production", "live", "real data" | NEW PROD |
38
- | "dev", "test", "local" | DEV |
39
- | "old prod", "historical" | OLD PROD |
40
- | No qualifier | NEW PROD (default) |
45
+ Configure your Supabase MCP server(s) in `.mcp.json`; this command uses whatever
46
+ environment aliases you define (e.g. `dev`, `staging`, `prod`). Map the user's
47
+ intent to your own aliases:
48
+
49
+ | User Says | Database (your alias) |
50
+ |-----------|-----------------------|
51
+ | "production", "live", "real data" | your production alias (default) |
52
+ | "dev", "test", "local" | your dev alias |
53
+ | "staging", "historical" | your staging/secondary alias |
54
+ | No qualifier | your production alias (default) |
41
55
 
42
56
  ## Key Tables
43
57
 
@@ -83,7 +83,7 @@ Use Playwright MCP against production URL:
83
83
  - Verify data loads and mutations work
84
84
 
85
85
  ### Database Changes
86
- Query PROD (`mcp__supabase__PROD__execute_sql`):
86
+ Query your production environment (`mcp__supabase__<your-prod-alias>__execute_sql` — use the alias you configure in `.mcp.json`):
87
87
  ```sql
88
88
  -- Verify data flows, not just schema
89
89
  SELECT COUNT(*), MAX(created_at) FROM [table]
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: massu-production-verify
3
3
  description: "When user says 'verify production', 'is it working', 'production check', or after a deploy to verify features are actually working in production — not just deployed"
4
- allowed-tools: Bash(*), Read(*), Grep(*), Glob(*), mcp__supabase__NEW_PROD__*, mcp__supabase__DEV__*, mcp__plugin_playwright_playwright__*, mcp__claude_ai_Vercel__get_deployment, mcp__claude_ai_Vercel__get_runtime_logs, mcp__claude_ai_Vercel__list_deployments, mcp__claude_ai_Vercel__web_fetch_vercel_url
4
+ allowed-tools: Bash(*), Read(*), Grep(*), Glob(*), mcp__supabase__*, mcp__plugin_playwright_playwright__*, mcp__claude_ai_Vercel__get_deployment, mcp__claude_ai_Vercel__get_runtime_logs, mcp__claude_ai_Vercel__list_deployments, mcp__claude_ai_Vercel__web_fetch_vercel_url
5
5
  ---
6
6
  name: massu-production-verify
7
7
 
@@ -17,9 +17,14 @@ Code existing, builds passing, and deploys succeeding prove NOTHING about whethe
17
17
 
18
18
  ---
19
19
 
20
+ > **Environment aliases**: Configure your Supabase MCP server(s) in `.mcp.json`; this
21
+ > command uses whatever environment aliases you define. Below, "production" / "PROD"
22
+ > means your configured production alias and "DEV" means your dev alias — substitute
23
+ > your own (`mcp__supabase__<your-env-alias>__execute_sql`).
24
+
20
25
  ## NON-NEGOTIABLE RULES
21
26
 
22
- - **Proof from production, not dev** — queries must hit NEW PROD database, URLs must hit production deployment
27
+ - **Proof from production, not dev** — queries must hit your PRODUCTION database, URLs must hit production deployment
23
28
  - **Data, not structure** — verifying a table exists is NOT the same as verifying data flows through it
24
29
  - **End-to-end, not component** — verify the full chain: trigger -> process -> store -> display
25
30
  - **Every feature, every deploy** — no exceptions for "simple" changes
@@ -1,13 +1,23 @@
1
1
  ---
2
2
  name: massu-rollback
3
3
  description: "When user says 'rollback', 'revert this', 'undo changes', 'go back', or needs to safely undo code or database changes with state preservation"
4
- allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*), mcp__supabase__DEV__*, mcp__supabase__NEW_PROD__*, mcp__supabase__OLD_PROD__*
4
+ allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*), mcp__supabase__*
5
5
  disable-model-invocation: true
6
6
  ---
7
7
  name: massu-rollback
8
8
 
9
9
  > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-14, CR-5, CR-12 enforced.
10
10
 
11
+ ## Tier requirement (Requires Pro)
12
+
13
+ The safe rollback protocol (multi-environment schema/data rollback with state
14
+ preservation and integrity verification) is a **Pro** feature. Confirm entitlement
15
+ before running — this hard-fails for sub-Pro:
16
+
17
+ ```bash
18
+ npx massu license check --min pro || exit 1
19
+ ```
20
+
11
21
  # Massu Rollback: Safe Rollback Protocol
12
22
 
13
23
  ## Objective
@@ -60,11 +70,19 @@ ROLLBACK VERIFICATION LOOP:
60
70
 
61
71
  ## SUPABASE ENVIRONMENTS
62
72
 
63
- | Environment | Project ID | MCP Tool Prefix |
64
- |-------------|------------|-----------------|
65
- | DEV | `gwqkbjymbarkufwvdmar` | `mcp__supabase__DEV__` |
66
- | OLD PROD | `hwaxogapihsqleyzpqtj` | `mcp__supabase__OLD_PROD__` |
67
- | NEW PROD | `cnfxxvrhhvjefyvpoqlq` | `mcp__supabase__NEW_PROD__` |
73
+ Rollbacks run against **whatever Supabase MCP server(s) you configure** in your
74
+ `.mcp.json`. Use the environment aliases you define there; the MCP tool names
75
+ follow the form `mcp__supabase__<your-env-alias>__execute_sql`. Apply every
76
+ rollback to EVERY environment you maintain so no environment drifts.
77
+
78
+ | Environment (your alias) | MCP Tool Prefix |
79
+ |--------------------------|-----------------|
80
+ | `<dev>` | `mcp__supabase__<dev>__` |
81
+ | `<staging>` | `mcp__supabase__<staging>__` |
82
+ | `<prod>` | `mcp__supabase__<prod>__` |
83
+
84
+ > Configure your Supabase MCP server(s) in `.mcp.json`; this command uses whatever
85
+ > environment aliases you define.
68
86
 
69
87
  ---
70
88
 
@@ -345,7 +363,7 @@ ALTER TABLE [table] ALTER COLUMN [column] TYPE [old_type];
345
363
  ```
346
364
 
347
365
  ### 5.2 Apply Rollback Migration
348
- Apply to environments in order: DEV first, then OLD PROD, then NEW PROD
366
+ Apply to environments in a safe order: lower environments first (e.g. dev), then staging, then production last — using your configured `.mcp.json` aliases.
349
367
 
350
368
  ```sql
351
369
  -- Always wrap in transaction
@@ -477,7 +495,7 @@ curl -I https://[production-url]/
477
495
  curl https://[production-url]/api/health
478
496
 
479
497
  # Monitor logs for errors
480
- # Use mcp__supabase__NEW_PROD__get_logs for each service
498
+ # Use mcp__supabase__<your-prod-alias>__get_logs for each service
481
499
  ```
482
500
 
483
501
  ---
@@ -1,13 +1,23 @@
1
1
  ---
2
2
  name: massu-security
3
3
  description: "When user says 'security audit', 'check security', 'RLS audit', 'XSS check', or needs a focused security review covering auth, secrets, injection, and OWASP top 10"
4
- allowed-tools: Bash(*), Read(*), Grep(*), Glob(*), mcp__supabase__DEV__*, mcp__supabase__NEW_PROD__*, mcp__supabase__OLD_PROD__*
4
+ allowed-tools: Bash(*), Read(*), Grep(*), Glob(*), mcp__supabase__*
5
5
  disable-model-invocation: true
6
6
  ---
7
7
  name: massu-security
8
8
 
9
9
  > **Shared rules apply.** Read `.claude/commands/_shared-preamble.md` before proceeding. CR-14, CR-5, CR-12 enforced.
10
10
 
11
+ ## Tier requirement (Requires Enterprise)
12
+
13
+ The deep multi-environment security audit (RLS/grants across every configured
14
+ Supabase environment, OWASP coverage, injection sweeps) is an **Enterprise**
15
+ feature. Confirm entitlement before running — this hard-fails for sub-Enterprise:
16
+
17
+ ```bash
18
+ npx massu license check --min enterprise || exit 1
19
+ ```
20
+
11
21
  # Massu Security: Comprehensive Security Audit
12
22
 
13
23
  ## Objective
@@ -71,11 +81,20 @@ SECURITY AUDIT LOOP:
71
81
 
72
82
  ## SUPABASE ENVIRONMENTS
73
83
 
74
- | Environment | Project ID | MCP Tool Prefix |
75
- |-------------|------------|-----------------|
76
- | DEV | `gwqkbjymbarkufwvdmar` | `mcp__supabase__DEV__` |
77
- | OLD PROD | `hwaxogapihsqleyzpqtj` | `mcp__supabase__OLD_PROD__` |
78
- | NEW PROD | `cnfxxvrhhvjefyvpoqlq` | `mcp__supabase__NEW_PROD__` |
84
+ This audit runs against **whatever Supabase MCP server(s) you configure** in your
85
+ `.mcp.json`. Use the environment aliases you define there — the audit covers every
86
+ configured environment (e.g. dev / staging / prod). The MCP tool names follow the
87
+ form `mcp__supabase__<your-env-alias>__execute_sql`; substitute your own aliases.
88
+
89
+ | Environment (your alias) | MCP Tool Prefix |
90
+ |--------------------------|-----------------|
91
+ | `<dev>` | `mcp__supabase__<dev>__` |
92
+ | `<staging>` | `mcp__supabase__<staging>__` |
93
+ | `<prod>` | `mcp__supabase__<prod>__` |
94
+
95
+ > Configure your Supabase MCP server(s) in `.mcp.json`; this command uses whatever
96
+ > environment aliases you define. Run the RLS/grants checks below against EVERY
97
+ > environment you maintain so no environment drifts.
79
98
 
80
99
  ---
81
100
 
@@ -470,9 +489,9 @@ npm audit --production --json | grep -i "critical\|high"
470
489
  ### Section 4: Database Security (RLS)
471
490
  | Environment | Tables with RLS | Policies | service_role Grants |
472
491
  |-------------|-----------------|----------|---------------------|
473
- | DEV | N/N | N | YES |
474
- | OLD PROD | N/N | N | YES |
475
- | NEW PROD | N/N | N | YES |
492
+ | `<env-alias-1>` | N/N | N | YES |
493
+ | `<env-alias-2>` | N/N | N | YES |
494
+ | `<env-alias-N>` | N/N | N | YES |
476
495
 
477
496
  ### Section 5: Injection Prevention
478
497
  | Check | Result | Status |
@@ -558,7 +577,7 @@ After audit, update `session-state/CURRENT.md`:
558
577
  1. Run Section 1: Secrets & Credentials
559
578
  2. Run Section 2: Authentication
560
579
  3. Run Section 3: Authorization (tRPC)
561
- 4. Run Section 4: Database Security (all 3 envs)
580
+ 4. Run Section 4: Database Security (every configured environment)
562
581
  5. Run Section 5: Injection Vulnerabilities
563
582
  6. Run Section 6: Data Exposure
564
583
  7. Run Section 7: Additional Checks