Skip to content

Commit 7a17faf

Browse files
committed
feat(scripts): check-cli-command-ids also requires every module under src/commands to BE a command
The oclif command table is a glob over the emitted tree (`"commands": { "strategy": "pattern", "target": "./dist/commands", "glob": "**/*.js" }`), so every module under `packages/cli/src/commands/` is taken to be a command. A helper placed beside the command it serves has no default-exported command class, and oclif then writes a `findCommand ... not found` warning to stderr on EVERY `os` invocation, whatever the user ran — which corrupts `os validate --json` for any consumer that reads both streams. `check-cli-command-ids.mjs` already walks that directory and already derives an id per file; it asked the opposite question (does a command-id literal outside the CLI resolve to a derivable path), and a module with no command class still yields a derivable path. So the second duty lands in the same walk: no new traversal, no new verification surface. - The predicate follows the INHERITANCE CHAIN, across files. `build.ts` extends `Compile` and `migrate/index.ts` extends `MigratePlan`; a predicate accepting only `extends Command` would false-red both, which is how a guard gets switched off. - It PARSES (via `scripts/ts-parse.mjs`) rather than matching text: `create.ts`, `generate.ts` and `init.ts` are scaffolders whose template literals spell `export default ...` hundreds of lines before the module's own real class. - It reads SOURCE, never `dist`, so it needs no build and inherits no stale artefact. - The module population is the EMITTED set, deliberately wider than the id population: a dotted or non-kebab base cannot be a command id but `tsc` still emits it and the glob still loads it, and those are the shapes a misplaced helper takes. - Exemptions are declarative and SELF-RETIRING — an entry reds once its file leaves the population or starts exporting a command class. - Zero examined modules is a refusal, not a pass. Duty one is unchanged: the derived id and topic sets are set-equal to the previous implementation (74 ids, 12 topics). Claude-Session: https://claude.ai/code/session_01TSf4DV7ziu4V5j73e46b7c Co-authored-by: Claude <noreply@anthropic.com>
1 parent 134b410 commit 7a17faf

1 file changed

Lines changed: 579 additions & 13 deletions

File tree

0 commit comments

Comments
 (0)