Skip to content

feat(lint): report a command cli-core reserves that the CLI built itself - #727

Merged
leemour merged 1 commit into
mainfrom
feat/reserved-shared-commands
Nov 25, 2026
Merged

leemour merged 1 commit into
mainfrom
feat/reserved-shared-commands

Conversation

@leemour

@leemour leemour commented Nov 25, 2026

Copy link
Copy Markdown
Member

Task

Stop a WireCat CLI from building its own command at a path that must come from cli-core.

Why

Audits on 25.11.2026 found own session start|status|end|list in zoom, drive, gcal, ydisk, notion and the CRM CLIs, an own mirrors in ydisk, and an own doctor and MCP server in memo. assertSharedContracts checks only the commands cli-core already marked, so a hand-built group has no mark and passes every check.

What

  • New lint rule reserved-shared-command (WC-CMD-34). It reads commands --json and reports each of these root paths whose command has no origin: "cli-core": session start, session status, session end, session list, doctor, mcp, account remove, mirrors, complete. It reports once per path (session once for its four leaves) and names the cli-core helper to mount. A group is judged by its own node, so a subcommand a CLI adds to a shared group stays allowed.
  • Warning first. cli-dev lint prints it and passes. The family audit counts it in the scorecard and never blocks on it. It becomes an error in a later release, planned for 2027-01-15, after cli-core marks tokenSessionCommand, oauthSessionCommand, fileMirrorsCommand and the standalone accountRemoveCommand. They have no mark in cli-core 1.0.0, so a CLI that mounts them is reported too.
  • Exceptions go in lint/overrides.json. Its schema already needs a reason, an owner and review_after, and an entry more than 14 days past its date fails. A lint/baseline/ entry for this rule fails the lint because it has neither, and --write-baseline writes none.
  • WC-CMD-34 in docs/standards/commands.md, a pointer from WC-ARCH-6, and a changelog fragment under Added. It is a minor change: LINT_RULES is experimental and the rule fails nothing.

Measured today

The rule ran on 20 CLIs. mail, gcal and drive were built from origin/main. The others are local builds, and for ydisk, linear, wordpress, attio, amo and b24 the local head was not origin/main. A grep of origin/main sources agrees with the split below.

CLI reported real copy only because cli-core leaves the helper unmarked
tg, max, wa nothing
slk, linear, attio, wordpress session session (tokenSessionCommand)
amo, b24, hubspot, clidev session session
pbx, beeline session, account remove session account remove
gcal, mail session, account remove session (mail: expected exception) account remove
notion session, mirrors, account remove session mirrors, account remove
ydisk session, mirrors, account remove session, mirrors account remove
zm session, complete, account remove session, complete account remove
memo doctor, mcp doctor, mcp
drive every path session its command tree has no cli-core mark at all, although it mounts appDoctorCommand, appMcpCommand and appCompleteCommand. Cause not known yet.

max replaces doctor and session through customizeSharedCommand, which keeps the mark, so it needs no exception. braze-cli was not measured.

Testing

  • pnpm typecheck, pnpm lint, pnpm docs:check, pnpm docs:lint, pnpm docs:spell, cli-dev changelog fragments, cli-dev api-report --check: pass.
  • vitest run: 1357 pass. 6 in scripts/release-checks.test.ts fail on this machine only: python3 there is an asdf shim that exits 126 under the test's throwaway HOME. The file is unchanged, and Main validation is green on the base commit.

🤖 Generated with Claude Code

Add the lint rule reserved-shared-command (WC-CMD-34). It reads the CLI's
commands --json and reports each of session start|status|end|list, doctor,
mcp, account remove, mirrors and complete whose command lacks cli-core's
origin mark, once per path, with the cli-core helper to mount instead.

Why: audits found own sessions in zoom, drive, gcal, ydisk, notion and the
CRM CLIs, an own mirrors in ydisk and an own doctor and MCP server in memo.
assertSharedContracts only checks commands cli-core already marked, so a
hand-built group passed every check.

The rule ships as a warning in cli-dev lint and the family audit. Measured
on 20 CLIs it flags 17 (only tg, max and wa pass), partly because cli-core
1.0.0 does not mark tokenSessionCommand, oauthSessionCommand,
fileMirrorsCommand and accountRemoveCommand. It becomes an error in a later
release after cli-core marks them, planned 2027-01-15.

An exception is a lint/overrides.json entry, which already requires a reason,
an owner and review_after. A lint/baseline entry for this rule is refused,
and --write-baseline writes none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leemour
leemour merged commit 0a2d750 into main Nov 25, 2026
10 checks passed
@leemour
leemour deleted the feat/reserved-shared-commands branch November 25, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant