Commit e4a71d4
cli: environments/*.ts command sources no longer spell os projects in --help (#11227)
* fix(cli): environments/*.ts command sources no longer spell os projects in live --help output
Fixes #10967
static override examples arrays, JSDoc headers, and exported class names
in packages/cli/src/commands/environments/{bind,create,list,show,switch}.ts
still spelled the pre-v5.0-rename `os projects <cmd>` — oclif prints
examples verbatim as part of --help, so a user copy-pasting straight from
`os environments bind --help` hit `Error: Command projects:bind not found.`
- examples arrays and JSDoc headers: os projects -> os environments (all
five files, 21 occurrences).
- exported class names renamed to match their file-path-derived command id
(ProjectsBind -> EnvironmentsBind, etc.) -- oclif's pattern-strategy
loader derives a command's id purely from its file path, confirmed by
reading processCommandIds() in @oclif/core and by building the CLI and
running --help/a real invocation on all five commands after the rename.
- environments.test.ts's imports and describe title updated to match, and
gains a pin: every examples entry on these five commands is checked
against the CLI's actual file-tree-derived command-id set (not a grep for
the literal string "os projects"), so a future topic rename that misses
an examples string fails a test instead of shipping. Anti-vacuity and
reverse-verification (both the pre-fix line as a specimen, and a live
edit-run-restore cycle) are documented in the test file's own comment.
* fix(cli): widen #10967's examples-resolve pin to every command file
PM review on #11227: the pin's population was a hardcoded 5-file map --
exactly the set already correct -- so it could not catch this defect class
returning anywhere else, including in the register.ts/whoami.ts/logout.ts
files #11221 already tracks live.
Widen it to every command source under packages/cli/src/commands/**,
walked the same way registeredCommandIds() already walks the tree for the
id universe. examples are now read via TypeScript AST (extractExamples),
not by importing every command module, to avoid making this file's cost
and failure surface track the whole package's transitive import graph.
extractExamples/stripInvocationPrefix now handle every invocation shape
actually present in the package: plain '$ os ...', the oclif help-template
form '<%= config.bin %> ...', either prefixed by one or more ENV=value
assignments (including a double-quoted value containing spaces), and the
{ command, description } object form start.ts uses twice.
The three #11221-owned files are carved out via an EXCLUDED map (file ->
reason), matching the pattern in
packages/create-objectstack/src/starter-comments-self-contained.test.ts's
EXCLUDED: a filtered main assertion, plus a second it.each that re-runs the
same predicate over the excluded files and asserts it still finds an
unresolved entry -- so when #11221 lands, that assertion goes red and says
to delete the entry, instead of the exclusion silently living forever.
Verified: the widened pin passes (71 tests, up from 14). Reverse-verified
the exclusion is load-bearing, not decorative -- temporarily cleared
EXCLUDED and confirmed all three files fail by name for the expected
reason (their real, currently-unresolved os auth ... examples), then
restored. Re-verified the original bind.ts reverse-verification still
works under the new population (a reintroduced stale example fails only
that one file, all others still pass). Re-ran the full local gate battery
(18 gates) clean.
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 2810695 commit e4a71d4
7 files changed
Lines changed: 376 additions & 47 deletions
File tree
- .changeset
- packages/cli/src/commands/environments
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
0 commit comments