@descent-vtt/spec-harness 0.19.0 → 0.21.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.
Files changed (50) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +325 -0
  4. package/README.md +39 -18
  5. package/dist/briefs.d.ts +45 -0
  6. package/dist/briefs.js +73 -0
  7. package/dist/briefs.js.map +1 -1
  8. package/dist/cli.d.ts +1 -1
  9. package/dist/cli.js +308 -142
  10. package/dist/cli.js.map +1 -1
  11. package/dist/commands.js +7 -2
  12. package/dist/commands.js.map +1 -1
  13. package/dist/config.d.ts +13 -1
  14. package/dist/config.js +14 -3
  15. package/dist/config.js.map +1 -1
  16. package/dist/configure.d.ts +94 -3
  17. package/dist/configure.js +204 -30
  18. package/dist/configure.js.map +1 -1
  19. package/dist/fs.d.ts +104 -1
  20. package/dist/fs.js +383 -11
  21. package/dist/fs.js.map +1 -1
  22. package/dist/git.d.ts +88 -2
  23. package/dist/git.js +155 -8
  24. package/dist/git.js.map +1 -1
  25. package/dist/guard.d.ts +20 -1
  26. package/dist/guard.js +31 -0
  27. package/dist/guard.js.map +1 -1
  28. package/dist/hooks.d.ts +59 -0
  29. package/dist/hooks.js +76 -3
  30. package/dist/hooks.js.map +1 -1
  31. package/dist/round.d.ts +27 -1
  32. package/dist/round.js +75 -17
  33. package/dist/round.js.map +1 -1
  34. package/dist/sandbox.js +4 -3
  35. package/dist/sandbox.js.map +1 -1
  36. package/dist/server.d.ts +25 -1
  37. package/dist/server.js +230 -28
  38. package/dist/server.js.map +1 -1
  39. package/dist/setup.js +40 -10
  40. package/dist/setup.js.map +1 -1
  41. package/dist/siblings.d.ts +29 -6
  42. package/dist/siblings.js +152 -39
  43. package/dist/siblings.js.map +1 -1
  44. package/dist/usage.d.ts +42 -7
  45. package/dist/usage.js +65 -6
  46. package/dist/usage.js.map +1 -1
  47. package/dist/workspace.d.ts +45 -3
  48. package/dist/workspace.js +143 -13
  49. package/dist/workspace.js.map +1 -1
  50. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"configure.js","sourceRoot":"","sources":["../src/configure.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAiB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,YAAY,EAAwB,MAAM,eAAe,CAAC;AAI/F,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,SAAS,WAAW,CAAC,KAAc,EAAE,QAA2B;IAC9D,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5H,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,GAAG,GAAG,4DAA4D,CAAC;AAEzE,sGAAsG;AACtG,MAAM,CAAC,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,YAAY,GAAG,mCAAmC,CAAC;AACzD,+GAA+G;AAC/G,MAAM,MAAM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C,CAAC,CAAC,QAAQ,WAAW,aAAa,CAAC,CAAC,CAAC,GAAG,WAAW,aAAa,CAAC;IACvF,IAAI,KAAK;QAAE,OAAO,GAAG,OAAO,sHAAsH,CAAC;IACnJ,OAAO,GAAG,OAAO,qEAAqE,MAAM,0CAA0C,MAAM,0CAA0C,CAAC;AACzL,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,cAAc,CAAC,OAAa,EAAE,WAAmB;IAC/D,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1G,IAAI,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/C,OAAO,EAAE,GAAG,OAAO,EAAE,eAAe,EAAE,CAAC,GAAG,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC;AACpE,CAAC","sourcesContent":["/**\n * What `init` writes into each tool's configuration, and what `doctor` says\n * of the result.\n *\n * Pure: `setup.ts` and the command line read the files and ask git, and\n * write what these return, so the core sweep holds these to the unit suite.\n * Each merge keeps what a person wrote and returns `null` when there is\n * nothing to add.\n */\n\nimport { isAbsolute, join } from 'node:path';\nimport { runInNewContext } from 'node:vm';\n\nimport { CALLABLE_TOOLS } from './hooks.js';\nimport { literal } from './literal.js';\nimport type { AllowedSigner } from './signers.js';\nimport type { LocalBranch } from './types.js';\nimport { namedTree, type HookLine } from './usage.js';\nimport { parseGlobList } from './vendor/spec-core/pattern/index.js';\nimport { CLAUDE_CODE_MINIMUM, meets, parseVersion, type ClaudeCodeCheck } from './versions.js';\n\ntype Json = Record<string, unknown>;\n\nfunction isObject(value: unknown): value is Json {\n return typeof value === 'object' && value !== null;\n}\n\nfunction sameStrings(value: unknown, expected: readonly string[]): boolean {\n return Array.isArray(value) && value.length === expected.length && value.every((item, index) => item === expected[index]);\n}\n\n/**\n * The command line as the project installed it. Claude Code starts a plugin's\n * server in the plugin's own directory and a hook wherever the session\n * stands, so neither can rely on `npx` finding the project's install; and on\n * Windows a server's command is started without a shell, where `npx` is a\n * shim that cannot start at all. `node` and the script's path work\n * everywhere. git's hook runs the same script, from the top of the work\n * tree, where git starts it.\n */\nconst BIN = 'node_modules/@descent-vtt/spec-harness/bin/spec-harness.js';\n\n/** The project root, as Claude Code substitutes it in a hook's arguments and in a plugin server's. */\nexport const PROJECT_DIR = '${CLAUDE_PROJECT_DIR}';\n\n/**\n * The project root in a project's own `.mcp.json`. Claude Code expands it\n * there from its own environment, which does not hold it, so it needs a\n * default; `.` is right, since a project's server starts in the project.\n */\nexport const PROJECT_DIR_OR_HERE = '${CLAUDE_PROJECT_DIR:-.}';\n\n/**\n * The matcher every release wrote: each name the hook reads a file from\n * (hooks.ts). `MultiEdit` is one no supported Claude Code has a tool for,\n * and Claude Code compares a listed name with a tool's exactly, so it starts\n * the hook for nothing there. It stays, since the hook is asked about a name\n * only under a matcher that lets the name through, and it reads this one for\n * whatever still sends it.\n */\nconst HOOK_MATCHER = 'Edit|Write|MultiEdit|NotebookEdit';\n/** The event Claude Code runs before a tool call, the only one of the two where a hook can refuse the call. */\nconst BEFORE = 'PreToolUse';\n/** The event after a call that succeeded, where a hook can only tell the model what it wrote. */\nconst AFTER = 'PostToolUse';\nconst GUARDED_EVENTS = [BEFORE, AFTER];\n/**\n * The event Claude Code runs as a session starts, under which the hook says\n * what would hold every write of it (ADR-0005). Its entry has no matcher:\n * left out, it is every way a session starts.\n */\nconst AT_START = 'SessionStart';\nconst GUARD_ARGS: readonly string[] = Object.freeze([`${PROJECT_DIR}/${BIN}`, 'hook', 'claude']);\n\n/**\n * The guard as a Claude Code hook: exec form, `args` given, so the project's\n * path is one argument whatever it holds, and no shell is involved.\n */\nexport const GUARD_HOOK: Readonly<Json> = Object.freeze({ type: 'command', command: 'node', args: GUARD_ARGS, timeout: 60 });\n\n// bare-name: what 0.1 installed, an npx command found from wherever the\n// session stood. Read here so that init replaces it, and never run.\nconst LEGACY_HOOK = 'npx --no-install spec-harness hook claude';\nconst LEGACY_SERVER_ARGS = ['--no-install', 'spec-harness', 'mcp'];\n\nfunction isGuard(hook: unknown): boolean {\n return isObject(hook) && hook['command'] === 'node' && sameStrings(hook['args'], GUARD_ARGS);\n}\n\nfunction isLegacyGuard(hook: unknown): boolean {\n return isObject(hook) && hook['command'] === LEGACY_HOOK;\n}\n\nfunction hooksOf(group: unknown): unknown[] {\n return isObject(group) && Array.isArray(group['hooks']) ? group['hooks'] : [];\n}\n\n/** A group with 0.1's guard replaced where it stands, keeping its other fields; the group itself when it has none. */\nfunction upgraded(group: unknown): unknown {\n const hooks = hooksOf(group);\n if (!hooks.some(isLegacyGuard)) return group;\n return { ...(group as Json), hooks: hooks.map((hook) => (isLegacyGuard(hook) ? { ...(hook as Json), command: 'node', args: [...GUARD_ARGS] } : hook)) };\n}\n\n/**\n * The tools, of those that write a file and a supported Claude Code can call\n * (hooks.ts), that a group's matcher has Claude Code start the group's hooks\n * for, by its hooks reference\n * (https://code.claude.com/docs/en/hooks, Matcher patterns, read\n * 2026-10-12): left out, empty or `*`, every tool; made of letters, digits,\n * `_`, `-`, spaces, `,` and `|` alone, the tools it names, one between each\n * `|` or `,`; with any other character in it, a JavaScript regular\n * expression that may match anywhere in a tool's name. `null` where the\n * reference does not say, or it cannot be told: a matcher that is neither\n * text nor an array, is no pattern, or is a pattern whose reading runs out\n * its budget.\n *\n * Two things its page on debugging a configuration adds\n * (https://code.claude.com/docs/en/debug-your-config, Check hooks and Check\n * common causes, read 2026-10-14). A matcher that is an array is an entry\n * Claude Code lists as an invalid setting, among the reasons a hook is not\n * loaded and never fires: no tool. And a comma separates names only from\n * {@link COMMA_SINCE} on; its changelog adds that a hyphenated name is\n * matched exactly only from {@link HYPHEN_SINCE} on. So a matcher of names\n * with either in it is read as `matching` has the Claude Code here read it\n * ({@link namesReadings}), and where the readings it may have differ, it\n * cannot be told.\n */\nfunction matchedTools(matcher: unknown, pattern: PatternReader, matching: Matching): readonly string[] | null {\n if (matcher === undefined || matcher === '' || matcher === '*') return CALLABLE_TOOLS;\n if (Array.isArray(matcher)) return [];\n if (typeof matcher !== 'string') return null;\n if (!NAMES.test(matcher)) return pattern(matcher);\n // A reading that cannot be told, or two that differ, leave the matcher one\n // whose tools cannot be told; where every reading comes to the same tools,\n // nothing turns on which the release has.\n const readings = namesReadings(matcher, pattern, matching);\n return readings.every((tools) => sameStrings(tools, readings[0]!)) ? readings[0]! : null;\n}\n\n/** A matcher that is a name, or names between `|` and `,`: what the reference compares with a tool's name exactly. */\nconst NAMES = /^[A-Za-z0-9_\\- ,|]*$/;\n\n/** The writing tools a matcher of names lists, one between each `|` or `,`. */\nfunction listedTools(matcher: string): readonly string[] {\n const names = matcher.split(/[|,]/).map((name) => name.trim());\n return CALLABLE_TOOLS.filter((tool) => names.includes(tool));\n}\n\n/**\n * The release of Claude Code from which a comma in a matcher separates\n * names as a `|` does. Its page on debugging a configuration (Check hooks,\n * read 2026-10-14) has a comma before it fall through to the reading of a\n * pattern, under which the matcher never matched, and its changelog has the\n * fix under this release: hooks with comma-separated matchers no longer\n * silently never firing.\n */\nexport const COMMA_SINCE = '2.1.191';\n\n/**\n * The release of Claude Code from which a hyphenated name in a matcher of\n * names is matched exactly. Its changelog\n * (https://code.claude.com/docs/en/changelog, 2.1.195, read 2026-10-18) has,\n * among its fixes, hook matchers with hyphenated identifiers that matched as\n * substrings, and match exactly from this release on; it does not say how\n * the rest of such a matcher was read.\n */\nexport const HYPHEN_SINCE = '2.1.195';\n\n/**\n * How the Claude Code that runs the hooks reads a matcher of names: as every\n * release from {@link HYPHEN_SINCE} on, and the hooks reference today; as\n * the release named, which is older; or it cannot be told, where the release\n * cannot.\n */\nexport type Matching = { readonly as: 'today' } | { readonly as: 'older'; readonly release: string } | { readonly as: 'untold' };\n\n/** The reading every release from {@link HYPHEN_SINCE} on has, and what a caller that asks no release is given. */\nconst TODAY: Matching = { as: 'today' };\n\n/**\n * How the Claude Code doctor asked its release reads a matcher of names. A\n * release that was not asked, or could not be told, leaves the reading\n * untold: asked or not, nothing says which it is.\n */\nexport function matchingUnder(release: ClaudeCodeCheck | null): Matching {\n if (release === null || release.state === 'unknown') return { as: 'untold' };\n // A release that was told is one whose version was read as one, and the\n // constant is a version, so both parse.\n return meets(parseVersion(release.version)!, parseVersion(HYPHEN_SINCE)!) ? TODAY : { as: 'older', release: release.version };\n}\n\n/** Whether `release` reads a comma in `matcher` as part of a pattern: one before {@link COMMA_SINCE}, where the matcher holds one. */\nfunction commaAsPattern(matcher: string, release: string): boolean {\n return matcher.includes(',') && !meets(parseVersion(release)!, parseVersion(COMMA_SINCE)!);\n}\n\n/** A matcher of names that holds a comma, as a release before {@link COMMA_SINCE} reads it. */\nfunction commaEarlier(matcher: string, pattern: PatternReader): readonly string[] | null {\n // No tool, where the matcher read as a pattern matches none of the writing\n // tools, which is what the page has such a matcher do; and where it matches\n // one, as `Edit|Write,Bash` matches `Edit`, the page's two sentences, that\n // a comma is read as part of a pattern and that the matcher never matched,\n // disagree, and it cannot be told.\n const read = pattern(matcher);\n return read !== null && read.length === 0 ? read : null;\n}\n\n/**\n * Each reading the Claude Code here may have of a matcher of names: the\n * writing tools it lists, or `null` where a reading cannot be told. From\n * {@link HYPHEN_SINCE} on there is one, the names matched exactly. Before\n * {@link COMMA_SINCE} a comma in it makes it a pattern ({@link commaEarlier}).\n * Before {@link HYPHEN_SINCE} a hyphen in it made it match as a substring,\n * and the changelog does not say which way: each name matched exactly but\n * the one with the hyphen, the matcher read as a pattern, which matches\n * anywhere in a tool's name, or its whole text found in a tool's name, which\n * no writing tool's holds, since none has a hyphen. A release that cannot be\n * told may read it any way a release does.\n */\nfunction namesReadings(matcher: string, pattern: PatternReader, matching: Matching): (readonly string[] | null)[] {\n const listed = listedTools(matcher);\n if (matching.as === 'today') return [listed];\n const substring = matcher.includes('-') ? [pattern(matcher), []] : [];\n if (matching.as === 'older') return commaAsPattern(matcher, matching.release) ? [commaEarlier(matcher, pattern)] : [listed, ...substring];\n return [listed, ...(matcher.includes(',') ? [commaEarlier(matcher, pattern)] : []), ...substring];\n}\n\n/**\n * How long the reading of one pattern may take, in milliseconds of the\n * clock. A sane matcher is read in about half of one (ADR-0005), so only a\n * pattern that backtracks without end meets it; on a machine under load an\n * ordinary one may, and is then said as one that cannot be told, where an\n * idle machine reads it.\n */\nconst PATTERN_BUDGET = 100;\n\n/**\n * The writing tools a matcher that is a pattern matches, or `null` where it\n * is no pattern, or its reading runs out its budget.\n *\n * The pattern is a line of a settings file, which arrives with a clone, and\n * one can be written that a test of a few short names never finishes:\n * `^((((([A-Za-z]*)*)*)*)*)*$X` ran for more than ten seconds. Tested as\n * written, one such entry and neither doctor nor init would come back, with\n * no word. So it is made and tested in a context of its own, whose run\n * takes a timeout where a test in this one takes none, and what throws\n * there, a pattern that is none or the stop itself, is a matcher that\n * cannot be told. The shape of a pattern does not say which will: groups in\n * a row backtrack as nested ones do.\n */\nfunction patternTools(source: string): readonly string[] | null {\n try {\n const matched: string[] = runInNewContext('tools.filter((tool) => new RegExp(source).test(tool))', { tools: CALLABLE_TOOLS, source }, { timeout: PATTERN_BUDGET });\n return matched;\n } catch {\n return null;\n }\n}\n\n/** What reads a matcher that is a pattern: the writing tools it matches, or `null` where that cannot be told. */\nexport type PatternReader = (source: string) => readonly string[] | null;\n\n/**\n * A reader for one run: a pattern is read the first time it is asked of,\n * and answered from that reading after.\n *\n * A reading that runs out its budget costs the whole of it, a settings file\n * can hold one matcher over any number of entries, and init asks of an\n * entry twice, for what doctor says of the file and for what to write into\n * it. Fifty entries under one such pattern were fifty readings, five and a\n * half seconds, and fifty-one for init; they are one. Nothing is spared a\n * file that holds a pattern of its own for each entry.\n *\n * Made where a run begins and handed down, never kept by this module: a\n * reading is of the clock, so one kept past its run would answer for a\n * machine that is busy no longer.\n */\nexport function patternReader(read: PatternReader = patternTools): PatternReader {\n const known = new Map<string, readonly string[] | null>();\n return (source) => {\n const before = known.get(source);\n if (before !== undefined) return before;\n const tools = read(source);\n known.set(source, tools);\n return tools;\n };\n}\n\n/** Whether Claude Code runs a hook's entry in the background, where it waits on no answer of it. */\nfunction inBackground(hook: Json): boolean {\n return hook['async'] === true || hook['asyncRewake'] === true;\n}\n\n/**\n * The writing tools whose call Claude Code hands an entry under `event` and\n * waits for it on, or `null` where that cannot be told here. Before a write\n * an entry in the background answers too late to refuse it, so it is waited\n * on for none (the reference, Run hooks in the background). An `if` has the\n * entry started only for the calls its rule matches, in the syntax of a\n * permission rule, which is not read here.\n */\nfunction answered(event: string, matcher: unknown, hook: Json, pattern: PatternReader, matching: Matching): readonly string[] | null {\n if (event === BEFORE && inBackground(hook)) return [];\n if (hook['if'] !== undefined) return null;\n return matchedTools(matcher, pattern, matching);\n}\n\n/**\n * `.claude/settings.json`, or the plugin's hooks, with the guard hooks merged\n * in; `null` when they are already there.\n *\n * An event has the guard where Claude Code starts init's own line under it\n * for a write. Where the settings hold another line of the hook that it\n * starts for a write, one `isHook` knows as the hook's by the words after\n * the harness's command, nothing is merged in at all: the line is a\n * person's, a second one beside it would run for every write as well, and\n * init rewrites none but the one 0.1 wrote. Without `isHook`, only init's\n * own line is known: the default's `false` and an `undefined` read the same\n * in `some`, so that mutant is equivalent.\n *\n * `pattern` reads a matcher that is a pattern: the run's own reader, where\n * the run has read the file's matchers already ({@link patternReader}).\n * `matching` is how the Claude Code here reads a matcher of names, where\n * the run asked its release ({@link matchingUnder}): a line that\n * release starts for no write is no guard, and init's own is written beside\n * it.\n */\nexport function mergeClaudeSettings(\n current: Json,\n isHook: (words: readonly string[]) => boolean = () => false,\n pattern: PatternReader = patternReader(),\n matching: Matching = TODAY,\n): Json | null {\n const hooks = isObject(current['hooks']) ? current['hooks'] : {};\n const theirs = harnessEntries(current).some((entry) => !isGuard(entry.hook) && !isLegacyGuard(entry.hook) && isHook(entry.words) && isStarted(toolsOf(entry, pattern, matching)));\n if (theirs) return null;\n let changed = false;\n const next: Json = { ...hooks };\n for (const event of GUARDED_EVENTS) {\n const listed = hooks[event];\n const before: unknown[] = Array.isArray(listed) ? listed : [];\n const groups = before.map(upgraded);\n const replaced = groups.some((group, index) => group !== before[index]);\n const present = harnessEntries({ hooks: { [event]: groups } }).some((entry) => isGuard(entry.hook) && isStarted(toolsOf(entry, pattern, matching)));\n if (!present) groups.push({ matcher: HOOK_MATCHER, hooks: [{ ...GUARD_HOOK, args: [...GUARD_ARGS] }] });\n if (replaced || !present) {\n next[event] = groups;\n changed = true;\n }\n }\n return changed ? { ...current, hooks: next } : null;\n}\n\n/**\n * Settings with init's entry under `SessionStart` added beside its two, or\n * `null` where it is not to be: where init's own line does not stand\n * under both `PreToolUse` and `PostToolUse`, a file init writes no hook\n * into or one it has yet to complete; and where a line of the hook stands\n * under `SessionStart` already, init's or one `isHook` knows, which would\n * say the same twice (ADR-0012).\n */\nexport function withSessionStart(settings: Json, isHook: (words: readonly string[]) => boolean): Json | null {\n const hooks = isObject(settings['hooks']) ? settings['hooks'] : {};\n const own = GUARDED_EVENTS.every((event) => harnessEntries({ hooks: { [event]: hooks[event] } }).some((entry) => isGuard(entry.hook)));\n if (!own || startsSessions(settings, isHook)) return null;\n const listed = hooks[AT_START];\n return { ...settings, hooks: { ...hooks, [AT_START]: [...(Array.isArray(listed) ? listed : []), { hooks: [{ ...GUARD_HOOK, args: [...GUARD_ARGS] }] }] } };\n}\n\n/**\n * Whether settings have Claude Code start the hook as a session starts: an\n * entry under `SessionStart` whose line is init's, or one `isHook` knows\n * as the hook's. Its matcher is not read: one that names some of the ways a\n * session starts has the check made for those.\n */\nexport function startsSessions(settings: unknown, isHook: (words: readonly string[]) => boolean): boolean {\n const groups = field(field(settings, 'hooks'), AT_START);\n if (!Array.isArray(groups)) return false;\n return groups.some((group) => hooksOf(group).some((hook) => isObject(hook) && (isGuard(hook) || knownAs(hook, isHook))));\n}\n\n/** Whether `isHook` knows an entry's line as the hook's. */\nfunction knownAs(hook: Json, isHook: (words: readonly string[]) => boolean): boolean {\n const written = writtenHook(hook);\n return written !== null && isHook(written.words);\n}\n\n/**\n * What doctor notes where settings hold the guard hooks and none under\n * `SessionStart`: what would hold every write is said at the first write,\n * which it holds, and not as the session starts.\n */\nexport const NO_SESSION_START =\n 'note: no settings file has Claude Code start the hook as a session starts, so a configuration that does not load, or a brief named that spec-brief does not list, is said only at the first write, which it holds: spec-harness init --write adds the entry beside the two it wrote';\n\n/** The server's entry, reading the project at `projectDir`: {@link PROJECT_DIR} for the plugin, {@link PROJECT_DIR_OR_HERE} for a project. */\nexport function mcpServer(projectDir: string): Json {\n return { command: 'node', args: [`${projectDir}/${BIN}`, 'mcp', '--root', projectDir] };\n}\n\nfunction isLegacyServer(server: unknown): boolean {\n return isObject(server) && server['command'] === 'npx' && sameStrings(server['args'], LEGACY_SERVER_ARGS);\n}\n\n/**\n * A project's `.mcp.json` with the harness's server merged in, or `null` when\n * one is registered. A server registered under the name some other way is\n * the person's, and stays; 0.1's npx entry is replaced, keeping its other\n * fields.\n */\nexport function mergeMcp(current: Json): Json | null {\n const servers = isObject(current['mcpServers']) ? current['mcpServers'] : {};\n const existing = servers['spec-harness'];\n if ('spec-harness' in servers && !isLegacyServer(existing)) return null;\n return { ...current, mcpServers: { ...servers, 'spec-harness': { ...(existing as Json | undefined), ...mcpServer(PROJECT_DIR_OR_HERE) } } };\n}\n\n/** A key of a file read as JSON; a file that is missing, or is not a JSON object, holds nothing. */\nfunction field(file: unknown, key: string): unknown {\n return isObject(file) ? file[key] : undefined;\n}\n\n/** The harness's command on a line: its script, or its name, alone or at the end of a path. */\nfunction isLauncher(word: string): boolean {\n const name = word.split(/[\\\\/]/).at(-1);\n return name === 'spec-harness' || name === 'spec-harness.js';\n}\n\n/** Anything in a word that a shell reads before the program is handed it: a quote, a variable, an operator, a pattern. */\nconst SHELL_READS = /[^A-Za-z0-9_./:=@%+,-]/;\n\n/** A line of the harness's in Claude Code's settings: what follows its command there. */\nexport interface WrittenHook {\n /** The events whose hooks hold the line, of the two the guard answers. */\n readonly events: readonly string[];\n /** What follows the harness's command, word for word as written. */\n readonly words: readonly string[];\n /**\n * Whether a shell reads those words first, and can change them: a line\n * with no `args`, which Claude Code hands to a shell, holding a quote, a\n * variable or anything else a shell rewrites. What the hook is handed is\n * then the shell's to say. With `args`, Claude Code hands each word over\n * as it stands.\n */\n readonly shell: boolean;\n /** Whether the entry sets `onFailure` to `\"block\"`. */\n readonly blocks: boolean;\n /**\n * What the entry has for `type` where that is not `\"command\"`, as it is\n * said of the line: none at all, or a word the reference does not list.\n * Whether Claude Code runs such an entry cannot be told. `null` for an\n * entry it runs as a command.\n */\n readonly untyped: string | null;\n}\n\n/**\n * The handler types that are no command, by Claude Code's hooks reference\n * (https://code.claude.com/docs/en/hooks, Hook handler fields, read\n * 2026-10-12): an entry of one sends a request, calls a tool of an MCP\n * server, or asks a model or an agent. It runs no command, the harness's or\n * any other, whatever else the entry holds.\n */\nconst OTHER_HANDLERS: readonly unknown[] = ['http', 'mcp_tool', 'prompt', 'agent'];\n\n/**\n * The line of an entry that runs the harness, or `null` for one that does\n * not. Only an entry Claude Code runs as a command is one: the reference\n * has `type` as a field every entry must have, with `\"command\"` for a\n * command and four other words, and says nothing of an entry with none or\n * with another word, which is kept, and said as one that cannot be told.\n */\nfunction writtenHook(hook: Json): Line | null {\n const { command, args, type } = hook;\n if (typeof command !== 'string' || OTHER_HANDLERS.includes(type)) return null;\n let line: string[];\n // Without arguments the line is a shell's, which splits it at its spaces:\n // at each one here, and what stands between two of them is no word.\n if (args === undefined) line = command.split(/\\s/).filter((word) => word !== '');\n else if (Array.isArray(args) && args.every((arg): arg is string => typeof arg === 'string')) line = [command, ...args];\n // Arguments that are not all text are no line Claude Code can start.\n else return null;\n const shell = args === undefined;\n // A quote around the path of the command is the shell's, dropped to know the command by.\n const at = line.findIndex((word) => isLauncher(shell ? word.replace(/[\"']/g, '') : word));\n if (at === -1) return null;\n const words = line.slice(at + 1);\n const untyped = type === 'command' ? null : type === undefined ? 'no \"type\"' : `the \"type\" ${JSON.stringify(type)}`;\n return { words, shell: shell && words.some((word) => SHELL_READS.test(word)), blocks: hook['onFailure'] === 'block', untyped };\n}\n\n/**\n * Every line in Claude Code's settings that runs the harness, under the two\n * events the guard answers: a line that stands under both, as init writes\n * it, is one line. Whose line each is, the guard's or another command's, is\n * the reader's to say (usage.ts): this knows the harness by its command\n * alone.\n */\nexport function writtenHooks(settings: unknown): WrittenHook[] {\n const found: { events: string[]; words: readonly string[]; shell: boolean; blocks: boolean; untyped: string | null }[] = [];\n for (const { event, words, shell, blocks, untyped } of harnessEntries(settings)) {\n const same = found.find((other) => sameLine(other, { words, shell, blocks, untyped }));\n if (same === undefined) found.push({ events: [event], words, shell, blocks, untyped });\n else if (!same.events.includes(event)) same.events.push(event);\n }\n return found;\n}\n\ntype Line = Omit<WrittenHook, 'events'>;\n\nfunction sameLine(one: Line, other: Line): boolean {\n return one.shell === other.shell && one.blocks === other.blocks && one.untyped === other.untyped && sameStrings(one.words, other.words);\n}\n\n/** An entry that runs the harness: its line, where it stands, and what decides whether Claude Code starts it there. */\ninterface HarnessEntry extends Line {\n readonly event: string;\n /** The matcher of the entry's group, as written; `undefined` where the group has none. */\n readonly matcher: unknown;\n readonly hook: Json;\n}\n\n/**\n * The writing tools whose call an entry is handed and waited on for, or\n * `null` where that cannot be told. Read where it is asked for and no\n * sooner: a matcher that is a pattern can cost its whole budget.\n */\nfunction toolsOf(entry: HarnessEntry, pattern: PatternReader, matching: Matching): readonly string[] | null {\n return answered(entry.event, entry.matcher, entry.hook, pattern, matching);\n}\n\n/** Every entry that runs the harness under the two events the guard answers, in the order the settings hold them. */\nfunction harnessEntries(settings: unknown): HarnessEntry[] {\n const hooks = field(settings, 'hooks');\n if (!isObject(hooks)) return [];\n return GUARDED_EVENTS.flatMap((event) => {\n const groups = hooks[event];\n if (!Array.isArray(groups)) return [];\n return groups.flatMap((group) =>\n hooksOf(group).flatMap((hook): HarnessEntry[] => {\n if (!isObject(hook)) return [];\n const written = writtenHook(hook);\n if (written === null) return [];\n return [{ ...written, event, matcher: field(group, 'matcher'), hook }];\n }),\n );\n });\n}\n\n/** Whether Claude Code starts a line for a write, by the tools it is waited on for: one whose tools cannot be told is taken as started. */\nexport function isStarted(tools: readonly string[] | null): boolean {\n return tools === null || tools.length > 0;\n}\n\n/** What doctor reports of one line of Claude Code's hook. */\nexport interface HookReport {\n /** The settings file that holds it, as a person finds it. */\n readonly file: string;\n readonly events: readonly string[];\n /** What follows the harness's command, as written. */\n readonly line: readonly string[];\n /**\n * `guards`: Claude Code waits on the hook before a write, and the hook\n * checks it. `off`: the hook checks no write, for a line it cannot read, a\n * root that is no directory, or a root that is a directory outside any\n * work tree; or it is never started, in a file an array for a matcher\n * keeps Claude Code from loading the hooks of. `held`: the hook holds every write, for a\n * brief the line names that is not one. `unstarted`: Claude Code waits on\n * the line before no write, so it is not the guard. `unknown`: what the\n * hook is handed, which writes it is started for, or whether Claude Code\n * runs the entry at all, cannot be told here.\n */\n readonly state: 'guards' | 'off' | 'held' | 'unstarted' | 'unknown';\n readonly onFailure: 'block' | null;\n /** What there is to say of what the hook does with the line, or `null`. */\n readonly detail: string | null;\n /** The writing tools Claude Code waits on the line before a write by, where the hook can refuse it, of those a supported Claude Code can call (hooks.ts); `null` where that cannot be told. */\n readonly before: readonly string[] | null;\n /** The writing tools Claude Code starts the line after a write by, where the hook can warn of it; `null` where that cannot be told. */\n readonly after: readonly string[] | null;\n /** What there is to say of the two, or `null` where they are every tool that writes, as init has it. */\n readonly cover: string | null;\n /** What `onFailure` changes, where the entry sets it to `\"block\"`. */\n readonly note: string | null;\n}\n\n/**\n * The release of Claude Code that reads `onFailure` on a hook's entry, by its\n * hooks reference (https://code.claude.com/docs/en/hooks, read 2026-10-12).\n */\nconst ON_FAILURE_SINCE = '2.1.295';\n\n/** What `onFailure: \"block\"` changes for a line, named by `where` it stands, or `null` where the entry does not set it. */\nfunction describeOnFailure(where: string, blocks: boolean, off: boolean): string | null {\n if (!blocks) return null;\n const holds = `${where} sets onFailure to \"block\", so Claude Code ${ON_FAILURE_SINCE} or later holds a write when the hook fails`;\n if (off) return `${holds}, which with this line is every write, the one that mends the line among them: mend it by hand`;\n return `${holds}, where it lets the write go ahead without it: by its exit 1 for a question it cannot read, by not starting, or by running past its timeout`;\n}\n\n/** Names as a sentence lists them: one, two with \"and\", more with commas before it. Never asked of none. */\nfunction named(names: readonly string[]): string {\n const last = names.at(-1)!;\n return names.length === 1 ? last : `${names.slice(0, -1).join(', ')} and ${last}`;\n}\n\n/** The writing tools a line's entries under `event` are waited on for between them, or `null` where an entry that cannot be told might add one. */\nfunction toolsUnder(event: string, entries: readonly HarnessEntry[], reading: Reading): readonly string[] | null {\n const read = entries.filter((entry) => entry.event === event).map((entry) => toolsOf(entry, reading.pattern, reading.matching));\n const sure = CALLABLE_TOOLS.filter((tool) => read.some((tools) => tools !== null && tools.includes(tool)));\n return sure.length < CALLABLE_TOOLS.length && read.some((tools) => tools === null) ? null : sure;\n}\n\n/** What a run reads every matcher with: its reader of patterns, and how the Claude Code here reads a matcher of names. */\ninterface Reading {\n readonly pattern: PatternReader;\n readonly matching: Matching;\n}\n\n/**\n * What is said after a matcher that Claude Code does not read as its text\n * suggests: an array, which it loads no hook under, and names with a comma or\n * a hyphen where the release here reads them another way than the newest\n * does, or cannot be told. Nothing for any other matcher, and nothing where\n * every reading the release may have is the names as listed.\n */\nfunction saidOfMatcher(matcher: unknown, { pattern, matching }: Reading): string {\n if (Array.isArray(matcher)) return ', an array, which Claude Code lists as an invalid setting and loads no hook under';\n if (typeof matcher !== 'string' || !NAMES.test(matcher)) return '';\n const tools = listedTools(matcher);\n if (namesReadings(matcher, pattern, matching).every((read) => sameStrings(read, tools))) return '';\n const listed = tools.length === 0 ? 'no tool that writes' : named(tools);\n const earlier = commaEarlier(matcher, pattern) === null ? 'a pattern whose matches its documentation does not give' : 'a pattern that matches no tool';\n const substring = \"a matcher with a hyphenated name in it matched as a substring, and Claude Code's changelog does not say how the rest of it was read\";\n if (matching.as === 'older') {\n if (commaAsPattern(matcher, matching.release)) return `, which Claude Code ${matching.release} reads as ${earlier}: a comma separates names from ${COMMA_SINCE} on, where the matcher is ${listed}`;\n return `, which Claude Code ${matching.release} may read otherwise: before ${HYPHEN_SINCE} ${substring}; from ${HYPHEN_SINCE} on it is ${listed}`;\n }\n // The release cannot be told: a comma alone turns on 2.1.191, and a hyphen on 2.1.195.\n if (!matcher.includes('-')) return `, which is ${listed} from Claude Code ${COMMA_SINCE} on, where a comma separates names, and ${earlier} before it: the release here cannot be told`;\n const comma = matcher.includes(',') ? `, and before ${COMMA_SINCE} ${earlier}, where a comma separated no names` : '';\n return `, which is ${listed} from Claude Code ${HYPHEN_SINCE} on, and may be read otherwise before it, where ${substring}${comma}: the release here cannot be told`;\n}\n\n/** What a line's entries under `event` hold that decides when Claude Code starts them, as written. */\nfunction entriesUnder(event: string, entries: readonly HarnessEntry[], reading: Reading): string {\n const under = entries.filter((entry) => entry.event === event);\n if (under.length === 0) return `it stands under no ${event}`;\n const said = under.map(({ matcher, hook }) => {\n const pattern = matcher === undefined ? 'no matcher' : `the matcher ${JSON.stringify(matcher)}${saidOfMatcher(matcher, reading)}`;\n const background = inBackground(hook) ? ' in the background' : '';\n const rule = hook['if'] === undefined ? '' : ` with \"if\" ${JSON.stringify(hook['if'])}`;\n return `${pattern}${background}${rule}`;\n });\n return `under ${event} it has ${named([...new Set(said)])}`;\n}\n\n/**\n * What is said of the writes Claude Code starts a line for, by the event and\n * the matcher of each entry that holds it; `null` where it is waited on\n * before every tool that writes and started after each, as init writes it.\n * A tool is one a supported Claude Code can call: `MultiEdit`, which the\n * hook still reads a path from, is named as unchecked for no line, since no\n * such Claude Code has it to call (hooks.ts).\n */\nfunction describeCover(where: string, before: readonly string[] | null, after: readonly string[] | null, entries: readonly HarnessEntry[], reading: Reading): string | null {\n const parts: string[] = [];\n const left = (tools: readonly string[]): string[] => CALLABLE_TOOLS.filter((tool) => !tools.includes(tool));\n if (before === null) parts.push(`which writes Claude Code waits on it before cannot be told here (${entriesUnder(BEFORE, entries, reading)})`);\n else if (before.length === 0) parts.push(`Claude Code waits on it before no write, so it is not the guard and refuses none (${entriesUnder(BEFORE, entries, reading)})`);\n else if (left(before).length > 0) {\n parts.push(`Claude Code waits on it before a write by ${named(before)}, and before none by ${named(left(before))}, which goes unchecked (${entriesUnder(BEFORE, entries, reading)})`);\n }\n if (after === null) parts.push(`which writes it is started after cannot be told here (${entriesUnder(AFTER, entries, reading)})`);\n else if (after.length === 0) parts.push(`it is started after no write, so it warns of none (${entriesUnder(AFTER, entries, reading)})`);\n else if (left(after).length > 0) parts.push(`it is started after a write by ${named(after)} alone (${entriesUnder(AFTER, entries, reading)})`);\n return parts.length === 0 ? null : `${where}: ${parts.join('; ')}`;\n}\n\n/** The events under which an array for a matcher keeps Claude Code from loading the rest of a file's hooks. */\nconst UNLOADING: readonly string[] = [BEFORE, 'PermissionRequest'];\n\n/** An array that stands for a matcher where it unloads a settings file's hooks: the event it stands under, and the array as written. */\nexport interface ArrayMatcher {\n readonly event: string;\n readonly matcher: string;\n}\n\n/**\n * The first array that stands for a matcher under `PreToolUse` or\n * `PermissionRequest` in a settings file, or `null`.\n *\n * Claude Code's page on debugging a configuration\n * (https://code.claude.com/docs/en/debug-your-config, Check hooks, read\n * 2026-10-14) has a matcher that is an array, where it must be one string,\n * as an entry Claude Code lists as an invalid setting, at the start of an\n * interactive session and in `claude doctor`; and where the array is under\n * one of these two events, none of that file's other hooks load either. It\n * names no release. So a file that holds one runs no hook at all, whoever\n * wrote the entry and whatever it runs: the array's own is not loaded, and\n * neither is any other.\n */\nexport function arrayMatcher(settings: unknown): ArrayMatcher | null {\n const hooks = field(settings, 'hooks');\n for (const event of UNLOADING) {\n const groups = field(hooks, event);\n if (!Array.isArray(groups)) continue;\n const group = groups.find((candidate) => Array.isArray(field(candidate, 'matcher')));\n if (group !== undefined) return { event, matcher: JSON.stringify(field(group, 'matcher')) };\n }\n return null;\n}\n\n/** What is said of a settings file that an array for a matcher keeps Claude Code from loading the hooks of. */\nexport function describeArrayMatcher(file: string, { event, matcher }: ArrayMatcher): string {\n return `${file} has an array for a matcher under ${event}, ${matcher}, which Claude Code lists as an invalid setting, and beside one under PreToolUse or PermissionRequest it loads none of the file's other hooks`;\n}\n\n/** How a matcher that is an array is mended. */\nexport const ONE_STRING = 'write the matcher as one string, its names between \"|\"';\n\n/** The words Claude Code hands the hook for a line: what follows the harness's command, each `${CLAUDE_PROJECT_DIR}` filled with `project`. */\nfunction handedWords(words: readonly string[], project: string): string[] {\n return words.map((word) => word.split(PROJECT_DIR).join(project));\n}\n\n/** The words handed over for every line of the harness's in the settings files, for a caller that has to ask something of each before it reports them. */\nexport function handedLines(sources: readonly ClaudeSettings[], project: string): string[][] {\n return sources.flatMap(({ settings }) => writtenHooks(settings).map((hook) => handedWords(hook.words, project)));\n}\n\n/**\n * The lines of Claude Code's hook in the settings files, each with what the\n * hook does with it and which writes Claude Code starts it for. `read` is\n * the hook's own reading of the words it is handed (usage.ts), `null` for a\n * line that is not its; the words are handed to it as Claude Code hands them\n * to the hook, each `${CLAUDE_PROJECT_DIR}` filled with `project`.\n *\n * A line that guards and holds no more than a release wrote is reported\n * with nothing to say, as it always was. One with more on it is said as it\n * is, and fails nothing. One the hook cannot read, or whose root is no\n * directory, or is in no work tree that holds the project, is a guard that\n * is off, and one that names a brief which is not\n * one holds every write: each a problem, and doctor exits 1 for it. A line\n * Claude Code waits on before no write is not the guard, whatever the hook\n * would do with it.\n *\n * `pattern` reads a matcher that is a pattern, once for every entry under\n * it in every file: the run's own reader, where something else in the run\n * reads the same files ({@link patternReader}). `matching` is how the\n * Claude Code here reads a matcher of names, where its release was asked\n * ({@link matchingUnder}); a caller that asks none reads one as every\n * release from {@link HYPHEN_SINCE} on does.\n *\n * A file that holds an array for a matcher under `PreToolUse` or\n * `PermissionRequest` has none of its hooks loaded ({@link arrayMatcher}):\n * each line of the hook there is started for no write, and one that stood\n * to be started for a write is a guard that is off.\n */\nexport function reportHooks(\n sources: readonly ClaudeSettings[],\n project: string,\n read: (words: readonly string[]) => HookLine | null,\n pattern: PatternReader = patternReader(),\n matching: Matching = TODAY,\n): HookReport[] {\n const reading: Reading = { pattern, matching };\n return sources.flatMap(({ file, settings }) => {\n const entries = harnessEntries(settings);\n const array = arrayMatcher(settings);\n return writtenHooks(settings).flatMap((hook): HookReport[] => {\n const handed = read(handedWords(hook.words, project));\n if (handed === null) return [];\n const both = GUARDED_EVENTS.every((event) => hook.events.includes(event));\n // An empty word is shown as a shell spells one, where joined it would not show at all.\n // A line that is not under both events is under one.\n const where = `\"${hook.words.map((word) => (word === '' ? \"''\" : word)).join(' ')}\" in ${file}${both ? '' : ` (under ${hook.events[0]} alone)`}`;\n const mine = entries.filter((entry) => sameLine(entry, hook));\n const before = toolsUnder(BEFORE, mine, reading);\n const after = toolsUnder(AFTER, mine, reading);\n if (array !== null) {\n // Nothing of the file is loaded, whatever the line holds and\n // whatever the hook would do with it. A line that stood to be\n // started for a write, or stands under an array itself, where\n // someone meant a matcher, is a guard set up that checks nothing;\n // one that stood to be started for none leaves no write unchecked\n // that it was ever asked about.\n const unloaded = { file, events: hook.events, line: hook.words, onFailure: hook.blocks ? 'block' : null, before: [], after: [], cover: null, note: null } satisfies Partial<HookReport>;\n const said = `${where}: ${describeArrayMatcher(file, array)}`;\n if (isStarted(before) || isStarted(after) || mine.some((entry) => Array.isArray(entry.matcher))) {\n return [{ ...unloaded, state: 'off', detail: `${said}, so the guard is off and no write is checked; ${ONE_STRING}` }];\n }\n return [{ ...unloaded, state: 'unstarted', detail: `${said}: the line is not started, and stood to be started for no write as it is, so no guard is switched off` }];\n }\n const written = { file, events: hook.events, line: hook.words, onFailure: hook.blocks ? 'block' : null, before, after, cover: describeCover(where, before, after, mine, reading) } satisfies Partial<HookReport>;\n const note = describeOnFailure(where, hook.blocks, false);\n if (hook.untyped !== null) {\n const detail = `${where} stands on an entry with ${hook.untyped}, where Claude Code's hooks reference has \"type\": \"command\" on an entry it runs as a command, so whether Claude Code runs it cannot be told here: give the entry \"type\": \"command\"`;\n return [{ ...written, state: 'unknown', detail, note }];\n }\n if (hook.shell) {\n const detail = `${where} is a shell's to read before the hook is handed it, so what the hook does with it cannot be told here: written with \"args\", each word reaches the hook as it stands`;\n return [{ ...written, state: 'unknown', detail, note }];\n }\n // What the hook would do with a line it is never asked on before a write is not what guards.\n const unstarted: HookReport = { ...written, state: 'unstarted', detail: null, note };\n const waited = before === null || before.length > 0;\n if (handed.state === 'off') {\n const detail = `${where}: ${handed.fault.wrong}, so the guard is off and ${handed.unchecked ?? 'no write is checked'}; ${handed.fault.mend}`;\n // A fault the hook says, it says with exit 1 after every write it is\n // started for as well, so it is said wherever the line stands.\n if (handed.silent !== true) return [{ ...written, state: 'off', detail, note: describeOnFailure(where, hook.blocks, true) }];\n // A root outside any work tree, or in one that does not hold the\n // project, of which the hook says nothing: no run of it fails\n // there, so onFailure holds no write for it, and where the line is\n // waited on before no write there is none it leaves unchecked.\n return [waited ? { ...written, state: 'off', detail, note } : unstarted];\n }\n if (!waited) return [unstarted];\n if (handed.state === 'held') {\n const detail = `${where}: ${handed.wrong}, so the hook holds every write until the line is mended: name a brief spec-brief lists, or take --brief off the line`;\n return [{ ...written, state: 'held', detail, note }];\n }\n if (before === null) return [{ ...written, state: 'unknown', detail: null, note }];\n // What a release wrote: its hook, and nothing after it.\n if (sameStrings(hook.words, ['hook', 'claude'])) return [{ ...written, state: 'guards', detail: null, note }];\n const root = handed.root === undefined ? '' : `, and its root, ${handed.root}, is a directory`;\n // Whose briefs a write is checked by, where they are not the project's own.\n const holder = handed.holder === undefined ? '' : ` in ${namedTree(handed.holder)}, which holds this project: the hook checks a write here by that work tree's briefs and its branch, as a file under ${handed.holder.path}/ there`;\n return [{ ...written, state: 'guards', detail: `${where} is more than init writes, and guards: the hook reads the line${root}${holder}`, note }];\n });\n });\n}\n\n/** Whether a project's `.mcp.json` registers a server under the harness's name, however it runs it. */\nexport function registersServer(mcp: unknown): boolean {\n const servers = field(mcp, 'mcpServers');\n return isObject(servers) && 'spec-harness' in servers;\n}\n\n/** A Claude Code settings file, named as a person finds it, and what reading it gave: an object, or nothing usable. */\nexport interface ClaudeSettings {\n readonly file: string;\n readonly settings: unknown;\n}\n\n/** The plugin's id in `enabledPlugins`, and the settings file that turns it on. */\nexport interface EnabledPlugin {\n readonly id: string;\n readonly file: string;\n}\n\n/** `enabledPlugins` keys a plugin `<name>@<marketplace>`; this repository's marketplace lists the plugin as `spec-harness`. */\nconst PLUGIN_ID = /^spec-harness@[^@]+$/;\n\n/**\n * Whether Claude Code runs this package's plugin, from its settings files\n * given lowest precedence first: user, project, local. Claude Code merges\n * `enabledPlugins` key by key, so for each id the last file that sets it to\n * `true` or `false` decides. A plugin named `spec-harness` counts from any\n * marketplace, since another can list this repository. `null` when no file\n * turns it on.\n */\nexport function enabledPlugin(sources: readonly ClaudeSettings[]): EnabledPlugin | null {\n const decided = new Map<string, EnabledPlugin | null>();\n for (const { file, settings } of sources) {\n const plugins = field(settings, 'enabledPlugins');\n if (!isObject(plugins)) continue;\n for (const [id, on] of Object.entries(plugins)) {\n if (PLUGIN_ID.test(id) && typeof on === 'boolean') decided.set(id, on ? { id, file } : null);\n }\n }\n return [...decided.values()].find((entry) => entry !== null) ?? null;\n}\n\n/**\n * The settings file whose `disableAllHooks` turns Claude Code's hooks off,\n * or `null` where none does.\n *\n * By its settings reference\n * (https://code.claude.com/docs/en/settings-reference, disableAllHooks, read\n * 2026-10-12) the key is a Boolean any settings file may hold, and `true`\n * turns hooks off. Set outside managed settings, it turns off the hooks of\n * the user's, the project's and the local settings and of plugins, and the\n * hooks of managed settings, of the Agent SDK and of a plugin that managed\n * settings force on keep running. By its hooks reference (Disable or remove\n * hooks) the value that counts is the one left after settings precedence:\n * of the files given, lowest precedence first, the last that sets a Boolean\n * decides. A value that is no Boolean is passed over, as the key left out.\n */\nexport function hooksDisabled(sources: readonly ClaudeSettings[]): string | null {\n let file: string | null = null;\n for (const source of sources) {\n const value = field(source.settings, 'disableAllHooks');\n if (typeof value === 'boolean') file = value ? source.file : null;\n }\n return file;\n}\n\n/** The project's settings file for Claude Code, as it is named among the sources. */\nexport const PROJECT_SETTINGS = '.claude/settings.json';\n\n/** Where Claude Code records the marketplaces it has fetched, in a directory it keeps plugins in. */\nexport const MARKETPLACE_REGISTRY = 'known_marketplaces.json';\n\n/** Where it records the marketplaces hosted on claude.ai, in a shape its reference does not give. */\nexport const HOSTED_REGISTRY = 'known_marketplaces_claudeai.json';\n\n/**\n * The origins in a plugin's id that are no marketplace, by Claude Code's\n * plugin loading reference (https://code.claude.com/docs/en/plugins/loading,\n * Find where a plugin came from, read 2026-10-12): a plugin started from a\n * directory or an archive, one saved under a skills directory, and one\n * synced from a claude.ai account. None has a marketplace, and the first\n * and the last no record on disk that the reference describes.\n */\nconst OTHER_ORIGINS: readonly string[] = ['inline', 'skills-dir', 'synced'];\n\n/** A name a directory can be looked up by: no separator, and no way out of the directory it is looked up in. */\nconst DIRECTORY_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;\n\n/**\n * The marketplace a plugin's id names, where it names one whose directory\n * can be looked up: `null` for an origin that is no marketplace, and for\n * text that names no directory.\n */\nexport function pluginMarketplace(id: string): string | null {\n const origin = id.slice(id.indexOf('@') + 1);\n return OTHER_ORIGINS.includes(origin) || !DIRECTORY_NAME.test(origin) ? null : origin;\n}\n\n/** What one of the directories Claude Code keeps plugins in holds of a plugin and its marketplace. */\nexport interface PluginsRoot {\n readonly directory: string;\n /** Whether its cache holds a version of the plugin that no `.orphaned_at` marks as left behind. */\n readonly cached: boolean;\n /** Its `known_marketplaces.json` as read: `null` where there is none. */\n readonly registry: Json | null | 'unreadable';\n /** Whether a record of marketplaces hosted on claude.ai stands beside it. */\n readonly hosted: boolean;\n}\n\n/**\n * Whether this machine has what Claude Code loads a plugin from. `detail`\n * is why, where the plugin is not simply there.\n */\nexport type PluginPresence = { readonly state: 'present'; readonly detail: null } | { readonly state: 'absent' | 'unknown'; readonly detail: string };\n\nfunction turnsOn(settings: unknown, id: string): boolean {\n const plugins = field(settings, 'enabledPlugins');\n return isObject(plugins) && plugins[id] === true;\n}\n\nfunction holds(record: unknown, name: string): boolean {\n return isObject(record) && Object.hasOwn(record, name);\n}\n\n/**\n * Whether the plugin that settings turn on is on this machine, by Claude\n * Code's plugin loading reference\n * (https://code.claude.com/docs/en/plugins/loading, read 2026-10-12), from\n * the settings files and from what the directories it keeps plugins in\n * hold: its plugins root, and each seed directory.\n *\n * `present`: a version of it is in a cache, where the reference has one\n * directory for each installed version of a marketplace plugin (Find\n * plugins on disk).\n *\n * `absent` is said only where the reference leaves the plugin no way to\n * load (Enabled in project settings but not installed): its only `true` is\n * in the project's `.claude/settings.json`, for which Claude Code fetches\n * no plugin a machine lacks, and neither of the page's two exceptions is\n * met, a marketplace that lists it by a relative path, since no marketplace\n * of that name is recorded as fetched or declared in settings, and a seed\n * directory that holds it.\n *\n * Everything else is `unknown`: an origin that is no marketplace, a record\n * that is not there or cannot be read, a marketplace that is there or is\n * declared, whose own list is not read here, and a `true` in a settings\n * file of the person's own, for which Claude Code fetches.\n */\nexport function pluginPresence(plugin: EnabledPlugin, sources: readonly ClaudeSettings[], roots: readonly PluginsRoot[]): PluginPresence {\n const untold = (detail: string): PluginPresence => ({ state: 'unknown', detail });\n const marketplace = pluginMarketplace(plugin.id);\n if (marketplace === null) return untold(`${plugin.id} names no marketplace whose plugins are kept in a cache: a plugin from --plugin-dir, a skills directory or a claude.ai account comes another way`);\n if (roots.length === 0) return untold('where Claude Code keeps its plugins is not known here: none of CLAUDE_CODE_PLUGIN_CACHE_DIR, CLAUDE_CONFIG_DIR and a home directory is set');\n if (roots.some((root) => root.cached)) return { state: 'present', detail: null };\n const unread = roots.find((root) => !isObject(root.registry));\n if (unread !== undefined) {\n const wrong = unread.registry === null ? 'is not there' : 'cannot be read as JSON';\n return untold(`${join(unread.directory, MARKETPLACE_REGISTRY)}, where Claude Code records the marketplaces it has fetched, ${wrong}`);\n }\n const fetched = roots.find((root) => holds(root.registry, marketplace));\n if (fetched !== undefined) {\n return untold(\n `its marketplace, ${marketplace}, is on this machine (${join(fetched.directory, MARKETPLACE_REGISTRY)}) and no version of the plugin is in the cache: Claude Code loads a plugin that its marketplace lists by a relative path from the marketplace itself, and the marketplace's list is not read here`,\n );\n }\n const declaring = sources.find(({ settings }) => holds(field(settings, 'extraKnownMarketplaces'), marketplace));\n if (declaring !== undefined) return untold(`${declaring.file} declares its marketplace, ${marketplace}, under extraKnownMarketplaces, which Claude Code fetches after a session has started: nothing of it is on this machine now`);\n const hosted = roots.find((root) => root.hosted);\n if (hosted !== undefined) return untold(`${join(hosted.directory, HOSTED_REGISTRY)} records the marketplaces hosted on claude.ai, in a shape Claude Code's reference does not give, so whether ${marketplace} is one cannot be read`);\n const own = sources.filter(({ file, settings }) => file !== PROJECT_SETTINGS && turnsOn(settings, plugin.id)).map(({ file }) => file);\n if (own.length > 0) return untold(`${named(own)} ${own.length === 1 ? 'turns' : 'turn'} it on, and Claude Code fetches a plugin that settings of the person's own turn on: neither a version of it nor its marketplace, ${marketplace}, is on this machine now`);\n return {\n state: 'absent',\n detail: `${PROJECT_SETTINGS} alone turns it on, and Claude Code fetches no plugin that a project's settings alone turn on, unless its marketplace lists it by a relative path or a seed directory holds it: no marketplace ${marketplace} is recorded as fetched or declared in settings, and no version of the plugin is in a cache (${roots.map((root) => join(root.directory, 'cache')).join(', ')})`,\n };\n}\n\n/** Where the plugin is on, as a person would look it up. */\nfunction isOn(plugin: EnabledPlugin): string {\n return `the spec-harness plugin is on (${plugin.id} in ${plugin.file})`;\n}\n\n/** How to have init's entries in place of the plugin's, for this project alone. */\nfunction turnOff(plugin: EnabledPlugin): string {\n return `turn the plugin off for this project with claude plugin disable ${plugin.id} --scope local`;\n}\n\nconst PARTS = literal({\n hooks: { brings: 'the guard hooks', twice: 'every write is guarded twice', skipped: 'init writes none', entry: \"spec-harness's hooks\", them: 'them', none: 'no hook' },\n server: { brings: 'the server', twice: 'the server is registered twice', skipped: 'init registers none', entry: 'the spec-harness server', them: 'it', none: 'no server' },\n});\n\n/** How to have a plugin that is not on this machine brought to it, in the commands Claude Code's plugin pages give. */\nfunction bring(plugin: EnabledPlugin): string {\n return `install it here, with claude plugin install ${plugin.id} once its marketplace is added`;\n}\n\n/** That the plugin settings turn on is not on this machine, and why. */\nfunction isAbsent(plugin: EnabledPlugin, detail: string, brought: string): string {\n return `${isOn(plugin)} and is not on this machine, so it brings ${brought} here: ${detail}`;\n}\n\n/**\n * What init says of a Claude Code file where the plugin that settings turn\n * on is not on this machine. It writes nothing on that reading alone: a\n * plugin that is there after all would bring the same `part` a second time.\n * A file that holds init's entry already is `present`.\n */\nexport function describeAbsent(plugin: EnabledPlugin, detail: string, part: 'hooks' | 'server', present: boolean): string {\n const words = PARTS[part];\n const absent = isAbsent(plugin, detail, words.none);\n if (present) return `${absent}. This file holds ${words.entry}; with the plugin installed as well, ${words.twice}: ${turnOff(plugin)}`;\n return `${absent}. On that reading alone ${words.skipped}, since with a plugin that is there after all ${words.twice}: ${bring(plugin)}, or to have ${words.them} here instead, ${turnOff(plugin)} and run init again`;\n}\n\n/**\n * What init says of a Claude Code file it leaves alone because the plugin is\n * on and brings the same `part`. A file that holds init's entry already is a\n * double install for the person to settle: init removes nothing, since the\n * file is the repository's and a clone without the plugin relies on it. So\n * is an entry `elsewhere`, in a settings file of the person's own, which\n * init does not write and doctor fails all the same.\n */\nexport function describeSkipped(plugin: EnabledPlugin, part: 'hooks' | 'server', present: boolean, elsewhere: readonly string[] = []): string {\n const words = PARTS[part];\n if (present) return `${isOn(plugin)} and brings ${words.brings} this file holds as well, so ${words.twice}: take ${words.entry} out of this file, or ${turnOff(plugin)}`;\n if (elsewhere.length > 0) {\n return `${isOn(plugin)} and brings ${words.brings} ${named(elsewhere)} ${elsewhere.length === 1 ? 'holds' : 'hold'} as well, so ${words.twice}: take ${words.entry} out there, or ${turnOff(plugin)}. init writes none here`;\n }\n return `${isOn(plugin)} and brings ${words.brings}, so ${words.skipped}: with both, ${words.twice}. To have ${words.them} here instead, for every clone of the repository, ${turnOff(plugin)} and run init again`;\n}\n\n/** How Claude Code is wired to the harness: the plugin, init's entries, both or neither. */\nexport interface ClaudeCodeWiring {\n readonly plugin: EnabledPlugin | null;\n /** Whether this machine has what Claude Code loads that plugin from; `null` where no settings file turns one on. */\n readonly presence: PluginPresence | null;\n /** The settings file whose `disableAllHooks` turns the hooks off, or `null`. */\n readonly hooksOff: string | null;\n /** The settings files that hold the guard hooks: a line of the hook that Claude Code starts for a write, before it or after. */\n readonly hooks: readonly string[];\n /** Each line of the hook in the settings files, with what the hook does with it and the writes it is started for. */\n readonly lines: readonly HookReport[];\n /** Whether `.mcp.json` registers the server. */\n readonly server: boolean;\n /** Whether a settings file has Claude Code start the hook as a session starts (startsSessions). */\n readonly sessionStart: boolean;\n /**\n * The release of the Claude Code on `PATH`, where it was asked: a matcher\n * that lists names with a comma is read as that release reads it\n * ({@link matchingUnder}). `null` where it was not asked.\n */\n readonly release: ClaudeCodeCheck | null;\n /**\n * An array for a matcher that keeps Claude Code from loading the hooks of\n * the project's settings file, the file init writes its hooks into, or\n * `null`: init writes none there while it stands ({@link arrayMatcher}).\n */\n readonly unloaded: ArrayMatcher | null;\n}\n\nexport type WiringState = 'plugin' | 'init' | 'both' | 'none';\n\n/** The wiring as its descriptions read it: what a caller knows of the plugin's presence, and of an array in the project's settings, which one that does not ask leaves out. */\ntype Wired = Pick<ClaudeCodeWiring, 'plugin' | 'hooks' | 'server'> & { readonly presence?: PluginPresence | null; readonly unloaded?: ArrayMatcher | null };\n\n/**\n * How init comes to write the guard hooks. Where an array unloads the\n * project's settings file, init writes none there and says the array, so\n * the advice is the array's, and init after it: advice that led to more\n * advice is the advice at the end.\n */\nfunction runInit(wiring: Wired): string {\n const unloaded = wiring.unloaded ?? null;\n if (unloaded === null) return 'run spec-harness init --write';\n return `${describeArrayMatcher(PROJECT_SETTINGS, unloaded)}, those init writes among them: ${ONE_STRING}, then run spec-harness init --write`;\n}\n\n/** Why the plugin settings turn on is not on this machine, or `null` where it is, may be, or none is on. */\nfunction absence(wiring: Wired): string | null {\n return wiring.presence?.state === 'absent' ? wiring.presence.detail : null;\n}\n\n/**\n * Which of the four the wiring is. `both` is a double install, and doctor\n * fails it; either of init's entries counts. A plugin that is not on this\n * machine brings nothing to it, and is not counted.\n */\nexport function wiringState(wiring: Wired): WiringState {\n const init = wiring.hooks.length > 0 || wiring.server;\n if (wiring.plugin === null || absence(wiring) !== null) return init ? 'init' : 'none';\n return init ? 'both' : 'plugin';\n}\n\n/**\n * Whether hooks that would guard are switched off: `disableAllHooks` in a\n * settings file, where a settings file holds the guard hooks or a plugin\n * that may be on this machine brings them. A guard someone set up, which\n * checks no write.\n */\nexport function guardSwitchedOff(wiring: Wired & Pick<ClaudeCodeWiring, 'hooksOff'>): boolean {\n return wiring.hooksOff !== null && (wiring.hooks.length > 0 || (wiring.plugin !== null && absence(wiring) === null));\n}\n\n/**\n * What doctor and init say of `disableAllHooks` in `file`. `guarded` is\n * whether there are guard hooks for it to switch off; without any it is a\n * note on what the key would do to them.\n */\nexport function describeHooksOff(file: string, guarded: boolean): string {\n const off = `\"disableAllHooks\" is true in ${file}, so Claude Code runs no hook of the user's, the project's or the local settings, and none of a plugin`;\n if (!guarded) return `note: ${off}: the hooks init writes, and those the plugin brings, would not run while it stands`;\n return `${off}: no write is guarded. Take the key out of ${file}, or set it to false, to have the guard back. Hooks of managed settings, and of a plugin managed settings force on, keep running, and no managed settings are read here`;\n}\n\n/**\n * What doctor adds of the plugin settings turn on, where it is not simply on\n * this machine: that it cannot be told, which is never fine, or that it is\n * not, beside entries of init's. `null` where there is no more to say: no\n * plugin, one that is there, and one that is not where nothing else is\n * wired, which the wiring's own sentence says.\n */\nexport function describePresence(wiring: Wired): string | null {\n const { plugin, presence } = wiring;\n if (plugin === null || presence === undefined || presence === null || presence.state === 'present') return null;\n if (presence.state === 'unknown') return `whether ${plugin.id} is on this machine cannot be told: ${presence.detail}. A plugin that is not there brings no hook: Claude Code's /plugin lists it, and its errors`;\n if (wiring.hooks.length > 0) return `${isAbsent(plugin, presence.detail, 'no hook')}. With the plugin installed as well, ${PARTS.hooks.twice}: ${turnOff(plugin)}`;\n return wiring.server ? unguarded(plugin, presence.detail, wiring) : null;\n}\n\n/** That the plugin settings turn on is not on this machine and no hook of init's stands in for it, with the two ways to a guard. */\nfunction unguarded(plugin: EnabledPlugin, detail: string, wiring: Wired): string {\n return `${isAbsent(plugin, detail, 'no hook')}, and Claude Code guards no write. To have the guard, ${bring(plugin)}, or ${turnOff(plugin)} and ${runInit(wiring)}`;\n}\n\n/** What `doctor` says of the wiring, and what to do when it is doubled or missing. */\nexport function describeClaudeCode(wiring: Wired): string {\n const { plugin } = wiring;\n const entries = [...wiring.hooks.map((file) => `the guard hooks in ${file}`), ...(wiring.server ? ['the server in .mcp.json'] : [])].join(', ');\n const own = `init's entries: ${entries}`;\n if (plugin === null) {\n if (entries === '') return `neither the spec-harness plugin nor the hooks init writes, so Claude Code guards no write: ${runInit(wiring)}, or install the plugin`;\n return own;\n }\n const absent = absence(wiring);\n if (absent !== null) return entries === '' ? unguarded(plugin, absent, wiring) : own;\n if (entries === '') return `${isOn(plugin)} and brings the guard hooks and the server`;\n const twice = [...(wiring.hooks.length > 0 ? [PARTS.hooks.twice] : []), ...(wiring.server ? [PARTS.server.twice] : [])].join(' and ');\n return `${isOn(plugin)}, beside ${entries}: ${twice}. Keep one: take spec-harness's entries out of those files, or ${turnOff(plugin)}`;\n}\n\n/** The spec-brief plugin this package ships, as spec-brief's `plugins` names it. */\nexport const PLUGIN = '@descent-vtt/spec-harness/spec-brief-plugin';\n\nexport { SPEC_BRIEF_CONFIGS } from './config.js';\n\n/** The conditions an import meets in Node, its `defaultConditions`, and `default`, which every one meets. */\nconst IMPORT_CONDITIONS: readonly string[] = ['node', 'import', 'default'];\n\n/** A target Node refuses as invalid, which an array passes over and anything else stops at. */\nconst INVALID = Symbol('invalid target');\n\nfunction resolveTarget(target: unknown): string | null | undefined | typeof INVALID {\n if (typeof target === 'string') return target.startsWith('./') ? target : INVALID;\n if (Array.isArray(target)) {\n for (const item of target) {\n const resolved = resolveTarget(item);\n if (resolved !== undefined && resolved !== INVALID) return resolved;\n }\n return null;\n }\n if (typeof target !== 'object' || target === null) return target === null ? null : INVALID;\n for (const [condition, value] of Object.entries(target)) {\n if (!IMPORT_CONDITIONS.includes(condition)) continue;\n const resolved = resolveTarget(value);\n if (resolved !== undefined) return resolved;\n }\n return undefined;\n}\n\n/**\n * The file a package's `exports` target names for an import, as Node's\n * PACKAGE_TARGET_RESOLVE finds it, or `null` when it names none: a string\n * that starts with `./`; in an object, the target of the first key, in the\n * object's own order, that an import meets - `node`, `import` or\n * `default` - and that resolves to anything, a `null` included; in an\n * array, the first item that resolves, one Node refuses passed over. A\n * `null` target is not exported, and ends the search there, where a\n * condition an import does not meet lets it go on.\n */\nexport function exportedFile(target: unknown): string | null {\n const resolved = resolveTarget(target);\n return typeof resolved === 'string' ? resolved : null;\n}\n\n/**\n * Whether spec-brief's configuration loads the plugin, by name or as\n * `{ module, options }`. spec-brief also loads a plugin by a path, one that\n * starts with `.` or is absolute, read from the root; such a path is the\n * plugin when `isPluginFile` says it names the plugin's file, which only the\n * disk can tell. Without one, no path is: the default's `false` and an\n * `undefined` read the same in `some`, so that mutant is equivalent.\n */\nexport function loadsPlugin(config: Json, isPluginFile: (path: string) => boolean = () => false): boolean {\n const plugins = config['plugins'];\n const names = (specifier: unknown): boolean =>\n specifier === PLUGIN || (typeof specifier === 'string' && (specifier.startsWith('.') || isAbsolute(specifier)) && isPluginFile(specifier));\n return Array.isArray(plugins) && plugins.some((entry) => names(entry) || (isObject(entry) && names(entry['module'])));\n}\n\n/** Whether spec-brief's configuration names the base its archive measures a round from. */\nexport function measuresArchive(config: Json): boolean {\n const archiving = config['archiving'];\n return isObject(archiving) && typeof archiving['base'] === 'string';\n}\n\n/**\n * spec-brief's configuration with the plugin loaded and the archive measured\n * from `base`, or `null` when both already hold. spec-brief's archive\n * refuses a round that changed a protected file, and learns that a signed\n * ruling allows it only by asking the plugin (ADR-0006). It checks the file at\n * all only when it knows the base: without one it warns that the scope went\n * unmeasured and passes, so the gate is open until a base is named. A base a\n * person wrote is kept.\n */\nexport function mergeSpecBrief(current: Json, base: string | null = null, isPluginFile?: (path: string) => boolean): Json | null {\n const plugin = loadsPlugin(current, isPluginFile);\n const measure = base !== null && !measuresArchive(current);\n if (plugin && !measure) return null;\n const plugins: unknown[] = Array.isArray(current['plugins']) ? current['plugins'] : [];\n const archiving: Json = isObject(current['archiving']) ? current['archiving'] : {};\n return {\n ...current,\n ...(plugin ? {} : { plugins: [...plugins, PLUGIN] }),\n ...(measure ? { archiving: { ...archiving, base } } : {}),\n };\n}\n\n/** Whether spec-brief loads the plugin, as its configuration at the root says. */\nexport type PluginState =\n | { readonly kind: 'loaded' | 'not-loaded' | 'unreadable'; readonly file: string }\n | { readonly kind: 'unconfigured' };\n\n/** What a person reads about the plugin, and what to do when it is not loaded. */\nexport function describePlugin(state: PluginState): string {\n switch (state.kind) {\n case 'loaded':\n return `spec-brief loads spec-harness's plugin (${state.file}): its archive accepts a protected file a signed ruling allows`;\n case 'not-loaded':\n return `spec-brief does not load spec-harness's plugin, so its archive refuses a protected file whatever ruling is signed: add \"${PLUGIN}\" to \"plugins\" in ${state.file}, or run spec-harness init --write`;\n case 'unreadable':\n return `${state.file} cannot be read as JSON, so whether spec-brief loads spec-harness's plugin is unknown`;\n case 'unconfigured':\n return \"spec-brief has no configuration at the root, so it loads no plugin: spec-harness init --write writes one that loads spec-harness's\";\n }\n}\n\n/** What git says that tells a base apart. */\nexport interface BaseFacts {\n /** The remote's default branch as a local ref, such as `origin/main`, or `null`. */\n readonly remoteDefault: string | null;\n /** The name of the branch checked out, or `null` on a detached head. */\n readonly branch: string | null;\n /** Every local branch, by its name and the ref a base names it by. */\n readonly branches: readonly LocalBranch[];\n}\n\n/** The base `init` names, and why; `base` is `null` when none can be told. */\nexport interface BaseChoice {\n readonly base: string | null;\n readonly detail: string;\n}\n\n/**\n * The base `init` writes into `.spec-harness.json`. Every ruling is verified\n * against the allowed signers on it, so it is named rather than left to be\n * found. The remote's default branch comes first, but git records it when\n * it clones, and before 2.48 not on a fetch: a repository made with `git\n * init` and pushed to a remote often has none. There the branch init runs on\n * is the base when it is `main` or `master`, or the only branch; otherwise\n * the person names it.\n */\nexport function chooseBase(facts: BaseFacts): BaseChoice {\n const { remoteDefault, branch } = facts;\n if (remoteDefault !== null) return { base: remoteDefault, detail: `rounds are measured from ${remoteDefault}, the remote's default branch` };\n const unrecorded = 'no remote records a default branch (refs/remotes/origin/HEAD)';\n if (branch !== null) {\n const conventional = branch === 'main' || branch === 'master';\n if (conventional || facts.branches.every((local) => local.name === branch)) {\n const which = conventional ? 'the branch init runs on' : 'the only branch';\n // The base is a ref git and spec-brief read, so it is the name git\n // reads as the branch and nothing else: `heads/main` beside a tag\n // `main`. A branch with no commit yet is listed by no ref.\n const base = facts.branches.find((local) => local.name === branch)?.ref ?? branch;\n return { base, detail: `rounds are measured from ${base}, ${which}: ${unrecorded}; change \"base\" if rounds merge into another` };\n }\n }\n const where = branch === null ? 'HEAD is detached' : `${branch} is not main, master or the only branch`;\n return {\n base: null,\n detail: `no base can be told: ${unrecorded}, and ${where}; set \"base\" to the branch rounds merge into, or run git remote set-head origin --auto and init again`,\n };\n}\n\n/** Where a base came from: `--base`, the configuration, or the remote. */\nexport type BaseSource = 'flag' | 'config' | 'remote';\n\nconst SOURCES: Readonly<Record<BaseSource, string>> = { flag: '--base', config: '.spec-harness.json', remote: \"the remote's default branch\" };\n\n/** The base a command resolved, and how; or why there is none. */\nexport function describeBase(base: { readonly ref: string; readonly source: BaseSource; readonly mergeBase: string } | { readonly reason: string }): string {\n if ('reason' in base) return `none: ${base.reason}`;\n return `${base.ref} (${SOURCES[base.source]}), merge base ${base.mergeBase.slice(0, 12)}`;\n}\n\n/** Whether the allowed-signers file is on the base, where every ruling's signature is checked against it. */\nexport function describeSigners(file: string, base: string | null, onBase: boolean): string {\n if (base === null) return `${file}, read from the base, which could not be resolved: no ruling can count`;\n if (onBase) return `${file} is on ${base}`;\n return `${file} is not on ${base}, so no ruling can count: commit it there, one line per person: <email> namespaces=\"git\" <public key>`;\n}\n\n/**\n * The note doctor gives on the signers whose key is not FIDO2, or `null`\n * when every one's is. A note, never a failure: ADR-0006 accepts a key the\n * agent's account cannot read too, and a PIV or PKCS#11 hardware key is\n * written as a plain key.\n */\nexport function describeSignerKeys(signers: readonly Pick<AllowedSigner, 'line' | 'principals' | 'keyType'>[]): string | null {\n if (signers.length === 0) return null;\n const named = signers.map((signer) => `${signer.principals.join(',')} (${signer.keyType}, line ${signer.line})`).join(', ');\n return (\n `note: signers whose key is not a FIDO2 key: ${named}. ` +\n \"Where an agent runs as the person, ADR-0006 recommends a FIDO2 key, ssh-keygen -t ed25519-sk, whose signature needs a touch no process can supply, or a key the agent's account cannot read; \" +\n 'a PIV or PKCS#11 hardware key reads as a plain ssh-rsa or ecdsa line, so this is a note, not a failure'\n );\n}\n\n/** The note doctor gives on a line of the allowed-signers file that is not a signer. */\nexport function describeSignerProblem(problem: { readonly line: number; readonly message: string }): string {\n return `note: line ${problem.line} is not a signer: ${problem.message}`;\n}\n\n/** What doctor says of the Claude Code on `PATH`, which runs the guard's hooks only from the minimum on. */\nexport function describeClaudeRelease(check: ClaudeCodeCheck): string {\n // A version read from a package.json says so: nothing ran to tell it.\n const release = (found: { readonly version: string; readonly file?: string }): string =>\n `Claude Code ${found.version}${found.file === undefined ? '' : ` (as ${found.file} declares)`}`;\n switch (check.state) {\n case 'ok':\n return `${release(check)} runs the hooks, which need ${CLAUDE_CODE_MINIMUM} or later`;\n case 'outdated':\n return `${release(check)} is older than ${CLAUDE_CODE_MINIMUM}, which the hooks need: it ignores a hook's args and runs a bare node, which fails, and a PreToolUse hook that fails blocks nothing, so every write passes unguarded: update Claude Code, with claude update`;\n case 'unknown':\n return `whether Claude Code is ${CLAUDE_CODE_MINIMUM} or later, which the hooks need, cannot be told: ${check.reason}; an older release lets every write pass unguarded, so check claude --version where Claude Code runs`;\n }\n}\n\n/** Where git's pre-commit hook stands: git's path for it, shown from the root, and what is there. */\nexport type GitHookState =\n | { readonly state: 'runs' | 'absent' | 'other' | 'inert'; readonly file: string }\n /**\n * What stands at the path is no file, `what` it is instead. `stops`: git\n * can execute it, tries to run it as the hook, fails, and stops every\n * commit. `ignored`: git cannot execute it, and skips it as it skips a\n * hook that is not executable.\n */\n | { readonly state: 'stops' | 'ignored'; readonly file: string; readonly what: string }\n /**\n * A file the account may not read, `reason` being why, and `runs` whether\n * git may execute it. One git may not execute it skips, with a hint, and\n * commits. One it may it runs, and a script the shell cannot read either\n * stops every commit there (measured with git 2.47 as an ordinary account),\n * where a program runs without being read: which it is cannot be read.\n */\n | { readonly state: 'unreadable'; readonly file: string; readonly runs: boolean; readonly reason: string }\n | { readonly state: 'unknown'; readonly reason: string };\n\n/**\n * The advice for a missing hook, which init gives beside the file and doctor\n * with it. The hook is the guard for a write the agent's hooks never see,\n * one made through a shell (ADR-0005).\n */\nexport function missingGitHook(file: string | null): string {\n const where = file === null ? '' : ` (${file})`;\n return `no pre-commit hook runs spec-harness${where}: one refuses a commit that changes what the active brief protects, for any agent or none, a shell's writes included; run spec-harness init --git-hook --write to add it`;\n}\n\n/**\n * How to keep the files the rules live in from changing unread, on each\n * forge, as spec-core's ADR-0005 asks: the forge protects them, and CI checks\n * a change against the base branch's rules. GitLab Free has no Code Owners\n * approval, so there the person who merges is the reviewer.\n */\nexport const PROTECT_RULE_FILES =\n \"Have the forge protect this file, the ADRs, the tool configurations and the CI configuration, so no change to them reaches the base branch without a person, and check each change in CI against the base branch's rules: \" +\n 'on GitHub, CODEOWNERS and a protected branch; on GitLab Premium, Code Owners; on GitLab Free, a protected branch no one pushes to, merged by Maintainers, agents as Developers, and pipelines that must succeed. ' +\n \"spec-core's docs/adopting.md has the settings\";\n\n/**\n * The line to add to a hook the repository has of its own: node and the\n * script in the project's install, as Claude Code's hooks are run. git starts\n * a pre-commit hook at the top of the work tree it commits in, a linked\n * worktree's own, wherever the hook is kept, so the path is read from there.\n */\nexport const GIT_HOOK_LINE = `node ${BIN} hook git`;\n\n/**\n * The hook init writes. It is a POSIX sh script on every platform, since Git\n * for Windows runs a hook with the sh it ships. git starts it at the top of\n * the work tree it commits in, so the project's install is read from there,\n * and where a linked worktree has none, from the repository's main work\n * tree: the work tree whose `.git` the common directory is, where `git\n * worktree add` was run and the project installed (ADR-0005). Where neither\n * has the install - a worktree of a repository nobody installed into, a\n * repository that shares its hooks with one that uses the harness - node\n * would end on a stack trace, so the hook says what is missing and where,\n * and the commit waits, as it did when npx found nothing to run.\n */\nexport const PRE_COMMIT = `#!/bin/sh\n# spec-harness: refuse a commit that changes what the active brief protects.\n# git runs this at the top of the work tree it commits in, a linked worktree's\n# own, wherever the hook is kept: the project's install is read from there,\n# or, where a linked worktree has none, from the repository's main work tree.\nbin=${BIN}\nif [ ! -f \"$bin\" ]; then\n common=$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null)\n if [ \"\\${common##*/}\" = .git ] && [ -f \"\\${common%/.git}/$bin\" ]; then\n bin=\\${common%/.git}/$bin\n else\n printf '%s\\\\n' \"spec-harness: $bin is not in $PWD, the work tree git commits in, nor in its repository's main work tree: install the project's dependencies there, as with npm ci, and commit again\" >&2\n exit 2\n fi\nfi\nexec node \"$bin\" hook git\n`;\n\n/**\n * What doctor and init add of a hook whose text runs the harness through\n * npx: the hook init wrote through 0.9.1, or the line it advised for a hook\n * of the repository's own. A note, never a failure: the hook guards as it\n * did. npx starts npm to start node, and npm 12 says on stderr what it runs,\n * twice a commit. A comment that names the command runs nothing, and neither\n * does another runner's line, which is the repository's to choose.\n */\nexport function gitHookNote(text: string): string | null {\n const npx = text.split('\\n').some((line) => /^[^#]*\\bnpx\\b.*\\bspec-harness\\s+hook\\s+git\\b/.test(line));\n if (!npx) return null;\n return `it runs spec-harness through npx, which starts npm to start node on every commit, and under npm 12 prints two \"npm notice run\" lines each time: to run it with node from the project's install, as Claude Code's hooks are, replace the npx command there with \"${GIT_HOOK_LINE}\"`;\n}\n\n/** What doctor says of git's pre-commit hook. */\nexport function describeGitHook(hook: GitHookState): string {\n switch (hook.state) {\n case 'runs':\n return `${hook.file} runs spec-harness`;\n case 'inert':\n return `${hook.file} runs spec-harness, but is not executable, so git skips it: chmod +x ${hook.file}`;\n case 'other':\n return `${hook.file} does not run spec-harness: add the line \"${GIT_HOOK_LINE}\" to it`;\n case 'stops':\n return `${hook.file} is ${hook.what}, not a hook, and git stops every commit at it, since it cannot run it (\"cannot spawn\" on Windows, \"cannot exec\" elsewhere): nothing is checked there, and nothing is committed. Take it away, then run spec-harness init --git-hook --write`;\n case 'ignored':\n return `${hook.file} is ${hook.what}, not a hook, and is not executable, so git skips it and runs no hook: take it away, then run spec-harness init --git-hook --write`;\n case 'unreadable':\n if (!hook.runs) return `${hook.file} cannot be read (${hook.reason}), and is not executable, so git skips it and runs no hook: make it readable and executable, or take it away and run spec-harness init --git-hook --write`;\n return `${hook.file} cannot be read (${hook.reason}), so whether it runs spec-harness cannot be told: git runs it at a commit, and a script there that cannot be read stops every commit, where a program runs; make it readable`;\n case 'absent':\n return missingGitHook(hook.file);\n case 'unknown':\n return `where git runs its hooks cannot be told: ${hook.reason}`;\n }\n}\n\n/** spec-graph's configuration files, in the order spec-graph reads them; then a \"spec-graph\" key in package.json. */\nexport const SPEC_GRAPH_CONFIGS: readonly string[] = ['.spec-graph.json', 'spec-graph.config.json'];\n\n/**\n * spec-graph's own patterns when its configuration names none, its\n * DEFAULT_PATTERNS as of 0.9.0. They decide only what init says, never what\n * it writes: `patterns` in the configuration replaces them, so writing the\n * briefs into it would freeze spec-graph's defaults into the file.\n */\nconst SPEC_GRAPH_DEFAULTS: readonly string[] = ['docs/**/*.md', 'doc/**/*.md', 'adr/**/*.md', 'rfcs/**/*.md', 'specs/**/*.md', '*.md'];\n\n/** Whether spec-graph, configured as `config` says, reads the briefs in the directory `briefs`. */\nexport function graphReadsBriefs(config: Json, briefs: string): boolean {\n const configured = Array.isArray(config['patterns']) ? config['patterns'].filter((pattern): pattern is string => typeof pattern === 'string') : [];\n const list = parseGlobList(configured.length > 0 ? configured : SPEC_GRAPH_DEFAULTS, { dialect: 'path', caseSensitive: true, backslash: 'separator' });\n return list.ok && list.list.match(`${briefs}/001_brief.md`);\n}\n\n/**\n * What the history entry does. spec-graph reads a brief whose status says\n * `archived` as a record already; the entry makes one a record whatever word\n * its status uses, or none - and it does anything only where spec-graph\n * reads the briefs, which its defaults do not in `briefs/`.\n */\nexport function describeGraph(archiveGlob: string, briefs: string, reads: boolean, added: boolean): string {\n const history = added ? `read ${archiveGlob} as history` : `${archiveGlob} is history`;\n if (reads) return `${history}: an archived brief is a record whatever its status says, so a live brief that depends on one is not a stale premise`;\n return `${history}, for when spec-graph reads the briefs; its patterns do not reach ${briefs}/, so it checks none of them now: add \"${briefs}/**/*.md\" to its \"patterns\" if it should`;\n}\n\n/** spec-graph's configuration with the archive read as history, or `null` when it already is. */\nexport function mergeSpecGraph(current: Json, archiveGlob: string): Json | null {\n const patterns = current['historyPatterns'];\n const history = Array.isArray(patterns) ? patterns.filter((p): p is string => typeof p === 'string') : [];\n if (history.includes(archiveGlob)) return null;\n return { ...current, historyPatterns: [...history, archiveGlob] };\n}\n"]}
1
+ {"version":3,"file":"configure.js","sourceRoot":"","sources":["../src/configure.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAE,cAAc,EAA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C;IACvF,IAAI,KAAK;QAAE,OAAO,GAAG,OAAO,sHAAsH,CAAC;IACnJ,OAAO,GAAG,OAAO,qEAAqE,MAAM,0CAA0C,MAAM,0CAA0C,CAAC;AACzL,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,cAAc,CAAC,OAAa,EAAE,WAAmB;IAC/D,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1G,IAAI,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/C,OAAO,EAAE,GAAG,OAAO,EAAE,eAAe,EAAE,CAAC,GAAG,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC;AACpE,CAAC","sourcesContent":["/**\n * What `init` writes into each tool's configuration, and what `doctor` says\n * of the result.\n *\n * Pure: `setup.ts` and the command line read the files and ask git, and\n * write what these return, so the core sweep holds these to the unit suite.\n * Each merge keeps what a person wrote and returns `null` when there is\n * nothing to add.\n */\n\nimport { isAbsolute, join } from 'node:path';\nimport { runInNewContext } from 'node:vm';\n\nimport { CALLABLE_TOOLS, HOOK_BUDGET_MS } from './hooks.js';\nimport { literal } from './literal.js';\nimport type { AllowedSigner } from './signers.js';\nimport type { LocalBranch } from './types.js';\nimport { namedTree, type HookLine } from './usage.js';\nimport { parseGlobList } from './vendor/spec-core/pattern/index.js';\nimport { CLAUDE_CODE_MINIMUM, meets, parseVersion, type ClaudeCodeCheck } from './versions.js';\n\ntype Json = Record<string, unknown>;\n\nfunction isObject(value: unknown): value is Json {\n return typeof value === 'object' && value !== null;\n}\n\nfunction sameStrings(value: unknown, expected: readonly string[]): boolean {\n return Array.isArray(value) && value.length === expected.length && value.every((item, index) => item === expected[index]);\n}\n\n/**\n * The command line as the project installed it. Claude Code starts a plugin's\n * server in the plugin's own directory and a hook wherever the session\n * stands, so neither can rely on `npx` finding the project's install; and on\n * Windows a server's command is started without a shell, where `npx` is a\n * shim that cannot start at all. `node` and the script's path work\n * everywhere. git's hook runs the same script, from the top of the work\n * tree, where git starts it.\n */\nconst BIN = 'node_modules/@descent-vtt/spec-harness/bin/spec-harness.js';\n\n/** The project root, as Claude Code substitutes it in a hook's arguments and in a plugin server's. */\nexport const PROJECT_DIR = '${CLAUDE_PROJECT_DIR}';\n\n/**\n * The project root in a project's own `.mcp.json`. Claude Code expands it\n * there from its own environment, which does not hold it, so it needs a\n * default; `.` is right, since a project's server starts in the project.\n */\nexport const PROJECT_DIR_OR_HERE = '${CLAUDE_PROJECT_DIR:-.}';\n\n/**\n * The matcher every release wrote: each name the hook reads a file from\n * (hooks.ts). `MultiEdit` is one no supported Claude Code has a tool for,\n * and Claude Code compares a listed name with a tool's exactly, so it starts\n * the hook for nothing there. It stays, since the hook is asked about a name\n * only under a matcher that lets the name through, and it reads this one for\n * whatever still sends it.\n */\nconst HOOK_MATCHER = 'Edit|Write|MultiEdit|NotebookEdit';\n/** The event Claude Code runs before a tool call, the only one of the two where a hook can refuse the call. */\nconst BEFORE = 'PreToolUse';\n/** The event after a call that succeeded, where a hook can only tell the model what it wrote. */\nconst AFTER = 'PostToolUse';\nconst GUARDED_EVENTS = [BEFORE, AFTER];\n/**\n * The event Claude Code runs as a session starts, under which the hook says\n * what would hold every write of it (ADR-0005). Its entry has no matcher:\n * left out, it is every way a session starts.\n */\nconst AT_START = 'SessionStart';\n/**\n * The event Claude Code runs as its main agent finishes a turn, under which\n * the hook reports what the work tree holds where `turnReport` is on\n * (ADR-0005). Its entry has no matcher: the event takes none.\n */\nconst AT_TURN_END = 'Stop';\nconst GUARD_ARGS: readonly string[] = Object.freeze([`${PROJECT_DIR}/${BIN}`, 'hook', 'claude']);\n\n/**\n * The guard as a Claude Code hook: exec form, `args` given, so the project's\n * path is one argument whatever it holds, and no shell is involved.\n */\nexport const GUARD_HOOK: Readonly<Json> = Object.freeze({ type: 'command', command: 'node', args: GUARD_ARGS, timeout: 60 });\n\n/**\n * The hook's entry at the end of a turn: the guard's line, run in the\n * background. Claude Code waits on no part of it, so the turn ends as it\n * would, and it hands the hook's `systemMessage` to Claude as the next\n * turn begins, where from an entry it waits on it shows the person the\n * message instead (the hooks reference,\n * https://code.claude.com/docs/en/hooks, *Run hooks in the background* and\n * *JSON output*, read 2026-10-19).\n */\nexport const TURN_HOOK: Readonly<Json> = Object.freeze({ ...GUARD_HOOK, async: true });\n\n// bare-name: what 0.1 installed, an npx command found from wherever the\n// session stood. Read here so that init replaces it, and never run.\nconst LEGACY_HOOK = 'npx --no-install spec-harness hook claude';\nconst LEGACY_SERVER_ARGS = ['--no-install', 'spec-harness', 'mcp'];\n\nfunction isGuard(hook: unknown): boolean {\n return isObject(hook) && hook['command'] === 'node' && sameStrings(hook['args'], GUARD_ARGS);\n}\n\nfunction isLegacyGuard(hook: unknown): boolean {\n return isObject(hook) && hook['command'] === LEGACY_HOOK;\n}\n\nfunction hooksOf(group: unknown): unknown[] {\n return isObject(group) && Array.isArray(group['hooks']) ? group['hooks'] : [];\n}\n\n/** A group with 0.1's guard replaced where it stands, keeping its other fields; the group itself when it has none. */\nfunction upgraded(group: unknown): unknown {\n const hooks = hooksOf(group);\n if (!hooks.some(isLegacyGuard)) return group;\n return { ...(group as Json), hooks: hooks.map((hook) => (isLegacyGuard(hook) ? { ...(hook as Json), command: 'node', args: [...GUARD_ARGS] } : hook)) };\n}\n\n/**\n * The tools, of those that write a file and a supported Claude Code can call\n * (hooks.ts), that a group's matcher has Claude Code start the group's hooks\n * for, by its hooks reference\n * (https://code.claude.com/docs/en/hooks, Matcher patterns, read\n * 2026-10-12): left out, empty or `*`, every tool; made of letters, digits,\n * `_`, `-`, spaces, `,` and `|` alone, the tools it names, one between each\n * `|` or `,`; with any other character in it, a JavaScript regular\n * expression that may match anywhere in a tool's name. `null` where the\n * reference does not say, or it cannot be told: a matcher that is neither\n * text nor an array, is no pattern, or is a pattern whose reading runs out\n * its budget.\n *\n * Two things its page on debugging a configuration adds\n * (https://code.claude.com/docs/en/debug-your-config, Check hooks and Check\n * common causes, read 2026-10-14). A matcher that is an array is an entry\n * Claude Code lists as an invalid setting, among the reasons a hook is not\n * loaded and never fires: no tool. And a comma separates names only from\n * {@link COMMA_SINCE} on; its changelog adds that a hyphenated name is\n * matched exactly only from {@link HYPHEN_SINCE} on. So a matcher of names\n * with either in it is read as `matching` has the Claude Code here read it\n * ({@link namesReadings}), and where the readings it may have differ, it\n * cannot be told.\n */\nfunction matchedTools(matcher: unknown, pattern: PatternReader, matching: Matching): readonly string[] | null {\n if (matcher === undefined || matcher === '' || matcher === '*') return CALLABLE_TOOLS;\n if (Array.isArray(matcher)) return [];\n if (typeof matcher !== 'string') return null;\n if (!NAMES.test(matcher)) return pattern(matcher);\n // A reading that cannot be told, or two that differ, leave the matcher one\n // whose tools cannot be told; where every reading comes to the same tools,\n // nothing turns on which the release has.\n const readings = namesReadings(matcher, pattern, matching);\n return readings.every((tools) => sameStrings(tools, readings[0]!)) ? readings[0]! : null;\n}\n\n/** A matcher that is a name, or names between `|` and `,`: what the reference compares with a tool's name exactly. */\nconst NAMES = /^[A-Za-z0-9_\\- ,|]*$/;\n\n/** The writing tools a matcher of names lists, one between each `|` or `,`. */\nfunction listedTools(matcher: string): readonly string[] {\n const names = matcher.split(/[|,]/).map((name) => name.trim());\n return CALLABLE_TOOLS.filter((tool) => names.includes(tool));\n}\n\n/**\n * The release of Claude Code from which a comma in a matcher separates\n * names as a `|` does. Its page on debugging a configuration (Check hooks,\n * read 2026-10-14) has a comma before it fall through to the reading of a\n * pattern, under which the matcher never matched, and its changelog has the\n * fix under this release: hooks with comma-separated matchers no longer\n * silently never firing.\n */\nexport const COMMA_SINCE = '2.1.191';\n\n/**\n * The release of Claude Code from which a hyphenated name in a matcher of\n * names is matched exactly. Its changelog\n * (https://code.claude.com/docs/en/changelog, 2.1.195, read 2026-10-18) has,\n * among its fixes, hook matchers with hyphenated identifiers that matched as\n * substrings, and match exactly from this release on; it does not say how\n * the rest of such a matcher was read.\n */\nexport const HYPHEN_SINCE = '2.1.195';\n\n/**\n * How the Claude Code that runs the hooks reads a matcher of names: as every\n * release from {@link HYPHEN_SINCE} on, and the hooks reference today; as\n * the release named, which is older; or it cannot be told, where the release\n * cannot.\n */\nexport type Matching = { readonly as: 'today' } | { readonly as: 'older'; readonly release: string } | { readonly as: 'untold' };\n\n/** The reading every release from {@link HYPHEN_SINCE} on has, and what a caller that asks no release is given. */\nconst TODAY: Matching = { as: 'today' };\n\n/**\n * How the Claude Code doctor asked its release reads a matcher of names. A\n * release that was not asked, or could not be told, leaves the reading\n * untold: asked or not, nothing says which it is.\n */\nexport function matchingUnder(release: ClaudeCodeCheck | null): Matching {\n if (release === null || release.state === 'unknown') return { as: 'untold' };\n // A release that was told is one whose version was read as one, and the\n // constant is a version, so both parse.\n return meets(parseVersion(release.version)!, parseVersion(HYPHEN_SINCE)!) ? TODAY : { as: 'older', release: release.version };\n}\n\n/** Whether `release` reads a comma in `matcher` as part of a pattern: one before {@link COMMA_SINCE}, where the matcher holds one. */\nfunction commaAsPattern(matcher: string, release: string): boolean {\n return matcher.includes(',') && !meets(parseVersion(release)!, parseVersion(COMMA_SINCE)!);\n}\n\n/** A matcher of names that holds a comma, as a release before {@link COMMA_SINCE} reads it. */\nfunction commaEarlier(matcher: string, pattern: PatternReader): readonly string[] | null {\n // No tool, where the matcher read as a pattern matches none of the writing\n // tools, which is what the page has such a matcher do; and where it matches\n // one, as `Edit|Write,Bash` matches `Edit`, the page's two sentences, that\n // a comma is read as part of a pattern and that the matcher never matched,\n // disagree, and it cannot be told.\n const read = pattern(matcher);\n return read !== null && read.length === 0 ? read : null;\n}\n\n/**\n * Each reading the Claude Code here may have of a matcher of names: the\n * writing tools it lists, or `null` where a reading cannot be told. From\n * {@link HYPHEN_SINCE} on there is one, the names matched exactly. Before\n * {@link COMMA_SINCE} a comma in it makes it a pattern ({@link commaEarlier}).\n * Before {@link HYPHEN_SINCE} a hyphen in it made it match as a substring,\n * and the changelog does not say which way: each name matched exactly but\n * the one with the hyphen, the matcher read as a pattern, which matches\n * anywhere in a tool's name, or its whole text found in a tool's name, which\n * no writing tool's holds, since none has a hyphen. A release that cannot be\n * told may read it any way a release does.\n */\nfunction namesReadings(matcher: string, pattern: PatternReader, matching: Matching): (readonly string[] | null)[] {\n const listed = listedTools(matcher);\n if (matching.as === 'today') return [listed];\n const substring = matcher.includes('-') ? [pattern(matcher), []] : [];\n if (matching.as === 'older') return commaAsPattern(matcher, matching.release) ? [commaEarlier(matcher, pattern)] : [listed, ...substring];\n return [listed, ...(matcher.includes(',') ? [commaEarlier(matcher, pattern)] : []), ...substring];\n}\n\n/**\n * How long the reading of one pattern may take, in milliseconds of the\n * clock. A sane matcher is read in about half of one (ADR-0005), so only a\n * pattern that backtracks without end meets it; on a machine under load an\n * ordinary one may, and is then said as one that cannot be told, where an\n * idle machine reads it.\n */\nconst PATTERN_BUDGET = 100;\n\n/**\n * The writing tools a matcher that is a pattern matches, or `null` where it\n * is no pattern, or its reading runs out its budget.\n *\n * The pattern is a line of a settings file, which arrives with a clone, and\n * one can be written that a test of a few short names never finishes:\n * `^((((([A-Za-z]*)*)*)*)*)*$X` ran for more than ten seconds. Tested as\n * written, one such entry and neither doctor nor init would come back, with\n * no word. So it is made and tested in a context of its own, whose run\n * takes a timeout where a test in this one takes none, and what throws\n * there, a pattern that is none or the stop itself, is a matcher that\n * cannot be told. The shape of a pattern does not say which will: groups in\n * a row backtrack as nested ones do.\n */\nfunction patternTools(source: string): readonly string[] | null {\n try {\n const matched: string[] = runInNewContext('tools.filter((tool) => new RegExp(source).test(tool))', { tools: CALLABLE_TOOLS, source }, { timeout: PATTERN_BUDGET });\n return matched;\n } catch {\n return null;\n }\n}\n\n/** What reads a matcher that is a pattern: the writing tools it matches, or `null` where that cannot be told. */\nexport type PatternReader = (source: string) => readonly string[] | null;\n\n/**\n * A reader for one run: a pattern is read the first time it is asked of,\n * and answered from that reading after.\n *\n * A reading that runs out its budget costs the whole of it, a settings file\n * can hold one matcher over any number of entries, and init asks of an\n * entry twice, for what doctor says of the file and for what to write into\n * it. Fifty entries under one such pattern were fifty readings, five and a\n * half seconds, and fifty-one for init; they are one. Nothing is spared a\n * file that holds a pattern of its own for each entry.\n *\n * Made where a run begins and handed down, never kept by this module: a\n * reading is of the clock, so one kept past its run would answer for a\n * machine that is busy no longer.\n */\nexport function patternReader(read: PatternReader = patternTools): PatternReader {\n const known = new Map<string, readonly string[] | null>();\n return (source) => {\n const before = known.get(source);\n if (before !== undefined) return before;\n const tools = read(source);\n known.set(source, tools);\n return tools;\n };\n}\n\n/** Whether Claude Code runs a hook's entry in the background, where it waits on no answer of it. */\nfunction inBackground(hook: Json): boolean {\n return hook['async'] === true || hook['asyncRewake'] === true;\n}\n\n/**\n * The writing tools whose call Claude Code hands an entry under `event` and\n * waits for it on, or `null` where that cannot be told here. Before a write\n * an entry in the background answers too late to refuse it, so it is waited\n * on for none (the reference, Run hooks in the background). An `if` has the\n * entry started only for the calls its rule matches, in the syntax of a\n * permission rule, which is not read here.\n */\nfunction answered(event: string, matcher: unknown, hook: Json, pattern: PatternReader, matching: Matching): readonly string[] | null {\n if (event === BEFORE && inBackground(hook)) return [];\n if (hook['if'] !== undefined) return null;\n return matchedTools(matcher, pattern, matching);\n}\n\n/**\n * `.claude/settings.json`, or the plugin's hooks, with the guard hooks merged\n * in; `null` when they are already there.\n *\n * An event has the guard where Claude Code starts init's own line under it\n * for a write. Where the settings hold another line of the hook that it\n * starts for a write, one `isHook` knows as the hook's by the words after\n * the harness's command, nothing is merged in at all: the line is a\n * person's, a second one beside it would run for every write as well, and\n * init rewrites none but the one 0.1 wrote. Without `isHook`, only init's\n * own line is known: the default's `false` and an `undefined` read the same\n * in `some`, so that mutant is equivalent.\n *\n * `pattern` reads a matcher that is a pattern: the run's own reader, where\n * the run has read the file's matchers already ({@link patternReader}).\n * `matching` is how the Claude Code here reads a matcher of names, where\n * the run asked its release ({@link matchingUnder}): a line that\n * release starts for no write is no guard, and init's own is written beside\n * it.\n */\nexport function mergeClaudeSettings(\n current: Json,\n isHook: (words: readonly string[]) => boolean = () => false,\n pattern: PatternReader = patternReader(),\n matching: Matching = TODAY,\n): Json | null {\n const hooks = isObject(current['hooks']) ? current['hooks'] : {};\n const theirs = harnessEntries(current).some((entry) => !isGuard(entry.hook) && !isLegacyGuard(entry.hook) && isHook(entry.words) && isStarted(toolsOf(entry, pattern, matching)));\n if (theirs) return null;\n let changed = false;\n const next: Json = { ...hooks };\n for (const event of GUARDED_EVENTS) {\n const listed = hooks[event];\n const before: unknown[] = Array.isArray(listed) ? listed : [];\n const groups = before.map(upgraded);\n const replaced = groups.some((group, index) => group !== before[index]);\n const present = harnessEntries({ hooks: { [event]: groups } }).some((entry) => isGuard(entry.hook) && isStarted(toolsOf(entry, pattern, matching)));\n if (!present) groups.push({ matcher: HOOK_MATCHER, hooks: [{ ...GUARD_HOOK, args: [...GUARD_ARGS] }] });\n if (replaced || !present) {\n next[event] = groups;\n changed = true;\n }\n }\n return changed ? { ...current, hooks: next } : null;\n}\n\n/**\n * Settings with init's entry under `SessionStart` added beside its two, or\n * `null` where it is not to be: where init's own line does not stand\n * under both `PreToolUse` and `PostToolUse`, a file init writes no hook\n * into or one it has yet to complete; and where a line of the hook stands\n * under `SessionStart` already, init's or one `isHook` knows, which would\n * say the same twice (ADR-0012).\n */\nexport function withSessionStart(settings: Json, isHook: (words: readonly string[]) => boolean): Json | null {\n const hooks = isObject(settings['hooks']) ? settings['hooks'] : {};\n const own = GUARDED_EVENTS.every((event) => harnessEntries({ hooks: { [event]: hooks[event] } }).some((entry) => isGuard(entry.hook)));\n if (!own || startsSessions(settings, isHook)) return null;\n const listed = hooks[AT_START];\n return { ...settings, hooks: { ...hooks, [AT_START]: [...(Array.isArray(listed) ? listed : []), { hooks: [{ ...GUARD_HOOK, args: [...GUARD_ARGS] }] }] } };\n}\n\n/** The events init writes its own line under. */\nconst INIT_EVENTS: readonly string[] = [BEFORE, AFTER, AT_START];\n\n/**\n * Settings with `onFailure: \"block\"` on each of init's own entries, under\n * the three events it writes them under, or `null` where each has it\n * already: `init --block-on-failure`. Claude Code's hooks reference\n * (https://code.claude.com/docs/en/hooks, Block the action when a hook\n * fails, read 2026-10-19) has the field read by Claude Code 2.1.295 and\n * later, and a failure under it, a hook that cannot start or that reaches\n * its timeout among them, do what exit 2 does on its event: before a write,\n * hold it. What a release before 2.1.295 does with the key is on no page, so\n * init writes it only where it is asked to (ADR-0012). An entry a person\n * wrote is theirs, and is left as it is.\n */\nexport function withOnFailure(settings: Json): Json | null {\n const hooks = isObject(settings['hooks']) ? settings['hooks'] : {};\n const unblocked = (hook: unknown): boolean => isGuard(hook) && (hook as Json)['onFailure'] !== 'block';\n const next: Json = { ...hooks };\n let changed = false;\n for (const event of INIT_EVENTS) {\n const groups = hooks[event];\n if (!Array.isArray(groups) || !groups.some((group) => hooksOf(group).some(unblocked))) continue;\n next[event] = groups.map((group) => (hooksOf(group).some(unblocked) ? { ...(group as Json), hooks: hooksOf(group).map((hook) => (unblocked(hook) ? { ...(hook as Json), onFailure: 'block' } : hook)) } : group));\n changed = true;\n }\n return changed ? { ...settings, hooks: next } : null;\n}\n\n/**\n * Whether settings have Claude Code start the hook as a session starts: an\n * entry under `SessionStart` whose line is init's, or one `isHook` knows\n * as the hook's. Its matcher is not read: one that names some of the ways a\n * session starts has the check made for those.\n */\nexport function startsSessions(settings: unknown, isHook: (words: readonly string[]) => boolean): boolean {\n const groups = field(field(settings, 'hooks'), AT_START);\n if (!Array.isArray(groups)) return false;\n return groups.some((group) => hooksOf(group).some((hook) => isObject(hook) && (isGuard(hook) || knownAs(hook, isHook))));\n}\n\n/**\n * Settings with init's entry under `Stop` added, or `null` where a line\n * of the hook stands there already, init's or one `isHook` knows, which\n * would report the turn twice (ADR-0012).\n */\nexport function withTurnReport(settings: Json, isHook: (words: readonly string[]) => boolean): Json | null {\n if (reportsTurns(settings, isHook)) return null;\n const hooks = isObject(settings['hooks']) ? settings['hooks'] : {};\n const listed = hooks[AT_TURN_END];\n return { ...settings, hooks: { ...hooks, [AT_TURN_END]: [...(Array.isArray(listed) ? listed : []), { hooks: [{ ...TURN_HOOK, args: [...GUARD_ARGS] }] }] } };\n}\n\n/** Whether settings have Claude Code start the hook as a turn ends: an entry under `Stop` whose line is init's, or one `isHook` knows as the hook's. */\nexport function reportsTurns(settings: unknown, isHook: (words: readonly string[]) => boolean): boolean {\n const groups = field(field(settings, 'hooks'), AT_TURN_END);\n if (!Array.isArray(groups)) return false;\n return groups.some((group) => hooksOf(group).some((hook) => isObject(hook) && (isGuard(hook) || knownAs(hook, isHook))));\n}\n\n/** Whether `isHook` knows an entry's line as the hook's. */\nfunction knownAs(hook: Json, isHook: (words: readonly string[]) => boolean): boolean {\n const written = writtenHook(hook);\n return written !== null && isHook(written.words);\n}\n\n/**\n * What doctor notes where settings hold the guard hooks and none under\n * `SessionStart`: what would hold every write is said at the first write,\n * which it holds, and not as the session starts.\n */\nexport const NO_SESSION_START =\n 'note: no settings file has Claude Code start the hook as a session starts, so a configuration that does not load, or a brief named that spec-brief does not list, is said only at the first write, which it holds: spec-harness init --write adds the entry beside the two it wrote';\n\n/**\n * What doctor notes where `turnReport` is on and no settings file has Claude\n * Code start the hook as a turn ends: the report the configuration asks for\n * is made at no turn's end. The plugin brings no entry for it (ADR-0012).\n */\nexport const NO_TURN_END = `note: \"turnReport\" is on, and no settings file has Claude Code start the hook as a turn ends, so no turn's end is reported: spec-harness init --write adds the entry beside init's, and says where it goes where the plugin brings the guard hooks`;\n\n/**\n * What doctor notes, run in a linked worktree, of the spec-harness the\n * hook's line runs: the one installed where `${CLAUDE_PROJECT_DIR}` points,\n * which is this work tree in a session started in it, and the main\n * checkout in a worktree session of the desktop app's, where Claude Code\n * reads the hooks from the main checkout's root and points the placeholder\n * at it (its worktrees page, What worktrees share with the main checkout,\n * read 2026-10-19). Said where the two are not one release, `null` for\n * none, and `null` where they are. A note: from 0.19.0 on either decides a\n * write by the work tree that holds it, so it says which release answers,\n * not where a write is decided.\n */\nexport function describeInstalls(main: string, there: string | null, here: string | null): string | null {\n if (there === here) return null;\n const release = (version: string | null): string => (version === null ? 'none' : version);\n return `note: this is a linked worktree of ${main}, and the hook's line runs the spec-harness installed where \\${CLAUDE_PROJECT_DIR} points: this work tree's, ${release(here)}, in a session started here, and ${main}'s, ${release(there)}, in one started there, as a worktree session of the desktop app is`;\n}\n\n/** The server's entry, reading the project at `projectDir`: {@link PROJECT_DIR} for the plugin, {@link PROJECT_DIR_OR_HERE} for a project. */\nexport function mcpServer(projectDir: string): Json {\n return { command: 'node', args: [`${projectDir}/${BIN}`, 'mcp', '--root', projectDir] };\n}\n\nfunction isLegacyServer(server: unknown): boolean {\n return isObject(server) && server['command'] === 'npx' && sameStrings(server['args'], LEGACY_SERVER_ARGS);\n}\n\n/**\n * A project's `.mcp.json` with the harness's server merged in, or `null` when\n * one is registered. A server registered under the name some other way is\n * the person's, and stays; 0.1's npx entry is replaced, keeping its other\n * fields.\n */\nexport function mergeMcp(current: Json): Json | null {\n const servers = isObject(current['mcpServers']) ? current['mcpServers'] : {};\n const existing = servers['spec-harness'];\n if ('spec-harness' in servers && !isLegacyServer(existing)) return null;\n return { ...current, mcpServers: { ...servers, 'spec-harness': { ...(existing as Json | undefined), ...mcpServer(PROJECT_DIR_OR_HERE) } } };\n}\n\n/** A key of a file read as JSON; a file that is missing, or is not a JSON object, holds nothing. */\nfunction field(file: unknown, key: string): unknown {\n return isObject(file) ? file[key] : undefined;\n}\n\n/** The harness's command on a line: its script, or its name, alone or at the end of a path. */\nfunction isLauncher(word: string): boolean {\n const name = word.split(/[\\\\/]/).at(-1);\n return name === 'spec-harness' || name === 'spec-harness.js';\n}\n\n/** Anything in a word that a shell reads before the program is handed it: a quote, a variable, an operator, a pattern. */\nconst SHELL_READS = /[^A-Za-z0-9_./:=@%+,-]/;\n\n/** A line of the harness's in Claude Code's settings: what follows its command there. */\nexport interface WrittenHook {\n /** The events whose hooks hold the line, of the two the guard answers. */\n readonly events: readonly string[];\n /** What follows the harness's command, word for word as written. */\n readonly words: readonly string[];\n /**\n * Whether a shell reads those words first, and can change them: a line\n * with no `args`, which Claude Code hands to a shell, holding a quote, a\n * variable or anything else a shell rewrites. What the hook is handed is\n * then the shell's to say. With `args`, Claude Code hands each word over\n * as it stands.\n */\n readonly shell: boolean;\n /** Whether the entry sets `onFailure` to `\"block\"`. */\n readonly blocks: boolean;\n /**\n * The word that names the harness, its script's path or its name, as\n * written, and whether a shell reads it first: an entry with no `args`.\n * Entries that name the harness in two ways are two lines.\n */\n readonly launcher: { readonly word: string; readonly shell: boolean };\n /**\n * What the entry has for `type` where that is not `\"command\"`, as it is\n * said of the line: none at all, or a word the reference does not list.\n * Whether Claude Code runs such an entry cannot be told. `null` for an\n * entry it runs as a command.\n */\n readonly untyped: string | null;\n}\n\n/**\n * The handler types that are no command, by Claude Code's hooks reference\n * (https://code.claude.com/docs/en/hooks, Hook handler fields, read\n * 2026-10-12): an entry of one sends a request, calls a tool of an MCP\n * server, or asks a model or an agent. It runs no command, the harness's or\n * any other, whatever else the entry holds.\n */\nconst OTHER_HANDLERS: readonly unknown[] = ['http', 'mcp_tool', 'prompt', 'agent'];\n\n/**\n * The line of an entry that runs the harness, or `null` for one that does\n * not. Only an entry Claude Code runs as a command is one: the reference\n * has `type` as a field every entry must have, with `\"command\"` for a\n * command and four other words, and says nothing of an entry with none or\n * with another word, which is kept, and said as one that cannot be told.\n */\nfunction writtenHook(hook: Json): Line | null {\n const { command, args, type } = hook;\n if (typeof command !== 'string' || OTHER_HANDLERS.includes(type)) return null;\n let line: string[];\n // Without arguments the line is a shell's, which splits it at its spaces:\n // at each one here, and what stands between two of them is no word.\n if (args === undefined) line = command.split(/\\s/).filter((word) => word !== '');\n else if (Array.isArray(args) && args.every((arg): arg is string => typeof arg === 'string')) line = [command, ...args];\n // Arguments that are not all text are no line Claude Code can start.\n else return null;\n const shell = args === undefined;\n // A quote around the path of the command is the shell's, dropped to know the command by.\n const at = line.findIndex((word) => isLauncher(shell ? word.replace(/[\"']/g, '') : word));\n if (at === -1) return null;\n const words = line.slice(at + 1);\n const untyped = type === 'command' ? null : type === undefined ? 'no \"type\"' : `the \"type\" ${JSON.stringify(type)}`;\n return { words, shell: shell && words.some((word) => SHELL_READS.test(word)), blocks: hook['onFailure'] === 'block', untyped, launcher: { word: line[at]!, shell } };\n}\n\n/**\n * Every line in Claude Code's settings that runs the harness, under the two\n * events the guard answers: a line that stands under both, as init writes\n * it, is one line. Whose line each is, the guard's or another command's, is\n * the reader's to say (usage.ts): this knows the harness by its command\n * alone.\n */\nexport function writtenHooks(settings: unknown): WrittenHook[] {\n const found: { events: string[]; words: readonly string[]; shell: boolean; blocks: boolean; untyped: string | null; launcher: WrittenHook['launcher'] }[] = [];\n for (const { event, words, shell, blocks, untyped, launcher } of harnessEntries(settings)) {\n const same = found.find((other) => sameLine(other, { words, shell, blocks, untyped, launcher }));\n if (same === undefined) found.push({ events: [event], words, shell, blocks, untyped, launcher });\n else if (!same.events.includes(event)) same.events.push(event);\n }\n return found;\n}\n\ntype Line = Omit<WrittenHook, 'events'>;\n\nfunction sameLine(one: Line, other: Line): boolean {\n // `shell` is not compared: it follows from whether a shell reads the\n // launcher and from the words after it, which are.\n return (\n one.blocks === other.blocks &&\n one.untyped === other.untyped &&\n one.launcher.word === other.launcher.word &&\n one.launcher.shell === other.launcher.shell &&\n sameStrings(one.words, other.words)\n );\n}\n\n/**\n * Where doctor looks for the script a line runs: each directory\n * `${CLAUDE_PROJECT_DIR}` can name as a session starts, which Claude Code\n * fills in, in either form, and how a file is told to stand at a path.\n */\nexport interface ScriptPlaces {\n readonly projects: readonly string[];\n readonly isFile: (path: string) => boolean;\n}\n\n/**\n * What is said of the script a line runs where it is in none of the places\n * it can name, `null` where it is in one, and `null` where that cannot be\n * told here: a relative path, which is read from wherever the session\n * stands as the hook starts, a name a program finds by itself (npx's\n * package, a command on `PATH`), and a word a shell reads before it runs\n * anything.\n */\nfunction absentScript(launcher: WrittenHook['launcher'], places: ScriptPlaces): string | null {\n const paths = [...new Set(places.projects.map((project) => launcher.word.split(PROJECT_DIR).join(project)))];\n if (paths.some((path) => (launcher.shell && SHELL_READS.test(path)) || !isAbsolute(path) || places.isFile(path))) return null;\n return paths.length === 1 ? `the script it runs, ${paths[0]}, is not there` : `the script it runs is in neither place \\${CLAUDE_PROJECT_DIR} can name, ${paths.join(' or ')}`;\n}\n\n/** An entry that runs the harness: its line, where it stands, and what decides whether Claude Code starts it there. */\ninterface HarnessEntry extends Line {\n readonly event: string;\n /** The matcher of the entry's group, as written; `undefined` where the group has none. */\n readonly matcher: unknown;\n readonly hook: Json;\n}\n\n/**\n * The writing tools whose call an entry is handed and waited on for, or\n * `null` where that cannot be told. Read where it is asked for and no\n * sooner: a matcher that is a pattern can cost its whole budget.\n */\nfunction toolsOf(entry: HarnessEntry, pattern: PatternReader, matching: Matching): readonly string[] | null {\n return answered(entry.event, entry.matcher, entry.hook, pattern, matching);\n}\n\n/** Every entry that runs the harness under the two events the guard answers, in the order the settings hold them. */\nfunction harnessEntries(settings: unknown): HarnessEntry[] {\n const hooks = field(settings, 'hooks');\n if (!isObject(hooks)) return [];\n return GUARDED_EVENTS.flatMap((event) => {\n const groups = hooks[event];\n if (!Array.isArray(groups)) return [];\n return groups.flatMap((group) =>\n hooksOf(group).flatMap((hook): HarnessEntry[] => {\n if (!isObject(hook)) return [];\n const written = writtenHook(hook);\n if (written === null) return [];\n return [{ ...written, event, matcher: field(group, 'matcher'), hook }];\n }),\n );\n });\n}\n\n/** Whether Claude Code starts a line for a write, by the tools it is waited on for: one whose tools cannot be told is taken as started. */\nexport function isStarted(tools: readonly string[] | null): boolean {\n return tools === null || tools.length > 0;\n}\n\n/** What doctor reports of one line of Claude Code's hook. */\nexport interface HookReport {\n /** The settings file that holds it, as a person finds it. */\n readonly file: string;\n readonly events: readonly string[];\n /** What follows the harness's command, as written. */\n readonly line: readonly string[];\n /**\n * `guards`: Claude Code waits on the hook before a write, and the hook\n * checks it. `off`: the hook checks no write, for a line it cannot read, a\n * root that is no directory, or a root that is a directory outside any\n * work tree; or it is never started, in a file an array for a matcher\n * keeps Claude Code from loading the hooks of, or it cannot start, its\n * script not there. `held`: the hook holds every write, for a brief the\n * line names that is not one or that spec-brief cannot be asked about;\n * or Claude Code does, for a hook that cannot start under `onFailure:\n * \"block\"`. `unstarted`: Claude Code waits on\n * the line before no write, so it is not the guard. `unknown`: what the\n * hook is handed, which writes it is started for, or whether Claude Code\n * runs the entry at all, cannot be told here.\n */\n readonly state: 'guards' | 'off' | 'held' | 'unstarted' | 'unknown';\n readonly onFailure: 'block' | null;\n /** What there is to say of what the hook does with the line, or `null`. */\n readonly detail: string | null;\n /** The writing tools Claude Code waits on the line before a write by, where the hook can refuse it, of those a supported Claude Code can call (hooks.ts); `null` where that cannot be told. */\n readonly before: readonly string[] | null;\n /** The writing tools Claude Code starts the line after a write by, where the hook can warn of it; `null` where that cannot be told. */\n readonly after: readonly string[] | null;\n /** What there is to say of the two, or `null` where they are every tool that writes, as init has it. */\n readonly cover: string | null;\n /** What `onFailure` changes, where the entry sets it to `\"block\"`. */\n readonly note: string | null;\n /** What is said of an entry whose `timeout` is below what a run of the hook is given, or `null`. */\n readonly timeout: string | null;\n}\n\n/**\n * The release of Claude Code that reads `onFailure` on a hook's entry, by its\n * hooks reference (https://code.claude.com/docs/en/hooks, Command hook\n * fields, read 2026-10-19) and its changelog, which adds the field under it.\n */\nexport const ON_FAILURE_SINCE = '2.1.295';\n\n/** Whether the Claude Code doctor asked its release reads `onFailure`: one that was told, at {@link ON_FAILURE_SINCE} or later. */\nexport function readsOnFailure(release: ClaudeCodeCheck | null): boolean {\n // A release that was told is one whose version was read as one, and the\n // constant is a version, so both parse.\n return release !== null && release.state !== 'unknown' && meets(parseVersion(release.version)!, parseVersion(ON_FAILURE_SINCE)!);\n}\n\n/**\n * What `onFailure: \"block\"` changes for a line, named by `where` it stands,\n * or `null` where the entry does not set it. The hook fails for none of its\n * own answers, a line of its own that turns the guard off among them, which\n * it says with exit 0 (ADR-0005): what the field holds is a hook that does\n * not run.\n */\nfunction describeOnFailure(where: string, blocks: boolean): string | null {\n if (!blocks) return null;\n return `${where} sets onFailure to \"block\", so Claude Code ${ON_FAILURE_SINCE} or later holds a write when the hook fails, where it lets the write go ahead without it: by not starting, as where the script on its line is not there, or by running past its timeout`;\n}\n\n/**\n * What is said of a line whose entries give the hook less time than a run\n * of it is given ({@link HOOK_BUDGET_MS}), or `null`. Claude Code's hooks\n * reference (Timeouts, read 2026-10-24) has a command hook cancelled at its\n * entry's `timeout`, and a PreToolUse hook it cancels blocks no tool call:\n * a run that needs its budget, which holds the write at the end of it, is\n * cut short there, and the write goes ahead. A note, which fails nothing:\n * the timeout is the person's. One that is no number is not read.\n */\nfunction describeTimeout(where: string, entries: readonly HarnessEntry[]): string | null {\n const short = entries.flatMap((entry) => {\n const seconds = entry.hook['timeout'];\n return typeof seconds === 'number' && seconds * 1000 < HOOK_BUDGET_MS ? [`${seconds} seconds under ${entry.event}`] : [];\n });\n if (short.length === 0) return null;\n return `${where} gives the hook ${named(short)}, less than the ${HOOK_BUDGET_MS / 1000} a run of it is given, so Claude Code cancels a run that takes longer before it answers, and a write it would have held goes ahead: give the entry 60, as init writes it, or no timeout`;\n}\n\n/**\n * What is said of a line that guards and whose entries set no `onFailure`,\n * where the Claude Code here reads the field: a hook that cannot start lets\n * the write go ahead, and the field would hold it. Advice, which fails\n * nothing: the file is read by every clone's Claude Code, and what a release\n * before {@link ON_FAILURE_SINCE} does with the key is on no page. `own` is\n * whether the entries are init's, in the file init writes, which\n * `init --block-on-failure` gives the field.\n */\nfunction adviseOnFailure(where: string, own: boolean): string {\n const how = own ? 'spec-harness init --write --block-on-failure writes it on these entries' : 'it is written on each of its entries';\n return `${where} sets no onFailure, so Claude Code lets a write go ahead where the hook cannot start, as where the script on its line is not there, or runs past its timeout: where every Claude Code that reads the file is ${ON_FAILURE_SINCE} or later, as the one here is, \"onFailure\": \"block\" holds the write instead, and ${how}`;\n}\n\n/** Names as a sentence lists them: one, two with \"and\", more with commas before it. Never asked of none. */\nfunction named(names: readonly string[]): string {\n const last = names.at(-1)!;\n return names.length === 1 ? last : `${names.slice(0, -1).join(', ')} and ${last}`;\n}\n\n/** The writing tools a line's entries under `event` are waited on for between them, or `null` where an entry that cannot be told might add one. */\nfunction toolsUnder(event: string, entries: readonly HarnessEntry[], reading: Reading): readonly string[] | null {\n const read = entries.filter((entry) => entry.event === event).map((entry) => toolsOf(entry, reading.pattern, reading.matching));\n const sure = CALLABLE_TOOLS.filter((tool) => read.some((tools) => tools !== null && tools.includes(tool)));\n return sure.length < CALLABLE_TOOLS.length && read.some((tools) => tools === null) ? null : sure;\n}\n\n/** What a run reads every matcher with: its reader of patterns, and how the Claude Code here reads a matcher of names. */\ninterface Reading {\n readonly pattern: PatternReader;\n readonly matching: Matching;\n}\n\n/**\n * What is said after a matcher that Claude Code does not read as its text\n * suggests: an array, which it loads no hook under, and names with a comma or\n * a hyphen where the release here reads them another way than the newest\n * does, or cannot be told. Nothing for any other matcher, and nothing where\n * every reading the release may have is the names as listed.\n */\nfunction saidOfMatcher(matcher: unknown, { pattern, matching }: Reading): string {\n if (Array.isArray(matcher)) return ', an array, which Claude Code lists as an invalid setting and loads no hook under';\n if (typeof matcher !== 'string' || !NAMES.test(matcher)) return '';\n const tools = listedTools(matcher);\n if (namesReadings(matcher, pattern, matching).every((read) => sameStrings(read, tools))) return '';\n const listed = tools.length === 0 ? 'no tool that writes' : named(tools);\n const earlier = commaEarlier(matcher, pattern) === null ? 'a pattern whose matches its documentation does not give' : 'a pattern that matches no tool';\n const substring = \"a matcher with a hyphenated name in it matched as a substring, and Claude Code's changelog does not say how the rest of it was read\";\n if (matching.as === 'older') {\n if (commaAsPattern(matcher, matching.release)) return `, which Claude Code ${matching.release} reads as ${earlier}: a comma separates names from ${COMMA_SINCE} on, where the matcher is ${listed}`;\n return `, which Claude Code ${matching.release} may read otherwise: before ${HYPHEN_SINCE} ${substring}; from ${HYPHEN_SINCE} on it is ${listed}`;\n }\n // The release cannot be told: a comma alone turns on 2.1.191, and a hyphen on 2.1.195.\n if (!matcher.includes('-')) return `, which is ${listed} from Claude Code ${COMMA_SINCE} on, where a comma separates names, and ${earlier} before it: the release here cannot be told`;\n const comma = matcher.includes(',') ? `, and before ${COMMA_SINCE} ${earlier}, where a comma separated no names` : '';\n return `, which is ${listed} from Claude Code ${HYPHEN_SINCE} on, and may be read otherwise before it, where ${substring}${comma}: the release here cannot be told`;\n}\n\n/** What a line's entries under `event` hold that decides when Claude Code starts them, as written. */\nfunction entriesUnder(event: string, entries: readonly HarnessEntry[], reading: Reading): string {\n const under = entries.filter((entry) => entry.event === event);\n if (under.length === 0) return `it stands under no ${event}`;\n const said = under.map(({ matcher, hook }) => {\n const pattern = matcher === undefined ? 'no matcher' : `the matcher ${JSON.stringify(matcher)}${saidOfMatcher(matcher, reading)}`;\n const background = inBackground(hook) ? ' in the background' : '';\n const rule = hook['if'] === undefined ? '' : ` with \"if\" ${JSON.stringify(hook['if'])}`;\n return `${pattern}${background}${rule}`;\n });\n return `under ${event} it has ${named([...new Set(said)])}`;\n}\n\n/**\n * What is said of the writes Claude Code starts a line for, by the event and\n * the matcher of each entry that holds it; `null` where it is waited on\n * before every tool that writes and started after each, as init writes it.\n * A tool is one a supported Claude Code can call: `MultiEdit`, which the\n * hook still reads a path from, is named as unchecked for no line, since no\n * such Claude Code has it to call (hooks.ts).\n */\nfunction describeCover(where: string, before: readonly string[] | null, after: readonly string[] | null, entries: readonly HarnessEntry[], reading: Reading): string | null {\n const parts: string[] = [];\n const left = (tools: readonly string[]): string[] => CALLABLE_TOOLS.filter((tool) => !tools.includes(tool));\n if (before === null) parts.push(`which writes Claude Code waits on it before cannot be told here (${entriesUnder(BEFORE, entries, reading)})`);\n else if (before.length === 0) parts.push(`Claude Code waits on it before no write, so it is not the guard and refuses none (${entriesUnder(BEFORE, entries, reading)})`);\n else if (left(before).length > 0) {\n parts.push(`Claude Code waits on it before a write by ${named(before)}, and before none by ${named(left(before))}, which goes unchecked (${entriesUnder(BEFORE, entries, reading)})`);\n }\n if (after === null) parts.push(`which writes it is started after cannot be told here (${entriesUnder(AFTER, entries, reading)})`);\n else if (after.length === 0) parts.push(`it is started after no write, so it warns of none (${entriesUnder(AFTER, entries, reading)})`);\n else if (left(after).length > 0) parts.push(`it is started after a write by ${named(after)} alone (${entriesUnder(AFTER, entries, reading)})`);\n return parts.length === 0 ? null : `${where}: ${parts.join('; ')}`;\n}\n\n/** The events under which an array for a matcher keeps Claude Code from loading the rest of a file's hooks. */\nconst UNLOADING: readonly string[] = [BEFORE, 'PermissionRequest'];\n\n/** An array that stands for a matcher where it unloads a settings file's hooks: the event it stands under, and the array as written. */\nexport interface ArrayMatcher {\n readonly event: string;\n readonly matcher: string;\n}\n\n/**\n * The first array that stands for a matcher under `PreToolUse` or\n * `PermissionRequest` in a settings file, or `null`.\n *\n * Claude Code's page on debugging a configuration\n * (https://code.claude.com/docs/en/debug-your-config, Check hooks, read\n * 2026-10-14) has a matcher that is an array, where it must be one string,\n * as an entry Claude Code lists as an invalid setting, at the start of an\n * interactive session and in `claude doctor`; and where the array is under\n * one of these two events, none of that file's other hooks load either. It\n * names no release. So a file that holds one runs no hook at all, whoever\n * wrote the entry and whatever it runs: the array's own is not loaded, and\n * neither is any other.\n */\nexport function arrayMatcher(settings: unknown): ArrayMatcher | null {\n const hooks = field(settings, 'hooks');\n for (const event of UNLOADING) {\n const groups = field(hooks, event);\n if (!Array.isArray(groups)) continue;\n const group = groups.find((candidate) => Array.isArray(field(candidate, 'matcher')));\n if (group !== undefined) return { event, matcher: JSON.stringify(field(group, 'matcher')) };\n }\n return null;\n}\n\n/** What is said of a settings file that an array for a matcher keeps Claude Code from loading the hooks of. */\nexport function describeArrayMatcher(file: string, { event, matcher }: ArrayMatcher): string {\n return `${file} has an array for a matcher under ${event}, ${matcher}, which Claude Code lists as an invalid setting, and beside one under PreToolUse or PermissionRequest it loads none of the file's other hooks`;\n}\n\n/** How a matcher that is an array is mended. */\nexport const ONE_STRING = 'write the matcher as one string, its names between \"|\"';\n\n/** The words Claude Code hands the hook for a line: what follows the harness's command, each `${CLAUDE_PROJECT_DIR}` filled with `project`. */\nfunction handedWords(words: readonly string[], project: string): string[] {\n return words.map((word) => word.split(PROJECT_DIR).join(project));\n}\n\n/** The words handed over for every line of the harness's in the settings files, for a caller that has to ask something of each before it reports them. */\nexport function handedLines(sources: readonly ClaudeSettings[], project: string): string[][] {\n return sources.flatMap(({ settings }) => writtenHooks(settings).map((hook) => handedWords(hook.words, project)));\n}\n\n/**\n * The lines of Claude Code's hook in the settings files, each with what the\n * hook does with it and which writes Claude Code starts it for. `read` is\n * the hook's own reading of the words it is handed (usage.ts), `null` for a\n * line that is not its; the words are handed to it as Claude Code hands them\n * to the hook, each `${CLAUDE_PROJECT_DIR}` filled with `project`.\n *\n * A line that guards and holds no more than a release wrote is reported\n * with nothing to say, as it always was. One with more on it is said as it\n * is, and fails nothing. One the hook cannot read, or whose root is no\n * directory, or is in no work tree that holds the project, is a guard that\n * is off, and one that names a brief which is not\n * one holds every write: each a problem, and doctor exits 1 for it. A line\n * Claude Code waits on before no write is not the guard, whatever the hook\n * would do with it.\n *\n * `pattern` reads a matcher that is a pattern, once for every entry under\n * it in every file: the run's own reader, where something else in the run\n * reads the same files ({@link patternReader}). `matching` is how the\n * Claude Code here reads a matcher of names, where its release was asked\n * ({@link matchingUnder}); a caller that asks none reads one as every\n * release from {@link HYPHEN_SINCE} on does.\n *\n * A file that holds an array for a matcher under `PreToolUse` or\n * `PermissionRequest` has none of its hooks loaded ({@link arrayMatcher}):\n * each line of the hook there is started for no write, and one that stood\n * to be started for a write is a guard that is off.\n *\n * `scripts` is where a caller that says whether the script a line runs is\n * there looks for it; with none it is not asked. A line whose script is\n * not there is a hook Claude Code cannot start, which it lets each write\n * go ahead without, or holds every write for where the entry sets\n * `onFailure` to `\"block\"` and the release here reads it.\n */\nexport function reportHooks(\n sources: readonly ClaudeSettings[],\n project: string,\n read: (words: readonly string[]) => HookLine | null,\n pattern: PatternReader = patternReader(),\n matching: Matching = TODAY,\n onFailureHere = false,\n scripts: ScriptPlaces | null = null,\n): HookReport[] {\n const reading: Reading = { pattern, matching };\n return sources.flatMap(({ file, settings }) => {\n const entries = harnessEntries(settings);\n const array = arrayMatcher(settings);\n return writtenHooks(settings).flatMap((hook): HookReport[] => {\n const handed = read(handedWords(hook.words, project));\n if (handed === null) return [];\n const both = GUARDED_EVENTS.every((event) => hook.events.includes(event));\n // An empty word is shown as a shell spells one, where joined it would not show at all.\n // A line that is not under both events is under one.\n const where = `\"${hook.words.map((word) => (word === '' ? \"''\" : word)).join(' ')}\" in ${file}${both ? '' : ` (under ${hook.events[0]} alone)`}`;\n const mine = entries.filter((entry) => sameLine(entry, hook));\n const before = toolsUnder(BEFORE, mine, reading);\n const after = toolsUnder(AFTER, mine, reading);\n if (array !== null) {\n // Nothing of the file is loaded, whatever the line holds and\n // whatever the hook would do with it. A line that stood to be\n // started for a write, or stands under an array itself, where\n // someone meant a matcher, is a guard set up that checks nothing;\n // one that stood to be started for none leaves no write unchecked\n // that it was ever asked about.\n const unloaded = { file, events: hook.events, line: hook.words, onFailure: hook.blocks ? 'block' : null, before: [], after: [], cover: null, note: null, timeout: null } satisfies Partial<HookReport>;\n const said = `${where}: ${describeArrayMatcher(file, array)}`;\n if (isStarted(before) || isStarted(after) || mine.some((entry) => Array.isArray(entry.matcher))) {\n return [{ ...unloaded, state: 'off', detail: `${said}, so the guard is off and no write is checked; ${ONE_STRING}` }];\n }\n return [{ ...unloaded, state: 'unstarted', detail: `${said}: the line is not started, and stood to be started for no write as it is, so no guard is switched off` }];\n }\n const written = { file, events: hook.events, line: hook.words, onFailure: hook.blocks ? 'block' : null, before, after, cover: describeCover(where, before, after, mine, reading), timeout: describeTimeout(where, mine) } satisfies Partial<HookReport>;\n const note = describeOnFailure(where, hook.blocks);\n // Where the release here reads the field, a line that guards without it is advised it.\n const own = file === PROJECT_SETTINGS && mine.every((entry) => isGuard(entry.hook));\n const guards = (detail: string | null): HookReport => ({ ...written, state: 'guards', detail, note: note ?? (onFailureHere ? adviseOnFailure(where, own) : null) });\n if (hook.untyped !== null) {\n const detail = `${where} stands on an entry with ${hook.untyped}, where Claude Code's hooks reference has \"type\": \"command\" on an entry it runs as a command, so whether Claude Code runs it cannot be told here: give the entry \"type\": \"command\"`;\n return [{ ...written, state: 'unknown', detail, note }];\n }\n if (hook.shell) {\n const detail = `${where} is a shell's to read before the hook is handed it, so what the hook does with it cannot be told here: written with \"args\", each word reaches the hook as it stands`;\n return [{ ...written, state: 'unknown', detail, note }];\n }\n // What the hook would do with a line it is never asked on before a write is not what guards.\n const unstarted: HookReport = { ...written, state: 'unstarted', detail: null, note };\n const waited = before === null || before.length > 0;\n // Whatever the hook would do with the words, it never reads them where\n // its script is not there. By the hooks reference\n // (https://code.claude.com/docs/en/hooks, Block the action when a hook\n // fails, read 2026-10-24) a command hook that cannot start, as where\n // its script does not exist, has failed, and the action goes ahead\n // unless the entry sets onFailure to \"block\", which holds it.\n const absent = scripts === null ? null : absentScript(hook.launcher, scripts);\n if (absent !== null) {\n if (!waited && !isStarted(after)) return [unstarted];\n const mend = 'install spec-harness in the project, npm install --save-dev @descent-vtt/spec-harness, or name its script where it is';\n if (hook.blocks && onFailureHere && waited) {\n return [{ ...written, state: 'held', detail: `${where}: ${absent}, so the hook cannot start, and Claude Code holds every write it is started for before, since the entry sets onFailure to \"block\"; ${mend}`, note }];\n }\n return [{ ...written, state: 'off', detail: `${where}: ${absent}, so the hook cannot start, the guard is off and Claude Code lets each write it is started for go ahead without it; ${mend}`, note }];\n }\n if (handed.state === 'off') {\n const detail = `${where}: ${handed.fault.wrong}, so the guard is off and ${handed.unchecked ?? 'no write is checked'}; ${handed.fault.mend}`;\n // A fault the hook says, it says after every write it is started for\n // as well, so it is said wherever the line stands. A root outside\n // any work tree, or in one that does not hold the project, it says\n // nothing of, and where the line is waited on before no write there\n // is none it leaves unchecked.\n return [handed.silent !== true || waited ? { ...written, state: 'off', detail, note } : unstarted];\n }\n if (!waited) return [unstarted];\n if (handed.state === 'held') {\n const detail = `${where}: ${handed.wrong}, so the hook holds every write until the line is mended: name a brief spec-brief lists, or take --brief off the line`;\n return [{ ...written, state: 'held', detail, note }];\n }\n if (before === null) return [{ ...written, state: 'unknown', detail: null, note }];\n // What a release wrote: its hook, and nothing after it.\n if (sameStrings(hook.words, ['hook', 'claude'])) return [guards(null)];\n const root = handed.root === undefined ? '' : `, and its root, ${handed.root}, is a directory`;\n // Whose briefs a write is checked by, where they are not the project's own.\n const holder = handed.holder === undefined ? '' : ` in ${namedTree(handed.holder)}, which holds this project: the hook checks a write here by that work tree's briefs and its branch, as a file under ${handed.holder.path}/ there`;\n return [guards(`${where} is more than init writes, and guards: the hook reads the line${root}${holder}`)];\n });\n });\n}\n\n/** Whether a project's `.mcp.json` registers a server under the harness's name, however it runs it. */\nexport function registersServer(mcp: unknown): boolean {\n const servers = field(mcp, 'mcpServers');\n return isObject(servers) && 'spec-harness' in servers;\n}\n\n/** A Claude Code settings file, named as a person finds it, and what reading it gave: an object, or nothing usable. */\nexport interface ClaudeSettings {\n readonly file: string;\n readonly settings: unknown;\n}\n\n/** The plugin's id in `enabledPlugins`, and the settings file that turns it on. */\nexport interface EnabledPlugin {\n readonly id: string;\n readonly file: string;\n}\n\n/** `enabledPlugins` keys a plugin `<name>@<marketplace>`; this repository's marketplace lists the plugin as `spec-harness`. */\nconst PLUGIN_ID = /^spec-harness@[^@]+$/;\n\n/**\n * Whether Claude Code runs this package's plugin, from its settings files\n * given lowest precedence first: user, project, local. Claude Code merges\n * `enabledPlugins` key by key, so for each id the last file that sets it to\n * `true` or `false` decides. A plugin named `spec-harness` counts from any\n * marketplace, since another can list this repository. `null` when no file\n * turns it on.\n */\nexport function enabledPlugin(sources: readonly ClaudeSettings[]): EnabledPlugin | null {\n const decided = new Map<string, EnabledPlugin | null>();\n for (const { file, settings } of sources) {\n const plugins = field(settings, 'enabledPlugins');\n if (!isObject(plugins)) continue;\n for (const [id, on] of Object.entries(plugins)) {\n if (PLUGIN_ID.test(id) && typeof on === 'boolean') decided.set(id, on ? { id, file } : null);\n }\n }\n return [...decided.values()].find((entry) => entry !== null) ?? null;\n}\n\n/**\n * The settings file whose `disableAllHooks` turns Claude Code's hooks off,\n * or `null` where none does.\n *\n * By its settings reference\n * (https://code.claude.com/docs/en/settings-reference, disableAllHooks, read\n * 2026-10-12) the key is a Boolean any settings file may hold, and `true`\n * turns hooks off. Set outside managed settings, it turns off the hooks of\n * the user's, the project's and the local settings and of plugins, and the\n * hooks of managed settings, of the Agent SDK and of a plugin that managed\n * settings force on keep running. By its hooks reference (Disable or remove\n * hooks) the value that counts is the one left after settings precedence:\n * of the files given, lowest precedence first, the last that sets a Boolean\n * decides. A value that is no Boolean is passed over, as the key left out.\n */\nexport function hooksDisabled(sources: readonly ClaudeSettings[]): string | null {\n let file: string | null = null;\n for (const source of sources) {\n const value = field(source.settings, 'disableAllHooks');\n if (typeof value === 'boolean') file = value ? source.file : null;\n }\n return file;\n}\n\n/** The project's settings file for Claude Code, as it is named among the sources. */\nexport const PROJECT_SETTINGS = '.claude/settings.json';\n\n/** Where Claude Code records the marketplaces it has fetched, in a directory it keeps plugins in. */\nexport const MARKETPLACE_REGISTRY = 'known_marketplaces.json';\n\n/** Where it records the marketplaces hosted on claude.ai, in a shape its reference does not give. */\nexport const HOSTED_REGISTRY = 'known_marketplaces_claudeai.json';\n\n/**\n * The origins in a plugin's id that are no marketplace, by Claude Code's\n * plugin loading reference (https://code.claude.com/docs/en/plugins/loading,\n * Find where a plugin came from, read 2026-10-12): a plugin started from a\n * directory or an archive, one saved under a skills directory, and one\n * synced from a claude.ai account. None has a marketplace, and the first\n * and the last no record on disk that the reference describes.\n */\nconst OTHER_ORIGINS: readonly string[] = ['inline', 'skills-dir', 'synced'];\n\n/** A name a directory can be looked up by: no separator, and no way out of the directory it is looked up in. */\nconst DIRECTORY_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;\n\n/**\n * The marketplace a plugin's id names, where it names one whose directory\n * can be looked up: `null` for an origin that is no marketplace, and for\n * text that names no directory.\n */\nexport function pluginMarketplace(id: string): string | null {\n const origin = id.slice(id.indexOf('@') + 1);\n return OTHER_ORIGINS.includes(origin) || !DIRECTORY_NAME.test(origin) ? null : origin;\n}\n\n/** What one of the directories Claude Code keeps plugins in holds of a plugin and its marketplace. */\nexport interface PluginsRoot {\n readonly directory: string;\n /** Whether its cache holds a version of the plugin that no `.orphaned_at` marks as left behind. */\n readonly cached: boolean;\n /** Its `known_marketplaces.json` as read: `null` where there is none. */\n readonly registry: Json | null | 'unreadable';\n /** Whether a record of marketplaces hosted on claude.ai stands beside it. */\n readonly hosted: boolean;\n}\n\n/**\n * Whether this machine has what Claude Code loads a plugin from. `detail`\n * is why, where the plugin is not simply there.\n */\nexport type PluginPresence = { readonly state: 'present'; readonly detail: null } | { readonly state: 'absent' | 'unknown'; readonly detail: string };\n\nfunction turnsOn(settings: unknown, id: string): boolean {\n const plugins = field(settings, 'enabledPlugins');\n return isObject(plugins) && plugins[id] === true;\n}\n\nfunction holds(record: unknown, name: string): boolean {\n return isObject(record) && Object.hasOwn(record, name);\n}\n\n/**\n * Whether the plugin that settings turn on is on this machine, by Claude\n * Code's plugin loading reference\n * (https://code.claude.com/docs/en/plugins/loading, read 2026-10-12), from\n * the settings files and from what the directories it keeps plugins in\n * hold: its plugins root, and each seed directory.\n *\n * `present`: a version of it is in a cache, where the reference has one\n * directory for each installed version of a marketplace plugin (Find\n * plugins on disk).\n *\n * `absent` is said only where the reference leaves the plugin no way to\n * load (Enabled in project settings but not installed): its only `true` is\n * in the project's `.claude/settings.json`, for which Claude Code fetches\n * no plugin a machine lacks, and neither of the page's two exceptions is\n * met, a marketplace that lists it by a relative path, since no marketplace\n * of that name is recorded as fetched or declared in settings, and a seed\n * directory that holds it.\n *\n * Everything else is `unknown`: an origin that is no marketplace, a record\n * that is not there or cannot be read, a marketplace that is there or is\n * declared, whose own list is not read here, and a `true` in a settings\n * file of the person's own, for which Claude Code fetches.\n */\nexport function pluginPresence(plugin: EnabledPlugin, sources: readonly ClaudeSettings[], roots: readonly PluginsRoot[]): PluginPresence {\n const untold = (detail: string): PluginPresence => ({ state: 'unknown', detail });\n const marketplace = pluginMarketplace(plugin.id);\n if (marketplace === null) return untold(`${plugin.id} names no marketplace whose plugins are kept in a cache: a plugin from --plugin-dir, a skills directory or a claude.ai account comes another way`);\n if (roots.length === 0) return untold('where Claude Code keeps its plugins is not known here: none of CLAUDE_CODE_PLUGIN_CACHE_DIR, CLAUDE_CONFIG_DIR and a home directory is set');\n if (roots.some((root) => root.cached)) return { state: 'present', detail: null };\n const unread = roots.find((root) => !isObject(root.registry));\n if (unread !== undefined) {\n const wrong = unread.registry === null ? 'is not there' : 'cannot be read as JSON';\n return untold(`${join(unread.directory, MARKETPLACE_REGISTRY)}, where Claude Code records the marketplaces it has fetched, ${wrong}`);\n }\n const fetched = roots.find((root) => holds(root.registry, marketplace));\n if (fetched !== undefined) {\n return untold(\n `its marketplace, ${marketplace}, is on this machine (${join(fetched.directory, MARKETPLACE_REGISTRY)}) and no version of the plugin is in the cache: Claude Code loads a plugin that its marketplace lists by a relative path from the marketplace itself, and the marketplace's list is not read here`,\n );\n }\n const declaring = sources.find(({ settings }) => holds(field(settings, 'extraKnownMarketplaces'), marketplace));\n if (declaring !== undefined) return untold(`${declaring.file} declares its marketplace, ${marketplace}, under extraKnownMarketplaces, which Claude Code fetches after a session has started: nothing of it is on this machine now`);\n const hosted = roots.find((root) => root.hosted);\n if (hosted !== undefined) return untold(`${join(hosted.directory, HOSTED_REGISTRY)} records the marketplaces hosted on claude.ai, in a shape Claude Code's reference does not give, so whether ${marketplace} is one cannot be read`);\n const own = sources.filter(({ file, settings }) => file !== PROJECT_SETTINGS && turnsOn(settings, plugin.id)).map(({ file }) => file);\n if (own.length > 0) return untold(`${named(own)} ${own.length === 1 ? 'turns' : 'turn'} it on, and Claude Code fetches a plugin that settings of the person's own turn on: neither a version of it nor its marketplace, ${marketplace}, is on this machine now`);\n return {\n state: 'absent',\n detail: `${PROJECT_SETTINGS} alone turns it on, and Claude Code fetches no plugin that a project's settings alone turn on, unless its marketplace lists it by a relative path or a seed directory holds it: no marketplace ${marketplace} is recorded as fetched or declared in settings, and no version of the plugin is in a cache (${roots.map((root) => join(root.directory, 'cache')).join(', ')})`,\n };\n}\n\n/** Where the plugin is on, as a person would look it up. */\nfunction isOn(plugin: EnabledPlugin): string {\n return `the spec-harness plugin is on (${plugin.id} in ${plugin.file})`;\n}\n\n/** How to have init's entries in place of the plugin's, for this project alone. */\nfunction turnOff(plugin: EnabledPlugin): string {\n return `turn the plugin off for this project with claude plugin disable ${plugin.id} --scope local`;\n}\n\nconst PARTS = literal({\n hooks: { brings: 'the guard hooks', twice: 'every write is guarded twice', skipped: 'init writes none', entry: \"spec-harness's hooks\", them: 'them', none: 'no hook' },\n server: { brings: 'the server', twice: 'the server is registered twice', skipped: 'init registers none', entry: 'the spec-harness server', them: 'it', none: 'no server' },\n});\n\n/** How to have a plugin that is not on this machine brought to it, in the commands Claude Code's plugin pages give. */\nfunction bring(plugin: EnabledPlugin): string {\n return `install it here, with claude plugin install ${plugin.id} once its marketplace is added`;\n}\n\n/** That the plugin settings turn on is not on this machine, and why. */\nfunction isAbsent(plugin: EnabledPlugin, detail: string, brought: string): string {\n return `${isOn(plugin)} and is not on this machine, so it brings ${brought} here: ${detail}`;\n}\n\n/**\n * What init says of a Claude Code file where the plugin that settings turn\n * on is not on this machine. It writes nothing on that reading alone: a\n * plugin that is there after all would bring the same `part` a second time.\n * A file that holds init's entry already is `present`.\n */\nexport function describeAbsent(plugin: EnabledPlugin, detail: string, part: 'hooks' | 'server', present: boolean): string {\n const words = PARTS[part];\n const absent = isAbsent(plugin, detail, words.none);\n if (present) return `${absent}. This file holds ${words.entry}; with the plugin installed as well, ${words.twice}: ${turnOff(plugin)}`;\n return `${absent}. On that reading alone ${words.skipped}, since with a plugin that is there after all ${words.twice}: ${bring(plugin)}, or to have ${words.them} here instead, ${turnOff(plugin)} and run init again`;\n}\n\n/**\n * What init says of a Claude Code file it leaves alone because the plugin is\n * on and brings the same `part`. A file that holds init's entry already is a\n * double install for the person to settle: init removes nothing, since the\n * file is the repository's and a clone without the plugin relies on it. So\n * is an entry `elsewhere`, in a settings file of the person's own, which\n * init does not write and doctor fails all the same.\n */\nexport function describeSkipped(plugin: EnabledPlugin, part: 'hooks' | 'server', present: boolean, elsewhere: readonly string[] = []): string {\n const words = PARTS[part];\n if (present) return `${isOn(plugin)} and brings ${words.brings} this file holds as well, so ${words.twice}: take ${words.entry} out of this file, or ${turnOff(plugin)}`;\n if (elsewhere.length > 0) {\n return `${isOn(plugin)} and brings ${words.brings} ${named(elsewhere)} ${elsewhere.length === 1 ? 'holds' : 'hold'} as well, so ${words.twice}: take ${words.entry} out there, or ${turnOff(plugin)}. init writes none here`;\n }\n return `${isOn(plugin)} and brings ${words.brings}, so ${words.skipped}: with both, ${words.twice}. To have ${words.them} here instead, for every clone of the repository, ${turnOff(plugin)} and run init again`;\n}\n\n/** How Claude Code is wired to the harness: the plugin, init's entries, both or neither. */\nexport interface ClaudeCodeWiring {\n readonly plugin: EnabledPlugin | null;\n /** Whether this machine has what Claude Code loads that plugin from; `null` where no settings file turns one on. */\n readonly presence: PluginPresence | null;\n /** The settings file whose `disableAllHooks` turns the hooks off, or `null`. */\n readonly hooksOff: string | null;\n /** The settings files that hold the guard hooks: a line of the hook that Claude Code starts for a write, before it or after. */\n readonly hooks: readonly string[];\n /** Each line of the hook in the settings files, with what the hook does with it and the writes it is started for. */\n readonly lines: readonly HookReport[];\n /** Whether `.mcp.json` registers the server. */\n readonly server: boolean;\n /** Whether a settings file has Claude Code start the hook as a session starts (startsSessions). */\n readonly sessionStart: boolean;\n /** Whether a settings file has Claude Code start the hook as a turn ends (reportsTurns): the plugin brings no such entry. */\n readonly turnEnd: boolean;\n /**\n * The release of the Claude Code on `PATH`, where it was asked: a matcher\n * that lists names with a comma is read as that release reads it\n * ({@link matchingUnder}). `null` where it was not asked.\n */\n readonly release: ClaudeCodeCheck | null;\n /**\n * An array for a matcher that keeps Claude Code from loading the hooks of\n * the project's settings file, the file init writes its hooks into, or\n * `null`: init writes none there while it stands ({@link arrayMatcher}).\n */\n readonly unloaded: ArrayMatcher | null;\n}\n\nexport type WiringState = 'plugin' | 'init' | 'both' | 'none';\n\n/** The wiring as its descriptions read it: what a caller knows of the plugin's presence, and of an array in the project's settings, which one that does not ask leaves out. */\ntype Wired = Pick<ClaudeCodeWiring, 'plugin' | 'hooks' | 'server'> & { readonly presence?: PluginPresence | null; readonly unloaded?: ArrayMatcher | null };\n\n/**\n * How init comes to write the guard hooks. Where an array unloads the\n * project's settings file, init writes none there and says the array, so\n * the advice is the array's, and init after it: advice that led to more\n * advice is the advice at the end.\n */\nfunction runInit(wiring: Wired): string {\n const unloaded = wiring.unloaded ?? null;\n if (unloaded === null) return 'run spec-harness init --write';\n return `${describeArrayMatcher(PROJECT_SETTINGS, unloaded)}, those init writes among them: ${ONE_STRING}, then run spec-harness init --write`;\n}\n\n/** Why the plugin settings turn on is not on this machine, or `null` where it is, may be, or none is on. */\nfunction absence(wiring: Wired): string | null {\n return wiring.presence?.state === 'absent' ? wiring.presence.detail : null;\n}\n\n/**\n * Which of the four the wiring is. `both` is a double install, and doctor\n * fails it; either of init's entries counts. A plugin that is not on this\n * machine brings nothing to it, and is not counted.\n */\nexport function wiringState(wiring: Wired): WiringState {\n const init = wiring.hooks.length > 0 || wiring.server;\n if (wiring.plugin === null || absence(wiring) !== null) return init ? 'init' : 'none';\n return init ? 'both' : 'plugin';\n}\n\n/**\n * Whether hooks that would guard are switched off: `disableAllHooks` in a\n * settings file, where a settings file holds the guard hooks or a plugin\n * that may be on this machine brings them. A guard someone set up, which\n * checks no write.\n */\nexport function guardSwitchedOff(wiring: Wired & Pick<ClaudeCodeWiring, 'hooksOff'>): boolean {\n return wiring.hooksOff !== null && guardWired(wiring);\n}\n\n/** Whether something brings the guard hooks: a settings file that holds them, or a plugin settings turn on that may be on this machine. */\nexport function guardWired(wiring: Wired): boolean {\n return wiring.hooks.length > 0 || (wiring.plugin !== null && absence(wiring) === null);\n}\n\n/**\n * What doctor and init say of `disableAllHooks` in `file`. `guarded` is\n * whether there are guard hooks for it to switch off; without any it is a\n * note on what the key would do to them.\n */\nexport function describeHooksOff(file: string, guarded: boolean): string {\n const off = `\"disableAllHooks\" is true in ${file}, so Claude Code runs no hook of the user's, the project's or the local settings, and none of a plugin`;\n if (!guarded) return `note: ${off}: the hooks init writes, and those the plugin brings, would not run while it stands`;\n return `${off}: no write is guarded. Take the key out of ${file}, or set it to false, to have the guard back. Hooks of managed settings, and of a plugin managed settings force on, keep running, and no managed settings are read here`;\n}\n\n/**\n * What doctor adds of the plugin settings turn on, where it is not simply on\n * this machine: that it cannot be told, which is never fine, or that it is\n * not, beside entries of init's. `null` where there is no more to say: no\n * plugin, one that is there, and one that is not where nothing else is\n * wired, which the wiring's own sentence says.\n */\nexport function describePresence(wiring: Wired): string | null {\n const { plugin, presence } = wiring;\n if (plugin === null || presence === undefined || presence === null || presence.state === 'present') return null;\n if (presence.state === 'unknown') return `whether ${plugin.id} is on this machine cannot be told: ${presence.detail}. A plugin that is not there brings no hook: Claude Code's /plugin lists it, and its errors`;\n if (wiring.hooks.length > 0) return `${isAbsent(plugin, presence.detail, 'no hook')}. With the plugin installed as well, ${PARTS.hooks.twice}: ${turnOff(plugin)}`;\n return wiring.server ? unguarded(plugin, presence.detail, wiring) : null;\n}\n\n/** That the plugin settings turn on is not on this machine and no hook of init's stands in for it, with the two ways to a guard. */\nfunction unguarded(plugin: EnabledPlugin, detail: string, wiring: Wired): string {\n return `${isAbsent(plugin, detail, 'no hook')}, and Claude Code guards no write. To have the guard, ${bring(plugin)}, or ${turnOff(plugin)} and ${runInit(wiring)}`;\n}\n\n/** What `doctor` says of the wiring, and what to do when it is doubled or missing. */\nexport function describeClaudeCode(wiring: Wired): string {\n const { plugin } = wiring;\n const entries = [...wiring.hooks.map((file) => `the guard hooks in ${file}`), ...(wiring.server ? ['the server in .mcp.json'] : [])].join(', ');\n const own = `init's entries: ${entries}`;\n if (plugin === null) {\n if (entries === '') return `neither the spec-harness plugin nor the hooks init writes, so Claude Code guards no write: ${runInit(wiring)}, or install the plugin`;\n return own;\n }\n const absent = absence(wiring);\n if (absent !== null) return entries === '' ? unguarded(plugin, absent, wiring) : own;\n if (entries === '') return `${isOn(plugin)} and brings the guard hooks and the server`;\n const twice = [...(wiring.hooks.length > 0 ? [PARTS.hooks.twice] : []), ...(wiring.server ? [PARTS.server.twice] : [])].join(' and ');\n return `${isOn(plugin)}, beside ${entries}: ${twice}. Keep one: take spec-harness's entries out of those files, or ${turnOff(plugin)}`;\n}\n\n/** The spec-brief plugin this package ships, as spec-brief's `plugins` names it. */\nexport const PLUGIN = '@descent-vtt/spec-harness/spec-brief-plugin';\n\nexport { SPEC_BRIEF_CONFIGS } from './config.js';\n\n/** The conditions an import meets in Node, its `defaultConditions`, and `default`, which every one meets. */\nconst IMPORT_CONDITIONS: readonly string[] = ['node', 'import', 'default'];\n\n/** A target Node refuses as invalid, which an array passes over and anything else stops at. */\nconst INVALID = Symbol('invalid target');\n\nfunction resolveTarget(target: unknown): string | null | undefined | typeof INVALID {\n if (typeof target === 'string') return target.startsWith('./') ? target : INVALID;\n if (Array.isArray(target)) {\n for (const item of target) {\n const resolved = resolveTarget(item);\n if (resolved !== undefined && resolved !== INVALID) return resolved;\n }\n return null;\n }\n if (typeof target !== 'object' || target === null) return target === null ? null : INVALID;\n for (const [condition, value] of Object.entries(target)) {\n if (!IMPORT_CONDITIONS.includes(condition)) continue;\n const resolved = resolveTarget(value);\n if (resolved !== undefined) return resolved;\n }\n return undefined;\n}\n\n/**\n * The file a package's `exports` target names for an import, as Node's\n * PACKAGE_TARGET_RESOLVE finds it, or `null` when it names none: a string\n * that starts with `./`; in an object, the target of the first key, in the\n * object's own order, that an import meets - `node`, `import` or\n * `default` - and that resolves to anything, a `null` included; in an\n * array, the first item that resolves, one Node refuses passed over. A\n * `null` target is not exported, and ends the search there, where a\n * condition an import does not meet lets it go on.\n */\nexport function exportedFile(target: unknown): string | null {\n const resolved = resolveTarget(target);\n return typeof resolved === 'string' ? resolved : null;\n}\n\n/**\n * Whether spec-brief's configuration loads the plugin, by name or as\n * `{ module, options }`. spec-brief also loads a plugin by a path, one that\n * starts with `.` or is absolute, read from the root; such a path is the\n * plugin when `isPluginFile` says it names the plugin's file, which only the\n * disk can tell. Without one, no path is: the default's `false` and an\n * `undefined` read the same in `some`, so that mutant is equivalent.\n */\nexport function loadsPlugin(config: Json, isPluginFile: (path: string) => boolean = () => false): boolean {\n const plugins = config['plugins'];\n const names = (specifier: unknown): boolean =>\n specifier === PLUGIN || (typeof specifier === 'string' && (specifier.startsWith('.') || isAbsolute(specifier)) && isPluginFile(specifier));\n return Array.isArray(plugins) && plugins.some((entry) => names(entry) || (isObject(entry) && names(entry['module'])));\n}\n\n/** Whether spec-brief's configuration names the base its archive measures a round from. */\nexport function measuresArchive(config: Json): boolean {\n const archiving = config['archiving'];\n return isObject(archiving) && typeof archiving['base'] === 'string';\n}\n\n/**\n * spec-brief's configuration with the plugin loaded and the archive measured\n * from `base`, or `null` when both already hold. spec-brief's archive\n * refuses a round that changed a protected file, and learns that a signed\n * ruling allows it only by asking the plugin (ADR-0006). It checks the file at\n * all only when it knows the base: without one it warns that the scope went\n * unmeasured and passes, so the gate is open until a base is named. A base a\n * person wrote is kept.\n */\nexport function mergeSpecBrief(current: Json, base: string | null = null, isPluginFile?: (path: string) => boolean): Json | null {\n const plugin = loadsPlugin(current, isPluginFile);\n const measure = base !== null && !measuresArchive(current);\n if (plugin && !measure) return null;\n const plugins: unknown[] = Array.isArray(current['plugins']) ? current['plugins'] : [];\n const archiving: Json = isObject(current['archiving']) ? current['archiving'] : {};\n return {\n ...current,\n ...(plugin ? {} : { plugins: [...plugins, PLUGIN] }),\n ...(measure ? { archiving: { ...archiving, base } } : {}),\n };\n}\n\n/** Whether spec-brief loads the plugin, as its configuration at the root says. */\nexport type PluginState =\n | { readonly kind: 'loaded' | 'not-loaded' | 'unreadable'; readonly file: string }\n | { readonly kind: 'unconfigured' };\n\n/** What a person reads about the plugin, and what to do when it is not loaded. */\nexport function describePlugin(state: PluginState): string {\n switch (state.kind) {\n case 'loaded':\n return `spec-brief loads spec-harness's plugin (${state.file}): its archive accepts a protected file a signed ruling allows`;\n case 'not-loaded':\n return `spec-brief does not load spec-harness's plugin, so its archive refuses a protected file whatever ruling is signed: add \"${PLUGIN}\" to \"plugins\" in ${state.file}, or run spec-harness init --write`;\n case 'unreadable':\n return `${state.file} cannot be read as JSON, so whether spec-brief loads spec-harness's plugin is unknown`;\n case 'unconfigured':\n return \"spec-brief has no configuration at the root, so it loads no plugin: spec-harness init --write writes one that loads spec-harness's\";\n }\n}\n\n/** What git says that tells a base apart. */\nexport interface BaseFacts {\n /** The remote's default branch as a local ref, such as `origin/main`, or `null`. */\n readonly remoteDefault: string | null;\n /** The name of the branch checked out, or `null` on a detached head. */\n readonly branch: string | null;\n /** Every local branch, by its name and the ref a base names it by. */\n readonly branches: readonly LocalBranch[];\n}\n\n/** The base `init` names, and why; `base` is `null` when none can be told. */\nexport interface BaseChoice {\n readonly base: string | null;\n readonly detail: string;\n}\n\n/**\n * The base `init` writes into `.spec-harness.json`. Every ruling is verified\n * against the allowed signers on it, so it is named rather than left to be\n * found. The remote's default branch comes first, but git records it when\n * it clones, and before 2.48 not on a fetch: a repository made with `git\n * init` and pushed to a remote often has none. There the branch init runs on\n * is the base when it is `main` or `master`, or the only branch; otherwise\n * the person names it.\n */\nexport function chooseBase(facts: BaseFacts): BaseChoice {\n const { remoteDefault, branch } = facts;\n if (remoteDefault !== null) return { base: remoteDefault, detail: `rounds are measured from ${remoteDefault}, the remote's default branch` };\n const unrecorded = 'no remote records a default branch (refs/remotes/origin/HEAD)';\n if (branch !== null) {\n const conventional = branch === 'main' || branch === 'master';\n if (conventional || facts.branches.every((local) => local.name === branch)) {\n const which = conventional ? 'the branch init runs on' : 'the only branch';\n // The base is a ref git and spec-brief read, so it is the name git\n // reads as the branch and nothing else: `heads/main` beside a tag\n // `main`. A branch with no commit yet is listed by no ref.\n const base = facts.branches.find((local) => local.name === branch)?.ref ?? branch;\n return { base, detail: `rounds are measured from ${base}, ${which}: ${unrecorded}; change \"base\" if rounds merge into another` };\n }\n }\n const where = branch === null ? 'HEAD is detached' : `${branch} is not main, master or the only branch`;\n return {\n base: null,\n detail: `no base can be told: ${unrecorded}, and ${where}; set \"base\" to the branch rounds merge into, or run git remote set-head origin --auto and init again`,\n };\n}\n\n/** Where a base came from: `--base`, the configuration, or the remote. */\nexport type BaseSource = 'flag' | 'config' | 'remote';\n\nconst SOURCES: Readonly<Record<BaseSource, string>> = { flag: '--base', config: '.spec-harness.json', remote: \"the remote's default branch\" };\n\n/** The base a command resolved, and how; or why there is none. */\nexport function describeBase(base: { readonly ref: string; readonly source: BaseSource; readonly mergeBase: string } | { readonly reason: string }): string {\n if ('reason' in base) return `none: ${base.reason}`;\n return `${base.ref} (${SOURCES[base.source]}), merge base ${base.mergeBase.slice(0, 12)}`;\n}\n\n/** Whether the allowed-signers file is on the base, where every ruling's signature is checked against it. */\nexport function describeSigners(file: string, base: string | null, onBase: boolean): string {\n if (base === null) return `${file}, read from the base, which could not be resolved: no ruling can count`;\n if (onBase) return `${file} is on ${base}`;\n return `${file} is not on ${base}, so no ruling can count: commit it there, one line per person: <email> namespaces=\"git\" <public key>`;\n}\n\n/**\n * The note doctor gives on the signers whose key is not FIDO2, or `null`\n * when every one's is. A note, never a failure: ADR-0006 accepts a key the\n * agent's account cannot read too, and a PIV or PKCS#11 hardware key is\n * written as a plain key.\n */\nexport function describeSignerKeys(signers: readonly Pick<AllowedSigner, 'line' | 'principals' | 'keyType'>[]): string | null {\n if (signers.length === 0) return null;\n const named = signers.map((signer) => `${signer.principals.join(',')} (${signer.keyType}, line ${signer.line})`).join(', ');\n return (\n `note: signers whose key is not a FIDO2 key: ${named}. ` +\n \"Where an agent runs as the person, ADR-0006 recommends a FIDO2 key, ssh-keygen -t ed25519-sk, whose signature needs a touch no process can supply, or a key the agent's account cannot read; \" +\n 'a PIV or PKCS#11 hardware key reads as a plain ssh-rsa or ecdsa line, so this is a note, not a failure'\n );\n}\n\n/** The note doctor gives on a line of the allowed-signers file that is not a signer. */\nexport function describeSignerProblem(problem: { readonly line: number; readonly message: string }): string {\n return `note: line ${problem.line} is not a signer: ${problem.message}`;\n}\n\n/** What doctor says of the Claude Code on `PATH`, which runs the guard's hooks only from the minimum on. */\nexport function describeClaudeRelease(check: ClaudeCodeCheck): string {\n // A version read from a package.json says so: nothing ran to tell it.\n const release = (found: { readonly version: string; readonly file?: string }): string =>\n `Claude Code ${found.version}${found.file === undefined ? '' : ` (as ${found.file} declares)`}`;\n switch (check.state) {\n case 'ok':\n return `${release(check)} runs the hooks, which need ${CLAUDE_CODE_MINIMUM} or later`;\n case 'outdated':\n return `${release(check)} is older than ${CLAUDE_CODE_MINIMUM}, which the hooks need: it ignores a hook's args and runs a bare node, which fails, and a PreToolUse hook that fails blocks nothing, so every write passes unguarded: update Claude Code, with claude update`;\n case 'unknown':\n return `whether Claude Code is ${CLAUDE_CODE_MINIMUM} or later, which the hooks need, cannot be told: ${check.reason}; an older release lets every write pass unguarded, so check claude --version where Claude Code runs`;\n }\n}\n\n/** Where git's pre-commit hook stands: git's path for it, shown from the root, and what is there. */\nexport type GitHookState =\n | { readonly state: 'runs' | 'absent' | 'other' | 'inert'; readonly file: string }\n /**\n * What stands at the path is no file, `what` it is instead. `stops`: git\n * can execute it, tries to run it as the hook, fails, and stops every\n * commit. `ignored`: git cannot execute it, and skips it as it skips a\n * hook that is not executable.\n */\n | { readonly state: 'stops' | 'ignored'; readonly file: string; readonly what: string }\n /**\n * A file the account may not read, `reason` being why, and `runs` whether\n * git may execute it. One git may not execute it skips, with a hint, and\n * commits. One it may it runs, and a script the shell cannot read either\n * stops every commit there (measured with git 2.47 as an ordinary account),\n * where a program runs without being read: which it is cannot be read.\n */\n | { readonly state: 'unreadable'; readonly file: string; readonly runs: boolean; readonly reason: string }\n | { readonly state: 'unknown'; readonly reason: string };\n\n/**\n * The advice for a missing hook, which init gives beside the file and doctor\n * with it. The hook is the guard for a write the agent's hooks never see,\n * one made through a shell (ADR-0005).\n */\nexport function missingGitHook(file: string | null): string {\n const where = file === null ? '' : ` (${file})`;\n return `no pre-commit hook runs spec-harness${where}: one refuses a commit that changes what the active brief protects, for any agent or none, a shell's writes included; run spec-harness init --git-hook --write to add it`;\n}\n\n/**\n * How to keep the files the rules live in from changing unread, on each\n * forge, as spec-core's ADR-0005 asks: the forge protects them, and CI checks\n * a change against the base branch's rules. GitLab Free has no Code Owners\n * approval, so there the person who merges is the reviewer.\n */\nexport const PROTECT_RULE_FILES =\n \"Have the forge protect this file, the ADRs, the tool configurations and the CI configuration, so no change to them reaches the base branch without a person, and check each change in CI against the base branch's rules: \" +\n 'on GitHub, CODEOWNERS and a protected branch; on GitLab Premium, Code Owners; on GitLab Free, a protected branch no one pushes to, merged by Maintainers, agents as Developers, and pipelines that must succeed. ' +\n \"spec-core's docs/adopting.md has the settings\";\n\n/**\n * The line to add to a hook the repository has of its own: node and the\n * script in the project's install, as Claude Code's hooks are run. git starts\n * a pre-commit hook at the top of the work tree it commits in, a linked\n * worktree's own, wherever the hook is kept, so the path is read from there.\n */\nexport const GIT_HOOK_LINE = `node ${BIN} hook git`;\n\n/**\n * The hook init writes. It is a POSIX sh script on every platform, since Git\n * for Windows runs a hook with the sh it ships. git starts it at the top of\n * the work tree it commits in, so the project's install is read from there,\n * and where a linked worktree has none, from the repository's main work\n * tree: the work tree whose `.git` the common directory is, where `git\n * worktree add` was run and the project installed (ADR-0005). Where neither\n * has the install - a worktree of a repository nobody installed into, a\n * repository that shares its hooks with one that uses the harness - node\n * would end on a stack trace, so the hook says what is missing and where,\n * and the commit waits, as it did when npx found nothing to run.\n */\nexport const PRE_COMMIT = `#!/bin/sh\n# spec-harness: refuse a commit that changes what the active brief protects.\n# git runs this at the top of the work tree it commits in, a linked worktree's\n# own, wherever the hook is kept: the project's install is read from there,\n# or, where a linked worktree has none, from the repository's main work tree.\nbin=${BIN}\nif [ ! -f \"$bin\" ]; then\n common=$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null)\n if [ \"\\${common##*/}\" = .git ] && [ -f \"\\${common%/.git}/$bin\" ]; then\n bin=\\${common%/.git}/$bin\n else\n printf '%s\\\\n' \"spec-harness: $bin is not in $PWD, the work tree git commits in, nor in its repository's main work tree: install the project's dependencies there, as with npm ci, and commit again\" >&2\n exit 2\n fi\nfi\nexec node \"$bin\" hook git\n`;\n\n/**\n * What doctor and init add of a hook whose text runs the harness through\n * npx: the hook init wrote through 0.9.1, or the line it advised for a hook\n * of the repository's own. A note, never a failure: the hook guards as it\n * did. npx starts npm to start node, and npm 12 says on stderr what it runs,\n * twice a commit. A comment that names the command runs nothing, and neither\n * does another runner's line, which is the repository's to choose.\n */\nexport function gitHookNote(text: string): string | null {\n const npx = text.split('\\n').some((line) => /^[^#]*\\bnpx\\b.*\\bspec-harness\\s+hook\\s+git\\b/.test(line));\n if (!npx) return null;\n return `it runs spec-harness through npx, which starts npm to start node on every commit, and under npm 12 prints two \"npm notice run\" lines each time: to run it with node from the project's install, as Claude Code's hooks are, replace the npx command there with \"${GIT_HOOK_LINE}\"`;\n}\n\n/** What doctor says of git's pre-commit hook. */\nexport function describeGitHook(hook: GitHookState): string {\n switch (hook.state) {\n case 'runs':\n return `${hook.file} runs spec-harness`;\n case 'inert':\n return `${hook.file} runs spec-harness, but is not executable, so git skips it: chmod +x ${hook.file}`;\n case 'other':\n return `${hook.file} does not run spec-harness: add the line \"${GIT_HOOK_LINE}\" to it`;\n case 'stops':\n return `${hook.file} is ${hook.what}, not a hook, and git stops every commit at it, since it cannot run it (\"cannot spawn\" on Windows, \"cannot exec\" elsewhere): nothing is checked there, and nothing is committed. Take it away, then run spec-harness init --git-hook --write`;\n case 'ignored':\n return `${hook.file} is ${hook.what}, not a hook, and is not executable, so git skips it and runs no hook: take it away, then run spec-harness init --git-hook --write`;\n case 'unreadable':\n if (!hook.runs) return `${hook.file} cannot be read (${hook.reason}), and is not executable, so git skips it and runs no hook: make it readable and executable, or take it away and run spec-harness init --git-hook --write`;\n return `${hook.file} cannot be read (${hook.reason}), so whether it runs spec-harness cannot be told: git runs it at a commit, and a script there that cannot be read stops every commit, where a program runs; make it readable`;\n case 'absent':\n return missingGitHook(hook.file);\n case 'unknown':\n return `where git runs its hooks cannot be told: ${hook.reason}`;\n }\n}\n\n/** spec-graph's configuration files, in the order spec-graph reads them; then a \"spec-graph\" key in package.json. */\nexport const SPEC_GRAPH_CONFIGS: readonly string[] = ['.spec-graph.json', 'spec-graph.config.json'];\n\n/**\n * spec-graph's own patterns when its configuration names none, its\n * DEFAULT_PATTERNS as of 0.9.0. They decide only what init says, never what\n * it writes: `patterns` in the configuration replaces them, so writing the\n * briefs into it would freeze spec-graph's defaults into the file.\n */\nconst SPEC_GRAPH_DEFAULTS: readonly string[] = ['docs/**/*.md', 'doc/**/*.md', 'adr/**/*.md', 'rfcs/**/*.md', 'specs/**/*.md', '*.md'];\n\n/** Whether spec-graph, configured as `config` says, reads the briefs in the directory `briefs`. */\nexport function graphReadsBriefs(config: Json, briefs: string): boolean {\n const configured = Array.isArray(config['patterns']) ? config['patterns'].filter((pattern): pattern is string => typeof pattern === 'string') : [];\n const list = parseGlobList(configured.length > 0 ? configured : SPEC_GRAPH_DEFAULTS, { dialect: 'path', caseSensitive: true, backslash: 'separator' });\n return list.ok && list.list.match(`${briefs}/001_brief.md`);\n}\n\n/**\n * What the history entry does. spec-graph reads a brief whose status says\n * `archived` as a record already; the entry makes one a record whatever word\n * its status uses, or none - and it does anything only where spec-graph\n * reads the briefs, which its defaults do not in `briefs/`.\n */\nexport function describeGraph(archiveGlob: string, briefs: string, reads: boolean, added: boolean): string {\n const history = added ? `read ${archiveGlob} as history` : `${archiveGlob} is history`;\n if (reads) return `${history}: an archived brief is a record whatever its status says, so a live brief that depends on one is not a stale premise`;\n return `${history}, for when spec-graph reads the briefs; its patterns do not reach ${briefs}/, so it checks none of them now: add \"${briefs}/**/*.md\" to its \"patterns\" if it should`;\n}\n\n/** spec-graph's configuration with the archive read as history, or `null` when it already is. */\nexport function mergeSpecGraph(current: Json, archiveGlob: string): Json | null {\n const patterns = current['historyPatterns'];\n const history = Array.isArray(patterns) ? patterns.filter((p): p is string => typeof p === 'string') : [];\n if (history.includes(archiveGlob)) return null;\n return { ...current, historyPatterns: [...history, archiveGlob] };\n}\n"]}