@mutmutco/opencode-mmi 2.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/index.d.ts +35 -0
  2. package/dist/index.js +194 -0
  3. package/package.json +44 -0
  4. package/skills/_shared/doctrine.md +238 -0
  5. package/skills/bootstrap/SKILL.md +419 -0
  6. package/skills/bootstrap/seeds/Dockerfile.template +25 -0
  7. package/skills/bootstrap/seeds/README.template.md +36 -0
  8. package/skills/bootstrap/seeds/architecture.template.md +19 -0
  9. package/skills/bootstrap/seeds/components.json.template +31 -0
  10. package/skills/bootstrap/seeds/cursor-environment.template.json +3 -0
  11. package/skills/bootstrap/seeds/cursor-rules.template.mdc +11 -0
  12. package/skills/bootstrap/seeds/design-system.paths.template.json +8 -0
  13. package/skills/bootstrap/seeds/docker-compose.template.yml +17 -0
  14. package/skills/bootstrap/seeds/gate.template.yml +42 -0
  15. package/skills/bootstrap/seeds/google-login.template.md +35 -0
  16. package/skills/bootstrap/seeds/manifest.json +32 -0
  17. package/skills/bootstrap/seeds/mcp-playwright.template.json +13 -0
  18. package/skills/bootstrap/seeds/mmi-product-required-checks.template.json +23 -0
  19. package/skills/browser-automation/SKILL.md +137 -0
  20. package/skills/build/SKILL.md +237 -0
  21. package/skills/build/references/halt-report.md +38 -0
  22. package/skills/build/references/loops.md +13 -0
  23. package/skills/build/references/worked-example.md +18 -0
  24. package/skills/build/templates/campaign-northstar.md +40 -0
  25. package/skills/coop/SKILL.md +77 -0
  26. package/skills/grind/SKILL.md +469 -0
  27. package/skills/grind/references/auto.md +107 -0
  28. package/skills/grind/references/build-notes.md +56 -0
  29. package/skills/grind/references/routing.md +76 -0
  30. package/skills/grind/references/verify.md +83 -0
  31. package/skills/grind/templates/saga-snapshot.md +28 -0
  32. package/skills/grind/templates/synthesize-panel.md +104 -0
  33. package/skills/handoff/SKILL.md +67 -0
  34. package/skills/hotfix/SKILL.md +219 -0
  35. package/skills/mmi/SKILL.md +372 -0
  36. package/skills/rcand/SKILL.md +169 -0
  37. package/skills/release/SKILL.md +309 -0
  38. package/skills/secrets/SKILL.md +137 -0
  39. package/skills/stage/SKILL.md +150 -0
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: stage
3
+ description: Spin a local, gitignored, auto-decommissioned test environment for the current branch (force-kills any previous stage); --live deploys an on-demand personal cloud dev stage served only to your IP. Use when the user wants to run, preview, smoke-test, or spin up the current branch locally, set up a local/Playwright env, wants a personal cloud dev stage, or invokes /stage [--live [--down]].
4
+ ---
5
+
6
+ # /stage — local test environment
7
+
8
+ A throwaway **local** environment to exercise the current branch — a dev server / local stack, plus
9
+ Playwright or other tools where the project uses them. It is **off the promotion train**: any developer,
10
+ no version effect, no deploy. It lives in a **gitignored** workspace, **force-kills the previous stage**
11
+ before starting, and **auto-decommissions** when done.
12
+
13
+ Use `/stage` as the normal path for local previews, smoke tests, and Playwright targets. If the user
14
+ already asked to run or preview the app, that is enough authorization to start it; when intent is unclear,
15
+ ask before creating or destroying a stage. Manual dev-server commands are allowed when the user explicitly
16
+ wants a bypass or when a bounded diagnostic needs one, but say why. If the stage path itself fails, diagnose
17
+ from `mmi-cli stage --json`, `tmp/stage/state.json`, process/port/container evidence, and file Hub/org-default
18
+ friction instead of silently working around it.
19
+
20
+ The stage recipe comes from one of two sources, picked automatically:
21
+
22
+ - **Registry-derived default** (plumbing-free product repos): a `tenant-container` repo that ships
23
+ `docker-compose.yml` + `.env.example` and has a Hub registry `portRange` needs **no committed `.mmi`**.
24
+ `mmi-cli stage` derives a default compose stage — copy `.env.example` → `.env`, run `docker compose build
25
+ --no-cache`, run `docker compose up -d`, choose a free port from the registry range, and report the local
26
+ URL (e.g. `http://127.0.0.1:3700/`). The commands are shell-aware (PowerShell `Copy-Item` +
27
+ `$env:KEY='value'`; bash POSIX), and `--apply` runs them cross-shell.
28
+ - **Local recipe** (optional): repo configuration under `stage` — `{ build, up, healthUrl, tools[] }` in a
29
+ local `.mmi/config.json`. That file must not carry board, deploy, secret, or project registry facts. A
30
+ POSIX-only recipe (`cp -n … && VAR=value …`) is treated as **stale** on a PowerShell host: `/stage` ignores
31
+ it and uses the registry-derived default instead of failing in the wrong shell.
32
+
33
+ ## Step 0 — inspect the plan
34
+
35
+ ```bash
36
+ mmi-cli stage --json
37
+ ```
38
+
39
+ The JSON reports `source` (`derived` / `local` / `none`) and, when derived, the local `url`. `source: none`
40
+ means neither a usable local recipe nor a derivable default exists — the message names the missing fact
41
+ (deployModel, `docker-compose.yml`, `.env.example`, or registry `portRange`). That gap does not mean the
42
+ repo's Hub registry/project setup is missing.
43
+
44
+ ## Step 1 — run the stage
45
+
46
+ A stage is **per worktree**. The CLI force-stops only the previous stage **in this worktree**, runs
47
+ `stage.build`, starts `stage.up`, records `tmp/stage/state.json`, picks a free port from the registry
48
+ range (skipping ports reserved by sibling worktrees), and polls `stage.healthUrl` when configured.
49
+ Use `--port` to pin a port when needed:
50
+
51
+ ```bash
52
+ mmi-cli stage run --apply
53
+ mmi-cli stage run --apply --port 5180
54
+ ```
55
+
56
+ Use a larger bound when the repo's local stack is known to be slow:
57
+ ```bash
58
+ mmi-cli stage run --apply --timeout-ms 120000
59
+ ```
60
+
61
+ All stage artifacts (build output, screenshots, Playwright traces, local DB files) stay under `tmp/stage/`
62
+ — never tracked.
63
+
64
+ A local stage is bound to the worktree that started it. Concurrent worktrees on one machine each keep
65
+ their own stage on separate ports — you do not need to stop one before starting another. Saga continuity
66
+ keys on branch; use a distinct North Star slug per parallel grind or feature. Stage JSON/state records
67
+ the starting `cwd` plus git branch/commit when available.
68
+
69
+ ### Step 1a — post-smoke panel (when criteria exist)
70
+
71
+ When grinding or the user supplied **acceptance criteria** (from the issue body at Gate 1 — not
72
+ ad-hoc chat text), run a **Budget-routing panel** on observable stage signals before teardown:
73
+
74
+ 1. **Panel** (parallel):
75
+ - **requirements-match** (budget tier) — does the staged URL/behavior meet the criteria?
76
+ - **runtime-health** (budget tier) — console errors, failed `healthUrl`, broken UI signals
77
+ *(smoke observability — not the grind `correctness` hard lens)*
78
+ - **tests-actually-test** (budget tier) — if Playwright ran, did it exercise the changed path?
79
+ 2. **Synthesize** → `PanelReport` per `skills/grind/templates/synthesize-panel.md`.
80
+ 3. Feed the result back to the active `/grind` loop or report to the human. A non-empty
81
+ `PanelReport.blockers` means the stage failed smoke — do not claim the grind criterion met.
82
+ This panel is **not** a security clearance — grind Phase 2 still runs the `security` hard lens.
83
+
84
+ Skip when `/stage` is ad-hoc preview with no criteria.
85
+
86
+ ## Step 2 — stop when done
87
+
88
+ ```bash
89
+ mmi-cli stage stop --apply
90
+ ```
91
+
92
+ Stop the stage when the work is done, before switching context, or before replacing it with another stage.
93
+ If the user clearly wants the preview to stay up, leave it running and report that. The next `/stage` also
94
+ stops the previous recorded stage before starting, so a stale server does not linger between runs. For the
95
+ registry-derived Docker Compose default, stop also runs the recorded compose teardown (`docker compose down`)
96
+ from the original stage working directory.
97
+
98
+ ## /stage --live — personal cloud dev stage
99
+
100
+ dev.x stages are **not standing environments**: without `--live` the dev stage is dark. `--live`
101
+ deploys the **current branch** to the project's dev runtime and serves it **only to your public IP** —
102
+ gated at the **Cloudflare edge** (#1761). The CLI detects your IP, dispatches the central
103
+ `tenant-deploy.yml` (stage=dev), then `tenant-control.yml` `cf-gate-allow` (an ephemeral Cloudflare WAF
104
+ rule scoped to your dev host + IP). The box no longer IP-gates dev. No SSH from your machine; everything
105
+ moves through the central workflows.
106
+
107
+ ```bash
108
+ mmi-cli stage --live # dry-run plan
109
+ mmi-cli stage --live --apply # deploy + gate your IP at the Cloudflare edge
110
+ ```
111
+
112
+ Tear it down when done — the runtime stops and the Cloudflare edge gate is removed:
113
+
114
+ ```bash
115
+ mmi-cli stage --live --down --apply
116
+ ```
117
+
118
+ Personal dev stages only — rc/live environments still move exclusively through the promotion train.
119
+
120
+ ## Step 3 — report
121
+
122
+ The stage URL, what's running (server + tools), the workspace path (`tmp/stage/`), and the teardown command.
123
+
124
+ ## Notes
125
+
126
+ - `/stage` is local — no AWS, no deploy, no board or version effect. The one cloud exception is
127
+ `--live`: an on-demand **dev** stage of your branch, gated to your IP at the Cloudflare edge (above).
128
+ - `/stage-live` is not an org command: remote rc/live environments move only through `/rcand`, `/release`, and `/hotfix`.
129
+ - Everything is gitignored; `/stage` never produces a tracked change.
130
+ - **Playwright MCP output goes to `tmp/`**, never the repo root: if you drive the Playwright MCP server,
131
+ pass `--output-dir tmp/playwright-mcp` (or point its output there). `.playwright-mcp/` is kept gitignored
132
+ by the org `.gitignore` managed block (`mmi-cli doctor`) as a safety net, so a stray default capture is
133
+ never tracked.
134
+ - `tools[]` is declarative for now; stage hardening starts/stops the main configured process. Repos with
135
+ extra local services should encode them behind `stage.up` until a tool runner is added.
136
+ - **Stale Docker bundle:** the registry-derived Docker Compose default builds with `docker compose build
137
+ --no-cache` before `up`. If the browser still serves an old bundle, run `mmi-cli stage stop --apply`, rerun
138
+ `/stage`, then inspect `tmp/stage/state.json` identity, container image labels, and compose build inputs.
139
+ - **Stale `.env`:** when `.env` already exists from a prior `/stage` run, `stage run` does **not** refresh it
140
+ from an updated `.env.example` — it warns on stderr and keeps the stale file. Delete `.env` (or merge in the
141
+ new keys by hand) when `.env.example` changes, then re-run `/stage`.
142
+
143
+ ## Retro — one check before you finish
144
+ Before your final report, answer one question honestly: did **this skill's own instructions** misfire
145
+ this run — ambiguous wording, a misleading message, or an environment failure it should have warned
146
+ about? (Process only — never the user's code or task; e.g. a teardown that left a port bound, or a
147
+ Playwright output path aimed at the repo root.) If yes, file **one** lesson and move on; a clean run is
148
+ silent (hard cap: one per run). It lands on the Hub board (deduped) and is fixed only via a reviewed PR —
149
+ never edit the skill live; the retro is advisory, so if the call fails, note it and continue:
150
+ `mmi-cli skill-lesson --skill stage --title "<what misfired>" --body "<what; evidence; proposed amendment>"`