buddy-agent-harness 0.6.0 → 0.7.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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/bin/buddy-agent-harness.mjs +8 -3
- package/dist/cli-Bvnq8zOL.mjs +2122 -0
- package/dist/cli-Bvnq8zOL.mjs.map +1 -0
- package/dist/cli.d.mts +13 -2
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +2 -20
- package/dist/index.d.mts +382 -47
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/package.json +3 -2
- package/plugin.json +1 -1
- package/skills/doctor/SKILL.md +20 -34
- package/skills/doctor/references/bridges.md +23 -0
- package/skills/doctor/references/configuration.md +12 -0
- package/skills/doctor/references/harnesses/claude-code.md +39 -0
- package/skills/doctor/references/harnesses/codex.md +37 -0
- package/skills/doctor/references/harnesses/copilot-cli.md +39 -0
- package/skills/doctor/references/harnesses/cursor.md +40 -0
- package/skills/doctor/references/harnesses/devin-desktop.md +20 -0
- package/skills/doctor/references/harnesses/gemini-cli.md +38 -0
- package/skills/doctor/references/harnesses/windsurf.md +27 -0
- package/skills/doctor/references/instructions.md +14 -0
- package/skills/doctor/references/mcp.md +31 -0
- package/skills/doctor/references/nonstandard.md +27 -0
- package/skills/doctor/scripts/doctor.mjs +7 -3
- package/skills/enhance/SKILL.md +4 -0
- package/skills/init/README.md +1 -1
- package/skills/init/SKILL.md +19 -8
- package/skills/init/references/detection.md +5 -3
- package/skills/init/references/harnesses/cursor.md +9 -2
- package/skills/init/scripts/doctor.mjs +14 -0
- package/skills/init/scripts/init.mjs +7 -3
- package/skills/repair/README.md +21 -0
- package/skills/repair/SKILL.md +74 -0
- package/skills/repair/references/classes.md +49 -0
- package/skills/repair/scripts/doctor.mjs +14 -0
- package/src/cli.ts +40 -7
- package/src/command-output/command-output.ts +1 -4
- package/src/diagnose-bridges/diagnose-bridges.ts +21 -13
- package/src/diagnose-bridges/diagnose-instructions.ts +7 -2
- package/src/diagnose-bridges/doctor-guidance.ts +636 -90
- package/src/diagnose-bridges/doctor.command.ts +55 -28
- package/src/diagnose-bridges/git-bridge-state.ts +30 -0
- package/src/diagnose-bridges/locator.ts +36 -0
- package/src/diagnose-configuration/diagnose-configuration.ts +99 -0
- package/src/diagnose-mcp/diagnose-mcp.ts +135 -0
- package/src/diagnose-mcp/mcp-baseline.ts +122 -0
- package/src/diagnose-mcp/mcp-model.ts +88 -0
- package/src/diagnose-mcp/mcp-secrets.ts +101 -0
- package/src/diagnose-mcp/mcp-sources.ts +131 -0
- package/src/diagnose-nonstandard/diagnose-nonstandard.ts +109 -0
- package/src/harness-registry/harness-registry.ts +97 -4
- package/src/harness-registry/mcp-config.ts +37 -0
- package/src/harness-registry/nonstandard-artifact.ts +39 -0
- package/src/index.ts +18 -2
- package/src/initialize-harnesses/init.command.ts +13 -18
- package/src/initialize-harnesses/initialize-harnesses.ts +6 -3
- package/src/is-record/is-record.ts +12 -0
- package/src/skill-projection/skill-projection.ts +102 -16
- package/dist/cli.mjs.map +0 -1
- package/dist/init.command-zbntulIq.mjs +0 -1016
- package/dist/init.command-zbntulIq.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.command-zbntulIq.mjs","names":["inspect"],"sources":["../src/command-output/command-output.ts","../src/harness-registry/harness-registry.ts","../src/diagnose-bridges/agents-files.ts","../src/diagnose-bridges/doctor-guidance.ts","../src/diagnose-bridges/json-with-comments.ts","../src/diagnose-bridges/diagnose-instructions.ts","../src/diagnose-bridges/directory-files.ts","../src/diagnose-bridges/git-bridge-state.ts","../src/diagnose-bridges/diagnose-bridges.ts","../src/diagnose-bridges/doctor.command.ts","../src/skill-projection/skill-projection.ts","../src/initialize-harnesses/initialize-harnesses.ts","../src/initialize-harnesses/init.command.ts"],"sourcesContent":["import { sep } from 'node:path'\nimport { encode } from '@toon-format/toon'\n\nexport type OutputFormat = 'json' | 'toon' | 'text'\n\nconst formats: readonly OutputFormat[] = ['toon', 'json', 'text']\n\n/** Rejects anything but the supported formats so an unknown value never falls back silently. */\nexport function parseFormat(value: string | undefined): OutputFormat {\n\tif (!formats.includes(value as OutputFormat)) throw new Error('--format must be toon, json, or text.')\n\treturn value as OutputFormat\n}\n\n/** The single stdout boundary: internal logic stays on plain objects, encoding happens here. */\nexport function writeResult(value: object, format: OutputFormat): void {\n\tprocess.stdout.write(`${encodeResult(value, format)}\\n`)\n}\n\nfunction encodeResult(value: object, format: OutputFormat): string {\n\tif (format === 'json') return JSON.stringify(value)\n\treturn format === 'text' ? renderText(value) : encode(value)\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction cell(value: unknown): string {\n\treturn value === undefined ? '' : String(value)\n}\n\n/** A header row plus one row per record, every column padded to its widest cell. */\nfunction table(rows: Record<string, unknown>[]): string[] {\n\tconst columns = [...new Set(rows.flatMap((row) => Object.keys(row)))]\n\tconst widths = columns.map((column) => Math.max(column.length, ...rows.map((row) => cell(row[column]).length)))\n\tconst line = (values: string[]) =>\n\t\t` ${values.map((value, index) => value.padEnd(widths[index] as number)).join(' ')}`.trimEnd()\n\treturn [line(columns), ...rows.map((row) => line(columns.map((column) => cell(row[column]))))]\n}\n\n/**\n * The same result rendered for a person rather than for an agent: scalars as `key: value`, records\n * as an aligned table, and everything else as a bulleted list. TOON stays the default because it is\n * what an agent parses; this is for reading over someone's shoulder.\n */\nexport function renderText(value: object): string {\n\tconst blocks = Object.entries(value).map(([key, item]) => {\n\t\tif (!Array.isArray(item)) return [`${key}: ${isRecord(item) ? JSON.stringify(item) : String(item)}`]\n\t\tif (!item.length) return [`${key}: (none)`]\n\t\tconst body = item.every(isRecord) ? table(item) : item.map((entry) => ` - ${String(entry)}`)\n\t\treturn [`${key}:`, ...body]\n\t})\n\n\t// A blank line wherever a multi-line block meets its neighbour, so a following scalar does not\n\t// read as another row of the table above it.\n\treturn blocks\n\t\t.flatMap((block, index) => {\n\t\t\tconst previous = blocks[index - 1]\n\t\t\treturn previous && (previous.length > 1 || block.length > 1) ? ['', ...block] : block\n\t\t})\n\t\t.join('\\n')\n}\n\n/** AXI §10: the executable's absolute path, with the user's home directory collapsed to `~`. */\nexport function binPath(home: string, executable: string | undefined): string {\n\tif (!executable) return 'buddy-agent-harness'\n\treturn home && executable.startsWith(home + sep) ? `~${executable.slice(home.length)}` : executable\n}\n","import { lstatSync } from 'node:fs'\nimport { join } from 'node:path'\nimport type { InstructionBridge } from './instruction-bridge.ts'\n\nexport type HarnessName =\n\t| 'claude-code'\n\t| 'cursor'\n\t| 'codex'\n\t| 'copilot-cli'\n\t| 'gemini-cli'\n\t| 'devin-desktop'\n\t| 'windsurf'\n\n/** The two scopes a harness reads configuration at. Their roots differ; their shape does not. */\nexport type HarnessScopeName = 'project' | 'user'\n\n/**\n * What one harness does at one scope. Paths are relative to that scope's root: the repository root\n * at project scope, the user's home directory at user scope.\n *\n * `detect` is the directory whose presence means this harness is configured at this scope — a\n * different question per scope, which is why it is recorded per scope rather than once.\n *\n * `skillsDirectory` is the projection target the harness needs to see `.agents/skills` at this\n * scope. A harness that reads `.agents/skills` natively there has none, and is never projected into.\n *\n * `instructionBridge` is the same question for `AGENTS.md`: what the harness needs at this scope in\n * order to read it. It belongs per scope for the same reason `skillsDirectory` does — the file\n * differs. Unlike `skillsDirectory`, the `init` command does not write it; the `init` skill does. It\n * is recorded here to be diagnosed and gated per harness, not to be projected.\n */\nexport type HarnessScope = {\n\tdetect: string\n\tskillsDirectory?: string\n\tinstructionBridge?: InstructionBridge\n}\n\nexport type Harness = {\n\tname: HarnessName\n\t/** What this harness does inside a repository. `init` and `doctor` act only here. */\n\tproject: HarnessScope\n\t/**\n\t * What this harness does for the user, outside any repository. Absent when no user-scope path is\n\t * primary-sourced — Devin documents none. Described and diagnosable; never written to.\n\t */\n\tuser?: HarnessScope\n\t/** Set when this name has been superseded; the value is the name that replaces it. */\n\tdeprecated?: HarnessName\n}\n\n/**\n * The two scopes disagree in general, and a single answer per harness could only record one of them:\n * Copilot CLI is `.github/skills` in a repository and `~/.copilot` for the user. Claude Code is the\n * only harness that needs a skills projection, and it needs one at both scopes. Codex, Cursor,\n * Copilot CLI, Gemini CLI, and Devin Desktop read `.agents/skills` themselves and are never\n * projected into.\n *\n * Gemini CLI carried a `.gemini/skills` projection until E-GEM-02: it reads the `.agents/skills`\n * alias at project scope too, where that alias takes precedence over `.gemini/skills`. It still\n * needs an instruction bridge, which is a separate axis and unaffected.\n *\n * Instruction bridges are recorded at project scope only. The user-scope equivalents exist, but\n * nothing writes or reads them yet: `init` works inside a repository, and so does `doctor`.\n *\n * `windsurf` is the former name of Devin Desktop, rebranded 2026-06-02. It is retained as a\n * deprecated alias: Devin still scans the legacy `.windsurf/skills` path, so its projection keeps\n * working, but new repositories should enable `devin-desktop` and have nothing written for them.\n *\n * See `.research/agentic-configuration-standards/` for the per-harness sources.\n */\nexport const harnessRegistry: readonly Harness[] = [\n\t{\n\t\tname: 'claude-code',\n\t\tproject: {\n\t\t\tdetect: '.claude',\n\t\t\tskillsDirectory: '.claude/skills',\n\t\t\tinstructionBridge: { kind: 'import', path: 'CLAUDE.md' },\n\t\t},\n\t\tuser: { detect: '.claude', skillsDirectory: '.claude/skills' },\n\t},\n\t{ name: 'cursor', project: { detect: '.cursor' }, user: { detect: '.cursor' } },\n\t{ name: 'codex', project: { detect: '.codex' }, user: { detect: '.codex' } },\n\t{ name: 'copilot-cli', project: { detect: '.github/skills' }, user: { detect: '.copilot' } },\n\t{\n\t\tname: 'gemini-cli',\n\t\tproject: {\n\t\t\tdetect: '.gemini',\n\t\t\tinstructionBridge: { kind: 'settings-entry', path: '.gemini/settings.json', key: 'context.fileName' },\n\t\t},\n\t\tuser: { detect: '.gemini' },\n\t},\n\t{ name: 'devin-desktop', project: { detect: '.devin' } },\n\t{\n\t\tname: 'windsurf',\n\t\tproject: { detect: '.windsurf', skillsDirectory: '.windsurf/skills' },\n\t\tdeprecated: 'devin-desktop',\n\t},\n]\n\n/** Enabled whether or not the repository already contains their directories. */\nconst defaultHarnesses: readonly HarnessName[] = ['claude-code', 'cursor']\n\nfunction directoryExists(path: string): boolean {\n\ttry {\n\t\treturn lstatSync(path).isDirectory()\n\t} catch {\n\t\treturn false\n\t}\n}\n\n/** The default harnesses, plus the preferred ones, plus every harness whose directory is present. */\nexport function selectHarnesses(root: string, preferred: readonly HarnessName[]): Harness[] {\n\tconst enabled = new Set<HarnessName>([...defaultHarnesses, ...preferred])\n\treturn harnessRegistry.filter(\n\t\t(harness) => enabled.has(harness.name) || directoryExists(join(root, harness.project.detect)),\n\t)\n}\n","import { type Dirent, existsSync, readdirSync } from 'node:fs'\nimport { join, posix } from 'node:path'\n\n/** Directories that never hold instructions this repository is responsible for bridging. */\nconst pruned = new Set(['node_modules'])\n\n/**\n * Every directory below `root` holding an `AGENTS.md`, repository-relative and POSIX-separated,\n * with the root itself as `''`. Sorted, root first.\n *\n * Dot-directories are pruned along with `node_modules`. That is not only a speed measure:\n * `.agents/AGENTS.md` is canonical shared instructions rather than a subtree-scoped file, and\n * bridging it would claim a scope it does not have.\n */\nexport function agentsFileDirectories(root: string): string[] {\n\tconst found: string[] = []\n\n\tconst walk = (relative: string): void => {\n\t\tif (existsSync(join(root, relative, 'AGENTS.md'))) found.push(relative)\n\t\tlet entries: Dirent[]\n\t\ttry {\n\t\t\tentries = readdirSync(join(root, relative), { withFileTypes: true })\n\t\t} catch {\n\t\t\treturn\n\t\t}\n\t\tfor (const entry of entries) {\n\t\t\tif (!entry.isDirectory() || entry.name.startsWith('.') || pruned.has(entry.name)) continue\n\t\t\twalk(relative ? posix.join(relative, entry.name) : entry.name)\n\t\t}\n\t}\n\n\twalk('')\n\treturn found.sort()\n}\n","/**\n * The one place `doctor`'s guidance is written. The command reads `detail` and `repair` to fill its\n * `findings` and `help` sections; `skills/doctor/SKILL.md` is generated from the same table by\n * `scripts/generate-skills.ts`, so the shipped skill cannot drift from what the command says.\n */\n\n/** Every way a skills bridge can fail, in the order `doctor` reports them. */\nexport type BridgeProblem =\n\t| 'no-canonical'\n\t| 'missing'\n\t| 'degraded'\n\t| 'stale'\n\t| 'diverged-bridge'\n\t| 'diverged-canonical'\n\t| 'diverged-both'\n\t| 'diverged-unknown'\n\t| 'unpinned-copy'\n\n/**\n * Every way an instruction bridge can fail. Separate from `BridgeProblem` because the two share no\n * repair: a skills bridge is rebuilt with `init` flags, and an instruction bridge is a file whose\n * content is the user's, so every repair here goes back to the `init` skill.\n */\nexport type InstructionProblem =\n\t| 'no-instructions'\n\t| 'instructions-missing'\n\t| 'instructions-unbridged'\n\t| 'instructions-unreadable'\n\n/** Everything `doctor` can report against, across both sections. */\nexport type DoctorProblem = BridgeProblem | InstructionProblem\n\nexport type Repair = {\n\tproblem: DoctorProblem\n\t/** What `doctor` prints in the `findings` row for this problem. */\n\tdetail: string\n\t/**\n\t * The command that fixes it, for `doctor`'s own output. `path` is the repository-relative bridge\n\t * path; `cli` is how to invoke this tool.\n\t */\n\trepair(path: string, cli: string): string\n\t/**\n\t * What the shipped skill tells an agent to do instead. A repair that rebuilds a bridge delegates\n\t * to the `init` skill rather than calling the `init` command, because rebuilding can move\n\t * user-authored skills and that judgment is the `init` skill's, not `doctor`'s.\n\t */\n\tskillRepair(path: string): string\n}\n\n/** How the command names itself. */\nexport const commandInvocation = 'buddy-agent-harness'\n/**\n * How a skill invokes the command. A skill may run without the binary on PATH, so it goes through\n * `npx`, pinned to the caret range of the version that generated the skill.\n *\n * The pin is what makes the shipped guidance honest. A skill states the findings and flags of the\n * version it was generated from, so an unpinned `npx` — which resolves whatever is latest — can\n * hand an agent a table that does not describe the CLI it just ran. The caret keeps patches\n * flowing and stops at the next breaking line.\n */\nexport const skillInvocation = (version: string) => `npx -y ${commandInvocation}@^${version}`\n\n/**\n * The launcher a skill ships, named for the subcommand it runs so a stack trace or a process list\n * says which one it was. One script per command, beside the `SKILL.md` that documents it.\n */\nexport const launcherFor = (subcommand: string) => `scripts/${subcommand}.mjs`\n\n/**\n * How a skill names its launcher: the path as the skill sees it, resolved by the agent against the\n * directory it read the `SKILL.md` from.\n *\n * `node` stays in front. The launcher ships without an executable bit, and its shebang does nothing\n * on Windows, so naming the file alone would not run it.\n */\nexport const launcherInvocation = (subcommand: string) => `node ${launcherFor(subcommand)}`\n\n/**\n * The launcher written into a skill's `scripts/` directory. It resolves the CLI from its own\n * location rather than the working directory, so the skill runs the copy it shipped with and\n * fetches nothing. The repository it inspects is still the working directory, unchanged.\n */\nexport function renderSkillLauncher(subcommand: string): string {\n\treturn `#!/usr/bin/env node\n// Generated from src/diagnose-bridges/doctor-guidance.ts by scripts/generate-skills.ts. Do not edit by hand.\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\n// <package>/skills/<skill>/scripts/${subcommand}.mjs: four levels up is the package root.\nconst packageRoot = dirname(dirname(dirname(dirname(fileURLToPath(import.meta.url)))))\n\nprocess.argv.splice(2, 0, '${subcommand}')\nawait import(join(packageRoot, 'bin', '${commandInvocation}.mjs'))\n`\n}\n\n/** How the skill hands a repair back to `init`. */\nexport const initSkillInvocation = '/buddy-agent-harness:init'\n\n/** The skills bridges, reported in `bridges`. */\nexport const bridgeRepairs: readonly Repair[] = [\n\t{\n\t\tproblem: 'no-canonical',\n\t\tdetail: 'the canonical skill directory does not exist, so no bridge can resolve',\n\t\trepair: (_path, cli) => `${cli} init`,\n\t\tskillRepair: () => `run \\`${initSkillInvocation}\\`, which creates \\`.agents/skills\\` and the bridges`,\n\t},\n\t{\n\t\tproblem: 'missing',\n\t\tdetail: 'no bridge at this path — the harness sees zero project skills',\n\t\trepair: (_path, cli) => `${cli} init`,\n\t\tskillRepair: () => `run \\`${initSkillInvocation}\\``,\n\t},\n\t{\n\t\tproblem: 'degraded',\n\t\tdetail: 'expected a directory but found a regular file — checkout without core.symlinks',\n\t\trepair: (_path, cli) => `${cli} init --copy --force`,\n\t\tskillRepair: () => `run \\`${initSkillInvocation} --copy --force\\``,\n\t},\n\t{\n\t\tproblem: 'stale',\n\t\tdetail: 'symlink does not resolve to .agents/skills',\n\t\trepair: (_path, cli) => `${cli} init --force`,\n\t\tskillRepair: () => `run \\`${initSkillInvocation} --force\\``,\n\t},\n\t{\n\t\tproblem: 'diverged-bridge',\n\t\tdetail: 'only the bridge changed since the two last agreed — an agent wrote through the copy',\n\t\trepair: (path, cli) =>\n\t\t\t`replace .agents/skills with ${path} to keep the newer edit and then run ${cli} init --force`,\n\t\tskillRepair: (path) =>\n\t\t\t`replace .agents/skills with ${path} to keep the newer edit, then run \\`${initSkillInvocation} --force\\``,\n\t},\n\t{\n\t\tproblem: 'diverged-canonical',\n\t\tdetail: 'only .agents/skills changed since the two last agreed — the copy is stale',\n\t\trepair: (_path, cli) => `${cli} init --copy --force`,\n\t\tskillRepair: () => `run \\`${initSkillInvocation} --copy --force\\``,\n\t},\n\t{\n\t\tproblem: 'diverged-both',\n\t\tdetail: 'both sides changed since they last agreed — rebuilding would discard one of them',\n\t\trepair: (path) => `git diff --no-index .agents/skills ${path} and reconcile by hand`,\n\t\tskillRepair: (path) => `run \\`git diff --no-index .agents/skills ${path}\\` and reconcile by hand`,\n\t},\n\t{\n\t\tproblem: 'diverged-unknown',\n\t\tdetail: 'contents differ and no commit where they agreed was found — which side moved is unknown',\n\t\trepair: (path) => `git diff --no-index .agents/skills ${path} and reconcile by hand`,\n\t\tskillRepair: (path) => `run \\`git diff --no-index .agents/skills ${path}\\` and reconcile by hand`,\n\t},\n\t{\n\t\tproblem: 'unpinned-copy',\n\t\tdetail: 'tracked copy without the skip-worktree bit — the tree is dirty with content that must not be committed',\n\t\t// The index entry is the tracked symlink on a Windows checkout but the individual files in a\n\t\t// committed copy, so the paths are read back from git rather than assumed.\n\t\trepair: (path) => `git ls-files -z ${path} | xargs -0 git update-index --skip-worktree`,\n\t\tskillRepair: (path) => `run \\`git ls-files -z ${path} | xargs -0 git update-index --skip-worktree\\``,\n\t},\n]\n\n/**\n * The instruction bridges, reported in `instructions`. Every repair is the `init` skill: these are\n * files a person wrote, or files carrying content beside the bridge, and deciding what to preserve\n * while restoring the bridge is judgment no flag carries. `repair` therefore names the skill in\n * both places rather than pretending a shell command exists.\n */\nexport const instructionRepairs: readonly Repair[] = [\n\t{\n\t\tproblem: 'no-instructions',\n\t\tdetail: 'no AGENTS.md at the repository root, so every instruction bridge points at nothing',\n\t\trepair: () => initSkillInvocation,\n\t\tskillRepair: () => `run \\`${initSkillInvocation}\\`, which derives AGENTS.md and the bridges to it`,\n\t},\n\t{\n\t\tproblem: 'instructions-missing',\n\t\tdetail: 'no instruction bridge at this path — the harness reads none of AGENTS.md',\n\t\trepair: () => initSkillInvocation,\n\t\tskillRepair: () => `run \\`${initSkillInvocation}\\``,\n\t},\n\t{\n\t\tproblem: 'instructions-unbridged',\n\t\tdetail: 'the file is present but names AGENTS.md nowhere — the harness reads none of it',\n\t\trepair: () => initSkillInvocation,\n\t\tskillRepair: () =>\n\t\t\t`run \\`${initSkillInvocation}\\`, which adds the bridge without discarding what the file already says`,\n\t},\n\t{\n\t\tproblem: 'instructions-unreadable',\n\t\tdetail: 'the settings file does not parse, so the harness reads none of it',\n\t\trepair: () => initSkillInvocation,\n\t\tskillRepair: () => `fix the JSON by hand, then run \\`${initSkillInvocation}\\``,\n\t},\n]\n\n/** Both sections, in the order `doctor` reports them. */\nexport const doctorRepairs: readonly Repair[] = [...bridgeRepairs, ...instructionRepairs]\n\nconst repairsByProblem = new Map(doctorRepairs.map((entry) => [entry.problem, entry]))\n\nexport function repairFor(problem: DoctorProblem): Repair {\n\treturn repairsByProblem.get(problem) as Repair\n}\n\nexport const doctorSkill = {\n\tname: 'doctor',\n\tdescription:\n\t\t'Use this skill when a repository loads no project skills, when skills are missing after a clone, when a harness appears to be ignoring AGENTS.md, or when checking whether the agent configuration bridges into .claude/skills, CLAUDE.md, and the other harness files still resolve.',\n} as const\n\n/** Written into the generated skill so a reader knows not to edit it in place. */\nexport const generatedSkillWarning =\n\t'<!-- Generated from src/diagnose-bridges/doctor-guidance.ts by scripts/generate-skills.ts. Do not edit by hand. -->'\n\n/**\n * The shipped `doctor` skill, rendered from the same table the command prints. `version` is the\n * package version the skill ships with; it pins the `npx` invocation so the table and the CLI that\n * produced it stay on the same breaking line.\n */\nexport function renderDoctorSkill(version: string): string {\n\t// A repair may itself contain a pipe, which would otherwise end the table cell early.\n\tconst cell = (value: string) => value.replaceAll('|', '\\\\|')\n\tconst rows = (repairs: readonly Repair[]) =>\n\t\trepairs\n\t\t\t.map((entry) => `| \\`${entry.problem}\\` | ${entry.detail} | ${cell(entry.skillRepair('<path>'))} |`)\n\t\t\t.join('\\n')\n\n\treturn `---\nname: ${doctorSkill.name}\ndescription: ${doctorSkill.description}\n---\n\n${generatedSkillWarning}\n\n# Harness Doctor\n\nA repository keeps one canonical configuration: \\`.agents/skills\\` for its skills and \\`AGENTS.md\\` for its instructions. Harnesses that cannot read those get bridges pointing at them: Claude Code needs both, and Gemini CLI needs the instruction bridge only — it reads \\`.agents/skills\\` itself. A bridge that stops resolving is silent: the harness finds nothing and loads zero project skills, with no warning anywhere. An instruction bridge fails the same way and costs more, because the harness then reads none of the repository's instructions at all.\n\nDiagnose it:\n\n\\`\\`\\`sh\n${launcherInvocation('doctor')}\n\\`\\`\\`\n\nThat path is relative to this skill's own directory. The launcher runs the CLI that shipped beside it against the current working directory, so nothing is downloaded. Fall back to \\`${skillInvocation(version)} doctor\\` when the launcher cannot be resolved or run, which is the case when the plugin was installed from git rather than npm and its dependencies were never installed.\n\nThe command is read-only. It never repairs anything, so it is safe to run at any point, including from a session-start hook.\n\n## Reading the report\n\n\\`bridges\\` lists every skills bridge \\`init\\` would create for this repository, each with a \\`status\\` of \\`ok\\`, \\`missing\\`, \\`degraded\\`, \\`stale\\`, or \\`diverged\\`.\n\n\\`instructions\\` lists every instruction bridge into \\`AGENTS.md\\`, with a \\`status\\` of \\`ok\\`, \\`missing\\`, \\`unbridged\\`, or \\`unreadable\\`. They are a separate section because nothing about them is shared: a different \\`kind\\`, a different status vocabulary, and a repair that is never a command.\n\n\\`findings\\` explains each problem from either section and \\`help\\` names its repair. Apply the repair from the tables below, then re-run \\`doctor\\`.\n\nDo not run an \\`init\\` command yourself. Rebuilding a skills bridge can move skills a user wrote, and rewriting an instruction file touches prose a person authored — both are the \\`init\\` skill's judgment, so hand the repair to \\`${initSkillInvocation}\\` instead. A \\`help\\` line naming that skill has no shell equivalent at all.\n\nWhen every bridge resolves, \\`findings\\` says so outright rather than being empty.\n\nThe default output is TOON, which is what you parse. Add \\`--format text\\` when you need to show the same report to a person, or \\`--format json\\`.\n\n## Skills bridge findings\n\n| Finding | What it means | Repair |\n| --- | --- | --- |\n${rows(bridgeRepairs)}\n\nSubstitute the reported bridge path for \\`<path>\\`.\n\n## Instruction bridge findings\n\n| Finding | What it means | Repair |\n| --- | --- | --- |\n${rows(instructionRepairs)}\n\n\\`unbridged\\` is the one to read carefully. The file is there and looks fine, and it names \\`AGENTS.md\\` nowhere — a \\`CLAUDE.md\\` someone overwrote with real content, or a \\`.gemini/settings.json\\` another tool rewrote without \\`AGENTS.md\\` in \\`context.fileName\\`. Never fix it by replacing the file: the content that displaced the bridge may be the only copy of something.\n\nAn instruction bridge is reported per file, so a monorepo gets one row per \\`AGENTS.md\\` in the tree. Each nested \\`AGENTS.md\\` needs its own stub — an import bridges the file beside it and nothing deeper.\n\n## The Windows case\n\nThe common failure is \\`degraded\\`. Creating a symlink on Windows needs a privilege most accounts do not have, and Git for Windows gates it separately with \\`core.symlinks\\`, which its installer leaves off. With \\`core.symlinks=false\\` git does not error — it writes the symlink out as a regular file whose contents are the target path. \\`${initSkillInvocation} --copy --force\\` rebuilds the bridges as real directories on that machine.\n\nA copy is a snapshot rather than a live projection, and an agent that edits a skill through it writes into the copy instead of into \\`.agents/skills\\`. That is what the \\`diverged\\` findings catch.\n\n## Rules\n\n- Never repair a \\`diverged-both\\` or \\`diverged-unknown\\` bridge by re-running \\`init\\`. Rebuilding overwrites whichever side holds the newer edit. Reconcile the two directories first.\n- Edit skills at \\`.agents/skills/<name>/SKILL.md\\`. Editing through a bridge is only safe when that bridge is a symlink.\n- Do not add bridges to \\`.gitignore\\`. An untracked bridge swallows a real edit silently.\n- Write instructions in \\`AGENTS.md\\`, never in \\`CLAUDE.md\\`. A bridge file holds the import and any harness-specific notes; content written there reaches one harness and drifts from the canonical file.\n`\n}\n","/**\n * `.gemini/settings.json` may legally carry comments — the Gemini CLI loader strips them before\n * parsing. A plain `JSON.parse` of a valid settings file therefore throws, and `doctor` would report\n * a working bridge as unreadable. Comments are removed before parsing for that reason.\n *\n * Only comments. A trailing comma stays a parse error, because nothing documents it as accepted.\n */\nexport function stripJsonComments(source: string): string {\n\tlet output = ''\n\tlet index = 0\n\tlet inString = false\n\tlet escaped = false\n\n\twhile (index < source.length) {\n\t\tconst character = source[index] as string\n\n\t\tif (inString) {\n\t\t\toutput += character\n\t\t\tif (escaped) escaped = false\n\t\t\telse if (character === '\\\\') escaped = true\n\t\t\telse if (character === '\"') inString = false\n\t\t\tindex += 1\n\t\t\tcontinue\n\t\t}\n\n\t\tif (character === '\"') {\n\t\t\tinString = true\n\t\t\toutput += character\n\t\t\tindex += 1\n\t\t\tcontinue\n\t\t}\n\n\t\t// A `//` inside a string is an ordinary URL; outside one it can only start a comment.\n\t\tif (character === '/' && source[index + 1] === '/') {\n\t\t\twhile (index < source.length && source[index] !== '\\n') index += 1\n\t\t\tcontinue\n\t\t}\n\n\t\tif (character === '/' && source[index + 1] === '*') {\n\t\t\tindex += 2\n\t\t\twhile (index < source.length && !(source[index] === '*' && source[index + 1] === '/')) index += 1\n\t\t\tindex += 2\n\t\t\tcontinue\n\t\t}\n\n\t\toutput += character\n\t\tindex += 1\n\t}\n\n\treturn output\n}\n\n/** The parsed value, or `undefined` when the file is not JSON even once its comments are gone. */\nexport function parseJsonWithComments(source: string): unknown {\n\ttry {\n\t\treturn JSON.parse(stripJsonComments(source))\n\t} catch {\n\t\treturn undefined\n\t}\n}\n","import { lstatSync, readFileSync, readlinkSync } from 'node:fs'\nimport { join, posix } from 'node:path'\nimport type { Harness, HarnessName } from '../harness-registry/harness-registry.ts'\nimport type { InstructionBridge } from '../harness-registry/instruction-bridge.ts'\nimport { agentsFileDirectories } from './agents-files.ts'\nimport type { BridgeFinding } from './diagnose-bridges.ts'\nimport { type InstructionProblem, repairFor } from './doctor-guidance.ts'\nimport { parseJsonWithComments } from './json-with-comments.ts'\n\n/** What is on disk where an instruction bridge belongs. */\nexport type InstructionKind = 'import' | 'symlink' | 'settings-entry' | 'file' | 'none'\n/**\n * `unbridged` is the case a skills bridge has no equivalent of: the file is there, so nothing looks\n * wrong, and it names `AGENTS.md` nowhere — a `CLAUDE.md` overwritten with real content, or a\n * settings file another tool rewrote.\n */\nexport type InstructionStatus = 'ok' | 'missing' | 'unbridged' | 'unreadable'\n\nexport type InstructionReport = {\n\tharness: HarnessName\n\t/** Repository-relative path of the file that carries the bridge. */\n\tpath: string\n\tkind: InstructionKind\n\tstatus: InstructionStatus\n}\n\nexport const canonicalInstructions = 'AGENTS.md'\n\ntype Inspection = {\n\tkind: InstructionKind\n\tstatus: InstructionStatus\n\tproblem?: InstructionProblem\n}\n\n/**\n * An import bridges the `AGENTS.md` beside it and nothing else, so the check is per directory\n * holding one rather than per harness. A line of its own is enough: the harness reference allows\n * Claude-specific notes below the import, and a file that carries the import plus notes still\n * bridges.\n */\nfunction inspectImport(target: string): Inspection {\n\tlet stats: ReturnType<typeof lstatSync>\n\ttry {\n\t\tstats = lstatSync(target)\n\t} catch {\n\t\treturn { kind: 'none', status: 'missing', problem: 'instructions-missing' }\n\t}\n\n\tif (stats.isSymbolicLink()) {\n\t\treturn readlinkSync(target) === canonicalInstructions\n\t\t\t? { kind: 'symlink', status: 'ok' }\n\t\t\t: { kind: 'symlink', status: 'unbridged', problem: 'instructions-unbridged' }\n\t}\n\n\tconst imported = readFileSync(target, 'utf8')\n\t\t.split('\\n')\n\t\t.some((line) => line.trim() === `@${canonicalInstructions}`)\n\treturn imported\n\t\t? { kind: 'import', status: 'ok' }\n\t\t: { kind: 'file', status: 'unbridged', problem: 'instructions-unbridged' }\n}\n\n/** Reads a dotted key out of parsed JSON without asserting anything about the rest of the file. */\nfunction valueAt(settings: unknown, key: string): unknown {\n\treturn key.split('.').reduce<unknown>((value, segment) => {\n\t\tif (typeof value !== 'object' || value === null) return undefined\n\t\treturn (value as Record<string, unknown>)[segment]\n\t}, settings)\n}\n\nfunction inspectSettingsEntry(target: string, key: string): Inspection {\n\tlet source: string\n\ttry {\n\t\tsource = readFileSync(target, 'utf8')\n\t} catch {\n\t\treturn { kind: 'none', status: 'missing', problem: 'instructions-missing' }\n\t}\n\n\tconst settings = parseJsonWithComments(source)\n\tif (settings === undefined) return { kind: 'file', status: 'unreadable', problem: 'instructions-unreadable' }\n\n\tconst entry = valueAt(settings, key)\n\treturn Array.isArray(entry) && entry.includes(canonicalInstructions)\n\t\t? { kind: 'settings-entry', status: 'ok' }\n\t\t: { kind: 'file', status: 'unbridged', problem: 'instructions-unbridged' }\n}\n\n/** Every path an instruction bridge of this kind belongs at, in report order. */\nfunction pathsFor(root: string, bridge: InstructionBridge): string[] {\n\tif (bridge.kind !== 'import') return [bridge.path]\n\treturn agentsFileDirectories(root).map((directory) => (directory ? posix.join(directory, bridge.path) : bridge.path))\n}\n\nfunction inspect(target: string, bridge: InstructionBridge): Inspection {\n\treturn bridge.kind === 'import' ? inspectImport(target) : inspectSettingsEntry(target, bridge.key)\n}\n\n/**\n * Reports whether every enabled harness can still read `AGENTS.md`.\n *\n * Losing one of these is quieter than losing a skills bridge and costs more: a harness with no\n * instruction bridge reads none of the repository's instructions, and says nothing about it. The\n * checks are read-only, and no repair is a command — rewriting an instruction file is the `init`\n * skill's judgment.\n */\nexport function diagnoseInstructions(\n\troot: string,\n\tharnesses: readonly Harness[],\n\tcli: string,\n): { instructions: InstructionReport[]; findings: BridgeFinding[] } {\n\t// Project scope only: `doctor` diagnoses a repository, and the user-scope bridges are neither\n\t// written nor read by this tool.\n\tconst bridged = harnesses\n\t\t.map((harness) => ({ name: harness.name, bridge: harness.project.instructionBridge }))\n\t\t.filter((harness): harness is { name: HarnessName; bridge: InstructionBridge } => Boolean(harness.bridge))\n\n\tconst instructions: InstructionReport[] = []\n\tconst findings: BridgeFinding[] = []\n\tif (!bridged.length) return { instructions, findings }\n\n\t// Only reported when something bridges into it. Every other harness reads `AGENTS.md` where it\n\t// lies, so its absence is a repository that has not run `init` rather than a broken bridge.\n\tif (!agentsFileDirectories(root).includes('')) {\n\t\tconst { detail, repair } = repairFor('no-instructions')\n\t\tfindings.push({ path: canonicalInstructions, detail, repair: repair(canonicalInstructions, cli) })\n\t}\n\n\tfor (const { name, bridge } of bridged) {\n\t\tfor (const path of pathsFor(root, bridge)) {\n\t\t\tconst inspection = inspect(join(root, path), bridge)\n\t\t\tinstructions.push({ harness: name, path, kind: inspection.kind, status: inspection.status })\n\t\t\tif (inspection.problem) {\n\t\t\t\tconst { detail, repair } = repairFor(inspection.problem)\n\t\t\t\tfindings.push({ path, detail, repair: repair(path, cli) })\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { instructions, findings }\n}\n","import { readdirSync } from 'node:fs'\nimport { join, posix, relative, sep } from 'node:path'\n\n/**\n * Every file below `directory`, as paths relative to it, POSIX-separated and sorted. A directory\n * that does not exist reads as empty: `doctor` never creates one to look at it.\n */\nexport function filesUnder(directory: string): string[] {\n\ttry {\n\t\treturn readdirSync(directory, { recursive: true, withFileTypes: true })\n\t\t\t.filter((entry) => entry.isFile())\n\t\t\t.map((entry) => relative(directory, join(entry.parentPath, entry.name)).split(sep).join(posix.sep))\n\t\t\t.sort()\n\t} catch {\n\t\treturn []\n\t}\n}\n","import { execFileSync } from 'node:child_process'\nimport { join } from 'node:path'\nimport { filesUnder } from './directory-files.ts'\n\n/** Which side of a diverged bridge moved since the last commit where the two agreed. */\nexport type DivergenceDirection = 'bridge' | 'canonical' | 'both' | 'unknown'\n\n/** Whether a path is tracked, and if so whether its skip-worktree bit is still set. */\nexport type TrackingState = 'untracked' | 'tracked' | 'skip-worktree'\n\nfunction git(root: string, args: string[], input?: string): string | undefined {\n\ttry {\n\t\treturn execFileSync('git', args, {\n\t\t\tcwd: root,\n\t\t\tencoding: 'utf8',\n\t\t\t...(input === undefined ? {} : { input }),\n\t\t\tstdio: ['pipe', 'pipe', 'pipe'],\n\t\t})\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\nfunction lines(output: string | undefined): string[] {\n\treturn (output ?? '').split('\\n').filter(Boolean)\n}\n\n/**\n * Reads git state for the two sides of a bridge. Every method degrades to \"cannot tell\" rather than\n * throwing, so `doctor` still reports on a tarball, a worktree without git, or a repository with no\n * commits.\n */\nexport class GitBridgeState {\n\t/** Path of `root` relative to the repository root, `''` at the top, `undefined` outside a repository. */\n\tprivate readonly prefix: string | undefined\n\n\tconstructor(private readonly root: string) {\n\t\tthis.prefix = git(root, ['rev-parse', '--show-prefix'])?.trim()\n\t}\n\n\t/**\n\t * `init --copy` marks a bridge skip-worktree so a machine-local copy over a tracked symlink stops\n\t * showing as a pending change. The bit is a hint that some checkouts clear, so it is verified\n\t * rather than assumed.\n\t */\n\ttrackingOf(path: string): TrackingState {\n\t\tif (this.prefix === undefined) return 'untracked'\n\t\tconst entries = lines(git(this.root, ['ls-files', '-v', '--', path]))\n\t\tif (!entries.length) return 'untracked'\n\t\treturn entries.every((entry) => entry.startsWith('S')) ? 'skip-worktree' : 'tracked'\n\t}\n\n\t/**\n\t * Names the side that moved by finding the newest commit whose two trees agreed, then asking which\n\t * of the working directories still matches it.\n\t */\n\tdirectionOf(bridge: string, canonical: string): DivergenceDirection {\n\t\tif (this.prefix === undefined) return 'unknown'\n\t\tconst base = this.lastAgreedTree(bridge, canonical)\n\t\tif (base === undefined) return 'unknown'\n\t\tconst bridgeMoved = !this.matchesTree(bridge, base)\n\t\tconst canonicalMoved = !this.matchesTree(canonical, base)\n\t\tif (bridgeMoved && canonicalMoved) return 'both'\n\t\tif (bridgeMoved) return 'bridge'\n\t\treturn 'canonical'\n\t}\n\n\t/** The tree of the newest commit where both paths held identical content. */\n\tprivate lastAgreedTree(bridge: string, canonical: string): string | undefined {\n\t\tfor (const commit of lines(git(this.root, ['rev-list', '-n', '200', 'HEAD', '--', bridge, canonical]))) {\n\t\t\tconst bridgeObject = git(this.root, ['rev-parse', '-q', '--verify', `${commit}:${this.prefix}${bridge}`])?.trim()\n\t\t\tif (!bridgeObject) continue\n\t\t\tconst canonicalObject = git(this.root, [\n\t\t\t\t'rev-parse',\n\t\t\t\t'-q',\n\t\t\t\t'--verify',\n\t\t\t\t`${commit}:${this.prefix}${canonical}`,\n\t\t\t])?.trim()\n\t\t\tif (bridgeObject === canonicalObject) return bridgeObject\n\t\t}\n\t\treturn undefined\n\t}\n\n\t/**\n\t * Compares a working directory against a git tree by object id. `hash-object` is used rather than\n\t * hashing in-process so the comparison follows whatever object format the repository uses.\n\t */\n\tprivate matchesTree(directory: string, tree: string): boolean {\n\t\tconst expected = new Map(\n\t\t\tlines(git(this.root, ['ls-tree', '-r', tree])).map((entry) => {\n\t\t\t\tconst [meta, path] = entry.split('\\t')\n\t\t\t\treturn [path, (meta as string).split(' ')[2] as string] as const\n\t\t\t}),\n\t\t)\n\t\tconst files = filesUnder(join(this.root, directory))\n\t\tif (files.length !== expected.size || files.some((file) => !expected.has(file))) return false\n\t\tconst hashed = lines(\n\t\t\tgit(this.root, ['hash-object', '--stdin-paths'], files.map((file) => join(directory, file)).join('\\n')),\n\t\t)\n\t\treturn hashed.length === files.length && files.every((file, index) => expected.get(file) === hashed[index])\n\t}\n}\n","import { lstatSync, readFileSync, readlinkSync, statSync } from 'node:fs'\nimport { dirname, join, relative } from 'node:path'\nimport { type HarnessName, selectHarnesses } from '../harness-registry/harness-registry.ts'\nimport { diagnoseInstructions, type InstructionReport } from './diagnose-instructions.ts'\nimport { filesUnder } from './directory-files.ts'\nimport { type BridgeProblem, repairFor } from './doctor-guidance.ts'\nimport { type DivergenceDirection, GitBridgeState } from './git-bridge-state.ts'\n\nexport type BridgeKind = 'symlink' | 'copy' | 'file' | 'none'\nexport type BridgeStatus = 'ok' | 'missing' | 'degraded' | 'stale' | 'diverged'\n\nexport type BridgeReport = {\n\tharness: HarnessName\n\t/** Repository-relative, as the harness registry declares it. */\n\tpath: string\n\tkind: BridgeKind\n\tstatus: BridgeStatus\n}\n\nexport type BridgeFinding = {\n\tpath: string\n\tdetail: string\n\t/** The command that repairs this finding, already carrying the bridge path. */\n\trepair: string\n}\n\nexport type DivergenceReport = {\n\tpath: string\n\tdirection: DivergenceDirection\n}\n\nexport type DiagnoseOptions = {\n\troot: string\n\tharnesses?: HarnessName[]\n\t/** How to name this tool in the repair commands. */\n\tcli: string\n}\n\nexport type DiagnoseResult = {\n\tbridges: BridgeReport[]\n\t/**\n\t * The instruction bridges into `AGENTS.md`, kept out of `bridges` on purpose: a different `kind`\n\t * and `status` vocabulary, and a repair that is the `init` skill rather than a command.\n\t */\n\tinstructions: InstructionReport[]\n\tdivergence: DivergenceReport[]\n\tfindings: BridgeFinding[]\n}\n\nconst canonicalPath = '.agents/skills'\n\nfunction pathState(target: string): 'missing' | 'symlink' | 'directory' | 'file' {\n\ttry {\n\t\tconst stats = lstatSync(target)\n\t\tif (stats.isSymbolicLink()) return 'symlink'\n\t\treturn stats.isDirectory() ? 'directory' : 'file'\n\t} catch {\n\t\treturn 'missing'\n\t}\n}\n\nfunction isDirectory(path: string): boolean {\n\ttry {\n\t\treturn statSync(path).isDirectory()\n\t} catch {\n\t\treturn false\n\t}\n}\n\n/** The same test `init` uses to decide a projection is already correct, plus that it still resolves. */\nfunction resolvesToCanonical(target: string, canonical: string): boolean {\n\treturn readlinkSync(target) === relative(dirname(target), canonical) && isDirectory(target)\n}\n\nfunction sameContent(left: string, right: string): boolean {\n\tconst leftFiles = filesUnder(left)\n\tconst rightFiles = filesUnder(right)\n\treturn (\n\t\tleftFiles.length === rightFiles.length &&\n\t\tleftFiles.every(\n\t\t\t(file, index) =>\n\t\t\t\trightFiles[index] === file && readFileSync(join(left, file)).equals(readFileSync(join(right, file))),\n\t\t)\n\t)\n}\n\ntype Inspection = {\n\tkind: BridgeKind\n\tstatus: BridgeStatus\n\tproblem?: BridgeProblem\n\tdirection?: DivergenceDirection\n}\n\nfunction inspect(target: string, path: string, canonical: string, git: GitBridgeState): Inspection {\n\tswitch (pathState(target)) {\n\t\tcase 'missing':\n\t\t\treturn { kind: 'none', status: 'missing', problem: 'missing' }\n\t\t// The flagship Windows failure: git with `core.symlinks=false` writes the link out as a\n\t\t// regular file holding the target path, and the harness silently loads nothing.\n\t\tcase 'file':\n\t\t\treturn { kind: 'file', status: 'degraded', problem: 'degraded' }\n\t\tcase 'symlink':\n\t\t\treturn resolvesToCanonical(target, canonical)\n\t\t\t\t? { kind: 'symlink', status: 'ok' }\n\t\t\t\t: { kind: 'symlink', status: 'stale', problem: 'stale' }\n\t\tdefault: {\n\t\t\tif (!sameContent(target, canonical)) {\n\t\t\t\tconst direction = git.directionOf(path, canonicalPath)\n\t\t\t\treturn { kind: 'copy', status: 'diverged', problem: `diverged-${direction}`, direction }\n\t\t\t}\n\t\t\t// A copy over a tracked symlink only stays out of `git status` while its skip-worktree bit\n\t\t\t// survives, and some checkout and merge operations clear it.\n\t\t\treturn git.trackingOf(path) === 'tracked'\n\t\t\t\t? { kind: 'copy', status: 'ok', problem: 'unpinned-copy' }\n\t\t\t\t: { kind: 'copy', status: 'ok' }\n\t\t}\n\t}\n}\n\n/**\n * Reports whether every bridge this repository needs still resolves: the skills bridges into\n * `.agents/skills`, and the instruction bridges into `AGENTS.md`. Read-only: nothing is created,\n * moved, or repaired, so the caller decides what to run from the repair each finding carries.\n */\nexport function diagnoseBridges({ root, harnesses: preferred = [], cli }: DiagnoseOptions): DiagnoseResult {\n\tconst canonical = join(root, '.agents', 'skills')\n\tconst git = new GitBridgeState(root)\n\tconst selected = selectHarnesses(root, preferred)\n\tconst bridged = selected\n\t\t.map((harness) => ({ name: harness.name, skillsDirectory: harness.project.skillsDirectory }))\n\t\t.filter((harness): harness is { name: HarnessName; skillsDirectory: string } => Boolean(harness.skillsDirectory))\n\n\tconst bridges: BridgeReport[] = []\n\tconst divergence: DivergenceReport[] = []\n\tconst findings: BridgeFinding[] = []\n\n\tif (!isDirectory(canonical)) {\n\t\tconst { detail, repair } = repairFor('no-canonical')\n\t\tfindings.push({ path: canonicalPath, detail, repair: repair(canonicalPath, cli) })\n\t}\n\n\tfor (const harness of bridged) {\n\t\tconst path = harness.skillsDirectory\n\t\tconst inspection = inspect(join(root, path), path, canonical, git)\n\t\tbridges.push({ harness: harness.name, path, kind: inspection.kind, status: inspection.status })\n\t\tif (inspection.direction) divergence.push({ path, direction: inspection.direction })\n\t\tif (inspection.problem) {\n\t\t\tconst { detail, repair } = repairFor(inspection.problem)\n\t\t\tfindings.push({ path, detail, repair: repair(path, cli) })\n\t\t}\n\t}\n\n\tconst instructions = diagnoseInstructions(root, selected, cli)\n\tfindings.push(...instructions.findings)\n\n\treturn { bridges, instructions: instructions.instructions, divergence, findings }\n}\n","import { homedir } from 'node:os'\nimport type { cli } from 'clibuilder'\nimport { command, z } from 'clibuilder'\nimport { binPath, parseFormat, writeResult } from '../command-output/command-output.ts'\nimport { type HarnessName, harnessRegistry } from '../harness-registry/harness-registry.ts'\nimport { type DiagnoseResult, diagnoseBridges } from './diagnose-bridges.ts'\nimport { commandInvocation } from './doctor-guidance.ts'\n\ntype DoctorReport = {\n\tbin: string\n\tbridges: DiagnoseResult['bridges']\n\tinstructions: DiagnoseResult['instructions']\n\tdivergence?: DiagnoseResult['divergence']\n\t/** The repair is lifted out into `help`, so a finding row stays to the diagnosis itself. */\n\tfindings: Omit<DiagnoseResult['findings'][number], 'repair'>[] | string\n\thelp?: string[]\n}\n\n/**\n * AXI §5: the healthy answer states the zero with context, so an agent does not re-run with other\n * flags to confirm that an empty section really meant \"nothing wrong\".\n */\nexport function buildReport(bin: string, result: DiagnoseResult): DoctorReport {\n\t// Both sections are bridges, so the healthy line counts them together rather than making a reader\n\t// add up two numbers to learn that nothing is wrong.\n\tif (!result.findings.length) {\n\t\tconst count = result.bridges.length + result.instructions.length\n\t\treturn {\n\t\t\tbin,\n\t\t\tbridges: result.bridges,\n\t\t\tinstructions: result.instructions,\n\t\t\tfindings:\n\t\t\t\tcount === 1 ? '0 problems found — the 1 bridge resolves' : `0 problems found — all ${count} bridges resolve`,\n\t\t}\n\t}\n\n\treturn {\n\t\tbin,\n\t\tbridges: result.bridges,\n\t\tinstructions: result.instructions,\n\t\t...(result.divergence.length ? { divergence: result.divergence } : {}),\n\t\tfindings: result.findings.map(({ path, detail }) => ({ path, detail })),\n\t\thelp: [...new Set(result.findings.map((finding) => `Run \\`${finding.repair}\\``))],\n\t}\n}\n\nexport const doctorCommand: cli.Command = command({\n\tname: 'doctor',\n\tdescription:\n\t\t\"Report whether this repository's harness bridges still resolve — skills into .agents/skills, instructions into AGENTS.md. Read-only.\",\n\toptions: {\n\t\troot: {\n\t\t\tdescription: 'Repository or package directory. Defaults to the current directory.',\n\t\t\ttype: z.optional(z.string()),\n\t\t},\n\t\tharness: {\n\t\t\tdescription: 'Comma-separated harnesses to check in addition to Claude Code and Cursor, e.g. codex,gemini-cli.',\n\t\t\ttype: z.optional(z.string()),\n\t\t},\n\t\tformat: {\n\t\t\tdescription: 'Output format: toon (default), json, or text for a human-readable report.',\n\t\t\ttype: z.optional(z.string()),\n\t\t\tdefault: 'toon',\n\t\t},\n\t},\n\trun(args) {\n\t\ttry {\n\t\t\tconst format = parseFormat(args.format)\n\t\t\tconst requested = args.harness\n\t\t\t\t?.split(',')\n\t\t\t\t.map((name) => name.trim())\n\t\t\t\t.filter(Boolean)\n\t\t\tconst unsupported = requested?.filter((name) => !harnessRegistry.some((harness) => harness.name === name))\n\t\t\tif (unsupported?.length)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Unsupported harness: ${unsupported.join(', ')}. Supported: ${harnessRegistry\n\t\t\t\t\t\t.map((harness) => harness.name)\n\t\t\t\t\t\t.join(', ')}.`,\n\t\t\t\t)\n\t\t\tconst result = diagnoseBridges({\n\t\t\t\troot: args.root ?? process.cwd(),\n\t\t\t\t...(requested?.length ? { harnesses: requested as HarnessName[] } : {}),\n\t\t\t\tcli: commandInvocation,\n\t\t\t})\n\t\t\t// Exit stays 0 even with findings: the diagnosis succeeded, and a non-zero code reads to an\n\t\t\t// agent as \"this command is broken, try something else\".\n\t\t\twriteResult(buildReport(binPath(homedir(), process.argv[1]), result), format)\n\t\t} catch (error) {\n\t\t\tprocess.stderr.write(`error: ${error instanceof Error ? error.message : 'Harness diagnosis failed.'}\\n`)\n\t\t\tprocess.exitCode = 1\n\t\t}\n\t},\n})\n","import { cpSync, lstatSync, mkdirSync, readdirSync, readlinkSync, rmSync, symlinkSync } from 'node:fs'\nimport { dirname, join, relative } from 'node:path'\nimport type { Harness, HarnessName } from '../harness-registry/harness-registry.ts'\n\nfunction skillNames(skillsDirectory: string): string[] {\n\treturn readdirSync(skillsDirectory, { withFileTypes: true })\n\t\t.filter((entry) => entry.isDirectory())\n\t\t.map((entry) => entry.name)\n\t\t.sort()\n}\n\nfunction pathOccupied(path: string): boolean {\n\ttry {\n\t\tlstatSync(path)\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n\nfunction isCorrectLink(target: string, source: string): boolean {\n\treturn lstatSync(target).isSymbolicLink() && readlinkSync(target) === relative(dirname(target), source)\n}\n\n/** Creates the canonical directory when absent, so a fresh repository reports zero skills. */\nexport function countSkills(canonicalSkills: string): number {\n\tmkdirSync(canonicalSkills, { recursive: true })\n\treturn skillNames(canonicalSkills).length\n}\n\nexport type ProjectSkillsOptions = {\n\troot: string\n\tcanonicalSkills: string\n\tharnesses: readonly Harness[]\n\tcopy: boolean\n\tforce: boolean\n}\n\n/**\n * Points every harness that cannot read `.agents/skills` at the canonical directory. Symlinking is\n * preferred; a platform that refuses the link falls back to a copy. Returns the projected harnesses.\n */\nexport function projectSkills({ root, canonicalSkills, harnesses, copy, force }: ProjectSkillsOptions): HarnessName[] {\n\tconst projections = harnesses\n\t\t.filter((harness) => harness.project.skillsDirectory)\n\t\t.map((harness) => ({\n\t\t\tharness,\n\t\t\ttarget: join(root, harness.project.skillsDirectory as string),\n\t\t}))\n\n\tconst conflicts = projections\n\t\t.filter(({ target }) => pathOccupied(target) && !isCorrectLink(target, canonicalSkills))\n\t\t.map(({ target }) => target)\n\n\tif (conflicts.length && !force) {\n\t\tthrow new Error(\n\t\t\t`Refusing to replace existing skill targets:\\n${conflicts.map((target) => `- ${target}`).join('\\n')}`,\n\t\t)\n\t}\n\n\tfor (const { target } of projections) {\n\t\tmkdirSync(dirname(target), { recursive: true })\n\t\tif (pathOccupied(target) && isCorrectLink(target, canonicalSkills)) continue\n\t\tif (pathOccupied(target)) rmSync(target, { recursive: true, force: true })\n\t\tif (copy) {\n\t\t\tcpSync(canonicalSkills, target, { recursive: true })\n\t\t\tcontinue\n\t\t}\n\t\ttry {\n\t\t\tsymlinkSync(relative(dirname(target), canonicalSkills), target, 'junction')\n\t\t} catch (error) {\n\t\t\tif (pathOccupied(target)) throw error\n\t\t\tcpSync(canonicalSkills, target, { recursive: true })\n\t\t}\n\t}\n\n\treturn projections.map(({ harness }) => harness.name)\n}\n","import { join } from 'node:path'\nimport { type HarnessName, selectHarnesses } from '../harness-registry/harness-registry.ts'\nimport { countSkills, projectSkills } from '../skill-projection/skill-projection.ts'\n\nexport type InitializeOptions = {\n\troot: string\n\tharnesses?: HarnessName[]\n\tcopy?: boolean\n\tforce?: boolean\n}\nexport type InitializeResult = {\n\troot: string\n\tharnesses: HarnessName[]\n\tnative: HarnessName[]\n\tlinked: HarnessName[]\n\t/** Enabled harnesses whose name has been superseded, as `{ name, replacedBy }`. */\n\tdeprecated: { name: HarnessName; replacedBy: HarnessName }[]\n\tskills: number\n\tcopied: boolean\n}\n\nexport function initializeHarnesses({\n\troot,\n\tharnesses: preferred = [],\n\tcopy = false,\n\tforce = false,\n}: InitializeOptions): InitializeResult {\n\tconst canonicalSkills = join(root, '.agents', 'skills')\n\tconst skills = countSkills(canonicalSkills)\n\tconst harnesses = selectHarnesses(root, preferred)\n\tconst linked = projectSkills({ root, canonicalSkills, harnesses, copy, force })\n\n\treturn {\n\t\troot,\n\t\tharnesses: harnesses.map((harness) => harness.name),\n\t\tnative: harnesses.filter((harness) => !harness.project.skillsDirectory).map((harness) => harness.name),\n\t\tlinked,\n\t\tdeprecated: harnesses\n\t\t\t.filter((harness) => harness.deprecated)\n\t\t\t.map((harness) => ({ name: harness.name, replacedBy: harness.deprecated as HarnessName })),\n\t\tskills,\n\t\tcopied: copy,\n\t}\n}\n","import type { cli } from 'clibuilder'\nimport { command, z } from 'clibuilder'\nimport { parseFormat, writeResult } from '../command-output/command-output.ts'\nimport { doctorCommand } from '../diagnose-bridges/doctor.command.ts'\nimport { type HarnessName, harnessRegistry } from '../harness-registry/harness-registry.ts'\nimport { initializeHarnesses } from './initialize-harnesses.ts'\n\nexport const initCommand: cli.Command = command({\n\tname: 'init',\n\tdescription: 'Set up canonical agent skills for the harnesses already enabled in a repository.',\n\toptions: {\n\t\troot: {\n\t\t\tdescription: 'Repository or package directory. Defaults to the current directory.',\n\t\t\ttype: z.optional(z.string()),\n\t\t},\n\t\tharness: {\n\t\t\tdescription: 'Comma-separated harnesses to enable in addition to Claude Code and Cursor, e.g. codex,gemini-cli.',\n\t\t\ttype: z.optional(z.string()),\n\t\t},\n\t\tcopy: {\n\t\t\tdescription: 'Copy skills instead of linking them.',\n\t\t\ttype: z.optional(z.boolean()),\n\t\t},\n\t\tforce: {\n\t\t\tdescription: 'Replace conflicting target skill directories.',\n\t\t\ttype: z.optional(z.boolean()),\n\t\t},\n\t\tformat: {\n\t\t\tdescription: 'Output format: toon (default), json, or text for a human-readable report.',\n\t\t\ttype: z.optional(z.string()),\n\t\t\tdefault: 'toon',\n\t\t},\n\t},\n\trun(args) {\n\t\ttry {\n\t\t\tconst format = parseFormat(args.format)\n\t\t\tconst requested = args.harness\n\t\t\t\t?.split(',')\n\t\t\t\t.map((name) => name.trim())\n\t\t\t\t.filter(Boolean)\n\t\t\tconst unsupported = requested?.filter((name) => !harnessRegistry.some((harness) => harness.name === name))\n\t\t\tif (unsupported?.length)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Unsupported harness: ${unsupported.join(', ')}. Supported: ${harnessRegistry\n\t\t\t\t\t\t.map((harness) => harness.name)\n\t\t\t\t\t\t.join(', ')}.`,\n\t\t\t\t)\n\t\t\twriteResult(\n\t\t\t\tinitializeHarnesses({\n\t\t\t\t\troot: args.root ?? process.cwd(),\n\t\t\t\t\t...(requested?.length ? { harnesses: requested as HarnessName[] } : {}),\n\t\t\t\t\t...(args.copy === undefined ? {} : { copy: args.copy }),\n\t\t\t\t\t...(args.force === undefined ? {} : { force: args.force }),\n\t\t\t\t}),\n\t\t\t\tformat,\n\t\t\t)\n\t\t} catch (error) {\n\t\t\tprocess.stderr.write(`error: ${error instanceof Error ? error.message : 'Harness initialization failed.'}\\n`)\n\t\t\tprocess.exitCode = 1\n\t\t}\n\t},\n})\n\n// Named for the package rather than shortened to `harness`: `repobuddy` mounts every plugin into one\n// command namespace, where `harness` is generic enough to collide with another plugin's.\nexport const harnessCommand: cli.Command = command({\n\tname: 'agent-harness',\n\tdescription: 'Commands for configuring agent harness compatibility.',\n\tcommands: [initCommand, doctorCommand],\n})\n\nexport function activate({ addCommand }: { addCommand(command: typeof harnessCommand): void }): void {\n\taddCommand(harnessCommand)\n}\n"],"mappings":";;;;;;;AAKA,MAAM,UAAmC;CAAC;CAAQ;CAAQ;AAAM;;AAGhE,SAAgB,YAAY,OAAyC;CACpE,IAAI,CAAC,QAAQ,SAAS,KAAqB,GAAG,MAAM,IAAI,MAAM,uCAAuC;CACrG,OAAO;AACR;;AAGA,SAAgB,YAAY,OAAe,QAA4B;CACtE,QAAQ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