Commit dabd1c5
fix(cli): drop the never-loaded oclif.plugins entries and correct the text that says
Fixes #21285
Clause-②: no
## What this does
`packages/cli/package.json` listed `@oclif/plugin-help` and
`@oclif/plugin-plugins` under `oclif.plugins`, but both were only
`devDependencies`. oclif loads an `oclif.plugins` entry only when the
same name is in `dependencies`, so neither ever loaded. This PR:
- removes the `oclif.plugins` array (no other `oclif` key changes);
- removes the two `devDependencies` (no consumer remains, see H1) and
regenerates `pnpm-lock.yaml` with `pnpm install --lockfile-only`;
- corrects every published text that described the array or said `os
plugins` works (per-site table below);
- rewrites `test/plugin-commands.test.ts` so it pins the new state
instead of the dead array;
- adds `.changeset/21285-drop-dead-oclif-plugins.md` (`patch`,
`@objectstack/cli`).
Maintainer ruling (verbatim):
> 同意:`oclif.plugins`: 里面那两个插件只装在 devDependencies,所以从来没加载过,`os help` 和
`os plugins` 都不是可用命令。我建议删掉这两条配置。
`packages/spec/**` is untouched. That includes `cli-extension.zod.ts`
and its generated page
`content/docs/references/kernel/cli-extension.mdx`, which still say `os
plugins install`. The spec-lane card #21286 carries them, and it remains
open.
## Behaviour: nothing an operator sees changes
Reading script: `node packages/cli/bin/run.js` with `NODE_ENV` unset and
`OCLIF_COLUMNS=120`, run from an empty directory. Each run's stdout,
stderr and exit code were captured. The runs:
- `--help`, `help`, `plugins`, `plugins install
@acme/plugin-marketplace` and `frobnicate`;
- `TOPIC --help` for each of the 32 root-level topics;
- an `@oclif/core` `Config.load` dump: loaded plugins, all 65 command
ids and all 75 topics.
That is 114 files per reading.
| Reading | Tree | Result |
|---|---|---|
| before | base `748b24072`, unmodified | `os --help`: 12 topics + 22
commands. `help`, `plugins` and `plugins install` exit 2 with `command
... not found`. Plugins loaded: `@objectstack/cli` only. |
| **positive control** | base, with the two plugins added to
`dependencies` (mutation through `scripts/ablation-replace.mjs`, restore
proven: blob == HEAD, `git diff HEAD` empty) | **differs** in 9 files,
plus 6 new ones. `os help` exits 0. `os plugins` exits 0 ("No plugins
installed."). The command table gains `help` and 10 `plugins:*` ids (65
to 76). The root help gains the `plugins` topic and the `help` and
`plugins` commands. So the reading catches a real difference. |
| after | `cc13e2532` (array and devDependencies removed, lockfile
regenerated) and `a593c8c62` (CLI rebuilt) | `diff -r` against before:
**empty**, all 114 files, same sha256 over the concatenation
(`338e1f0f...5c6f38`) |
| final heads | `3c8442fc0` and `a1e72918c` (after merging main) |
identical, except the two version strings `17.5.0` to `17.6.0`. Those
come from main's Version Packages merge, not from this diff. |
## Hypotheses
- **H1 (no consumer): holds. Both devDependencies are removed.** `git
grep` finds `plugin-help` and `plugin-plugins` only in these places:
- the array and the `devDependencies` block;
- comments in `bin/run.js`, `doctor.ts` and
`doctor-deprecation-hint-commands.test.ts`;
- docs text;
- the one test assertion.
No import, `require`, script, fixture or other importer names them. In
the lockfile, only the `packages/cli` importer referenced them.
- **Lockfile comparison**, measured against both merge bases
(`748b24072` and `5a9292e6f`), with the same result:
- 14 package entries and 14 snapshots are removed and 0 added. Every
removed entry is in the transitive closure of the two plugins:
`@oclif/plugin-help@7.0.2`, `@oclif/plugin-plugins@7.0.3`,
`hosted-git-info@7.0.2`, `isexe@3.1.5`, `lru-cache@10.4.3`,
`npm@11.21.0`, `npm-package-arg@11.0.3`, `npm-run-path@5.3.0`,
`object-treeify@4.0.1`, `path-key@4.0.0`, `proc-log@4.2.0`,
`validate-npm-package-name@5.0.1`, `which@4.0.0` and `yarn@1.22.22`.
- All 1379 kept snapshots and packages are byte-identical.
- **DOWN count: 0.** Four names lose only a second, plugin-only version:
`isexe` 3.1.5, `lru-cache` 10.4.3, `path-key` 4.0.0 and `which` 4.0.0.
The versions every other consumer resolves are unchanged.
- **H2 (only `dependencies` count): holds.** `@oclif/core` 5.1.2
`lib/config/plugin-loader.js` `loadCorePlugins` calls
`findMatchingDependencies(rootPlugin.pjson.dependencies ?? {},
corePlugins)`. Measured three ways:
- the before/after identity above;
- the positive control above;
- a standalone fixture root on 5.1.2: with `@acme/plugin-marketplace`
listed in `oclif.plugins` plus `dependencies`, `marketplace:search`
loads and runs. Moved to `devDependencies`, nothing loads.
- **H3 (the site list is complete): holds, with no new site.** The PM's
grep was re-run, then widened to `plugins
install/uninstall/update/link/...` in space and colon forms, every
`@oclif/plugin-*`, and `os|objectstack plugins|help`. Every hit is
accounted for in the table below. The widened spellings found only three
things beyond the card's sites: `bin/run.js:87` (the `plugins link`
sentence, covered with the run.js site), the phrase "ObjectStack
plugins" (prose, not a command), and one `CHANGELOG.md` line.
- **H4 (the build-your-own-distribution route stays true): holds.**
Decided from the loader, not the old text. Fixture distribution roots on
`@oclif/core` 5.1.2 `Config.load`:
- a root listing `@acme/plugin-marketplace` in both `oclif.plugins` and
`dependencies` loads `marketplace:search` and runs it;
- a root listing both `@objectstack/cli` and the extension that way
loads 66 commands (this CLI's 65 plus `marketplace:search`);
- devDependencies-only loads nothing.
## Per-site conclusions
| Site | Conclusion |
|---|---|
| `packages/cli/package.json` `oclif.plugins` + 2 `devDependencies` |
**Changed**: removed. |
| `pnpm-lock.yaml` | **Changed**: regenerated by the tooling, comparison
above. |
| `content/docs/plugins/index.mdx` Step 3 callout (lines 400-408) |
**Changed**. Its reason ("`plugin-plugins` sits in devDependencies")
became false. It now says: no plugin manager; `os plugins ...` and `os
help` are not commands; `os --help` is the help entry; the distribution
route, kept because H4 holds; and the loader's `dependencies`-only rule.
|
| same page, "Once loaded, the new commands appear in `os --help`" |
**Already true**: true of the distribution's own `os --help` (H4
fixture). |
| `packages/cli/README.md` `### os plugins (oclif)` | **Changed**. Now
`### os plugins and os help (not commands)`: no plugin manager; each
exits 2; use `os --help`; link to the plugin-system section. |
| `packages/cli/README.md` `## oclif Plugin System` (intro, step 3,
"Install and use", comparison row) | **Changed**. `os plugins install`
is gone. Step 3 and the example load through an `os` distribution
listing the plugin in `oclif.plugins` + `dependencies`. |
| `packages/cli/bin/run.js:84-97` | **Changed**. The reasoning now names
"no plugin manager, no `oclif.plugins`, no `@oclif/plugin-plugins`
dependency" instead of the devDependencies placement. The 34-entry count
is re-measured (12 topics + 22 commands). |
| `packages/cli/src/commands/doctor.ts:2377-2380` | **Changed**
(comment): "no plugin supplies one (the package declares no
`oclif.plugins`)". |
|
`packages/cli/src/commands/doctor-deprecation-hint-commands.test.ts:15`
| **Changed** (comment), same restatement. |
| `packages/cli/test/plugin-commands.test.ts` | **Rewritten** to pin the
new state. `oclif.plugins` is undefined, and no `@oclif/plugin-*`
package appears in any dependency field. The command-discovery and bin
pins are kept. The guard is not deleted (reverse verification below). |
| `docs/qa/platform-checklist/areas/cli.json:658`
(`cli.flag-command-error-ux`) | **Changed**. The source line now reads
"no oclif.plugins at all, no plugin manager, no help command and no
not-found plugin, so unknown commands hard-error". Revision 1 to 2, with
a history entry. `pnpm check:platform-checklist` is green. |
| `packages/spec/src/kernel/cli-extension.zod.ts:18` and
`content/docs/references/kernel/cli-extension.mdx:21` | **Out of
scope**. Spec-lane, carried by #21286, untouched as the card directs. |
| `packages/cli/CHANGELOG.md:1362` (the "`plugins link`ed TypeScript
plugin ... `@oclif/plugin-plugins` sits in `devDependencies`" entry) |
**Out of scope**. Release-owned, and true of the version it shipped
with. Not edited in a code PR. |
| "ObjectStack plugins" hits (`content/docs/ai/skills.mdx`,
`api/error-handling-server.mdx`, `plugins/development.mdx`,
`packages/core/src/types.ts`, `packages/types/README.md`,
`skills/objectstack-platform/references/plugin-hooks.md`), root
`CHANGELOG.md:1367` | **Not a site**: a case-insensitive match on prose,
not an `os plugins` command. |
## Tests and gates (final head `a1e72918c` unless noted)
- Gates: `node scripts/pm/dispatch-gates.mjs --repo
objectstack-ai/objectstack --commands` at `a1e72918c` derives **106**
commands. All 106 were run with each exit code captured before any pipe,
and **all 106 exit 0**. `--ran` reconciles them: `106 derived famil(ies)
accounted for, 106 run, 0 NOT-MEASURED`.
- The same 106 were also all green at `3c8442fc0`.
- At `a593c8c62`, 4 needed a re-run. Three refused with exit 3
(`PREREQUISITE NOT MET`) before the packages they read were built:
`check:skill-examples`, `check:dual-build-cjs-loads` and
`check:i18n-coverage`. `check:slot-lookup` hit an ENOENT on a temp
fixture that a concurrent CLI test deleted. All 4 were green on re-run.
- `@objectstack/cli` unit tier (`vitest run --project unit
--maxWorkers=2`): **243 files and 3440 tests passed** at `3c8442fc0`,
and again at `a593c8c62`. The two edited test files were re-run at
`a1e72918c`: 2 files and 16 tests passed. The last merge (`3c8442fc0` to
`a1e72918c`) brought 4 main commits, none of which touch `packages/cli`.
- Reverse verification on the rewritten test, with the fix committed.
Each mutation went through `scripts/ablation-replace.mjs` (anchor hit,
blob changed) with its restore proven (blob == HEAD, `git diff HEAD`
empty):
- re-adding the `oclif.plugins` array: `declares no oclif.plugins` goes
**red** (`expected [ '@oclif/plugin-help', ... ] to be undefined`);
- adding `@oclif/plugin-plugins` to `devDependencies`: `depends on no
@oclif/plugin-* package` goes **red**.
- `pnpm --filter @objectstack/cli typecheck` (at `a593c8c62`): exit 0.
`plugin-commands.test.ts` is in `tsconfig.test.json`'s program and
`doctor-deprecation-hint-commands.test.ts` in `tsconfig.json`'s
(`--listFilesOnly`).
- `--project integration` (at `a593c8c62`, run because the diff touches
`bin/`): 69/70 files and 601/603 tests pass. The 1 failure is
pre-existing: `test/published-entry-node-env-source-reroute.test.ts`,
`CONTROL: neutralising the declaration in the child reproduces the card
verbatim`. It fails identically on base `748b24072`, built (59/59 turbo
cache), in a separate worktree. Cause: tsx 4.23.15's ESM API registers
`./esm/index.mjs` relative to `dist/esm/api/index.cjs`. That resolves to
the nonexistent `dist/esm/api/esm/index.mjs` (`oclif:config:ts-path`
debug: "Could not find tsx. Skipping tsx registration"), so the
control's trap never arms. It is unrelated to `oclif.plugins`. The
integration tier was not re-run at the final head: the incoming main
commits touch no `packages/cli/bin` or `src` file. It is declared to CI.
- Lint, narrowed and measured: `eslint --no-inline-config --format json`
over the 4 touched JS/TS files reports 4 files, 0 errors and 0 warnings.
The other 6 touched files (`.md`, `.mdx`, `.json`, `.yaml`) are outside
`eslint.config.mjs`'s `files` globs. The config enables no type-aware
linting (no `parserOptions.project`), so this diff cannot move an
untouched file's verdict. The full `pnpm lint` is CI's.
## Acceptance notes (not filed here; for the seat)
- `packages/cli/README.md` `### Global` says `-v, --version` and `-h,
--help`. Measured on the built entry: `os -h` and `os -v` exit 2 with
`command -h not found` and `command -v not found`. Only `--help` and
`--version` work. This is pre-existing and unrelated to this diff, so it
is reported, not fixed.
- `packages/cli/README.md` `### Plugin Management` says "There is no `os
plugin` command group in v1". `os plugin build|sign|publish` is
registered: the `plugin` topic is in `os --help`. This is pre-existing,
and #21167 also holds this file, so it is left untouched.
- The tsx 4.23.15 ESM-API defect above. It reds that integration control
leg on base too, so it will red `packages/cli`'s integration tier
wherever that file runs.
---
_Generated by [Claude
Code](https://claude.ai/code/session_018gA1pE6eJtwHhqx72G8U9X)_
---------
Co-authored-by: Claude <noreply@anthropic.com>os plugins works (#21306)1 parent 135daaa commit dabd1c5
10 files changed
Lines changed: 101 additions & 244 deletions
File tree
- .changeset
- content/docs/plugins
- docs/qa/platform-checklist/areas
- packages/cli
- bin
- src/commands
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
409 | 411 | | |
410 | 412 | | |
411 | 413 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
577 | | - | |
| 577 | + | |
578 | 578 | | |
579 | 579 | | |
580 | 580 | | |
| |||
655 | 655 | | |
656 | 656 | | |
657 | 657 | | |
658 | | - | |
| 658 | + | |
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
662 | | - | |
| 662 | + | |
| 663 | + | |
663 | 664 | | |
664 | 665 | | |
665 | 666 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
267 | 269 | | |
268 | 270 | | |
269 | | - | |
270 | 271 | | |
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
274 | 275 | | |
275 | 276 | | |
276 | 277 | | |
277 | | - | |
| 278 | + | |
278 | 279 | | |
279 | 280 | | |
280 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 56 | | |
61 | 57 | | |
62 | 58 | | |
| |||
137 | 133 | | |
138 | 134 | | |
139 | 135 | | |
140 | | - | |
141 | | - | |
142 | 136 | | |
143 | 137 | | |
144 | 138 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2375 | 2375 | | |
2376 | 2376 | | |
2377 | 2377 | | |
2378 | | - | |
2379 | | - | |
| 2378 | + | |
| 2379 | + | |
2380 | 2380 | | |
2381 | 2381 | | |
2382 | 2382 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | | - | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
13 | 28 | | |
14 | 29 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
20 | 39 | | |
| 40 | + | |
| 41 | + | |
21 | 42 | | |
22 | | - | |
23 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
24 | 49 | | |
25 | 50 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
30 | 64 | | |
| 65 | + | |
| 66 | + | |
31 | 67 | | |
32 | 68 | | |
33 | 69 | | |
34 | 70 | | |
35 | 71 | | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 72 | + | |
41 | 73 | | |
42 | 74 | | |
43 | 75 | | |
| |||
0 commit comments