@lannguyensi/harness 0.14.0 → 0.15.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 (45) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +3 -1
  3. package/dist/cli/init/composer.d.ts +29 -0
  4. package/dist/cli/init/composer.js +377 -0
  5. package/dist/cli/init/composer.js.map +1 -0
  6. package/dist/cli/init/dependencies.d.ts +25 -0
  7. package/dist/cli/init/dependencies.js +100 -10
  8. package/dist/cli/init/dependencies.js.map +1 -1
  9. package/dist/cli/init/index.d.ts +18 -1
  10. package/dist/cli/init/index.js +17 -7
  11. package/dist/cli/init/index.js.map +1 -1
  12. package/dist/cli/init/interactive.d.ts +31 -2
  13. package/dist/cli/init/interactive.js +321 -79
  14. package/dist/cli/init/interactive.js.map +1 -1
  15. package/dist/cli/init/templates.d.ts +1 -1
  16. package/dist/cli/init/templates.js +60 -9
  17. package/dist/cli/init/templates.js.map +1 -1
  18. package/dist/cli/pack/hook-pre-tool-use.d.ts +1 -1
  19. package/dist/cli/pack/hook-pre-tool-use.js +37 -3
  20. package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
  21. package/dist/cli/validate/checks.d.ts +1 -1
  22. package/dist/cli/validate/checks.js +1 -7
  23. package/dist/cli/validate/checks.js.map +1 -1
  24. package/dist/io/harness-lock.js +1 -9
  25. package/dist/io/harness-lock.js.map +1 -1
  26. package/dist/policies/ledger-client.js +3 -9
  27. package/dist/policies/ledger-client.js.map +1 -1
  28. package/dist/policies/producers.d.ts +12 -0
  29. package/dist/policies/producers.js +61 -0
  30. package/dist/policies/producers.js.map +1 -0
  31. package/dist/runtime/expand-home.d.ts +14 -0
  32. package/dist/runtime/expand-home.js +54 -0
  33. package/dist/runtime/expand-home.js.map +1 -0
  34. package/dist/runtime/intercept.js +13 -2
  35. package/dist/runtime/intercept.js.map +1 -1
  36. package/dist/runtime/ledger-add.js +10 -3
  37. package/dist/runtime/ledger-add.js.map +1 -1
  38. package/dist/runtime/ledger-record.js +11 -10
  39. package/dist/runtime/ledger-record.js.map +1 -1
  40. package/dist/schema/index.d.ts +281 -101
  41. package/dist/schema/permission-profiles.d.ts +125 -125
  42. package/dist/schema/policies.d.ts +261 -0
  43. package/dist/schema/policies.js +50 -0
  44. package/dist/schema/policies.js.map +1 -1
  45. package/package.json +1 -1
@@ -11,23 +11,25 @@
11
11
  // matching `/ExitPrompt|aborted/i`. The wizard catches it, prints an
12
12
  // abort line to stderr, and returns `aborted:true` WITHOUT calling
13
13
  // `init()`. No partial manifest is ever written.
14
- // - The wizard never invokes `harness apply` itself. It prints the
15
- // suggested command and lets the operator decide. This is a
16
- // deliberate scope-cut for v1 (per the task description's
17
- // out-of-scope list).
14
+ // - After validate-clean the wizard offers a runtime multiselect and
15
+ // runs `harness apply` once per selected runtime (task 696f7560).
16
+ // The set defaults to whichever runtimes detect() found configured,
17
+ // so a fresh CC-only machine sees the historical single-runtime flow.
18
+ // Unchecking everything skips wiring and prints the manual fallback.
18
19
  // - Acceptance criterion "fresh ~/.claude/ produces a valid harness.yaml":
19
20
  // we delegate writing to the existing `init()` so the same atomic
20
21
  // write + file-lock + post-write validate path is reused. The wizard
21
22
  // is essentially a UI for picking the `--template` value.
22
- import { select, confirm, input } from "@inquirer/prompts";
23
+ import { select, confirm, input, checkbox } from "@inquirer/prompts";
23
24
  import * as path from "node:path";
24
25
  import { EX_FAIL, HarnessExitError } from "../exit-codes.js";
25
- import { detect } from "./detect.js";
26
+ import { detect, } from "./detect.js";
26
27
  import { init } from "./index.js";
27
28
  import { validate } from "../validate/index.js";
28
- import { apply } from "../apply/index.js";
29
- import { checkDependencies, formatDependencyTable, installPackagesGlobally, } from "./dependencies.js";
30
- const DEFAULT_PROMPTS = { select, confirm, input };
29
+ import { apply, CODEX_CONFIG_BASENAME } from "../apply/index.js";
30
+ import { checkDependencies, checkDependencyList, dependenciesForCustom, formatDependencyTable, installPackagesGlobally, } from "./dependencies.js";
31
+ import { COMPOSABLE_MCPS, COMPOSABLE_PACKS, COMPOSABLE_POLICIES, composeCustom, } from "./composer.js";
32
+ const DEFAULT_PROMPTS = { select, confirm, input, checkbox };
31
33
  function isAbortError(err) {
32
34
  if (!(err instanceof Error))
33
35
  return false;
@@ -58,6 +60,77 @@ function profileNeedsAgentTasks(profile) {
58
60
  function detectionHasAgentTasks(d) {
59
61
  return d.mcpServers.some((s) => s.name === "agent-tasks");
60
62
  }
63
+ function runtimeIsConfigured(r) {
64
+ if (!r)
65
+ return false;
66
+ return r.homeExists || r.settingsExists;
67
+ }
68
+ async function wireRuntime(o) {
69
+ // Defensive: only claude-code and codex have apply paths in v1. The
70
+ // checkbox UI disables "opencode" until task f34eb233 lands, so this
71
+ // branch is unreachable through normal use; the guard fires if the
72
+ // disabled flag is ever removed without wiring an adapter, instead of
73
+ // silently returning a half-built RuntimeApplyOutcome.
74
+ if (o.runtime !== "claude-code" && o.runtime !== "codex") {
75
+ throw new HarnessExitError(`wireRuntime: ${o.runtime} is not a wirable runtime in this harness build`, EX_FAIL);
76
+ }
77
+ if (o.runtime === "claude-code") {
78
+ const applyOpts = {
79
+ configPath: o.configPath,
80
+ target: o.claudeSettingsPath,
81
+ merge: true,
82
+ };
83
+ if (o.homeDir !== undefined)
84
+ applyOpts.homeDir = path.join(o.homeDir, ".claude");
85
+ try {
86
+ const r = await apply(applyOpts);
87
+ if (r.targetMergeSummary)
88
+ o.stderr(`\n${r.targetMergeSummary}\n`);
89
+ if (r.targetWritten) {
90
+ o.stderr(`wired into ${r.targetPath}\n`);
91
+ o.stderr(`verify: claude -p "say hi" --settings ${r.targetPath} --output-format stream-json --include-hook-events\n`);
92
+ }
93
+ for (const hint of r.restartHints)
94
+ o.stderr(`restart hint: ${hint}\n`);
95
+ return { runtime: "claude-code", apply: r };
96
+ }
97
+ catch (err) {
98
+ const message = err instanceof Error ? err.message : String(err);
99
+ const recoveryHint = `harness apply --target ${o.claudeSettingsPath} --merge`;
100
+ o.stderr(`\nFailed to wire ${o.claudeSettingsPath}: ${message}\n`);
101
+ o.stderr(`Manifest is on disk. To retry the merge manually:\n ${recoveryHint}\n`);
102
+ return { runtime: "claude-code", recoveryHint };
103
+ }
104
+ }
105
+ // Codex path: apply --runtime codex emits harness.generated/codex/config.toml.
106
+ // We deliberately do NOT pass --target: apply rejects --target+codex (see
107
+ // apply.ts) because harness owns harness.generated/, the operator owns
108
+ // ~/.codex/config.toml, and there is no in-place TOML merge yet. We print
109
+ // the exact merge command the operator needs instead.
110
+ const applyOpts = {
111
+ configPath: o.configPath,
112
+ runtime: "codex",
113
+ };
114
+ if (o.homeDir !== undefined)
115
+ applyOpts.homeDir = path.join(o.homeDir, ".claude");
116
+ try {
117
+ const r = await apply(applyOpts);
118
+ const generatedCodexPath = path.join(r.generatedDir, CODEX_CONFIG_BASENAME);
119
+ o.stderr(`\ncodex config generated at ${generatedCodexPath}\n`);
120
+ o.stderr(`To activate: copy or include those [[hooks.*]] entries into ${o.codexConfigPath}\n`);
121
+ for (const hint of r.restartHints)
122
+ o.stderr(`restart hint: ${hint}\n`);
123
+ const recoveryHint = `merge ${generatedCodexPath} into ${o.codexConfigPath}`;
124
+ return { runtime: "codex", apply: r, recoveryHint };
125
+ }
126
+ catch (err) {
127
+ const message = err instanceof Error ? err.message : String(err);
128
+ const recoveryHint = `harness apply --runtime codex # then merge harness.generated/codex/config.toml into ${o.codexConfigPath}`;
129
+ o.stderr(`\nFailed to generate codex config: ${message}\n`);
130
+ o.stderr(`To retry manually:\n ${recoveryHint}\n`);
131
+ return { runtime: "codex", recoveryHint };
132
+ }
133
+ }
61
134
  export async function runInteractive(opts = {}) {
62
135
  const prompts = opts.prompts ?? DEFAULT_PROMPTS;
63
136
  const stderr = opts.stderr ?? ((s) => process.stderr.write(s));
@@ -107,15 +180,13 @@ export async function runInteractive(opts = {}) {
107
180
  ],
108
181
  }));
109
182
  if (profile === "custom") {
110
- stderr([
111
- "Custom profile selected. The interactive wizard does not build",
112
- "manifests à la carte. Start from `harness init --template minimal`",
113
- "or `harness init --template full` for the reference manifest, then",
114
- "edit it directly. Detection results above tell you what the",
115
- "harness already sees in your environment.",
116
- "",
117
- ].join("\n"));
118
- return { aborted: true, profile };
183
+ return await runCustomProfile({
184
+ detection,
185
+ prompts,
186
+ stderr,
187
+ stdout,
188
+ opts,
189
+ });
119
190
  }
120
191
  if (profileNeedsAgentTasks(profile) && !detectionHasAgentTasks(detection)) {
121
192
  const proceed = await prompts.confirm({
@@ -198,69 +269,15 @@ export async function runInteractive(opts = {}) {
198
269
  initOpts.homeDir = path.join(opts.homeDir, ".claude");
199
270
  }
200
271
  const initResult = await init(initOpts);
201
- if (initResult.stderr)
202
- stderr(initResult.stderr);
203
272
  stdout(initResult.stdout);
204
- const v = validate({ configPath: initResult.path });
205
- const validateClean = v.errorCount === 0;
206
- stderr(`\nharness validate: ${v.errorCount} error(s), ${v.warningCount} warning(s)\n`);
207
- for (const d of v.diagnostics) {
208
- stderr(` [${d.severity}] ${d.path}: ${d.message}\n`);
209
- }
210
- if (!validateClean) {
211
- stderr(`\nValidate reported errors. Fix the manifest before running \`harness apply\`.\n`);
212
- return { aborted: false, profile, init: initResult, validateClean };
213
- }
214
- // Validate-clean: offer to wire into Claude Code right now. A bare
215
- // `harness init` leaves the manifest on disk but Claude Code does
216
- // not see it until `apply --target ... --merge` runs. Without this
217
- // prompt the operator gets a clean manifest, runs `harness apply`,
218
- // sees `harness.generated/` files appear, and is stuck wondering
219
- // why Claude still does not honour any hooks. Auto-offering the
220
- // merge here collapses that two-step trap into one.
221
- const claudeSettingsPath = path.join(detection.runtimes.find((r) => r.name === "claude-code")?.home ?? path.join(opts.homeDir ?? process.env.HOME ?? "", ".claude"), "settings.json");
222
- const wireNow = await prompts.confirm({
223
- message: `Wire into Claude Code now? (merges hooks + mcpServers into ${claudeSettingsPath})`,
224
- default: true,
273
+ return await runPostInitTail({
274
+ initResult,
275
+ profile,
276
+ detection,
277
+ prompts,
278
+ stderr,
279
+ opts,
225
280
  });
226
- if (!wireNow) {
227
- stderr(`\nManifest written. To wire it into Claude Code later:\n harness apply --target ${claudeSettingsPath} --merge\n`);
228
- return { aborted: false, profile, init: initResult, validateClean };
229
- }
230
- const applyOpts = {
231
- configPath: initResult.path,
232
- target: claudeSettingsPath,
233
- merge: true,
234
- };
235
- if (opts.homeDir !== undefined) {
236
- applyOpts.homeDir = path.join(opts.homeDir, ".claude");
237
- }
238
- // The merge-apply touches a real file under ~/.claude; permission
239
- // errors and pre-existing malformed JSON both throw from apply().
240
- // Catch here so a clean manifest write is not undone by a stack
241
- // trace, and the operator still sees the manual fallback command
242
- // they need to recover.
243
- let applyResult;
244
- try {
245
- applyResult = await apply(applyOpts);
246
- }
247
- catch (err) {
248
- const message = err instanceof Error ? err.message : String(err);
249
- stderr(`\nFailed to wire ${claudeSettingsPath}: ${message}\n`);
250
- stderr(`Manifest is on disk. To retry the merge manually:\n harness apply --target ${claudeSettingsPath} --merge\n`);
251
- return { aborted: false, profile, init: initResult, validateClean };
252
- }
253
- if (applyResult.targetMergeSummary) {
254
- stderr(`\n${applyResult.targetMergeSummary}\n`);
255
- }
256
- if (applyResult.targetWritten) {
257
- stderr(`wired into ${applyResult.targetPath}\n`);
258
- stderr(`verify: claude -p "say hi" --settings ${applyResult.targetPath} --output-format stream-json --include-hook-events\n`);
259
- }
260
- for (const hint of applyResult.restartHints) {
261
- stderr(`restart hint: ${hint}\n`);
262
- }
263
- return { aborted: false, profile, init: initResult, validateClean, apply: applyResult };
264
281
  }
265
282
  catch (err) {
266
283
  if (isAbortError(err)) {
@@ -270,4 +287,229 @@ export async function runInteractive(opts = {}) {
270
287
  throw err;
271
288
  }
272
289
  }
290
+ /**
291
+ * Run the shared tail after the manifest has been written: validate the
292
+ * on-disk file, surface diagnostics, then offer the runtime-multiselect
293
+ * wire-now step. Used by both the named-profile path (Solo / Team /
294
+ * Full) and the Custom-profile composer path (task 31d2fbb5) so they
295
+ * share identical post-init UX.
296
+ */
297
+ async function runPostInitTail(t) {
298
+ const { initResult, profile, detection, prompts, stderr, opts } = t;
299
+ if (initResult.stderr)
300
+ stderr(initResult.stderr);
301
+ const v = validate({ configPath: initResult.path });
302
+ const validateClean = v.errorCount === 0;
303
+ stderr(`\nharness validate: ${v.errorCount} error(s), ${v.warningCount} warning(s)\n`);
304
+ for (const d of v.diagnostics) {
305
+ stderr(` [${d.severity}] ${d.path}: ${d.message}\n`);
306
+ }
307
+ if (!validateClean) {
308
+ stderr(`\nValidate reported errors. Fix the manifest before running \`harness apply\`.\n`);
309
+ return { aborted: false, profile, init: initResult, validateClean };
310
+ }
311
+ // Validate-clean: offer to wire each runtime right now. A bare
312
+ // `harness init` leaves the manifest on disk but Claude Code / Codex
313
+ // do not see it until `harness apply` runs. The multiselect collapses
314
+ // that trap into one and pre-checks whichever runtimes detect() found
315
+ // configured so the common single-runtime case stays a single Enter
316
+ // press.
317
+ const claudeRuntime = detection.runtimes.find((r) => r.name === "claude-code");
318
+ const codexRuntime = detection.runtimes.find((r) => r.name === "codex");
319
+ const claudeSettingsPath = path.join(claudeRuntime?.home ?? path.join(opts.homeDir ?? process.env.HOME ?? "", ".claude"), "settings.json");
320
+ const codexConfigPath = path.join(codexRuntime?.home ?? path.join(opts.homeDir ?? process.env.HOME ?? "", ".codex"), "config.toml");
321
+ const wireChoices = [
322
+ {
323
+ name: `claude-code → merges into ${claudeSettingsPath}`,
324
+ value: "claude-code",
325
+ checked: runtimeIsConfigured(claudeRuntime) || claudeRuntime === undefined,
326
+ },
327
+ {
328
+ name: `codex → writes harness.generated/codex/config.toml, you merge into ${codexConfigPath}`,
329
+ value: "codex",
330
+ checked: runtimeIsConfigured(codexRuntime),
331
+ },
332
+ ];
333
+ const selectedRuntimes = (await prompts.checkbox({
334
+ message: "Wire harness into which runtimes now? (space to toggle, return to confirm; uncheck all to skip)",
335
+ choices: [
336
+ ...wireChoices,
337
+ // opencode is parked until the runtime adapter (task f34eb233)
338
+ // lands. Listing it disabled keeps the slot stable so the wizard
339
+ // copy and screenshots do not churn when v1.1 enables it.
340
+ {
341
+ name: "opencode (shipping in harness v1.1 — adapter task f34eb233)",
342
+ value: "opencode",
343
+ checked: false,
344
+ disabled: "(disabled until f34eb233 lands)",
345
+ },
346
+ ],
347
+ }));
348
+ if (selectedRuntimes.length === 0) {
349
+ stderr([
350
+ "",
351
+ "Manifest written; no runtimes selected for wiring. To wire later:",
352
+ ` claude-code: harness apply --target ${claudeSettingsPath} --merge`,
353
+ ` codex: harness apply --runtime codex # then merge harness.generated/codex/config.toml into ${codexConfigPath}`,
354
+ "",
355
+ ].join("\n"));
356
+ return { aborted: false, profile, init: initResult, validateClean, applies: [] };
357
+ }
358
+ if (selectedRuntimes.length > 1) {
359
+ stderr("\nMulti-runtime wiring: harness.lock will reflect the last-applied runtime; re-run `harness apply --runtime <name>` to refresh drift baselines.\n");
360
+ }
361
+ const applies = [];
362
+ for (const runtime of selectedRuntimes) {
363
+ const outcome = await wireRuntime({
364
+ runtime,
365
+ configPath: initResult.path,
366
+ homeDir: opts.homeDir,
367
+ claudeSettingsPath,
368
+ codexConfigPath,
369
+ stderr,
370
+ });
371
+ applies.push(outcome);
372
+ }
373
+ const legacyApply = applies.find((a) => a.runtime === "claude-code")?.apply;
374
+ const result = {
375
+ aborted: false,
376
+ profile,
377
+ init: initResult,
378
+ validateClean,
379
+ applies,
380
+ };
381
+ if (legacyApply !== undefined)
382
+ result.apply = legacyApply;
383
+ return result;
384
+ }
385
+ /**
386
+ * Custom-profile à-la-carte builder (task 31d2fbb5). Drives three
387
+ * checkbox prompts (packs / MCPs / policies), feeds them into the
388
+ * composer, then rejoins the shared write + wire-now tail. v1 surface
389
+ * is intentionally a subset of the FULL template; remaining packs,
390
+ * MCPs, and policies are tracked as follow-up.
391
+ */
392
+ async function runCustomProfile(rc) {
393
+ const { detection, prompts, stderr, stdout, opts } = rc;
394
+ const profile = "custom";
395
+ // Pre-check MCPs whose names appear in detected settings.json
396
+ // mcpServers. Packs and policies have no detection signal today
397
+ // (settings.json doesn't carry them), so they start unchecked and
398
+ // the operator opts in.
399
+ const detectedMcpNames = new Set(detection.mcpServers.map((s) => s.name));
400
+ const detectedHasMemoryRouterDir = (() => {
401
+ // memory.router is structurally not in settings.json mcpServers,
402
+ // so this stays unchecked by default; operators who already have a
403
+ // memory.router config can re-check it in the prompt.
404
+ return false;
405
+ })();
406
+ const packs = (await prompts.checkbox({
407
+ message: "Custom: pick policy packs",
408
+ choices: COMPOSABLE_PACKS.map((p) => ({
409
+ name: `${p.label} ${p.description}`,
410
+ value: p.key,
411
+ checked: false,
412
+ })),
413
+ }));
414
+ const mcps = (await prompts.checkbox({
415
+ message: "Custom: pick MCP servers / routers",
416
+ choices: COMPOSABLE_MCPS.map((m) => ({
417
+ name: `${m.label} ${m.description}`,
418
+ value: m.key,
419
+ checked: m.key === "memory-router" ? detectedHasMemoryRouterDir : detectedMcpNames.has(m.key),
420
+ })),
421
+ }));
422
+ const policies = (await prompts.checkbox({
423
+ message: "Custom: pick reference policies",
424
+ choices: COMPOSABLE_POLICIES.map((p) => ({
425
+ name: `${p.label} ${p.description}`,
426
+ value: p.key,
427
+ checked: false,
428
+ })),
429
+ }));
430
+ if (packs.length === 0 && mcps.length === 0 && policies.length === 0) {
431
+ stderr([
432
+ "",
433
+ "Custom: no components selected — nothing to compose. Aborted; no manifest written.",
434
+ "Re-run `harness init --interactive` and pick at least one pack, MCP, or policy.",
435
+ "",
436
+ ].join("\n"));
437
+ return { aborted: true, profile };
438
+ }
439
+ // Dependency check uses the Custom-specific dep resolver. Same install
440
+ // UX as the named-profile path.
441
+ const customDeps = dependenciesForCustom({ packs, mcps, policies });
442
+ const depResult = checkDependencyList(customDeps, opts.dependencyPathEnv !== undefined ? { pathEnv: opts.dependencyPathEnv } : {});
443
+ if (depResult.statuses.length > 0) {
444
+ stderr(`\n${formatDependencyTable(profile, depResult)}\n`);
445
+ }
446
+ if (depResult.missingPackages.length > 0) {
447
+ const installNow = await prompts.confirm({
448
+ message: `Install ${depResult.missingPackages.length} missing package(s) with \`npm i -g ${depResult.missingPackages.join(" ")}\`?`,
449
+ default: true,
450
+ });
451
+ if (!installNow) {
452
+ stderr([
453
+ "",
454
+ "Aborted: dependencies missing and install declined.",
455
+ `To install manually: npm i -g ${depResult.missingPackages.join(" ")}`,
456
+ "Then re-run `harness init --interactive`.",
457
+ "",
458
+ ].join("\n"));
459
+ return { aborted: true, profile };
460
+ }
461
+ stderr(`\nRunning npm i -g ${depResult.missingPackages.join(" ")}\n`);
462
+ const installResult = await installPackagesGlobally(depResult.missingPackages, opts.installSpawn ? { spawn: opts.installSpawn } : {});
463
+ if (!installResult.ok) {
464
+ stderr([
465
+ "",
466
+ `Aborted: npm install exited ${installResult.exitCode}. Manifest NOT written.`,
467
+ "Common fixes: re-run with sudo, switch nvm to a writable node, or check network proxy.",
468
+ `Then re-run: harness init --interactive`,
469
+ "",
470
+ ].join("\n"));
471
+ return { aborted: true, profile };
472
+ }
473
+ stderr(`Installed ${installResult.attempted.length} package(s) successfully.\n`);
474
+ }
475
+ const defaultMemoryDir = path.join(detection.runtimes[0]?.home ?? "~/.claude", "projects", "{project}", "memory");
476
+ const memoryDir = await prompts.input({
477
+ message: "Memory directory pattern (use {project} for the per-project slug)",
478
+ default: defaultMemoryDir,
479
+ });
480
+ if (memoryDir.trim() === "") {
481
+ stderr("Aborted: memory directory left empty.\n");
482
+ return { aborted: true, profile };
483
+ }
484
+ const selection = { packs, mcps, policies, memoryDir: memoryDir.trim() };
485
+ const composed = composeCustom(selection);
486
+ for (const w of composed.warnings) {
487
+ stderr(`composer warning: ${w}\n`);
488
+ }
489
+ const confirmWrite = await prompts.confirm({
490
+ message: `Write composed harness.yaml to ${detection.manifest.path}?`,
491
+ default: true,
492
+ });
493
+ if (!confirmWrite) {
494
+ stderr("Aborted: declined to write manifest.\n");
495
+ return { aborted: true, profile };
496
+ }
497
+ const initOpts = {
498
+ content: composed.yaml,
499
+ contentLabel: "custom",
500
+ force: detection.manifest.exists,
501
+ };
502
+ if (opts.homeDir !== undefined)
503
+ initOpts.homeDir = path.join(opts.homeDir, ".claude");
504
+ const initResult = await init(initOpts);
505
+ stdout(initResult.stdout);
506
+ return await runPostInitTail({
507
+ initResult,
508
+ profile,
509
+ detection,
510
+ prompts,
511
+ stderr,
512
+ opts,
513
+ });
514
+ }
273
515
  //# sourceMappingURL=interactive.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interactive.js","sourceRoot":"","sources":["../../../src/cli/init/interactive.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAC5D,EAAE;AACF,gBAAgB;AAChB,EAAE;AACF,wEAAwE;AACxE,kEAAkE;AAClE,4DAA4D;AAC5D,sEAAsE;AACtE,uEAAuE;AACvE,qEAAqE;AACrE,mDAAmD;AACnD,mEAAmE;AACnE,8DAA8D;AAC9D,4DAA4D;AAC5D,wBAAwB;AACxB,2EAA2E;AAC3E,oEAAoE;AACpE,uEAAuE;AACvE,4DAA4D;AAE5D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAwB,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAmB,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAoB,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,GAExB,MAAM,mBAAmB,CAAC;AA4C3B,MAAM,eAAe,GAAuB,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAEvE,SAAS,YAAY,CAAC,GAAY;IAChC,IAAI,CAAC,CAAC,GAAG,YAAY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AAE,CAAC;QAC3B,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"interactive.js","sourceRoot":"","sources":["../../../src/cli/init/interactive.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAC5D,EAAE;AACF,gBAAgB;AAChB,EAAE;AACF,wEAAwE;AACxE,kEAAkE;AAClE,4DAA4D;AAC5D,sEAAsE;AACtE,uEAAuE;AACvE,qEAAqE;AACrE,mDAAmD;AACnD,qEAAqE;AACrE,oEAAoE;AACpE,sEAAsE;AACtE,wEAAwE;AACxE,uEAAuE;AACvE,2EAA2E;AAC3E,oEAAoE;AACpE,uEAAuE;AACvE,4DAA4D;AAE5D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,MAAM,GAIP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,IAAI,EAAmB,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAoB,MAAM,mBAAmB,CAAC;AACnF,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,GAExB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,GAKd,MAAM,eAAe,CAAC;AAyEvB,MAAM,eAAe,GAAuB,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAEjF,SAAS,YAAY,CAAC,GAAY;IAChC,IAAI,CAAC,CAAC,GAAG,YAAY,KAAK,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KAAK,EAAE,SAAS,CAAC,QAAQ,CAAC,MAAM;KACjC,CAAC;IACF,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS;QAAE,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACtF,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAE1B,OAAO,MAAM,eAAe,CAAC;QAC3B,UAAU;QACV,OAAO;QACP,SAAS;QACT,OAAO;QACP,MAAM;QACN,IAAI;KACL,CAAC,CAAC;AACL,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export declare const MINIMAL_TEMPLATE = "# ~/.claude/harness.yaml\n#\n# Bootstrapped by `harness init --template minimal`.\n#\n# This is the empty-but-valid manifest. Run `harness validate` to confirm it\n# parses, then add entries under the five top-level keys:\n#\n# grounding: evidence-ledger + claim-gate config (see docs/ARCHITECTURE.md \u00A72)\n# tools: mcp / cli / skills / builtin inventory (\u00A73)\n# memory: directories, retention, scopes (\u00A74)\n# hooks: event-bound shell commands (\u00A75)\n# policies: named rules that bind hooks to triggers (\u00A76)\n#\n# Phase 2 verbs to add entries safely: `harness add mcp <name> ...`,\n# `harness add cli`, `harness add hook`, `harness add skill`.\n# Per-machine overrides live at ~/.claude/machines/<discriminator>.harness.overrides.yaml\n# (ARCHITECTURE.md \u00A78) for paths that vary per host.\n#\n# Docs: https://github.com/LanNguyenSi/harness\n\nversion: 1\n";
2
- export declare const FULL_TEMPLATE = "# ~/.claude/harness.yaml\n#\n# Bootstrapped by `harness init --template full`. The reference manifest:\n# every example policy from docs/examples/full-manifest.yaml wired through\n# the generic `harness policy intercept` engine, so no external shell\n# scripts under ~/.claude/hooks/ are required.\n#\n# Canonical source for the policy + policy_packs sections is\n# docs/examples/full-manifest.yaml. A parity vitest\n# (tests/cli/init-full-template-parity.test.ts) fails the build if the\n# two diverge on policy names or load-bearing fields.\n#\n# What you still need on PATH (the wizard offers to `npm i -g` these on\n# init): agent-tasks-mcp-bridge, grounding-mcp, memory-router-*,\n# understanding-gate-claude-*. Optional add-on: a local codebase-oracle\n# MCP server (see comment under tools.mcp below).\n\nversion: 1\n\ngrounding:\n session:\n auto_start: true\n id_format: \"gs-{repo}-{rand:8}\"\n evidence_ledger:\n path: ~/.evidence-ledger/ledger.db\n retention_days: 90\n policies_source: ~/.claude/harness.d/policies/claim-gate.yaml\n\ntools:\n mcp:\n # codebase-oracle (the Pandora RAG MCP server) is intentionally NOT\n # in this default. The npm name `codebase-oracle` is already taken\n # by an unrelated CLI, and the Pandora variant is not yet published\n # under a non-colliding scope. Operators who run from a local\n # checkout can add it back with (note: `harness add` splits the\n # command on commas, not whitespace):\n # harness add mcp codebase-oracle \\\n # --command 'npx,tsx,~/git/pandora/codebase-oracle/src/mcp-server.ts'\n - name: agent-tasks\n # Zero-setup entry: `@agent-tasks/mcp-bridge` exposes the\n # `agent-tasks-mcp-bridge` binary on PATH. The bridge owns token\n # storage and defaults to the hosted backend; override with\n # `AGENT_TASKS_BASE_URL` / `AGENT_TASKS_TOKEN` for self-hosted.\n # `min_version` floor: 0.6.0 added the `--version` short-circuit\n # the doctor probe needs (PR agent-tasks/240, release-cut PR 241).\n # Bump the floor whenever a fix you depend on lands; loose floors\n # are fine, the point is the drift signal not pinning a specific cut.\n command: [agent-tasks-mcp-bridge]\n min_version: \"0.6.0\"\n health:\n verb: projects_list\n timeout_ms: 5000\n enabled: true\n - name: grounding-mcp\n # Published bin from `@lannguyensi/grounding-mcp`. No env is set:\n # the bundled default resolves to `~/.evidence-ledger/ledger.db`\n # via os.homedir() at startup. Passing a literal tilde in env\n # bypasses shell expansion and creates rogue cwd-relative DB files\n # (see agent-tasks/42d224a6 incident). `min_version` floor: 0.2.0\n # added the `--version` short-circuit the doctor probe needs (PR\n # agent-grounding/76, release-cut PR 77).\n command: [grounding-mcp]\n min_version: \"0.2.0\"\n health:\n verb: ledger_status\n timeout_ms: 5000\n enabled: true\n\n cli:\n - name: gh\n binary: gh\n required: true\n\n skills:\n enabled:\n - simplify\n - init\n - review\n - security-review\n source_dirs:\n - ~/.claude/skills\n\n builtin:\n known: [Read, Edit, Write, Bash, Agent, Skill, TaskCreate, Glob, Grep]\n\nmemory:\n directories:\n - path: ~/.claude/projects/{project}/memory\n scope: project\n router:\n # Published bin from `@lannguyensi/memory-router`.\n # `min_version` floor: 0.3.0 added the `--version` short-circuit\n # the doctor probe needs (PR agent-memory/40, release-cut PR 41).\n command: [memory-router-user-prompt-submit]\n min_version: \"0.3.0\"\n enabled: true\n retention:\n staleness_days: 180\n broken_refs: warn\n scopes:\n default: project\n allowed: [project, user]\n\n# All PreToolUse hooks share the generic `harness policy intercept` CLI\n# entrypoint. The engine reads the tool event on stdin, evaluates whichever\n# policy below has a matching trigger (`match` + optional `bash_match`),\n# and emits Claude Code's deny envelope when the required ledger tag is\n# absent. No external shell scripts are required.\n#\n# The `git-preflight` SessionStart hook is the producer side of the\n# `preflight-before-*` policies: `harness session-start preflight` runs\n# agent-preflight against the session cwd and, on a ready:true result,\n# records `preflight:${REPO}` to the evidence ledger. It needs the\n# `preflight` binary on PATH (`npm i -g @lannguyensi/agent-preflight`); when\n# that is absent the hook logs to stderr and exits 0, so the session is\n# never broken \u2014 the preflight gates just stay closed until a tag is\n# produced some other way.\nhooks:\n - name: git-preflight\n event: SessionStart\n command: harness session-start preflight\n blocking: false\n budget_ms: 30000\n\n - name: require-review-evidence\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_merge\"\n command: harness policy intercept\n blocking: hard\n budget_ms: 2000\n\n - name: require-dogfood-evidence\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*(npm publish\\b|git( -C \\S+)* tag v)'\n command: harness policy intercept\n blocking: hard\n budget_ms: 2000\n\n - name: require-preflight-evidence\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* (status|log|diff|branch)\\b'\n command: harness policy intercept\n blocking: hard\n budget_ms: 1000\n\n - name: require-review-subagent-evidence\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_create\"\n command: harness policy intercept\n blocking: hard\n budget_ms: 2000\n\n - name: require-preflight-push-evidence\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* push\\b'\n command: harness policy intercept\n blocking: hard\n budget_ms: 1000\n\npolicies:\n - name: review-before-merge\n description: Block PR merges unless a ledger entry tagged review:<pr-number> exists for this session.\n trigger:\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_merge\"\n extract:\n PR_NUMBER: \"toolArgs.prNumber\"\n requires:\n ledger_tag: \"review:${PR_NUMBER}\"\n hook: require-review-evidence\n enforcement: block\n\n - name: dogfood-before-release\n description: Block npm publish / git tag v* without a recent dogfood ledger entry.\n trigger:\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*(npm publish\\b|git( -C \\S+)* tag v)'\n requires:\n ledger_tag: \"dogfood:${SESSION_ID}\"\n within: 24h\n hook: require-dogfood-evidence\n enforcement: block\n\n - name: two-reviewers-required\n description: At least two distinct reviewer ledger entries must exist for the PR.\n trigger:\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_merge\"\n extract:\n PR_NUMBER: \"toolArgs.prNumber\"\n requires:\n ledger_tag: \"review:${PR_NUMBER}\"\n count:\n min: 2\n hook: require-review-evidence\n enforcement: warn\n\n - name: preflight-before-investigation\n description: Block investigative git reads (status/log/diff/branch) when agent-preflight has not run recently with ready:true for the current repo.\n trigger:\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* (status|log|diff|branch)\\b'\n requires:\n ledger_tag: \"preflight:${REPO}\"\n within: 1h\n hook: require-preflight-evidence\n enforcement: block\n\n - name: review-subagent-before-pr-create\n description: Block agent-tasks PR creation unless a review-subagent ledger entry tagged for this task already exists. Forces the rigorous review BEFORE the PR opens, not after.\n trigger:\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_create\"\n extract:\n TASK_ID: \"toolArgs.taskId\"\n requires:\n ledger_tag: \"review-subagent:${TASK_ID}\"\n hook: require-review-subagent-evidence\n enforcement: block\n\n - name: preflight-before-push\n description: Block git push unless a fresh preflight ledger entry exists for the current branch. Catches the stale-checkout class of incident at the last reversible step.\n trigger:\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* push\\b'\n requires:\n ledger_tag: \"preflight:${BRANCH}\"\n within: 10m\n hook: require-preflight-push-evidence\n enforcement: block\n\n# Full inherits the Solo/Team understanding-gate stack: the Stop hook\n# persists each Understanding Report and the PreToolUse pre-tool-use\n# blocker refuses Edit/Write/Bash until the report is approved. Drop\n# this block if you want the reference policies above without the\n# baseline gate.\npolicy_packs:\n - name: understanding-before-execution\n source: builtin\n enabled: true\n description: Force agents to expose their task interpretation and wait for explicit human approval before any write-capable tool fires.\n config:\n mode: grill_me\n";
2
+ export declare const FULL_TEMPLATE = "# ~/.claude/harness.yaml\n#\n# Bootstrapped by `harness init --template full`. The reference manifest:\n# every example policy from docs/examples/full-manifest.yaml wired through\n# the generic `harness policy intercept` engine, so no external shell\n# scripts under ~/.claude/hooks/ are required.\n#\n# Canonical source for the policy + policy_packs sections is\n# docs/examples/full-manifest.yaml. A parity vitest\n# (tests/cli/init-full-template-parity.test.ts) fails the build if the\n# two diverge on policy names or load-bearing fields.\n#\n# What you still need on PATH (the wizard offers to `npm i -g` these on\n# init): agent-tasks-mcp-bridge, grounding-mcp, memory-router-*,\n# understanding-gate-claude-*.\n\nversion: 1\n\ngrounding:\n session:\n auto_start: true\n id_format: \"gs-{repo}-{rand:8}\"\n evidence_ledger:\n path: ~/.evidence-ledger/ledger.db\n retention_days: 90\n policies_source: ~/.claude/harness.d/policies/claim-gate.yaml\n\ntools:\n mcp:\n # codebase-oracle (the Pandora RAG MCP server) is intentionally NOT\n # in the Full default. It is published as\n # `@lannguyensi/codebase-oracle` and works fine standalone, but it\n # is an opinionated workflow add-on (multi-repo semantic search)\n # rather than infrastructure harness itself assumes. Operators who\n # want it wire it explicitly:\n # npm i -g @lannguyensi/codebase-oracle\n # harness add mcp codebase-oracle --command codebase-oracle,mcp\n # Set ORACLE_SCAN_ROOT (absolute path; tilde is not expanded by the\n # MCP env block) and OPENAI_API_KEY (or switch providers via\n # ORACLE_LLM_PROVIDER) before the first call.\n - name: agent-tasks\n # Zero-setup entry: `@agent-tasks/mcp-bridge` exposes the\n # `agent-tasks-mcp-bridge` binary on PATH. The bridge owns token\n # storage and defaults to the hosted backend; override with\n # `AGENT_TASKS_BASE_URL` / `AGENT_TASKS_TOKEN` for self-hosted.\n # `min_version` floor: 0.6.0 added the `--version` short-circuit\n # the doctor probe needs (PR agent-tasks/240, release-cut PR 241).\n # Bump the floor whenever a fix you depend on lands; loose floors\n # are fine, the point is the drift signal not pinning a specific cut.\n command: [agent-tasks-mcp-bridge]\n min_version: \"0.6.0\"\n health:\n verb: projects_list\n timeout_ms: 5000\n enabled: true\n - name: grounding-mcp\n # Published bin from `@lannguyensi/grounding-mcp`. No env is set:\n # the bundled default resolves to `~/.evidence-ledger/ledger.db`\n # via os.homedir() at startup. Passing a literal tilde in env\n # bypasses shell expansion and creates rogue cwd-relative DB files\n # (see agent-tasks/42d224a6 incident). `min_version` floor: 0.2.0\n # added the `--version` short-circuit the doctor probe needs (PR\n # agent-grounding/76, release-cut PR 77).\n command: [grounding-mcp]\n min_version: \"0.2.0\"\n health:\n verb: ledger_status\n timeout_ms: 5000\n enabled: true\n\n cli:\n - name: gh\n binary: gh\n required: true\n\n skills:\n enabled:\n - simplify\n - init\n - review\n - security-review\n source_dirs:\n - ~/.claude/skills\n\n builtin:\n known: [Read, Edit, Write, Bash, Agent, Skill, TaskCreate, Glob, Grep]\n\nmemory:\n directories:\n - path: ~/.claude/projects/{project}/memory\n scope: project\n router:\n # Published bin from `@lannguyensi/memory-router`.\n # `min_version` floor: 0.3.0 added the `--version` short-circuit\n # the doctor probe needs (PR agent-memory/40, release-cut PR 41).\n command: [memory-router-user-prompt-submit]\n min_version: \"0.3.0\"\n enabled: true\n retention:\n staleness_days: 180\n broken_refs: warn\n scopes:\n default: project\n allowed: [project, user]\n\n# All PreToolUse hooks share the generic `harness policy intercept` CLI\n# entrypoint. The engine reads the tool event on stdin, evaluates whichever\n# policy below has a matching trigger (`match` + optional `bash_match`),\n# and emits Claude Code's deny envelope when the required ledger tag is\n# absent. No external shell scripts are required.\n#\n# The `git-preflight` SessionStart hook is the producer side of the\n# `preflight-before-*` policies: `harness session-start preflight` runs\n# agent-preflight against the session cwd and, on a ready:true result,\n# records `preflight:${REPO}` to the evidence ledger. It needs the\n# `preflight` binary on PATH (`npm i -g @lannguyensi/agent-preflight`); when\n# that is absent the hook logs to stderr and exits 0, so the session is\n# never broken \u2014 the preflight gates just stay closed until a tag is\n# produced some other way.\nhooks:\n - name: git-preflight\n event: SessionStart\n command: harness session-start preflight\n blocking: false\n budget_ms: 30000\n\n - name: require-review-evidence\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_merge\"\n command: harness policy intercept\n blocking: hard\n budget_ms: 2000\n\n - name: require-dogfood-evidence\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*(npm publish\\b|git( -C \\S+)* tag v)'\n command: harness policy intercept\n blocking: hard\n budget_ms: 2000\n\n - name: require-preflight-evidence\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* (status|log|diff|branch)\\b'\n command: harness policy intercept\n blocking: hard\n budget_ms: 1000\n\n - name: require-review-subagent-evidence\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_create\"\n command: harness policy intercept\n blocking: hard\n budget_ms: 2000\n\n - name: require-preflight-push-evidence\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* push\\b'\n command: harness policy intercept\n blocking: hard\n budget_ms: 1000\n\npolicies:\n - name: review-before-merge\n description: Block PR merges unless a ledger entry tagged review:<pr-number> exists for this session.\n trigger:\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_merge\"\n extract:\n PR_NUMBER: \"toolArgs.prNumber\"\n requires:\n ledger_tag: \"review:${PR_NUMBER}\"\n hook: require-review-evidence\n enforcement: block\n producers:\n - kind: mcp\n verb: mcp__agent-grounding__ledger_add\n example: '{type:\"fact\", content:\"review:${PR_NUMBER} \u2014 <verdict + key findings + nits>\", source:\"Agent(general-purpose) review\"}'\n description: Spawn a review subagent against the PR diff, capture its verdict, then persist a ledger entry tagged with the PR number. The content should be self-contained enough for an auditor to read without re-opening the chat.\n\n - name: dogfood-before-release\n description: Block npm publish / git tag v* without a recent dogfood ledger entry.\n trigger:\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*(npm publish\\b|git( -C \\S+)* tag v)'\n requires:\n ledger_tag: \"dogfood:${SESSION_ID}\"\n within: 24h\n hook: require-dogfood-evidence\n enforcement: block\n producers:\n - kind: mcp\n verb: mcp__agent-grounding__ledger_add\n example: '{type:\"fact\", content:\"dogfood:${SESSION_ID} \u2014 <end-to-end smoke summary against the live system>\", source:\"manual smoke test\"}'\n description: Before tagging or publishing, run the release path end-to-end against the live system (not just unit tests) and persist the result as a session-tagged ledger entry. Document what you exercised (install, CLI happy path, MCP handshake, etc.) so a future auditor can tell whether the smoke covered the change.\n\n - name: two-reviewers-required\n description: At least two distinct reviewer ledger entries must exist for the PR.\n trigger:\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_merge\"\n extract:\n PR_NUMBER: \"toolArgs.prNumber\"\n requires:\n ledger_tag: \"review:${PR_NUMBER}\"\n count:\n min: 2\n hook: require-review-evidence\n enforcement: warn\n producers:\n - kind: mcp\n verb: mcp__agent-grounding__ledger_add\n example: '{type:\"fact\", content:\"review:${PR_NUMBER} \u2014 <verdict + key findings + nits>\", source:\"Agent(general-purpose) review (reviewer 2)\"}'\n description: Same shape as review-before-merge but TWO DISTINCT reviewer entries must exist before the gate is satisfied (count.min 2). Distinguish reviewers by source so the count is honest. Warn-level enforcement, so the agent CAN merge with one reviewer but should consider spawning a second for load-bearing changes.\n\n - name: preflight-before-investigation\n description: Block investigative git reads (status/log/diff/branch) when agent-preflight has not run recently with ready:true for the current repo.\n trigger:\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* (status|log|diff|branch)\\b'\n requires:\n ledger_tag: \"preflight:${REPO}\"\n within: 1h\n hook: require-preflight-evidence\n enforcement: block\n producers:\n - kind: bash\n command: harness session-start preflight\n description: Runs agent-preflight against the current cwd; on ready:true, records preflight:${REPO} to the ledger. Standard producer.\n - kind: mcp\n verb: mcp__agent-grounding__ledger_add\n example: '{type:\"fact\", content:\"preflight:${REPO}\", source:\"manual\"}'\n description: Direct ledger write. Use when the Bash hook is locked down (e.g. understanding-gate active) or when the standard producer is unavailable.\n\n - name: review-subagent-before-pr-create\n description: Block agent-tasks PR creation unless a review-subagent ledger entry tagged for this task already exists. Forces the rigorous review BEFORE the PR opens, not after.\n trigger:\n event: PreToolUse\n match: \"mcp__agent-tasks__pull_requests_create\"\n extract:\n TASK_ID: \"toolArgs.taskId\"\n requires:\n ledger_tag: \"review-subagent:${TASK_ID}\"\n hook: require-review-subagent-evidence\n enforcement: block\n producers:\n - kind: mcp\n verb: mcp__agent-grounding__ledger_add\n example: '{type:\"fact\", content:\"review-subagent:${TASK_ID} \u2014 <verdict + key findings + nits>\", source:\"Agent(general-purpose) review\"}'\n description: After running a review subagent against the staged diff, persist its verdict + load-bearing findings as a ledger entry tagged with the task UUID. The content should be self-contained enough to audit later without re-reading the chat.\n\n - name: preflight-before-push\n description: Block git push unless a fresh preflight ledger entry exists for the current branch. Catches the stale-checkout class of incident at the last reversible step.\n trigger:\n event: PreToolUse\n match: \"Bash\"\n bash_match: '(^|\\n|;|\\||&&|\\()\\s*(\\w+=\\S+\\s+)*git( -C \\S+)* push\\b'\n requires:\n ledger_tag: \"preflight:${BRANCH}\"\n within: 10m\n hook: require-preflight-push-evidence\n enforcement: block\n producers:\n - kind: bash\n command: harness session-start preflight\n description: Runs agent-preflight against the current cwd; on ready:true, records preflight:${BRANCH} to the ledger. Standard producer.\n - kind: mcp\n verb: mcp__agent-grounding__ledger_add\n example: '{type:\"fact\", content:\"preflight:${BRANCH} \u2014 <summary of what is on the branch + smoke results>\", source:\"manual\"}'\n description: Direct ledger write. The branch is the WIP review surface; the content should summarise what is staged + the smoke evidence so a reviewer can audit later without re-reading the chat.\n\n# Full inherits the Solo/Team understanding-gate stack: the Stop hook\n# persists each Understanding Report and the PreToolUse pre-tool-use\n# blocker refuses Edit/Write/Bash until the report is approved. Drop\n# this block if you want the reference policies above without the\n# baseline gate.\npolicy_packs:\n - name: understanding-before-execution\n source: builtin\n enabled: true\n description: Force agents to expose their task interpretation and wait for explicit human approval before any write-capable tool fires.\n config:\n mode: grill_me\n # Producers (agent-tasks/25bced52): rendered into the gate's deny\n # envelope by the same engine as policy producers. Constraint at\n # this layer: at-least-one `ask`. Post-v0.14.0 the gate signal\n # is a filesystem marker and the mcp ledger_add path no longer\n # satisfies the gate; the canonical unblock surface is the\n # operator-approval prompt.\n producers:\n - kind: ask\n command: harness approve understanding\n description: \"Bare command, no pipes or chaining. The hook recognises it via isEscapeCommand and emits permissionDecision:ask; the operator's go on that prompt IS the gate approval. Golden path.\"\n - kind: bash\n command: harness approve understanding\n description: Same command from any un-hooked terminal (operator only, not reachable from inside the gated session). Writes the canonical marker at harness.generated/.approvals/${SESSION_ID}.\n";
3
3
  export type TemplateName = "minimal" | "full" | "solo" | "team";
4
4
  export declare function getTemplate(name: TemplateName): string;