Skip to content

feat(init): opt-in agent selection with interactive picker#36

Merged
bntvllnt merged 1 commit into
mainfrom
worktree-init-opt-in
Jun 1, 2026
Merged

feat(init): opt-in agent selection with interactive picker#36
bntvllnt merged 1 commit into
mainfrom
worktree-init-opt-in

Conversation

@bntvllnt
Copy link
Copy Markdown
Owner

Why

init (shipped to canary in #34) wrote files for all 6 agents by default and installed the global skill unless --no-skill. That installs things the user never asked for. This flips it to opt-in: nothing is written unless chosen.

Pre-release change — init only exists on canary, no stable release ships it, so there's no backward-compat cost.

Behavior

Invocation Result
init (TTY) Interactive checkbox picker — AGENTS.md + CLAUDE.md preselected, skill toggle in-list
init --yes / --json / no TTY Defaults to AGENTS.md + CLAUDE.md, no skill
init --agents claude,cursor Exactly those
init --all Every agent
init --skill Also installs the global skill (opt-in)

Removed --no-skill (skill is off by default now).

Implementation

  • Zero new dependency — interactive picker is a Node readline raw-mode checkbox (src/install/prompt.ts). The project is deliberately dep-minimal.
  • Selection logic is a pure resolveInitPlan(flags, isTty) + pure prompt helpers (buildPromptItems/toggleItem/collectSelection/renderMenu), all unit-tested. The raw-mode loop is a thin I/O shell over them.

Tests / gates

  • 16 new tests (resolver branches + prompt helpers). Full suite 326 passed.
  • lint / typecheck / build green.
  • Smoke-tested every non-interactive path (default, --all, --agents, --skill, invalid agent → exit 2).

Docs

README, docs/cli-reference.md, llms-full.txt, CHANGELOG.md updated; the [Unreleased] entry now describes the opt-in design (the never-shipped --no-skill/default-all behavior is gone).

init no longer installs files for every agent (or the global skill) by
default. Nothing is written unless the user chooses it.

- TTY, no flags: interactive checkbox picker (AGENTS.md + CLAUDE.md
  preselected; skill toggle in-list). Zero new dependency (readline raw mode).
- Non-interactive (--yes/--json/no TTY): defaults to AGENTS.md + CLAUDE.md.
- --agents <list> explicit, --all for every agent.
- Global skill is opt-in via --skill (removed --no-skill; no longer default-on).

Pure resolveInitPlan() + prompt helpers are unit-tested (16 new tests).
Pre-release change to the canary-only init command — no stable users affected.
@bntvllnt bntvllnt merged commit 491adaa into main Jun 1, 2026
2 checks passed
@bntvllnt bntvllnt deleted the worktree-init-opt-in branch June 1, 2026 17:00
bntvllnt added a commit that referenced this pull request Jun 1, 2026
Release prep for **2.4.0**.

## Changes
- `package.json`: `2.3.0` → `2.4.0` (minor — new `init` command).
- `CHANGELOG.md`: `[Unreleased]` → `[2.4.0] - 2026-06-01`, fresh empty
`[Unreleased]`, compare links updated.

## What ships in 2.4.0
- `init` command — agent adoption layer (#34)
- Opt-in agent selection + interactive picker (#36)

## After merge
Dispatch the **Publish** workflow (workflow_dispatch on main) → tags
`v2.4.0`, `npm publish --tag latest` via OIDC, creates the GitHub
Release.
bntvllnt added a commit that referenced this pull request 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).
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