Skip to content

Commit 0c60897

Browse files
feat(cli): os skills install, update and status at the server's version, with or without a project (#35060)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} --> _Requested by **Yibo Wang** · [project thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwBQ3DFv6XZAspQRYGQoEWhr8)_ Fixes #34773 Clause-②: yes (widening: a new published CLI command group, `os skills install | update | status`) Metadata-protocol: none ## 维护者速读 - 改了什么:新增 `os skills install / update / status` 三个命令,在有或没有项目的目录里,把已发布的 `@objectstack/skills` 按服务器版本装进 `.claude/skills/`,并能更新和核对;MCP 开放服务的安装提示改为这条命令。 - 为什么改:只连了 MCP 客户端的用户没有办法装技能,有项目的用户升级后也没有命令刷新技能,本地知识会悄悄落后于服务器。 - 风险与回滚:新增命令,不改已有命令;`update` 只动自己装过的技能,用户自己的技能目录从不触碰;回滚即撤销本 PR。 - 先看:`packages/cli/src/utils/skills-command.ts`(拒绝条件与写入顺序)、`packages/cli/src/utils/skills-install-state.ts`(`planSkillsWrite` 的归属判断)、`packages/cli/src/utils/skills-catalog.ts`(`npm pack` 读取与 tar 解包)。 - 两分钟验证:在空目录运行 `node packages/cli/bin/run.js skills install --version 18.5.0`,预期装入 11 个技能并写出 `.claude/skills/.objectstack-skills.json`;再运行 `skills status --version 18.6.0 --check`,预期退出码 1 并提示版本不一致。 - 需要你做的:无,席位落地。 ## What changes - **`os skills install`** copies the published `@objectstack/skills` catalog at one version into the agent's skills directory (`.claude/skills/` under the current directory, `--dir` overrides). It works in an empty directory with no `package.json`, and in a project; it reads and writes no `package.json`. - Version, in order, and the output names which: `--version V` (exact; ranges and tags refused), else `--target T` (a target environment URL or a restriction profile file, read by the same `loadRestrictionProfile` as `os validate --target`, taking `versions.skills`), else the CLI's own version. `@objectstack/skills` and `@objectstack/cli` are in one `fixed` group of `.changeset/config.json`, so the CLI's version names the catalog written for it. - Source: the tarball at exactly that version, read with `npm pack` in the current directory, so the user's `.npmrc` files and `npm_config_*` variables (registry, scope mapping, credentials, proxy) apply; there was no existing registry helper to reuse. No third-party installer. The tarball is unpacked in process (`readTarGz`: ustar, prefix, pax `path`, GNU long name, checksum checked), and only `package/dist/skills/NAME/**` for each NAME holding a `SKILL.md` is kept. The tarball must declare `@objectstack/skills` at the requested version; a link, a path leaving the tree, or an empty catalog is refused. A version the registry does not publish is refused with a sentence naming it. - What was written is recorded in `.objectstack-skills.json` beside the skills: package, version, every file of every catalog skill with its SHA-256. - An existing recorded catalog is refused (names `os skills update`). A same-named directory the record does not name (for example one `skills experimental_sync` copied) is refused, naming it; `--force` replaces it ("adopted" in the output). - **`os skills update`** moves the recorded catalog to the resolved version: replaces each recorded skill, removes recorded skills the new version dropped, adds new ones. A skill directory the record does not name is never written, replaced or removed: a new catalog skill whose name collides with one is refused even under `--force`. A recorded skill changed locally is refused, naming the files, unless `--force`. No record: refused, naming `os skills install`. - **`os skills status`** reports installed versus expected version (same order), `missing`, `modified` (changed / removed / added files) and `extra` (directories the record does not name: listed, never judged). Mismatch = no record, another version, or any missing or modified skill. Exits 0; with `--check`, 1 on a mismatch. The registry is not read. All three commands take `--json` (one document on stdout). - **`@objectstack/mcp`**: the open server's `initialize` skills install line now reads `... install that version into the agent's skills directory with the ObjectStack CLI, with or without a project: os skills install --version VERSION (where the CLI is not installed: npx -p @objectstack/cli@VERSION os skills install --version VERSION).` instead of `pnpm add -D @objectstack/skills@VERSION`, which needed a project. The README describes the new line. The #34686 line is not yet on npm (`@objectstack/mcp` 18.5.0 tarball carries no `Published skills` text, published 2026-11-15), so the pending #34686 changeset is corrected to name the new command (see DELIBERATE CORRECTION below) rather than this changeset declaring a same-release supersession. - Registration: the `skills` topic in `packages/cli/package.json` `oclif.topics`. - Docs: `content/docs/deployment/cli.mdx` gains a `### Skills` section (all three commands, flags table); `content/docs/ai/skills.mdx` leads its install section with `os skills` for users with and without a project, keeps the `experimental_sync` path, and names `install --force` to move a synced project over; `content/docs/ai/connect-mcp.mdx` describes the new install line and the MCP-only path. - Changeset `.changeset/34773-os-skills-install.md`: `@objectstack/cli` and `@objectstack/mcp` `patch` (Metadata-protocol `none` takes `patch`, per the Check Changeset level axis). ## Tests - `packages/cli/test/skills-commands.test.ts` (unit tier), 22 tests. Seams: `skillsRegistry.fetchTarball` (the registry, answering tarballs the test builds or "not published") and `fetch` (the target's published restriction profile). No network. - Done when: in an empty directory with no `package.json`, `install --target URL` installs the server's version; after the server's profile moves to 18.6.0, `status --target URL --check --json` exits 1 with `installedVersion 18.5.0, expectedVersion 18.6.0, mismatch true`. - Install into an empty dir (files land, the catalog README does not, record names version and every file); `--dir`; version order (`--version`, target URL, target file, CLI fallback, and `--version` with `--target` refused); unknown version refused and nothing written; non-exact version refused before the registry is asked; install over a record refused; conflict refused then `--force` adopts. - Update: replaces, removes dropped, adds new, leaves `my-own` untouched; a new catalog skill colliding with a user directory refused even with `--force`; local edit refused unless `--force`; no record refused. - Status: match, version mismatch (0 by default, 1 with `--check`), missing/modified/extra with only missing and modified counting, nothing installed. - Tarball reader: long path via ustar prefix, other-version refusal, link and traversal refusal, empty catalog refusal. - `packages/mcp/src/initialize-selection-rule-34686.test.ts`: new case pins `os skills install --version OWN_VERSION`, the `npx -p @objectstack/cli@OWN_VERSION` form and no `pnpm add`. Red first against the old line, then green. <details><summary>Run readings (head bec9bdc)</summary> - `pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2 test/skills-commands.test.ts`: Test Files 1 passed, Tests 22 passed (VERDICT command-exit 0). - Red first, MCP pin before the line changed: `× names os skills install --version at that version, and no project-only install` — `AssertionError: expected 'ObjectStack MCP Server. The tools thi…' to contain 'os skills install --version 18.5.0'`, Tests 1 failed / 7 passed. After the change: 8 passed. - `pnpm --filter @objectstack/mcp test && pnpm --filter @objectstack/mcp typecheck`: Test Files 71 passed, Tests 1254 passed; `check:test-typecheck: OK`; VERDICT command-exit 0. - `pnpm --filter @objectstack/cli typecheck`: `check:test-typecheck: OK — @objectstack/cli's test layer compiles`; VERDICT command-exit 0. - `pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2`: Test Files 427 passed (427), Tests 6085 passed (6085); VERDICT command-exit 0. The `integration` tier is declared to CI: the diff touches no integration-tier file, no `bin/` entry and no `test/helpers/serve-process.ts`. - Ablation A1 (update ownership): `planSkillsWrite`'s conflict branch replaced with `else if (false) conflicts.push(name); /* ABLATION-A1 */` via `scripts/ablation-replace.mjs` (anchor 1 → 0, blob 0b64350 → 9c901ed004bf). Red: `install refuses a same-named directory it did not install, and --force adopts it`, `update never touches a directory it did not install`; Tests 2 failed / 20 passed. Restored: blob == HEAD, `git diff HEAD` empty. A first A1 attempt replaced the line with an `else` that left a dangling `else` (transform error, "no tests"): a vacuous run, discarded and rerun as above. - Ablation A2 (status mismatch): `mismatch: !versionMatches || missing.length > 0` → `mismatch: /* ABLATION-A2 */ missing.length > 0` (blob f1cef08 → a70e150850d1). Red: the Done-when test, `status: a version mismatch exits 0 by default and 1 with --check`, `status with nothing installed`; Tests 3 failed / 19 passed. Restored: blob == HEAD, `git diff HEAD` empty. - Live, against the real registry (not a test): in an empty scratch directory, `node packages/cli/bin/run.js skills install --version 18.5.0` installed 11 skills (`objectstack-data` byte-identical, `diff -r`, to the `npm pack` tarball's `dist/skills/objectstack-data`); `status --version 18.5.0 --check` exit 0; `status --check` (CLI fallback 18.5.0) exit 0; `update --version 99.0.0` exit 1, `@objectstack/skills 99.0.0 is not published on the npm registry this environment uses (npm pack @objectstack/skills@99.0.0: No matching version found for @objectstack/skills@99.0.0.). Nothing was written.`; `update --version 18.4.0` exit 0, then `status --check` exit 1, `The catalog is 18.4.0, not 18.5.0`. </details> ## Review round (S1, S2, S3, N1) - **S1, paths stay under the skills directory.** A tarball path segment, a recorded skill name and a recorded file path are refused when a segment is empty, `.`, `..`, or holds a backslash or a colon (`isSafePathSegment`, `skills-catalog.ts`). `applySkillsWrite` resolves every target (dropped skills, skill roots, files) and refuses any that does not lie strictly under the skills root, before the first write. - **S2, malformed records are refused whole.** `readSkillsManifest` validates recorded skill names with the catalog's own `SKILL_NAME` rule and recorded file paths with the S1 segment rule, so an empty name can no longer make `update --force` remove the skills directory itself. - **S3, Windows `npm pack`.** The invocation is built by `npmPackInvocation`; under `shell: true` (win32) the `--pack-destination` path is quoted, so a temp path with a space stays one argument. - Red first: commit e5b66d7 adds the pins and moves the invocation into `npmPackInvocation` with behaviour unchanged; `test/skills-commands.test.ts` then reads 5 failed / 25 passed: `refuses a Windows separator or a drive letter in a path segment`, `refuses a catalog file whose target resolves outside the skills directory, and writes nothing there`, `refuses a record naming a skill or a file with a Windows separator or a drive letter`, `on Windows runs through a shell and quotes the destination, so a path with a space stays one argument`, `a malformed record is refused whole > an empty skill name` (the `..` and backslash-name rows were already refused and stay as controls). Commit bbb4b55 fixes them: 30 passed; `pnpm --filter @objectstack/cli typecheck` exit 0. ## DELIBERATE CORRECTION `.changeset/34686-initialize-selection-rule.md` is a pending release note (not yet on npm: the `@objectstack/mcp` 18.5.0 tarball carries no `Published skills` text) that this PR makes false, so it is corrected here and `check-empty-changeset` stays red on it by design. Its install-line bullet now reads: "**The skills install line**: `Published skills: @objectstack/skills <version>` with the command that installs it into the agent's skills directory, with or without a project, `os skills install --version <version>`, at this package's own version (released together with `@objectstack/skills`), not the `version` option." The sentence in `.changeset/34773-os-skills-install.md` that said this PR supersedes the `pnpm add -D` wording in the same release is removed, since that wording no longer ships. ## Acceptance notes - **"Active target".** `os validate --target` has no default target, so there is no implicit active target to reuse; the order is `--version`, `--target`, the CLI's version. Not invented here. - **An open-source server does not publish its skills version over HTTP.** `RESTRICTION_PROFILE_ROUTE` (`/api/v1/discovery/restriction-profile`) is served by cloud only (its docblock in `restriction-profile.ts`), so `--target http://localhost:3000` against `os dev` is refused by the validate reader's own 404 sentence. For an open server the version reaches the user through the MCP `initialize` line, which now carries `--version VERSION`. Noted, not filed: it is the reader's existing behaviour. - **`/mcp/skill` carries no install line.** The order said the install line rides `initialize` and `/mcp/skill`; on `a841e26b23` only `skillsInstallLine` in `mcp-server-runtime.ts` (the `initialize` text) carries it (`git grep "Published skills"`: one source hit). Only that one changed. - The `skills-reference.mdx` page and `packages/skills/README.md` still document the `pnpm add -D` plus `experimental_sync` path, which keeps working; `skills.mdx` now leads with `os skills`. Left for the skills lane. <details><summary>Verification (local gate subset, head bec9bdc)</summary> - `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack`: 118 families derived from `objectstack-ai/objectstack` at `bec9bdc5cb`. All 118 run, exit codes captured before any pipe; `--ran` reconciliation: `118 derived, 115 run, 3 NOT-MEASURED, 0 UNRUN`. - NOT MEASURED (exit 3, prerequisite not met, left to CI): `check:skill-examples` (needs `@objectstack/client-react` built), `check:dual-build-cjs-loads` (needs a full build), `check:i18n-coverage` (`examples/app-showcase` config failed to lint without a full build). - Every other derived family exit 0, including `check:cli-command-ids` (`1401 command-id literal(s) across 461 file(s) outside packages/cli all resolve`, 115 ids derived), `check:cli-examples-parity`, `check:cli-test-child-env`, `check:doc-anchors`, `check:doc-authoring`, `check:docs-transcript-drift`, `check:nul-bytes`, `check:published-files`, `check:changeset-fixed`, `check-empty-changeset`, `check-changeset-no-major` (base axis), `check:test-source-alias`, `check:cross-package-test-inputs`. - `node scripts/pm/overlap-check.mjs --branch=claude/issue-34773-os-skills-install`: `VERDICT clean exit 0` (origin/main merges cleanly; #34717 and #33849 share `packages/cli/package.json`, both merge cleanly). - `node scripts/pm/check-governed-merges.mjs --branch claude/issue-34773-os-skills-install`: `0 of 15 path(s) hit the register`, NOT governed; 1518 changed lines. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01WGufzgNCAXyGfBQFZBwixH)_ <!-- signed: repo:objectstack#3 · os-support-ai · session_01WGufzgNCAXyGfBQFZBwixH --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 59defa0 commit 0c60897

16 files changed

Lines changed: 1605 additions & 14 deletions

‎.changeset/34686-initialize-selection-rule.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ A client connected to the open MCP server over HTTP was told one sentence at `in
1212
When neither the host's per-request text nor the plugin's `instructions` option answers, `result.instructions` now carries, after that sentence:
1313

1414
- **The selection rule**, only where the request registers both `list_datasets` and `query_dataset` (a bridge with the dataset members and a grant that admits `data:read`; an API key or session counts): look for a governed metric first with `list_datasets` and the question's business words; a word matches only an equal name, label or synonym; one measure match answers through `query_dataset`; several matches are a question for the user; no match falls back to `query_records` / `aggregate_records` and says the answer is not from a governed metric. A grant without `data:read` gets no dataset sentence.
15-
- **The skills install line**: `Published skills: @objectstack/skills <version>` with its `pnpm add -D` command, at this package's own version (released together with `@objectstack/skills`), not the `version` option.
15+
- **The skills install line**: `Published skills: @objectstack/skills <version>` with the command that installs it into the agent's skills directory, with or without a project, `os skills install --version <version>`, at this package's own version (released together with `@objectstack/skills`), not the `version` option.
1616

1717
Host-injected instructions and the `instructions` option are served exactly as before, with nothing appended. The stdio server's instructions are unchanged.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
'@objectstack/cli': patch
3+
'@objectstack/mcp': patch
4+
---
5+
6+
feat(cli): `os skills install | update | status` install, update and check the published skills catalog at the server's version, with or without a project
7+
8+
Clause-②: yes (widening: a new published CLI command group, `os skills install | update | status`)
9+
Metadata-protocol: none
10+
11+
Nothing installed the published skills catalog except `create-objectstack`'s scaffold-time sync, so a user who only connected an MCP client had no way to install it, and a project had no command to refresh it after an upgrade.
12+
13+
- **`os skills install`** copies `@objectstack/skills` at one version into the agent's skills directory (`.claude/skills/` under the current directory, or `--dir`), in an empty directory or in a project; no `package.json` is read or written. The version is `--version` (exact), else the target environment's (`--target`, a URL or a restriction profile file, read exactly as `os validate --target` reads it), else the CLI's own version (the two are released together); the output names which. The tarball is read with `npm pack` from the registry the environment configures, and only `dist/skills/<name>/` is copied. A version the registry does not publish is refused, naming it. What was written is recorded in `.objectstack-skills.json` beside the skills.
14+
- **`os skills update`** moves the recorded catalog to another version: it replaces the catalog's skills, removes those the new version dropped, and never writes, replaces or removes a skill directory it did not install. A catalog skill changed locally is refused unless `--force`.
15+
- **`os skills status`** reports the installed version against the expected one, plus missing, modified and extra skills; it exits `0`, or `1` on a mismatch with `--check`. All three take `--json`.
16+
17+
`@objectstack/mcp`: the open server's `initialize` skills install line now names `os skills install --version <version>` (and its `npx -p @objectstack/cli@<version>` form for a machine without the CLI) instead of `pnpm add -D @objectstack/skills@<version>`, which needed a project.

‎content/docs/ai/connect-mcp.mdx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,14 @@ such sentence.
301301

302302
The instructions also name the published skills package and the version to
303303
install, which is the server's own version
304-
(`Published skills: @objectstack/skills <version>`, with
305-
`pnpm add -D @objectstack/skills@<version>`); see
306-
[Skills](/docs/ai/skills) for syncing it into your agent. A deployment that sets
304+
(`Published skills: @objectstack/skills <version>`), with the command that
305+
installs it into your agent's skills directory, with or without a project:
306+
`os skills install --version <version>`, or
307+
`npx -p @objectstack/cli@<version> os skills install --version <version>` where
308+
the CLI is not installed. If you only connected an MCP client and have no
309+
project, run it in the directory your agent works in; it writes
310+
`.claude/skills/` there (`--dir` names another). See
311+
[Skills](/docs/ai/skills#installing-skills) for updating and checking it. A deployment that sets
307312
the MCP plugin's `instructions` option serves that text as written instead, and
308313
the local stdio server's instructions carry neither part.
309314

‎content/docs/ai/skills.mdx‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,29 @@ See [Agents](/docs/ai/agents#you-extend-the-platform-with-skills-not-agents) for
2626

2727
## Installing skills
2828

29-
Skills ship as the npm package `@objectstack/skills`, released with the other `@objectstack/*` packages at one shared version. Install it at your installed `@objectstack/spec`'s version — the catalog's version is then your spec's — and copy it from `node_modules` into your agent's directory, the two steps `create-objectstack` runs when it scaffolds a project:
29+
Skills ship as the npm package `@objectstack/skills`, released with the other `@objectstack/*` packages at one shared version. The CLI installs the catalog at the version your server runs into your agent's skills directory, with or without a project — no `package.json` is read or written:
30+
31+
```bash
32+
os skills install # this CLI's version: the catalog written for it
33+
os skills install --target https://acme.example.com # the version a target environment runs
34+
os skills install --version 18.5.0 # the version an MCP server's instructions name
35+
```
36+
37+
The skills land as real files in `.claude/skills/` under the current directory (`--dir` names another agent's directory), beside a record of what was installed, `.objectstack-skills.json`. The catalog is read from the npm registry your environment configures; a version it does not publish is refused, naming it.
38+
39+
**With no project.** If you only connected an MCP client, the server's `initialize` instructions name its version and the command, `os skills install --version <version>`. Run it in the directory your agent works in; without the CLI installed, `npx -p @objectstack/cli@<version> os skills install --version <version>` does the same.
40+
41+
**After an upgrade.** The catalog is versioned and updated as **one unit**, with ObjectStack itself. `os skills status` reports the installed version against the expected one (the same `--version` / `--target` / CLI order), plus catalog skills that are missing or modified and skill directories of your own (`--check` exits `1` on a mismatch, for CI). `os skills update` moves the catalog to the expected version: it replaces the catalog's skills, removes those the new version dropped, and never touches a skill it did not install. Commit `.claude/skills/` with the project. See the [CLI reference](/docs/deployment/cli#skills) for every flag.
42+
43+
A project can also depend on the package and sync it from `node_modules` with the third-party skills CLI, the two steps `create-objectstack` runs when it scaffolds a project:
3044

3145
```bash
3246
pnpm add -D "@objectstack/skills@$(node -p "require('@objectstack/spec/package.json').version")"
3347
# npm: npm install --save-dev "@objectstack/skills@…" · yarn: yarn add -D "@objectstack/skills@…"
3448
npx skills@1.7.2 experimental_sync --agent claude-code --copy -y
3549
```
3650

37-
Add the package with the manager that installed the project: in a pnpm project, `npm install --save-dev` exits `1` with `npm error Cannot read properties of null (reading 'edgesOut')`.
38-
39-
The skills land as real files in `.claude/skills/`; commit them with the project, and keep `--copy` — without it they are links into `node_modules`, which a clone does not have. Name your own runtime after `--agent` (`codex`, `cursor`, …). The catalog is versioned and updated as **one unit**, with ObjectStack itself: bump `@objectstack/skills` with the other `@objectstack/*` packages, then re-run the sync. The package is published from `18.0.0-next.0` on (there is no 17.x release); for what the sync writes, the versions, the one scaffolder that is an exception and the `next` channel, see the [AI Skills Reference](/docs/ai/skills-reference#installing-skills).
51+
Add the package with the manager that installed the project: in a pnpm project, `npm install --save-dev` exits `1` with `npm error Cannot read properties of null (reading 'edgesOut')`. Keep `--copy` — without it the skills are links into `node_modules`, which a clone does not have — and name your own runtime after `--agent` (`codex`, `cursor`, …). To move such a project to `os skills`, run `os skills install --force`: it replaces the synced directories of the same names with the catalog's and records them. The package is published from `18.0.0-next.0` on (there is no 17.x release); for what the sync writes, the versions, the one scaffolder that is an exception and the `next` channel, see the [AI Skills Reference](/docs/ai/skills-reference#installing-skills).
4052

4153
---
4254

‎content/docs/deployment/cli.mdx‎

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3679,6 +3679,89 @@ the grant, use the environment's console: **Account → Connect an AI Assistant*
36793679
| `-s, --server <url>` | `OS_CLOUD_URL` | Control-plane URL. Default `https://cloud.objectos.ai`, or the URL recorded by `os cloud login` |
36803680
| `-t, --token <key>` | `OS_CLOUD_API_KEY` | Bearer token, used only to find the environment; `$OS_TOKEN` and `~/.objectstack/cloud.json` are the fallbacks |
36813681

3682+
### Skills
3683+
3684+
The published skills catalog (`@objectstack/skills`, see [AI Skills](/docs/ai/skills))
3685+
installed into, updated in and checked against your coding agent's skills
3686+
directory. All three work in an empty directory as well as in a project: no
3687+
`package.json` is read or written.
3688+
3689+
| Command | Description |
3690+
|---------|-------------|
3691+
| `os skills install` | Copy the catalog at one version into the skills directory, and record what was written |
3692+
| `os skills update` | Move the recorded catalog to another version; skills it did not install are never touched |
3693+
| `os skills status` | Report the installed catalog against the expected version: missing, modified and extra skills |
3694+
3695+
**Which version.** `--version <v>` (an exact version), else `--target <t>` —
3696+
the version the target environment runs, read from its restriction profile
3697+
exactly as [`os validate --target`](#os-validate) reads it (an environment's
3698+
`http(s)` URL, or a profile JSON file) — else this CLI's own version, which is
3699+
the catalog's: the two are released together. The output names which one was
3700+
used. A range or a tag is refused, and so is a version the registry does not
3701+
publish, naming it.
3702+
3703+
**Where from.** The `@objectstack/skills` tarball at exactly that version, read
3704+
with `npm pack` from the npm registry your environment configures (your
3705+
`.npmrc` files and `npm_config_*` variables apply). Only its
3706+
`dist/skills/<name>/` directories are copied.
3707+
3708+
**What is recorded.** `install` writes `.objectstack-skills.json` beside the
3709+
skills: the version and every file of every catalog skill with its hash. That
3710+
record is how `update` and `status` tell the catalog's skills from your own.
3711+
3712+
#### `os skills install`
3713+
3714+
```bash
3715+
os skills install # this CLI's version, into .claude/skills/
3716+
os skills install --version 18.5.0 # the version an MCP server names
3717+
os skills install --target https://acme.example.com # the version a target environment runs
3718+
os skills install --dir .agents/skills # another agent's skills directory
3719+
```
3720+
3721+
A directory that already holds a recorded catalog is refused, naming
3722+
`os skills update`. A skill directory the record does not name but which shares
3723+
a catalog skill's name (for example one an earlier `skills experimental_sync`
3724+
copied) is refused, naming it; `--force` replaces it with the catalog's.
3725+
3726+
#### `os skills update`
3727+
3728+
```bash
3729+
os skills update # this CLI's version
3730+
os skills update --target https://acme.example.com # the version a target environment runs
3731+
os skills update --version 18.6.0
3732+
```
3733+
3734+
Replaces each recorded skill at the new version and removes each one the new
3735+
version no longer ships. A skill directory the record does not name is never
3736+
written, replaced or removed: a new catalog skill whose name one of yours
3737+
already uses is refused, naming it. A recorded skill you changed is refused,
3738+
naming the files; `--force` discards the change. With no recorded catalog the
3739+
command refuses, naming `os skills install`.
3740+
3741+
#### `os skills status`
3742+
3743+
```bash
3744+
os skills status
3745+
os skills status --target https://acme.example.com --check # exit 1 when the catalog is not the target's
3746+
os skills status --json
3747+
```
3748+
3749+
Reports the installed and the expected version (resolved in the order above),
3750+
`missing` (recorded skills whose directory is gone), `modified` (recorded skills
3751+
with a file changed, removed or added) and `extra` (skill directories the record
3752+
does not name — yours, listed and never judged). The registry is not read. A
3753+
mismatch is no recorded catalog, another version, or any missing or modified
3754+
skill: the command exits `0` regardless, and `1` on a mismatch with `--check`.
3755+
3756+
| Flag | Commands | Purpose |
3757+
|---|---|---|
3758+
| `--version <v>` | all three | Exact catalog version (not with `--target`) |
3759+
| `--target <t>` | all three | Target environment URL or restriction profile file whose skills version to use |
3760+
| `--dir <path>` | all three | The skills directory (default `.claude/skills/` under the current directory) |
3761+
| `--json` | all three | One JSON document on stdout |
3762+
| `--force` | `install`, `update` | `install`: replace same-named directories it did not install. `update`: discard local changes to catalog skills |
3763+
| `--check` | `status` | Exit `1` on a mismatch |
3764+
36823765
### Packages
36833766

36843767
The two commands that move a compiled app onto a platform. They target

‎packages/cli/package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@
9696
"secret": {
9797
"description": "Maintain stored secrets: report orphaned rows, re-wrap old ciphertext"
9898
},
99+
"skills": {
100+
"description": "Install, update and check the published ObjectStack skills catalog in your agent's skills directory"
101+
},
99102
"storage": {
100103
"description": "Inspect stored files: report orphaned attachments"
101104
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* `os skills install` — copy the published skills catalog
5+
* (`@objectstack/skills`) at one version into an agent's skills directory, in
6+
* a project or in an empty directory: no `package.json` is read or written.
7+
*
8+
* The version is `--version`, else the target environment's (`--target`, read
9+
* as `os validate --target` reads it), else this CLI's own; the output names
10+
* which. The catalog is the package tarball at exactly that version from the
11+
* npm registry this environment configures (`utils/skills-catalog.ts`). What
12+
* was written is recorded beside it (`utils/skills-install-state.ts`), so
13+
* `os skills update` and `os skills status` can tell the catalog's skills from
14+
* the user's own. A directory that already holds a recorded catalog is
15+
* refused, naming `os skills update`; same-named skill directories the record
16+
* does not name are refused unless `--force` replaces them.
17+
*/
18+
19+
import { Command, Flags } from '@oclif/core';
20+
import { isExitSignal, printError, printHeader, printSuccess } from '../../utils/format.js';
21+
import { runSkillsWrite, skillsCommonFlags, skillsWriteLines } from '../../utils/skills-command.js';
22+
23+
export default class SkillsInstall extends Command {
24+
static override description =
25+
'Install the published ObjectStack skills catalog at the server\'s version into your agent\'s skills directory, with or without a project';
26+
27+
static override examples = [
28+
'$ os skills install # this CLI\'s version, into .claude/skills/',
29+
'$ os skills install --version 18.5.0 # the version an MCP server names',
30+
'$ os skills install --target https://acme.example.com # the version a target environment runs',
31+
'$ os skills install --dir .agents/skills # another agent\'s skills directory',
32+
];
33+
34+
static override flags = {
35+
...skillsCommonFlags,
36+
force: Flags.boolean({
37+
description: 'Replace skill directories this command did not install that share a catalog skill\'s name',
38+
default: false,
39+
}),
40+
};
41+
42+
async run(): Promise<void> {
43+
const { flags } = await this.parse(SkillsInstall);
44+
if (!flags.json) printHeader('Skills install');
45+
try {
46+
const result = await runSkillsWrite({
47+
command: 'install',
48+
version: flags.version,
49+
target: flags.target,
50+
dir: flags.dir,
51+
force: flags.force,
52+
cliVersion: this.config.version,
53+
});
54+
if (flags.json) {
55+
console.log(JSON.stringify(result, null, 2));
56+
return;
57+
}
58+
for (const line of skillsWriteLines(result)) console.log(` ${line}`);
59+
printSuccess(`Installed ${result.added.length + result.adopted.length} skills of @objectstack/skills ${result.version}.`);
60+
} catch (error) {
61+
if (isExitSignal(error)) throw error;
62+
if (flags.json) console.log(JSON.stringify({ ok: false, command: 'install', error: (error as Error).message }, null, 2));
63+
else printError((error as Error).message);
64+
this.exit(1);
65+
}
66+
}
67+
}

0 commit comments

Comments
 (0)