@scopebond/hook 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +27 -1
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +116 -15
  4. package/dist/cli.js.map +1 -1
  5. package/dist/cloud.d.ts +24 -2
  6. package/dist/cloud.d.ts.map +1 -1
  7. package/dist/cloud.js +77 -9
  8. package/dist/cloud.js.map +1 -1
  9. package/dist/delivery-report.d.ts +16 -0
  10. package/dist/delivery-report.d.ts.map +1 -0
  11. package/dist/delivery-report.js +51 -0
  12. package/dist/delivery-report.js.map +1 -0
  13. package/dist/delivery-state.d.ts +30 -0
  14. package/dist/delivery-state.d.ts.map +1 -0
  15. package/dist/delivery-state.js +86 -0
  16. package/dist/delivery-state.js.map +1 -0
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/install.d.ts.map +1 -1
  22. package/dist/install.js +8 -2
  23. package/dist/install.js.map +1 -1
  24. package/dist/managed.d.ts +3 -1
  25. package/dist/managed.d.ts.map +1 -1
  26. package/dist/managed.js +50 -4
  27. package/dist/managed.js.map +1 -1
  28. package/dist/obs-emitter.d.ts.map +1 -1
  29. package/dist/obs-emitter.js +2 -2
  30. package/dist/obs-emitter.js.map +1 -1
  31. package/dist/policy-sync.d.ts.map +1 -1
  32. package/dist/policy-sync.js +6 -2
  33. package/dist/policy-sync.js.map +1 -1
  34. package/dist/proof.d.ts +1 -1
  35. package/dist/proof.d.ts.map +1 -1
  36. package/dist/proof.js +2 -1
  37. package/dist/proof.js.map +1 -1
  38. package/dist/recover.d.ts +33 -0
  39. package/dist/recover.d.ts.map +1 -0
  40. package/dist/recover.js +201 -0
  41. package/dist/recover.js.map +1 -0
  42. package/dist/runtime.d.ts +2 -0
  43. package/dist/runtime.d.ts.map +1 -1
  44. package/dist/runtime.js +12 -2
  45. package/dist/runtime.js.map +1 -1
  46. package/dist/version.d.ts +4 -4
  47. package/dist/version.d.ts.map +1 -1
  48. package/dist/version.js +5 -5
  49. package/dist/version.js.map +1 -1
  50. package/package.json +3 -3
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,+EAA+E;AAC/E,gDAAgD;AAChD,EAAE;AACF,sFAAsF;AACtF,wFAAwF;AACxF,oCAAoC;AACpC,EAAE;AACF,qDAAqD;AACrD,kEAAkE;AAElE,uFAAuF;AACvF,uFAAuF;AACvF,yFAAyF;AACzF,wFAAwF;AACxF,wFAAwF;AACxF,CAAC;IACC,MAAM,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACzD,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;QAChC,IAAI,OAAO,CAAC,IAAI,KAAK,qBAAqB,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YAAE,OAAO;QACtF,KAAK,MAAM,OAAO,IAAI,mBAAmB;YAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjG,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,O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AAC;IAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC","sourcesContent":["#!/usr/bin/env node\n// scopebond-hook — govern a coding agent's tool calls against policy, in-path,\n// before they run, with a signed local receipt.\n//\n// The command list, arguments and examples live in `COMMANDS` near the bottom of this\n// file, which is what `scopebond-hook help [command]` prints — one source rather than a\n// comment here that drifts from it.\n//\n// Config dir: $SCOPEBOND_HOOK_DIR, else ./.scopebond\n// Fail-closed: any error denies the action with a repair message.\n\n// `node:sqlite` (the receipt store) is still flagged experimental on Node 22, and Node\n// prints a warning on stderr the first time it loads — on every `verify`, and into the\n// agent's transcript on every hook call. It is a notice about Node, not about the user's\n// setup, so it is dropped; every other warning still prints through Node's own handler.\n// (The store is required lazily, after this module has run, so the filter is in place.)\n{\n const nodeWarningHandlers = process.listeners(\"warning\");\n process.removeAllListeners(\"warning\");\n process.on(\"warning\", (warning) => {\n if (warning.name === \"ExperimentalWarning\" && /sqlite/i.test(warning.message)) return;\n for (const handler of nodeWarningHandlers) handler.call(process, warning);\n });\n}\n\nimport { readFileSync, writeFileSync, existsSync, mkdtempSync, rmSync, statSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { hostname, tmpdir } from \"node:os\";\nimport { execFileSync } from \"node:child_process\";\nimport type { CloudEnrollmentBundle } from \"@scopebond/gateway\";\nimport { verifyReceipt } from \"@scopebond/gateway\";\nimport { openReceiptStore, loadOrCreateAttester } from \"@scopebond/gateway/node\";\nimport { callRequestOf, keyedIdFor, TYPED_ACTION_TYPES } from \"./typed-ops.js\";\nimport { databaseGuardActions } from \"./typed-infra.js\";\nimport { mapClaudeToolUse, mapCodexToolUse, mapCursorEvent, fillPushBranch, type Mapped } from \"./map.js\";\nimport { createHookRuntime, type Decision } from \"./runtime.js\";\nimport { useDigestKey, loadOrCreateDigestKey } from \"./minimize.js\";\nimport { scaffold, harnessSnippet, placeHook, type HookPlacement } from \"./init.js\";\nimport {\n userHome, userHarnessFile, resolveConfigDir, writeHarnessConfig, removeHarnessConfig,\n cursorDetected, codexDetected, absoluteHookCommand, isHarnessConfigured, purgeHome, type Harness,\n harnessScopes, harnessScopeLabel, configuredHookCommands, hookCommandResolves, projectHarnessFile,\n localHarnessFile, gitShareState, isMachineSpecificCommand, trustProjectPolicy, untrustedProjectPolicy, isTrustedProject,\n wireLifecycleHooks, unwireLifecycleHooks,\n} from \"./install.js\";\nimport {\n openObservations, describeObservations, observationStatus, stopReasonFromClaude, exitFromClaudeFailure,\n HEARTBEAT_INTERVAL_MS, OBSERVATIONS_SCOPE, type ObservationEmitter,\n} from \"./obs-emitter.js\";\nimport { OBSERVATION_DB, ObservationStore } from \"./obs-store.js\";\nimport { loadOrCreateBindingKey } from \"./observation.js\";\nimport { uploadPending } from \"./obs-upload.js\";\nimport { connectCloud, loadConnection, connectionPath } from \"./cloud.js\";\nimport { loadPolicyExport, policyBuilds } from \"./policy-load.js\";\nimport { isManaged, readMeta, MANAGED_DOC_FILE } from \"./managed.js\";\nimport { syncIfDue, syncPolicy, type SyncOptions, type SyncOutcome } from \"./policy-sync.js\";\nimport { loadBudgetExport } from \"./budget-load.js\";\nimport { compile, defaultRules, describeRules, loadRules, saveRules, rulesPath, pathRuleFor } from \"./rules.js\";\nimport { createSigner } from \"@scopebond/sdk\";\nimport { runDispatchCommand } from \"./dispatch-cli.js\";\nimport { describeAction, type ExplainIntent } from \"./explain.js\";\nimport { ensureDurableRuntime, pinnedCliPath, isEphemeralPath } from \"./runtime-install.js\";\nimport { cliCommand, hookCommand, hookVersion } from \"./version.js\";\nimport { computeManifest, renderManifest } from \"./capabilities.js\";\nimport { runProofFixtures, loadProofs, saveProofs, proofPassed, deliverProofReceipts } from \"./proof.js\";\nimport { fileURLToPath } from \"node:url\";\n\n/** The current git branch in `cwd` (best-effort). A bare `git push` pushes it, so\n * the runtime fills it in before evaluating; on failure the ref stays absent and\n * the starter policy fails closed. */\nfunction currentBranch(cwd: string): string | null {\n try {\n return execFileSync(\"git\", [\"-C\", cwd, \"symbolic-ref\", \"--quiet\", \"--short\", \"HEAD\"], {\n encoding: \"utf8\", stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim() || null;\n } catch { return null; }\n}\n\n/** Read an enrollment bundle from a file path, an inline base64 blob, or inline raw\n * JSON (the portal hands out a base64 blob so it is one clean argument). */\nfunction readBundleArg(bundleArg: string | undefined, stdin: () => string): CloudEnrollmentBundle {\n let text: string;\n if (!bundleArg) text = stdin();\n else if (existsSync(bundleArg)) text = readFileSync(bundleArg, \"utf8\");\n else if (bundleArg.trim().startsWith(\"{\")) text = bundleArg;\n else { try { text = Buffer.from(bundleArg, \"base64\").toString(\"utf8\"); } catch { text = bundleArg; } }\n return JSON.parse(text) as CloudEnrollmentBundle;\n}\n\nfunction configDir(): string {\n return process.env.SCOPEBOND_HOOK_DIR ?? join(process.cwd(), \".scopebond\");\n}\nfunction runtimePaths(dir: string, cwd?: string) {\n const connection = loadConnection(dir);\n return {\n policyPath: join(dir, \"policy.json\"),\n keyPath: join(dir, \"agent.key\"),\n attesterPath: join(dir, \"attester.key\"),\n dbPath: join(dir, \"receipts.db\"),\n ...(cwd ? { cwd } : {}),\n // Strict: deny (not just observe) tools with no taxonomy mapping.\n strict: process.argv.includes(\"--strict\") || process.env.SCOPEBOND_HOOK_STRICT === \"1\",\n // When connected, auto-export receipts. A short bounded flush keeps the hot path\n // fast; undelivered receipts persist in the durable outbox and flush next time\n // (or via `scopebond-hook flush`, e.g. on a session-end hook).\n ...(connection ? { cloud: { connection, flushTimeoutMs: Number(process.env.SCOPEBOND_HOOK_FLUSH_MS ?? 800) } } : {}),\n };\n}\n/** The harness's own id for this tool call, when it gives one (Claude Code and Codex send\n * `tool_use_id`), so the receipts of one call share a stable action group. */\nfunction callId(input: Record<string, unknown>): string | undefined {\n for (const key of [\"tool_use_id\", \"tool_call_id\", \"call_id\"]) {\n const value = input?.[key];\n if (typeof value === \"string\" && value !== \"\") return value;\n }\n return undefined;\n}\nfunction readStdin(): string {\n try { return readFileSync(0, \"utf8\"); } catch { return \"\"; }\n}\n\nfunction denyClaude(reason: string): never {\n process.stdout.write(JSON.stringify({\n hookSpecificOutput: { hookEventName: \"PreToolUse\", permissionDecision: \"deny\", permissionDecisionReason: reason },\n }) + \"\\n\");\n // A composed explanation already names Scopebond in its first line; only the\n // bare internal messages need the prefix.\n process.stderr.write(`${reason.startsWith(\"Scopebond\") ? reason : `Scopebond: ${reason}`}\\n`);\n process.exit(2);\n}\n\n/** Codex accepts the structured deny response on a successful hook exit. Keeping\n * exit 0 lets its UI show a completed policy check instead of a failed hook while\n * still preventing the tool call. */\nfunction denyCodex(reason: string): never {\n process.stdout.write(JSON.stringify({\n hookSpecificOutput: { hookEventName: \"PreToolUse\", permissionDecision: \"deny\", permissionDecisionReason: reason },\n }) + \"\\n\");\n process.exit(0);\n}\n\nconst harnessName = (harness: Harness): string => harness === \"claude\" ? \"Claude Code\" : harness === \"cursor\" ? \"Cursor\" : \"Codex\";\nconst harnessFileName = (harness: Harness): string => harness === \"claude\" ? \".claude/settings.json\" : harness === \"cursor\" ? \".cursor/hooks.json\" : \".codex/hooks.json\";\nconst selectedHarness = (args: string[]): Harness => args.includes(\"--codex\") ? \"codex\" : args.includes(\"--cursor\") ? \"cursor\" : \"claude\";\nconst codexTrustStep = \"Open Codex, run `/hooks`, review Scopebond, and choose Trust. Then start a new task.\";\n/** What Cursor can and cannot stop. Cursor has before-hooks for shell commands, MCP\n * calls and file reads, but reports file *edits* only after they are written, so an\n * out-of-policy edit is recorded and flagged rather than prevented. Said at install\n * time, because someone choosing a guardrail needs to know its edges up front. */\nconst cursorCoverageNote = [\n \"What this covers in Cursor:\",\n \" prevented shell commands, MCP tool calls, file reads — checked before they run\",\n \" recorded file edits — Cursor reports an edit only after writing it, so an\",\n \" out-of-policy edit is signed and flagged, not blocked\",\n \"For edits that must be blocked before they land, use the GitHub Action as a required\",\n \"check on pull requests.\",\n].join(\"\\n\");\n\n/** Record what was dispatched as observations, when this workspace enrolled for them. Purely\n * additive: it runs after the decision is made and can neither change it nor fail it. */\nfunction recordObservations(dir: string, cwd: string, input: Record<string, unknown>, decision: Decision, harness: Harness): ObservationEmitter | undefined {\n try {\n const { emitter } = openObservations(dir, { adapterVersion: hookVersion() });\n if (!emitter) return undefined;\n const sessionId = typeof input.session_id === \"string\" && input.session_id !== \"\" ? input.session_id : undefined;\n // Session lifecycle is Claude Code only: its SessionStart/SessionEnd hooks are the ones\n // the tested mapping covers. Other hosts still get tool intents from their PreToolUse.\n if (harness === \"claude\" && sessionId) emitter.activity(sessionId, cwd);\n emitter.toolIntents({ harnessSessionId: sessionId, callId: callId(input), cwd, dispatched: decision.dispatched ?? [], request: callRequestOf(input) });\n return emitter;\n } catch { return undefined; }\n}\n\n/** The remote-database actions of a shell call, only when the rule set opts in (`protect_remote_database`).\n * They are extra evaluated intents read from the raw command, so the deny happens before it runs. */\nfunction databaseGuard(dir: string, cwd: string, input: Record<string, unknown>): Mapped[] {\n let enabled = false;\n try { enabled = loadRules(dir)?.protect_remote_database === true; } catch { return []; }\n if (!enabled) return [];\n const request = callRequestOf(input);\n if (request?.command === undefined) return [];\n const intent = (params: Record<string, unknown>): Mapped => ({ intent: { action_type: \"db.exec\", params }, evaluated: true, source: \"shell\" });\n try {\n return databaseGuardActions(request.command, request.dialect ?? \"posix\", { cwd }).map((action) => intent({ ...action }));\n } catch {\n // The rule is on and the reader failed: a command that names a database tool is not waved through.\n return /(?:wrangler|psql)/i.test(request.command) ? [intent({ provider: \"unknown\", verb: \"unknown\", scope: \"unknown\", risk: \"unknown\" })] : [];\n }\n}\n\nasync function runPreToolUse(mapper: (input: Record<string, unknown>) => Mapped[], deny: (reason: string) => never = denyClaude, raw?: string, harness: Harness = \"claude\"): Promise<void> {\n let input: Record<string, unknown>;\n try { input = JSON.parse(raw ?? readStdin()); } catch { deny(\"hook received invalid JSON on stdin\"); }\n let runtime: ReturnType<typeof createHookRuntime> | undefined;\n try {\n const cwd = input?.cwd ? String(input.cwd) : process.cwd();\n const dir = resolveConfigDir(cwd);\n runtime = createHookRuntime(runtimePaths(dir, cwd));\n useDigestKey(loadOrCreateDigestKey(dir));\n const decision = await runtime.evaluate([...fillPushBranch(mapper(input!), currentBranch(cwd)), ...databaseGuard(dir, cwd, input!)], { groupKey: callId(input!) });\n const observer = recordObservations(dir, cwd, input!, decision, harness);\n // Workspace rules: at most every five minutes, a capped check alongside the record delivery. It never fails the call.\n await Promise.all([runtime.flush(), observer?.flush() ?? Promise.resolve(), syncIfDue(dir, () => syncOptionsFor(dir))]);\n observer?.close();\n // Close before deciding: the receipt is already committed, and leaving the handle\n // open is what made the write-ahead log grow without bound.\n runtime.close();\n runtime = undefined;\n if (decision.decision === \"deny\") deny(decision.reason);\n // Stay silent on allow/not_evaluated so the coding agent's normal permission\n // flow remains in charge. Scopebond blocks; it never silently approves.\n process.exit(0);\n } catch (error) {\n try { runtime?.close(); } catch { /* already failing; the deny below is what matters */ }\n deny(`Scopebond hook failed closed: ${(error as Error).message}. Repair: run \\`${cliCommand(\"init\")}\\`.`);\n }\n}\n\n/** Claude Code events other than PreToolUse: session start and end, and the after-action\n * events. They only feed observations; they never print a decision and always exit 0. */\nasync function runClaudeLifecycle(input: Record<string, unknown>): Promise<never> {\n try {\n const cwd = input.cwd ? String(input.cwd) : process.cwd();\n const { emitter } = openObservations(resolveConfigDir(cwd), { adapterVersion: hookVersion() });\n const sessionId = typeof input.session_id === \"string\" && input.session_id !== \"\" ? input.session_id : undefined;\n if (emitter) {\n try {\n switch (input.hook_event_name) {\n case \"SessionStart\": if (sessionId) emitter.sessionStart(sessionId, cwd); break;\n case \"SessionEnd\": if (sessionId) emitter.sessionStop(sessionId, stopReasonFromClaude(input.reason)); break;\n case \"PostToolUse\": { const id = callId(input); if (id) emitter.toolOutcomes(sessionId, id, \"ok\"); break; }\n case \"PostToolUseFailure\": { const id = callId(input); if (id) emitter.toolOutcomes(sessionId, id, exitFromClaudeFailure(input.is_interrupt)); break; }\n }\n await emitter.flush(input.hook_event_name === \"SessionEnd\" ? 1500 : 800);\n } finally { emitter.close(); }\n }\n } catch { /* observations are best effort; nothing here may affect the agent */ }\n process.exit(0);\n}\n\nconst CLAUDE_OBSERVATION_EVENTS = new Set([\"SessionStart\", \"SessionEnd\", \"PostToolUse\", \"PostToolUseFailure\"]);\n\nasync function runClaude(): Promise<void> {\n const raw = readStdin();\n let event: unknown; let input: Record<string, unknown> | undefined;\n try { input = JSON.parse(raw) as Record<string, unknown>; event = input?.hook_event_name; } catch { /* PreToolUse reports invalid input */ }\n if (input && typeof event === \"string\" && CLAUDE_OBSERVATION_EVENTS.has(event)) await runClaudeLifecycle(input);\n await runPreToolUse(mapClaudeToolUse, denyClaude, raw, \"claude\");\n}\n\nasync function runCodex(): Promise<void> {\n await runPreToolUse(mapCodexToolUse, denyCodex, undefined, \"codex\");\n}\n\nfunction denyCursor(reason: string): never {\n process.stdout.write(JSON.stringify({ permission: \"deny\", agentMessage: reason }) + \"\\n\");\n process.exit(0);\n}\n\nasync function runCursor(): Promise<void> {\n // Unparseable input denies, like every other adapter. Previously this fell through\n // to evaluation with an empty payload, which mapped to no known action and so\n // answered \"ask\" — handing an unreadable request to a prompt the user would very\n // likely accept. Deny-by-default on unparseable input is not optional.\n let parsed: unknown;\n try { parsed = JSON.parse(readStdin()); } catch { denyCursor(\"Scopebond: hook received invalid JSON on stdin\"); }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n denyCursor(\"Scopebond: hook received a payload that is not a JSON object\");\n }\n const input = parsed as Record<string, unknown>;\n const event = String(input.hook_event_name ?? input.event ?? process.argv[3] ?? \"\");\n let permission: \"allow\" | \"deny\" | \"ask\" = \"deny\";\n let message = \"Scopebond hook failed closed\";\n let postHoc = false;\n let runtime: ReturnType<typeof createHookRuntime> | undefined;\n try {\n const cwd = input?.cwd ? String(input.cwd) : process.cwd();\n const dir = resolveConfigDir(cwd);\n runtime = createHookRuntime(runtimePaths(dir, cwd));\n useDigestKey(loadOrCreateDigestKey(dir));\n const mapped = fillPushBranch(mapCursorEvent(event, input), currentBranch(cwd));\n const decision = await runtime.evaluate(mapped, { groupKey: callId(input) });\n const observer = recordObservations(dir, cwd, input, decision, \"cursor\");\n await Promise.all([runtime.flush(), observer?.flush() ?? Promise.resolve(), syncIfDue(dir, () => syncOptionsFor(dir))]);\n observer?.close();\n // An `afterFileEdit` violation is real and recorded, but the edit has already\n // landed. Say so rather than letting \"blocked\" imply it was stopped.\n postHoc = mapped.some((m) => m.postHoc);\n // Three outcomes, three answers:\n // deny — out of policy, blocked outright.\n // allow — a rule was evaluated and permitted it. Returning \"ask\" here put a\n // confirmation prompt in front of every ordinary command, which is not\n // \"your agent works as normal\"; it also trained people to click through\n // prompts, which makes the real denials easier to miss. An evaluated\n // allow is a decision, not a silent auto-approval.\n // ask — nothing was evaluated (no rule covers this action), so Cursor's own\n // permission flow stays in charge. That is the fail-closed case and it\n // keeps its prompt.\n permission = decision.decision === \"deny\" ? \"deny\" : decision.decision === \"allow\" ? \"allow\" : \"ask\";\n message = decision.reason;\n } catch (error) {\n permission = \"deny\";\n message = `Scopebond hook failed closed: ${(error as Error).message}. Repair: run \\`${cliCommand(\"init\")}\\`.`;\n } finally {\n // Release the SQLite handles on every path: an unclosed writer leaves its\n // write-ahead log behind for the next tool call to extend.\n try { runtime?.close(); } catch { /* the decision is already recorded */ }\n }\n if (postHoc && permission === \"deny\") {\n message = `${message}\\nCursor reports a file edit only after it is written, so this edit was not prevented. Review and revert it yourself.`;\n }\n process.stdout.write(JSON.stringify({ permission, agentMessage: message }) + \"\\n\");\n process.exit(0);\n}\n\n/** `init`, `trust` and `uninstall` change what governs the agent, so they are for a\n * person at a terminal. A coding agent's shell is not interactive: without a TTY on\n * stdin they refuse unless `--yes` is passed (for scripts and CI). The starter policy\n * also denies the agent running them. */\nfunction requireInteractive(command: string, args: string[]): void {\n if (process.stdin.isTTY || args.includes(\"--yes\")) return;\n console.error(`scopebond ${command} changes what governs your coding agent, so it does not run unattended.`);\n console.error(`There is no terminal on stdin here — which is also what it looks like when the agent itself`);\n console.error(`tries to run this, so the refusal is deliberate rather than a bug.`);\n console.error(``);\n console.error(`If you are a person: run it in your own terminal, or confirm it now with --yes:`);\n console.error(` ${cliCommand(`${command} --yes`)}`);\n console.error(`Scripts, CI and container builds should always pass --yes.`);\n process.exit(1);\n}\n\nfunction runInit(args: string[]): void {\n const harness = selectedHarness(args);\n const dir = configDir();\n // A dry run changes nothing, so it needs no terminal and no --yes.\n if (args.includes(\"--dry-run\")) {\n const shared = projectHarnessFile(harness, process.cwd());\n const local = localHarnessFile(harness, process.cwd());\n const personal = args.includes(\"--shared\") || args.includes(\"--npx\") ? null\n : local ?? (gitShareState(shared) === \"tracked\" ? null : shared);\n console.log(`Dry run — nothing is written.\\n`);\n console.log(`Would scaffold ${dir} (machine key, countersigning key, starter policy, .gitignore)`);\n if (args.includes(\"--no-install\")) {\n console.log(`Would print the ${harnessFileName(harness)} snippet instead of writing it`);\n } else if (personal) {\n console.log(`Would configure ${personal} (this machine only; kept out of git)`);\n console.log(` adding hook \"<node>\" \"${pinnedCliPath(hookVersion())}\" ${harness}`);\n console.log(` (or the path this copy runs from, when it is already installed durably)`);\n if (local) console.log(` and remove any machine-specific Scopebond entry from ${shared}`);\n } else {\n console.log(`Would configure ${shared} (shared — safe to commit)`);\n console.log(` adding hook ${hookCommand(harness)}`);\n }\n console.log(`\\nNothing else in those files is changed. Run without --dry-run to apply.`);\n process.exit(0);\n }\n requireInteractive(\"init\", args);\n const { agentKid, policyPath, rulesPath: rulesFile } = scaffold(dir, { force: args.includes(\"--force\") });\n console.log(`Scopebond hook enrolled in ${dir}`);\n console.log(` machine key ${agentKid}`);\n console.log(` rules ${rulesFile} (the readable list — edit this)`);\n console.log(` policy ${policyPath} (compiled from the rules; don't hand-edit)`);\n // With a user-level install present, a project policy governs only once trusted.\n // Running init here is that decision, so pin this policy now.\n if (!process.env.SCOPEBOND_HOOK_DIR && existsSync(join(userHome(), \"policy.json\"))) {\n trustProjectPolicy(dir);\n console.log(` trusted overrides ${userHome()} here; after editing it, run \\`${cliCommand(\"trust\")}\\``);\n }\n // The hook command runs once per tool call, so it must start fast. `npx` re-resolves\n // a package that is already on disk and costs ~830 ms a call; the same CLI invoked\n // directly costs ~110 ms. Pin a durable copy and use that, and fall back to `npx`\n // (slow, but it always starts) when no durable copy can be made. `--npx` forces the\n // portable form for anyone who wants it.\n const shared = args.includes(\"--shared\");\n const pin = args.includes(\"--npx\") || shared ? { cli: null, how: \"unavailable\" as const } : ensureDurableRuntime(cliPath(), hookVersion());\n const command = pin.cli ? absoluteHookCommand(pin.cli, harness) : undefined;\n // Configure the agent automatically by default (idempotent), so there is no\n // hand-editing step; --no-install prints the snippet instead.\n if (!args.includes(\"--no-install\")) {\n let placed: HookPlacement;\n try { placed = placeHook(harness, process.cwd(), command, { shared }); } catch (error) { console.error((error as Error).message); process.exit(1); }\n // No per-action millisecond claim here: it varies by machine, and this project only\n // states numbers it has measured. The measured comparison lives in the changelog.\n console.log(` hook runtime ${placed.scope === \"personal\"\n ? `${pin.cli}\\n pinned — no npx resolution per action`\n : `npx @scopebond/hook@${hookVersion()} — portable, but re-resolves on every action`}`);\n console.log(\"\");\n console.log(`✓ ${harnessName(harness)} configured in ${placed.file}`);\n console.log(placed.scope === \"personal\"\n ? ` this machine only — kept out of git, so no teammate inherits a path that does not exist for them`\n : ` shared — the portable command starts on any machine that clones this project`);\n if (placed.repaired > 0) console.log(` moved a machine-specific hook out of ${projectHarnessFile(harness, process.cwd())}; commit that change`);\n if (placed.note) console.log(` note: ${placed.note}`);\n if (harness === \"codex\") console.log(`\\nOne last step: ${codexTrustStep}`);\n if (harness === \"cursor\") console.log(`\\n${cursorCoverageNote}`);\n } else {\n // The snippet is for a file the user will likely commit, so it carries the portable\n // command; the pinned one is offered separately, for a file only this machine uses.\n console.log(`Add this to your ${harnessFileName(harness)}:`);\n console.log(harnessSnippet(harness));\n const local = localHarnessFile(harness, process.cwd());\n if (command && local) {\n console.log(`\\nFaster, for this machine only — use this command in ${local} instead (keep that file out of git):`);\n console.log(` ${command}`);\n }\n if (harness === \"cursor\") console.log(`\\n${cursorCoverageNote}`);\n }\n console.log(\"\");\n // Print the runnable `npx` form: after `npx @scopebond/hook init` there is no\n // `scopebond-hook` binary on PATH, so a bare `scopebond-hook log` would fail.\n console.log(`Next: run one command in the agent, then \\`${cliCommand(\"log\")}\\` to see the receipt`);\n console.log(`and \\`${cliCommand(\"verify\")}\\` to check it offline. Try \\`${cliCommand('test \"rm -rf /\"')}\\`.`);\n console.log(`To send receipts to a workspace: ${cliCommand(\"connect <workspace-url> <enrollment>\")}`);\n}\n\nfunction decisionOf(payload: Record<string, unknown>): string {\n const rr = String(payload.realtime_result ?? \"\");\n const state = String((payload.execution as Record<string, unknown> | undefined)?.state ?? \"\");\n if (state === \"observed_not_evaluated\") return \"not_evaluated\";\n if (rr === \"deny\") return state === \"cooperative_allow\" || state === \"executed\" ? \"monitor\" : \"deny\";\n return \"allow\";\n}\n\nfunction describeIntent(payload: Record<string, unknown>): string {\n return describeAction(payload.intent as ExplainIntent | undefined);\n}\n\n/** `log [-n N] [--deny] [--since <when>]` — the recent decisions.\n *\n * \"What did my agents get blocked on this week\" had no answer at the CLI: the only\n * output was an unfiltered tail. `--deny` and `--since` make it answerable, and the\n * tail is read as a tail (`ORDER BY id DESC LIMIT`) rather than by loading and parsing\n * every receipt ever recorded and slicing the end off. */\nasync function runLog(args: string[]): Promise<void> {\n const dir = resolveConfigDir(process.cwd());\n const dbPath = join(dir, \"receipts.db\");\n if (!existsSync(dbPath)) { console.log(\"no receipts yet — run a command in the agent first.\"); process.exit(0); }\n const nIdx = args.indexOf(\"-n\");\n const n = nIdx >= 0 ? Math.max(1, Number(args[nIdx + 1]) || 20) : 20;\n const denyOnly = args.includes(\"--deny\");\n const sinceIdx = args.indexOf(\"--since\");\n const since = sinceIdx >= 0 ? parseSince(args[sinceIdx + 1]) : null;\n if (sinceIdx >= 0 && since === null) {\n console.error(`--since wants a duration (7d, 24h, 30m) or a date (2026-09-25); got ${args[sinceIdx + 1] ?? \"nothing\"}`);\n process.exit(1);\n }\n const { store } = openReceiptStore({ db: dbPath });\n try {\n const total = store.count ? await Promise.resolve(store.count()) : (await Promise.resolve(store.list())).length;\n // A filter has to look past the last N to find N matches; without one, read only the\n // tail. The scan is still bounded so a huge log cannot hang the command.\n const budget = denyOnly || since ? Math.min(Math.max(n * 50, 1000), 20000) : n;\n const scanned = store.recent\n ? await Promise.resolve(store.recent(budget))\n : (await Promise.resolve(store.list())).slice(-budget).reverse();\n const matching = scanned.filter((r) => {\n const p = r.payload as unknown as Record<string, unknown>;\n if (denyOnly && decisionOf(p) !== \"deny\") return false;\n if (since) {\n const at = Date.parse(String(p.timestamp ?? \"\"));\n if (!Number.isFinite(at) || at < since) return false;\n }\n return true;\n });\n const shown = matching.slice(0, n).reverse(); // oldest-first on screen, newest last\n if (shown.length === 0) {\n console.log(denyOnly || since ? \"no receipts match that filter.\" : \"no receipts yet.\");\n process.exit(0);\n }\n for (const r of shown) {\n const p = r.payload as unknown as Record<string, unknown>;\n console.log(`${String(p.timestamp ?? \"\")} ${decisionOf(p).padEnd(13)} ${describeIntent(p)}`);\n }\n const filters = [denyOnly ? \"denied\" : \"\", since ? `since ${new Date(since).toISOString()}` : \"\"].filter(Boolean).join(\", \");\n const scope = filters ? ` matching ${filters}` : \"\";\n const capped = (denyOnly || since) && scanned.length >= budget && total > budget;\n console.log(`\\n${shown.length}${scope} of ${total} receipt(s)${capped ? ` — searched the most recent ${budget}` : \"\"}. Verify them: ${cliCommand(\"verify\")}`);\n } finally {\n try { store.close?.(); } catch { /* read-only */ }\n }\n}\n\n/** `rules` — read and change the limits in plain terms.\n *\n * Without this, \"edit the limits\" meant hand-writing a ~700-character case-folded\n * negative lookahead, which nobody does — so the starter policy was effectively the only\n * policy. The lists live in `.scopebond/rules.json`; `policy.json` is compiled from them. */\nfunction runRules(args: string[]): void {\n const dir = resolveConfigDir(process.cwd());\n if (!existsSync(join(dir, \"policy.json\"))) {\n console.error(`no policy here yet — run \\`${cliCommand(\"init\")}\\` first.`);\n process.exit(1);\n }\n const rules = loadRules(dir) ?? defaultRules();\n const [verb, ...values] = args.filter((a) => !a.startsWith(\"--\"));\n const value = values.join(\" \").trim();\n\n if (!verb || verb === \"show\") {\n console.log(`Rules for ${dir}`);\n if (!loadRules(dir)) console.log(`(showing the defaults — ${rulesPath(dir)} will be written on your first change)`);\n console.log(\"\");\n console.log(describeRules(rules));\n console.log(\"\");\n console.log(`Change them:`);\n console.log(` ${cliCommand(\"rules allow <program>\")} stop blocking a program`);\n console.log(` ${cliCommand(\"rules block <program>\")} start blocking one`);\n console.log(` ${cliCommand(\"rules protect <path>\")} never write there`);\n console.log(` ${cliCommand(\"rules unprotect <path>\")} allow writing there again`);\n console.log(` ${cliCommand(\"rules protect-branch <name>\")} never push there`);\n console.log(` ${cliCommand(\"rules unprotect-branch <name>\")}`);\n console.log(` ${cliCommand(\"rules protect-remote-database\")} block destructive or unreadable SQL on a remote database (off by default)`);\n console.log(`Or edit ${rulesPath(dir)} directly, then \\`${cliCommand(\"rules apply\")}\\`.`);\n process.exit(0);\n }\n\n const needsValue = [\"allow\", \"block\", \"protect\", \"unprotect\", \"protect-branch\", \"unprotect-branch\"];\n if (needsValue.includes(verb) && !value) {\n console.error(`\\`rules ${verb}\\` needs a value, e.g. \\`${cliCommand(`rules ${verb} ${verb.includes(\"branch\") ? \"production\" : verb.includes(\"protect\") ? \"infra/\" : \"dd\"}`)}\\``);\n process.exit(1);\n }\n\n let changed = \"\";\n switch (verb) {\n case \"allow\": {\n const before = rules.destructive_programs.length;\n rules.destructive_programs = rules.destructive_programs.filter((p) => p.toLowerCase() !== value.toLowerCase());\n if (rules.destructive_programs.length === before) { console.log(`${value} was not in the blocked list; nothing to change.`); process.exit(0); }\n changed = `${value} is no longer blocked`;\n break;\n }\n case \"block\": {\n if (rules.destructive_programs.some((p) => p.toLowerCase() === value.toLowerCase())) { console.log(`${value} is already blocked.`); process.exit(0); }\n rules.destructive_programs.push(value.toLowerCase());\n changed = `${value} is now blocked`;\n break;\n }\n case \"protect\": case \"unprotect\": {\n const list = verb === \"protect\" ? \"protected_write\" : \"protected_write\";\n const rule = pathRuleFor(value);\n if (verb === \"protect\") {\n if (rules[list].some((r) => r.label === rule.label)) { console.log(`${value} is already protected.`); process.exit(0); }\n rules[list].push(rule);\n changed = `writes to ${rule.label} are now blocked`;\n } else {\n const before = rules[list].length;\n rules[list] = rules[list].filter((r) => r.label !== rule.label && !r.label.startsWith(`${value.replace(/\\/$/, \"\")}/`));\n if (rules[list].length === before) {\n console.log(`${value} is not in the protected list. Current list:`);\n for (const r of rules[list]) console.log(` ${r.label}`);\n process.exit(1);\n }\n changed = `writes to ${value} are allowed again`;\n }\n break;\n }\n case \"protect-branch\": {\n if (rules.protected_branches.some((b) => b.toLowerCase() === value.toLowerCase())) { console.log(`${value} is already protected.`); process.exit(0); }\n rules.protected_branches.push(value);\n changed = `pushes to ${value} are now blocked`;\n break;\n }\n case \"unprotect-branch\": {\n const before = rules.protected_branches.length;\n rules.protected_branches = rules.protected_branches.filter((b) => b.toLowerCase() !== value.toLowerCase());\n if (rules.protected_branches.length === before) { console.log(`${value} was not protected; nothing to change.`); process.exit(0); }\n changed = `pushes to ${value} are allowed again`;\n break;\n }\n case \"protect-remote-database\":\n if (rules.protect_remote_database === true) { console.log(\"Remote databases are already protected.\"); process.exit(0); }\n rules.protect_remote_database = true;\n changed = \"remote SQL that drops, deletes or updates every row, or cannot be read, is now blocked\";\n break;\n case \"unprotect-remote-database\":\n if (rules.protect_remote_database !== true) { console.log(\"Remote databases were not protected; nothing to change.\"); process.exit(0); }\n delete rules.protect_remote_database;\n changed = \"remote SQL is no longer checked\";\n break;\n case \"apply\":\n changed = `recompiled from ${rulesPath(dir)}`;\n break;\n default:\n console.error(`unknown: rules ${verb}`);\n printHelp(\"rules\", true);\n process.exit(1);\n }\n\n if (isManaged(dir)) {\n console.error(\"The rules on this computer are set by your Scopebond workspace, so they cannot be changed here.\");\n console.error(\"Change them in the workspace (Rules), or disconnect this computer to manage its rules locally again.\");\n process.exit(1);\n }\n // Changing what governs the agent is the same class of action as `init`.\n requireInteractive(\"rules\", args);\n const policyPath = join(dir, \"policy.json\");\n const agentKid = createSigner({ privateKeyPem: readFileSync(join(dir, \"agent.key\"), \"utf8\") }).kid;\n saveRules(dir, rules);\n writeFileSync(policyPath, `${JSON.stringify(compile(rules, agentKid), null, 2)}\\n`);\n console.log(`✓ ${changed}`);\n console.log(` rules ${rulesPath(dir)}`);\n console.log(` policy ${policyPath} (recompiled)`);\n // A project policy governs only once trusted, and the hash just changed.\n if (!process.env.SCOPEBOND_HOOK_DIR && existsSync(join(userHome(), \"policy.json\"))) {\n trustProjectPolicy(dir);\n console.log(` trusted re-pinned for this project`);\n }\n console.log(`\\nCheck it: ${cliCommand('test \"rm -rf /\"')}`);\n process.exit(0);\n}\n\n/** `prune --before <when> [--yes]` — bound the local receipt store.\n *\n * Signed receipts are the product, so this never runs on its own and never quietly\n * destroys anything: it archives what it will remove to a JSONL file beside the\n * database first, and it refuses entirely once the log has been anchored, because a\n * receipt's position is its anchor leaf index. Without a `--before` it reports the\n * footprint and exits. */\nasync function runPrune(args: string[]): Promise<void> {\n const dir = resolveConfigDir(process.cwd());\n const dbPath = join(dir, \"receipts.db\");\n if (!existsSync(dbPath)) { console.log(\"no local receipts yet — nothing to prune.\"); process.exit(0); }\n const beforeIdx = args.indexOf(\"--before\");\n if (beforeIdx < 0) {\n console.log(`local receipts ${dbPath}`);\n console.log(` ${describeStore(dbPath)}`);\n console.log(`\\nNothing is removed automatically. To bound it, name a cutoff:`);\n console.log(` ${cliCommand(\"prune --before 90d\")} # older than 90 days`);\n console.log(` ${cliCommand(\"prune --before 2026-01-01\")}`);\n console.log(`Receipts are archived beside the database before removal.`);\n process.exit(0);\n }\n const cutoff = parseSince(args[beforeIdx + 1]);\n if (cutoff === null) {\n console.error(`--before wants a duration (90d, 24h) or a date (2026-01-01); got ${args[beforeIdx + 1] ?? \"nothing\"}`);\n process.exit(1);\n }\n const iso = new Date(cutoff).toISOString();\n const { store } = openReceiptStore({ db: dbPath });\n const sqlite = store as typeof store & {\n before?(iso: string): unknown[];\n removeBefore?(iso: string): { removed: number };\n };\n if (!sqlite.before || !sqlite.removeBefore) {\n console.error(\"this receipt store does not support pruning (no SQLite available).\");\n process.exit(1);\n }\n try {\n const doomed = sqlite.before(iso);\n if (doomed.length === 0) { console.log(`no receipts older than ${iso}.`); process.exit(0); }\n const before = describeStore(dbPath);\n console.log(`${doomed.length} receipt(s) recorded before ${iso} (store is currently ${before}).`);\n if (!args.includes(\"--yes\") && !process.stdin.isTTY) {\n console.error(`\\nThis removes signed evidence, so it needs an explicit confirmation:`);\n console.error(` ${cliCommand(`prune --before ${args[beforeIdx + 1]} --yes`)}`);\n process.exit(1);\n }\n const archive = join(dir, `receipts-archived-${new Date().toISOString().replace(/[:.]/g, \"-\")}.jsonl`);\n writeFileSync(archive, `${doomed.map((r) => JSON.stringify(r)).join(\"\\n\")}\\n`);\n console.log(`archived to ${archive}`);\n const { removed } = sqlite.removeBefore(iso);\n console.log(`removed ${removed} receipt(s)`);\n store.close?.();\n console.log(`store now ${describeStore(dbPath)}`);\n console.log(`\\nThe archive is a plain JSONL of signed receipts — still verifiable, still yours.`);\n process.exit(0);\n } catch (error) {\n try { store.close?.(); } catch { /* closing after a failure */ }\n console.error(`prune refused: ${(error as Error).message}`);\n process.exit(1);\n }\n}\n\n/** A `--since` value: a duration (`7d`, `24h`, `30m`) or an ISO-ish date. */\nexport function parseSince(value: string | undefined, now: number = Date.now()): number | null {\n if (!value) return null;\n const duration = /^(\\d+)\\s*([dhm])$/i.exec(value.trim());\n if (duration) {\n const scale = { d: 86_400_000, h: 3_600_000, m: 60_000 }[duration[2].toLowerCase() as \"d\" | \"h\" | \"m\"];\n return now - Number(duration[1]) * scale;\n }\n const at = Date.parse(value);\n return Number.isFinite(at) ? at : null;\n}\n\nasync function runVerify(): Promise<void> {\n const dir = resolveConfigDir(process.cwd());\n const dbPath = join(dir, \"receipts.db\");\n const attesterPath = join(dir, \"attester.key\");\n if (!existsSync(dbPath) || !existsSync(attesterPath)) { console.log(\"nothing to verify yet (no receipts or no attester key).\"); process.exit(0); }\n const { attester } = loadOrCreateAttester({ file: attesterPath });\n const { store } = openReceiptStore({ db: dbPath });\n // Verification is the one command that must read everything — that is the point of it.\n // It just should not look hung while doing so: at ~2.6 s per 20,000 receipts a long\n // history is a visible wait, so report progress on a TTY.\n const all = await Promise.resolve(store.list());\n try { store.close?.(); } catch { /* read-only */ }\n const progress = process.stdout.isTTY && all.length >= 2000;\n let ok = 0;\n const bad: string[] = [];\n for (const [index, r] of all.entries()) {\n const result = verifyReceipt(r, attester.publicKeyPem) as unknown as Record<string, boolean>;\n if (result.valid) ok += 1;\n else {\n const failed = Object.entries(result).filter(([k, v]) => k.endsWith(\"_valid\") && v === false).map(([k]) => k);\n bad.push(`${String((r.payload as unknown as Record<string, unknown>).timestamp ?? \"\")}: ${failed.join(\", \") || \"invalid\"}`);\n }\n if (progress && (index + 1) % 1000 === 0) process.stderr.write(`\\rverifying ${index + 1}/${all.length}…`);\n }\n if (progress) process.stderr.write(\"\\r\".padEnd(40) + \"\\r\");\n console.log(`${ok}/${all.length} receipt(s) verify offline against ${attesterPath}.`);\n if (bad.length) { for (const b of bad) console.error(` ✗ ${b}`); process.exit(1); }\n process.exit(0);\n}\n\nasync function runTest(args: string[]): Promise<void> {\n const command = args.find((a) => !a.startsWith(\"-\"));\n if (!command) { console.error('usage: scopebond-hook test \"<shell command>\"'); process.exit(1); }\n const dir = resolveConfigDir(process.cwd());\n if (!existsSync(join(dir, \"policy.json\"))) { console.error(`no policy yet — run \\`${cliCommand(\"init\")}\\` first.`); process.exit(1); }\n // Evaluate against the real policy and keys, but a throwaway store, so `test`\n // never records a receipt or exports anything.\n const tmp = mkdtempSync(join(tmpdir(), \"sb-hook-test-\"));\n try {\n const runtime = createHookRuntime({\n policyPath: join(dir, \"policy.json\"), keyPath: join(dir, \"agent.key\"),\n attesterPath: join(dir, \"attester.key\"), dbPath: join(tmp, \"receipts.db\"),\n strict: process.argv.includes(\"--strict\"),\n });\n const mapped = fillPushBranch(mapClaudeToolUse({ tool_name: \"Bash\", tool_input: { command } }), currentBranch(process.cwd()));\n console.log(`command: ${command}`);\n for (const m of mapped) {\n const d = await runtime.evaluateOne(m);\n // One tidy row per action. A deny's full explanation is multi-line, so the\n // row carries only the deciding rule and the whole message is printed once,\n // below — exactly as the agent will receive it.\n const note = d.decision === \"deny\" ? (d.clauseId ? `rule \"${d.clauseId}\"` : \"\")\n : d.decision === \"not_evaluated\" ? d.reason : \"\";\n console.log(` ${describeIntent({ intent: m.intent }).padEnd(28)} → ${d.decision.padEnd(14)}${note}`);\n }\n const overall = await runtime.evaluate(mapped);\n console.log(`\\noverall: ${overall.decision}`);\n if (overall.decision === \"deny\" && overall.reason) console.log(`\\n${overall.reason}`);\n process.exit(overall.decision === \"deny\" ? 2 : 0);\n } finally {\n rmSync(tmp, { recursive: true, force: true });\n }\n}\n\nasync function runConnect(args: string[]): Promise<void> {\n const positional = args.filter((a) => !a.startsWith(\"--\"));\n const url = positional[0];\n const bundleArg = positional[1];\n const harness = selectedHarness(args);\n if (!url) {\n console.error(`usage: ${cliCommand(\"connect <workspace-url> <enrollment> [--claude|--cursor|--codex] [--no-install]\")}`);\n console.error(enrollmentHelp);\n process.exit(1);\n }\n const dir = configDir();\n // One command sets everything up: scaffold the key, attester and starter policy if\n // they do not exist, then enroll and persist the scoped machine credential. The\n // enrollment can be a file, an inline base64 blob (what the portal hands out) or\n // raw JSON — the user never has to save or open a JSON file.\n scaffold(dir, {});\n let bundle: CloudEnrollmentBundle;\n try { bundle = readBundleArg(bundleArg, readStdin); }\n catch { console.error(`could not read the enrollment (expected a file, inline blob, or JSON on stdin)\\n${enrollmentHelp}`); process.exit(1); }\n await finishConnect(dir, url, bundle, harness, args);\n}\n\n/** Enroll with a bundle and wire the agent: shared by `connect` (a pasted enrollment)\n * and `login` (one received through device-code approval). */\nasync function finishConnect(dir: string, url: string, bundle: CloudEnrollmentBundle, harness: Harness, args: string[]): Promise<void> {\n try {\n const c = await connectCloud(dir, url, bundle);\n console.log(`✓ Connected to ${c.url}`);\n // With a user-level install present, the hook ignores a project policy until it is\n // trusted, and would fall back to the user home, which holds no cloud.json: the agent\n // stays governed, but nothing reaches the workspace. Connecting this project is the\n // user's decision to use it, exactly as running `init` here is, so pin it the same way.\n if (!process.env.SCOPEBOND_HOOK_DIR && resolve(dir) !== resolve(userHome()) && existsSync(join(userHome(), \"policy.json\"))) {\n trustProjectPolicy(dir);\n console.log(`✓ This project's rules are trusted (they override ${userHome()} here)`);\n }\n // Configure the agent automatically (merges into the existing config), unless the\n // caller opts out. This removes the \"paste this snippet\" step. A hook that is already\n // configured — pinned by `init`, or user-level by `install` — is left as it is:\n // connecting changes where receipts go, not how the hook starts.\n const scopes = harnessScopes(harness, process.cwd());\n const existing = scopes.local ?? scopes.project ?? scopes.user;\n if (existing && !args.includes(\"--no-install\")) {\n console.log(`✓ ${harnessName(harness)} already configured in ${existing}`);\n } else if (!args.includes(\"--no-install\")) {\n const { file } = placeHook(harness, process.cwd(), undefined);\n console.log(`✓ ${harnessName(harness)} configured in ${file}`);\n if (harness === \"codex\") console.log(`\\nOne last step: ${codexTrustStep}`);\n } else {\n console.log(`Add this to your ${harnessFileName(harness)}:`);\n console.log(harnessSnippet(harness));\n }\n // Session and after-action observations are opt-in through the enrollment: wired only\n // when this workspace granted observations:write and Claude Code is the host. Off is\n // silent here (`status` says why); a granted scope the hook cannot use is worth a line.\n const observing = observationStatus(loadConnection(dir));\n if (observing.state === \"on\" && harness === \"claude\" && !args.includes(\"--no-install\")) {\n const placed = harnessScopes(\"claude\", process.cwd());\n const target = placed.local ?? placed.project ?? placed.user;\n const command = target ? configuredHookCommands(target)[0] : undefined;\n if (target && command) { wireLifecycleHooks(target, command); console.log(`✓ Session and after-action observations enabled in ${target}`); }\n } else if (observing.state === \"unsupported\") console.log(`Observations: ${observing.reason}`);\n console.log(\"\");\n console.log(\"Run your agent — the first action appears in your workspace within seconds.\");\n } catch (error) {\n const message = (error as Error).message;\n console.error(`connect failed: ${message}`);\n if (/enrollment|expired|401|403/i.test(message)) console.error(enrollmentHelp);\n process.exit(1);\n }\n}\n\n/** Where an enrollment comes from, for every connect error that means \"this one will\n * not work\": the bare \"invalid enrollment token\" told the reader nothing about what to\n * do next. */\nconst enrollmentHelp = [\n \"An enrollment comes from your Scopebond workspace: open it, choose to connect an agent,\",\n \"and copy the command it shows — it includes the workspace URL and a fresh enrollment.\",\n \"Each enrollment is single-use and expires soon after it is created; if this one was\",\n \"used or has expired, create a new one there.\",\n].join(\"\\n\");\n\nasync function runFlush(): Promise<void> {\n const dir = resolveConfigDir(process.cwd());\n if (!loadConnection(dir)) { console.error(`not connected to a workspace; run \\`${cliCommand(\"connect <workspace-url> <enrollment>\")}\\` first`); process.exit(1); }\n const runtime = createHookRuntime(runtimePaths(dir));\n await runtime.exporter?.flush();\n const status = runtime.exporter?.status();\n runtime.exporter?.stop();\n console.log(`flushed; ${status?.pending ?? 0} receipt(s) still pending${status?.lastError ? ` (last error: ${status.lastError})` : \"\"}`);\n // Let pending HTTP handles close normally (forced exit can abort on Windows).\n process.exitCode = status && status.pending > 0 ? 1 : 0;\n}\n\n/** `observations`: what the observation emitters are doing, and the local queue. */\n/** `policy load <export.json> [--yes]`: check a policy exported from the workspace and, with\n * `--yes`, make it the active policy here; then acknowledge it (or its refusal) to the workspace. */\nasync function runPolicy(args: string[]): Promise<void> {\n const [sub, file] = args;\n if (sub === \"sync\") { await runPolicySync(args.includes(\"--background\")); return; }\n if (sub !== \"load\" || !file) { console.error(`usage: ${cliCommand(\"policy sync\")} | ${cliCommand(\"policy load <export.json> [--yes]\")}`); process.exitCode = 2; return; }\n const dir = resolveConfigDir(process.cwd());\n if (isManaged(dir)) {\n console.error(\"The rules on this computer are set by your Scopebond workspace; a policy file cannot replace them here.\");\n process.exitCode = 1;\n return;\n }\n const apply = args.includes(\"--yes\");\n const connection = loadConnection(dir);\n const outcome = loadPolicyExport(dir, file, { apply, environmentId: connection?.environment_id });\n let ack: Parameters<ObservationEmitter[\"policyAck\"]>[0] | undefined;\n if (outcome.state === \"rejected\") {\n console.error(`refused: ${outcome.message} (${outcome.error})`);\n if (outcome.ack) ack = { ...outcome.ack, error: outcome.error };\n process.exitCode = 1;\n } else if (outcome.state === \"would_load\") {\n console.log(`This export checks out (policy ${outcome.facts.policyId} v${outcome.facts.policyVersion}, digest ${outcome.facts.policyDigest.slice(0, 12)}...).`);\n console.log(`Loading it REPLACES the active policy at ${join(dir, \"policy.json\")} (the old one is kept as policy.previous.json), so the starter protections apply only if the export includes them.`);\n console.log(\"Run again with --yes to load it.\");\n return;\n } else {\n console.log(`loaded policy ${outcome.facts.policyId} v${outcome.facts.policyVersion} (digest ${outcome.facts.policyDigest.slice(0, 12)}...) from export ${outcome.facts.exportId}`);\n console.log(` active policy ${outcome.policyPath}${outcome.previous ? ` (previous kept at ${outcome.previous})` : \"\"}`);\n console.log(` note \\`${cliCommand(\"rules apply\")}\\` recompiles policy.json from rules.json and would replace it`);\n ack = { exportId: outcome.facts.exportId, policyId: outcome.facts.policyId, policyVersion: outcome.facts.policyVersion, policyDigest: outcome.facts.policyDigest, scopeDigest: outcome.facts.scopeDigest };\n }\n if (!ack) return;\n await sendPolicyAck(dir, ack);\n}\n\n/** What a rules check needs for this config directory. A project policy governs only once trusted, so it is re-pinned after a\n * write, exactly when `rules apply` would. */\nfunction syncOptionsFor(dir: string): SyncOptions {\n const home = userHome();\n const repin = dir !== home && existsSync(join(home, \"policy.json\")) && isTrustedProject(dir);\n const agentKid = createSigner({ privateKeyPem: readFileSync(join(dir, \"agent.key\"), \"utf8\") }).kid;\n return { agentKid, hookVersion: hookVersion(), policyBuilds, afterPolicyWrite: repin ? (d) => { trustProjectPolicy(d); } : undefined };\n}\n\n/** `policy sync`: bring this computer's rules in line with its workspace now (the hook also checks every five minutes). */\nasync function runPolicySync(background: boolean): Promise<void> {\n const dir = resolveConfigDir(process.cwd());\n let outcome: SyncOutcome;\n try {\n outcome = await syncPolicy(dir, syncOptionsFor(dir));\n } catch (error) {\n outcome = { state: \"unavailable\", message: (error as Error).message };\n }\n if (background) return;\n const lines: Record<SyncOutcome[\"state\"], string> = {\n not_connected: \"This computer is not connected to a Scopebond workspace; it uses its own rules.\",\n own_rules: \"Your workspace does not set rules for this computer; it uses its own rules.\",\n unchanged: \"Up to date with your workspace.\",\n applied: \"Updated to your workspace's latest rules.\",\n refused: \"Could not apply your workspace's rules; the rules already in force stay.\",\n disconnected: \"The workspace connection is no longer valid; this computer now uses its own rules.\",\n unavailable: \"Could not reach your workspace; the rules already in force stay.\",\n };\n console.log(lines[outcome.state]);\n if (outcome.state === \"refused\" || outcome.state === \"unavailable\") { console.log(` ${outcome.message}`); process.exitCode = 1; }\n}\n\n/** Queue a `policy_ack` (loaded or rejected) through the observation outbox and try to deliver it now. */\nasync function sendPolicyAck(dir: string, ack: Parameters<ObservationEmitter[\"policyAck\"]>[0]): Promise<void> {\n const observed = openObservations(dir, { adapterVersion: hookVersion(), spawnHeartbeat: false });\n if (!observed.emitter) { console.error(`not acknowledged to the workspace: observations are ${observed.status.state}${\"reason\" in observed.status ? ` (${observed.status.reason})` : \"\"}`); return; }\n try {\n const queued = observed.emitter.policyAck(ack);\n await observed.emitter.flush(3000);\n console.error(queued?.queued ? `queued the ${ack.error ? \"rejection\" : \"load\"} acknowledgement for the workspace` : \"could not queue the acknowledgement\");\n } finally { observed.emitter.close(); }\n}\n\n/** `budget load <export.json> [--yes]`: check an action budget exported from the workspace and, with `--yes`,\n * make it the budget this machine enforces; then acknowledge it (or its refusal) to the workspace. */\nasync function runBudgetLoad(args: string[]): Promise<void> {\n const file = args.find((a) => !a.startsWith(\"--\"));\n if (!file) { console.error(`usage: ${cliCommand(\"budget load <export.json> [--yes]\")}`); process.exitCode = 2; return; }\n const dir = resolveConfigDir(process.cwd());\n const agentKid = (() => { try { return createSigner({ privateKeyPem: readFileSync(join(dir, \"agent.key\"), \"utf8\") }).kid; } catch { return \"\"; } })();\n const outcome = loadBudgetExport(dir, file, { apply: args.includes(\"--yes\"), agentKid, environmentId: loadConnection(dir)?.environment_id });\n let ack: Parameters<ObservationEmitter[\"policyAck\"]>[0] | undefined;\n if (outcome.state === \"rejected\") {\n console.error(`refused: ${outcome.message} (${outcome.error})`);\n if (outcome.ack && outcome.error !== \"expired\") ack = { ...outcome.ack, error: outcome.error };\n process.exitCode = 1;\n } else if (outcome.state === \"would_load\") {\n const p = outcome.facts.policy;\n for (const w of outcome.warnings) console.error(`warning: ${w}`);\n console.log(`This export checks out: ${p.mode} budget ${outcome.facts.budgetId} v${outcome.facts.budgetVersion}, ${p.max_dispatch} dispatches in ${p.window_seconds}s for this agent on this installation.`);\n console.log(`Loading it writes the budget to ${join(dir, \"dispatch.json\")} as acknowledged, and replaces an older workspace budget for this agent. Run again with --yes to load it.`);\n return;\n } else {\n const p = outcome.facts.policy;\n for (const w of outcome.warnings) console.error(`warning: ${w}`);\n console.log(`loaded ${p.mode} budget ${outcome.facts.budgetId} v${outcome.facts.budgetVersion} from export ${outcome.facts.exportId}: ${p.max_dispatch} dispatches in ${p.window_seconds}s`);\n if (outcome.replaced.length > 0) console.log(` replaced ${outcome.replaced.join(\", \")}`);\n console.log(` valid until ${new Date(outcome.facts.validUntil).toISOString()} (after that an enforced budget denies new dispatch until you load a new export)`);\n ack = { exportId: outcome.facts.exportId, policyId: outcome.facts.budgetId, policyVersion: outcome.facts.budgetVersion, policyDigest: outcome.facts.policyDigest, scopeDigest: outcome.facts.scopeDigest };\n }\n if (!ack) return;\n await sendPolicyAck(dir, ack);\n}\n\nasync function runObservations(args: string[]): Promise<void> {\n const sub = args[0] ?? \"status\";\n const dir = resolveConfigDir(process.cwd());\n if (sub === \"heartbeat\") { await runHeartbeatLoop(args[1] ?? \"\"); return; }\n if (sub === \"status\") {\n const lines = describeObservations(dir);\n console.log(`observations: ${lines[0]}`);\n for (const line of lines.slice(1)) console.log(` ${line}`);\n const file = join(dir, OBSERVATION_DB);\n if (args.includes(\"--refused\") && existsSync(file)) {\n const store = new ObservationStore(file);\n try { for (const row of store.terminal()) console.log(` refused #${row.sequence} gen ${row.generation} ${row.kind} ${row.observation_id} ${row.code} ${new Date(row.at).toISOString()}`); }\n finally { store.close(); }\n }\n return;\n }\n if (sub === \"id\") {\n // The opaque id this installation gives a ref, remote or repository, for writing reference\n // sets. Local only: it reads the binding key and prints; nothing is sent anywhere.\n const id = keyedIdFor(loadOrCreateBindingKey(dir), args[1] ?? \"\", args.slice(2));\n if (!id) { console.error(\"usage: observations id <ref <name> | remote <url> | ghrepo <owner/name> | repo <workspace-path> | mcp <server> <tool> | mcp-resource <kind> <value> | net-dest <host> <port> | cf <kind> <name> | database <pg|sqlite> <key>>\"); process.exit(1); }\n console.log(id);\n return;\n }\n if (sub === \"wire\" || sub === \"unwire\") {\n const scopes = harnessScopes(\"claude\", process.cwd());\n if (sub === \"unwire\") {\n let removed = 0;\n for (const file of [scopes.project, scopes.local, scopes.user]) if (file) removed += unwireLifecycleHooks(file);\n console.log(`removed ${removed} lifecycle hook entr${removed === 1 ? \"y\" : \"ies\"}`);\n return;\n }\n const target = scopes.local ?? scopes.project ?? scopes.user;\n const command = target ? configuredHookCommands(target)[0] : undefined;\n if (!target || !command) { console.error(\"Claude Code is not configured with this hook; run install or init first\"); process.exit(1); }\n wireLifecycleHooks(target, command);\n console.log(`session and after-action hooks wired in ${target}`);\n return;\n }\n const opened = openObservations(dir, { adapterVersion: hookVersion(), spawnHeartbeat: false });\n if (!opened.emitter) {\n console.error(`observations are ${opened.status.state}${\"reason\" in opened.status ? `: ${opened.status.reason}` : \"\"}`);\n process.exit(1);\n }\n const emitter = opened.emitter;\n try {\n if (sub === \"flush\") {\n const outcome = await uploadPending(emitter.store, { url: emitter.connection.url, credential: emitter.connection.credential, timeoutMs: 10_000 });\n const left = emitter.store.pendingSummary().count;\n console.log(`${outcome.result}: ${outcome.acknowledged} acknowledged, ${outcome.deferred} deferred, ${outcome.rejected} refused; ${left} still pending${outcome.detail ? ` (${outcome.detail})` : \"\"}`);\n process.exitCode = left > 0 ? 1 : 0;\n } else if (sub === \"retry\") {\n const state = emitter.store.state();\n if (state?.capability === \"unsupported\") { emitter.store.setCapability(\"active\", null); console.log(\"will try the workspace again\"); }\n else console.log(\"nothing to retry (a stale generation clears when you reconnect)\");\n } else { console.error(\"usage: observations [status [--refused]|flush|retry|wire|unwire]\"); process.exit(1); }\n } finally { emitter.close(); }\n}\n\n/** The single heartbeat helper for one active session (started by the hook, never by hand). */\nasync function runHeartbeatLoop(sessionId: string): Promise<void> {\n if (!sessionId) return;\n const dir = resolveConfigDir(process.cwd());\n const { emitter } = openObservations(dir, { adapterVersion: hookVersion(), spawnHeartbeat: false, flushTimeoutMs: 3000 });\n if (!emitter) return;\n const override = Number(process.env.SCOPEBOND_HEARTBEAT_INTERVAL_MS);\n const interval = Number.isFinite(override) && override >= 100 ? override : HEARTBEAT_INTERVAL_MS;\n const endsAt = Date.now() + 24 * 60 * 60 * 1000;\n let last = Date.now();\n try {\n for (;;) {\n const verdict = emitter.heartbeatTick(sessionId, last);\n await emitter.flush();\n if (verdict === \"stop\" || Date.now() > endsAt) break;\n last = Date.now();\n await new Promise<void>((resolve) => setTimeout(resolve, interval));\n }\n } finally { emitter.store.releaseHeartbeat(sessionId); emitter.close(); }\n}\n\n/** The absolute path to this CLI file, for registering the hook by absolute path. */\nfunction cliPath(): string {\n return fileURLToPath(import.meta.url);\n}\n\n/** `install` — the once-per-machine, user-level install (SB112). Scaffolds the\n * user home and registers the hook by absolute path in the user-level agent config,\n * so every project a developer opens is governed without a per-repo `init`. */\nfunction runInstall(args: string[]): void {\n const dir = userHome();\n // Run through `npx`, this CLI lives in npm's throwaway cache; registering that path\n // would leave a hook that stops starting whenever npm clears it — and a hook that\n // cannot start lets every action through. Pin the durable copy, as `init` does, and\n // fall back to the portable `npx` command when none can be made.\n const commandFor = (h: Harness): string => {\n const pin = ensureDurableRuntime(cliPath(), hookVersion());\n return pin.cli ? absoluteHookCommand(pin.cli, h) : hookCommand(h);\n };\n const harnessesFor = (): Harness[] => args.includes(\"--codex\") ? [\"codex\"]\n : args.includes(\"--cursor\") ? [\"cursor\"]\n : args.includes(\"--claude\") ? [\"claude\"]\n : [\"claude\", ...(cursorDetected() ? [\"cursor\" as const] : []), ...(codexDetected() ? [\"codex\" as const] : [])];\n // `install` rewrites agent config files the user did not create — their theme, plugins\n // and permissions live in ~/.claude/settings.json — so there is a way to see exactly\n // what it would touch before it touches anything.\n if (args.includes(\"--dry-run\")) {\n console.log(`Dry run — nothing is written.\\n`);\n console.log(`Would scaffold ${dir} (machine key, countersigning key, starter policy)`);\n for (const h of harnessesFor()) {\n const file = userHarnessFile(h);\n const exists = existsSync(file);\n console.log(`Would ${exists ? \"modify\" : \"create\"} ${file}`);\n if (exists) console.log(` backing it up to ${file}.scopebond-backup`);\n // Previewed without copying anything: the path the real run would pin.\n console.log(` adding hook ${absoluteHookCommand(isEphemeralPath(cliPath()) ? pinnedCliPath(hookVersion()) : cliPath(), h)}`);\n if (exists && isHarnessConfigured(file)) console.log(` (a Scopebond hook is already there; it would be replaced, not duplicated)`);\n }\n console.log(`\\nNothing else in those files is changed. Run without --dry-run to apply.`);\n process.exit(0);\n }\n const { agentKid, policyPath } = scaffold(dir, { force: args.includes(\"--force\") });\n console.log(`Scopebond installed for this user in ${dir}`);\n console.log(` machine key ${agentKid}`);\n console.log(` policy ${policyPath} (starter — edit the limits)`);\n console.log(\"\");\n const harnesses: Harness[] = harnessesFor();\n if (!args.includes(\"--no-install\")) {\n for (const h of harnesses) {\n try {\n const target = userHarnessFile(h);\n const backup = existsSync(target) ? `${target}.scopebond-backup` : null;\n const file = writeHarnessConfig(target, h, commandFor(h));\n console.log(`✓ ${harnessName(h)} configured in ${file}`);\n if (backup && existsSync(backup)) console.log(` original kept at ${backup}`);\n } catch (error) { console.error(`✗ ${harnessName(h)}: ${(error as Error).message}`); process.exitCode = 1; }\n }\n } else {\n console.log(\"Add this to your user-level agent config:\");\n console.log(harnessSnippet(harnesses[0]));\n }\n if (harnesses.includes(\"codex\")) console.log(`\\nOne last step for Codex: ${codexTrustStep}`);\n console.log(\"\");\n console.log(`A project's own .scopebond policy applies only after you trust it there (${cliCommand(\"trust\")}).`);\n console.log(`Check it: ${cliCommand(\"doctor\")} · see decisions: ${cliCommand(\"log\")}`);\n console.log(`To send receipts to a workspace: ${cliCommand(\"connect <workspace-url> <enrollment>\")}`);\n}\n\n/** Size and count of the local receipt store, plus its write-ahead log. Signed evidence\n * accumulates in the user's project directory and there is no automatic deletion — so\n * the footprint is reported rather than left to be discovered. */\nfunction describeStore(dbPath: string): string {\n const bytes = (file: string): number => { try { return statSync(file).size; } catch { return 0; } };\n const total = bytes(dbPath) + bytes(`${dbPath}-wal`) + bytes(`${dbPath}-shm`);\n const human = total >= 1024 * 1024 ? `${(total / 1024 / 1024).toFixed(1)} MiB` : `${Math.max(1, Math.round(total / 1024))} KiB`;\n let count: number | null = null;\n try {\n const { store } = openReceiptStore({ db: dbPath });\n try { count = store.count ? Number(store.count()) : null; } finally { store.close?.(); }\n } catch { count = null; }\n return count === null ? human : `${count} receipt(s), ${human}`;\n}\n\nfunction runStatus(): void {\n const home = userHome();\n const installed = existsSync(join(home, \"policy.json\"));\n // Both scopes, always: `init` writes the project config and `install` writes the\n // user one, so a single-scope check contradicts whichever command the user ran.\n const claude = harnessScopes(\"claude\", process.cwd());\n const cursor = harnessScopes(\"cursor\", process.cwd());\n const codex = harnessScopes(\"codex\", process.cwd());\n const connected = !!loadConnection(resolveConfigDir(process.cwd()));\n const dbPath = join(resolveConfigDir(process.cwd()), \"receipts.db\");\n console.log(`Scopebond hook ${hookVersion()}`);\n console.log(` user home ${home} ${installed ? \"(installed)\" : `(not installed — run \\`${cliCommand(\"install\")}\\`)`}`);\n console.log(` active config ${resolveConfigDir(process.cwd())}`);\n const ignored = untrustedProjectPolicy(process.cwd());\n if (ignored) console.log(` project policy ${ignored} ignored — not trusted (run \\`${cliCommand(\"trust\")}\\` to use it)`);\n console.log(` Claude Code ${harnessScopeLabel(claude) || \"not configured\"}`);\n console.log(` Cursor ${harnessScopeLabel(cursor) || (cursorDetected() ? \"detected, not configured\" : \"not detected\")}`);\n console.log(` Codex ${codex.project || codex.user ? `${harnessScopeLabel(codex)} — approve once with /hooks` : codexDetected() ? \"detected, not configured\" : \"not detected\"}`);\n console.log(` cloud workspace ${connected ? \"connected\" : \"not connected (local only)\"}`);\n {\n const activeDir = resolveConfigDir(process.cwd());\n const meta = readMeta(activeDir);\n const managed = existsSync(join(activeDir, MANAGED_DOC_FILE));\n const checked = meta.checked_at ? `, last checked ${meta.checked_at}` : \"\";\n console.log(` rules ${managed ? `set by your workspace (version ${meta.revision})${checked}` : `this computer's own (${rulesPath(activeDir)})${connected ? checked : \"\"}`}`);\n console.log(` always on: protection of Scopebond's own settings and the agents' hook settings`);\n if (meta.last_error) console.log(` last problem: ${meta.last_error}`);\n }\n const observationLines = describeObservations(resolveConfigDir(process.cwd()));\n console.log(` observations ${observationLines[0]}`);\n for (const line of observationLines.slice(1)) console.log(` ${line}`);\n console.log(` local receipts ${existsSync(dbPath) ? `${dbPath} (${describeStore(dbPath)})` : \"none yet\"}`);\n for (const [name, scopes] of [[\"Claude Code\", claude], [\"Cursor\", cursor], [\"Codex\", codex]] as const) {\n for (const file of [scopes.project, scopes.local, scopes.user]) if (file) console.log(` ${name}: ${file}`);\n }\n}\n\n/** `capabilities`: the manifest of what this hook can honestly claim, cell by cell.\n * `--prove` runs the safe fixtures in temp directories (never touching agent settings);\n * `--save` records the result beside the policy; `--json` prints the manifest. */\nasync function runCapabilities(args: string[]): Promise<void> {\n const cwd = process.cwd();\n const dir = resolveConfigDir(cwd);\n const configured = {\n claude: !!harnessScopeLabel(harnessScopes(\"claude\", cwd)),\n cursor: !!harnessScopeLabel(harnessScopes(\"cursor\", cwd)),\n codex: !!harnessScopeLabel(harnessScopes(\"codex\", cwd)),\n };\n const version = hookVersion();\n let proofs = loadProofs(dir);\n let failed = false;\n if (args.includes(\"--prove\")) {\n // When the workspace accepts observations, the fixtures are signed with this machine's\n // own keys (copied into the temp home) and their receipts are delivered first, so the\n // proof can name them and the workspace can resolve them. Otherwise a fixture stays local.\n const observed = openObservations(dir, { adapterVersion: version, spawnHeartbeat: false });\n const collected: unknown[] = [];\n const fresh = await runProofFixtures(version, observed.emitter ? { identityDir: dir, collect: collected } : {});\n const proven = computeManifest({ adapterVersion: version, configured: { claude: true, codex: true, cursor: true }, proofs: fresh });\n for (const cell of proven.cells) {\n const proof = fresh[cell.key];\n if (proof && !proofPassed(proof, cell)) {\n failed = true;\n console.error(`fixture failed: ${cell.key} (allow ${proof.safe_allow}, deny ${proof.safe_deny}, signature ${proof.signature}, grouping ${proof.grouping})`);\n }\n }\n if (observed.emitter) {\n try {\n const delivered = await deliverProofReceipts(observed.emitter.connection, collected);\n if (!delivered) console.error(\"could not deliver the fixture receipts to the workspace; the capability proofs were not sent (run it again when it is reachable)\");\n else {\n const queued = observed.emitter.capabilityProofs(proven.cells.flatMap((cell) => {\n // A typed-operation cell has no receipt of its own action type for a proof to name, so no proof is sent for it.\n if (TYPED_ACTION_TYPES.has(cell.action_type)) return [];\n const proof = cell.state === \"unsupported\" ? undefined : fresh[cell.key];\n return proof ? [{ adapterVersion: cell.adapter_version, hostVariant: cell.host_variant, actionType: cell.action_type, phase: cell.event_phase, requiredFields: cell.emitted_required_fields, fixtureVersion: `fixture/${proof.test_vector_digest}`, passed: proofPassed(proof, cell), proofDigests: proof.proof_digests }] : [];\n }));\n await observed.emitter.flush(3000);\n console.error(`queued ${queued} capability proof observation(s) (fixture origin, ${collected.length} fixture receipt(s) delivered)`);\n }\n } finally { observed.emitter.close(); }\n }\n if (args.includes(\"--save\")) {\n if (!existsSync(dir)) { console.error(`no ${dir} to record into - run \\`${cliCommand(\"init\")}\\` first.`); process.exit(1); }\n console.error(`recorded fixture proofs in ${saveProofs(dir, fresh)}`);\n }\n proofs = fresh;\n }\n const manifest = computeManifest({ adapterVersion: version, configured, proofs });\n if (args.includes(\"--json\")) console.log(JSON.stringify(manifest, null, 2));\n else {\n console.log(renderManifest(manifest));\n if (args.includes(\"--prove\")) console.log(`\\nFixture run ${failed ? \"FAILED - see degraded cells\" : \"passed\"}. It used temporary directories only; no agent setting or policy was changed and no key was modified.`);\n }\n process.exitCode = failed ? 1 : 0;\n}\n\nasync function runDoctor(): Promise<void> {\n const problems: string[] = [];\n const nodeOk = nodeSupported();\n console.log(`Scopebond doctor`);\n console.log(` node ${process.versions.node} ${nodeOk ? \"ok\" : \"TOO OLD (need >=22.13)\"}`);\n if (!nodeOk) problems.push(\"node >=22.13 is required (the Cloud outbox uses node:sqlite)\");\n const cli = cliPath();\n console.log(` cli ${cli} ${existsSync(cli) ? \"ok\" : \"MISSING\"}`);\n const active = resolveConfigDir(process.cwd());\n const hasPolicy = existsSync(join(active, \"policy.json\"));\n console.log(` active config ${active} ${hasPolicy ? \"ok\" : `no policy (run \\`${cliCommand(\"init\")}\\` here, or \\`${cliCommand(\"install\")}\\` once for your user)`}`);\n if (!hasPolicy) problems.push(\"no policy found in the active config dir\");\n const ignored = untrustedProjectPolicy(process.cwd());\n if (ignored) console.log(` project policy ${ignored} IGNORED — not trusted (never trusted, or edited since). Review it, then \\`${cliCommand(\"trust\")}\\``);\n // Every harness, in both scopes, plus a check that each configured command can\n // actually start. A pinned path that has gone missing is the one failure mode of\n // the fast absolute-path install, so doctor is where it must surface.\n let anyHarness = false;\n for (const harness of [\"claude\", \"cursor\", \"codex\"] as const) {\n const scopes = harnessScopes(harness, process.cwd());\n const label = harnessScopeLabel(scopes);\n const name = harnessName(harness);\n if (!label) {\n const detected = harness === \"claude\" || (harness === \"cursor\" ? cursorDetected() : codexDetected());\n console.log(` ${name.padEnd(15)} ${detected ? `not configured — run \\`${cliCommand(`init${harness === \"claude\" ? \"\" : ` --${harness}`}`)}\\`` : \"not detected\"}`);\n continue;\n }\n anyHarness = true;\n console.log(` ${name.padEnd(15)} ${label}`);\n for (const file of [scopes.project, scopes.local, scopes.user]) {\n if (!file) continue;\n // A project file git shares must not name a path on this machine: it starts here,\n // so the resolve check below passes, but on every teammate's machine it cannot\n // start — and a hook that cannot start is a non-blocking error, so their agent runs\n // unchecked. Only the doctor on the machine that wrote it can see this coming.\n const share = file === scopes.project ? gitShareState(file) : \"none\";\n const shared = share === \"tracked\" || share === \"untracked\";\n for (const command of configuredHookCommands(file)) {\n const ok = hookCommandResolves(command);\n const leaks = ok && shared && isMachineSpecificCommand(command);\n console.log(` ${ok && !leaks ? \"ok \" : \"BAD \"} ${file}`);\n if (!ok) {\n console.log(` command cannot start: ${command}`);\n problems.push(`${name} hook command no longer resolves in ${file} — run \\`${cliCommand(\"init\")}\\` to repair it`);\n } else if (leaks) {\n console.log(` machine-specific command in a file git shares: ${command}`);\n problems.push(`${name} hook in ${file} names a path on this machine and git shares that file — anyone who clones it gets a hook that cannot start, and their agent runs unchecked. Run \\`${cliCommand(`init${harness === \"claude\" ? \"\" : ` --${harness}`}`)}\\` to move it, then commit the change`);\n }\n }\n }\n if (harness === \"codex\") console.log(` run /hooks in Codex and approve Scopebond once`);\n }\n if (!anyHarness) problems.push(`no coding agent is configured — run \\`${cliCommand(\"init\")}\\` in your project root`);\n const connection = loadConnection(active);\n if (!connection) {\n console.log(` cloud not connected (local only) — receipts stay on this machine`);\n } else {\n let reachable = \"unknown\";\n try {\n const res = await fetch(new URL(\"/healthz\", connection.url).toString(), { method: \"GET\" });\n reachable = res.ok ? \"reachable\" : `unhealthy (${res.status})`;\n } catch (error) { reachable = `unreachable (${(error as Error).message})`; }\n console.log(` cloud ${connection.url} — ${reachable}`);\n }\n console.log(problems.length ? `\\n${problems.length} problem(s): ${problems.join(\"; \")}` : `\\nAll good.`);\n process.exitCode = problems.length ? 1 : 0;\n}\n\nfunction runUninstall(args: string[]): void {\n requireInteractive(\"uninstall\", args);\n let removed = 0;\n // Both scopes. Checking only the user config meant that after a per-project `init` —\n // the install the site actually tells people to run — `uninstall` reported \"no\n // user-level harness config found\" and left the project hook in place.\n for (const h of [\"claude\", \"cursor\", \"codex\"] as Harness[]) {\n for (const file of [projectHarnessFile(h, process.cwd()), localHarnessFile(h, process.cwd()), userHarnessFile(h)]) {\n if (file && removeHarnessConfig(file)) { console.log(`✓ removed the Scopebond hook from ${file}`); removed++; }\n }\n }\n if (removed === 0) console.log(\"no Scopebond hook found in this project or your user config.\");\n if (args.includes(\"--purge\")) { purgeHome(); console.log(`✓ purged ${userHome()} (keys, policy, receipts)`); }\n else console.log(`Kept ${userHome()} (keys, policy, receipts). Use --purge to remove it too.`);\n const projectDir = resolveConfigDir(process.cwd());\n if (existsSync(join(projectDir, \"policy.json\"))) {\n console.log(`Kept ${projectDir} (this project's keys, policy and receipts) — delete it by hand if you want it gone.`);\n }\n}\n\n/** `trust` — let this project's .scopebond policy govern here instead of the user\n * home, pinned to its current contents. Run by the user, not the agent: the file it\n * writes lives in the user home, which the starter policy write-protects. */\nfunction runTrust(args: string[]): void {\n requireInteractive(\"trust\", args);\n const dir = join(process.cwd(), \".scopebond\");\n if (!existsSync(join(dir, \"policy.json\"))) { console.error(`no project policy at ${join(dir, \"policy.json\")}`); process.exit(1); }\n const digest = trustProjectPolicy(dir);\n console.log(`✓ trusted ${join(dir, \"policy.json\")} (sha256 ${digest.slice(0, 12)}…)`);\n console.log(\"It governs agents in this project until it changes; after any edit, review it and run trust again.\");\n}\n\n/** `login <workspace-url>` — connect this computer without pasting anything. It asks\n * the workspace for a short code, shows it with the page to open, and waits while a\n * person who can manage the workspace approves it there for an environment and agent.\n * The approval hands back a single-use enrollment, which completes exactly as\n * `connect` does. Nothing secret is printed: the device code stays in memory. */\nasync function runLogin(args: string[]): Promise<void> {\n const positional = args.filter((a) => !a.startsWith(\"--\"));\n const harness = selectedHarness(args);\n let origin: string;\n try {\n const parsed = new URL(positional[0] ?? \"\");\n const local = parsed.hostname === \"localhost\" || parsed.hostname === \"127.0.0.1\" || parsed.hostname === \"[::1]\";\n if (parsed.protocol !== \"https:\" && !(local && parsed.protocol === \"http:\")) throw new Error(\"https required\");\n origin = parsed.origin;\n } catch {\n console.error(`usage: ${cliCommand(\"login <workspace-url> [--claude|--cursor|--codex] [--no-install]\")}`);\n console.error(\"The workspace URL is the address of your Scopebond workspace, for example https://cloud.scopebond.com.\");\n process.exit(1);\n }\n const post = async (path: string, body: unknown): Promise<{ status: number; json: Record<string, unknown> }> => {\n const response = await fetch(new URL(path, origin), {\n method: \"POST\", headers: { \"content-type\": \"application/json\" }, body: JSON.stringify(body),\n redirect: \"error\", signal: AbortSignal.timeout(15_000),\n });\n return { status: response.status, json: await response.json().catch(() => ({})) as Record<string, unknown> };\n };\n let start: { status: number; json: Record<string, unknown> };\n try { start = await post(\"/v1/device/code\", { client_name: hostname(), harness }); }\n catch (error) { console.error(`could not reach ${origin}: ${(error as Error).message}`); process.exit(1); }\n const deviceCode = typeof start.json.device_code === \"string\" ? start.json.device_code : \"\";\n if (start.status !== 200 || !deviceCode) {\n console.error(`${origin} did not start a login (HTTP ${start.status}). Check the workspace URL, or use ${cliCommand(\"connect <workspace-url> <enrollment>\")}.`);\n process.exit(1);\n }\n const userCode = String(start.json.user_code ?? \"\");\n const verify = String(start.json.verification_uri_complete ?? start.json.verification_uri ?? origin);\n let intervalMs = Math.max(1, Number(start.json.interval ?? 5)) * 1000;\n const deadline = Date.now() + Math.max(60, Number(start.json.expires_in ?? 600)) * 1000;\n console.log(`To connect this computer, open:\\n\\n ${verify}\\n\\nand check that it shows the code ${userCode}\\n`);\n console.log(\"Waiting for approval (the code expires in 10 minutes; Ctrl+C to stop)…\");\n const dir = configDir();\n scaffold(dir, {});\n while (Date.now() < deadline) {\n await new Promise((resolve) => setTimeout(resolve, intervalMs));\n let polled: { status: number; json: Record<string, unknown> };\n try { polled = await post(\"/v1/device/token\", { device_code: deviceCode }); }\n catch { continue; } // a transient network error: keep waiting until the deadline\n if (polled.status === 200 && polled.json.enrollment && typeof polled.json.enrollment === \"object\") {\n console.log(\"✓ Approved\");\n await finishConnect(dir, origin, polled.json.enrollment as CloudEnrollmentBundle, harness, args);\n return;\n }\n const error = polled.json.error;\n if (error === \"authorization_pending\") continue;\n if (error === \"slow_down\") { intervalMs += 5_000; continue; }\n if (error === \"access_denied\") { console.error(\"The request was denied in the workspace. Nothing was connected.\"); process.exit(1); }\n if (error === \"expired_token\") break;\n console.error(`login failed (${String(error ?? `HTTP ${polled.status}`)}). Run the command again for a new code.`);\n process.exit(1);\n }\n console.error(\"The code expired before it was approved. Run the command again for a new one.\");\n process.exit(1);\n}\n\n/** What each command does, its arguments, and one example. The whole help used to be a\n * single usage line listing 15 command names, which told a reader nothing about what any\n * of them did or what arguments they take. */\nconst COMMANDS: Array<{ name: string; args?: string; summary: string; detail?: string[] }> = [\n { name: \"init\", args: \"[--cursor|--codex] [--shared] [--dry-run] [--no-install] [--npx] [--force] [--yes]\",\n summary: \"set this project up: keys, a starter policy, and your agent wired to the hook\",\n detail: [\n \"Writes .scopebond/ (machine key, countersigning key, starter policy, .gitignore) and\",\n \"wires your agent to the hook. It pins a durable copy of this package so the hook starts\",\n \"fast, and because that command names paths on this machine it goes where git will not\",\n \"share it: .claude/settings.local.json (kept out of git for this clone), or for Cursor\",\n \"and Codex their project file only while git does not track it. --shared writes the\",\n \"portable npx command to .claude/settings.json, .cursor/hooks.json or .codex/hooks.json\",\n \"instead, so everyone who clones the project gets the hook. --dry-run shows what it\",\n \"would write. --no-install prints the config snippet rather than writing it.\",\n \"Needs a terminal, or --yes in a script, because it changes what governs your agent.\",\n ] },\n { name: \"install\", args: \"[--claude] [--cursor] [--codex] [--dry-run] [--force] [--yes]\",\n summary: \"set up once for this user, so every project you open is governed\",\n detail: [\n \"Scaffolds ~/.scopebond and registers the hook in your user-level agent config.\",\n \"--dry-run prints exactly which files it would touch and changes nothing. Each config\",\n \"is copied to <file>.scopebond-backup before its first modification.\",\n ] },\n { name: \"rules\", args: \"[show|allow|block|protect|unprotect|protect-branch|unprotect-branch|protect-remote-database|unprotect-remote-database|apply] [value]\",\n summary: \"read and change the limits in plain terms\",\n detail: [\n \"With no arguments, prints what is blocked in plain English — no regular expressions.\",\n \"The editable lists are .scopebond/rules.json; policy.json is compiled from them, so\",\n \"you never hand-write a lookahead.\",\n \" rules allow dd stop blocking a program\",\n \" rules protect infra/ never write there\",\n \" rules protect-branch production\",\n \" rules apply recompile after editing rules.json by hand\",\n ] },\n { name: \"status\", summary: \"what is configured, where, and how big the local log is\" },\n { name: \"capabilities\", args: \"[--prove [--save]] [--json]\",\n summary: \"what this hook can honestly claim, per agent host, action and phase\",\n detail: [\n \"Prints the capability manifest: for Claude Code, Codex and Cursor, each action type and\",\n \"phase is unsupported, inactive, configured_unverified, degraded or verified_reporting.\",\n \"Unsupported stays unsupported. A cell is never verified from a local run alone.\",\n \"--prove runs safe fixtures (allow, deny, signature, action group) in temporary\",\n \"directories; it does not read or change any agent settings. --save records the result.\",\n ] },\n { name: \"policy\", args: \"load <export.json> [--yes]\",\n summary: \"check a policy exported from your workspace and make it the active policy here\",\n detail: [\n \"Without --yes it only checks the export (its policy hash and scope digest, and that the\",\n \"gateway can load it) and says what loading would replace. With --yes the policy is\",\n \"written atomically as policy.json, the old one kept as policy.previous.json. If this\",\n \"machine is enrolled for observations, the load (or the refusal) is then acknowledged to\",\n \"the workspace, echoing the export's digests exactly. An export carries no signature;\",\n \"get the file from your workspace.\",\n ] },\n { name: \"observations\", args: \"[status [--refused]|flush|retry|wire|unwire|id <kind> <value>]\",\n summary: \"session, health and action observations sent to your workspace (opt-in)\",\n detail: [\n `On only when your workspace enrollment grants ${OBSERVATIONS_SCOPE}; otherwise off, and status says why.`,\n \"Local enforcement never depends on it: uploads are best effort and bounded. status shows\",\n \"what is pending and what the workspace refused (kept locally, never retried). flush\",\n \"sends now; retry re-checks a workspace that lacked the route; wire and unwire add or\",\n \"remove the Claude Code session and after-action hook entries.\",\n ] },\n { name: \"budget\", args: \"init|ack <id>|status|load <export.json>\",\n summary: \"per-agent action budgets: how many actions this agent may dispatch in a window\",\n detail: [\n \"load checks a budget exported from your workspace (digests, environment, validity, fail-closed contract) and, with --yes,\",\n \"makes it the acknowledged budget here, then acknowledges it to the workspace so its export stops showing as pending.\",\n \"init writes the suggested 100 actions per 60 seconds, monitor-only (nothing is limited).\",\n \"Enforcing needs the mode set to enforce and an acknowledgement of the exact policy (ack).\",\n \"Counters persist across hook processes and restarts. They count dispatched parent actions on\",\n \"THIS installation only; a limit shared across installations needs a shared in-path gateway,\",\n \"which an independent hook is not, so it refuses to enforce one.\",\n ] },\n { name: \"delegation\", args: \"add <file>|list|revoke <id>|import <file>\",\n summary: \"delegated child scopes: a child may do no more than its parent and never outlives it\",\n detail: [\n \"A session runs under one with SCOPEBOND_DELEGATION=<id>. Every action is checked against it,\",\n \"and against every ancestor, for scope, expiry and revocation. revoke takes effect on the next action.\",\n \"import adds revoked ids from a file exported from your workspace (add-only).\",\n ] },\n { name: \"doctor\", summary: \"check the setup and whether each configured hook command can start\",\n detail: [\"Exits non-zero when something is wrong, so it works in a script.\"] },\n { name: \"log\", args: \"[-n N] [--deny] [--since 7d]\",\n summary: \"the recent decisions\",\n detail: [`--deny shows only blocked actions; --since takes 7d, 24h, 30m or a date.`, `e.g. ${cliCommand(\"log --deny --since 7d\")}`] },\n { name: \"verify\", summary: \"check every local receipt offline against the countersigning key\",\n detail: [\"No network, no account. Exits non-zero if any receipt fails.\"] },\n { name: \"test\", args: '\"<shell command>\"',\n summary: \"show the decision for a command without running or recording it\",\n detail: [`e.g. ${cliCommand('test \"rm -rf /\"')}`] },\n { name: \"prune\", args: \"[--before 90d] [--yes]\",\n summary: \"report the local store's size, or bound it\",\n detail: [\n \"With no --before it only reports. With one, it archives the receipts it will remove\",\n \"to a JSONL file beside the database, then removes them. Refuses once the log has been\",\n \"anchored, because a receipt's position is its anchor leaf index.\",\n ] },\n { name: \"login\", args: \"<workspace-url> [--claude|--cursor|--codex] [--no-install]\",\n summary: \"connect this computer to a Scopebond Cloud workspace by approving a short code there\",\n detail: [\n \"Prints a code and a link; someone who manages the workspace opens it, checks the code\",\n \"and approves it for an environment and agent. Nothing is copied or pasted.\",\n ] },\n { name: \"connect\", args: \"<workspace-url> <enrollment> [--claude|--cursor|--codex]\",\n summary: \"send receipts to a Scopebond Cloud workspace as well as keeping them locally\" },\n { name: \"flush\", summary: \"deliver any receipts still queued for the workspace now\" },\n { name: \"trust\", args: \"[--yes]\", summary: \"let this project's .scopebond policy govern here (pinned by hash)\" },\n { name: \"uninstall\", args: \"[--purge] [--yes]\", summary: \"remove the hook from your agent config; --purge also deletes the home\" },\n { name: \"claude\", summary: \"(internal) decide one Claude Code PreToolUse call, JSON on stdin\" },\n { name: \"cursor\", summary: \"(internal) decide one Cursor hook event, JSON on stdin\" },\n { name: \"codex\", summary: \"(internal) decide one Codex PreToolUse call, JSON on stdin\" },\n];\n\nfunction printHelp(topic: string | undefined, toStderr = false): void {\n const out = toStderr ? console.error : console.log;\n const match = topic ? COMMANDS.find((c) => c.name === topic.replace(/^--?/, \"\")) : undefined;\n if (match) {\n out(`scopebond-hook ${match.name}${match.args ? ` ${match.args}` : \"\"}`);\n out(\"\");\n out(` ${match.summary}`);\n if (match.detail) { out(\"\"); for (const line of match.detail) out(` ${line}`); }\n return;\n }\n if (topic) { out(`no such command: ${topic}`); out(\"\"); }\n out(`scopebond-hook — govern a coding agent's tool calls against policy, before they run.`);\n out(\"\");\n out(`Usage: scopebond-hook <command> [options]`);\n out(\"\");\n out(` ${cliCommand(\"init\")} set up this project`);\n out(` ${cliCommand('test \"rm -rf /\"')} see a decision without running it`);\n out(` ${cliCommand(\"log --deny\")} what got blocked`);\n out(` ${cliCommand(\"rules\")} what is blocked, in plain English`);\n out(\"\");\n out(\"Commands:\");\n const width = Math.max(...COMMANDS.map((c) => c.name.length));\n for (const command of COMMANDS) {\n if (command.summary.startsWith(\"(internal)\")) continue;\n out(` ${command.name.padEnd(width)} ${command.summary}`);\n }\n out(\"\");\n out(` ${\"help\".padEnd(width)} \\`help <command>\\` for that command's arguments and examples`);\n out(\"\");\n out(`Receipts and keys stay in .scopebond/ in this project. Nothing leaves your machine`);\n out(`unless you run \\`connect\\`. Docs: https://github.com/avouro-com/scopebond`);\n}\n\n/** Whether this Node can run the receipt store (`node:sqlite`, 22.13+). */\nfunction nodeSupported(version = process.versions.node): boolean {\n const [major, minor] = version.split(\".\").map(Number);\n return major > 22 || (major === 22 && minor >= 13);\n}\n\nconst [cmd, ...rest] = process.argv.slice(2);\n// A setup command on an older Node would scaffold and wire the agent, then fail on the\n// first action with an error about a missing module. Stop before changing anything, and\n// say what to do. The hook subcommands are left alone: they already fail closed.\nif ([\"init\", \"install\", \"connect\", \"login\"].includes(cmd ?? \"\") && !nodeSupported()) {\n console.error(`Scopebond needs Node.js 22.13 or later; this is Node ${process.versions.node}.`);\n console.error(\"Install the current Node.js LTS from https://nodejs.org, open a new terminal, and run the command again.\");\n process.exit(1);\n}\nif (cmd === \"claude\") { await runClaude(); }\nelse if (cmd === \"cursor\") { await runCursor(); }\nelse if (cmd === \"codex\") { await runCodex(); }\nelse if (cmd === \"init\") { runInit(rest); }\nelse if (cmd === \"install\") { runInstall(rest); }\nelse if (cmd === \"connect\") { await runConnect(rest); }\nelse if (cmd === \"log\") { await runLog(rest); }\nelse if (cmd === \"verify\") { await runVerify(); }\nelse if (cmd === \"test\") { await runTest(rest); }\nelse if (cmd === \"flush\") { await runFlush(); }\nelse if (cmd === \"status\") { runStatus(); }\nelse if (cmd === \"doctor\") { await runDoctor(); }\nelse if (cmd === \"capabilities\") { await runCapabilities(rest); }\nelse if (cmd === \"observations\") { await runObservations(rest); }\nelse if (cmd === \"policy\") { await runPolicy(rest); }\nelse if (cmd === \"budget\" && rest[0] === \"load\") { await runBudgetLoad(rest.slice(1)); }\nelse if (cmd === \"budget\" || cmd === \"delegation\") {\n // These change what the agent may do, so they are for a person at a terminal.\n if (rest[0] !== \"status\" && rest[0] !== \"list\") requireInteractive(cmd, rest);\n const dir = resolveConfigDir(process.cwd());\n const kid = (() => { try { return createSigner({ privateKeyPem: readFileSync(join(dir, \"agent.key\"), \"utf8\") }).kid; } catch { return \"\"; } })();\n process.exit(runDispatchCommand(cmd, rest, dir, kid));\n}\nelse if (cmd === \"uninstall\") { runUninstall(rest); }\nelse if (cmd === \"login\") { await runLogin(rest); }\nelse if (cmd === \"trust\") { runTrust(rest); }\nelse if (cmd === \"prune\") { await runPrune(rest); }\nelse if (cmd === \"rules\") { runRules(rest); }\nelse if (cmd === \"help\" || cmd === \"--help\" || cmd === \"-h\" || cmd === undefined) { printHelp(rest[0]); }\nelse {\n console.error(`unknown command: ${cmd}`);\n printHelp(undefined, true);\n process.exit(1);\n}\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,+EAA+E;AAC/E,gDAAgD;AAChD,EAAE;AACF,sFAAsF;AACtF,wFAAwF;AACxF,oCAAoC;AACpC,EAAE;AACF,qDAAqD;AACrD,kEAAkE;AAElE,uFAAuF;AACvF,uFAAuF;AACvF,yFAAyF;AACzF,wFAAwF;AACxF,wFAAwF;AACxF,CAAC;IACC,MAAM,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACzD,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;QAChC,IAAI,OAAO,CAAC,IAAI,KAAK,qBAAqB,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YAAE,OAAO;QACtF,KAAK,MAAM,OAAO,IAAI,mBAAmB;YAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC,CAA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GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;IAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAAC,CAAC;KACpG,CAAC;IACJ,OAAO,CAAC,KAAK,CAAC,oBAAoB,GAAG,EAAE,CAAC,CAAC;IACzC,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC","sourcesContent":["#!/usr/bin/env node\n// scopebond-hook — govern a coding agent's tool calls against policy, in-path,\n// before they run, with a signed local receipt.\n//\n// The command list, arguments and examples live in `COMMANDS` near the bottom of this\n// file, which is what `scopebond-hook help [command]` prints — one source rather than a\n// comment here that drifts from it.\n//\n// Config dir: $SCOPEBOND_HOOK_DIR, else ./.scopebond\n// Fail-closed: any error denies the action with a repair message.\n\n// `node:sqlite` (the receipt store) is still flagged experimental on Node 22, and Node\n// prints a warning on stderr the first time it loads — on every `verify`, and into the\n// agent's transcript on every hook call. It is a notice about Node, not about the user's\n// setup, so it is dropped; every other warning still prints through Node's own handler.\n// (The store is required lazily, after this module has run, so the filter is in place.)\n{\n const nodeWarningHandlers = process.listeners(\"warning\");\n process.removeAllListeners(\"warning\");\n process.on(\"warning\", (warning) => {\n if (warning.name === \"ExperimentalWarning\" && /sqlite/i.test(warning.message)) return;\n for (const handler of nodeWarningHandlers) handler.call(process, warning);\n });\n}\n\nimport { readFileSync, writeFileSync, existsSync, mkdtempSync, rmSync, statSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { hostname, tmpdir } from \"node:os\";\nimport { execFileSync } from \"node:child_process\";\nimport type { CloudEnrollmentBundle } from \"@scopebond/gateway\";\nimport { verifyReceipt } from \"@scopebond/gateway\";\nimport { openReceiptStore, loadOrCreateAttester } from \"@scopebond/gateway/node\";\nimport { callRequestOf, keyedIdFor, TYPED_ACTION_TYPES } from \"./typed-ops.js\";\nimport { databaseGuardActions } from \"./typed-infra.js\";\nimport { mapClaudeToolUse, mapCodexToolUse, mapCursorEvent, fillPushBranch, type Mapped } from \"./map.js\";\nimport { createHookRuntime, type Decision } from \"./runtime.js\";\nimport { useDigestKey, loadOrCreateDigestKey } from \"./minimize.js\";\nimport { scaffold, harnessSnippet, placeHook, type HookPlacement } from \"./init.js\";\nimport {\n userHome, userHarnessFile, resolveConfigDir, writeHarnessConfig, removeHarnessConfig,\n cursorDetected, codexDetected, absoluteHookCommand, isHarnessConfigured, purgeHome, type Harness,\n harnessScopes, harnessScopeLabel, configuredHookCommands, hookCommandResolves, projectHarnessFile,\n localHarnessFile, gitShareState, isMachineSpecificCommand, trustProjectPolicy, untrustedProjectPolicy, isTrustedProject,\n wireLifecycleHooks, unwireLifecycleHooks,\n} from \"./install.js\";\nimport {\n openObservations, describeObservations, observationStatus, stopReasonFromClaude, exitFromClaudeFailure,\n HEARTBEAT_INTERVAL_MS, OBSERVATIONS_SCOPE, type ObservationEmitter,\n} from \"./obs-emitter.js\";\nimport { OBSERVATION_DB, ObservationStore } from \"./obs-store.js\";\nimport { loadOrCreateBindingKey } from \"./observation.js\";\nimport { uploadPending } from \"./obs-upload.js\";\nimport { connectCloud, ingestUrl, loadConnection, connectionPath } from \"./cloud.js\";\nimport { recoverEarlierReceipts } from \"./recover.js\";\nimport { loadPolicyExport, policyBuilds } from \"./policy-load.js\";\nimport { isManaged, readMeta, MANAGED_DOC_FILE } from \"./managed.js\";\nimport { syncIfDue, syncPolicy, type SyncOptions, type SyncOutcome } from \"./policy-sync.js\";\nimport { loadBudgetExport } from \"./budget-load.js\";\nimport { compile, defaultRules, describeRules, loadRules, saveRules, rulesPath, pathRuleFor } from \"./rules.js\";\nimport { createSigner } from \"@scopebond/sdk\";\nimport { runDispatchCommand } from \"./dispatch-cli.js\";\nimport { describeAction, type ExplainIntent } from \"./explain.js\";\nimport { ensureDurableRuntime, pinnedCliPath, isEphemeralPath } from \"./runtime-install.js\";\nimport { cliCommand, hookCommand, hookVersion } from \"./version.js\";\nimport { recordRulesCredential } from \"./delivery-state.js\";\nimport { describeDelivery } from \"./delivery-report.js\";\nimport { computeManifest, renderManifest } from \"./capabilities.js\";\nimport { runProofFixtures, loadProofs, saveProofs, proofPassed, deliverProofReceipts } from \"./proof.js\";\nimport { fileURLToPath } from \"node:url\";\n\n/** The current git branch in `cwd` (best-effort). A bare `git push` pushes it, so\n * the runtime fills it in before evaluating; on failure the ref stays absent and\n * the starter policy fails closed. */\nfunction currentBranch(cwd: string): string | null {\n try {\n return execFileSync(\"git\", [\"-C\", cwd, \"symbolic-ref\", \"--quiet\", \"--short\", \"HEAD\"], {\n encoding: \"utf8\", stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim() || null;\n } catch { return null; }\n}\n\n/** Read an enrollment bundle from a file path, an inline base64 blob, or inline raw\n * JSON (the portal hands out a base64 blob so it is one clean argument). */\nfunction readBundleArg(bundleArg: string | undefined, stdin: () => string): CloudEnrollmentBundle {\n let text: string;\n if (!bundleArg) text = stdin();\n else if (existsSync(bundleArg)) text = readFileSync(bundleArg, \"utf8\");\n else if (bundleArg.trim().startsWith(\"{\")) text = bundleArg;\n else { try { text = Buffer.from(bundleArg, \"base64\").toString(\"utf8\"); } catch { text = bundleArg; } }\n return JSON.parse(text) as CloudEnrollmentBundle;\n}\n\nfunction configDir(): string {\n return process.env.SCOPEBOND_HOOK_DIR ?? join(process.cwd(), \".scopebond\");\n}\nfunction runtimePaths(dir: string, cwd?: string) {\n const connection = loadConnection(dir);\n return {\n policyPath: join(dir, \"policy.json\"),\n keyPath: join(dir, \"agent.key\"),\n attesterPath: join(dir, \"attester.key\"),\n dbPath: join(dir, \"receipts.db\"),\n ...(cwd ? { cwd } : {}),\n // Strict: deny (not just observe) tools with no taxonomy mapping.\n strict: process.argv.includes(\"--strict\") || process.env.SCOPEBOND_HOOK_STRICT === \"1\",\n // When connected, auto-export receipts. A short bounded flush keeps the hot path\n // fast; undelivered receipts persist in the durable outbox and flush next time\n // (or via `scopebond-hook flush`, e.g. on a session-end hook).\n ...(connection ? { cloud: { connection, flushTimeoutMs: Number(process.env.SCOPEBOND_HOOK_FLUSH_MS ?? 800) } } : {}),\n };\n}\n/** The harness's own id for this tool call, when it gives one (Claude Code and Codex send\n * `tool_use_id`), so the receipts of one call share a stable action group. */\nfunction callId(input: Record<string, unknown>): string | undefined {\n for (const key of [\"tool_use_id\", \"tool_call_id\", \"call_id\"]) {\n const value = input?.[key];\n if (typeof value === \"string\" && value !== \"\") return value;\n }\n return undefined;\n}\nfunction readStdin(): string {\n try { return readFileSync(0, \"utf8\"); } catch { return \"\"; }\n}\n\nfunction denyClaude(reason: string): never {\n process.stdout.write(JSON.stringify({\n hookSpecificOutput: { hookEventName: \"PreToolUse\", permissionDecision: \"deny\", permissionDecisionReason: reason },\n }) + \"\\n\");\n // A composed explanation already names Scopebond in its first line; only the\n // bare internal messages need the prefix.\n process.stderr.write(`${reason.startsWith(\"Scopebond\") ? reason : `Scopebond: ${reason}`}\\n`);\n process.exit(2);\n}\n\n/** Codex accepts the structured deny response on a successful hook exit. Keeping\n * exit 0 lets its UI show a completed policy check instead of a failed hook while\n * still preventing the tool call. */\nfunction denyCodex(reason: string): never {\n process.stdout.write(JSON.stringify({\n hookSpecificOutput: { hookEventName: \"PreToolUse\", permissionDecision: \"deny\", permissionDecisionReason: reason },\n }) + \"\\n\");\n process.exit(0);\n}\n\nconst harnessName = (harness: Harness): string => harness === \"claude\" ? \"Claude Code\" : harness === \"cursor\" ? \"Cursor\" : \"Codex\";\nconst harnessFileName = (harness: Harness): string => harness === \"claude\" ? \".claude/settings.json\" : harness === \"cursor\" ? \".cursor/hooks.json\" : \".codex/hooks.json\";\nconst selectedHarness = (args: string[]): Harness => args.includes(\"--codex\") ? \"codex\" : args.includes(\"--cursor\") ? \"cursor\" : \"claude\";\nconst codexTrustStep = \"Open Codex, run `/hooks`, review Scopebond, and choose Trust. Then start a new task.\";\n/** What Cursor can and cannot stop. Cursor has before-hooks for shell commands, MCP\n * calls and file reads, but reports file *edits* only after they are written, so an\n * out-of-policy edit is recorded and flagged rather than prevented. Said at install\n * time, because someone choosing a guardrail needs to know its edges up front. */\nconst cursorCoverageNote = [\n \"What this covers in Cursor:\",\n \" prevented shell commands, MCP tool calls, file reads — checked before they run\",\n \" recorded file edits — Cursor reports an edit only after writing it, so an\",\n \" out-of-policy edit is signed and flagged, not blocked\",\n \"For edits that must be blocked before they land, use the GitHub Action as a required\",\n \"check on pull requests.\",\n].join(\"\\n\");\n\n/** Record what was dispatched as observations, when this workspace enrolled for them. Purely\n * additive: it runs after the decision is made and can neither change it nor fail it. */\nfunction recordObservations(dir: string, cwd: string, input: Record<string, unknown>, decision: Decision, harness: Harness): ObservationEmitter | undefined {\n try {\n const { emitter } = openObservations(dir, { adapterVersion: hookVersion() });\n if (!emitter) return undefined;\n const sessionId = typeof input.session_id === \"string\" && input.session_id !== \"\" ? input.session_id : undefined;\n // Session lifecycle is Claude Code only: its SessionStart/SessionEnd hooks are the ones\n // the tested mapping covers. Other hosts still get tool intents from their PreToolUse.\n if (harness === \"claude\" && sessionId) emitter.activity(sessionId, cwd);\n emitter.toolIntents({ harnessSessionId: sessionId, callId: callId(input), cwd, dispatched: decision.dispatched ?? [], request: callRequestOf(input) });\n return emitter;\n } catch { return undefined; }\n}\n\n/** The remote-database actions of a shell call, only when the rule set opts in (`protect_remote_database`).\n * They are extra evaluated intents read from the raw command, so the deny happens before it runs. */\nfunction databaseGuard(dir: string, cwd: string, input: Record<string, unknown>): Mapped[] {\n let enabled = false;\n try { enabled = loadRules(dir)?.protect_remote_database === true; } catch { return []; }\n if (!enabled) return [];\n const request = callRequestOf(input);\n if (request?.command === undefined) return [];\n const intent = (params: Record<string, unknown>): Mapped => ({ intent: { action_type: \"db.exec\", params }, evaluated: true, source: \"shell\" });\n try {\n return databaseGuardActions(request.command, request.dialect ?? \"posix\", { cwd }).map((action) => intent({ ...action }));\n } catch {\n // The rule is on and the reader failed: a command that names a database tool is not waved through.\n return /(?:wrangler|psql)/i.test(request.command) ? [intent({ provider: \"unknown\", verb: \"unknown\", scope: \"unknown\", risk: \"unknown\" })] : [];\n }\n}\n\nasync function runPreToolUse(mapper: (input: Record<string, unknown>) => Mapped[], deny: (reason: string) => never = denyClaude, raw?: string, harness: Harness = \"claude\"): Promise<void> {\n let input: Record<string, unknown>;\n try { input = JSON.parse(raw ?? readStdin()); } catch { deny(\"hook received invalid JSON on stdin\"); }\n let runtime: ReturnType<typeof createHookRuntime> | undefined;\n try {\n const cwd = input?.cwd ? String(input.cwd) : process.cwd();\n const dir = resolveConfigDir(cwd);\n runtime = createHookRuntime(runtimePaths(dir, cwd));\n useDigestKey(loadOrCreateDigestKey(dir));\n const decision = await runtime.evaluate([...fillPushBranch(mapper(input!), currentBranch(cwd)), ...databaseGuard(dir, cwd, input!)], { groupKey: callId(input!) });\n const observer = recordObservations(dir, cwd, input!, decision, harness);\n // Workspace rules: at most every five minutes, a capped check alongside the record delivery. It never fails the call.\n await Promise.all([runtime.flush(), observer?.flush() ?? Promise.resolve(), syncIfDue(dir, () => syncOptionsFor(dir))]);\n observer?.close();\n // Close before deciding: the receipt is already committed, and leaving the handle\n // open is what made the write-ahead log grow without bound.\n runtime.close();\n runtime = undefined;\n if (decision.decision === \"deny\") deny(decision.reason);\n // Stay silent on allow/not_evaluated so the coding agent's normal permission\n // flow remains in charge. Scopebond blocks; it never silently approves.\n process.exit(0);\n } catch (error) {\n try { runtime?.close(); } catch { /* already failing; the deny below is what matters */ }\n deny(`Scopebond hook failed closed: ${(error as Error).message}. Repair: run \\`${cliCommand(\"init\")}\\`.`);\n }\n}\n\n/** Claude Code events other than PreToolUse: session start and end, and the after-action\n * events. They only feed observations; they never print a decision and always exit 0. */\nasync function runClaudeLifecycle(input: Record<string, unknown>): Promise<never> {\n try {\n const cwd = input.cwd ? String(input.cwd) : process.cwd();\n const { emitter } = openObservations(resolveConfigDir(cwd), { adapterVersion: hookVersion() });\n const sessionId = typeof input.session_id === \"string\" && input.session_id !== \"\" ? input.session_id : undefined;\n if (emitter) {\n try {\n switch (input.hook_event_name) {\n case \"SessionStart\": if (sessionId) emitter.sessionStart(sessionId, cwd); break;\n case \"SessionEnd\": if (sessionId) emitter.sessionStop(sessionId, stopReasonFromClaude(input.reason)); break;\n case \"PostToolUse\": { const id = callId(input); if (id) emitter.toolOutcomes(sessionId, id, \"ok\"); break; }\n case \"PostToolUseFailure\": { const id = callId(input); if (id) emitter.toolOutcomes(sessionId, id, exitFromClaudeFailure(input.is_interrupt)); break; }\n }\n await emitter.flush(input.hook_event_name === \"SessionEnd\" ? 1500 : 800);\n } finally { emitter.close(); }\n }\n } catch { /* observations are best effort; nothing here may affect the agent */ }\n process.exit(0);\n}\n\nconst CLAUDE_OBSERVATION_EVENTS = new Set([\"SessionStart\", \"SessionEnd\", \"PostToolUse\", \"PostToolUseFailure\"]);\n\nasync function runClaude(): Promise<void> {\n const raw = readStdin();\n let event: unknown; let input: Record<string, unknown> | undefined;\n try { input = JSON.parse(raw) as Record<string, unknown>; event = input?.hook_event_name; } catch { /* PreToolUse reports invalid input */ }\n if (input && typeof event === \"string\" && CLAUDE_OBSERVATION_EVENTS.has(event)) await runClaudeLifecycle(input);\n await runPreToolUse(mapClaudeToolUse, denyClaude, raw, \"claude\");\n}\n\nasync function runCodex(): Promise<void> {\n await runPreToolUse(mapCodexToolUse, denyCodex, undefined, \"codex\");\n}\n\nfunction denyCursor(reason: string): never {\n process.stdout.write(JSON.stringify({ permission: \"deny\", agentMessage: reason }) + \"\\n\");\n process.exit(0);\n}\n\nasync function runCursor(): Promise<void> {\n // Unparseable input denies, like every other adapter. Previously this fell through\n // to evaluation with an empty payload, which mapped to no known action and so\n // answered \"ask\" — handing an unreadable request to a prompt the user would very\n // likely accept. Deny-by-default on unparseable input is not optional.\n let parsed: unknown;\n try { parsed = JSON.parse(readStdin()); } catch { denyCursor(\"Scopebond: hook received invalid JSON on stdin\"); }\n if (typeof parsed !== \"object\" || parsed === null || Array.isArray(parsed)) {\n denyCursor(\"Scopebond: hook received a payload that is not a JSON object\");\n }\n const input = parsed as Record<string, unknown>;\n const event = String(input.hook_event_name ?? input.event ?? process.argv[3] ?? \"\");\n let permission: \"allow\" | \"deny\" | \"ask\" = \"deny\";\n let message = \"Scopebond hook failed closed\";\n let postHoc = false;\n let runtime: ReturnType<typeof createHookRuntime> | undefined;\n try {\n const cwd = input?.cwd ? String(input.cwd) : process.cwd();\n const dir = resolveConfigDir(cwd);\n runtime = createHookRuntime(runtimePaths(dir, cwd));\n useDigestKey(loadOrCreateDigestKey(dir));\n const mapped = fillPushBranch(mapCursorEvent(event, input), currentBranch(cwd));\n const decision = await runtime.evaluate(mapped, { groupKey: callId(input) });\n const observer = recordObservations(dir, cwd, input, decision, \"cursor\");\n await Promise.all([runtime.flush(), observer?.flush() ?? Promise.resolve(), syncIfDue(dir, () => syncOptionsFor(dir))]);\n observer?.close();\n // An `afterFileEdit` violation is real and recorded, but the edit has already\n // landed. Say so rather than letting \"blocked\" imply it was stopped.\n postHoc = mapped.some((m) => m.postHoc);\n // Three outcomes, three answers:\n // deny — out of policy, blocked outright.\n // allow — a rule was evaluated and permitted it. Returning \"ask\" here put a\n // confirmation prompt in front of every ordinary command, which is not\n // \"your agent works as normal\"; it also trained people to click through\n // prompts, which makes the real denials easier to miss. An evaluated\n // allow is a decision, not a silent auto-approval.\n // ask — nothing was evaluated (no rule covers this action), so Cursor's own\n // permission flow stays in charge. That is the fail-closed case and it\n // keeps its prompt.\n permission = decision.decision === \"deny\" ? \"deny\" : decision.decision === \"allow\" ? \"allow\" : \"ask\";\n message = decision.reason;\n } catch (error) {\n permission = \"deny\";\n message = `Scopebond hook failed closed: ${(error as Error).message}. Repair: run \\`${cliCommand(\"init\")}\\`.`;\n } finally {\n // Release the SQLite handles on every path: an unclosed writer leaves its\n // write-ahead log behind for the next tool call to extend.\n try { runtime?.close(); } catch { /* the decision is already recorded */ }\n }\n if (postHoc && permission === \"deny\") {\n message = `${message}\\nCursor reports a file edit only after it is written, so this edit was not prevented. Review and revert it yourself.`;\n }\n process.stdout.write(JSON.stringify({ permission, agentMessage: message }) + \"\\n\");\n process.exit(0);\n}\n\n/** `init`, `trust` and `uninstall` change what governs the agent, so they are for a\n * person at a terminal. A coding agent's shell is not interactive: without a TTY on\n * stdin they refuse unless `--yes` is passed (for scripts and CI). The starter policy\n * also denies the agent running them. */\nfunction requireInteractive(command: string, args: string[]): void {\n if (process.stdin.isTTY || args.includes(\"--yes\")) return;\n console.error(`scopebond ${command} changes what governs your coding agent, so it does not run unattended.`);\n console.error(`There is no terminal on stdin here — which is also what it looks like when the agent itself`);\n console.error(`tries to run this, so the refusal is deliberate rather than a bug.`);\n console.error(``);\n console.error(`If you are a person: run it in your own terminal, or confirm it now with --yes:`);\n console.error(` ${cliCommand(`${command} --yes`)}`);\n console.error(`Scripts, CI and container builds should always pass --yes.`);\n process.exit(1);\n}\n\nfunction runInit(args: string[]): void {\n const harness = selectedHarness(args);\n const dir = configDir();\n // A dry run changes nothing, so it needs no terminal and no --yes.\n if (args.includes(\"--dry-run\")) {\n const shared = projectHarnessFile(harness, process.cwd());\n const local = localHarnessFile(harness, process.cwd());\n const personal = args.includes(\"--shared\") || args.includes(\"--npx\") ? null\n : local ?? (gitShareState(shared) === \"tracked\" ? null : shared);\n console.log(`Dry run — nothing is written.\\n`);\n console.log(`Would scaffold ${dir} (machine key, countersigning key, starter policy, .gitignore)`);\n if (args.includes(\"--no-install\")) {\n console.log(`Would print the ${harnessFileName(harness)} snippet instead of writing it`);\n } else if (personal) {\n console.log(`Would configure ${personal} (this machine only; kept out of git)`);\n console.log(` adding hook \"<node>\" \"${pinnedCliPath(hookVersion())}\" ${harness}`);\n console.log(` (or the path this copy runs from, when it is already installed durably)`);\n if (local) console.log(` and remove any machine-specific Scopebond entry from ${shared}`);\n } else {\n console.log(`Would configure ${shared} (shared — safe to commit)`);\n console.log(` adding hook ${hookCommand(harness)}`);\n }\n console.log(`\\nNothing else in those files is changed. Run without --dry-run to apply.`);\n process.exit(0);\n }\n requireInteractive(\"init\", args);\n const { agentKid, policyPath, rulesPath: rulesFile } = scaffold(dir, { force: args.includes(\"--force\") });\n console.log(`Scopebond hook enrolled in ${dir}`);\n console.log(` machine key ${agentKid}`);\n console.log(` rules ${rulesFile} (the readable list — edit this)`);\n console.log(` policy ${policyPath} (compiled from the rules; don't hand-edit)`);\n // With a user-level install present, a project policy governs only once trusted.\n // Running init here is that decision, so pin this policy now.\n if (!process.env.SCOPEBOND_HOOK_DIR && existsSync(join(userHome(), \"policy.json\"))) {\n trustProjectPolicy(dir);\n console.log(` trusted overrides ${userHome()} here; after editing it, run \\`${cliCommand(\"trust\")}\\``);\n }\n // The hook command runs once per tool call, so it must start fast. `npx` re-resolves\n // a package that is already on disk and costs ~830 ms a call; the same CLI invoked\n // directly costs ~110 ms. Pin a durable copy and use that, and fall back to `npx`\n // (slow, but it always starts) when no durable copy can be made. `--npx` forces the\n // portable form for anyone who wants it.\n const shared = args.includes(\"--shared\");\n const pin = args.includes(\"--npx\") || shared ? { cli: null, how: \"unavailable\" as const } : ensureDurableRuntime(cliPath(), hookVersion());\n const command = pin.cli ? absoluteHookCommand(pin.cli, harness) : undefined;\n // Configure the agent automatically by default (idempotent), so there is no\n // hand-editing step; --no-install prints the snippet instead.\n if (!args.includes(\"--no-install\")) {\n let placed: HookPlacement;\n try { placed = placeHook(harness, process.cwd(), command, { shared }); } catch (error) { console.error((error as Error).message); process.exit(1); }\n // No per-action millisecond claim here: it varies by machine, and this project only\n // states numbers it has measured. The measured comparison lives in the changelog.\n console.log(` hook runtime ${placed.scope === \"personal\"\n ? `${pin.cli}\\n pinned — no npx resolution per action`\n : `npx @scopebond/hook@${hookVersion()} — portable, but re-resolves on every action`}`);\n console.log(\"\");\n console.log(`✓ ${harnessName(harness)} configured in ${placed.file}`);\n console.log(placed.scope === \"personal\"\n ? ` this machine only — kept out of git, so no teammate inherits a path that does not exist for them`\n : ` shared — the portable command starts on any machine that clones this project`);\n if (placed.repaired > 0) console.log(` moved a machine-specific hook out of ${projectHarnessFile(harness, process.cwd())}; commit that change`);\n if (placed.note) console.log(` note: ${placed.note}`);\n if (harness === \"codex\") console.log(`\\nOne last step: ${codexTrustStep}`);\n if (harness === \"cursor\") console.log(`\\n${cursorCoverageNote}`);\n } else {\n // The snippet is for a file the user will likely commit, so it carries the portable\n // command; the pinned one is offered separately, for a file only this machine uses.\n console.log(`Add this to your ${harnessFileName(harness)}:`);\n console.log(harnessSnippet(harness));\n const local = localHarnessFile(harness, process.cwd());\n if (command && local) {\n console.log(`\\nFaster, for this machine only — use this command in ${local} instead (keep that file out of git):`);\n console.log(` ${command}`);\n }\n if (harness === \"cursor\") console.log(`\\n${cursorCoverageNote}`);\n }\n console.log(\"\");\n // Print the runnable `npx` form: after `npx @scopebond/hook init` there is no\n // `scopebond-hook` binary on PATH, so a bare `scopebond-hook log` would fail.\n console.log(`Next: run one command in the agent, then \\`${cliCommand(\"log\")}\\` to see the receipt`);\n console.log(`and \\`${cliCommand(\"verify\")}\\` to check it offline. Try \\`${cliCommand('test \"rm -rf /\"')}\\`.`);\n console.log(`To send receipts to a workspace: ${cliCommand(\"connect <workspace-url> <enrollment>\")}`);\n}\n\nfunction decisionOf(payload: Record<string, unknown>): string {\n const rr = String(payload.realtime_result ?? \"\");\n const state = String((payload.execution as Record<string, unknown> | undefined)?.state ?? \"\");\n if (state === \"observed_not_evaluated\") return \"not_evaluated\";\n if (rr === \"deny\") return state === \"cooperative_allow\" || state === \"executed\" ? \"monitor\" : \"deny\";\n return \"allow\";\n}\n\nfunction describeIntent(payload: Record<string, unknown>): string {\n return describeAction(payload.intent as ExplainIntent | undefined);\n}\n\n/** `log [-n N] [--deny] [--since <when>]` — the recent decisions.\n *\n * \"What did my agents get blocked on this week\" had no answer at the CLI: the only\n * output was an unfiltered tail. `--deny` and `--since` make it answerable, and the\n * tail is read as a tail (`ORDER BY id DESC LIMIT`) rather than by loading and parsing\n * every receipt ever recorded and slicing the end off. */\nasync function runLog(args: string[]): Promise<void> {\n const dir = resolveConfigDir(process.cwd());\n const dbPath = join(dir, \"receipts.db\");\n if (!existsSync(dbPath)) { console.log(\"no receipts yet — run a command in the agent first.\"); process.exit(0); }\n const nIdx = args.indexOf(\"-n\");\n const n = nIdx >= 0 ? Math.max(1, Number(args[nIdx + 1]) || 20) : 20;\n const denyOnly = args.includes(\"--deny\");\n const sinceIdx = args.indexOf(\"--since\");\n const since = sinceIdx >= 0 ? parseSince(args[sinceIdx + 1]) : null;\n if (sinceIdx >= 0 && since === null) {\n console.error(`--since wants a duration (7d, 24h, 30m) or a date (2026-09-25); got ${args[sinceIdx + 1] ?? \"nothing\"}`);\n process.exit(1);\n }\n const { store } = openReceiptStore({ db: dbPath });\n try {\n const total = store.count ? await Promise.resolve(store.count()) : (await Promise.resolve(store.list())).length;\n // A filter has to look past the last N to find N matches; without one, read only the\n // tail. The scan is still bounded so a huge log cannot hang the command.\n const budget = denyOnly || since ? Math.min(Math.max(n * 50, 1000), 20000) : n;\n const scanned = store.recent\n ? await Promise.resolve(store.recent(budget))\n : (await Promise.resolve(store.list())).slice(-budget).reverse();\n const matching = scanned.filter((r) => {\n const p = r.payload as unknown as Record<string, unknown>;\n if (denyOnly && decisionOf(p) !== \"deny\") return false;\n if (since) {\n const at = Date.parse(String(p.timestamp ?? \"\"));\n if (!Number.isFinite(at) || at < since) return false;\n }\n return true;\n });\n const shown = matching.slice(0, n).reverse(); // oldest-first on screen, newest last\n if (shown.length === 0) {\n console.log(denyOnly || since ? \"no receipts match that filter.\" : \"no receipts yet.\");\n process.exit(0);\n }\n for (const r of shown) {\n const p = r.payload as unknown as Record<string, unknown>;\n console.log(`${String(p.timestamp ?? \"\")} ${decisionOf(p).padEnd(13)} ${describeIntent(p)}`);\n }\n const filters = [denyOnly ? \"denied\" : \"\", since ? `since ${new Date(since).toISOString()}` : \"\"].filter(Boolean).join(\", \");\n const scope = filters ? ` matching ${filters}` : \"\";\n const capped = (denyOnly || since) && scanned.length >= budget && total > budget;\n console.log(`\\n${shown.length}${scope} of ${total} receipt(s)${capped ? ` — searched the most recent ${budget}` : \"\"}. Verify them: ${cliCommand(\"verify\")}`);\n } finally {\n try { store.close?.(); } catch { /* read-only */ }\n }\n}\n\n/** `rules` — read and change the limits in plain terms.\n *\n * Without this, \"edit the limits\" meant hand-writing a ~700-character case-folded\n * negative lookahead, which nobody does — so the starter policy was effectively the only\n * policy. The lists live in `.scopebond/rules.json`; `policy.json` is compiled from them. */\nfunction runRules(args: string[]): void {\n const dir = resolveConfigDir(process.cwd());\n if (!existsSync(join(dir, \"policy.json\"))) {\n console.error(`no policy here yet — run \\`${cliCommand(\"init\")}\\` first.`);\n process.exit(1);\n }\n const rules = loadRules(dir) ?? defaultRules();\n const [verb, ...values] = args.filter((a) => !a.startsWith(\"--\"));\n const value = values.join(\" \").trim();\n\n if (!verb || verb === \"show\") {\n console.log(`Rules for ${dir}`);\n if (!loadRules(dir)) console.log(`(showing the defaults — ${rulesPath(dir)} will be written on your first change)`);\n console.log(\"\");\n console.log(describeRules(rules));\n console.log(\"\");\n console.log(`Change them:`);\n console.log(` ${cliCommand(\"rules allow <program>\")} stop blocking a program`);\n console.log(` ${cliCommand(\"rules block <program>\")} start blocking one`);\n console.log(` ${cliCommand(\"rules protect <path>\")} never write there`);\n console.log(` ${cliCommand(\"rules unprotect <path>\")} allow writing there again`);\n console.log(` ${cliCommand(\"rules protect-branch <name>\")} never push there`);\n console.log(` ${cliCommand(\"rules unprotect-branch <name>\")}`);\n console.log(` ${cliCommand(\"rules protect-remote-database\")} block destructive or unreadable SQL on a remote database (off by default)`);\n console.log(`Or edit ${rulesPath(dir)} directly, then \\`${cliCommand(\"rules apply\")}\\`.`);\n process.exit(0);\n }\n\n const needsValue = [\"allow\", \"block\", \"protect\", \"unprotect\", \"protect-branch\", \"unprotect-branch\"];\n if (needsValue.includes(verb) && !value) {\n console.error(`\\`rules ${verb}\\` needs a value, e.g. \\`${cliCommand(`rules ${verb} ${verb.includes(\"branch\") ? \"production\" : verb.includes(\"protect\") ? \"infra/\" : \"dd\"}`)}\\``);\n process.exit(1);\n }\n\n let changed = \"\";\n switch (verb) {\n case \"allow\": {\n const before = rules.destructive_programs.length;\n rules.destructive_programs = rules.destructive_programs.filter((p) => p.toLowerCase() !== value.toLowerCase());\n if (rules.destructive_programs.length === before) { console.log(`${value} was not in the blocked list; nothing to change.`); process.exit(0); }\n changed = `${value} is no longer blocked`;\n break;\n }\n case \"block\": {\n if (rules.destructive_programs.some((p) => p.toLowerCase() === value.toLowerCase())) { console.log(`${value} is already blocked.`); process.exit(0); }\n rules.destructive_programs.push(value.toLowerCase());\n changed = `${value} is now blocked`;\n break;\n }\n case \"protect\": case \"unprotect\": {\n const list = verb === \"protect\" ? \"protected_write\" : \"protected_write\";\n const rule = pathRuleFor(value);\n if (verb === \"protect\") {\n if (rules[list].some((r) => r.label === rule.label)) { console.log(`${value} is already protected.`); process.exit(0); }\n rules[list].push(rule);\n changed = `writes to ${rule.label} are now blocked`;\n } else {\n const before = rules[list].length;\n rules[list] = rules[list].filter((r) => r.label !== rule.label && !r.label.startsWith(`${value.replace(/\\/$/, \"\")}/`));\n if (rules[list].length === before) {\n console.log(`${value} is not in the protected list. Current list:`);\n for (const r of rules[list]) console.log(` ${r.label}`);\n process.exit(1);\n }\n changed = `writes to ${value} are allowed again`;\n }\n break;\n }\n case \"protect-branch\": {\n if (rules.protected_branches.some((b) => b.toLowerCase() === value.toLowerCase())) { console.log(`${value} is already protected.`); process.exit(0); }\n rules.protected_branches.push(value);\n changed = `pushes to ${value} are now blocked`;\n break;\n }\n case \"unprotect-branch\": {\n const before = rules.protected_branches.length;\n rules.protected_branches = rules.protected_branches.filter((b) => b.toLowerCase() !== value.toLowerCase());\n if (rules.protected_branches.length === before) { console.log(`${value} was not protected; nothing to change.`); process.exit(0); }\n changed = `pushes to ${value} are allowed again`;\n break;\n }\n case \"protect-remote-database\":\n if (rules.protect_remote_database === true) { console.log(\"Remote databases are already protected.\"); process.exit(0); }\n rules.protect_remote_database = true;\n changed = \"remote SQL that drops, deletes or updates every row, or cannot be read, is now blocked\";\n break;\n case \"unprotect-remote-database\":\n if (rules.protect_remote_database !== true) { console.log(\"Remote databases were not protected; nothing to change.\"); process.exit(0); }\n delete rules.protect_remote_database;\n changed = \"remote SQL is no longer checked\";\n break;\n case \"apply\":\n changed = `recompiled from ${rulesPath(dir)}`;\n break;\n default:\n console.error(`unknown: rules ${verb}`);\n printHelp(\"rules\", true);\n process.exit(1);\n }\n\n if (isManaged(dir)) {\n console.error(\"The rules on this computer are set by your Scopebond workspace, so they cannot be changed here.\");\n console.error(\"Change them in the workspace (Rules), or disconnect this computer to manage its rules locally again.\");\n process.exit(1);\n }\n // Changing what governs the agent is the same class of action as `init`.\n requireInteractive(\"rules\", args);\n const policyPath = join(dir, \"policy.json\");\n const agentKid = createSigner({ privateKeyPem: readFileSync(join(dir, \"agent.key\"), \"utf8\") }).kid;\n saveRules(dir, rules);\n writeFileSync(policyPath, `${JSON.stringify(compile(rules, agentKid), null, 2)}\\n`);\n console.log(`✓ ${changed}`);\n console.log(` rules ${rulesPath(dir)}`);\n console.log(` policy ${policyPath} (recompiled)`);\n // A project policy governs only once trusted, and the hash just changed.\n if (!process.env.SCOPEBOND_HOOK_DIR && existsSync(join(userHome(), \"policy.json\"))) {\n trustProjectPolicy(dir);\n console.log(` trusted re-pinned for this project`);\n }\n console.log(`\\nCheck it: ${cliCommand('test \"rm -rf /\"')}`);\n process.exit(0);\n}\n\n/** `prune --before <when> [--yes]` — bound the local receipt store.\n *\n * Signed receipts are the product, so this never runs on its own and never quietly\n * destroys anything: it archives what it will remove to a JSONL file beside the\n * database first, and it refuses entirely once the log has been anchored, because a\n * receipt's position is its anchor leaf index. Without a `--before` it reports the\n * footprint and exits. */\nasync function runPrune(args: string[]): Promise<void> {\n const dir = resolveConfigDir(process.cwd());\n const dbPath = join(dir, \"receipts.db\");\n if (!existsSync(dbPath)) { console.log(\"no local receipts yet — nothing to prune.\"); process.exit(0); }\n const beforeIdx = args.indexOf(\"--before\");\n if (beforeIdx < 0) {\n console.log(`local receipts ${dbPath}`);\n console.log(` ${describeStore(dbPath)}`);\n console.log(`\\nNothing is removed automatically. To bound it, name a cutoff:`);\n console.log(` ${cliCommand(\"prune --before 90d\")} # older than 90 days`);\n console.log(` ${cliCommand(\"prune --before 2026-01-01\")}`);\n console.log(`Receipts are archived beside the database before removal.`);\n process.exit(0);\n }\n const cutoff = parseSince(args[beforeIdx + 1]);\n if (cutoff === null) {\n console.error(`--before wants a duration (90d, 24h) or a date (2026-01-01); got ${args[beforeIdx + 1] ?? \"nothing\"}`);\n process.exit(1);\n }\n const iso = new Date(cutoff).toISOString();\n const { store } = openReceiptStore({ db: dbPath });\n const sqlite = store as typeof store & {\n before?(iso: string): unknown[];\n removeBefore?(iso: string): { removed: number };\n };\n if (!sqlite.before || !sqlite.removeBefore) {\n console.error(\"this receipt store does not support pruning (no SQLite available).\");\n process.exit(1);\n }\n try {\n const doomed = sqlite.before(iso);\n if (doomed.length === 0) { console.log(`no receipts older than ${iso}.`); process.exit(0); }\n const before = describeStore(dbPath);\n console.log(`${doomed.length} receipt(s) recorded before ${iso} (store is currently ${before}).`);\n if (!args.includes(\"--yes\") && !process.stdin.isTTY) {\n console.error(`\\nThis removes signed evidence, so it needs an explicit confirmation:`);\n console.error(` ${cliCommand(`prune --before ${args[beforeIdx + 1]} --yes`)}`);\n process.exit(1);\n }\n const archive = join(dir, `receipts-archived-${new Date().toISOString().replace(/[:.]/g, \"-\")}.jsonl`);\n writeFileSync(archive, `${doomed.map((r) => JSON.stringify(r)).join(\"\\n\")}\\n`);\n console.log(`archived to ${archive}`);\n const { removed } = sqlite.removeBefore(iso);\n console.log(`removed ${removed} receipt(s)`);\n store.close?.();\n console.log(`store now ${describeStore(dbPath)}`);\n console.log(`\\nThe archive is a plain JSONL of signed receipts — still verifiable, still yours.`);\n process.exit(0);\n } catch (error) {\n try { store.close?.(); } catch { /* closing after a failure */ }\n console.error(`prune refused: ${(error as Error).message}`);\n process.exit(1);\n }\n}\n\n/** A `--since` value: a duration (`7d`, `24h`, `30m`) or an ISO-ish date. */\nexport function parseSince(value: string | undefined, now: number = Date.now()): number | null {\n if (!value) return null;\n const duration = /^(\\d+)\\s*([dhm])$/i.exec(value.trim());\n if (duration) {\n const scale = { d: 86_400_000, h: 3_600_000, m: 60_000 }[duration[2].toLowerCase() as \"d\" | \"h\" | \"m\"];\n return now - Number(duration[1]) * scale;\n }\n const at = Date.parse(value);\n return Number.isFinite(at) ? at : null;\n}\n\nasync function runVerify(): Promise<void> {\n const dir = resolveConfigDir(process.cwd());\n const dbPath = join(dir, \"receipts.db\");\n const attesterPath = join(dir, \"attester.key\");\n if (!existsSync(dbPath) || !existsSync(attesterPath)) { console.log(\"nothing to verify yet (no receipts or no attester key).\"); process.exit(0); }\n const { attester } = loadOrCreateAttester({ file: attesterPath });\n const { store } = openReceiptStore({ db: dbPath });\n // Verification is the one command that must read everything — that is the point of it.\n // It just should not look hung while doing so: at ~2.6 s per 20,000 receipts a long\n // history is a visible wait, so report progress on a TTY.\n const all = await Promise.resolve(store.list());\n try { store.close?.(); } catch { /* read-only */ }\n const progress = process.stdout.isTTY && all.length >= 2000;\n let ok = 0;\n const bad: string[] = [];\n for (const [index, r] of all.entries()) {\n const result = verifyReceipt(r, attester.publicKeyPem) as unknown as Record<string, boolean>;\n if (result.valid) ok += 1;\n else {\n const failed = Object.entries(result).filter(([k, v]) => k.endsWith(\"_valid\") && v === false).map(([k]) => k);\n bad.push(`${String((r.payload as unknown as Record<string, unknown>).timestamp ?? \"\")}: ${failed.join(\", \") || \"invalid\"}`);\n }\n if (progress && (index + 1) % 1000 === 0) process.stderr.write(`\\rverifying ${index + 1}/${all.length}…`);\n }\n if (progress) process.stderr.write(\"\\r\".padEnd(40) + \"\\r\");\n console.log(`${ok}/${all.length} receipt(s) verify offline against ${attesterPath}.`);\n if (bad.length) { for (const b of bad) console.error(` ✗ ${b}`); process.exit(1); }\n process.exit(0);\n}\n\nasync function runTest(args: string[]): Promise<void> {\n const command = args.find((a) => !a.startsWith(\"-\"));\n if (!command) { console.error('usage: scopebond-hook test \"<shell command>\"'); process.exit(1); }\n const dir = resolveConfigDir(process.cwd());\n if (!existsSync(join(dir, \"policy.json\"))) { console.error(`no policy yet — run \\`${cliCommand(\"init\")}\\` first.`); process.exit(1); }\n // Evaluate against the real policy and keys, but a throwaway store, so `test`\n // never records a receipt or exports anything.\n const tmp = mkdtempSync(join(tmpdir(), \"sb-hook-test-\"));\n try {\n const runtime = createHookRuntime({\n policyPath: join(dir, \"policy.json\"), keyPath: join(dir, \"agent.key\"),\n attesterPath: join(dir, \"attester.key\"), dbPath: join(tmp, \"receipts.db\"),\n strict: process.argv.includes(\"--strict\"),\n });\n const mapped = fillPushBranch(mapClaudeToolUse({ tool_name: \"Bash\", tool_input: { command } }), currentBranch(process.cwd()));\n console.log(`command: ${command}`);\n for (const m of mapped) {\n const d = await runtime.evaluateOne(m);\n // One tidy row per action. A deny's full explanation is multi-line, so the\n // row carries only the deciding rule and the whole message is printed once,\n // below — exactly as the agent will receive it.\n const note = d.decision === \"deny\" ? (d.clauseId ? `rule \"${d.clauseId}\"` : \"\")\n : d.decision === \"not_evaluated\" ? d.reason : \"\";\n console.log(` ${describeIntent({ intent: m.intent }).padEnd(28)} → ${d.decision.padEnd(14)}${note}`);\n }\n const overall = await runtime.evaluate(mapped);\n console.log(`\\noverall: ${overall.decision}`);\n if (overall.decision === \"deny\" && overall.reason) console.log(`\\n${overall.reason}`);\n process.exit(overall.decision === \"deny\" ? 2 : 0);\n } finally {\n rmSync(tmp, { recursive: true, force: true });\n }\n}\n\nasync function runConnect(args: string[]): Promise<void> {\n const positional = args.filter((a) => !a.startsWith(\"--\"));\n const url = positional[0];\n const bundleArg = positional[1];\n const harness = selectedHarness(args);\n if (!url) {\n console.error(`usage: ${cliCommand(\"connect <workspace-url> <enrollment> [--claude|--cursor|--codex] [--no-install] [--project]\")}`);\n console.error(enrollmentHelp);\n process.exit(1);\n }\n const dir = connectDir(args);\n // One command sets everything up: scaffold the key, attester and starter policy if\n // they do not exist, then enroll and persist the scoped machine credential. The\n // enrollment can be a file, an inline base64 blob (what the portal hands out) or\n // raw JSON — the user never has to save or open a JSON file.\n scaffold(dir, {});\n let bundle: CloudEnrollmentBundle;\n try { bundle = readBundleArg(bundleArg, readStdin); }\n catch { console.error(`could not read the enrollment (expected a file, inline blob, or JSON on stdin)\\n${enrollmentHelp}`); process.exit(1); }\n await finishConnect(dir, url, bundle, harness, args);\n}\n\n/** Enroll with a bundle and wire the agent: shared by `connect` (a pasted enrollment)\n * and `login` (one received through device-code approval). */\nasync function finishConnect(dir: string, url: string, bundle: CloudEnrollmentBundle, harness: Harness, args: string[]): Promise<void> {\n try {\n const c = await connectCloud(dir, url, bundle);\n console.log(`✓ Connected to ${c.url}`);\n if (c.rotatedFrom) console.log(`✓ This computer's earlier key (${c.rotatedFrom}) was no longer accepted, so it was replaced; the old key is kept in ${join(dir, \"retired-keys\")}`);\n if (c.setAside) console.log(` ${c.setAside.toLocaleString()} queued record(s) signed by an earlier key cannot go through this connection. To deliver them, run: ${cliCommand(\"recover\")}`);\n // With a user-level install present, the hook ignores a project policy until it is\n // trusted, and would fall back to the user home, which holds no cloud.json: the agent\n // stays governed, but nothing reaches the workspace. Connecting this project is the\n // user's decision to use it, exactly as running `init` here is, so pin it the same way.\n if (!process.env.SCOPEBOND_HOOK_DIR && resolve(dir) !== resolve(userHome()) && existsSync(join(userHome(), \"policy.json\"))) {\n trustProjectPolicy(dir);\n console.log(`✓ This project's rules are trusted (they override ${userHome()} here)`);\n }\n // Configure the agent automatically (merges into the existing config), unless the\n // caller opts out. This removes the \"paste this snippet\" step. A hook that is already\n // configured — pinned by `init`, or user-level by `install` — is left as it is:\n // connecting changes where receipts go, not how the hook starts.\n const scopes = harnessScopes(harness, process.cwd());\n const existing = scopes.local ?? scopes.project ?? scopes.user;\n if (existing && !args.includes(\"--no-install\")) {\n console.log(`✓ ${harnessName(harness)} already configured in ${existing}`);\n } else if (!args.includes(\"--no-install\")) {\n // A connection for this computer (the user home, the default) covers every project,\n // so the hook goes into the user-level agent settings. Placing it in the current\n // folder's project settings — what this did before — left every other project\n // unchecked, and a sign-in run from a scratch folder governed only that folder.\n // `--project` (a per-project connection) keeps the project placement.\n const file = dir === userHome()\n ? writeHarnessConfig(userHarnessFile(harness), harness, durableHookCommand(harness))\n : placeHook(harness, process.cwd(), undefined).file;\n console.log(`✓ ${harnessName(harness)} configured in ${file}`);\n if (harness === \"codex\") console.log(`\\nOne last step: ${codexTrustStep}`);\n } else {\n console.log(`Add this to your ${harnessFileName(harness)}:`);\n console.log(harnessSnippet(harness));\n }\n // Session and after-action observations are opt-in through the enrollment: wired only\n // when this workspace granted observations:write and Claude Code is the host. Off is\n // silent here (`status` says why); a granted scope the hook cannot use is worth a line.\n const observing = observationStatus(loadConnection(dir));\n if (observing.state === \"on\" && harness === \"claude\" && !args.includes(\"--no-install\")) {\n const placed = harnessScopes(\"claude\", process.cwd());\n const target = placed.local ?? placed.project ?? placed.user;\n const command = target ? configuredHookCommands(target)[0] : undefined;\n if (target && command) { wireLifecycleHooks(target, command); console.log(`✓ Session and after-action observations enabled in ${target}`); }\n } else if (observing.state === \"unsupported\") console.log(`Observations: ${observing.reason}`);\n console.log(\"\");\n console.log(\"Run your agent — the first action appears in your workspace within seconds.\");\n } catch (error) {\n const message = (error as Error).message;\n console.error(`connect failed: ${message}`);\n if (/enrollment|expired|401|403/i.test(message)) console.error(enrollmentHelp);\n process.exit(1);\n }\n}\n\n/** Where an enrollment comes from, for every connect error that means \"this one will\n * not work\": the bare \"invalid enrollment token\" told the reader nothing about what to\n * do next. */\nconst enrollmentHelp = [\n \"An enrollment comes from your Scopebond workspace: open it, choose to connect an agent,\",\n \"and copy the command it shows — it includes the workspace URL and a fresh enrollment.\",\n \"Each enrollment is single-use and expires soon after it is created; if this one was\",\n \"used or has expired, create a new one there.\",\n].join(\"\\n\");\n\n/** Where `connect` and `login` write. A project someone set up here with `init` (it has a\n * policy) is connected, as before. Otherwise the configuration the hook itself uses from\n * here — usually the user-level install — so reconnecting from any folder repairs the\n * connection that is actually failing instead of creating a second, project-level one\n * beside it. `--project` asks for a new per-project setup explicitly. */\nfunction connectDir(args: string[]): string {\n const project = configDir();\n return args.includes(\"--project\") || existsSync(join(project, \"policy.json\")) ? project : resolveConfigDir(process.cwd());\n}\n\n/** `recover [--no-wait]`: deliver receipts that an earlier, since-revoked key of this computer\n * signed and the workspace never received, after an owner or admin approves it there. */\nasync function runRecover(args: string[]): Promise<void> {\n const dir = resolveConfigDir(process.cwd());\n const connection = loadConnection(dir);\n if (!connection) {\n console.error(`not connected to a workspace; run \\`${cliCommand(\"login <workspace-url>\")}\\` first`);\n process.exit(1);\n }\n console.log(`Recovering from ${dir}`);\n const result = await recoverEarlierReceipts(dir, connection, {\n log: (line) => console.log(line),\n fetch,\n now: Date.now,\n sleep: (ms) => new Promise((done) => setTimeout(done, ms)),\n }, { wait: !args.includes(\"--no-wait\"), waitMs: 15 * 60_000, pollMs: 5_000 });\n if (result.groups) {\n const parts = [\n `recovered ${result.accepted.toLocaleString()}`,\n `already present ${result.duplicates.toLocaleString()}`,\n `refused ${result.rejected.toLocaleString()}`,\n ...(result.pending ? [`waiting for approval ${result.pending.toLocaleString()}`] : []),\n ...(result.skipped ? [`skipped ${result.skipped.toLocaleString()}`] : []),\n ];\n console.log(`\\nDone: ${parts.join(\", \")}.`);\n }\n process.exitCode = result.failed || result.pending ? 1 : 0;\n}\n\nasync function runFlush(): Promise<void> {\n const dir = resolveConfigDir(process.cwd());\n if (!loadConnection(dir)) { console.error(`not connected to a workspace; run \\`${cliCommand(\"connect <workspace-url> <enrollment>\")}\\` first`); process.exit(1); }\n const runtime = createHookRuntime(runtimePaths(dir));\n await runtime.exporter?.flush();\n const status = runtime.exporter?.status();\n runtime.exporter?.stop();\n console.log(`flushed; ${status?.pending ?? 0} receipt(s) still pending${status?.lastError ? ` (last error: ${status.lastError})` : \"\"}`);\n // Let pending HTTP handles close normally (forced exit can abort on Windows).\n process.exitCode = status && status.pending > 0 ? 1 : 0;\n}\n\n/** `observations`: what the observation emitters are doing, and the local queue. */\n/** `policy load <export.json> [--yes]`: check a policy exported from the workspace and, with\n * `--yes`, make it the active policy here; then acknowledge it (or its refusal) to the workspace. */\nasync function runPolicy(args: string[]): Promise<void> {\n const [sub, file] = args;\n if (sub === \"sync\") { await runPolicySync(args.includes(\"--background\")); return; }\n if (sub !== \"load\" || !file) { console.error(`usage: ${cliCommand(\"policy sync\")} | ${cliCommand(\"policy load <export.json> [--yes]\")}`); process.exitCode = 2; return; }\n const dir = resolveConfigDir(process.cwd());\n if (isManaged(dir)) {\n console.error(\"The rules on this computer are set by your Scopebond workspace; a policy file cannot replace them here.\");\n process.exitCode = 1;\n return;\n }\n const apply = args.includes(\"--yes\");\n const connection = loadConnection(dir);\n const outcome = loadPolicyExport(dir, file, { apply, environmentId: connection?.environment_id });\n let ack: Parameters<ObservationEmitter[\"policyAck\"]>[0] | undefined;\n if (outcome.state === \"rejected\") {\n console.error(`refused: ${outcome.message} (${outcome.error})`);\n if (outcome.ack) ack = { ...outcome.ack, error: outcome.error };\n process.exitCode = 1;\n } else if (outcome.state === \"would_load\") {\n console.log(`This export checks out (policy ${outcome.facts.policyId} v${outcome.facts.policyVersion}, digest ${outcome.facts.policyDigest.slice(0, 12)}...).`);\n console.log(`Loading it REPLACES the active policy at ${join(dir, \"policy.json\")} (the old one is kept as policy.previous.json), so the starter protections apply only if the export includes them.`);\n console.log(\"Run again with --yes to load it.\");\n return;\n } else {\n console.log(`loaded policy ${outcome.facts.policyId} v${outcome.facts.policyVersion} (digest ${outcome.facts.policyDigest.slice(0, 12)}...) from export ${outcome.facts.exportId}`);\n console.log(` active policy ${outcome.policyPath}${outcome.previous ? ` (previous kept at ${outcome.previous})` : \"\"}`);\n console.log(` note \\`${cliCommand(\"rules apply\")}\\` recompiles policy.json from rules.json and would replace it`);\n ack = { exportId: outcome.facts.exportId, policyId: outcome.facts.policyId, policyVersion: outcome.facts.policyVersion, policyDigest: outcome.facts.policyDigest, scopeDigest: outcome.facts.scopeDigest };\n }\n if (!ack) return;\n await sendPolicyAck(dir, ack);\n}\n\n/** What a rules check needs for this config directory. A project policy governs only once trusted, so it is re-pinned after a\n * write, exactly when `rules apply` would. */\nfunction syncOptionsFor(dir: string): SyncOptions {\n const home = userHome();\n const repin = dir !== home && existsSync(join(home, \"policy.json\")) && isTrustedProject(dir);\n const agentKid = createSigner({ privateKeyPem: readFileSync(join(dir, \"agent.key\"), \"utf8\") }).kid;\n return { agentKid, hookVersion: hookVersion(), policyBuilds, afterPolicyWrite: repin ? (d) => { trustProjectPolicy(d); } : undefined };\n}\n\n/** `policy sync`: bring this computer's rules in line with its workspace now (the hook also checks every five minutes). */\nasync function runPolicySync(background: boolean): Promise<void> {\n const dir = resolveConfigDir(process.cwd());\n let outcome: SyncOutcome;\n try {\n outcome = await syncPolicy(dir, syncOptionsFor(dir));\n } catch (error) {\n outcome = { state: \"unavailable\", message: (error as Error).message };\n }\n if (background) return;\n const lines: Record<SyncOutcome[\"state\"], string> = {\n not_connected: \"This computer is not connected to a Scopebond workspace; it uses its own rules.\",\n own_rules: \"Your workspace does not set rules for this computer; it uses its own rules.\",\n unchanged: \"Up to date with your workspace.\",\n applied: \"Updated to your workspace's latest rules.\",\n refused: \"Could not apply your workspace's rules; the rules already in force stay.\",\n disconnected: \"The workspace connection is no longer valid; this computer now uses its own rules.\",\n unavailable: \"Could not reach your workspace; the rules already in force stay.\",\n };\n console.log(lines[outcome.state]);\n if (outcome.state === \"refused\" || outcome.state === \"unavailable\") { console.log(` ${outcome.message}`); process.exitCode = 1; }\n}\n\n/** Queue a `policy_ack` (loaded or rejected) through the observation outbox and try to deliver it now. */\nasync function sendPolicyAck(dir: string, ack: Parameters<ObservationEmitter[\"policyAck\"]>[0]): Promise<void> {\n const observed = openObservations(dir, { adapterVersion: hookVersion(), spawnHeartbeat: false });\n if (!observed.emitter) { console.error(`not acknowledged to the workspace: observations are ${observed.status.state}${\"reason\" in observed.status ? ` (${observed.status.reason})` : \"\"}`); return; }\n try {\n const queued = observed.emitter.policyAck(ack);\n await observed.emitter.flush(3000);\n console.error(queued?.queued ? `queued the ${ack.error ? \"rejection\" : \"load\"} acknowledgement for the workspace` : \"could not queue the acknowledgement\");\n } finally { observed.emitter.close(); }\n}\n\n/** `budget load <export.json> [--yes]`: check an action budget exported from the workspace and, with `--yes`,\n * make it the budget this machine enforces; then acknowledge it (or its refusal) to the workspace. */\nasync function runBudgetLoad(args: string[]): Promise<void> {\n const file = args.find((a) => !a.startsWith(\"--\"));\n if (!file) { console.error(`usage: ${cliCommand(\"budget load <export.json> [--yes]\")}`); process.exitCode = 2; return; }\n const dir = resolveConfigDir(process.cwd());\n const agentKid = (() => { try { return createSigner({ privateKeyPem: readFileSync(join(dir, \"agent.key\"), \"utf8\") }).kid; } catch { return \"\"; } })();\n const outcome = loadBudgetExport(dir, file, { apply: args.includes(\"--yes\"), agentKid, environmentId: loadConnection(dir)?.environment_id });\n let ack: Parameters<ObservationEmitter[\"policyAck\"]>[0] | undefined;\n if (outcome.state === \"rejected\") {\n console.error(`refused: ${outcome.message} (${outcome.error})`);\n if (outcome.ack && outcome.error !== \"expired\") ack = { ...outcome.ack, error: outcome.error };\n process.exitCode = 1;\n } else if (outcome.state === \"would_load\") {\n const p = outcome.facts.policy;\n for (const w of outcome.warnings) console.error(`warning: ${w}`);\n console.log(`This export checks out: ${p.mode} budget ${outcome.facts.budgetId} v${outcome.facts.budgetVersion}, ${p.max_dispatch} dispatches in ${p.window_seconds}s for this agent on this installation.`);\n console.log(`Loading it writes the budget to ${join(dir, \"dispatch.json\")} as acknowledged, and replaces an older workspace budget for this agent. Run again with --yes to load it.`);\n return;\n } else {\n const p = outcome.facts.policy;\n for (const w of outcome.warnings) console.error(`warning: ${w}`);\n console.log(`loaded ${p.mode} budget ${outcome.facts.budgetId} v${outcome.facts.budgetVersion} from export ${outcome.facts.exportId}: ${p.max_dispatch} dispatches in ${p.window_seconds}s`);\n if (outcome.replaced.length > 0) console.log(` replaced ${outcome.replaced.join(\", \")}`);\n console.log(` valid until ${new Date(outcome.facts.validUntil).toISOString()} (after that an enforced budget denies new dispatch until you load a new export)`);\n ack = { exportId: outcome.facts.exportId, policyId: outcome.facts.budgetId, policyVersion: outcome.facts.budgetVersion, policyDigest: outcome.facts.policyDigest, scopeDigest: outcome.facts.scopeDigest };\n }\n if (!ack) return;\n await sendPolicyAck(dir, ack);\n}\n\nasync function runObservations(args: string[]): Promise<void> {\n const sub = args[0] ?? \"status\";\n const dir = resolveConfigDir(process.cwd());\n if (sub === \"heartbeat\") { await runHeartbeatLoop(args[1] ?? \"\"); return; }\n if (sub === \"status\") {\n const lines = describeObservations(dir);\n console.log(`observations: ${lines[0]}`);\n for (const line of lines.slice(1)) console.log(` ${line}`);\n const file = join(dir, OBSERVATION_DB);\n if (args.includes(\"--refused\") && existsSync(file)) {\n const store = new ObservationStore(file);\n try { for (const row of store.terminal()) console.log(` refused #${row.sequence} gen ${row.generation} ${row.kind} ${row.observation_id} ${row.code} ${new Date(row.at).toISOString()}`); }\n finally { store.close(); }\n }\n return;\n }\n if (sub === \"id\") {\n // The opaque id this installation gives a ref, remote or repository, for writing reference\n // sets. Local only: it reads the binding key and prints; nothing is sent anywhere.\n const id = keyedIdFor(loadOrCreateBindingKey(dir), args[1] ?? \"\", args.slice(2));\n if (!id) { console.error(\"usage: observations id <ref <name> | remote <url> | ghrepo <owner/name> | repo <workspace-path> | mcp <server> <tool> | mcp-resource <kind> <value> | net-dest <host> <port> | cf <kind> <name> | database <pg|sqlite> <key>>\"); process.exit(1); }\n console.log(id);\n return;\n }\n if (sub === \"wire\" || sub === \"unwire\") {\n const scopes = harnessScopes(\"claude\", process.cwd());\n if (sub === \"unwire\") {\n let removed = 0;\n for (const file of [scopes.project, scopes.local, scopes.user]) if (file) removed += unwireLifecycleHooks(file);\n console.log(`removed ${removed} lifecycle hook entr${removed === 1 ? \"y\" : \"ies\"}`);\n return;\n }\n const target = scopes.local ?? scopes.project ?? scopes.user;\n const command = target ? configuredHookCommands(target)[0] : undefined;\n if (!target || !command) { console.error(\"Claude Code is not configured with this hook; run install or init first\"); process.exit(1); }\n wireLifecycleHooks(target, command);\n console.log(`session and after-action hooks wired in ${target}`);\n return;\n }\n const opened = openObservations(dir, { adapterVersion: hookVersion(), spawnHeartbeat: false });\n if (!opened.emitter) {\n console.error(`observations are ${opened.status.state}${\"reason\" in opened.status ? `: ${opened.status.reason}` : \"\"}`);\n process.exit(1);\n }\n const emitter = opened.emitter;\n try {\n if (sub === \"flush\") {\n const outcome = await uploadPending(emitter.store, { url: ingestUrl(emitter.connection), credential: emitter.connection.credential, timeoutMs: 10_000 });\n const left = emitter.store.pendingSummary().count;\n console.log(`${outcome.result}: ${outcome.acknowledged} acknowledged, ${outcome.deferred} deferred, ${outcome.rejected} refused; ${left} still pending${outcome.detail ? ` (${outcome.detail})` : \"\"}`);\n process.exitCode = left > 0 ? 1 : 0;\n } else if (sub === \"retry\") {\n const state = emitter.store.state();\n if (state?.capability === \"unsupported\") { emitter.store.setCapability(\"active\", null); console.log(\"will try the workspace again\"); }\n else console.log(\"nothing to retry (a stale generation clears when you reconnect)\");\n } else { console.error(\"usage: observations [status [--refused]|flush|retry|wire|unwire]\"); process.exit(1); }\n } finally { emitter.close(); }\n}\n\n/** The single heartbeat helper for one active session (started by the hook, never by hand). */\nasync function runHeartbeatLoop(sessionId: string): Promise<void> {\n if (!sessionId) return;\n const dir = resolveConfigDir(process.cwd());\n const { emitter } = openObservations(dir, { adapterVersion: hookVersion(), spawnHeartbeat: false, flushTimeoutMs: 3000 });\n if (!emitter) return;\n const override = Number(process.env.SCOPEBOND_HEARTBEAT_INTERVAL_MS);\n const interval = Number.isFinite(override) && override >= 100 ? override : HEARTBEAT_INTERVAL_MS;\n const endsAt = Date.now() + 24 * 60 * 60 * 1000;\n let last = Date.now();\n try {\n for (;;) {\n const verdict = emitter.heartbeatTick(sessionId, last);\n await emitter.flush();\n if (verdict === \"stop\" || Date.now() > endsAt) break;\n last = Date.now();\n await new Promise<void>((resolve) => setTimeout(resolve, interval));\n }\n } finally { emitter.store.releaseHeartbeat(sessionId); emitter.close(); }\n}\n\n/** The absolute path to this CLI file, for registering the hook by absolute path. */\nfunction cliPath(): string {\n return fileURLToPath(import.meta.url);\n}\n\n/** `install` — the once-per-machine, user-level install (SB112). Scaffolds the\n * user home and registers the hook by absolute path in the user-level agent config,\n * so every project a developer opens is governed without a per-repo `init`. */\n/** The command a user-level agent setting runs. Run through `npx`, this CLI lives in npm's\n * throwaway cache; registering that path would leave a hook that stops starting whenever\n * npm clears it — and a hook that cannot start lets every action through. Pin the durable\n * copy, as `init` does, and fall back to the portable `npx` command when none can be made. */\nfunction durableHookCommand(h: Harness): string {\n const pin = ensureDurableRuntime(cliPath(), hookVersion());\n return pin.cli ? absoluteHookCommand(pin.cli, h) : hookCommand(h);\n}\n\nfunction runInstall(args: string[]): void {\n const dir = userHome();\n const commandFor = durableHookCommand;\n const harnessesFor = (): Harness[] => args.includes(\"--codex\") ? [\"codex\"]\n : args.includes(\"--cursor\") ? [\"cursor\"]\n : args.includes(\"--claude\") ? [\"claude\"]\n : [\"claude\", ...(cursorDetected() ? [\"cursor\" as const] : []), ...(codexDetected() ? [\"codex\" as const] : [])];\n // `install` rewrites agent config files the user did not create — their theme, plugins\n // and permissions live in ~/.claude/settings.json — so there is a way to see exactly\n // what it would touch before it touches anything.\n if (args.includes(\"--dry-run\")) {\n console.log(`Dry run — nothing is written.\\n`);\n console.log(`Would scaffold ${dir} (machine key, countersigning key, starter policy)`);\n for (const h of harnessesFor()) {\n const file = userHarnessFile(h);\n const exists = existsSync(file);\n console.log(`Would ${exists ? \"modify\" : \"create\"} ${file}`);\n if (exists) console.log(` backing it up to ${file}.scopebond-backup`);\n // Previewed without copying anything: the path the real run would pin.\n console.log(` adding hook ${absoluteHookCommand(isEphemeralPath(cliPath()) ? pinnedCliPath(hookVersion()) : cliPath(), h)}`);\n if (exists && isHarnessConfigured(file)) console.log(` (a Scopebond hook is already there; it would be replaced, not duplicated)`);\n }\n console.log(`\\nNothing else in those files is changed. Run without --dry-run to apply.`);\n process.exit(0);\n }\n const { agentKid, policyPath } = scaffold(dir, { force: args.includes(\"--force\") });\n console.log(`Scopebond installed for this user in ${dir}`);\n console.log(` machine key ${agentKid}`);\n console.log(` policy ${policyPath} (starter — edit the limits)`);\n console.log(\"\");\n const harnesses: Harness[] = harnessesFor();\n if (!args.includes(\"--no-install\")) {\n for (const h of harnesses) {\n try {\n const target = userHarnessFile(h);\n const backup = existsSync(target) ? `${target}.scopebond-backup` : null;\n const file = writeHarnessConfig(target, h, commandFor(h));\n console.log(`✓ ${harnessName(h)} configured in ${file}`);\n if (backup && existsSync(backup)) console.log(` original kept at ${backup}`);\n } catch (error) { console.error(`✗ ${harnessName(h)}: ${(error as Error).message}`); process.exitCode = 1; }\n }\n } else {\n console.log(\"Add this to your user-level agent config:\");\n console.log(harnessSnippet(harnesses[0]));\n }\n if (harnesses.includes(\"codex\")) console.log(`\\nOne last step for Codex: ${codexTrustStep}`);\n console.log(\"\");\n console.log(`A project's own .scopebond policy applies only after you trust it there (${cliCommand(\"trust\")}).`);\n console.log(`Check it: ${cliCommand(\"doctor\")} · see decisions: ${cliCommand(\"log\")}`);\n console.log(`To send receipts to a workspace: ${cliCommand(\"connect <workspace-url> <enrollment>\")}`);\n}\n\n/** Size and count of the local receipt store, plus its write-ahead log. Signed evidence\n * accumulates in the user's project directory and there is no automatic deletion — so\n * the footprint is reported rather than left to be discovered. */\nfunction describeStore(dbPath: string): string {\n const bytes = (file: string): number => { try { return statSync(file).size; } catch { return 0; } };\n const total = bytes(dbPath) + bytes(`${dbPath}-wal`) + bytes(`${dbPath}-shm`);\n const human = total >= 1024 * 1024 ? `${(total / 1024 / 1024).toFixed(1)} MiB` : `${Math.max(1, Math.round(total / 1024))} KiB`;\n let count: number | null = null;\n try {\n const { store } = openReceiptStore({ db: dbPath });\n try { count = store.count ? Number(store.count()) : null; } finally { store.close?.(); }\n } catch { count = null; }\n return count === null ? human : `${count} receipt(s), ${human}`;\n}\n\nfunction runStatus(): void {\n const home = userHome();\n const installed = existsSync(join(home, \"policy.json\"));\n // Both scopes, always: `init` writes the project config and `install` writes the\n // user one, so a single-scope check contradicts whichever command the user ran.\n const claude = harnessScopes(\"claude\", process.cwd());\n const cursor = harnessScopes(\"cursor\", process.cwd());\n const codex = harnessScopes(\"codex\", process.cwd());\n const connected = !!loadConnection(resolveConfigDir(process.cwd()));\n const dbPath = join(resolveConfigDir(process.cwd()), \"receipts.db\");\n console.log(`Scopebond hook ${hookVersion()}`);\n console.log(` user home ${home} ${installed ? \"(installed)\" : `(not installed — run \\`${cliCommand(\"install\")}\\`)`}`);\n console.log(` active config ${resolveConfigDir(process.cwd())}`);\n const ignored = untrustedProjectPolicy(process.cwd());\n if (ignored) console.log(` project policy ${ignored} ignored — not trusted (run \\`${cliCommand(\"trust\")}\\` to use it)`);\n console.log(` Claude Code ${harnessScopeLabel(claude) || \"not configured\"}`);\n console.log(` Cursor ${harnessScopeLabel(cursor) || (cursorDetected() ? \"detected, not configured\" : \"not detected\")}`);\n console.log(` Codex ${codex.project || codex.user ? `${harnessScopeLabel(codex)} — approve once with /hooks` : codexDetected() ? \"detected, not configured\" : \"not detected\"}`);\n console.log(` cloud workspace ${connected ? \"connected\" : \"not connected (local only)\"}`);\n {\n const activeDir = resolveConfigDir(process.cwd());\n const connection = loadConnection(activeDir);\n if (connection) for (const line of describeDelivery(activeDir, connection).lines) console.log(` ${line}`);\n }\n {\n const activeDir = resolveConfigDir(process.cwd());\n const meta = readMeta(activeDir);\n const managed = existsSync(join(activeDir, MANAGED_DOC_FILE));\n const checked = meta.checked_at ? `, last checked ${meta.checked_at}` : \"\";\n console.log(` rules ${managed ? `set by your workspace (version ${meta.revision})${checked}` : `this computer's own (${rulesPath(activeDir)})${connected ? checked : \"\"}`}`);\n console.log(` always on: protection of Scopebond's own settings and the agents' hook settings`);\n if (meta.last_error) console.log(` last problem: ${meta.last_error}`);\n }\n const observationLines = describeObservations(resolveConfigDir(process.cwd()));\n console.log(` observations ${observationLines[0]}`);\n for (const line of observationLines.slice(1)) console.log(` ${line}`);\n console.log(` local receipts ${existsSync(dbPath) ? `${dbPath} (${describeStore(dbPath)})` : \"none yet\"}`);\n for (const [name, scopes] of [[\"Claude Code\", claude], [\"Cursor\", cursor], [\"Codex\", codex]] as const) {\n for (const file of [scopes.project, scopes.local, scopes.user]) if (file) console.log(` ${name}: ${file}`);\n }\n}\n\n/** `capabilities`: the manifest of what this hook can honestly claim, cell by cell.\n * `--prove` runs the safe fixtures in temp directories (never touching agent settings);\n * `--save` records the result beside the policy; `--json` prints the manifest. */\nasync function runCapabilities(args: string[]): Promise<void> {\n const cwd = process.cwd();\n const dir = resolveConfigDir(cwd);\n const configured = {\n claude: !!harnessScopeLabel(harnessScopes(\"claude\", cwd)),\n cursor: !!harnessScopeLabel(harnessScopes(\"cursor\", cwd)),\n codex: !!harnessScopeLabel(harnessScopes(\"codex\", cwd)),\n };\n const version = hookVersion();\n let proofs = loadProofs(dir);\n let failed = false;\n if (args.includes(\"--prove\")) {\n // When the workspace accepts observations, the fixtures are signed with this machine's\n // own keys (copied into the temp home) and their receipts are delivered first, so the\n // proof can name them and the workspace can resolve them. Otherwise a fixture stays local.\n const observed = openObservations(dir, { adapterVersion: version, spawnHeartbeat: false });\n const collected: unknown[] = [];\n const fresh = await runProofFixtures(version, observed.emitter ? { identityDir: dir, collect: collected } : {});\n const proven = computeManifest({ adapterVersion: version, configured: { claude: true, codex: true, cursor: true }, proofs: fresh });\n for (const cell of proven.cells) {\n const proof = fresh[cell.key];\n if (proof && !proofPassed(proof, cell)) {\n failed = true;\n console.error(`fixture failed: ${cell.key} (allow ${proof.safe_allow}, deny ${proof.safe_deny}, signature ${proof.signature}, grouping ${proof.grouping})`);\n }\n }\n if (observed.emitter) {\n try {\n const delivered = await deliverProofReceipts(observed.emitter.connection, collected);\n if (!delivered) console.error(\"could not deliver the fixture receipts to the workspace; the capability proofs were not sent (run it again when it is reachable)\");\n else {\n const queued = observed.emitter.capabilityProofs(proven.cells.flatMap((cell) => {\n // A typed-operation cell has no receipt of its own action type for a proof to name, so no proof is sent for it.\n if (TYPED_ACTION_TYPES.has(cell.action_type)) return [];\n const proof = cell.state === \"unsupported\" ? undefined : fresh[cell.key];\n return proof ? [{ adapterVersion: cell.adapter_version, hostVariant: cell.host_variant, actionType: cell.action_type, phase: cell.event_phase, requiredFields: cell.emitted_required_fields, fixtureVersion: `fixture/${proof.test_vector_digest}`, passed: proofPassed(proof, cell), proofDigests: proof.proof_digests }] : [];\n }));\n await observed.emitter.flush(3000);\n console.error(`queued ${queued} capability proof observation(s) (fixture origin, ${collected.length} fixture receipt(s) delivered)`);\n }\n } finally { observed.emitter.close(); }\n }\n if (args.includes(\"--save\")) {\n if (!existsSync(dir)) { console.error(`no ${dir} to record into - run \\`${cliCommand(\"init\")}\\` first.`); process.exit(1); }\n console.error(`recorded fixture proofs in ${saveProofs(dir, fresh)}`);\n }\n proofs = fresh;\n }\n const manifest = computeManifest({ adapterVersion: version, configured, proofs });\n if (args.includes(\"--json\")) console.log(JSON.stringify(manifest, null, 2));\n else {\n console.log(renderManifest(manifest));\n if (args.includes(\"--prove\")) console.log(`\\nFixture run ${failed ? \"FAILED - see degraded cells\" : \"passed\"}. It used temporary directories only; no agent setting or policy was changed and no key was modified.`);\n }\n process.exitCode = failed ? 1 : 0;\n}\n\nasync function runDoctor(): Promise<void> {\n const problems: string[] = [];\n const nodeOk = nodeSupported();\n console.log(`Scopebond doctor`);\n console.log(` node ${process.versions.node} ${nodeOk ? \"ok\" : \"TOO OLD (need >=22.13)\"}`);\n if (!nodeOk) problems.push(\"node >=22.13 is required (the Cloud outbox uses node:sqlite)\");\n const cli = cliPath();\n console.log(` cli ${cli} ${existsSync(cli) ? \"ok\" : \"MISSING\"}`);\n const active = resolveConfigDir(process.cwd());\n const hasPolicy = existsSync(join(active, \"policy.json\"));\n console.log(` active config ${active} ${hasPolicy ? \"ok\" : `no policy (run \\`${cliCommand(\"init\")}\\` here, or \\`${cliCommand(\"install\")}\\` once for your user)`}`);\n if (!hasPolicy) problems.push(\"no policy found in the active config dir\");\n const ignored = untrustedProjectPolicy(process.cwd());\n if (ignored) console.log(` project policy ${ignored} IGNORED — not trusted (never trusted, or edited since). Review it, then \\`${cliCommand(\"trust\")}\\``);\n // Every harness, in both scopes, plus a check that each configured command can\n // actually start. A pinned path that has gone missing is the one failure mode of\n // the fast absolute-path install, so doctor is where it must surface.\n let anyHarness = false;\n for (const harness of [\"claude\", \"cursor\", \"codex\"] as const) {\n const scopes = harnessScopes(harness, process.cwd());\n const label = harnessScopeLabel(scopes);\n const name = harnessName(harness);\n if (!label) {\n const detected = harness === \"claude\" || (harness === \"cursor\" ? cursorDetected() : codexDetected());\n console.log(` ${name.padEnd(15)} ${detected ? `not configured — run \\`${cliCommand(`init${harness === \"claude\" ? \"\" : ` --${harness}`}`)}\\`` : \"not detected\"}`);\n continue;\n }\n anyHarness = true;\n console.log(` ${name.padEnd(15)} ${label}`);\n for (const file of [scopes.project, scopes.local, scopes.user]) {\n if (!file) continue;\n // A project file git shares must not name a path on this machine: it starts here,\n // so the resolve check below passes, but on every teammate's machine it cannot\n // start — and a hook that cannot start is a non-blocking error, so their agent runs\n // unchecked. Only the doctor on the machine that wrote it can see this coming.\n const share = file === scopes.project ? gitShareState(file) : \"none\";\n const shared = share === \"tracked\" || share === \"untracked\";\n for (const command of configuredHookCommands(file)) {\n const ok = hookCommandResolves(command);\n const leaks = ok && shared && isMachineSpecificCommand(command);\n console.log(` ${ok && !leaks ? \"ok \" : \"BAD \"} ${file}`);\n if (!ok) {\n console.log(` command cannot start: ${command}`);\n problems.push(`${name} hook command no longer resolves in ${file} — run \\`${cliCommand(\"init\")}\\` to repair it`);\n } else if (leaks) {\n console.log(` machine-specific command in a file git shares: ${command}`);\n problems.push(`${name} hook in ${file} names a path on this machine and git shares that file — anyone who clones it gets a hook that cannot start, and their agent runs unchecked. Run \\`${cliCommand(`init${harness === \"claude\" ? \"\" : ` --${harness}`}`)}\\` to move it, then commit the change`);\n }\n }\n }\n if (harness === \"codex\") console.log(` run /hooks in Codex and approve Scopebond once`);\n }\n if (!anyHarness) problems.push(`no coding agent is configured — run \\`${cliCommand(\"init\")}\\` in your project root`);\n const connection = loadConnection(active);\n if (!connection) {\n console.log(` cloud not connected (local only) — receipts stay on this machine`);\n } else {\n let reachable = \"unknown\";\n try {\n const res = await fetch(new URL(\"/healthz\", connection.url).toString(), { method: \"GET\" });\n reachable = res.ok ? \"reachable\" : `unhealthy (${res.status})`;\n } catch (error) { reachable = `unreachable (${(error as Error).message})`; }\n console.log(` cloud ${connection.url} — ${reachable}`);\n // SB273: an authenticated check. Reaching the workspace says nothing about whether it\n // still accepts this computer; the rules endpoint answers 401 when it does not.\n let accepted = \"unknown\";\n try {\n const res = await fetch(new URL(\"/v1/policy\", connection.url).toString(), {\n headers: { authorization: `Bearer ${connection.credential}`, \"x-scopebond-hook-version\": hookVersion() },\n redirect: \"error\", signal: AbortSignal.timeout(10_000),\n });\n if (res.status === 401) {\n accepted = \"REFUSED (401)\";\n recordRulesCredential(active, false, Date.now());\n } else if (res.ok || res.status === 204 || res.status === 304) {\n accepted = \"accepted\";\n recordRulesCredential(active, true, Date.now());\n } else accepted = `unknown (HTTP ${res.status})`;\n } catch (error) { accepted = `not checked (${(error as Error).message})`; }\n console.log(` connection ${accepted}`);\n const delivery = describeDelivery(active, connection);\n for (const line of delivery.lines) console.log(` ${line}`);\n problems.push(...delivery.problems);\n }\n console.log(problems.length ? `\\n${problems.length} problem(s): ${problems.join(\"; \")}` : `\\nAll good.`);\n process.exitCode = problems.length ? 1 : 0;\n}\n\nfunction runUninstall(args: string[]): void {\n requireInteractive(\"uninstall\", args);\n let removed = 0;\n // Both scopes. Checking only the user config meant that after a per-project `init` —\n // the install the site actually tells people to run — `uninstall` reported \"no\n // user-level harness config found\" and left the project hook in place.\n for (const h of [\"claude\", \"cursor\", \"codex\"] as Harness[]) {\n for (const file of [projectHarnessFile(h, process.cwd()), localHarnessFile(h, process.cwd()), userHarnessFile(h)]) {\n if (file && removeHarnessConfig(file)) { console.log(`✓ removed the Scopebond hook from ${file}`); removed++; }\n }\n }\n if (removed === 0) console.log(\"no Scopebond hook found in this project or your user config.\");\n if (args.includes(\"--purge\")) { purgeHome(); console.log(`✓ purged ${userHome()} (keys, policy, receipts)`); }\n else console.log(`Kept ${userHome()} (keys, policy, receipts). Use --purge to remove it too.`);\n const projectDir = resolveConfigDir(process.cwd());\n if (existsSync(join(projectDir, \"policy.json\"))) {\n console.log(`Kept ${projectDir} (this project's keys, policy and receipts) — delete it by hand if you want it gone.`);\n }\n}\n\n/** `trust` — let this project's .scopebond policy govern here instead of the user\n * home, pinned to its current contents. Run by the user, not the agent: the file it\n * writes lives in the user home, which the starter policy write-protects. */\nfunction runTrust(args: string[]): void {\n requireInteractive(\"trust\", args);\n const dir = join(process.cwd(), \".scopebond\");\n if (!existsSync(join(dir, \"policy.json\"))) { console.error(`no project policy at ${join(dir, \"policy.json\")}`); process.exit(1); }\n const digest = trustProjectPolicy(dir);\n console.log(`✓ trusted ${join(dir, \"policy.json\")} (sha256 ${digest.slice(0, 12)}…)`);\n console.log(\"It governs agents in this project until it changes; after any edit, review it and run trust again.\");\n}\n\n/** `login <workspace-url>` — connect this computer without pasting anything. It asks\n * the workspace for a short code, shows it with the page to open, and waits while a\n * person who can manage the workspace approves it there for an environment and agent.\n * The approval hands back a single-use enrollment, which completes exactly as\n * `connect` does. Nothing secret is printed: the device code stays in memory. */\nasync function runLogin(args: string[]): Promise<void> {\n const positional = args.filter((a) => !a.startsWith(\"--\"));\n const harness = selectedHarness(args);\n let origin: string;\n try {\n const parsed = new URL(positional[0] ?? \"\");\n const local = parsed.hostname === \"localhost\" || parsed.hostname === \"127.0.0.1\" || parsed.hostname === \"[::1]\";\n if (parsed.protocol !== \"https:\" && !(local && parsed.protocol === \"http:\")) throw new Error(\"https required\");\n origin = parsed.origin;\n } catch {\n console.error(`usage: ${cliCommand(\"login <workspace-url> [--claude|--cursor|--codex] [--no-install] [--project]\")}`);\n console.error(\"The workspace URL is the address of your Scopebond workspace, for example https://cloud.scopebond.com.\");\n process.exit(1);\n }\n const post = async (path: string, body: unknown): Promise<{ status: number; json: Record<string, unknown> }> => {\n const response = await fetch(new URL(path, origin), {\n method: \"POST\", headers: { \"content-type\": \"application/json\" }, body: JSON.stringify(body),\n redirect: \"error\", signal: AbortSignal.timeout(15_000),\n });\n return { status: response.status, json: await response.json().catch(() => ({})) as Record<string, unknown> };\n };\n // SB276: run from inside an agent session (its own terminal or tool call), a sign-in can\n // land in the agent's working folder rather than this person's, and the person may never\n // see the code to approve. Say so plainly; the hook settings are left alone either way.\n if (process.env.CLAUDECODE || process.env.CODEX_SANDBOX || process.env.CURSOR_AGENT) {\n console.error(\"Note: this looks like a coding agent's own terminal. Signing in works best from your own terminal window, outside the agent.\");\n }\n let start: { status: number; json: Record<string, unknown> };\n try { start = await post(\"/v1/device/code\", { client_name: hostname(), harness }); }\n catch (error) { console.error(`could not reach ${origin}: ${(error as Error).message}`); process.exit(1); }\n const deviceCode = typeof start.json.device_code === \"string\" ? start.json.device_code : \"\";\n if (start.status !== 200 || !deviceCode) {\n console.error(`${origin} did not start a login (HTTP ${start.status}). Check the workspace URL, or use ${cliCommand(\"connect <workspace-url> <enrollment>\")}.`);\n process.exit(1);\n }\n const userCode = String(start.json.user_code ?? \"\");\n const verify = String(start.json.verification_uri_complete ?? start.json.verification_uri ?? origin);\n let intervalMs = Math.max(1, Number(start.json.interval ?? 5)) * 1000;\n const deadline = Date.now() + Math.max(60, Number(start.json.expires_in ?? 600)) * 1000;\n console.log(`To connect this computer, open:\\n\\n ${verify}\\n\\nand check that it shows the code ${userCode}\\n`);\n console.log(\"Waiting for approval (the code expires in 10 minutes; Ctrl+C to stop)…\");\n const dir = connectDir(args);\n scaffold(dir, {});\n while (Date.now() < deadline) {\n await new Promise((resolve) => setTimeout(resolve, intervalMs));\n let polled: { status: number; json: Record<string, unknown> };\n try { polled = await post(\"/v1/device/token\", { device_code: deviceCode }); }\n catch { continue; } // a transient network error: keep waiting until the deadline\n if (polled.status === 200 && polled.json.enrollment && typeof polled.json.enrollment === \"object\") {\n console.log(\"✓ Approved\");\n await finishConnect(dir, origin, polled.json.enrollment as CloudEnrollmentBundle, harness, args);\n return;\n }\n const error = polled.json.error;\n if (error === \"authorization_pending\") continue;\n if (error === \"slow_down\") { intervalMs += 5_000; continue; }\n if (error === \"access_denied\") { console.error(\"The request was denied in the workspace. Nothing was connected.\"); process.exit(1); }\n if (error === \"expired_token\") break;\n console.error(`login failed (${String(error ?? `HTTP ${polled.status}`)}). Run the command again for a new code.`);\n process.exit(1);\n }\n console.error(\"The code expired before it was approved. Run the command again for a new one.\");\n process.exit(1);\n}\n\n/** What each command does, its arguments, and one example. The whole help used to be a\n * single usage line listing 15 command names, which told a reader nothing about what any\n * of them did or what arguments they take. */\nconst COMMANDS: Array<{ name: string; args?: string; summary: string; detail?: string[] }> = [\n { name: \"init\", args: \"[--cursor|--codex] [--shared] [--dry-run] [--no-install] [--npx] [--force] [--yes]\",\n summary: \"set this project up: keys, a starter policy, and your agent wired to the hook\",\n detail: [\n \"Writes .scopebond/ (machine key, countersigning key, starter policy, .gitignore) and\",\n \"wires your agent to the hook. It pins a durable copy of this package so the hook starts\",\n \"fast, and because that command names paths on this machine it goes where git will not\",\n \"share it: .claude/settings.local.json (kept out of git for this clone), or for Cursor\",\n \"and Codex their project file only while git does not track it. --shared writes the\",\n \"portable npx command to .claude/settings.json, .cursor/hooks.json or .codex/hooks.json\",\n \"instead, so everyone who clones the project gets the hook. --dry-run shows what it\",\n \"would write. --no-install prints the config snippet rather than writing it.\",\n \"Needs a terminal, or --yes in a script, because it changes what governs your agent.\",\n ] },\n { name: \"install\", args: \"[--claude] [--cursor] [--codex] [--dry-run] [--force] [--yes]\",\n summary: \"set up once for this user, so every project you open is governed\",\n detail: [\n \"Scaffolds ~/.scopebond and registers the hook in your user-level agent config.\",\n \"--dry-run prints exactly which files it would touch and changes nothing. Each config\",\n \"is copied to <file>.scopebond-backup before its first modification.\",\n ] },\n { name: \"rules\", args: \"[show|allow|block|protect|unprotect|protect-branch|unprotect-branch|protect-remote-database|unprotect-remote-database|apply] [value]\",\n summary: \"read and change the limits in plain terms\",\n detail: [\n \"With no arguments, prints what is blocked in plain English — no regular expressions.\",\n \"The editable lists are .scopebond/rules.json; policy.json is compiled from them, so\",\n \"you never hand-write a lookahead.\",\n \" rules allow dd stop blocking a program\",\n \" rules protect infra/ never write there\",\n \" rules protect-branch production\",\n \" rules apply recompile after editing rules.json by hand\",\n ] },\n { name: \"status\", summary: \"what is configured, where, and how big the local log is\" },\n { name: \"capabilities\", args: \"[--prove [--save]] [--json]\",\n summary: \"what this hook can honestly claim, per agent host, action and phase\",\n detail: [\n \"Prints the capability manifest: for Claude Code, Codex and Cursor, each action type and\",\n \"phase is unsupported, inactive, configured_unverified, degraded or verified_reporting.\",\n \"Unsupported stays unsupported. A cell is never verified from a local run alone.\",\n \"--prove runs safe fixtures (allow, deny, signature, action group) in temporary\",\n \"directories; it does not read or change any agent settings. --save records the result.\",\n ] },\n { name: \"policy\", args: \"load <export.json> [--yes]\",\n summary: \"check a policy exported from your workspace and make it the active policy here\",\n detail: [\n \"Without --yes it only checks the export (its policy hash and scope digest, and that the\",\n \"gateway can load it) and says what loading would replace. With --yes the policy is\",\n \"written atomically as policy.json, the old one kept as policy.previous.json. If this\",\n \"machine is enrolled for observations, the load (or the refusal) is then acknowledged to\",\n \"the workspace, echoing the export's digests exactly. An export carries no signature;\",\n \"get the file from your workspace.\",\n ] },\n { name: \"observations\", args: \"[status [--refused]|flush|retry|wire|unwire|id <kind> <value>]\",\n summary: \"session, health and action observations sent to your workspace (opt-in)\",\n detail: [\n `On only when your workspace enrollment grants ${OBSERVATIONS_SCOPE}; otherwise off, and status says why.`,\n \"Local enforcement never depends on it: uploads are best effort and bounded. status shows\",\n \"what is pending and what the workspace refused (kept locally, never retried). flush\",\n \"sends now; retry re-checks a workspace that lacked the route; wire and unwire add or\",\n \"remove the Claude Code session and after-action hook entries.\",\n ] },\n { name: \"budget\", args: \"init|ack <id>|status|load <export.json>\",\n summary: \"per-agent action budgets: how many actions this agent may dispatch in a window\",\n detail: [\n \"load checks a budget exported from your workspace (digests, environment, validity, fail-closed contract) and, with --yes,\",\n \"makes it the acknowledged budget here, then acknowledges it to the workspace so its export stops showing as pending.\",\n \"init writes the suggested 100 actions per 60 seconds, monitor-only (nothing is limited).\",\n \"Enforcing needs the mode set to enforce and an acknowledgement of the exact policy (ack).\",\n \"Counters persist across hook processes and restarts. They count dispatched parent actions on\",\n \"THIS installation only; a limit shared across installations needs a shared in-path gateway,\",\n \"which an independent hook is not, so it refuses to enforce one.\",\n ] },\n { name: \"delegation\", args: \"add <file>|list|revoke <id>|import <file>\",\n summary: \"delegated child scopes: a child may do no more than its parent and never outlives it\",\n detail: [\n \"A session runs under one with SCOPEBOND_DELEGATION=<id>. Every action is checked against it,\",\n \"and against every ancestor, for scope, expiry and revocation. revoke takes effect on the next action.\",\n \"import adds revoked ids from a file exported from your workspace (add-only).\",\n ] },\n { name: \"doctor\", summary: \"check the setup and whether each configured hook command can start\",\n detail: [\"Exits non-zero when something is wrong, so it works in a script.\"] },\n { name: \"log\", args: \"[-n N] [--deny] [--since 7d]\",\n summary: \"the recent decisions\",\n detail: [`--deny shows only blocked actions; --since takes 7d, 24h, 30m or a date.`, `e.g. ${cliCommand(\"log --deny --since 7d\")}`] },\n { name: \"verify\", summary: \"check every local receipt offline against the countersigning key\",\n detail: [\"No network, no account. Exits non-zero if any receipt fails.\"] },\n { name: \"test\", args: '\"<shell command>\"',\n summary: \"show the decision for a command without running or recording it\",\n detail: [`e.g. ${cliCommand('test \"rm -rf /\"')}`] },\n { name: \"prune\", args: \"[--before 90d] [--yes]\",\n summary: \"report the local store's size, or bound it\",\n detail: [\n \"With no --before it only reports. With one, it archives the receipts it will remove\",\n \"to a JSONL file beside the database, then removes them. Refuses once the log has been\",\n \"anchored, because a receipt's position is its anchor leaf index.\",\n ] },\n { name: \"login\", args: \"<workspace-url> [--claude|--cursor|--codex] [--no-install]\",\n summary: \"connect this computer to a Scopebond Cloud workspace by approving a short code there\",\n detail: [\n \"Prints a code and a link; someone who manages the workspace opens it, checks the code\",\n \"and approves it for an environment and agent. Nothing is copied or pasted.\",\n ] },\n { name: \"connect\", args: \"<workspace-url> <enrollment> [--claude|--cursor|--codex]\",\n summary: \"send receipts to a Scopebond Cloud workspace as well as keeping them locally\" },\n { name: \"flush\", summary: \"deliver any receipts still queued for the workspace now\" },\n { name: \"recover\", args: \"[--no-wait]\", summary: \"deliver records an earlier, revoked key signed, once the workspace approves\",\n detail: [\n \"When this computer was replaced or disconnected while records were still queued, the\",\n \"workspace refuses them from the new connection. This asks the workspace to accept them,\",\n \"waits while an owner or admin approves it on Activity, then sends them, labelled Recovered.\",\n ] },\n { name: \"trust\", args: \"[--yes]\", summary: \"let this project's .scopebond policy govern here (pinned by hash)\" },\n { name: \"uninstall\", args: \"[--purge] [--yes]\", summary: \"remove the hook from your agent config; --purge also deletes the home\" },\n { name: \"claude\", summary: \"(internal) decide one Claude Code PreToolUse call, JSON on stdin\" },\n { name: \"cursor\", summary: \"(internal) decide one Cursor hook event, JSON on stdin\" },\n { name: \"codex\", summary: \"(internal) decide one Codex PreToolUse call, JSON on stdin\" },\n];\n\nfunction printHelp(topic: string | undefined, toStderr = false): void {\n const out = toStderr ? console.error : console.log;\n const match = topic ? COMMANDS.find((c) => c.name === topic.replace(/^--?/, \"\")) : undefined;\n if (match) {\n out(`scopebond-hook ${match.name}${match.args ? ` ${match.args}` : \"\"}`);\n out(\"\");\n out(` ${match.summary}`);\n if (match.detail) { out(\"\"); for (const line of match.detail) out(` ${line}`); }\n return;\n }\n if (topic) { out(`no such command: ${topic}`); out(\"\"); }\n out(`scopebond-hook — govern a coding agent's tool calls against policy, before they run.`);\n out(\"\");\n out(`Usage: scopebond-hook <command> [options]`);\n out(\"\");\n out(` ${cliCommand(\"init\")} set up this project`);\n out(` ${cliCommand('test \"rm -rf /\"')} see a decision without running it`);\n out(` ${cliCommand(\"log --deny\")} what got blocked`);\n out(` ${cliCommand(\"rules\")} what is blocked, in plain English`);\n out(\"\");\n out(\"Commands:\");\n const width = Math.max(...COMMANDS.map((c) => c.name.length));\n for (const command of COMMANDS) {\n if (command.summary.startsWith(\"(internal)\")) continue;\n out(` ${command.name.padEnd(width)} ${command.summary}`);\n }\n out(\"\");\n out(` ${\"help\".padEnd(width)} \\`help <command>\\` for that command's arguments and examples`);\n out(\"\");\n out(`Receipts and keys stay in .scopebond/ in this project. Nothing leaves your machine`);\n out(`unless you run \\`connect\\`. Docs: https://github.com/avouro-com/scopebond`);\n}\n\n/** Whether this Node can run the receipt store (`node:sqlite`, 22.13+). */\nfunction nodeSupported(version = process.versions.node): boolean {\n const [major, minor] = version.split(\".\").map(Number);\n return major > 22 || (major === 22 && minor >= 13);\n}\n\nconst [cmd, ...rest] = process.argv.slice(2);\n// A setup command on an older Node would scaffold and wire the agent, then fail on the\n// first action with an error about a missing module. Stop before changing anything, and\n// say what to do. The hook subcommands are left alone: they already fail closed.\nif ([\"init\", \"install\", \"connect\", \"login\"].includes(cmd ?? \"\") && !nodeSupported()) {\n console.error(`Scopebond needs Node.js 22.13 or later; this is Node ${process.versions.node}.`);\n console.error(\"Install the current Node.js LTS from https://nodejs.org, open a new terminal, and run the command again.\");\n process.exit(1);\n}\nif (cmd === \"claude\") { await runClaude(); }\nelse if (cmd === \"cursor\") { await runCursor(); }\nelse if (cmd === \"codex\") { await runCodex(); }\nelse if (cmd === \"init\") { runInit(rest); }\nelse if (cmd === \"install\") { runInstall(rest); }\nelse if (cmd === \"connect\") { await runConnect(rest); }\nelse if (cmd === \"log\") { await runLog(rest); }\nelse if (cmd === \"verify\") { await runVerify(); }\nelse if (cmd === \"test\") { await runTest(rest); }\nelse if (cmd === \"flush\") { await runFlush(); }\nelse if (cmd === \"recover\") { await runRecover(rest); }\nelse if (cmd === \"status\") { runStatus(); }\nelse if (cmd === \"doctor\") { await runDoctor(); }\nelse if (cmd === \"capabilities\") { await runCapabilities(rest); }\nelse if (cmd === \"observations\") { await runObservations(rest); }\nelse if (cmd === \"policy\") { await runPolicy(rest); }\nelse if (cmd === \"budget\" && rest[0] === \"load\") { await runBudgetLoad(rest.slice(1)); }\nelse if (cmd === \"budget\" || cmd === \"delegation\") {\n // These change what the agent may do, so they are for a person at a terminal.\n if (rest[0] !== \"status\" && rest[0] !== \"list\") requireInteractive(cmd, rest);\n const dir = resolveConfigDir(process.cwd());\n const kid = (() => { try { return createSigner({ privateKeyPem: readFileSync(join(dir, \"agent.key\"), \"utf8\") }).kid; } catch { return \"\"; } })();\n process.exit(runDispatchCommand(cmd, rest, dir, kid));\n}\nelse if (cmd === \"uninstall\") { runUninstall(rest); }\nelse if (cmd === \"login\") { await runLogin(rest); }\nelse if (cmd === \"trust\") { runTrust(rest); }\nelse if (cmd === \"prune\") { await runPrune(rest); }\nelse if (cmd === \"rules\") { runRules(rest); }\nelse if (cmd === \"help\" || cmd === \"--help\" || cmd === \"-h\" || cmd === undefined) { printHelp(rest[0]); }\nelse {\n console.error(`unknown command: ${cmd}`);\n printHelp(undefined, true);\n process.exit(1);\n}\n"]}