Skip to content

fix(cli): de-duplicate --help output and add init e2e coverage#38

Merged
bntvllnt merged 1 commit into
mainfrom
fix/cli-help-dedup
Jun 1, 2026
Merged

fix(cli): de-duplicate --help output and add init e2e coverage#38
bntvllnt merged 1 commit into
mainfrom
fix/cli-help-dedup

Conversation

@bntvllnt
Copy link
Copy Markdown
Owner

@bntvllnt bntvllnt commented Jun 1, 2026

Why

Dogfooding init surfaced a broken-looking codebase-intelligence --help: the
command list printed twice with two contradictory init descriptions. Root
cause — the program .description() embedded a hand-maintained command list that
commander also auto-generates. The manual init line was stale, claiming the
global skill installs by default (it is opt-in since #36).

The CLI action layer (src/cli.ts) is excluded from coverage and had zero
tests, so nothing caught this or guards the init lifecycle.

What

  • Fix: drop the manual command list from .description(); commander is now the
    single source. Preserve MCP-mode + Try hints via addHelpText("after").
  • Tests (tests/cli-init.e2e.test.ts, new): spawn the real binary across the
    full init lifecycle with a sandboxed HOME — help no-duplication regression,
    --json, default (non-TTY), --all, --agents subset, unknown-id → exit 2,
    empty selection, idempotent re-run, missing path → exit 1, --skill opt-in,
    skill-not-installed-by-default.
  • promptSelection non-TTY fallback tests (no mocking of own code).
  • Docs: README init line synced to opt-in skill wording.

Verification

  • TDD: 3 help tests RED on old build → GREEN after fix.
  • Gates: lint, typecheck, build pass. Full suite 342 passed / 3 todo (baseline
    326 + 16 new, zero regressions).
  • node dist/cli.js --help now shows one command list.

Behavior of init itself is unchanged — verified working across every mode
(interactive PTY, --json, --all, --agents, idempotency).

The program description embedded a hand-maintained command list that
commander also auto-prints, so `--help` rendered the command list twice
with two contradictory `init` descriptions — the manual one stale,
claiming the global skill installs by default (it is opt-in since #36).
Drop the manual list so commander is the single source; preserve the
MCP-mode and Try hints via addHelpText("after").

Add tests/cli-init.e2e.test.ts spawning the real binary across the full
init lifecycle (the CLI action is excluded from coverage and was
untested): --help no-duplication regression, --json, default, --all,
--agents subset, unknown-id exit 2, empty selection, idempotency,
missing-path exit 1, --skill opt-in. Add promptSelection non-TTY
fallback tests. Sync README init line to opt-in skill wording.
@bntvllnt bntvllnt added the bug Something isn't working label Jun 1, 2026
@bntvllnt bntvllnt self-assigned this Jun 1, 2026
@bntvllnt bntvllnt merged commit e21b238 into main Jun 1, 2026
2 checks passed
@bntvllnt bntvllnt deleted the fix/cli-help-dedup branch June 1, 2026 19:55
bntvllnt added a commit that referenced this pull request Jun 1, 2026
## Release v2.4.1

Patch release. Ships the `--help` de-duplication fix and the new `init`
lifecycle
E2E coverage from #38 (already on `main`, verified live on the
`2.4.0-canary.e21b238` build).

- `package.json` → `2.4.1`
- `CHANGELOG.md` → `[2.4.1]` entry (Fixed: doubled `--help`; Added: init
E2E tests)

No version-pinned docs to update — README/llms reference `@latest`.

After merge, dispatch the **Publish** workflow to tag `v2.4.1`, publish
npm `latest`
(OIDC provenance), and create the GitHub Release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant