@massu/core 1.13.1 → 1.15.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 +61 -2
- package/commands/_shared-preamble.md +15 -10
- package/commands/_shared-references/verification-table.md +9 -5
- package/commands/massu-checkpoint.md +31 -15
- package/commands/massu-data.md +24 -10
- package/commands/massu-golden-path/references/phase-5.5-production-verify.md +1 -1
- package/commands/massu-production-verify.md +7 -2
- package/commands/massu-rollback.md +26 -8
- package/commands/massu-security.md +29 -10
- package/dist/cli.js +979 -206
- package/dist/hooks/classify-failure.js +46 -0
- package/dist/hooks/cost-tracker.js +46 -0
- package/dist/hooks/incident-pipeline.js +46 -0
- package/dist/hooks/post-tool-use.js +46 -0
- package/dist/hooks/pre-compact.js +46 -0
- package/dist/hooks/quality-event.js +46 -0
- package/dist/hooks/session-end.js +702 -5
- package/dist/hooks/session-start.js +612 -56
- package/dist/hooks/user-prompt.js +296 -14
- package/package.json +3 -3
- package/commands/massu-autoresearch/references/eval-runner.md +0 -84
- package/commands/massu-autoresearch/references/safety-rails.md +0 -125
- package/commands/massu-autoresearch/references/scoring-protocol.md +0 -151
- package/commands/massu-autoresearch.md +0 -258
- package/commands/massu-command-health.md +0 -132
- package/commands/massu-command-improve.md +0 -232
- package/commands/massu-infra-audit.md +0 -187
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,65 @@ 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.15.0] - 2026-06-02
|
|
8
|
+
|
|
9
|
+
**Enterprise auto-learning governance + signed audit export (`plan-2026-06-01-enterprise-governance-audit-export`)**. Generalizes the Phase-3 per-rule two-operator review into an org-level governance policy enforced at the server promotion chokepoint + role-aware RLS, and adds a cryptographically-signed compliance export. Enterprise orgs (`plan='cloud_enterprise'`) can now set a promotion policy — minimum promoter role (rank-compared, never lexicographic), N-of-M distinct-approver requirement, allowed destinations, and a tighten-only hardened-review flag — that `promoted_rule_upsert` enforces before any promotion applies; a promotion below threshold is held `pending` and excluded from every seat's pull cursor until enough distinct operators (each other than the promoter) approve it. The new signed audit export streams the org's full governance history (policy, approvals, promotions, revocations) as a single Ed25519-signed FLAT envelope (records carried as a `records_json` STRING so the signature covers every record — no nested-array forgery hole), verifiable offline against the bundled public key. The `audit-export` edge function is the SOLE signer (single-signer, CR-46) for both the programmatic `ms_live_` path (admin-scoped) and the dashboard path (which calls it server-side via a service-role bearer and holds no key). Backwards-compatible additive feature — off the Enterprise path, behavior is unchanged (`approval_state` defaults to `applied`) — minor per semver.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **`packages/core/src/security/governance-export-verifier.ts`** — Ed25519 verifier for the signed `/audit-export` envelope; a one-line wrapper over the consolidated `verifyEd25519SignedEnvelope` core (third signed-envelope artifact, no copy-pasted crypto), NO transition mode. Bundled pubkey via `scripts/bundle-audit-export-pubkey.mjs` (+ `generate-audit-export-keypair.mjs`), wired into `prepublishOnly`.
|
|
14
|
+
- **`packages/core/src/rule-candidate-hardened.ts`** — `validateGovernanceGate(policy, approvals)` (generalized N-of-M gate) + `roleRank()` ladder; `validateHardenedApplyGate` now delegates as the N=2 special case (CR-10: symbol + refs + exact messages preserved).
|
|
15
|
+
- **`packages/core/src/auto-learning-entitlement.ts`** — `ENTERPRISE_GOVERNANCE_MIN_TIER` + `entitledForEnterpriseGovernance` (reuses the existing `tierLevel` + `PLAN_TO_TIER_MAP`; no parallel tier scheme).
|
|
16
|
+
- **`/massu-rule approvals`** subcommand — surfaces the org policy + pending N-of-M approval state.
|
|
17
|
+
- **pattern-scanner Check 37** + `governance-gate-invariant.test.ts` — the client-gate ↔ server-RPC ↔ RLS drift-guard (vitest ↔ scanner parity).
|
|
18
|
+
- **Website (massu_prod + massu.ai)**: migration 049 (`org_promotion_policy` + `promotion_approvals` ledger + `promoted_rules.approval_state` + the `promoted_rule_upsert` governance branch + `promotion_approval_record`/`promotion_policy_reconcile` RPCs + role-aware RLS + widened `activity_feed` CHECK), the `audit-export` Enterprise-gated Ed25519-signing edge function (CR-58 `verify_jwt=false`), and the `/dashboard/governance` admin page (policy editor + approvals + signed-export download).
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- `promoted_rule_upsert` re-defined (CREATE OR REPLACE of the 045 body + governance branch); `/sync` recognizes the new `pending_approval` status; `/promoted-rules` excludes `approval_state='pending'` rows from the differential-pull cursor.
|
|
23
|
+
|
|
24
|
+
## [1.14.0] - 2026-06-02
|
|
25
|
+
|
|
26
|
+
**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.
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- **`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`).
|
|
31
|
+
- **`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`.
|
|
32
|
+
- **`/massu-rule packs`** subcommand (`commands/rule.ts` + `massu-rule.md`) — Team-gated pack pull; `list`/`show` flag `FROM PACK <slug>@<version>`.
|
|
33
|
+
- **pattern-scanner Check 36** — pins the rule-pack enforcement-bridge no-apply invariant; mirrored by `rule-pack-enforcement-bridge.test.ts`.
|
|
34
|
+
- **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.
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- **`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.
|
|
39
|
+
- **`website/src/__tests__/changelog-parse.test.ts:EXPECTED_COUNT`** bumped 43 → 44.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
- **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.
|
|
44
|
+
- **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.
|
|
45
|
+
|
|
46
|
+
## [1.13.1] - 2026-05-20
|
|
47
|
+
|
|
48
|
+
**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.
|
|
49
|
+
|
|
50
|
+
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.
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- **`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).
|
|
55
|
+
|
|
56
|
+
### Added
|
|
57
|
+
|
|
58
|
+
- **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.
|
|
59
|
+
- **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.
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
|
|
63
|
+
- **`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).
|
|
64
|
+
- **`website/src/__tests__/changelog-parse.test.ts:EXPECTED_COUNT`** bumped 42 → 43.
|
|
65
|
+
|
|
7
66
|
## [1.13.0] - 2026-05-20
|
|
8
67
|
|
|
9
68
|
**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 +175,7 @@ Phase 1.5 multi-perspective review surfaced 5 security + 7 architecture findings
|
|
|
116
175
|
|
|
117
176
|
### Added
|
|
118
177
|
|
|
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
|
|
178
|
+
- **`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
179
|
- **`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
180
|
- **`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
181
|
- **`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 +195,7 @@ Phase 1.5 multi-perspective review surfaced 5 security + 7 architecture findings
|
|
|
136
195
|
### Drift-guards (CR-46 compliance)
|
|
137
196
|
|
|
138
197
|
- **`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
|
|
198
|
+
- **`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
199
|
- **`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
200
|
- **`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
201
|
- **`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
|
|
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
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
|
100
|
+
After applying ANY migration, verify all environments match:
|
|
96
101
|
|
|
97
102
|
```sql
|
|
98
|
-
-- Run on
|
|
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
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
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(*),
|
|
4
|
+
allowed-tools: Bash(*), Read(*), Write(*), Edit(*), Grep(*), Glob(*), mcp__supabase__*
|
|
5
5
|
---
|
|
6
6
|
name: massu-checkpoint
|
|
7
7
|
|
|
8
|
-
|
|
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.
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
|
159
|
-
|
|
|
160
|
-
|
|
|
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:
|
|
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:
|
|
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 (
|
|
522
|
+
| DB (all configured environments) | PASS |
|
|
507
523
|
|
|
508
524
|
### Files Changed
|
|
509
525
|
- [file1.ts]
|
package/commands/massu-data.md
CHANGED
|
@@ -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(*),
|
|
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
|
|
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** —
|
|
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
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
|
40
|
-
|
|
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
|
|
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(*),
|
|
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
|
|
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(*),
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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:
|
|
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
|
|
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(*),
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
|
474
|
-
|
|
|
475
|
-
|
|
|
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 (
|
|
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
|