feat: add init command for AI agent adoption#34
Merged
Conversation
codebase-intelligence has the data, but AI agents default to grep/read
instead of querying it. `init` closes that gap.
`codebase-intelligence init [path]` writes an idempotent, marked instruction
block ("query CI before grep/read") into each agent's repo file — AGENTS.md,
CLAUDE.md, .cursor/rules/codebase-intelligence.mdc,
.github/copilot-instructions.md, GEMINI.md, CONVENTIONS.md — and installs a
portable skill to ~/.claude/skills/. Only content between the
codebase-intelligence:start/:end markers is touched, so re-running is safe.
- src/install: pure managed-block upsert engine + per-agent target registry
+ shared block/skill content (single source of truth)
- skills/codebase-intelligence/SKILL.md: registry skill for ags / npx skills add
- flags: --agents <list>, --no-skill, --json
- 18 new tests (real fs, temp dirs); drift-guard ties SKILL.md to renderSkill()
- docs: README, cli-reference, architecture, llms.txt, llms-full.txt, CHANGELOG.md
This was referenced May 30, 2026
bntvllnt
added a commit
that referenced
this pull request
Jun 1, 2026
## 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).
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
codebase-intelligence has the data (architecture, impact, risk metrics) — but AI coding agents default to grep/read instead of querying it.
initcloses that adoption gap. Native TypeScript, zero new runtime deps, no LLM.What
codebase-intelligence init [path]writes an idempotent, marked instruction block ("query CI before grep/read") into each agent's repo file, and installs a portable skill:AGENTS.md,CLAUDE.md,.cursor/rules/codebase-intelligence.mdc,.github/copilot-instructions.md,GEMINI.md,CONVENTIONS.md~/.claude/skills/codebase-intelligence/SKILL.mdskills/codebase-intelligence/SKILL.md→ags install/npx skills addFlags:
--agents <list>(subset),--no-skill,--json.Safety / correctness
upsertManagedBlock()is pure + idempotent. Only content between<!-- codebase-intelligence:start -->/:endis ever touched — existing user content is preserved.renderBlock()/renderSkill(); 6 agents are a thin path+preamble table.SKILL.mdtorenderSkill().Tests / gates
Docs
README (Agent Adoption section + TOC + Features),
docs/cli-reference.md,docs/architecture.md,llms.txt,llms-full.txt, and a newCHANGELOG.md.Follow-up (manual)
skills.sh directory listing needs a logged-in web submit at agentskill.sh; the
SKILL.mdis spec-valid sonpx skills add github.com/bntvllnt/codebase-intelligenceworks once merged.