@descent-vtt/spec-harness 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +372 -0
  4. package/README.md +78 -11
  5. package/dist/briefs.d.ts +45 -0
  6. package/dist/briefs.js +73 -0
  7. package/dist/briefs.js.map +1 -1
  8. package/dist/cli.d.ts +1 -1
  9. package/dist/cli.js +384 -84
  10. package/dist/cli.js.map +1 -1
  11. package/dist/commands.js +7 -2
  12. package/dist/commands.js.map +1 -1
  13. package/dist/config.d.ts +15 -1
  14. package/dist/config.js +16 -3
  15. package/dist/config.js.map +1 -1
  16. package/dist/configure.d.ts +142 -32
  17. package/dist/configure.js +316 -89
  18. package/dist/configure.js.map +1 -1
  19. package/dist/fs.d.ts +150 -3
  20. package/dist/fs.js +459 -17
  21. package/dist/fs.js.map +1 -1
  22. package/dist/git.d.ts +85 -9
  23. package/dist/git.js +140 -16
  24. package/dist/git.js.map +1 -1
  25. package/dist/hooks.d.ts +111 -0
  26. package/dist/hooks.js +172 -16
  27. package/dist/hooks.js.map +1 -1
  28. package/dist/round.d.ts +8 -0
  29. package/dist/round.js +32 -9
  30. package/dist/round.js.map +1 -1
  31. package/dist/sandbox.js +4 -3
  32. package/dist/sandbox.js.map +1 -1
  33. package/dist/server.d.ts +25 -1
  34. package/dist/server.js +194 -27
  35. package/dist/server.js.map +1 -1
  36. package/dist/setup.d.ts +6 -3
  37. package/dist/setup.js +74 -23
  38. package/dist/setup.js.map +1 -1
  39. package/dist/siblings.d.ts +42 -7
  40. package/dist/siblings.js +135 -30
  41. package/dist/siblings.js.map +1 -1
  42. package/dist/types.d.ts +5 -0
  43. package/dist/types.js.map +1 -1
  44. package/dist/usage.d.ts +66 -12
  45. package/dist/usage.js +134 -21
  46. package/dist/usage.js.map +1 -1
  47. package/dist/workspace.d.ts +80 -1
  48. package/dist/workspace.js +188 -8
  49. package/dist/workspace.js.map +1 -1
  50. package/hooks/hooks.json +16 -0
  51. package/package.json +2 -2
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,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAoB,MAAM,YAAY,CAAC;AAE5F,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAgC,MAAM,YAAY,CAAC;AAClJ,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAwB,MAAM,eAAe,CAAC;AAC5F,OAAO,EACL,WAAW,EACX,QAAQ,EACR,cAAc,EACd,UAAU,EACV,WAAW,EACX,OAAO,EACP,IAAI,EACJ,aAAa,EACb,YAAY,EACZ,UAAU,EACV,OAAO,GAKR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAc,MAAM,gBAAgB,CAAC;AAEnG,MAAM,CAAC,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DnB,CAAC;AAGF,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,MAAM,GAAG,KAAK,IAA6B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AAE,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 { ConfigError, SIBLINGS } from './config.js';\nimport type { ClaudeCodeWiring } from './configure.js';\nimport { isDirectory } from './fs.js';\nimport { GitError, show, stagedChanges } from './git.js';\nimport type { DocumentReader } from './document.js';\nimport type { Decision } from './guard.js';\nimport { claudeResponse, gitResponse, parseClaudeHook, type HookRequest } from './hooks.js';\nimport type { Base } from './round.js';\nimport { SiblingError } from './siblings.js';\nimport { emptyValue, heldHookLine, isBlank, isClaudeHook, readHookLine, refusal, 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 openWorkspace,\n parseOptions,\n UsageError,\n version,\n type CliIO,\n type Options,\n type UnreadableLine,\n type Workspace,\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 or PostToolUse hook (stdin).\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.\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, disableAllHooks or an array for a matcher switches it\n off, the plugin that is turned on is not on this machine and\n nothing else guards, Claude Code is too old to run its hooks,\n or git stops every commit at what stands for 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 --help, --version\n\nAn option a command does not read, an argument it does not take, an option or an\nargument given an empty value, and a brief given both as the argument and as --brief\nare refused, exit 2, not read as if they were not there. doctor says an empty --brief\nor --base in its report. hook claude reads its line as every release has, and says a\nline it cannot read, and a --root that is not a directory, with exit 1: it refuses\nnothing for either.\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\nasync function decisionsFor(\n workspace: Workspace,\n options: Options,\n io: CliIO,\n given: readonly string[],\n cwd: string,\n): Promise<{ readonly decisions: Decision[] } | { readonly problem: string }> {\n const active = await activeBrief(workspace, options, io.env);\n const { brief, note, problem } = 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) };\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 exit code that answers\n * already: 1 for a question that cannot be read, 0 for a tool that writes\n * no file. Asked before anything on the hook's own line is, so that a line\n * that is wrong is said where there is a write it leaves unchecked.\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 io.stderr.write(`spec-harness: the hook input could not be read: ${(error as Error).message}\\n`);\n return EXIT_FAILED;\n }\n const request = parseClaudeHook(question);\n if ('error' in request) {\n // A hook that cannot read its question refuses nothing it cannot see,\n // but says so where the person reads it: a non-blocking error.\n io.stderr.write(`spec-harness: ${request.error}\\n`);\n return EXIT_FAILED;\n }\n return request.paths.length === 0 ? 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, since Claude Code shows the first line of the stderr of a hook\n * that exits 1 and goes on with the write, where exit 2 would hold every\n * write of the session, the one that mends the line among them (ADR-0005).\n */\nfunction guardOff(io: CliIO, { wrong, mend }: LineFault): number {\n io.stderr.write(`spec-harness: ${wrong}, so the guard is off and this write is not checked; ${mend}\\n`);\n return EXIT_FAILED;\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);\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);\n const cwd = request.cwd ?? io.cwd;\n let workspace: Workspace;\n try {\n workspace = await openWorkspace({ ...options, root: line.root ?? io.env['CLAUDE_PROJECT_DIR'] ?? cwd }, io);\n } catch (error) {\n if (error instanceof UsageError) return EXIT_OK;\n throw error;\n }\n try {\n const decided = await decisionsFor(workspace, options, io, request.paths, cwd);\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 const response = claudeResponse(request.event, decided.decisions);\n io.stdout.write(response.stdout);\n return response.exitCode;\n } catch (error) {\n if (request.event !== 'PreToolUse') throw error;\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 io.stderr.write(`spec-harness: cannot check this write: ${(error as Error).message}\\n`);\n return EXIT_ERROR;\n }\n }\n if (kind === 'git') {\n const workspace = await openWorkspace(options, io);\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 * 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, describePlugin, describePresence, describeSignerKeys, describeSignerProblem, describeSigners, guardSwitchedOff, wiringState } = configure;\n const { diagnoseBrief, specBriefPlugin } = round;\n const { gitHook } = setup;\n const { notFido2, readAllowedSigners } = signing;\n const workspace = await openWorkspace(options, io);\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, detail: sibling.reason };\n if (sibling.kind === 'outdated') return { ...row, version: sibling.version, detail: sibling.reason };\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})`;\n return { ...row, version: sibling.version, 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 const wiringNotes = [describePresence(wiring), wiring.hooksOff === null ? null : describeHooksOff(wiring.hooksOff, switchedOff)].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 `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, guard hooks that disableAllHooks switches off, a plugin that is\n // turned on and is not on this machine where no hook of init's stands in\n // for it, a Claude Code too old to run the hooks, and something at the\n // path of git's pre-commit hook that git cannot run and stops every\n // commit at. A release that cannot be told is not fine either, nor a\n // line whose reading cannot be, nor a plugin that cannot be told to be on\n // this machine: --strict fails the three.\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 untold = options.strict && (release?.state === 'unknown' || wiring.lines.some((line) => line.state === 'unknown') || wiring.presence?.state === 'unknown');\n return outdated || !usable || claude === 'both' || off || 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 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 const command = COMMANDS.get(options.command);\n if (command === undefined) {\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 return 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 if (\n error instanceof UsageError ||\n error instanceof ConfigError ||\n error instanceof SiblingError ||\n error instanceof SiblingOutputError ||\n error instanceof GitError\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,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,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1I,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGvE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,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;AAGjT,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,CAAC;AAC3K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AAW;YAC5B,KAAK,YAAY,YAAY;YAC7B,KAAK,YAAY,kBAAkB;YACnC,KAAK,YAAY,QAAQ;YACzB,KAAK,YAAY,UAAU,EAC3B,CAAC;YACD,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;YACpD,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;YAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aAChG,IAAK,KAA+B,CAAC,IAAI,KAAK,OAAO;YAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,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 } 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"]}
package/dist/commands.js CHANGED
@@ -10,7 +10,7 @@ import { describeMeasured } from './audit.js';
10
10
  import { briefIdFromBranch } from './branch.js';
11
11
  import { findActive } from './briefs.js';
12
12
  import { formatFindings } from './formats.js';
13
- import { isDirectory } from './fs.js';
13
+ import { isDirectory, isFile } from './fs.js';
14
14
  import { readJUnit } from './junit.js';
15
15
  import { classify, endOfOutput, readProbes, renderEvidence, renderUnexplained, verdictOf } from './probe.js';
16
16
  import { createReader } from './reader.js';
@@ -205,6 +205,11 @@ const LEFT_RUNNING = ', and something it started was left running, holding its o
205
205
  * command on Node's EISDIR and a stack.
206
206
  */
207
207
  const A_DIRECTORY = { ok: false, error: 'it is a directory, not a report' };
208
+ /**
209
+ * The same where something that is neither stands there, as a named pipe the
210
+ * probe's command made: opened, it was read without end (ADR-0002).
211
+ */
212
+ const NOT_A_FILE = { ok: false, error: 'it is neither a file nor a directory, not a report' };
208
213
  async function runProbe(directory, probe, runs, timeout) {
209
214
  const classified = [];
210
215
  for (let i = 0; i < runs; i += 1) {
@@ -216,7 +221,7 @@ async function runProbe(directory, probe, runs, timeout) {
216
221
  const run = await runCommand(probe.run, directory, timeout);
217
222
  // existsSync answers false for null, so the null check is there for the
218
223
  // type, and its mutant is equivalent.
219
- const junit = report === null || !existsSync(report) ? null : isDirectory(report) ? A_DIRECTORY : readJUnit(await readFile(report, 'utf8'));
224
+ const junit = report === null || !existsSync(report) ? null : isDirectory(report) ? A_DIRECTORY : !isFile(report) ? NOT_A_FILE : readJUnit(await readFile(report, 'utf8'));
220
225
  const judged = classify(probe, { exitCode: run.exitCode, output: run.output, junit });
221
226
  // After whatever `classify` says of the run: red, green or stopped, it
222
227
  // is judged by its shell, and what it left is said beside the verdict.
@@ -1 +1 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,QAAQ,EAA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AC","sourcesContent":["/**\n * The commands that read a round: context, audit, escalate, rule, rulings\n * and probe. Each resolves the brief, asks `round.ts` for the facts and\n * prints them; exit codes follow the family contract.\n */\n\nimport { existsSync } from 'node:fs';\nimport { mkdir, readFile, rm, writeFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\n\nimport { describeMeasured } from './audit.js';\nimport { briefIdFromBranch } from './branch.js';\nimport { findActive } from './briefs.js';\nimport { formatFindings } from './formats.js';\nimport { isDirectory } from './fs.js';\nimport { readJUnit, type JUnitRead } from './junit.js';\nimport { classify, endOfOutput, readProbes, renderEvidence, renderUnexplained, verdictOf, type ProbeResult, type ProbeSpec } from './probe.js';\nimport { createReader } from './reader.js';\nimport {\n buildContext,\n checkRulings,\n briefText,\n listEscalations,\n raiseEscalation,\n recordRuling,\n resolveBase,\n runAudit,\n} from './round.js';\nimport { renderMemo, type EscalationOption } from './rulings.js';\nimport { runCommand, withWorktree } from './sandbox.js';\nimport type { BriefRow, Finding } from './types.js';\nimport {\n describeActive,\n EXIT_ERROR,\n EXIT_FAILED,\n EXIT_OK,\n json,\n UsageError,\n version,\n type CliIO,\n type Options,\n type Workspace,\n openWorkspace,\n} from './workspace.js';\n\nconst reader = createReader();\n\n/**\n * The brief a command acts on: a positional id, else the active one. A\n * command that needs one and has none is a usage error. The command line\n * refuses the id beside `--brief` before it gets here (usage.ts).\n */\nexport async function targetBrief(workspace: Workspace, options: Options, io: CliIO, positional: string | undefined): Promise<{ brief: BriefRow; briefs: BriefRow[] }> {\n const briefs = await workspace.siblings.briefs();\n const fromBranch = briefIdFromBranch(workspace.config.branches, workspace.branch);\n const active = findActive(briefs, { argument: positional, flag: options.brief, environment: io.env['SPEC_BRIEF'], branch: fromBranch });\n const { brief, note, problem } = describeActive(active);\n if (problem !== null) throw new UsageError(problem);\n if (brief === null) throw new UsageError(note);\n return { brief, briefs };\n}\n\nconst MARK: Record<Finding['severity'], string> = { error: 'error ', warning: 'warning', note: 'note ' };\n\nfunction printFindings(io: CliIO, findings: readonly Finding[]): void {\n for (const finding of findings) {\n const where = finding.file === undefined ? '' : `${finding.file}${finding.line === undefined ? '' : `:${finding.line}`} `;\n io.stdout.write(`${MARK[finding.severity]} ${where}${finding.message} ${finding.rule}\\n ${finding.hint}\\n`);\n }\n}\n\n/* ----------------------------------------------------------------- context */\n\nexport async function contextCommand(options: Options, io: CliIO): Promise<number> {\n const workspace = await openWorkspace(options, io);\n const { brief, briefs } = await targetBrief(workspace, options, io, options.positionals[0]);\n const packet = await buildContext(workspace, brief, briefs, reader, options.base);\n if (options.format === 'json') {\n io.stdout.write(\n json('context', {\n brief: brief.id,\n markdown: packet.markdown,\n included: packet.included,\n omitted: packet.omitted,\n unresolved: packet.unresolved,\n unclosedFrontMatter: packet.unclosedFrontMatter,\n unreadableFrontMatter: packet.unreadableFrontMatter,\n unreadableScope: packet.unreadableScope,\n unreadableProtections: packet.unreadableProtections,\n unreadableRulingPaths: packet.unreadableRulingPaths,\n unmatchedSpecs: packet.unmatchedSpecs,\n }),\n );\n } else {\n io.stdout.write(packet.markdown);\n }\n return EXIT_OK;\n}\n\n/* ------------------------------------------------------------------- audit */\n\nexport async function auditCommand(options: Options, io: CliIO): Promise<number> {\n const workspace = await openWorkspace(options, io);\n const { brief } = await targetBrief(workspace, options, io, options.positionals[0]);\n const result = await runAudit(workspace, brief, reader, options.base);\n const { counts, findings, measured } = result.report;\n if (options.format === 'json') {\n io.stdout.write(\n json('audit', {\n ok: counts.error === 0 && (!options.strict || counts.warning === 0),\n brief: brief.id,\n base: result.base.kind === 'resolved' ? { ref: result.base.ref, mergeBase: result.base.mergeBase, head: result.base.head } : null,\n counts,\n measured,\n findings,\n dependencies: result.dependencies,\n installScripts: result.installScripts,\n }),\n );\n } else if (options.format === 'pretty') {\n io.stdout.write(`audit of brief ${brief.id}${result.base.kind === 'resolved' ? ` from ${result.base.ref} (${result.base.mergeBase.slice(0, 12)})` : ''}\\n\\n`);\n printFindings(io, findings);\n // The counts stay the last line, where a script reads them.\n io.stdout.write(`\\n${describeMeasured(measured)}\\n${counts.error} error(s), ${counts.warning} warning(s), ${counts.note} note(s)\\n`);\n } else {\n io.stdout.write(formatFindings(options.format, findings, { file: brief.file, version: version(), summary: describeMeasured(measured) }));\n }\n return counts.error > 0 || (options.strict && counts.warning > 0) ? EXIT_FAILED : EXIT_OK;\n}\n\n/* -------------------------------------------------------------- escalation */\n\nfunction parseOption(raw: string): EscalationOption {\n const colon = raw.indexOf(':');\n const option = colon < 0 ? { label: raw.trim(), consequence: '' } : { label: raw.slice(0, colon).trim(), consequence: raw.slice(colon + 1).trim() };\n // An option given nothing was refused where the command line was read, so\n // this one has a colon and nothing before it: a cost, and no choice it is\n // the cost of. The memo would number a choice with no name.\n if (option.label === '') throw new UsageError(`--option is ${JSON.stringify(raw)}, which names no choice before its colon; give it \"<label>: <cost>\"`);\n return option;\n}\n\nexport async function escalateCommand(options: Options, io: CliIO): Promise<number> {\n const workspace = await openWorkspace(options, io);\n if (options.list) {\n const waiting = await listEscalations(workspace);\n if (options.format === 'json') io.stdout.write(json('escalate', { waiting }));\n else if (waiting.length === 0) io.stdout.write('no escalation is waiting\\n');\n else for (const request of waiting) io.stdout.write(`${request.id} brief ${request.brief} ${request.paths.join(', ')} ${request.reason.split('\\n')[0]}\\n`);\n return EXIT_OK;\n }\n if (options.show !== undefined) {\n const request = (await listEscalations(workspace)).find((candidate) => candidate.id === options.show);\n if (request === undefined) throw new UsageError(`no escalation \"${options.show}\" is waiting`);\n io.stdout.write(options.format === 'json' ? json('escalate', { request }) : renderMemo(request));\n return EXIT_OK;\n }\n if (options.paths.length === 0 || options.reason === undefined) {\n throw new UsageError('escalate needs --path <file> (repeatable) and --reason <why>; or --list, or --show <id>');\n }\n // Read before spec-brief is asked anything: a request that cannot be\n // written is refused for what is wrong with it, whatever the brief.\n const choices = options.options.map(parseOption);\n const { brief } = await targetBrief(workspace, options, io, undefined);\n const { request, memo } = await raiseEscalation(workspace, brief, {\n paths: options.paths,\n reason: options.reason,\n options: choices,\n recommendation: options.recommend ?? null,\n });\n io.stdout.write(options.format === 'json' ? json('escalate', { request, memo }) : memo);\n // Exit 1: the round is waiting on a person, which a caller must not read as done.\n return EXIT_FAILED;\n}\n\nexport async function ruleCommand(options: Options, io: CliIO): Promise<number> {\n const id = options.positionals[0];\n if (id === undefined) throw new UsageError('rule needs the escalation id, such as E-012-1');\n if (options.allow === options.deny) throw new UsageError('rule needs exactly one of --allow or --deny');\n if (options.note === undefined || options.note.trim() === '') throw new UsageError('rule needs --note: what exactly is allowed, or why not');\n const workspace = await openWorkspace(options, io);\n const recorded = await recordRuling(workspace, id, options.allow ? 'allow' : 'deny', options.note, reader);\n const command = `git commit -S -m \"ruling ${recorded.id}: ${options.allow ? 'allow' : 'deny'}\" -- ${recorded.file}`;\n if (options.format === 'json') {\n io.stdout.write(json('rule', { ruling: recorded.id, file: recorded.file, row: recorded.row, commit: command }));\n } else {\n io.stdout.write(`${recorded.file} now holds ruling ${recorded.id}:\\n\\n ${recorded.row}\\n\\nIt counts once you commit it signed, with a key the base branch's allowed signers list:\\n\\n ${command}\\n`);\n }\n return EXIT_OK;\n}\n\nexport async function rulingsCommand(options: Options, io: CliIO): Promise<number> {\n const workspace = await openWorkspace(options, io);\n const { brief } = await targetBrief(workspace, options, io, options.positionals[0]);\n const base = await resolveBase(workspace, options.base);\n const check = await checkRulings(workspace, brief, await briefText(workspace, brief), reader, base);\n if (options.format === 'json') {\n io.stdout.write(json('rulings', { brief: brief.id, rows: check.rows, verified: check.verified, unverified: check.unverified, problems: check.problems }));\n } else {\n if (check.rows.length === 0) io.stdout.write(`brief ${brief.id} holds no ruling\\n`);\n for (const row of check.rows) {\n const verified = check.verified.find((ruling) => ruling.id === row.id);\n const unverified = check.unverified.find((ruling) => ruling.id === row.id);\n // An allow row that does not verify is among the unverified, with its\n // reason, so the fallback for none is equivalent to its mutants.\n const state = row.decision === 'deny' ? 'refused' : verified !== undefined ? `signed by ${verified.signer}` : `not verified: ${unverified?.reason ?? ''}`;\n io.stdout.write(`${row.id} ${row.decision} ${row.paths.join(', ')} ${state}\\n`);\n }\n printFindings(io, check.problems);\n }\n return check.unverified.length > 0 || check.problems.length > 0 ? EXIT_FAILED : EXIT_OK;\n}\n\n/* ------------------------------------------------------------------- probe */\n\n/**\n * What is said of a command answered with its output still held, three\n * seconds after its shell ended or after its timeout: of a run, in its\n * evidence, and of a `setup`, in why the probe stopped or, where the setup\n * passed, in a line of its own. What holds the output is no part of the\n * command and was not stopped with it. What the sandbox can reach of it is\n * stopped when the probe is done at that commit; the rest runs on until it\n * ends or a person ends it, and the person is the one who can find it\n * (ADR-0003).\n */\nconst LEFT_RUNNING = ', and something it started was left running, holding its output';\n\n/**\n * What is read of a probe's report where a directory stands under its name,\n * as a repository can hold one: no report, said in the probe's own words\n * for one it cannot read. Taken away as a file or read as one, it ended the\n * command on Node's EISDIR and a stack.\n */\nconst A_DIRECTORY: JUnitRead = { ok: false, error: 'it is a directory, not a report' };\n\nasync function runProbe(directory: string, probe: ProbeSpec, runs: number, timeout: number): Promise<ProbeResult['runs']> {\n const classified = [];\n for (let i = 0; i < runs; i += 1) {\n const report = probe.junit === null ? null : join(directory, probe.junit);\n // A report an earlier run left is taken away, so that what is read\n // after this run is this run's. A directory is none, and is left.\n if (report !== null && !isDirectory(report)) await rm(report, { force: true });\n const run = await runCommand(probe.run, directory, timeout);\n // existsSync answers false for null, so the null check is there for the\n // type, and its mutant is equivalent.\n const junit = report === null || !existsSync(report) ? null : isDirectory(report) ? A_DIRECTORY : readJUnit(await readFile(report, 'utf8'));\n const judged = classify(probe, { exitCode: run.exitCode, output: run.output, junit });\n // After whatever `classify` says of the run: red, green or stopped, it\n // is judged by its shell, and what it left is said beside the verdict.\n classified.push(run.outputHeld ? { ...judged, detail: `${judged.detail}${LEFT_RUNNING}` } : judged);\n }\n return classified;\n}\n\nexport async function probeCommand(options: Options, io: CliIO): Promise<number> {\n const workspace = await openWorkspace(options, io);\n const { brief } = await targetBrief(workspace, options, io, options.positionals[0]);\n const text = await briefText(workspace, brief);\n const set = readProbes(reader.codeBlocks(text));\n if (set.problems.length > 0) {\n for (const problem of set.problems) io.stderr.write(`spec-harness: ${brief.file}:${problem.line}: ${problem.message}\\n`);\n return EXIT_ERROR;\n }\n const probes = set.probes.filter((probe) => options.id === undefined || probe.id === options.id);\n if (probes.length === 0) {\n io.stdout.write(`brief ${brief.id} declares no probe${options.id === undefined ? '' : ` named ${options.id}`}\\n`);\n return options.id === undefined ? EXIT_OK : EXIT_ERROR;\n }\n const base = await resolveBase(workspace, options.base);\n if (base.kind === 'unresolved') throw new UsageError(base.reason);\n const at = options.at ?? (base.mergeBase === base.head ? 'base' : 'both');\n const results: ProbeResult[] = [];\n const measure = async (label: 'base' | 'head', commit: string, expected: 'red' | 'green'): Promise<void> => {\n await withWorktree(workspace.root, commit, async (directory) => {\n for (const file of set.files) {\n await mkdir(dirname(join(directory, file.path)), { recursive: true });\n await writeFile(join(directory, file.path), file.content.endsWith('\\n') ? file.content : `${file.content}\\n`);\n }\n const setups = [...new Set(probes.map((probe) => probe.setup).filter((setup): setup is string => setup !== null))];\n for (const setup of setups) {\n const timeout = workspace.config.probes.timeout;\n const run = await runCommand(setup, directory, timeout);\n // A setup stopped at its timeout has no exit code to have failed by,\n // and may have printed nothing: how long it was given is the reason.\n const how = run.exitCode === null ? `was stopped after ${timeout} seconds` : 'failed';\n if (run.exitCode !== 0) throw new UsageError(`the probe setup \"${setup}\" ${how} at ${label}${run.outputHeld ? LEFT_RUNNING : ''}:\\n${endOfOutput(run.output)}`);\n // A setup that passed says nothing else, and the runs after it start\n // beside what it left: on the standard error, whatever the format,\n // since the document has no place for a setup.\n if (run.outputHeld) io.stderr.write(`spec-harness: the probe setup \"${setup}\" passed at ${label}${LEFT_RUNNING}\\n`);\n }\n for (const probe of probes) {\n const runs = await runProbe(directory, probe, probe.runs ?? workspace.config.probes.runs, probe.timeout ?? workspace.config.probes.timeout);\n results.push({ probe, at: label, commit, expected, runs, verdict: verdictOf(expected, runs) });\n }\n });\n };\n if (at === 'base' || at === 'both') await measure('base', base.mergeBase, 'red');\n if (at === 'head' || at === 'both') await measure('head', base.head, 'green');\n const evidence = renderEvidence(results, set.hash, new Date().toISOString().slice(0, 10));\n const failed = results.filter((result) => result.verdict !== (result.expected === 'red' ? 'measured' : 'fixed'));\n if (options.format === 'json') {\n io.stdout.write(\n json('probe', {\n ok: failed.length === 0,\n brief: brief.id,\n hash: set.hash,\n results: results.map((result) => ({ id: result.probe.id, at: result.at, commit: result.commit, expected: result.expected, verdict: result.verdict, runs: result.runs })),\n evidence,\n }),\n );\n } else {\n io.stdout.write(`${evidence}\\n`);\n // On the standard error, beside the table and never in it: the table is\n // what a brief records and a script reads. The JSON document has the\n // same as a field of each such run, and so says nothing here.\n io.stderr.write(renderUnexplained(results));\n }\n return failed.length === 0 ? EXIT_OK : EXIT_FAILED;\n}\n"]}
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAiB,EAA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CAAC;IAC9C,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC;AACrD,CAAC","sourcesContent":["/**\n * The commands that read a round: context, audit, escalate, rule, rulings\n * and probe. Each resolves the brief, asks `round.ts` for the facts and\n * prints them; exit codes follow the family contract.\n */\n\nimport { existsSync } from 'node:fs';\nimport { mkdir, readFile, rm, writeFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\n\nimport { describeMeasured } from './audit.js';\nimport { briefIdFromBranch } from './branch.js';\nimport { findActive } from './briefs.js';\nimport { formatFindings } from './formats.js';\nimport { isDirectory, isFile } from './fs.js';\nimport { readJUnit, type JUnitRead } from './junit.js';\nimport { classify, endOfOutput, readProbes, renderEvidence, renderUnexplained, verdictOf, type ProbeResult, type ProbeSpec } from './probe.js';\nimport { createReader } from './reader.js';\nimport {\n buildContext,\n checkRulings,\n briefText,\n listEscalations,\n raiseEscalation,\n recordRuling,\n resolveBase,\n runAudit,\n} from './round.js';\nimport { renderMemo, type EscalationOption } from './rulings.js';\nimport { runCommand, withWorktree } from './sandbox.js';\nimport type { BriefRow, Finding } from './types.js';\nimport {\n describeActive,\n EXIT_ERROR,\n EXIT_FAILED,\n EXIT_OK,\n json,\n UsageError,\n version,\n type CliIO,\n type Options,\n type Workspace,\n openWorkspace,\n} from './workspace.js';\n\nconst reader = createReader();\n\n/**\n * The brief a command acts on: a positional id, else the active one. A\n * command that needs one and has none is a usage error. The command line\n * refuses the id beside `--brief` before it gets here (usage.ts).\n */\nexport async function targetBrief(workspace: Workspace, options: Options, io: CliIO, positional: string | undefined): Promise<{ brief: BriefRow; briefs: BriefRow[] }> {\n const briefs = await workspace.siblings.briefs();\n const fromBranch = briefIdFromBranch(workspace.config.branches, workspace.branch);\n const active = findActive(briefs, { argument: positional, flag: options.brief, environment: io.env['SPEC_BRIEF'], branch: fromBranch });\n const { brief, note, problem } = describeActive(active);\n if (problem !== null) throw new UsageError(problem);\n if (brief === null) throw new UsageError(note);\n return { brief, briefs };\n}\n\nconst MARK: Record<Finding['severity'], string> = { error: 'error ', warning: 'warning', note: 'note ' };\n\nfunction printFindings(io: CliIO, findings: readonly Finding[]): void {\n for (const finding of findings) {\n const where = finding.file === undefined ? '' : `${finding.file}${finding.line === undefined ? '' : `:${finding.line}`} `;\n io.stdout.write(`${MARK[finding.severity]} ${where}${finding.message} ${finding.rule}\\n ${finding.hint}\\n`);\n }\n}\n\n/* ----------------------------------------------------------------- context */\n\nexport async function contextCommand(options: Options, io: CliIO): Promise<number> {\n const workspace = await openWorkspace(options, io);\n const { brief, briefs } = await targetBrief(workspace, options, io, options.positionals[0]);\n const packet = await buildContext(workspace, brief, briefs, reader, options.base);\n if (options.format === 'json') {\n io.stdout.write(\n json('context', {\n brief: brief.id,\n markdown: packet.markdown,\n included: packet.included,\n omitted: packet.omitted,\n unresolved: packet.unresolved,\n unclosedFrontMatter: packet.unclosedFrontMatter,\n unreadableFrontMatter: packet.unreadableFrontMatter,\n unreadableScope: packet.unreadableScope,\n unreadableProtections: packet.unreadableProtections,\n unreadableRulingPaths: packet.unreadableRulingPaths,\n unmatchedSpecs: packet.unmatchedSpecs,\n }),\n );\n } else {\n io.stdout.write(packet.markdown);\n }\n return EXIT_OK;\n}\n\n/* ------------------------------------------------------------------- audit */\n\nexport async function auditCommand(options: Options, io: CliIO): Promise<number> {\n const workspace = await openWorkspace(options, io);\n const { brief } = await targetBrief(workspace, options, io, options.positionals[0]);\n const result = await runAudit(workspace, brief, reader, options.base);\n const { counts, findings, measured } = result.report;\n if (options.format === 'json') {\n io.stdout.write(\n json('audit', {\n ok: counts.error === 0 && (!options.strict || counts.warning === 0),\n brief: brief.id,\n base: result.base.kind === 'resolved' ? { ref: result.base.ref, mergeBase: result.base.mergeBase, head: result.base.head } : null,\n counts,\n measured,\n findings,\n dependencies: result.dependencies,\n installScripts: result.installScripts,\n }),\n );\n } else if (options.format === 'pretty') {\n io.stdout.write(`audit of brief ${brief.id}${result.base.kind === 'resolved' ? ` from ${result.base.ref} (${result.base.mergeBase.slice(0, 12)})` : ''}\\n\\n`);\n printFindings(io, findings);\n // The counts stay the last line, where a script reads them.\n io.stdout.write(`\\n${describeMeasured(measured)}\\n${counts.error} error(s), ${counts.warning} warning(s), ${counts.note} note(s)\\n`);\n } else {\n io.stdout.write(formatFindings(options.format, findings, { file: brief.file, version: version(), summary: describeMeasured(measured) }));\n }\n return counts.error > 0 || (options.strict && counts.warning > 0) ? EXIT_FAILED : EXIT_OK;\n}\n\n/* -------------------------------------------------------------- escalation */\n\nfunction parseOption(raw: string): EscalationOption {\n const colon = raw.indexOf(':');\n const option = colon < 0 ? { label: raw.trim(), consequence: '' } : { label: raw.slice(0, colon).trim(), consequence: raw.slice(colon + 1).trim() };\n // An option given nothing was refused where the command line was read, so\n // this one has a colon and nothing before it: a cost, and no choice it is\n // the cost of. The memo would number a choice with no name.\n if (option.label === '') throw new UsageError(`--option is ${JSON.stringify(raw)}, which names no choice before its colon; give it \"<label>: <cost>\"`);\n return option;\n}\n\nexport async function escalateCommand(options: Options, io: CliIO): Promise<number> {\n const workspace = await openWorkspace(options, io);\n if (options.list) {\n const waiting = await listEscalations(workspace);\n if (options.format === 'json') io.stdout.write(json('escalate', { waiting }));\n else if (waiting.length === 0) io.stdout.write('no escalation is waiting\\n');\n else for (const request of waiting) io.stdout.write(`${request.id} brief ${request.brief} ${request.paths.join(', ')} ${request.reason.split('\\n')[0]}\\n`);\n return EXIT_OK;\n }\n if (options.show !== undefined) {\n const request = (await listEscalations(workspace)).find((candidate) => candidate.id === options.show);\n if (request === undefined) throw new UsageError(`no escalation \"${options.show}\" is waiting`);\n io.stdout.write(options.format === 'json' ? json('escalate', { request }) : renderMemo(request));\n return EXIT_OK;\n }\n if (options.paths.length === 0 || options.reason === undefined) {\n throw new UsageError('escalate needs --path <file> (repeatable) and --reason <why>; or --list, or --show <id>');\n }\n // Read before spec-brief is asked anything: a request that cannot be\n // written is refused for what is wrong with it, whatever the brief.\n const choices = options.options.map(parseOption);\n const { brief } = await targetBrief(workspace, options, io, undefined);\n const { request, memo } = await raiseEscalation(workspace, brief, {\n paths: options.paths,\n reason: options.reason,\n options: choices,\n recommendation: options.recommend ?? null,\n });\n io.stdout.write(options.format === 'json' ? json('escalate', { request, memo }) : memo);\n // Exit 1: the round is waiting on a person, which a caller must not read as done.\n return EXIT_FAILED;\n}\n\nexport async function ruleCommand(options: Options, io: CliIO): Promise<number> {\n const id = options.positionals[0];\n if (id === undefined) throw new UsageError('rule needs the escalation id, such as E-012-1');\n if (options.allow === options.deny) throw new UsageError('rule needs exactly one of --allow or --deny');\n if (options.note === undefined || options.note.trim() === '') throw new UsageError('rule needs --note: what exactly is allowed, or why not');\n const workspace = await openWorkspace(options, io);\n const recorded = await recordRuling(workspace, id, options.allow ? 'allow' : 'deny', options.note, reader);\n const command = `git commit -S -m \"ruling ${recorded.id}: ${options.allow ? 'allow' : 'deny'}\" -- ${recorded.file}`;\n if (options.format === 'json') {\n io.stdout.write(json('rule', { ruling: recorded.id, file: recorded.file, row: recorded.row, commit: command }));\n } else {\n io.stdout.write(`${recorded.file} now holds ruling ${recorded.id}:\\n\\n ${recorded.row}\\n\\nIt counts once you commit it signed, with a key the base branch's allowed signers list:\\n\\n ${command}\\n`);\n }\n return EXIT_OK;\n}\n\nexport async function rulingsCommand(options: Options, io: CliIO): Promise<number> {\n const workspace = await openWorkspace(options, io);\n const { brief } = await targetBrief(workspace, options, io, options.positionals[0]);\n const base = await resolveBase(workspace, options.base);\n const check = await checkRulings(workspace, brief, await briefText(workspace, brief), reader, base);\n if (options.format === 'json') {\n io.stdout.write(json('rulings', { brief: brief.id, rows: check.rows, verified: check.verified, unverified: check.unverified, problems: check.problems }));\n } else {\n if (check.rows.length === 0) io.stdout.write(`brief ${brief.id} holds no ruling\\n`);\n for (const row of check.rows) {\n const verified = check.verified.find((ruling) => ruling.id === row.id);\n const unverified = check.unverified.find((ruling) => ruling.id === row.id);\n // An allow row that does not verify is among the unverified, with its\n // reason, so the fallback for none is equivalent to its mutants.\n const state = row.decision === 'deny' ? 'refused' : verified !== undefined ? `signed by ${verified.signer}` : `not verified: ${unverified?.reason ?? ''}`;\n io.stdout.write(`${row.id} ${row.decision} ${row.paths.join(', ')} ${state}\\n`);\n }\n printFindings(io, check.problems);\n }\n return check.unverified.length > 0 || check.problems.length > 0 ? EXIT_FAILED : EXIT_OK;\n}\n\n/* ------------------------------------------------------------------- probe */\n\n/**\n * What is said of a command answered with its output still held, three\n * seconds after its shell ended or after its timeout: of a run, in its\n * evidence, and of a `setup`, in why the probe stopped or, where the setup\n * passed, in a line of its own. What holds the output is no part of the\n * command and was not stopped with it. What the sandbox can reach of it is\n * stopped when the probe is done at that commit; the rest runs on until it\n * ends or a person ends it, and the person is the one who can find it\n * (ADR-0003).\n */\nconst LEFT_RUNNING = ', and something it started was left running, holding its output';\n\n/**\n * What is read of a probe's report where a directory stands under its name,\n * as a repository can hold one: no report, said in the probe's own words\n * for one it cannot read. Taken away as a file or read as one, it ended the\n * command on Node's EISDIR and a stack.\n */\nconst A_DIRECTORY: JUnitRead = { ok: false, error: 'it is a directory, not a report' };\n\n/**\n * The same where something that is neither stands there, as a named pipe the\n * probe's command made: opened, it was read without end (ADR-0002).\n */\nconst NOT_A_FILE: JUnitRead = { ok: false, error: 'it is neither a file nor a directory, not a report' };\n\nasync function runProbe(directory: string, probe: ProbeSpec, runs: number, timeout: number): Promise<ProbeResult['runs']> {\n const classified = [];\n for (let i = 0; i < runs; i += 1) {\n const report = probe.junit === null ? null : join(directory, probe.junit);\n // A report an earlier run left is taken away, so that what is read\n // after this run is this run's. A directory is none, and is left.\n if (report !== null && !isDirectory(report)) await rm(report, { force: true });\n const run = await runCommand(probe.run, directory, timeout);\n // existsSync answers false for null, so the null check is there for the\n // type, and its mutant is equivalent.\n const junit = report === null || !existsSync(report) ? null : isDirectory(report) ? A_DIRECTORY : !isFile(report) ? NOT_A_FILE : readJUnit(await readFile(report, 'utf8'));\n const judged = classify(probe, { exitCode: run.exitCode, output: run.output, junit });\n // After whatever `classify` says of the run: red, green or stopped, it\n // is judged by its shell, and what it left is said beside the verdict.\n classified.push(run.outputHeld ? { ...judged, detail: `${judged.detail}${LEFT_RUNNING}` } : judged);\n }\n return classified;\n}\n\nexport async function probeCommand(options: Options, io: CliIO): Promise<number> {\n const workspace = await openWorkspace(options, io);\n const { brief } = await targetBrief(workspace, options, io, options.positionals[0]);\n const text = await briefText(workspace, brief);\n const set = readProbes(reader.codeBlocks(text));\n if (set.problems.length > 0) {\n for (const problem of set.problems) io.stderr.write(`spec-harness: ${brief.file}:${problem.line}: ${problem.message}\\n`);\n return EXIT_ERROR;\n }\n const probes = set.probes.filter((probe) => options.id === undefined || probe.id === options.id);\n if (probes.length === 0) {\n io.stdout.write(`brief ${brief.id} declares no probe${options.id === undefined ? '' : ` named ${options.id}`}\\n`);\n return options.id === undefined ? EXIT_OK : EXIT_ERROR;\n }\n const base = await resolveBase(workspace, options.base);\n if (base.kind === 'unresolved') throw new UsageError(base.reason);\n const at = options.at ?? (base.mergeBase === base.head ? 'base' : 'both');\n const results: ProbeResult[] = [];\n const measure = async (label: 'base' | 'head', commit: string, expected: 'red' | 'green'): Promise<void> => {\n await withWorktree(workspace.root, commit, async (directory) => {\n for (const file of set.files) {\n await mkdir(dirname(join(directory, file.path)), { recursive: true });\n await writeFile(join(directory, file.path), file.content.endsWith('\\n') ? file.content : `${file.content}\\n`);\n }\n const setups = [...new Set(probes.map((probe) => probe.setup).filter((setup): setup is string => setup !== null))];\n for (const setup of setups) {\n const timeout = workspace.config.probes.timeout;\n const run = await runCommand(setup, directory, timeout);\n // A setup stopped at its timeout has no exit code to have failed by,\n // and may have printed nothing: how long it was given is the reason.\n const how = run.exitCode === null ? `was stopped after ${timeout} seconds` : 'failed';\n if (run.exitCode !== 0) throw new UsageError(`the probe setup \"${setup}\" ${how} at ${label}${run.outputHeld ? LEFT_RUNNING : ''}:\\n${endOfOutput(run.output)}`);\n // A setup that passed says nothing else, and the runs after it start\n // beside what it left: on the standard error, whatever the format,\n // since the document has no place for a setup.\n if (run.outputHeld) io.stderr.write(`spec-harness: the probe setup \"${setup}\" passed at ${label}${LEFT_RUNNING}\\n`);\n }\n for (const probe of probes) {\n const runs = await runProbe(directory, probe, probe.runs ?? workspace.config.probes.runs, probe.timeout ?? workspace.config.probes.timeout);\n results.push({ probe, at: label, commit, expected, runs, verdict: verdictOf(expected, runs) });\n }\n });\n };\n if (at === 'base' || at === 'both') await measure('base', base.mergeBase, 'red');\n if (at === 'head' || at === 'both') await measure('head', base.head, 'green');\n const evidence = renderEvidence(results, set.hash, new Date().toISOString().slice(0, 10));\n const failed = results.filter((result) => result.verdict !== (result.expected === 'red' ? 'measured' : 'fixed'));\n if (options.format === 'json') {\n io.stdout.write(\n json('probe', {\n ok: failed.length === 0,\n brief: brief.id,\n hash: set.hash,\n results: results.map((result) => ({ id: result.probe.id, at: result.at, commit: result.commit, expected: result.expected, verdict: result.verdict, runs: result.runs })),\n evidence,\n }),\n );\n } else {\n io.stdout.write(`${evidence}\\n`);\n // On the standard error, beside the table and never in it: the table is\n // what a brief records and a script reads. The JSON document has the\n // same as a field of each such run, and so says nothing here.\n io.stderr.write(renderUnexplained(results));\n }\n return failed.length === 0 ? EXIT_OK : EXIT_FAILED;\n}\n"]}
package/dist/config.d.ts CHANGED
@@ -44,14 +44,28 @@ export interface HarnessConfig {
44
44
  };
45
45
  /** The command for each sibling tool, or `null` to find it (ADR-0002). */
46
46
  readonly tools: Readonly<Record<SiblingName, readonly string[] | null>>;
47
+ /**
48
+ * Whether Claude Code's hook reports, at the end of each turn, the changed
49
+ * paths the brief protects or that are outside its scope; off by default,
50
+ * and `init` writes the entry that runs it only where it is on (ADR-0005).
51
+ */
52
+ readonly turnReport: boolean;
47
53
  }
48
54
  export type SiblingName = 'spec-brief' | 'spec-graph' | 'spec-guard';
49
55
  export declare const SIBLINGS: readonly SiblingName[];
50
56
  export declare const CONFIG_FILE = ".spec-harness.json";
57
+ /** spec-brief's configuration files, in the order spec-brief looks for them in a directory. */
58
+ export declare const SPEC_BRIEF_CONFIGS: readonly string[];
51
59
  export declare const DEFAULT_MANIFESTS: readonly string[];
52
60
  export declare const DEFAULT_CONFIG: HarnessConfig;
53
61
  export declare class ConfigError extends Error {
54
- constructor(message: string);
62
+ /**
63
+ * The configuration file that did not load, where one stands at its path:
64
+ * the one file a write may still reach while it does not (ADR-0005).
65
+ * `null` for a configuration that was not read from a file.
66
+ */
67
+ readonly file: string | null;
68
+ constructor(message: string, file?: string | null);
55
69
  }
56
70
  /** Validates a parsed configuration and fills in every default. */
57
71
  export declare function parseConfig(raw: unknown, file?: string): HarnessConfig;
package/dist/config.js CHANGED
@@ -9,6 +9,8 @@
9
9
  import { templateError } from './branch.js';
10
10
  export const SIBLINGS = ['spec-brief', 'spec-graph', 'spec-guard'];
11
11
  export const CONFIG_FILE = '.spec-harness.json';
12
+ /** spec-brief's configuration files, in the order spec-brief looks for them in a directory. */
13
+ export const SPEC_BRIEF_CONFIGS = ['.spec-brief.json', 'spec-brief.json'];
12
14
  export const DEFAULT_MANIFESTS = [
13
15
  'package.json',
14
16
  'Cargo.toml',
@@ -31,11 +33,19 @@ export const DEFAULT_CONFIG = {
31
33
  assertions: { premises: ['The Defect, Measured', 'Premises', 'Preconditions'] },
32
34
  probes: { runs: 2, timeout: 600 },
33
35
  tools: { 'spec-brief': null, 'spec-graph': null, 'spec-guard': null },
36
+ turnReport: false,
34
37
  };
35
38
  export class ConfigError extends Error {
36
- constructor(message) {
39
+ /**
40
+ * The configuration file that did not load, where one stands at its path:
41
+ * the one file a write may still reach while it does not (ADR-0005).
42
+ * `null` for a configuration that was not read from a file.
43
+ */
44
+ file;
45
+ constructor(message, file = null) {
37
46
  super(message);
38
47
  this.name = 'ConfigError';
48
+ this.file = file;
39
49
  }
40
50
  }
41
51
  function isObject(value) {
@@ -66,7 +76,7 @@ function nonEmpty(value, where) {
66
76
  export function parseConfig(raw, file = CONFIG_FILE) {
67
77
  if (!isObject(raw))
68
78
  throw new ConfigError(`${file} must hold a JSON object`);
69
- checkKeys(raw, ['$schema', 'branches', 'outOfScope', 'base', 'rulings', 'dependencies', 'context', 'assertions', 'probes', 'tools'], file);
79
+ checkKeys(raw, ['$schema', 'branches', 'outOfScope', 'base', 'rulings', 'dependencies', 'context', 'assertions', 'probes', 'tools', 'turnReport'], file);
70
80
  let branches = DEFAULT_CONFIG.branches;
71
81
  if (raw['branches'] !== undefined) {
72
82
  if (!isStringList(raw['branches']) || raw['branches'].length === 0) {
@@ -166,6 +176,9 @@ export function parseConfig(raw, file = CONFIG_FILE) {
166
176
  tools[name] = command;
167
177
  }
168
178
  }
169
- return { branches, outOfScope, base, rulings, dependencies, context, assertions, probes, tools };
179
+ const turnReport = raw['turnReport'] ?? DEFAULT_CONFIG.turnReport;
180
+ if (typeof turnReport !== 'boolean')
181
+ throw new ConfigError(`${file}: "turnReport" must be true or false`);
182
+ return { branches, outOfScope, base, rulings, dependencies, context, assertions, probes, tools, turnReport };
170
183
  }
171
184
  //# sourceMappingURL=config.js.map