Skip to content

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

Merged
Kamirus merged 7 commits into
mainfrom
feat/mops-deployed
Jun 16, 2026
Merged

feat(cli): add mops deployed post-deploy hook + init bootstrap#562
Kamirus merged 7 commits into
mainfrom
feat/mops-deployed

Conversation

@Kamirus

@Kamirus Kamirus commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

What

Implements the mops deployed spec (the specs/mops-deployed.md draft is removed in this PR now that the command exists).

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 <build-dir>/<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 --build-dir.
  • 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

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

Skill docs (closes #558)

Updates the mops-cli skill to cover the three gaps from #558: why check-stable matters (a local pre-deploy version of ICP's upgrade-time compatibility check), the per-deploy .most maintenance workflow (now mops deployed), and how to bootstrap the baseline for both new and already-deployed canisters.

Out of scope

  • .did handling — interface-change-driven, lives in mops generate candid.
  • Per-canister directory override, per-environment dirs, deployed-manifest fields — possible v2 follow-ups.

Closes #558

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 and docs/skills/changelog updates.
Code Quality Reuses resolveCanisters helpers and extracts shared resolveBuildOutputDir; useTempFixtures consolidates temp-fixture setup used by migrate tests.
Consistency Canister selection matches mops build/check; CLI docs, 09-mops.toml.md, changelog, and skill are in sync.
Security Local file copy/write only; no chain reads, identity, or package-registry surface.
Tests Broad coverage (init idempotency, overrides, warnings, multi-canister, E2E with check-stable); snapshot for main init path, targeted assertions for errors.
Maintainability Clear separation in deployed.ts; draft specs/*.md removed after implementation (candid spec paired with already-shipped mops generate candid).

Verdict

Decision: APPROVE
Risk: Low
Reason: The new command is additive, well-tested, and follows existing CLI/config patterns with no correctness or regression issues identified relative to the base SHA. Draft spec cleanup is intentional housekeeping, not a behavioral change.


Generated for commit 7d1271b

Kamirus and others added 5 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>
… spec

`--output` named the directory `mops deployed` *reads* built `.most` files
from, which read as the opposite of its role (and clashed with `mops build
--output`, where the same dir is written). `--build-dir` names what the
directory is, not its in/out role.

Also remove specs/mops-deployed.md now that the command is implemented.

Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve conflicts in cli/CHANGELOG.md and .agents/skills/mops-cli/SKILL.md
(keep both `mops deployed` and `mops generate candid` entries; drop the
unreleased bullets that main released under 2.14.0). Re-add the `Config`
import to build.ts that main's moc-args refactor dropped. Remove
specs/mops-candid.md, implemented by `mops generate candid` (#563).

Co-authored-by: Cursor <cursoragent@cursor.com>
The merge of origin/main truncated the released ## 2.14.0 section: six
bullets (toolchain --help, update/outdated --patch, install integrity
message, vessel.dhall deprecation, install race fix, smol-toml) were
git's common-context lines after the conflict marker and got removed
along with the marker. Restore them verbatim from main; CHANGELOG now
differs from main only by the new `mops deployed` entry under ## Next.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Kamirus Kamirus enabled auto-merge (squash) June 16, 2026 11:40
@Kamirus Kamirus disabled auto-merge June 16, 2026 11:40
State why check-stable matters (local pre-deploy version of ICP's
upgrade-time compatibility check) and how to bootstrap the baseline
`.most` for both new and already-deployed canisters.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Kamirus Kamirus enabled auto-merge (squash) June 16, 2026 11:47
@Kamirus Kamirus merged commit 170bee2 into main Jun 16, 2026
28 checks passed
@Kamirus Kamirus deleted the feat/mops-deployed branch June 16, 2026 11:52
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.

mops-cli skill: explain the benefit of check-stable and the .most file maintenance workflow

1 participant