Skip to content

feat(cli): add mops deployed post-deploy hook + init bootstrap#562

Open
Kamirus wants to merge 3 commits into
mainfrom
feat/mops-deployed
Open

feat(cli): add mops deployed post-deploy hook + init bootstrap#562
Kamirus wants to merge 3 commits into
mainfrom
feat/mops-deployed

Conversation

@Kamirus

@Kamirus Kamirus commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

What

Implements specs/mops-deployed.md.

After a successful deploy, mops deployed promotes the just-built .most into a committed deployed/<name>.most so mops check-stable compares against the deployed version on the next build. Closes the manual gap that today silently rots the stable-check baseline whenever someone forgets to copy the file.

CLI surface

mops deployed [canisters...]      # post-deploy hook: copy <outputDir>/<name>.most → <dir>/<name>.most
mops deployed init [canisters...] # one-time bootstrap: empty-actor baseline + sets [check-stable].path
  • Source: [build].outputDir (default .mops/.build); override with --output.
  • Destination: new [deployed].dir config (default deployed); override with --dir.
  • Canister selection mirrors mops build / mops check.
  • Missing source → error, never regenerates.
  • Warns when [check-stable].path doesn't point at <dir>/<name>.most so silent baseline drift is visible.
  • init is idempotent and only rewrites mops.toml when something actually changes.

Lifecycle (from the spec)

mops deployed init backend     # once, before first deploy
mops check backend             # every change
mops build backend
icp deploy
  mops deployed backend        # post-deploy hook
git add deployed/ && git commit

Out of scope

  • .did handling — interface-change-driven, lives in mops generate candid (separate spec).
  • Per-canister directory override, per-environment dirs, deployed-manifest fields — all flagged as open questions in the spec for v2.

Made with Cursor

Implements specs/mops-deployed.md. `mops deployed [canisters...]` promotes
the just-built `<outputDir>/<name>.most` into `<deployed-dir>/<name>.most`
so `mops check-stable` always compares against the deployed version.
`mops deployed init` writes an empty-actor baseline and wires
`[canisters.<name>.check-stable].path` to it.

New `[deployed].dir` config (default `deployed`); overridable per
invocation with `--dir`. Source overridable with `--output`.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Kamirus Kamirus requested a review from a team as a code owner June 2, 2026 07:20
@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Cursor AI review

👍 APPROVE — looks safe to merge

Category Assessment Details
Summary Adds mops deployed (post-deploy .most promotion) and mops deployed init (empty-actor baseline + [check-stable].path wiring), with [deployed].dir config, docs, changelog, skill, and Jest coverage.
Code Quality Reuses filterCanisters, resolveCanisterConfigs, resolveConfigPath, and writeConfig; no speculative scope beyond the spec.
Consistency Canister selection, --output/[build].outputDir defaults, and all-canisters-with-no-args behavior mirror mops build / mops check.
Security Local file copy/write only; no chain access, signing, or registry interaction.
Tests Broad coverage (init idempotency, path warnings, config overrides, multi-canister filtering, e2e with check-stable); snapshot used for the primary init happy path, targeted assertions elsewhere.
Maintainability Clear separation of config-relative vs resolved paths; warnings surface baseline drift when [check-stable].path and [deployed].dir diverge.

Verdict

Decision: APPROVE
Risk: Low
Reason: This is an additive, well-documented CLI feature with sensible error handling (missing source fails hard, path mismatches warn) and no breaking changes to existing commands or config. Project sync requirements (types, docs, changelog, skill) are met.


Generated for commit cf80a1b

Kamirus and others added 2 commits June 2, 2026 09:27
…ests

- `mops deployed --output` description disambiguated vs `mops build --output`
- Drop dead `output: options.output` (already in `...options`)
- Add tests for `init` preserving an existing baseline file and for the
  hook reading `[deployed].dir` from config

Co-authored-by: Cursor <cursoragent@cursor.com>
- Extract `resolveBuildOutputDir` from `build.ts`; `mops deployed --output`
  now shares the same precedence (CLI override → [build].outputDir → default).
- Collapse the duplicated canister-validation preamble in `deployed`/`deployedInit`
  into a single `selectCanisters` helper.
- Unify the two `[check-stable].path`-divergence warnings (post-deploy hook
  and `init`) into one `warnIfStablePathDiverges` helper with a single message.
- Hoist the `_tmp_<fixture>_<suffix>` + `afterEach` cleanup pattern out of
  `migrate.test.ts` and `deployed.test.ts` into a shared `useTempFixtures`
  helper in `tests/helpers.ts`.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant