@descent-vtt/spec-harness 0.20.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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +113 -0
- package/README.md +13 -7
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +119 -30
- package/dist/cli.js.map +1 -1
- package/dist/configure.d.ts +40 -3
- package/dist/configure.js +75 -9
- package/dist/configure.js.map +1 -1
- package/dist/fs.d.ts +30 -4
- package/dist/fs.js +104 -11
- package/dist/fs.js.map +1 -1
- package/dist/git.d.ts +38 -0
- package/dist/git.js +59 -2
- package/dist/git.js.map +1 -1
- package/dist/guard.d.ts +20 -1
- package/dist/guard.js +31 -0
- package/dist/guard.js.map +1 -1
- package/dist/hooks.d.ts +14 -0
- package/dist/hooks.js +14 -0
- package/dist/hooks.js.map +1 -1
- package/dist/round.d.ts +19 -1
- package/dist/round.js +59 -16
- package/dist/round.js.map +1 -1
- package/dist/server.js +42 -7
- package/dist/server.js.map +1 -1
- package/dist/siblings.d.ts +5 -3
- package/dist/siblings.js +52 -31
- package/dist/siblings.js.map +1 -1
- package/dist/workspace.js +23 -13
- package/dist/workspace.js.map +1 -1
- package/package.json +3 -3
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,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AC/L,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;QAC1F,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,6EAA6E;AAC7E,cAAc;AACd,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAI,GAAsB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACxE,OAAO,GAAG,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAC7G,CAAC","sourcesContent":["/**\n * The command line: arguments, dispatch, output and exit codes.\n *\n * Exit 0: done, nothing refused. Exit 1: something refused or found. Exit 2:\n * the answer cannot be trusted - a bad flag, an option, an argument or a\n * value that names nothing, a configuration that does not load, a sibling\n * that is missing or printed something unreadable, a git command that\n * failed, an output its reader closed, an error nothing here expected. A run\n * that could not look must never exit as though it looked and found nothing\n * (spec-core ADR-0005).\n *\n * A command loads what it runs. This module imports what every run needs,\n * the hook's before a write among them, and a module that only some\n * commands run is imported where one of them is the command: the hook\n * runs before and after every write an agent makes, and what it loaded of\n * the other commands was a wait before each (ADR-0002). A module that\n * cannot be loaded is thrown where it was asked for, and ends the run in a\n * line and exit 2, as every error does.\n */\n\nimport { SiblingOutputError } from './briefs.js';\nimport { CONFIG_FILE, ConfigError, SIBLINGS, SPEC_BRIEF_CONFIGS } from './config.js';\nimport type { ClaudeCodeWiring } from './configure.js';\nimport { dirname, join, resolve } from 'node:path';\n\nimport { gitDirectories, isDirectory, keepCall, loadConfig, mainWorkTree, outsideEvery, StateError, takeCall, writesOnly } from './fs.js';\nimport { changedPaths, GitError, show, stagedChanges } from './git.js';\nimport type { DocumentReader } from './document.js';\nimport type { Decision } from './guard.js';\nimport { afterResponse, callFile, callRecord, claudeResponse, gitResponse, keptCall, mendResponse, NONE, parseClaudeHook, SESSION_START, sessionOf, sessionResponse, TURN_END, turnResponse, warningResponse, warningsKept, warningsOf, type CallRecord, type HookRequest, type HookResponse } from './hooks.js';\nimport type { Base } from './round.js';\nimport type { BriefRow } from './types.js';\nimport { declaredVersion, SiblingError } from './siblings.js';\nimport { answerBeside, emptyValue, heldHookLine, isBlank, isClaudeHook, readHookLine, refusal, twoValues, unreadHookLine, type Command, type LineFault } from './usage.js';\nimport { CLAUDE_CODE_MINIMUM, MINIMUM_VERSIONS, type ClaudeCodeCheck } from './versions.js';\nimport {\n activeBrief,\n answerOf,\n describeActive,\n EXIT_ERROR,\n EXIT_FAILED,\n EXIT_OK,\n json,\n MAIN_INSTALL,\n mayBeElsewhere,\n openFound,\n openWorkspace,\n otherTree,\n parseOptions,\n UsageError,\n version,\n type CliIO,\n type Options,\n type UnreadableLine,\n type Workspace,\n writesBy,\n} from './workspace.js';\n\nexport { EXIT_ERROR, EXIT_FAILED, EXIT_OK, UsageError, version, type CliIO } from './workspace.js';\n\nexport const HELP = `spec-harness - context, guards, audits and rulings for rounds of agent work\n\nUsage:\n spec-harness <command> [options]\n\nCommands:\n context [brief] What an agent needs to start a round: the brief, its scope,\n rulings, dependencies, the rules in force, the cited documents.\n guard <path...> May the round write these paths? Exit 1 if one is refused.\n hook claude Answer a Claude Code PreToolUse, PostToolUse, SessionStart or Stop\n hook (stdin). At session start it says what would hold every\n write; at a turn's end, with \"turnReport\" on, what the work tree\n holds that the brief protects or that is outside its scope.\n hook git Answer git's pre-commit hook for the staged files.\n escalate Ask a person to rule: --path <file> (repeatable) --reason <why>\n [--option \"<label>: <cost>\"]... [--recommend <text>].\n --list shows what waits; --show <id> prints one memo. Neither\n raises a request: beside one, only --root and --format are read.\n rule <id> Record a person's ruling in the brief: --allow or --deny, with\n --note <text>. It counts once committed signed.\n rulings [brief] The brief's rulings, and whether each one's signature verifies.\n audit [brief] Did the round stay inside the lines: what the archive would say,\n the brief's assertions, unverified rulings, new dependencies\n and the install scripts it allowed.\n probe [brief] Run the brief's probes: red at the base, green at the head.\n --at <base|head|both>, --id <probe>.\n premises Do the live briefs' premises still hold? For CI: exit 1 when one\n is stale, or, with --strict, when spec-guard cannot read one.\n init Configure the spec-* tools to agree. Prints the plan; --write\n applies it; --git-hook adds a pre-commit hook; --block-on-failure\n has Claude Code 2.1.295 or later hold a write when the hook cannot\n start or runs past its timeout.\n mcp Serve start_round, check_path, request_escalation, audit_round,\n list_rounds and the workflow prompts over MCP on stdio.\n doctor Which siblings are installed, at which versions, which brief is\n named, how Claude Code runs the guard, and git's hook. Exit 1\n when a sibling is older than this release needs, the guard is\n installed twice, its hook's line turns it off or holds every\n write, the branch names a brief spec-brief does not list or\n has archived, disableAllHooks or an array for a matcher\n switches it off, the plugin that is turned on is not on this\n machine and nothing else guards, Claude Code is too old to\n run its hooks, or git stops every commit at what stands for\n its hook.\n\nOptions:\n --brief <id> The brief the round works on. Otherwise SPEC_BRIEF, then the branch.\n For context, guard, hook, escalate, rulings, audit, probe, premises\n and doctor.\n --base <ref> What the round is measured from. Otherwise \"base\" in\n .spec-harness.json, then the remote's default branch. For context,\n guard, hook, rulings, audit, probe and doctor.\n --root <dir> Run from another directory, which must exist. For every command.\n --format <fmt> pretty or json; audit and premises also gitlab, sarif or github.\n For every command but hook and mcp.\n --strict Warnings fail the run. For guard, audit, premises and doctor.\n --block-on-failure onFailure \"block\" on init's entries but the one as a turn ends. For init.\n --help, --version One of the two: both on one line are refused.\n\nAn option a command does not read, an argument it does not take, an option or an\nargument given an empty value, a brief given both as the argument and as --brief,\nand an option that takes one value given two that name two things are refused, exit 2,\nnot read as if they were not there, and so with --help or --version on the line. The\nsame value twice, as --root . --root ./, is read once, and on Windows a drive letter in\neither case. doctor says an empty --brief or --base in its report. hook claude reads its\nline as every release has, and says a line it cannot read, two values for one option or\n--help beside a --root that is not a directory among them, a --root that is not a\ndirectory, and a question it cannot read, as a warning to the person with exit 0: it\nrefuses nothing for any of them.\n\nExit codes: 0 clean, 1 refused or found something, 2 the answer cannot be trusted.\n`;\n\n\n/* ------------------------------------------------------------------- guard */\n\n/**\n * The reader of a brief's rulings, loaded where a ruling is read: a write\n * to a file no brief protects reads none.\n */\nconst reader = async (): Promise<DocumentReader> => (await import('./reader.js')).createReader();\n\n/**\n * The work tree with spec-brief's answers kept for a session of Claude\n * Code's, and given again to it where all they were read from reads the\n * same (ADR-0002); as it is where no session is named.\n */\nfunction keptFor(workspace: Workspace, session: string | null): Workspace {\n return session === null ? workspace : { ...workspace, siblings: workspace.siblings.keeping(workspace.commonDir, session) };\n}\n\nasync function decisionsFor(\n workspace: Workspace,\n options: Options,\n io: CliIO,\n given: readonly string[],\n cwd: string,\n session: string | null = null,\n): Promise<{ readonly decisions: Decision[]; readonly brief: BriefRow | null } | { readonly problem: string }> {\n // A path outside every work tree of the repository is decided as one\n // outside it, whichever brief is named and whatever is wrong with the\n // name: the problem held every write, a file outside the repository\n // among them, where no brief decides one (ADR-0005). So no brief is asked\n // about for such a write, and spec-brief is not run for it.\n const outside = outsideEvery(given, workspace.root, workspace.commonDir, cwd);\n const active = outside ? null : await activeBrief(keptFor(workspace, session), options, io.env);\n const { brief, note, problem } = active === null ? { brief: null, note: undefined, problem: null } : describeActive(active);\n if (problem !== null) return { problem };\n const { checkPaths } = await import('./round.js');\n return { decisions: await checkPaths(workspace, brief, note, given, cwd, reader, options.base), brief };\n}\n\n/**\n * Whether a decision is of a file the answer after the write is made from:\n * the configuration, spec-brief's, the brief, or a file beside it in the\n * briefs' directory, which spec-brief reads too. A call that writes one is\n * decided again after the write, so that what the write changed is read\n * (ADR-0002).\n */\nfunction decidesAnswers(decision: Decision, brief: BriefRow | null): boolean {\n if (decision.path === CONFIG_FILE || SPEC_BRIEF_CONFIGS.includes(decision.path)) return true;\n if (brief === null) return false;\n return decision.path === brief.file || decision.path.startsWith(`${dirname(brief.file)}/`);\n}\n\nconst SYMBOL: Record<Decision['verdict'], string> = { allow: 'ok ', warn: 'warning', ask: 'ask ', deny: 'refused' };\n\nasync function guardCommand(options: Options, io: CliIO): Promise<number> {\n if (options.positionals.length === 0) throw new UsageError('guard needs at least one path');\n const workspace = await openWorkspace(options, io);\n const decided = await decisionsFor(workspace, options, io, options.positionals, io.cwd);\n if ('problem' in decided) {\n io.stderr.write(`spec-harness: ${decided.problem}\\n`);\n return EXIT_ERROR;\n }\n const { decisions } = decided;\n if (options.format === 'json') {\n io.stdout.write(json('guard', { decisions }));\n } else {\n for (const decision of decisions) {\n io.stdout.write(`${SYMBOL[decision.verdict]} ${decision.message}\\n`);\n if (decision.verdict !== 'allow') io.stdout.write(` ${decision.hint}\\n`);\n }\n }\n const refused = decisions.some((d) => d.verdict === 'deny' || d.verdict === 'ask');\n const warned = decisions.some((d) => d.verdict === 'warn');\n return refused || (options.strict && warned) ? EXIT_FAILED : EXIT_OK;\n}\n\n/* -------------------------------------------------------------------- hook */\n\nasync function readStdin(io: CliIO): Promise<string> {\n // Only the built command line reads process.stdin, and the suite spawns it\n // from dist/, outside the sweep (tests/integration/claude-code.test.ts): the\n // lines below survive it untested in-process.\n if (io.stdin !== undefined) return io.stdin();\n const chunks: Buffer[] = [];\n for await (const chunk of process.stdin) chunks.push(chunk as Buffer);\n return Buffer.concat(chunks).toString('utf8');\n}\n\n/**\n * The write Claude Code asks the hook about, or the session that starts, or\n * the exit code that answers already, 0: for a question that cannot be read,\n * said to the person, and for a tool that writes no file. Asked before\n * anything on the hook's own line is, so that a line that is wrong is said\n * where there is a write it leaves unchecked, or a session whose every write\n * it leaves so.\n */\nasync function writeAsked(io: CliIO): Promise<HookRequest | number> {\n let question: string;\n try {\n question = await readStdin(io);\n } catch (error) {\n // A question that could not be read is one the hook cannot see, as one\n // it cannot parse is, below: it has no event to hold a write by.\n return answer(io, warningResponse(`the hook input could not be read: ${(error as Error).message}, so nothing it asks about is checked`));\n }\n const request = parseClaudeHook(question);\n // A hook that cannot read its question refuses nothing it cannot see, and\n // says so where the person reads it.\n if ('error' in request) return answer(io, warningResponse(`${request.error}, so nothing it asks about is checked`));\n return request.paths.length === 0 && request.event !== SESSION_START && request.event !== TURN_END ? EXIT_OK : request;\n}\n\n/**\n * What is wrong with the hook's own line, said and nothing refused for it:\n * one line, shown to the person, and exit 0, where exit 2 would hold every\n * write of the session, the one that mends the line among them. Exit 1 said\n * it as well, and is what Claude Code counts as a hook that failed, which\n * `onFailure: \"block\"` holds the write for (ADR-0005).\n */\nfunction guardOff(io: CliIO, { wrong, mend }: LineFault, event: string): number {\n if (event === SESSION_START) return answer(io, sessionResponse(`${wrong}, so the guard is off and no write of this session is checked; ${mend}`));\n if (event === TURN_END) return answer(io, turnResponse(`spec-harness: ${wrong}, so the guard is off and no write of this session is checked; ${mend}`));\n return answer(io, warningResponse(`${wrong}, so the guard is off and this write is not checked; ${mend}`));\n}\n\nfunction answer(io: CliIO, response: { readonly stdout: string; readonly exitCode: number }): number {\n io.stdout.write(response.stdout);\n return response.exitCode;\n}\n\n/**\n * The answer to a write a configuration that does not load holds no more,\n * or `null` for every other write, which is held as before (ADR-0005). Every\n * write was held. A write outside every work tree of the repository is\n * decided as such a write is, after the write as before it: nothing of the\n * repository's decides it. And before a write to the configuration file\n * itself, and to nothing else, the line says why every other write is held,\n * so that a session can mend a typo in it. `cwd` is what a relative path\n * is read from.\n */\nfunction mending(error: unknown, request: HookRequest, cwd: string, env: CliIO['env']): HookResponse | null {\n // Every configuration the hook loads is read from a file, so `file` is\n // never `null` here, and the test of it is the compiler's: its mutant is\n // equivalent.\n if (!(error instanceof ConfigError) || error.file === null) return null;\n // The work trees are named by the files git keeps, where git would name\n // the same ones; a repository whose configuration or environment moves a\n // work tree elsewhere is not known to leave the path outside. The file\n // was loaded from the top git named, where a `.git` stands, so the files\n // name a work tree, and the test of `null` is the compiler's.\n const found = gitDirectories(dirname(error.file), env);\n if (found !== null && found.exact && outsideEvery(request.paths, found.top, found.common, cwd)) return NONE;\n if (request.event !== 'PreToolUse' || !writesOnly(request.paths, error.file, cwd)) return null;\n return mendResponse(`${error.message}, so every other write is held until it loads; this write, to ${error.file} itself, is not checked`);\n}\n\n/**\n * What would hold every write of the session that starts, said once as it\n * starts and no write waits on it (ADR-0005): a configuration that does not\n * load, a brief named that spec-brief does not list or has archived, and\n * spec-brief itself, where a brief is named, missing, too old or unable to\n * list the briefs. Each in the words a write would be held with, and\n * `doctor` says, and with what mends it. `null` where nothing does. The\n * check never ends the session's start: whatever it meets is said.\n */\nasync function sessionProblem(options: Options, io: CliIO, root: string, cwd: string | null, session: string | null): Promise<string | null> {\n const held = 'so every write of this session is held until it is mended';\n try {\n const named = await openWorkspace({ ...options, root }, io);\n // A session in another work tree of the project has its writes decided\n // there, and so is the check (ADR-0005).\n const found = cwd === null ? null : await otherTree(named, cwd);\n const workspace = found === null ? named : await openFound(found, io, () => [named.root]);\n const { problem } = describeActive(await activeBrief(keptFor(workspace, session), options, io.env));\n return problem === null ? null : `${heldHookLine(problem).wrong}, ${held}: fix the brief or the branch before writing; spec-harness doctor says more`;\n } catch (error) {\n // A session in no work tree has nothing to guard, as a write there has\n // not. Anything else that stops the check stops a write's as well, which\n // is then held as one the hook cannot check: a configuration that does\n // not load, a spec-brief that is missing, too old or cannot list the\n // briefs, and whatever a defect throws.\n if (error instanceof UsageError) return null;\n // But a write to the configuration file itself, which mends it, where\n // the file is one a write may reach under its name alone (ADR-0005). The\n // configuration is read from a file here as before a write, so the test\n // of `file` is the compiler's, and its mutant is equivalent.\n const mendable = error instanceof ConfigError && error.file !== null && writesOnly([error.file], error.file, root);\n return `${(error as Error).message}, ${held}${mendable ? `, but for a write to ${error.file} itself, which is not checked` : ''}; spec-harness doctor says more`;\n }\n}\n\n/** The most paths a report names one by one: past it, how many more there are. */\nconst REPORTED = 20;\n\n/**\n * What the work tree holds at the end of a turn that the brief protects or\n * that is outside its scope, one line a path in the words a write of it is\n * given; or `null` where there is nothing to say: `turnReport` is off, no\n * brief is named, nothing changed is either, or the session is in no work\n * tree (ADR-0005). The work tree is the one a write of the session is\n * decided in. One start of git reads what changed, and nothing is asked of\n * the base, so no ruling is read: a protected file a signed ruling allows\n * is said as protected, and the audit reads the ruling. A configuration\n * that does not load is said by every write and as the session starts, and\n * here holds the report back without a word.\n */\nasync function turnReport(options: Options, io: CliIO, root: string, cwd: string | null): Promise<string | null> {\n try {\n const named = await openWorkspace({ ...options, root }, io);\n const found = cwd === null ? null : await otherTree(named, cwd);\n const workspace = found === null ? named : await openFound(found, io, () => [named.root]);\n if (!workspace.config.turnReport) return null;\n const { brief, problem } = describeActive(await activeBrief(workspace, options, io.env));\n if (problem !== null) return `spec-harness: ${heldHookLine(problem).wrong}, so what the work tree holds is not reported, and every write is held; spec-harness doctor says more`;\n if (brief === null) return null;\n const [changed, { decide }] = await Promise.all([changedPaths(workspace.root), import('./guard.js')]);\n const outOfScope = workspace.config.outOfScope;\n const said = changed.map((path) => decide({ path, given: path, brief, rulings: [], outOfScope })).filter((decision) => decision.verdict !== 'allow');\n if (said.length === 0) return null;\n const lines = said.slice(0, REPORTED).map((decision) => `- ${decision.message}. Next: ${decision.hint}.`);\n const more = said.length > REPORTED ? [`- and ${said.length - REPORTED} more: spec-harness guard <path> says each`] : [];\n const paths = said.length === 1 ? `a path that brief ${brief.id} protects or that is outside its scope` : `${said.length} paths that brief ${brief.id} protects or that are outside its scope`;\n return [`spec-harness: as this turn ended, the work tree held changes to ${paths}:`, ...lines, ...more].join('\\n');\n } catch (error) {\n if (error instanceof UsageError || error instanceof ConfigError) return null;\n return `spec-harness: ${(error as Error).message}, so what the work tree holds is not reported`;\n }\n}\n\n/**\n * Claude Code's hook on a line the parser refused: an option no command has,\n * an option left without its value, a --format or an --at that is none. It\n * was exit 2 before the question was read, for the line a settings file\n * holds as for one typed at a terminal. What is said of it is `doctor`'s\n * to say as well, of a line it finds in a settings file (usage.ts).\n */\nasync function unreadLine(said: string, io: CliIO): Promise<number> {\n const request = await writeAsked(io);\n if (typeof request === 'number') return request;\n return guardOff(io, unreadHookLine(said).fault, request.event);\n}\n\n/**\n * The answer after a write, where it can be given with no process started,\n * or `null` where it is to be decided as before (ADR-0002, ADR-0003).\n *\n * The git directory is the one the files at the hook's root name. What the\n * run before the write kept for this call, if anything, is taken away as it\n * is read, and answered from where it is this call's: the same release,\n * session, call, tool, paths, directories, line and variables. And where\n * nothing is kept, a run after a write says nothing but a warning outside\n * the scope, which only `outOfScope: \"warn\"` decides: under `ask` or\n * `deny` there is nothing to say, where the configuration read is the one\n * git would have the hook read, of the work tree the session is in.\n */\nasync function answeredAfter(root: string, record: CallRecord | null, cwd: string | null, paths: readonly string[], io: CliIO): Promise<HookResponse | null> {\n const found = gitDirectories(root, io.env);\n if (found === null) return null;\n if (record !== null) {\n const kept = await takeCall(found.common, callFile(record));\n // warningsKept reads no text as no record as well: the test is there for\n // the type, and its mutant is equivalent.\n const warnings = kept === null ? null : warningsKept(kept, record);\n if (warnings !== null) return afterResponse(warnings);\n }\n // A path in another work tree than the one this configuration is read\n // from may be decided by another's, which may warn.\n if (!found.exact || (cwd !== null && mayBeElsewhere(cwd, found.top)) || paths.some((path) => mayBeElsewhere(resolve(cwd ?? io.cwd, path), found.top))) return null;\n try {\n return (await loadConfig(found.top)).config.outOfScope === 'warn' ? null : afterResponse([]);\n } catch {\n // A configuration that does not load is said as it was, by the run.\n return null;\n }\n}\n\n/**\n * The answer before a write the hook could not check: one line, and exit 2,\n * which holds the write. Claude Code shows the line to Claude as the\n * reason.\n */\nfunction cannotCheck(io: CliIO, error: unknown): number {\n io.stderr.write(`spec-harness: cannot check this write: ${(error as Error).message}\\n`);\n return EXIT_ERROR;\n}\n\nasync function hookCommand(options: Options, io: CliIO): Promise<number> {\n const kind = options.positionals[0];\n if (kind === 'claude') {\n const request = await writeAsked(io);\n if (typeof request === 'number') return request;\n // The root the line gives, or what is wrong with it: read as `doctor`\n // reads the line where it finds it in a settings file (usage.ts).\n const line = readHookLine(options.root, io.cwd, isDirectory);\n if (line.state === 'off') return guardOff(io, line.fault, request.event);\n const cwd = request.cwd ?? io.cwd;\n const root = line.root ?? io.env['CLAUDE_PROJECT_DIR'] ?? cwd;\n const session = sessionOf(request);\n if (request.event === SESSION_START) return answer(io, sessionResponse(await sessionProblem(options, io, root, request.cwd, session)));\n if (request.event === TURN_END) return answer(io, turnResponse(await turnReport(options, io, root, request.cwd)));\n const record = callRecord(request, { root: line.root, brief: options.brief, base: options.base }, io.cwd, io.env, version());\n if (request.event === 'PostToolUse') {\n const answered = await answeredAfter(root, record, request.cwd, request.paths, io);\n if (answered !== null) {\n io.stdout.write(answered.stdout);\n return answered.exitCode;\n }\n }\n let workspace: Workspace;\n try {\n workspace = await openWorkspace({ ...options, root }, io);\n } catch (error) {\n if (error instanceof UsageError) return EXIT_OK;\n const mended = mending(error, request, cwd, io.env);\n if (mended !== null) return answer(io, mended);\n // git asked where the work tree is and did not answer within its time\n // limit: before a write that is a write the hook could not check, said\n // as one (ADR-0002).\n if (error instanceof GitError && request.event === 'PreToolUse') return cannotCheck(io, error);\n throw error;\n }\n try {\n // The answer reads a decision by its verdict, which a mutant's text\n // put first on this list has none of: that mutant is equivalent.\n const decisions: Decision[] = [];\n // Whether the run after the write may answer from what this one keeps:\n // not where a decision refuses, nor where the write is to what the\n // answer is made from, in any work tree that decides it.\n let keeps = true;\n for (const part of await writesBy(workspace, request.cwd, request.paths, io)) {\n const decided = await decisionsFor(part.workspace, options, io, part.paths, cwd, session);\n if ('problem' in decided) {\n // Exit 2 blocks the tool call, and its stderr reaches the model. Where\n // the name stands on the hook's own line, what is wrong with it is\n // `doctor`'s to say as well, in the same words (usage.ts).\n io.stderr.write(`spec-harness: ${heldHookLine(decided.problem).wrong}. Fix the brief or the branch before writing.\\n`);\n return EXIT_ERROR;\n }\n // A line of the answer for each path, by the work tree that decided it.\n decisions.push(...decided.decisions);\n if (decided.decisions.some((decision) => decision.verdict === 'deny' || decidesAnswers(decision, decided.brief))) keeps = false;\n }\n const response = claudeResponse(request.event, decisions);\n io.stdout.write(response.stdout);\n // What the run after the write will say, kept for it where the call\n // goes ahead: a refused call has none. It changes nothing of the\n // answer, which is made before it is kept.\n if (request.event === 'PreToolUse' && record !== null && keeps) {\n await keepCall(workspace.commonDir, callFile(record), keptCall(record, warningsOf(decisions)));\n }\n return response.exitCode;\n } catch (error) {\n if (request.event !== 'PreToolUse') throw error;\n // The configuration of another work tree the write is decided in,\n // which does not load, lets a write to itself through as the\n // project's does.\n const mended = mending(error, request, cwd, io.env);\n if (mended !== null) return answer(io, mended);\n // A round is named and its briefs cannot be read: the guard cannot\n // tell a protected file from any other, so the write waits.\n return cannotCheck(io, error);\n }\n }\n if (kind === 'git') {\n // git starts its hook at the top of the work tree it commits in, a\n // linked worktree's own, whose install may be none: it is then checked\n // with the main work tree's (ADR-0005).\n const workspace = await openWorkspace(options, io, MAIN_INSTALL);\n const staged = await stagedChanges(workspace.root);\n const paths = staged.flatMap((change) => (change.from === undefined ? [change.path] : [change.from, change.path]));\n if (paths.length === 0) return EXIT_OK;\n const decided = await decisionsFor(workspace, options, io, paths, workspace.root);\n if ('problem' in decided) {\n io.stderr.write(`spec-harness: ${decided.problem}\\n`);\n return EXIT_ERROR;\n }\n const response = gitResponse(decided.decisions);\n io.stderr.write(response.text);\n return response.exitCode;\n }\n throw new UsageError('hook takes \"claude\" or \"git\"');\n}\n\n/* ------------------------------------------------------------------ doctor */\n\n/**\n * The base, and the allowed-signers file as it is on it: the file waits on\n * the base, and the two on nothing else doctor asks. A --base given nothing\n * is no base, said as the brief's is, in the report.\n */\nasync function baseAndSigners(\n { resolveBase }: Pick<typeof import('./round.js'), 'resolveBase'>,\n workspace: Workspace,\n flag: string | undefined,\n signersFile: string,\n): Promise<{ readonly base: Base; readonly signersText: string | null }> {\n // Nothing in doctor asks what kind a base is but whether it is resolved, so\n // the mutant that names this one otherwise is equivalent.\n const base: Base = flag !== undefined && isBlank(flag) ? { kind: 'unresolved', reason: emptyValue('--base', 'base', flag) } : await resolveBase(workspace, flag);\n // An unresolved base has no commit: git shows nothing for one, so asking\n // anyway reads as no file, and that mutant is equivalent.\n const signersText = base.kind === 'resolved' ? await show(base.sha, signersFile, workspace.root) : null;\n return { base, signersText };\n}\n\n/**\n * The release of spec-harness installed in a work tree, where the hook's\n * line, init's and the plugin's, names its script under the project's\n * `node_modules`; `null` where none is, or its manifest gives no version.\n */\nfunction harnessRelease(root: string): string | null {\n const version = declaredVersion(join(root, 'node_modules', '@descent-vtt', 'spec-harness', 'package.json'));\n return typeof version === 'string' ? version : null;\n}\n\n/**\n * How Claude Code is wired to the guard, and the release of the one on\n * `PATH`, which waits on the wiring: only a Claude Code that runs the guard\n * is asked its release, since one older than the hooks need lets every\n * write through unguarded. `null` where it was not asked. The wiring asks\n * it itself, since which writes a line is started for can turn on the\n * release as well (round.ts); the two are told apart here for the report,\n * which has a place of its own for the release.\n */\nasync function wiringAndRelease(\n { claudeCodeWiring }: Pick<typeof import('./round.js'), 'claudeCodeWiring'>,\n root: string,\n io: CliIO,\n): Promise<{ readonly wiring: Omit<ClaudeCodeWiring, 'release'>; readonly release: ClaudeCodeCheck | null }> {\n const { release, ...wiring } = await claudeCodeWiring(root, io);\n return { wiring, release };\n}\n\nasync function doctorCommand(options: Options, io: CliIO): Promise<number> {\n // What doctor alone runs of them, loaded before anything is asked: the\n // five things below are asked at once, and none waits on a module.\n const [configure, round, setup, signing] = await Promise.all([import('./configure.js'), import('./round.js'), import('./setup.js'), import('./signers.js')]);\n const { describeBase, describeClaudeCode, describeClaudeRelease, describeGitHook, describeHooksOff, describeInstalls, describePlugin, describePresence, describeSignerKeys, describeSignerProblem, describeSigners, guardSwitchedOff, guardWired, NO_SESSION_START, wiringState } = configure;\n const { diagnoseBrief, specBriefPlugin } = round;\n const { gitHook } = setup;\n const { notFido2, readAllowedSigners } = signing;\n // The siblings as git's hook finds them in this work tree: its own\n // install, and in a linked worktree with none the main work tree's.\n const workspace = await openWorkspace(options, io, MAIN_INSTALL);\n const rows = SIBLINGS.map((name) => {\n const sibling = workspace.siblings.locate(name);\n const row = { tool: name, state: sibling.kind, minimum: MINIMUM_VERSIONS[name] };\n if (sibling.kind === 'absent') return { ...row, version: null, elsewhere: null, detail: sibling.reason };\n const elsewhere = sibling.elsewhere ?? null;\n const whose = elsewhere === null ? '' : `, the install of ${elsewhere}: this work tree has none of its own`;\n if (sibling.kind === 'outdated') return { ...row, version: sibling.version, elsewhere, detail: `${sibling.reason}${whose}` };\n const command = sibling.command.join(' ');\n const detail = sibling.version === null ? `${command} (named in .spec-harness.json; its version is not checked)` : `${command} (${sibling.version}${whose})`;\n return { ...row, version: sibling.version, elsewhere, detail };\n });\n const signersFile = workspace.config.rulings.allowedSigners;\n // Five things that wait on the work tree and on nothing of one another,\n // each a process or a chain of them. Asked one after another, Claude\n // Code's release, the longest wait of a doctor on Windows, was asked for\n // only when every answer of git's before it was in. So they are asked at\n // once, and read below in the order they were asked in before: where more\n // than one fails, the first of that order is the one thrown, whichever\n // failed first by the clock (ADR-0002).\n const [briefAsked, baseAsked, pluginAsked, claudeAsked, hookAsked] = await Promise.allSettled([\n diagnoseBrief(workspace, options, io.env),\n baseAndSigners(round, workspace, options.base, signersFile),\n specBriefPlugin(workspace.root),\n wiringAndRelease(round, workspace.root, io),\n gitHook(workspace.root),\n ]);\n const named = answerOf(briefAsked);\n // A ruling counts only by a signature checked against the allowed signers\n // on the base, and only once spec-brief's archive asks the plugin about it.\n const { base, signersText } = answerOf(baseAsked);\n const onBase = base.kind === 'resolved' ? signersText !== null : null;\n const signers = describeSigners(signersFile, base.kind === 'resolved' ? base.ref : null, onBase === true);\n // Which keys sign, as notes: a key that is not FIDO2 can still be one the\n // agent cannot use, and a PIV key reads as a plain one (ADR-0006).\n const read = readAllowedSigners(signersText ?? '');\n const plain = notFido2(read.signers);\n const signerNotes = [describeSignerKeys(plain), ...read.problems.map(describeSignerProblem)].filter((note): note is string => note !== null);\n const plugin = answerOf(pluginAsked);\n // The plugin and init's entries both on: Claude Code runs every guard twice\n // and registers the server twice (ADR-0012).\n const { wiring, release } = answerOf(claudeAsked);\n const claude = wiringState(wiring);\n // What the hook does with each line the settings hold for it, where there\n // is something to say: more on it than init writes, a line that turns the\n // guard off or holds every write, one only a shell can read, the writes\n // Claude Code starts it for where they are not all of them, and what\n // onFailure changes.\n const lineNotes = wiring.lines.flatMap((line) => [line.detail, line.cover, line.note]).filter((note): note is string => note !== null);\n // What stands over every line: a plugin that is turned on and is not on\n // this machine, or cannot be told to be, and disableAllHooks, which\n // switches off whatever hooks there are.\n const switchedOff = guardSwitchedOff(wiring);\n // And whether the hook is started as a session starts, where settings hold\n // the guard: a note, failing nothing, and `sessionStart` in the document.\n const atStart = wiring.hooks.length > 0 && !wiring.sessionStart ? NO_SESSION_START : null;\n // And, in a linked worktree where something wires the guard, the release\n // the hook's line runs where it is not this work tree's own: a note. In\n // the main work tree both are read from one install, and are one.\n const main = mainWorkTree(workspace.commonDir);\n const installs = guardWired(wiring) && main !== null ? describeInstalls(main, harnessRelease(main), harnessRelease(workspace.root)) : null;\n const wiringNotes = [describePresence(wiring), wiring.hooksOff === null ? null : describeHooksOff(wiring.hooksOff, switchedOff), installs].filter((note): note is string => note !== null);\n // How the hook runs the harness is a note: one that goes through npx guards\n // as well as one that does not, and fails nothing, --strict or not.\n const { hook, note: hookNote } = answerOf(hookAsked);\n const branch = workspace.branch === null ? '(detached)' : `${workspace.branch}${workspace.branchSource === undefined ? '' : ` (detached; ${workspace.branchSource} names it)`}`;\n if (options.format === 'json') {\n io.stdout.write(\n json('doctor', {\n root: workspace.root,\n branch: workspace.branch,\n branchSource: workspace.branchSource ?? null,\n brief: named.id,\n briefProblem: named.problem,\n base: base.kind === 'resolved' ? { ref: base.ref, source: base.source, mergeBase: base.mergeBase } : { unresolved: base.reason },\n allowedSigners: {\n file: signersFile,\n onBase,\n detail: signers,\n notFido2: plain.map(({ line, principals, keyType }) => ({ line, principals, keyType })),\n problems: read.problems,\n },\n plugin: { state: plugin.kind, file: 'file' in plugin ? plugin.file : null, detail: describePlugin(plugin) },\n claudeCode: {\n state: claude,\n ...wiring,\n detail: describeClaudeCode(wiring),\n notes: wiringNotes,\n release:\n release === null\n ? { state: 'unchecked', version: null, minimum: CLAUDE_CODE_MINIMUM, detail: 'not asked: nothing wires Claude Code to the guard here' }\n : { state: release.state, version: 'version' in release ? release.version : null, minimum: CLAUDE_CODE_MINIMUM, detail: describeClaudeRelease(release) },\n },\n gitHook: { state: hook.state, file: 'file' in hook ? hook.file : null, detail: describeGitHook(hook), note: hookNote },\n siblings: rows,\n }),\n );\n } else {\n const more = (notes: readonly string[]): string[] => notes.map((note) => ` ${note}`);\n io.stdout.write(\n [\n `root ${workspace.root}`,\n `branch ${branch}`,\n `brief ${named.problem === null ? (named.id ?? '(none named)') : `none: ${named.problem}`}`,\n `base ${describeBase(base)}`,\n `signers ${signers}`,\n ...more(signerNotes),\n `plugin ${describePlugin(plugin)}`,\n `claude ${describeClaudeCode(wiring)}`,\n ...more(wiringNotes),\n ...more(lineNotes),\n ...more(release === null ? [] : [describeClaudeRelease(release)]),\n ...more(atStart === null ? [] : [atStart]),\n `git ${describeGitHook(hook)}`,\n ...more(hookNote === null ? [] : [hookNote]),\n '',\n '',\n ].join('\\n'),\n );\n for (const row of rows) io.stdout.write(`${row.state.padEnd(8)} ${row.tool.padEnd(10)} ${row.detail}\\n`);\n }\n // An outdated sibling is a problem to fix, where a missing optional one is\n // a choice; with none installed, the harness can check nothing. A double\n // install is a problem too, where no Claude Code wiring at all is a choice,\n // and so are a hook whose own line turns the guard off or holds every\n // write, a branch that names a brief no round can work under, which holds\n // every write as well (ADR-0004), guard hooks that disableAllHooks\n // switches off, a plugin that is turned on and is not on this machine\n // where no hook of init's stands in for it, a Claude Code too old to run\n // the hooks, and something at the path of git's pre-commit hook that git\n // cannot run and stops every commit at. A release that cannot be told is\n // not fine either, nor a line whose reading cannot be, nor a plugin that\n // cannot be told to be on this machine, nor a hook git runs that cannot be\n // read, which stops every commit as a script and runs as a program, nor a\n // place git runs its hooks from that git cannot name: --strict fails the\n // five.\n const outdated = rows.some((row) => row.state === 'outdated');\n const usable = rows.some((row) => row.state === 'found');\n const off = wiring.lines.some((line) => line.state === 'off' || line.state === 'held');\n const missing = wiring.presence?.state === 'absent' && wiring.hooks.length === 0;\n const tooOld = release?.state === 'outdated';\n const stopped = hook.state === 'stops';\n // Only an unreadable hook has `runs`, so the test of its state is the\n // compiler's, and its mutant is equivalent.\n const untold =\n options.strict &&\n (release?.state === 'unknown' || wiring.lines.some((line) => line.state === 'unknown') || wiring.presence?.state === 'unknown' || (hook.state === 'unreadable' && hook.runs) || hook.state === 'unknown');\n return outdated || !usable || claude === 'both' || off || named.branch || switchedOff || missing || tooOld || stopped || untold ? EXIT_FAILED : EXIT_OK;\n}\n\n/* ---------------------------------------------------------------- dispatch */\n\n/**\n * A map, because the command is the first word a person types and an object\n * answers to more names than it was given: `spec-harness constructor` ran\n * `Object` as a command and ended on a stack trace, where `spec-harness\n * construct` is an unknown command with exit 2.\n */\nconst COMMANDS: ReadonlyMap<string, (options: Options, io: CliIO) => Promise<number>> = new Map(\n // One for every command that has a shape (usage.ts), which the compiler\n // holds. A command of another module loads its module when it is the one\n // typed, and no other command's.\n Object.entries({\n guard: guardCommand,\n hook: hookCommand,\n context: async (options, io) => (await import('./commands.js')).contextCommand(options, io),\n audit: async (options, io) => (await import('./commands.js')).auditCommand(options, io),\n escalate: async (options, io) => (await import('./commands.js')).escalateCommand(options, io),\n rule: async (options, io) => (await import('./commands.js')).ruleCommand(options, io),\n rulings: async (options, io) => (await import('./commands.js')).rulingsCommand(options, io),\n probe: async (options, io) => (await import('./commands.js')).probeCommand(options, io),\n premises: async (options, io) => (await import('./premises.js')).premisesCommand(options, io),\n init: async (options, io) => (await import('./setup.js')).initCommand(options, io),\n mcp: async (options, io) => (await import('./server.js')).mcpCommand(options, io),\n doctor: doctorCommand,\n } satisfies Record<Command, (options: Options, io: CliIO) => Promise<number>>),\n);\n\nasync function dispatch(argv: readonly string[], io: CliIO): Promise<number> {\n let options: Options;\n try {\n options = parseOptions(argv);\n } catch (error) {\n // The parser throws nothing but its refusal of the line, which holds\n // whose line it was. Claude Code's hook says its own, and holds no\n // write for it.\n const refused = error as UnreadableLine;\n if (isClaudeHook(refused.words[0], refused.words[1])) return unreadLine(refused.message, io);\n io.stderr.write(`spec-harness: ${refused.message}\\n`);\n return EXIT_ERROR;\n }\n // Two values for an option that takes one: the parser kept the last, and\n // which was meant cannot be told from the line, so it is refused as a line\n // the parser cannot read is, and Claude Code's hook says it of its own.\n const twice = twoValues(options, io.cwd);\n if (twice !== null) {\n if (isClaudeHook(options.command, options.positionals[0])) return unreadLine(twice, io);\n io.stderr.write(`spec-harness: ${twice}; give it one\\n`);\n return EXIT_ERROR;\n }\n // A line that is wrong is refused before --help or --version answers: an\n // answer beside it said nothing of what was wrong, exit 0, as an option no\n // command has never was (spec-core ADR-0005).\n if (options.command !== undefined && !COMMANDS.has(options.command)) {\n io.stderr.write(`spec-harness: unknown command \"${options.command}\"; see spec-harness --help\\n`);\n return EXIT_ERROR;\n }\n // What parsed and names nothing, before anything is read or written for it.\n const refused = refusal(options, isDirectory);\n if (refused !== null) {\n io.stderr.write(`spec-harness: ${refused}\\n`);\n return EXIT_ERROR;\n }\n // Claude Code's hook is exempt from every refusal above, and said a root\n // that is not a directory only as it ran, which the help or the version\n // answered in place of: printed beside one, either is a line it cannot\n // read, said where there is a write it leaves unchecked (ADR-0005).\n const beside = isClaudeHook(options.command, options.positionals[0]) ? answerBeside(options, io.cwd, isDirectory) : null;\n if (beside !== null) return unreadLine(beside, io);\n if (options.version) {\n io.stdout.write(`${version()}\\n`);\n return EXIT_OK;\n }\n if (options.help || options.command === undefined) {\n io.stdout.write(HELP);\n return options.help ? EXIT_OK : EXIT_ERROR;\n }\n return COMMANDS.get(options.command)!(options, io);\n}\n\n/**\n * Runs the command line and resolves to the exit code, for an error nothing\n * below expected too.\n *\n * Such an error is neither a refusal nor a finding: the answer cannot be\n * trusted, which is exit 2 (spec-core ADR-0005). Rejected instead, it reached\n * the launcher as Node's uncaught error, exit 1, \"refused or found something\"\n * to a script, and to Claude Code a hook that failed without blocking: the\n * write the guard could not check went ahead. The stack is what makes a\n * report of it something to act on, and it goes to stderr alone: a script\n * that reads a document from stdout is handed no part of one.\n *\n * A write its reader had closed the pipe for is not such an error: the answer\n * was not delivered, which is still 2, and nothing in the harness is at\n * fault, so it is said in a line and no stack sends a person looking for a\n * defect. The process's own streams report it as an event, which the\n * launcher answers in the same words; here it is a caller's stream that\n * throws it. It is read by its code: stdout and stderr are the only pipes\n * the harness writes to.\n *\n * Nor is a module of the build that is not there. The launcher says a build\n * without its command line in a line, and a module a command asks for where\n * it runs is said in the same line: a build with a file missing is not a\n * defect a stack leads to. It is read by its code too: the harness imports\n * nothing but its own modules and Node's.\n */\nexport async function run(argv: readonly string[], io: CliIO): Promise<number> {\n try {\n return await dispatch(argv, io);\n } catch (error) {\n // A sibling's document of a shape the harness does not read is a sibling\n // that printed something it cannot read (answers.ts): exit 2. A git\n // command that failed is what git said, and no line of the harness's;\n // and a path under git's directory where the harness keeps its state,\n // which holds something else, is said in a line of its own (fs.ts).\n if (\n error instanceof UsageError ||\n error instanceof ConfigError ||\n error instanceof SiblingError ||\n error instanceof SiblingOutputError ||\n error instanceof GitError ||\n error instanceof StateError\n ) {\n io.stderr.write(`spec-harness: ${error.message}\\n`);\n return EXIT_ERROR;\n }\n if (!(error instanceof Error)) io.stderr.write(`spec-harness: unexpected error: ${String(error)}\\n`);\n else if ((error as NodeJS.ErrnoException).code === 'EPIPE') io.stderr.write('spec-harness: stdout was closed before all of the output was written\\n');\n else if ((error as NodeJS.ErrnoException).code === 'ERR_MODULE_NOT_FOUND') io.stderr.write('spec-harness: build output is missing; run \"npm run build\" first, or install the published package.\\n');\n else io.stderr.write(`spec-harness: unexpected error: ${error.stack ?? error.message}\\n`);\n return EXIT_ERROR;\n }\n}\n\n// What bin/spec-harness.js runs; the suite spawns the built one, from dist/,\n// outside the sweep (tests/integration/cli.test.ts), so it survives untested\n// in-process.\nexport async function main(argv: readonly string[] = process.argv.slice(2)): Promise<number> {\n return run(argv, { stdout: process.stdout, stderr: process.stderr, cwd: process.cwd(), env: process.env });\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,kBAAkB,EAAoB,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrJ,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGzG,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAwD,MAAM,YAAY,CAAC;AAGjU,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAgC,MAAM,YAAY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AAC,wEAAwE,CAAC,CAAC;aACjJ,IAAK,KAA+B,CAAC,IAAI,KAAK,sBAAsB;YAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,uGAAuG,CAAC,CAAC;;YAC/L,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;QAC1F,OAAO,UAAU,CAAC;IACpB,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,6EAA6E;AAC7E,cAAc;AACd,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAI,GAAsB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACxE,OAAO,GAAG,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAC7G,CAAC","sourcesContent":["/**\n * The command line: arguments, dispatch, output and exit codes.\n *\n * Exit 0: done, nothing refused. Exit 1: something refused or found. Exit 2:\n * the answer cannot be trusted - a bad flag, an option, an argument or a\n * value that names nothing, a configuration that does not load, a sibling\n * that is missing or printed something unreadable, a git command that\n * failed, an output its reader closed, an error nothing here expected. A run\n * that could not look must never exit as though it looked and found nothing\n * (spec-core ADR-0005).\n *\n * A command loads what it runs. This module imports what every run needs,\n * the hook's before a write among them, and a module that only some\n * commands run is imported where one of them is the command: the hook\n * runs before and after every write an agent makes, and what it loaded of\n * the other commands was a wait before each (ADR-0002). A module that\n * cannot be loaded is thrown where it was asked for, and ends the run in a\n * line and exit 2, as every error does.\n */\n\nimport { SiblingOutputError, type ActiveBrief } from './briefs.js';\nimport { CONFIG_FILE, ConfigError, SIBLINGS, SPEC_BRIEF_CONFIGS } from './config.js';\nimport type { ClaudeCodeWiring } from './configure.js';\nimport { dirname, join } from 'node:path';\n\nimport { gitDirectories, isDirectory, keepCall, loadConfig, mainWorkTree, outsideEvery, reachedBy, StateError, takeCall, writesOnly } from './fs.js';\nimport { changedPaths, GitError, holdsPath, isShallow, show, stagedChanges, withBudget } from './git.js';\nimport type { DocumentReader } from './document.js';\nimport type { Decision } from './guard.js';\nimport { afterResponse, callFile, callRecord, claudeResponse, gitResponse, HOOK_BUDGET_MS, keptCall, mendResponse, NONE, parseClaudeHook, SESSION_START, sessionOf, sessionResponse, TURN_END, turnResponse, warningResponse, warningsKept, warningsOf, type CallRecord, type HookRequest, type HookResponse } from './hooks.js';\nimport type { Base } from './round.js';\nimport type { BriefRow } from './types.js';\nimport { declaredVersion, SiblingError } from './siblings.js';\nimport { answerBeside, emptyValue, heldHookLine, isBlank, isClaudeHook, readHookLine, refusal, twoValues, unreadHookLine, type Command, type LineFault } from './usage.js';\nimport { CLAUDE_CODE_MINIMUM, MINIMUM_VERSIONS, type ClaudeCodeCheck } from './versions.js';\nimport {\n activeBrief,\n answerOf,\n describeActive,\n EXIT_ERROR,\n EXIT_FAILED,\n EXIT_OK,\n json,\n MAIN_INSTALL,\n mayBeElsewhere,\n openFound,\n openWorkspace,\n otherTree,\n parseOptions,\n UsageError,\n version,\n type CliIO,\n type Options,\n type UnreadableLine,\n type Workspace,\n writesBy,\n} from './workspace.js';\n\nexport { EXIT_ERROR, EXIT_FAILED, EXIT_OK, UsageError, version, type CliIO } from './workspace.js';\n\nexport const HELP = `spec-harness - context, guards, audits and rulings for rounds of agent work\n\nUsage:\n spec-harness <command> [options]\n\nCommands:\n context [brief] What an agent needs to start a round: the brief, its scope,\n rulings, dependencies, the rules in force, the cited documents.\n guard <path...> May the round write these paths? Exit 1 if one is refused.\n hook claude Answer a Claude Code PreToolUse, PostToolUse, SessionStart or Stop\n hook (stdin). At session start it says what would hold every\n write; at a turn's end, with \"turnReport\" on, what the work tree\n holds that the brief protects or that is outside its scope.\n hook git Answer git's pre-commit hook for the staged files.\n escalate Ask a person to rule: --path <file> (repeatable) --reason <why>\n [--option \"<label>: <cost>\"]... [--recommend <text>].\n --list shows what waits; --show <id> prints one memo. Neither\n raises a request: beside one, only --root and --format are read.\n rule <id> Record a person's ruling in the brief: --allow or --deny, with\n --note <text>. It counts once committed signed.\n rulings [brief] The brief's rulings, and whether each one's signature verifies.\n audit [brief] Did the round stay inside the lines: what the archive would say,\n the brief's assertions, unverified rulings, new dependencies\n and the install scripts it allowed.\n probe [brief] Run the brief's probes: red at the base, green at the head.\n --at <base|head|both>, --id <probe>.\n premises Do the live briefs' premises still hold? For CI: exit 1 when one\n is stale, or, with --strict, when spec-guard cannot read one.\n init Configure the spec-* tools to agree. Prints the plan; --write\n applies it; --git-hook adds a pre-commit hook; --block-on-failure\n has Claude Code 2.1.295 or later hold a write when the hook cannot\n start or runs past its timeout.\n mcp Serve start_round, check_path, request_escalation, audit_round,\n list_rounds and the workflow prompts over MCP on stdio.\n doctor Which siblings are installed, at which versions, which brief is\n named, how Claude Code runs the guard, and git's hook. Exit 1\n when a sibling is older than this release needs, the guard is\n installed twice, its hook's line turns it off or holds every\n write or runs a script that is not there, the branch names a\n brief spec-brief does not list, cannot be asked about, or has\n archived, but for the branch git says archived it, a round's\n last commit, which waits to merge (CI fetches the base with its\n history for git to say), disableAllHooks or an array for a\n matcher switches it off, the plugin that is turned on is not on\n this machine and nothing else guards, Claude Code is too old to\n run its hooks, or git stops every commit at what stands for its\n hook.\n\nOptions:\n --brief <id> The brief the round works on. Otherwise SPEC_BRIEF, then the branch.\n For context, guard, hook, escalate, rulings, audit, probe, premises\n and doctor.\n --base <ref> What the round is measured from. Otherwise \"base\" in\n .spec-harness.json, then the remote's default branch. For context,\n guard, hook, rulings, audit, probe and doctor.\n --root <dir> Run from another directory, which must exist. For every command.\n --format <fmt> pretty or json; audit and premises also gitlab, sarif or github.\n For every command but hook and mcp.\n --strict Warnings fail the run. For guard, audit, premises and doctor.\n --block-on-failure onFailure \"block\" on init's entries but the one as a turn ends. For init.\n --help, --version One of the two: both on one line are refused.\n\nAn option a command does not read, an argument it does not take, an option or an\nargument given an empty value, a brief given both as the argument and as --brief,\nand an option that takes one value given two that name two things are refused, exit 2,\nnot read as if they were not there, and so with --help or --version on the line. The\nsame value twice, as --root . --root ./, is read once, and on Windows a drive letter in\neither case. doctor says an empty --brief or --base in its report. hook claude reads its\nline as every release has, and says a line it cannot read, two values for one option or\n--help beside a --root that is not a directory among them, a --root that is not a\ndirectory, and a question it cannot read, as a warning to the person with exit 0: it\nrefuses nothing for any of them.\n\nExit codes: 0 clean, 1 refused or found something, 2 the answer cannot be trusted.\n`;\n\n\n/* ------------------------------------------------------------------- guard */\n\n/**\n * The reader of a brief's rulings, loaded where a ruling is read: a write\n * to a file no brief protects reads none.\n */\nconst reader = async (): Promise<DocumentReader> => (await import('./reader.js')).createReader();\n\n/**\n * The work tree with spec-brief's answers kept for a session of Claude\n * Code's, and given again to it where all they were read from reads the\n * same (ADR-0002); as it is where no session is named.\n */\nfunction keptFor(workspace: Workspace, session: string | null): Workspace {\n return session === null ? workspace : { ...workspace, siblings: workspace.siblings.keeping(workspace.commonDir, session) };\n}\n\n/**\n * Whether the brief the branch names is one spec-brief has archived: a\n * closed round's branch, whose every write is held as under any name that is\n * no brief's, and in words of its own, since nothing on it is to be mended:\n * its round ends when the branch merges (ADR-0004).\n */\nfunction closesRound(active: ActiveBrief): boolean {\n return active.kind === 'archived' && active.source === 'branch';\n}\n\n/** What the hook says after what holds the write: how to mend it, or that a closed round's branch has nothing to mend. */\nconst MEND = 'Fix the brief or the branch before writing.';\nconst CLOSED = 'The round is archived and ends when this branch merges: write on the branch of a live brief.';\n\nasync function decisionsFor(\n workspace: Workspace,\n options: Options,\n io: CliIO,\n given: readonly string[],\n cwd: string,\n session: string | null = null,\n): Promise<{ readonly decisions: Decision[]; readonly brief: BriefRow | null } | { readonly problem: string; readonly closed: boolean }> {\n // A path outside every work tree of the repository is decided as one\n // outside it, whichever brief is named and whatever is wrong with the\n // name: the problem held every write, a file outside the repository\n // among them, where no brief decides one (ADR-0005). So no brief is asked\n // about for such a write, and spec-brief is not run for it.\n const outside = outsideEvery(given, workspace.root, workspace.commonDir, cwd);\n const active = outside ? null : await activeBrief(keptFor(workspace, session), options, io.env);\n const { brief, note, problem } = active === null ? { brief: null, note: undefined, problem: null } : describeActive(active);\n // A problem is said only of a brief something names, so `active` is one.\n if (problem !== null) return { problem, closed: closesRound(active!) };\n const { checkPaths } = await import('./round.js');\n return { decisions: await checkPaths(workspace, brief, note, given, cwd, reader, options.base), brief };\n}\n\n/**\n * Whether a decision is of a file the answer after the write is made from:\n * the configuration, spec-brief's, the brief, or a file beside it in the\n * briefs' directory, which spec-brief reads too. A call that writes one is\n * decided again after the write, so that what the write changed is read\n * (ADR-0002).\n */\nfunction decidesAnswers(decision: Decision, brief: BriefRow | null): boolean {\n if (decision.path === CONFIG_FILE || SPEC_BRIEF_CONFIGS.includes(decision.path)) return true;\n if (brief === null) return false;\n return decision.path === brief.file || decision.path.startsWith(`${dirname(brief.file)}/`);\n}\n\nconst SYMBOL: Record<Decision['verdict'], string> = { allow: 'ok ', warn: 'warning', ask: 'ask ', deny: 'refused' };\n\nasync function guardCommand(options: Options, io: CliIO): Promise<number> {\n if (options.positionals.length === 0) throw new UsageError('guard needs at least one path');\n const workspace = await openWorkspace(options, io);\n const decided = await decisionsFor(workspace, options, io, options.positionals, io.cwd);\n if ('problem' in decided) {\n io.stderr.write(`spec-harness: ${decided.problem}\\n`);\n return EXIT_ERROR;\n }\n const { decisions } = decided;\n if (options.format === 'json') {\n io.stdout.write(json('guard', { decisions }));\n } else {\n for (const decision of decisions) {\n io.stdout.write(`${SYMBOL[decision.verdict]} ${decision.message}\\n`);\n if (decision.verdict !== 'allow') io.stdout.write(` ${decision.hint}\\n`);\n }\n }\n const refused = decisions.some((d) => d.verdict === 'deny' || d.verdict === 'ask');\n const warned = decisions.some((d) => d.verdict === 'warn');\n return refused || (options.strict && warned) ? EXIT_FAILED : EXIT_OK;\n}\n\n/* -------------------------------------------------------------------- hook */\n\nasync function readStdin(io: CliIO): Promise<string> {\n // Only the built command line reads process.stdin, and the suite spawns it\n // from dist/, outside the sweep (tests/integration/claude-code.test.ts): the\n // lines below survive it untested in-process.\n if (io.stdin !== undefined) return io.stdin();\n const chunks: Buffer[] = [];\n for await (const chunk of process.stdin) chunks.push(chunk as Buffer);\n return Buffer.concat(chunks).toString('utf8');\n}\n\n/**\n * The write Claude Code asks the hook about, or the session that starts, or\n * the exit code that answers already, 0: for a question that cannot be read,\n * said to the person, and for a tool that writes no file. Asked before\n * anything on the hook's own line is, so that a line that is wrong is said\n * where there is a write it leaves unchecked, or a session whose every write\n * it leaves so.\n */\nasync function writeAsked(io: CliIO): Promise<HookRequest | number> {\n let question: string;\n try {\n question = await readStdin(io);\n } catch (error) {\n // A question that could not be read is one the hook cannot see, as one\n // it cannot parse is, below: it has no event to hold a write by.\n return answer(io, warningResponse(`the hook input could not be read: ${(error as Error).message}, so nothing it asks about is checked`));\n }\n const request = parseClaudeHook(question);\n // A hook that cannot read its question refuses nothing it cannot see, and\n // says so where the person reads it.\n if ('error' in request) return answer(io, warningResponse(`${request.error}, so nothing it asks about is checked`));\n return request.paths.length === 0 && request.event !== SESSION_START && request.event !== TURN_END ? EXIT_OK : request;\n}\n\n/**\n * What is wrong with the hook's own line, said and nothing refused for it:\n * one line, shown to the person, and exit 0, where exit 2 would hold every\n * write of the session, the one that mends the line among them. Exit 1 said\n * it as well, and is what Claude Code counts as a hook that failed, which\n * `onFailure: \"block\"` holds the write for (ADR-0005).\n */\nfunction guardOff(io: CliIO, { wrong, mend }: LineFault, event: string): number {\n if (event === SESSION_START) return answer(io, sessionResponse(`${wrong}, so the guard is off and no write of this session is checked; ${mend}`));\n if (event === TURN_END) return answer(io, turnResponse(`spec-harness: ${wrong}, so the guard is off and no write of this session is checked; ${mend}`));\n return answer(io, warningResponse(`${wrong}, so the guard is off and this write is not checked; ${mend}`));\n}\n\nfunction answer(io: CliIO, response: { readonly stdout: string; readonly exitCode: number }): number {\n io.stdout.write(response.stdout);\n return response.exitCode;\n}\n\n/**\n * The answer to a write a configuration that does not load holds no more,\n * or `null` for every other write, which is held as before (ADR-0005). Every\n * write was held. A write outside every work tree of the repository is\n * decided as such a write is, after the write as before it: nothing of the\n * repository's decides it. And before a write to the configuration file\n * itself, and to nothing else, the line says why every other write is held,\n * so that a session can mend a typo in it. `cwd` is what a relative path\n * is read from.\n */\nfunction mending(error: unknown, request: HookRequest, cwd: string, env: CliIO['env']): HookResponse | null {\n // Every configuration the hook loads is read from a file, so `file` is\n // never `null` here, and the test of it is the compiler's: its mutant is\n // equivalent.\n if (!(error instanceof ConfigError) || error.file === null) return null;\n // The work trees are named by the files git keeps, where git would name\n // the same ones; a repository whose configuration or environment moves a\n // work tree elsewhere is not known to leave the path outside. The file\n // was loaded from the top git named, where a `.git` stands, so the files\n // name a work tree, and the test of `null` is the compiler's.\n const found = gitDirectories(dirname(error.file), env);\n if (found !== null && found.exact && outsideEvery(request.paths, found.top, found.common, cwd)) return NONE;\n if (request.event !== 'PreToolUse' || !writesOnly(request.paths, error.file, cwd)) return null;\n return mendResponse(`${error.message}, so every other write is held until it loads; this write, to ${error.file} itself, is not checked`);\n}\n\n/**\n * What would hold every write of the session that starts, said once as it\n * starts and no write waits on it (ADR-0005): a configuration that does not\n * load, a brief named that spec-brief does not list or has archived, and\n * spec-brief itself, where a brief is named, missing, too old or unable to\n * list the briefs. Each in the words a write would be held with, and\n * `doctor` says, and with what mends it. `null` where nothing does. The\n * check never ends the session's start: whatever it meets is said.\n */\nasync function sessionProblem(options: Options, io: CliIO, root: string, cwd: string | null, session: string | null): Promise<string | null> {\n const held = 'so every write of this session is held until it is mended';\n try {\n const named = await openWorkspace({ ...options, root }, io);\n // A session in another work tree of the project has its writes decided\n // there, and so is the check (ADR-0005).\n const found = cwd === null ? null : await otherTree(named, cwd);\n const workspace = found === null ? named : await openFound(found, io, () => [named.root]);\n const active = await activeBrief(keptFor(workspace, session), options, io.env);\n const { problem } = describeActive(active);\n if (problem === null) return null;\n if (closesRound(active)) return `${heldHookLine(problem).wrong}, so every write of this session is held: the round is archived and ends when this branch merges, so write on the branch of a live brief; spec-harness doctor says more`;\n return `${heldHookLine(problem).wrong}, ${held}: fix the brief or the branch before writing; spec-harness doctor says more`;\n } catch (error) {\n // A session in no work tree has nothing to guard, as a write there has\n // not. Anything else that stops the check stops a write's as well, which\n // is then held as one the hook cannot check: a configuration that does\n // not load, a spec-brief that is missing, too old or cannot list the\n // briefs, and whatever a defect throws.\n if (error instanceof UsageError) return null;\n // But a write to the configuration file itself, which mends it, where\n // the file is one a write may reach under its name alone (ADR-0005). The\n // configuration is read from a file here as before a write, so the test\n // of `file` is the compiler's, and its mutant is equivalent.\n const mendable = error instanceof ConfigError && error.file !== null && writesOnly([error.file], error.file, root);\n return `${(error as Error).message}, ${held}${mendable ? `, but for a write to ${error.file} itself, which is not checked` : ''}; spec-harness doctor says more`;\n }\n}\n\n/** The most paths a report names one by one: past it, how many more there are. */\nconst REPORTED = 20;\n\n/**\n * What the work tree holds at the end of a turn that the brief protects or\n * that is outside its scope, one line a path in the words a write of it is\n * given; or `null` where there is nothing to say: `turnReport` is off, no\n * brief is named, nothing changed is either, or the session is in no work\n * tree (ADR-0005). The work tree is the one a write of the session is\n * decided in. One start of git reads what changed, and nothing is asked of\n * the base, so no ruling is read: a protected file a signed ruling allows\n * is said as protected, and the audit reads the ruling. A configuration\n * that does not load is said by every write and as the session starts, and\n * here holds the report back without a word.\n */\nasync function turnReport(options: Options, io: CliIO, root: string, cwd: string | null): Promise<string | null> {\n try {\n const named = await openWorkspace({ ...options, root }, io);\n const found = cwd === null ? null : await otherTree(named, cwd);\n const workspace = found === null ? named : await openFound(found, io, () => [named.root]);\n if (!workspace.config.turnReport) return null;\n const active = await activeBrief(workspace, options, io.env);\n const { brief, problem } = describeActive(active);\n if (problem !== null) {\n const ends = closesRound(active) ? ': the round is archived and ends when this branch merges' : '';\n return `spec-harness: ${heldHookLine(problem).wrong}, so what the work tree holds is not reported, and every write is held but one to a file outside every work tree of the repository${ends}; spec-harness doctor says more`;\n }\n if (brief === null) return null;\n const [changed, { decide }] = await Promise.all([changedPaths(workspace.root), import('./guard.js')]);\n const outOfScope = workspace.config.outOfScope;\n const said = changed.map((path) => decide({ path, given: path, brief, rulings: [], outOfScope })).filter((decision) => decision.verdict !== 'allow');\n if (said.length === 0) return null;\n const lines = said.slice(0, REPORTED).map((decision) => `- ${decision.message}. Next: ${decision.hint}.`);\n const more = said.length > REPORTED ? [`- and ${said.length - REPORTED} more: spec-harness guard <path> says each`] : [];\n const paths = said.length === 1 ? `a path that brief ${brief.id} protects or that is outside its scope` : `${said.length} paths that brief ${brief.id} protects or that are outside its scope`;\n return [`spec-harness: as this turn ended, the work tree held changes to ${paths}:`, ...lines, ...more].join('\\n');\n } catch (error) {\n if (error instanceof UsageError || error instanceof ConfigError) return null;\n return `spec-harness: ${(error as Error).message}, so what the work tree holds is not reported`;\n }\n}\n\n/**\n * Claude Code's hook on a line the parser refused: an option no command has,\n * an option left without its value, a --format or an --at that is none. It\n * was exit 2 before the question was read, for the line a settings file\n * holds as for one typed at a terminal. What is said of it is `doctor`'s\n * to say as well, of a line it finds in a settings file (usage.ts).\n */\nasync function unreadLine(said: string, io: CliIO): Promise<number> {\n const request = await writeAsked(io);\n if (typeof request === 'number') return request;\n return guardOff(io, unreadHookLine(said).fault, request.event);\n}\n\n/**\n * The answer after a write, where it can be given with no process started,\n * or `null` where it is to be decided as before (ADR-0002, ADR-0003).\n *\n * The git directory is the one the files at the hook's root name. What the\n * run before the write kept for this call, if anything, is taken away as it\n * is read, and answered from where it is this call's: the same release,\n * session, call, tool, paths, directories, line and variables. And where\n * nothing is kept, a run after a write says nothing but a warning outside\n * the scope, which only `outOfScope: \"warn\"` decides: under `ask` or\n * `deny` there is nothing to say, where the configuration read is the one\n * git would have the hook read, of the work tree the session is in.\n */\nasync function answeredAfter(root: string, record: CallRecord | null, cwd: string | null, paths: readonly string[], io: CliIO): Promise<HookResponse | null> {\n const found = gitDirectories(root, io.env);\n if (found === null) return null;\n if (record !== null) {\n const kept = await takeCall(found.common, callFile(record));\n // warningsKept reads no text as no record as well: the test is there for\n // the type, and its mutant is equivalent.\n const warnings = kept === null ? null : warningsKept(kept, record);\n if (warnings !== null) return afterResponse(warnings);\n }\n // A path in another work tree than the one this configuration is read\n // from may be decided by another's, which may warn, and so may the file a\n // link has a path written to.\n if (!found.exact || (cwd !== null && mayBeElsewhere(cwd, found.top)) || paths.some((path) => reachedBy(path, cwd ?? io.cwd).some((spelled) => mayBeElsewhere(spelled, found.top)))) return null;\n try {\n return (await loadConfig(found.top)).config.outOfScope === 'warn' ? null : afterResponse([]);\n } catch {\n // A configuration that does not load is said as it was, by the run.\n return null;\n }\n}\n\n/**\n * The answer before a write the hook could not check: one line, and exit 2,\n * which holds the write. Claude Code shows the line to Claude as the\n * reason.\n */\nfunction cannotCheck(io: CliIO, error: unknown): number {\n io.stderr.write(`spec-harness: cannot check this write: ${(error as Error).message}\\n`);\n return EXIT_ERROR;\n}\n\n/**\n * `hook claude` within one budget for every process it starts, below the\n * timeout Claude Code gives its entry, so that a run of slow processes ends\n * with its own answer and not the cancelling of it (ADR-0002); `hook git`\n * as it was, which no entry of Claude Code's runs.\n */\nfunction hookCommand(options: Options, io: CliIO): Promise<number> {\n return options.positionals[0] === 'claude' ? withBudget(HOOK_BUDGET_MS, () => answerHook(options, io)) : answerHook(options, io);\n}\n\nasync function answerHook(options: Options, io: CliIO): Promise<number> {\n const kind = options.positionals[0];\n if (kind === 'claude') {\n const request = await writeAsked(io);\n if (typeof request === 'number') return request;\n // The root the line gives, or what is wrong with it: read as `doctor`\n // reads the line where it finds it in a settings file (usage.ts).\n const line = readHookLine(options.root, io.cwd, isDirectory);\n if (line.state === 'off') return guardOff(io, line.fault, request.event);\n const cwd = request.cwd ?? io.cwd;\n const root = line.root ?? io.env['CLAUDE_PROJECT_DIR'] ?? cwd;\n const session = sessionOf(request);\n if (request.event === SESSION_START) return answer(io, sessionResponse(await sessionProblem(options, io, root, request.cwd, session)));\n if (request.event === TURN_END) return answer(io, turnResponse(await turnReport(options, io, root, request.cwd)));\n const record = callRecord(request, { root: line.root, brief: options.brief, base: options.base }, io.cwd, io.env, version());\n if (request.event === 'PostToolUse') {\n const answered = await answeredAfter(root, record, request.cwd, request.paths, io);\n if (answered !== null) {\n io.stdout.write(answered.stdout);\n return answered.exitCode;\n }\n }\n let workspace: Workspace;\n try {\n workspace = await openWorkspace({ ...options, root }, io);\n } catch (error) {\n if (error instanceof UsageError) return EXIT_OK;\n const mended = mending(error, request, cwd, io.env);\n if (mended !== null) return answer(io, mended);\n // git asked where the work tree is and did not answer within its time\n // limit: before a write that is a write the hook could not check, said\n // as one (ADR-0002).\n if (error instanceof GitError && request.event === 'PreToolUse') return cannotCheck(io, error);\n throw error;\n }\n try {\n // The answer reads a decision by its verdict, which a mutant's text\n // put first on this list has none of: that mutant is equivalent.\n const decisions: Decision[] = [];\n // Whether the run after the write may answer from what this one keeps:\n // not where a decision refuses, nor where the write is to what the\n // answer is made from, in any work tree that decides it.\n let keeps = true;\n for (const part of await writesBy(workspace, request.cwd, request.paths, io)) {\n const decided = await decisionsFor(part.workspace, options, io, part.paths, cwd, session);\n if ('problem' in decided) {\n // Exit 2 blocks the tool call, and its stderr reaches the model. Where\n // the name stands on the hook's own line, what is wrong with it is\n // `doctor`'s to say as well, in the same words (usage.ts).\n io.stderr.write(`spec-harness: ${heldHookLine(decided.problem).wrong}. ${decided.closed ? CLOSED : MEND}\\n`);\n return EXIT_ERROR;\n }\n // A line of the answer for each path, by the work tree that decided it.\n decisions.push(...decided.decisions);\n if (decided.decisions.some((decision) => decision.verdict === 'deny' || decidesAnswers(decision, decided.brief))) keeps = false;\n }\n const response = claudeResponse(request.event, decisions);\n io.stdout.write(response.stdout);\n // What the run after the write will say, kept for it where the call\n // goes ahead: a refused call has none. It changes nothing of the\n // answer, which is made before it is kept.\n if (request.event === 'PreToolUse' && record !== null && keeps) {\n await keepCall(workspace.commonDir, callFile(record), keptCall(record, warningsOf(decisions)));\n }\n return response.exitCode;\n } catch (error) {\n if (request.event !== 'PreToolUse') throw error;\n // The configuration of another work tree the write is decided in,\n // which does not load, lets a write to itself through as the\n // project's does.\n const mended = mending(error, request, cwd, io.env);\n if (mended !== null) return answer(io, mended);\n // A round is named and its briefs cannot be read: the guard cannot\n // tell a protected file from any other, so the write waits.\n return cannotCheck(io, error);\n }\n }\n if (kind === 'git') {\n // git starts its hook at the top of the work tree it commits in, a\n // linked worktree's own, whose install may be none: it is then checked\n // with the main work tree's (ADR-0005).\n const workspace = await openWorkspace(options, io, MAIN_INSTALL);\n const staged = await stagedChanges(workspace.root);\n const paths = staged.flatMap((change) => (change.from === undefined ? [change.path] : [change.from, change.path]));\n if (paths.length === 0) return EXIT_OK;\n const decided = await decisionsFor(workspace, options, io, paths, workspace.root);\n if ('problem' in decided) {\n io.stderr.write(`spec-harness: ${decided.problem}\\n`);\n return EXIT_ERROR;\n }\n const response = gitResponse(decided.decisions);\n io.stderr.write(response.text);\n return response.exitCode;\n }\n throw new UsageError('hook takes \"claude\" or \"git\"');\n}\n\n/* ------------------------------------------------------------------ doctor */\n\n/**\n * The base, and the allowed-signers file as it is on it: the file waits on\n * the base, and the two on nothing else doctor asks. A --base given nothing\n * is no base, said as the brief's is, in the report.\n */\nasync function baseAndSigners(\n { resolveBase }: Pick<typeof import('./round.js'), 'resolveBase'>,\n workspace: Workspace,\n flag: string | undefined,\n signersFile: string,\n): Promise<{ readonly base: Base; readonly signersText: string | null }> {\n // Nothing in doctor asks what kind a base is but whether it is resolved, so\n // the mutant that names this one otherwise is equivalent.\n const base: Base = flag !== undefined && isBlank(flag) ? { kind: 'unresolved', reason: emptyValue('--base', 'base', flag) } : await resolveBase(workspace, flag);\n // An unresolved base has no commit: git shows nothing for one, so asking\n // anyway reads as no file, and that mutant is equivalent.\n const signersText = base.kind === 'resolved' ? await show(base.sha, signersFile, workspace.root) : null;\n return { base, signersText };\n}\n\n/**\n * What a branch that names a brief spec-brief has archived is, as git tells\n * it: the branch that archived the brief, whose round waits to merge, where\n * the brief's archived file is in HEAD and not at the merge base of the base\n * and HEAD; a branch whose brief was archived before it, where the file is\n * at the merge base already; and cannot tell wherever git does not say,\n * which fails doctor as such a branch did (ADR-0004).\n */\ntype ClosedRound =\n | { readonly state: 'waiting-to-merge' | 'archived-before'; readonly brief: BriefRow; readonly ref: string; readonly mergeBase: string }\n | { readonly state: 'unknown'; readonly brief: BriefRow; readonly reason: string };\n\nasync function closedRound(workspace: Workspace, base: Base, brief: BriefRow): Promise<ClosedRound> {\n if (base.kind === 'unresolved') {\n return { state: 'unknown', brief, reason: `the base cannot be resolved (${base.reason}): fetch it under that name, with its history, as git fetch origin main:main fetches main` };\n }\n const [shallow, atBase, atHead] = await Promise.all([isShallow(workspace.root), holdsPath(base.mergeBase, brief.file, workspace.root), holdsPath(base.head, brief.file, workspace.root)]);\n // A merge base read in a history cut short can be older than the one the\n // whole history has, and a file absent from it present at the true one.\n if (shallow !== false) {\n return { state: 'unknown', brief, reason: 'the history is shallow, or git cannot say that it is not, and a merge base found in it may be older than the one the whole history has: fetch the whole history' };\n }\n if (atBase === null || atHead === null) return { state: 'unknown', brief, reason: `git could not list ${brief.file} at the merge base with ${base.ref}, or at HEAD` };\n if (atBase) return { state: 'archived-before', brief, ref: base.ref, mergeBase: base.mergeBase };\n // Absent from HEAD as well, the archive is not committed, or the file is\n // not the one git names: neither is the archive this branch committed.\n if (!atHead) return { state: 'unknown', brief, reason: `${brief.file} is not committed at HEAD; commit the archive` };\n return { state: 'waiting-to-merge', brief, ref: base.ref, mergeBase: base.mergeBase };\n}\n\n/** The note on doctor's `brief` line for a branch that names a brief spec-brief has archived. */\nfunction describeClosedRound(closed: ClosedRound): string {\n const { id, file } = closed.brief;\n switch (closed.state) {\n case 'waiting-to-merge':\n return `brief ${id} was archived on this branch, which waits to merge: ${file} is in HEAD and not at the merge base with ${closed.ref}, ${closed.mergeBase.slice(0, 12)}, so this fails nothing; the hook holds every write on the branch all the same`;\n case 'archived-before':\n return `brief ${id} was archived before this branch: ${file} is at the merge base with ${closed.ref}, ${closed.mergeBase.slice(0, 12)}, so the branch is a closed round's, used again, and every write on it is held`;\n case 'unknown':\n return `whether brief ${id} was archived on this branch, which waits to merge, cannot be told: ${closed.reason}`;\n }\n}\n\n/**\n * The release of spec-harness installed in a work tree, where the hook's\n * line, init's and the plugin's, names its script under the project's\n * `node_modules`; `null` where none is, or its manifest gives no version.\n */\nfunction harnessRelease(root: string): string | null {\n const version = declaredVersion(join(root, 'node_modules', '@descent-vtt', 'spec-harness', 'package.json'));\n return typeof version === 'string' ? version : null;\n}\n\n/**\n * How Claude Code is wired to the guard, and the release of the one on\n * `PATH`, which waits on the wiring: only a Claude Code that runs the guard\n * is asked its release, since one older than the hooks need lets every\n * write through unguarded. `null` where it was not asked. The wiring asks\n * it itself, since which writes a line is started for can turn on the\n * release as well (round.ts); the two are told apart here for the report,\n * which has a place of its own for the release. The script each line runs\n * is looked for in `places`, where `${CLAUDE_PROJECT_DIR}` can point.\n */\nasync function wiringAndRelease(\n { claudeCodeWiring }: Pick<typeof import('./round.js'), 'claudeCodeWiring'>,\n root: string,\n io: CliIO,\n places: readonly string[],\n): Promise<{ readonly wiring: Omit<ClaudeCodeWiring, 'release'>; readonly release: ClaudeCodeCheck | null }> {\n const { release, ...wiring } = await claudeCodeWiring(root, io, undefined, true, places);\n return { wiring, release };\n}\n\nasync function doctorCommand(options: Options, io: CliIO): Promise<number> {\n // What doctor alone runs of them, loaded before anything is asked: the\n // five things below are asked at once, and none waits on a module.\n const [configure, round, setup, signing] = await Promise.all([import('./configure.js'), import('./round.js'), import('./setup.js'), import('./signers.js')]);\n const { describeBase, describeClaudeCode, describeClaudeRelease, describeGitHook, describeHooksOff, describeInstalls, describePlugin, describePresence, describeSignerKeys, describeSignerProblem, describeSigners, guardSwitchedOff, guardWired, NO_SESSION_START, NO_TURN_END, wiringState } = configure;\n const { diagnoseBrief, specBriefPlugin } = round;\n const { gitHook } = setup;\n const { notFido2, readAllowedSigners } = signing;\n // The siblings as git's hook finds them in this work tree: its own\n // install, and in a linked worktree with none the main work tree's.\n const workspace = await openWorkspace(options, io, MAIN_INSTALL);\n const rows = SIBLINGS.map((name) => {\n const sibling = workspace.siblings.locate(name);\n const row = { tool: name, state: sibling.kind, minimum: MINIMUM_VERSIONS[name] };\n if (sibling.kind === 'absent') return { ...row, version: null, elsewhere: null, detail: sibling.reason };\n const elsewhere = sibling.elsewhere ?? null;\n const whose = elsewhere === null ? '' : `, the install of ${elsewhere}: this work tree has none of its own`;\n if (sibling.kind === 'outdated') return { ...row, version: sibling.version, elsewhere, detail: `${sibling.reason}${whose}` };\n const command = sibling.command.join(' ');\n const detail = sibling.version === null ? `${command} (named in .spec-harness.json; its version is not checked)` : `${command} (${sibling.version}${whose})`;\n return { ...row, version: sibling.version, elsewhere, detail };\n });\n const signersFile = workspace.config.rulings.allowedSigners;\n // Five things that wait on the work tree and on nothing of one another,\n // each a process or a chain of them. Asked one after another, Claude\n // Code's release, the longest wait of a doctor on Windows, was asked for\n // only when every answer of git's before it was in. So they are asked at\n // once, and read below in the order they were asked in before: where more\n // than one fails, the first of that order is the one thrown, whichever\n // failed first by the clock (ADR-0002).\n // In a linked worktree, `${CLAUDE_PROJECT_DIR}` names it in a session\n // started there and the main checkout in a worktree session of the desktop\n // app (https://code.claude.com/docs/en/worktrees, What worktrees share with\n // the main checkout, read 2026-10-24): the hook's script is looked for in\n // both, and is not there only where it is in neither.\n const main = mainWorkTree(workspace.commonDir);\n const [briefAsked, baseAsked, pluginAsked, claudeAsked, hookAsked] = await Promise.allSettled([\n diagnoseBrief(workspace, options, io.env),\n baseAndSigners(round, workspace, options.base, signersFile),\n specBriefPlugin(workspace.root),\n wiringAndRelease(round, workspace.root, io, main === null ? [workspace.root] : [workspace.root, main]),\n gitHook(workspace.root),\n ]);\n const named = answerOf(briefAsked);\n // A ruling counts only by a signature checked against the allowed signers\n // on the base, and only once spec-brief's archive asks the plugin about it.\n const { base, signersText } = answerOf(baseAsked);\n // A branch that names a brief spec-brief has archived holds every write,\n // and fails doctor, but for the branch that archived it: the last commit\n // of every round, whose own CI run must not fail for it. git tells the\n // two apart by the base, so they are told once it is resolved (ADR-0004).\n const closed = named.archived === null ? null : await closedRound(workspace, base, named.archived);\n const onBase = base.kind === 'resolved' ? signersText !== null : null;\n const signers = describeSigners(signersFile, base.kind === 'resolved' ? base.ref : null, onBase === true);\n // Which keys sign, as notes: a key that is not FIDO2 can still be one the\n // agent cannot use, and a PIV key reads as a plain one (ADR-0006).\n const read = readAllowedSigners(signersText ?? '');\n const plain = notFido2(read.signers);\n const signerNotes = [describeSignerKeys(plain), ...read.problems.map(describeSignerProblem)].filter((note): note is string => note !== null);\n const plugin = answerOf(pluginAsked);\n // The plugin and init's entries both on: Claude Code runs every guard twice\n // and registers the server twice (ADR-0012).\n const { wiring, release } = answerOf(claudeAsked);\n const claude = wiringState(wiring);\n // What the hook does with each line the settings hold for it, where there\n // is something to say: more on it than init writes, a line that turns the\n // guard off or holds every write, one only a shell can read, the writes\n // Claude Code starts it for where they are not all of them, and what\n // onFailure changes.\n const lineNotes = wiring.lines.flatMap((line) => [line.detail, line.cover, line.note, line.timeout]).filter((note): note is string => note !== null);\n // What stands over every line: a plugin that is turned on and is not on\n // this machine, or cannot be told to be, and disableAllHooks, which\n // switches off whatever hooks there are.\n const switchedOff = guardSwitchedOff(wiring);\n // And whether the hook is started as a session starts, where settings hold\n // the guard: a note, failing nothing, and `sessionStart` in the document.\n const atStart = wiring.hooks.length > 0 && !wiring.sessionStart ? NO_SESSION_START : null;\n // And whether the report the configuration asks for at a turn's end is\n // made at all: a note, failing nothing, and `turnEnd` in the document.\n const atEnd = workspace.config.turnReport && !wiring.turnEnd ? NO_TURN_END : null;\n // And, in a linked worktree where something wires the guard, the release\n // the hook's line runs where it is not this work tree's own: a note. In\n // the main work tree both are read from one install, and are one.\n const installs = guardWired(wiring) && main !== null ? describeInstalls(main, harnessRelease(main), harnessRelease(workspace.root)) : null;\n const wiringNotes = [describePresence(wiring), wiring.hooksOff === null ? null : describeHooksOff(wiring.hooksOff, switchedOff), installs].filter((note): note is string => note !== null);\n // How the hook runs the harness is a note: one that goes through npx guards\n // as well as one that does not, and fails nothing, --strict or not.\n const { hook, note: hookNote } = answerOf(hookAsked);\n const branch = workspace.branch === null ? '(detached)' : `${workspace.branch}${workspace.branchSource === undefined ? '' : ` (detached; ${workspace.branchSource} names it)`}`;\n if (options.format === 'json') {\n io.stdout.write(\n json('doctor', {\n root: workspace.root,\n branch: workspace.branch,\n branchSource: workspace.branchSource ?? null,\n brief: named.id,\n briefProblem: named.problem,\n closedRound:\n closed === null\n ? null\n : { state: closed.state, file: closed.brief.file, mergeBase: closed.state === 'unknown' ? null : closed.mergeBase, detail: describeClosedRound(closed) },\n base: base.kind === 'resolved' ? { ref: base.ref, source: base.source, mergeBase: base.mergeBase } : { unresolved: base.reason },\n allowedSigners: {\n file: signersFile,\n onBase,\n detail: signers,\n notFido2: plain.map(({ line, principals, keyType }) => ({ line, principals, keyType })),\n problems: read.problems,\n },\n plugin: { state: plugin.kind, file: 'file' in plugin ? plugin.file : null, detail: describePlugin(plugin) },\n claudeCode: {\n state: claude,\n ...wiring,\n detail: describeClaudeCode(wiring),\n notes: wiringNotes,\n release:\n release === null\n ? { state: 'unchecked', version: null, minimum: CLAUDE_CODE_MINIMUM, detail: 'not asked: nothing wires Claude Code to the guard here' }\n : { state: release.state, version: 'version' in release ? release.version : null, minimum: CLAUDE_CODE_MINIMUM, detail: describeClaudeRelease(release) },\n },\n gitHook: { state: hook.state, file: 'file' in hook ? hook.file : null, detail: describeGitHook(hook), note: hookNote },\n siblings: rows,\n }),\n );\n } else {\n const more = (notes: readonly string[]): string[] => notes.map((note) => ` ${note}`);\n io.stdout.write(\n [\n `root ${workspace.root}`,\n `branch ${branch}`,\n `brief ${named.problem === null ? (named.id ?? '(none named)') : `none: ${named.problem}`}`,\n ...more(closed === null ? [] : [describeClosedRound(closed)]),\n `base ${describeBase(base)}`,\n `signers ${signers}`,\n ...more(signerNotes),\n `plugin ${describePlugin(plugin)}`,\n `claude ${describeClaudeCode(wiring)}`,\n ...more(wiringNotes),\n ...more(lineNotes),\n ...more(release === null ? [] : [describeClaudeRelease(release)]),\n ...more(atStart === null ? [] : [atStart]),\n ...more(atEnd === null ? [] : [atEnd]),\n `git ${describeGitHook(hook)}`,\n ...more(hookNote === null ? [] : [hookNote]),\n '',\n '',\n ].join('\\n'),\n );\n for (const row of rows) io.stdout.write(`${row.state.padEnd(8)} ${row.tool.padEnd(10)} ${row.detail}\\n`);\n }\n // An outdated sibling is a problem to fix, where a missing optional one is\n // a choice; with none installed, the harness can check nothing. A double\n // install is a problem too, where no Claude Code wiring at all is a choice,\n // and so are a hook whose own line turns the guard off or holds every\n // write, or whose script is not there, a branch that names a brief no round\n // can work under, which holds every write as well, but for the branch that\n // archived its brief and waits to merge (ADR-0004), or one that names a\n // brief spec-brief cannot be asked about, which the hook holds every write\n // for too, guard hooks that disableAllHooks\n // switches off, a plugin that is turned on and is not on this machine\n // where no hook of init's stands in for it, a Claude Code too old to run\n // the hooks, and something at the path of git's pre-commit hook that git\n // cannot run and stops every commit at. A release that cannot be told is\n // not fine either, nor a line whose reading cannot be, nor a plugin that\n // cannot be told to be on this machine, nor a hook git runs that cannot be\n // read, which stops every commit as a script and runs as a program, nor a\n // place git runs its hooks from that git cannot name: --strict fails the\n // five.\n const outdated = rows.some((row) => row.state === 'outdated');\n const usable = rows.some((row) => row.state === 'found');\n const off = wiring.lines.some((line) => line.state === 'off' || line.state === 'held');\n const missing = wiring.presence?.state === 'absent' && wiring.hooks.length === 0;\n const tooOld = release?.state === 'outdated';\n const stopped = hook.state === 'stops';\n const unworkable = named.branch && closed?.state !== 'waiting-to-merge';\n // Only an unreadable hook has `runs`, so the test of its state is the\n // compiler's, and its mutant is equivalent.\n const untold =\n options.strict &&\n (release?.state === 'unknown' || wiring.lines.some((line) => line.state === 'unknown') || wiring.presence?.state === 'unknown' || (hook.state === 'unreadable' && hook.runs) || hook.state === 'unknown');\n return outdated || !usable || claude === 'both' || off || unworkable || named.holds || switchedOff || missing || tooOld || stopped || untold ? EXIT_FAILED : EXIT_OK;\n}\n\n/* ---------------------------------------------------------------- dispatch */\n\n/**\n * A map, because the command is the first word a person types and an object\n * answers to more names than it was given: `spec-harness constructor` ran\n * `Object` as a command and ended on a stack trace, where `spec-harness\n * construct` is an unknown command with exit 2.\n */\nconst COMMANDS: ReadonlyMap<string, (options: Options, io: CliIO) => Promise<number>> = new Map(\n // One for every command that has a shape (usage.ts), which the compiler\n // holds. A command of another module loads its module when it is the one\n // typed, and no other command's.\n Object.entries({\n guard: guardCommand,\n hook: hookCommand,\n context: async (options, io) => (await import('./commands.js')).contextCommand(options, io),\n audit: async (options, io) => (await import('./commands.js')).auditCommand(options, io),\n escalate: async (options, io) => (await import('./commands.js')).escalateCommand(options, io),\n rule: async (options, io) => (await import('./commands.js')).ruleCommand(options, io),\n rulings: async (options, io) => (await import('./commands.js')).rulingsCommand(options, io),\n probe: async (options, io) => (await import('./commands.js')).probeCommand(options, io),\n premises: async (options, io) => (await import('./premises.js')).premisesCommand(options, io),\n init: async (options, io) => (await import('./setup.js')).initCommand(options, io),\n mcp: async (options, io) => (await import('./server.js')).mcpCommand(options, io),\n doctor: doctorCommand,\n } satisfies Record<Command, (options: Options, io: CliIO) => Promise<number>>),\n);\n\nasync function dispatch(argv: readonly string[], io: CliIO): Promise<number> {\n let options: Options;\n try {\n options = parseOptions(argv);\n } catch (error) {\n // The parser throws nothing but its refusal of the line, which holds\n // whose line it was. Claude Code's hook says its own, and holds no\n // write for it.\n const refused = error as UnreadableLine;\n if (isClaudeHook(refused.words[0], refused.words[1])) return unreadLine(refused.message, io);\n io.stderr.write(`spec-harness: ${refused.message}\\n`);\n return EXIT_ERROR;\n }\n // Two values for an option that takes one: the parser kept the last, and\n // which was meant cannot be told from the line, so it is refused as a line\n // the parser cannot read is, and Claude Code's hook says it of its own.\n const twice = twoValues(options, io.cwd);\n if (twice !== null) {\n if (isClaudeHook(options.command, options.positionals[0])) return unreadLine(twice, io);\n io.stderr.write(`spec-harness: ${twice}; give it one\\n`);\n return EXIT_ERROR;\n }\n // A line that is wrong is refused before --help or --version answers: an\n // answer beside it said nothing of what was wrong, exit 0, as an option no\n // command has never was (spec-core ADR-0005).\n if (options.command !== undefined && !COMMANDS.has(options.command)) {\n io.stderr.write(`spec-harness: unknown command \"${options.command}\"; see spec-harness --help\\n`);\n return EXIT_ERROR;\n }\n // What parsed and names nothing, before anything is read or written for it.\n const refused = refusal(options, isDirectory);\n if (refused !== null) {\n io.stderr.write(`spec-harness: ${refused}\\n`);\n return EXIT_ERROR;\n }\n // Claude Code's hook is exempt from every refusal above, and said a root\n // that is not a directory only as it ran, which the help or the version\n // answered in place of: printed beside one, either is a line it cannot\n // read, said where there is a write it leaves unchecked (ADR-0005).\n const beside = isClaudeHook(options.command, options.positionals[0]) ? answerBeside(options, io.cwd, isDirectory) : null;\n if (beside !== null) return unreadLine(beside, io);\n if (options.version) {\n io.stdout.write(`${version()}\\n`);\n return EXIT_OK;\n }\n if (options.help || options.command === undefined) {\n io.stdout.write(HELP);\n return options.help ? EXIT_OK : EXIT_ERROR;\n }\n return COMMANDS.get(options.command)!(options, io);\n}\n\n/**\n * Runs the command line and resolves to the exit code, for an error nothing\n * below expected too.\n *\n * Such an error is neither a refusal nor a finding: the answer cannot be\n * trusted, which is exit 2 (spec-core ADR-0005). Rejected instead, it reached\n * the launcher as Node's uncaught error, exit 1, \"refused or found something\"\n * to a script, and to Claude Code a hook that failed without blocking: the\n * write the guard could not check went ahead. The stack is what makes a\n * report of it something to act on, and it goes to stderr alone: a script\n * that reads a document from stdout is handed no part of one.\n *\n * A write its reader had closed the pipe for is not such an error: the answer\n * was not delivered, which is still 2, and nothing in the harness is at\n * fault, so it is said in a line and no stack sends a person looking for a\n * defect. The process's own streams report it as an event, which the\n * launcher answers in the same words; here it is a caller's stream that\n * throws it. It is read by its code: stdout and stderr are the only pipes\n * the harness writes to.\n *\n * Nor is a module of the build that is not there. The launcher says a build\n * without its command line in a line, and a module a command asks for where\n * it runs is said in the same line: a build with a file missing is not a\n * defect a stack leads to. It is read by its code too: the harness imports\n * nothing but its own modules and Node's.\n */\nexport async function run(argv: readonly string[], io: CliIO): Promise<number> {\n try {\n return await dispatch(argv, io);\n } catch (error) {\n // A sibling's document of a shape the harness does not read is a sibling\n // that printed something it cannot read (answers.ts): exit 2. A git\n // command that failed is what git said, and no line of the harness's;\n // and a path under git's directory where the harness keeps its state,\n // which holds something else, is said in a line of its own (fs.ts).\n if (\n error instanceof UsageError ||\n error instanceof ConfigError ||\n error instanceof SiblingError ||\n error instanceof SiblingOutputError ||\n error instanceof GitError ||\n error instanceof StateError\n ) {\n io.stderr.write(`spec-harness: ${error.message}\\n`);\n return EXIT_ERROR;\n }\n if (!(error instanceof Error)) io.stderr.write(`spec-harness: unexpected error: ${String(error)}\\n`);\n else if ((error as NodeJS.ErrnoException).code === 'EPIPE') io.stderr.write('spec-harness: stdout was closed before all of the output was written\\n');\n else if ((error as NodeJS.ErrnoException).code === 'ERR_MODULE_NOT_FOUND') io.stderr.write('spec-harness: build output is missing; run \"npm run build\" first, or install the published package.\\n');\n else io.stderr.write(`spec-harness: unexpected error: ${error.stack ?? error.message}\\n`);\n return EXIT_ERROR;\n }\n}\n\n// What bin/spec-harness.js runs; the suite spawns the built one, from dist/,\n// outside the sweep (tests/integration/cli.test.ts), so it survives untested\n// in-process.\nexport async function main(argv: readonly string[] = process.argv.slice(2)): Promise<number> {\n return run(argv, { stdout: process.stdout, stderr: process.stderr, cwd: process.cwd(), env: process.env });\n}\n\n"]}
|
package/dist/configure.d.ts
CHANGED
|
@@ -155,6 +155,12 @@ export declare function reportsTurns(settings: unknown, isHook: (words: readonly
|
|
|
155
155
|
* which it holds, and not as the session starts.
|
|
156
156
|
*/
|
|
157
157
|
export declare const NO_SESSION_START = "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";
|
|
158
|
+
/**
|
|
159
|
+
* What doctor notes where `turnReport` is on and no settings file has Claude
|
|
160
|
+
* Code start the hook as a turn ends: the report the configuration asks for
|
|
161
|
+
* is made at no turn's end. The plugin brings no entry for it (ADR-0012).
|
|
162
|
+
*/
|
|
163
|
+
export declare 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";
|
|
158
164
|
/**
|
|
159
165
|
* What doctor notes, run in a linked worktree, of the spec-harness the
|
|
160
166
|
* hook's line runs: the one installed where `${CLAUDE_PROJECT_DIR}` points,
|
|
@@ -193,6 +199,15 @@ export interface WrittenHook {
|
|
|
193
199
|
readonly shell: boolean;
|
|
194
200
|
/** Whether the entry sets `onFailure` to `"block"`. */
|
|
195
201
|
readonly blocks: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* The word that names the harness, its script's path or its name, as
|
|
204
|
+
* written, and whether a shell reads it first: an entry with no `args`.
|
|
205
|
+
* Entries that name the harness in two ways are two lines.
|
|
206
|
+
*/
|
|
207
|
+
readonly launcher: {
|
|
208
|
+
readonly word: string;
|
|
209
|
+
readonly shell: boolean;
|
|
210
|
+
};
|
|
196
211
|
/**
|
|
197
212
|
* What the entry has for `type` where that is not `"command"`, as it is
|
|
198
213
|
* said of the line: none at all, or a word the reference does not list.
|
|
@@ -209,6 +224,15 @@ export interface WrittenHook {
|
|
|
209
224
|
* alone.
|
|
210
225
|
*/
|
|
211
226
|
export declare function writtenHooks(settings: unknown): WrittenHook[];
|
|
227
|
+
/**
|
|
228
|
+
* Where doctor looks for the script a line runs: each directory
|
|
229
|
+
* `${CLAUDE_PROJECT_DIR}` can name as a session starts, which Claude Code
|
|
230
|
+
* fills in, in either form, and how a file is told to stand at a path.
|
|
231
|
+
*/
|
|
232
|
+
export interface ScriptPlaces {
|
|
233
|
+
readonly projects: readonly string[];
|
|
234
|
+
readonly isFile: (path: string) => boolean;
|
|
235
|
+
}
|
|
212
236
|
/** 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. */
|
|
213
237
|
export declare function isStarted(tools: readonly string[] | null): boolean;
|
|
214
238
|
/** What doctor reports of one line of Claude Code's hook. */
|
|
@@ -223,8 +247,11 @@ export interface HookReport {
|
|
|
223
247
|
* checks it. `off`: the hook checks no write, for a line it cannot read, a
|
|
224
248
|
* root that is no directory, or a root that is a directory outside any
|
|
225
249
|
* work tree; or it is never started, in a file an array for a matcher
|
|
226
|
-
* keeps Claude Code from loading the hooks of
|
|
227
|
-
*
|
|
250
|
+
* keeps Claude Code from loading the hooks of, or it cannot start, its
|
|
251
|
+
* script not there. `held`: the hook holds every write, for a brief the
|
|
252
|
+
* line names that is not one or that spec-brief cannot be asked about;
|
|
253
|
+
* or Claude Code does, for a hook that cannot start under `onFailure:
|
|
254
|
+
* "block"`. `unstarted`: Claude Code waits on
|
|
228
255
|
* the line before no write, so it is not the guard. `unknown`: what the
|
|
229
256
|
* hook is handed, which writes it is started for, or whether Claude Code
|
|
230
257
|
* runs the entry at all, cannot be told here.
|
|
@@ -241,6 +268,8 @@ export interface HookReport {
|
|
|
241
268
|
readonly cover: string | null;
|
|
242
269
|
/** What `onFailure` changes, where the entry sets it to `"block"`. */
|
|
243
270
|
readonly note: string | null;
|
|
271
|
+
/** What is said of an entry whose `timeout` is below what a run of the hook is given, or `null`. */
|
|
272
|
+
readonly timeout: string | null;
|
|
244
273
|
}
|
|
245
274
|
/**
|
|
246
275
|
* The release of Claude Code that reads `onFailure` on a hook's entry, by its
|
|
@@ -303,8 +332,14 @@ export declare function handedLines(sources: readonly ClaudeSettings[], project:
|
|
|
303
332
|
* `PermissionRequest` has none of its hooks loaded ({@link arrayMatcher}):
|
|
304
333
|
* each line of the hook there is started for no write, and one that stood
|
|
305
334
|
* to be started for a write is a guard that is off.
|
|
335
|
+
*
|
|
336
|
+
* `scripts` is where a caller that says whether the script a line runs is
|
|
337
|
+
* there looks for it; with none it is not asked. A line whose script is
|
|
338
|
+
* not there is a hook Claude Code cannot start, which it lets each write
|
|
339
|
+
* go ahead without, or holds every write for where the entry sets
|
|
340
|
+
* `onFailure` to `"block"` and the release here reads it.
|
|
306
341
|
*/
|
|
307
|
-
export declare function reportHooks(sources: readonly ClaudeSettings[], project: string, read: (words: readonly string[]) => HookLine | null, pattern?: PatternReader, matching?: Matching, onFailureHere?: boolean): HookReport[];
|
|
342
|
+
export declare function reportHooks(sources: readonly ClaudeSettings[], project: string, read: (words: readonly string[]) => HookLine | null, pattern?: PatternReader, matching?: Matching, onFailureHere?: boolean, scripts?: ScriptPlaces | null): HookReport[];
|
|
308
343
|
/** Whether a project's `.mcp.json` registers a server under the harness's name, however it runs it. */
|
|
309
344
|
export declare function registersServer(mcp: unknown): boolean;
|
|
310
345
|
/** A Claude Code settings file, named as a person finds it, and what reading it gave: an object, or nothing usable. */
|
|
@@ -431,6 +466,8 @@ export interface ClaudeCodeWiring {
|
|
|
431
466
|
readonly server: boolean;
|
|
432
467
|
/** Whether a settings file has Claude Code start the hook as a session starts (startsSessions). */
|
|
433
468
|
readonly sessionStart: boolean;
|
|
469
|
+
/** Whether a settings file has Claude Code start the hook as a turn ends (reportsTurns): the plugin brings no such entry. */
|
|
470
|
+
readonly turnEnd: boolean;
|
|
434
471
|
/**
|
|
435
472
|
* The release of the Claude Code on `PATH`, where it was asked: a matcher
|
|
436
473
|
* that lists names with a comma is read as that release reads it
|