Skip to content

Commit 88ef94c

Browse files
authored
chore: sync mops-cli skill from upstream cli-v2.15.2 (#236)
1 parent b3263cd commit 88ef94c

3 files changed

Lines changed: 80 additions & 16 deletions

File tree

.claude/upstream.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ Upstream file paths are relative to `.agents/skills/<upstream-skill-name>/` in t
5252
## mops-cli
5353

5454
- **Upstream:** https://github.com/caffeinelabs/mops
55-
- **Tag:** cli-v2.14.0
56-
- **Commit:** d448cdf90991c3164cafd8b6d1b39f433ad820b1
57-
- **Last synced:** 2026-06-16
55+
- **Tag:** cli-v2.15.2
56+
- **Commit:** 564a380c945022ef6e47aa85c40197c037e49b83
57+
- **Last synced:** 2026-07-01
5858
- **Upstream file:** `.agents/skills/mops-cli/SKILL.md`
5959
- **icskills-owned sections:** none — body is 1:1 with upstream; only frontmatter differs

evaluations/mops-cli.json

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,45 @@
8383
"Notes the same pin also applies to `mops bench` and `mops watch`"
8484
]
8585
},
86+
{
87+
"name": "check-stable baseline bootstrap",
88+
"prompt": "I'm starting a brand-new mops project and want to enable `check-stable`. There's no deployed version yet, so what do I use as the `.most` baseline for `[check-stable].path`? Just the setup, no deploy steps.",
89+
"expected_behaviors": [
90+
"Uses `mops deployed init <canister>` to bootstrap the empty-actor baseline",
91+
"Explains `mops deployed init` also sets `[check-stable].path` in mops.toml",
92+
"Does NOT tell the user to hand-write a trivial `.most` file (e.g. `// Version: 1.0.0\\nactor { };`)",
93+
"May note the default destination is `deployed/<name>.most`"
94+
]
95+
},
96+
{
97+
"name": "Post-deploy .most promotion",
98+
"prompt": "After I deploy my `backend` canister, how do I keep the `check-stable` baseline in sync with what's actually deployed? Just the command and where it should run.",
99+
"expected_behaviors": [
100+
"Uses `mops deployed backend` (or `mops deployed` for all canisters) after a successful deploy",
101+
"Explains it promotes the built `.most` (from `[build].outputDir`, default `.mops/.build`) to `deployed/<name>.most`",
102+
"Notes it should run in the deploy pipeline immediately after deploy",
103+
"Does NOT claim `mops deployed` regenerates or rebuilds the `.most` (it errors if the source is missing)"
104+
]
105+
},
106+
{
107+
"name": "Regenerating candid interface",
108+
"prompt": "I changed the public interface of my `backend` Motoko canister and want to regenerate its `.did` file. What's the mops command and what does it do? No deploy steps.",
109+
"expected_behaviors": [
110+
"Uses `mops generate candid backend` (or `mops generate candid` for all canisters)",
111+
"Explains it (re)generates the `.did` from the current Motoko source",
112+
"May note the result is committed alongside `mops.toml`",
113+
"Does NOT suggest hand-editing the `.did` file or using `dfx generate`"
114+
]
115+
},
116+
{
117+
"name": "Autofix trimmed migrations with --no-check-limit",
118+
"prompt": "My canister has `check-limit` set on its migration chain, but I need to run `mops check --fix` across the older, normally-trimmed migrations too. How?",
119+
"expected_behaviors": [
120+
"Adds `--no-check-limit` to the command (e.g. `mops check --fix --no-check-limit`)",
121+
"Explains `--no-check-limit` overrides `check-limit` for a single run",
122+
"Does NOT suggest permanently removing or raising `check-limit` in mops.toml as the only option"
123+
]
124+
},
86125
{
87126
"name": "Adversarial: file path to mops check",
88127
"prompt": "I want to type-check my canister. My main file is at src/backend/main.mo. I'll run: mops check src/backend/main.mo. Is that right?",
@@ -117,7 +156,9 @@
117156
"Configure moc flags for my Motoko canister",
118157
"My mops.lock file is stale, what do I do?",
119158
"How do I add a dev dependency with mops?",
120-
"How do I configure the moc toolchain version in mops?"
159+
"How do I configure the moc toolchain version in mops?",
160+
"How do I regenerate the candid .did file for my Motoko canister with mops?",
161+
"How do I keep my check-stable .most baseline in sync after deploying?"
121162
],
122163
"should_not_trigger": [
123164
"Write a Motoko persistent actor with a counter",

skills/mops-cli/SKILL.md

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: mops-cli
33
description: "Manage Motoko projects with the mops CLI — toolchain pinning, dependency management, type-checking, building, and linting. Use when working with mops.toml, mops.lock, running mops commands, adding/removing packages, pinning moc or lintoko versions, checking or building canisters, configuring moc flags, or setting up a new Motoko project."
44
license: Apache-2.0
5-
compatibility: "mops >= 2.14.0"
5+
compatibility: "mops >= 2.15.2"
66
metadata:
77
title: Mops CLI
88
category: Infrastructure
@@ -43,21 +43,16 @@ chain = "src/backend/migrations"
4343
check-limit = 10 # optional — speeds up `mops check` when the chain gets long
4444

4545
[canisters.backend.check-stable]
46-
path = ".old/src/backend/dist/backend.most"
46+
path = "deployed/backend.most"
4747

4848
[build]
4949
outputDir = "src/backend/dist"
5050
args = ["--release"]
5151
```
5252

53-
`check-stable` verifies stable variable compatibility against a `.most` file from the deployed version. For a new project with no prior deployment, create a trivial `.most` file representing an empty actor:
53+
`check-stable` runs ICP's upgrade-time stable-variable compatibility check locally, so incompatible changes fail in `mops check` instead of being rejected when upgrading a live canister. It compares the current code against a `.most` from the deployed version.
5454

55-
```most
56-
// Version: 1.0.0
57-
actor {
58-
59-
};
60-
```
55+
Bootstrap that `.most`: new project → `mops deployed init` (empty-actor baseline); already-deployed canister → build from the deployed commit, then `mops deployed`. After every deploy, run `mops deployed` to promote the just-built `.most` (see [`mops deployed`](#mops-deployed) below).
6156

6257
Optional canister fields: `candid` (path to .did for compatibility checking), `initArg` (Candid-encoded init args).
6358

@@ -109,7 +104,7 @@ mops check -- -Werror # treat warnings as errors
109104

110105
**Always use canister names, not file paths.** Per-canister args from `mops.toml` are applied automatically.
111106

112-
`--fix` applies machine-applicable fixes from both moc and lintoko in one pass. Concurrent `--fix` runs (across processes) serialize automatically via an advisory lock at `.mops/fix.lock` — safe to invoke from multiple agents on the same project.
107+
`--fix` applies machine-applicable fixes from both moc and lintoko in one pass. Concurrent `--fix` runs (across processes) serialize automatically via an advisory lock at `.mops/fix.lock` — safe to invoke from multiple agents on the same project. Read-only files (e.g. frozen migrations) are skipped with a warning, not fixed.
113108

114109
### `mops build`
115110

@@ -122,6 +117,28 @@ mops build -- --ai-errors # pass extra moc flags
122117

123118
Produces `.wasm`, `.did`, and `.most` files in `[build].outputDir` (default `.mops/.build`).
124119

120+
### `mops deployed`
121+
122+
Post-deploy hook — keeps the on-disk `.most` baseline used by `check-stable` in sync with what's actually deployed.
123+
124+
```bash
125+
mops deployed init backend # one-time bootstrap: empty-actor baseline + sets [check-stable].path
126+
mops deployed backend # post-deploy: promotes .mops/.build/backend.most → deployed/backend.most
127+
mops deployed # all canisters
128+
```
129+
130+
Default destination is `deployed/<name>.most`; override with `[deployed].dir` in `mops.toml` or `--dir`. It reads built `.most` files from `[build].outputDir` (default `.mops/.build`); override with `--build-dir`. `mops deployed` errors if the source `.most` is missing — it never regenerates. Run it from your deploy pipeline immediately after a successful deploy.
131+
132+
### `mops generate candid`
133+
134+
```bash
135+
mops generate candid # all canisters
136+
mops generate candid backend # single canister
137+
mops generate candid backend -o <path> # single canister, ad-hoc path
138+
```
139+
140+
(Re)generates the curated `.did` from current Motoko source. With `[canisters.<name>].candid` set, overwrites that file. Without it, writes `<name>.did` next to `main` (e.g. `main = "src/Backend.mo"``src/backend.did`) and sets `[canisters.<name>].candid` in `mops.toml`. Run after every interface change; commit `.did` + `mops.toml` together. Same moc invocation as `mops build`, so the result always passes `mops build`'s subtype check.
141+
125142
### `mops toolchain`
126143

127144
```bash
@@ -144,6 +161,10 @@ Create migration files directly in the `chain` directory.
144161

145162
`check-limit` (optional) caps how many recent chain files `mops check` and `mops lint` consider — useful when the chain grows long and re-checking every old migration slows feedback down. `mops build` is unaffected by `check-limit`. When the limit kicks in, mops stages the included files into `.migrations-<canister>/` next to the `chain` directory (auto-`.gitignore`d). `moc` diagnostics may then print paths there — the real file lives in the `chain` directory with the same name.
146163

164+
Override `check-limit` for a single run with `--no-check-limit` (`mops check`, `mops check-stable`, `mops lint`) — e.g. `mops check --fix --no-check-limit` to autofix older, normally-trimmed migrations. On `mops check` and `mops check-stable`, `--no-check-limit` also suppresses the pending-migration warning.
165+
166+
When `check-limit` is set, `mops check-stable` (and the stable check inside `mops check`) reports if more migrations are pending than the limit allows — as an error if compat failed (replacing the misleading `moc` message), otherwise a warning.
167+
147168
### `mops remove <package>`
148169

149170
```bash
@@ -156,8 +177,8 @@ mops remove base
156177
mops outdated # list outdated dependencies (caret-bound)
157178
mops update # update all within caret bound (no major-version crossing)
158179
mops update core # update specific package within caret bound
159-
mops update --patch # restrict to patch bumps only (mutually exclusive with --major)
160180
mops update --major # allow updates that cross major versions
181+
mops update --patch # restrict to patch bumps only (mutually exclusive with --major)
161182
mops sync # add missing / remove unused packages
162183
```
163184

@@ -187,7 +208,7 @@ mops lint --fix # autofix lint issues
187208
mops lint <name> # filter to .mo files matching <name>
188209
```
189210

190-
When `[canisters.<name>.migrations].check-limit` is set, `mops lint` skips the trimmed chain migrations to match what `moc` sees during `mops check`. To lint a trimmed migration on demand, pass an explicit filter (e.g. `mops lint OldMigrationName`).
211+
When `[canisters.<name>.migrations].check-limit` is set, `mops lint` skips the trimmed chain migrations to match what `moc` sees during `mops check`. To lint a trimmed migration on demand, pass an explicit filter (e.g. `mops lint OldMigrationName`) or `--no-check-limit` to lint the full chain.
191212

192213
### `mops format`
193214

@@ -220,3 +241,5 @@ mops add core
220241
Then configure `[moc].args`, `[canisters]`, and `[build]` in `mops.toml`.
221242

222243
To update tools later: `mops toolchain update moc` or `mops toolchain update` (all tools).
244+
</content>
245+
</invoke>

0 commit comments

Comments
 (0)