@lannguyensi/harness 0.59.2 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +1 -1
- package/dist/cli/apply/apply.d.ts +20 -0
- package/dist/cli/apply/apply.js +13 -7
- package/dist/cli/apply/apply.js.map +1 -1
- package/dist/cli/apply/install-codex-config.d.ts +11 -3
- package/dist/cli/apply/install-codex-config.js +130 -52
- package/dist/cli/apply/install-codex-config.js.map +1 -1
- package/dist/cli/approve/understanding.js +34 -28
- package/dist/cli/approve/understanding.js.map +1 -1
- package/dist/cli/doctor/format.js +22 -0
- package/dist/cli/doctor/format.js.map +1 -1
- package/dist/cli/doctor/index.js +60 -31
- package/dist/cli/doctor/index.js.map +1 -1
- package/dist/cli/doctor/types.d.ts +17 -0
- package/dist/cli/dry-run.js +7 -0
- package/dist/cli/dry-run.js.map +1 -1
- package/dist/cli/index.js +46 -144
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/pack/auto-approve-path.js +25 -11
- package/dist/cli/pack/auto-approve-path.js.map +1 -1
- package/dist/cli/pack/hook-codex-post-tool-use.js +2 -2
- package/dist/cli/pack/hook-codex-post-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-codex-pre-tool-use.js +32 -5
- package/dist/cli/pack/hook-codex-pre-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-post-merge-gate-record.d.ts +7 -0
- package/dist/cli/pack/hook-post-merge-gate-record.js +39 -2
- package/dist/cli/pack/hook-post-merge-gate-record.js.map +1 -1
- package/dist/cli/pack/hook-post-tool-use.js +2 -2
- package/dist/cli/pack/hook-post-tool-use.js.map +1 -1
- package/dist/cli/pack/hook-pre-tool-use.js +60 -15
- package/dist/cli/pack/hook-pre-tool-use.js.map +1 -1
- package/dist/cli/policy/intercept.js +5 -1
- package/dist/cli/policy/intercept.js.map +1 -1
- package/dist/cli/record/index.d.ts +11 -2
- package/dist/cli/record/index.js +18 -5
- package/dist/cli/record/index.js.map +1 -1
- package/dist/cli/session-start/branch-check.d.ts +3 -29
- package/dist/cli/session-start/branch-check.js +7 -37
- package/dist/cli/session-start/branch-check.js.map +1 -1
- package/dist/cli/session-start/index.d.ts +16 -30
- package/dist/cli/session-start/index.js +72 -26
- package/dist/cli/session-start/index.js.map +1 -1
- package/dist/cli/session-start/shared-options.d.ts +92 -0
- package/dist/cli/session-start/shared-options.js +109 -0
- package/dist/cli/session-start/shared-options.js.map +1 -0
- package/dist/cli/session-start/stale-base-check.d.ts +3 -28
- package/dist/cli/session-start/stale-base-check.js +7 -37
- package/dist/cli/session-start/stale-base-check.js.map +1 -1
- package/dist/cli/session-start/toolchain-parity.d.ts +5 -21
- package/dist/cli/session-start/toolchain-parity.js +6 -38
- package/dist/cli/session-start/toolchain-parity.js.map +1 -1
- package/dist/cli/smoke/index.d.ts +1 -1
- package/dist/cli/smoke/index.js +8 -11
- package/dist/cli/smoke/index.js.map +1 -1
- package/dist/policy-packs/builtin/post-merge-gate-runtime.d.ts +11 -0
- package/dist/policy-packs/builtin/post-merge-gate-runtime.js +11 -0
- package/dist/policy-packs/builtin/post-merge-gate-runtime.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.d.ts +36 -0
- package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js +73 -0
- package/dist/policy-packs/builtin/understanding-before-execution/expiry-reason.js.map +1 -0
- package/dist/policy-packs/builtin/understanding-before-execution/index.d.ts +3 -2
- package/dist/policy-packs/builtin/understanding-before-execution/index.js +5 -2
- package/dist/policy-packs/builtin/understanding-before-execution/index.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/markers.js +1 -0
- package/dist/policy-packs/builtin/understanding-before-execution/markers.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.d.ts +205 -1
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js +360 -3
- package/dist/policy-packs/builtin/understanding-before-execution/persisted-reports.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.d.ts +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js +2 -2
- package/dist/policy-packs/builtin/understanding-before-execution/post-tool-use-boundary.js.map +1 -1
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.d.ts +36 -0
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js +50 -0
- package/dist/policy-packs/builtin/understanding-before-execution/task-markers.js.map +1 -1
- package/dist/runtime/bash-prefix-parse.js +319 -126
- package/dist/runtime/bash-prefix-parse.js.map +1 -1
- package/dist/runtime/intercept.d.ts +38 -0
- package/dist/runtime/intercept.js +224 -5
- package/dist/runtime/intercept.js.map +1 -1
- package/dist/runtime/read-only-bash.js +11 -1
- package/dist/runtime/read-only-bash.js.map +1 -1
- package/dist/runtime/shell-word.d.ts +16 -1
- package/dist/runtime/shell-word.js +82 -1
- package/dist/runtime/shell-word.js.map +1 -1
- package/package.json +1 -1
|
@@ -211,6 +211,16 @@ export interface PolicyPackUxDriftReport {
|
|
|
211
211
|
fields: string[];
|
|
212
212
|
message: string;
|
|
213
213
|
}
|
|
214
|
+
/** The runtime policy packs were expanded against; see `DoctorReport.packExpansionRuntime`. */
|
|
215
|
+
export interface PackExpansionRuntimeReport {
|
|
216
|
+
runtime: string;
|
|
217
|
+
/** How apply's `selectRuntime` chose it: last-apply, inferred, unrecorded or default. */
|
|
218
|
+
source: string;
|
|
219
|
+
/** The runtime the last apply recorded or that its files imply, when there is one. */
|
|
220
|
+
previousRuntime?: string;
|
|
221
|
+
/** Set when the last apply's `.last-apply` could not be read; names the file. */
|
|
222
|
+
warning?: string;
|
|
223
|
+
}
|
|
214
224
|
/**
|
|
215
225
|
* Doctor surface for the HOOK-level `min_version` floor on a
|
|
216
226
|
* policy-pack-EXPANDED hook (task ab634898). Distinct from
|
|
@@ -517,6 +527,13 @@ export interface DoctorReport {
|
|
|
517
527
|
* meets it.
|
|
518
528
|
*/
|
|
519
529
|
policyPackHookVersions: PolicyPackHookVersionGapReport[];
|
|
530
|
+
/**
|
|
531
|
+
* The runtime policy packs were expanded against for the pack checks:
|
|
532
|
+
* the one a plain `harness apply` would select (recorded in
|
|
533
|
+
* `.last-apply`, inferred from its files, else the default; task
|
|
534
|
+
* 04b8abcf). Always present.
|
|
535
|
+
*/
|
|
536
|
+
packExpansionRuntime: PackExpansionRuntimeReport;
|
|
520
537
|
workflows: WorkflowsSectionReport;
|
|
521
538
|
/** Phase 7 #6 — Risk Gate wiring health (classifiers / resolvers / `when:`). */
|
|
522
539
|
riskGate: RiskGateSection;
|
package/dist/cli/dry-run.js
CHANGED
|
@@ -2,6 +2,7 @@ import { stringify as stringifyYaml } from "yaml";
|
|
|
2
2
|
import { evaluateExtract, firstInputMatchMismatch, substituteTemplate, } from "../policies/index.js";
|
|
3
3
|
import { normalizeCommand, normalizeCommandAmpAware, normalizeCommandQuoteAware, } from "../runtime/command-normalize.js";
|
|
4
4
|
import { resolveGitContext } from "../runtime/git-context.js";
|
|
5
|
+
import { emptyIdentifierGuard } from "../runtime/intercept.js";
|
|
5
6
|
import { EX_USAGE, HarnessExitError } from "./exit-codes.js";
|
|
6
7
|
import { loadManifest } from "./loader.js";
|
|
7
8
|
const PROMPT_EVENTS = new Set(["UserPromptSubmit", "SessionStart"]);
|
|
@@ -145,6 +146,12 @@ function staticLedgerQuery(policy, ctx, builtins) {
|
|
|
145
146
|
return "(operator-only: no ledger query — unconditional deny)";
|
|
146
147
|
}
|
|
147
148
|
const extract = evaluateExtract(policy.trigger.extract ?? {}, ctx, builtins);
|
|
149
|
+
// Same guard as the runtime: an empty ${REPO} / ${BRANCH} never renders
|
|
150
|
+
// a blank tag (`preflight:`); show the hint the agent would get instead.
|
|
151
|
+
const emptyGuard = emptyIdentifierGuard(policy.requires.ledger_tag, extract.values);
|
|
152
|
+
if (emptyGuard !== null) {
|
|
153
|
+
return `(no ledger query: ${emptyGuard.message})`;
|
|
154
|
+
}
|
|
148
155
|
const sub = substituteTemplate(policy.requires.ledger_tag, extract.values);
|
|
149
156
|
return sub.result;
|
|
150
157
|
}
|
package/dist/cli/dry-run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dry-run.js","sourceRoot":"","sources":["../../src/cli/dry-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,kBAAkB,GAGnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"dry-run.js","sourceRoot":"","sources":["../../src/cli/dry-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,kBAAkB,GAGnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAsB,MAAM,aAAa,CAAC;AAmD/D,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC,CAAC;AAEpE,SAAS,WAAW,CAAC,IAAmB,EAAE,IAAmB;IAC3D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;IACrC,uEAAuE;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R,KAAK;QACL,gBAAgB,EAAE,QAAQ;QAC1B,kBAAkB,EAAE,UAAU;QAC9B,iBAAiB;KAClB,CAAC;IAEF,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI;QACtB,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI;QACxC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -72,6 +72,7 @@ import { writePendingApproval } from "../runtime/pending-approval.js";
|
|
|
72
72
|
import { runSessionStartBranchCheck } from "./session-start/branch-check.js";
|
|
73
73
|
import { runSessionStartToolchainParity } from "./session-start/toolchain-parity.js";
|
|
74
74
|
import { runSessionStartStaleBaseCheck } from "./session-start/stale-base-check.js";
|
|
75
|
+
import { addCwdOption, addIdentityOptions, addLedgerTimeoutOption, applyCliOptions, } from "./session-start/shared-options.js";
|
|
75
76
|
import { runPackHookBranchProtectionCli } from "./pack/hook-branch-protection.js";
|
|
76
77
|
import { runPackHookSolutionAcceptanceCli } from "./pack/hook-solution-acceptance.js";
|
|
77
78
|
import { runPackHookSolutionAcceptanceWriteguardCli } from "./pack/hook-solution-acceptance-writeguard.js";
|
|
@@ -1988,45 +1989,32 @@ export function buildProgram(opts = {}) {
|
|
|
1988
1989
|
throw new HarnessExitError("", result.exitCode);
|
|
1989
1990
|
}
|
|
1990
1991
|
});
|
|
1991
|
-
//
|
|
1992
|
-
//
|
|
1993
|
-
// type: `Run: harness preflight`. The handler delegates to the same
|
|
1992
|
+
// The action shared by `harness session-start preflight` and its
|
|
1993
|
+
// top-level alias `harness preflight`: the alias delegates to the same
|
|
1994
1994
|
// implementation, with the same CLI options.
|
|
1995
|
-
|
|
1996
|
-
.command("preflight")
|
|
1997
|
-
.description("Alias for `harness session-start preflight`: run agent-preflight against the session cwd " +
|
|
1998
|
-
"and, on a ready:true result, record a `preflight:${REPO}` fact to the evidence ledger. " +
|
|
1999
|
-
"Opt-in `session_start_preflight.setup: true` (default off) passes --setup through; " +
|
|
2000
|
-
"see docs/CLI.md for the trust and scope caveats.")
|
|
2001
|
-
.option("--config <path>", "manifest path (default: ~/.harness/harness.yaml; legacy fallback ~/.claude/harness.yaml)")
|
|
2002
|
-
.option("--project <name>", "apply per-project overrides")
|
|
2003
|
-
.option("--session <id>", "explicit session id (overrides stdin event + env)")
|
|
2004
|
-
.option("--timeout <ms>", "agent-preflight subprocess timeout in milliseconds (default 60000)")
|
|
2005
|
-
.option("--ledger-timeout <ms>", "per-call ledger timeout in milliseconds")
|
|
2006
|
-
.action(async (options) => {
|
|
1995
|
+
const preflightAction = async (options) => {
|
|
2007
1996
|
const cliOpts = {};
|
|
2008
|
-
|
|
2009
|
-
cliOpts.configPath = options.config;
|
|
2010
|
-
if (options.project)
|
|
2011
|
-
cliOpts.project = options.project;
|
|
2012
|
-
if (options.session)
|
|
2013
|
-
cliOpts.session = options.session;
|
|
1997
|
+
applyCliOptions(options, cliOpts);
|
|
2014
1998
|
if (options.timeout) {
|
|
2015
1999
|
const n = Number.parseInt(options.timeout, 10);
|
|
2016
2000
|
if (Number.isFinite(n) && n > 0)
|
|
2017
2001
|
cliOpts.preflightTimeoutMs = n;
|
|
2018
2002
|
}
|
|
2019
|
-
if (options.ledgerTimeout) {
|
|
2020
|
-
const n = Number.parseInt(options.ledgerTimeout, 10);
|
|
2021
|
-
if (Number.isFinite(n) && n > 0)
|
|
2022
|
-
cliOpts.ledgerTimeoutMs = n;
|
|
2023
|
-
}
|
|
2024
2003
|
// Opt into the bootstrap-staging side effect from the CLI entry
|
|
2025
2004
|
// point only. Library callers (vitest cases) get the no-op default
|
|
2026
2005
|
// so they cannot clobber the operator's real pending-approval file.
|
|
2027
2006
|
cliOpts.stagePendingApproval = writePendingApproval;
|
|
2028
2007
|
await runSessionStartPreflight(cliOpts);
|
|
2029
|
-
}
|
|
2008
|
+
};
|
|
2009
|
+
// Top-level alias for `harness session-start preflight`, so the
|
|
2010
|
+
// policy `ux.run:` field can show the short form the agent should
|
|
2011
|
+
// type: `Run: harness preflight`.
|
|
2012
|
+
addLedgerTimeoutOption(addIdentityOptions(program
|
|
2013
|
+
.command("preflight")
|
|
2014
|
+
.description("Alias for `harness session-start preflight`: run agent-preflight against the session cwd " +
|
|
2015
|
+
"and, on a ready:true result, record a `preflight:${REPO}` fact to the evidence ledger. " +
|
|
2016
|
+
"Opt-in `session_start_preflight.setup: true` (default off) passes --setup through; " +
|
|
2017
|
+
"see docs/CLI.md for the trust and scope caveats."), "explicit session id (overrides stdin event + env)").option("--timeout <ms>", "agent-preflight subprocess timeout in milliseconds (default 60000)")).action(preflightAction);
|
|
2030
2018
|
// Shared by the three `record` verbs' action handlers below: parse
|
|
2031
2019
|
// `--ledger-timeout <ms>` into `cliOpts.ledgerTimeoutMs`, and report a
|
|
2032
2020
|
// `RecordResult` (print the recorded fact on success; on failure, throw
|
|
@@ -2106,19 +2094,25 @@ export function buildProgram(opts = {}) {
|
|
|
2106
2094
|
recordCmd
|
|
2107
2095
|
.command("review-subagent [summary]")
|
|
2108
2096
|
.description("Record a review-subagent:${TASK_ID} + review-subagent:${BRANCH} fact for the " +
|
|
2109
|
-
"review-subagent-before-pr-create / review-subagent-before-pr-create-bash gates."
|
|
2097
|
+
"review-subagent-before-pr-create / review-subagent-before-pr-create-bash gates. " +
|
|
2098
|
+
"Exactly one of --task or --adhoc is required; --adhoc (work without an agent-tasks " +
|
|
2099
|
+
"task) writes review-subagent:${BRANCH} only.")
|
|
2110
2100
|
.option("--config <path>", "manifest path (default: ~/.harness/harness.yaml; legacy fallback ~/.claude/harness.yaml)")
|
|
2111
2101
|
.option("--project <name>", "apply per-project overrides")
|
|
2112
|
-
.
|
|
2102
|
+
.option("--task <id>", "agent-tasks task id the review-subagent:${TASK_ID} tag is namespaced by (exactly one of --task or --adhoc)")
|
|
2103
|
+
.option("--adhoc", "record for work without an agent-tasks task: writes review-subagent:${BRANCH} only, no task tag (exactly one of --task or --adhoc)")
|
|
2113
2104
|
.requiredOption("--verdict <text>", "reviewer verdict recorded in the fact content")
|
|
2114
2105
|
.option("--branch <name>", "explicit branch override for review-subagent:${BRANCH} (default: current git branch)")
|
|
2115
2106
|
.option("--session <id>", "explicit session id (default: $CLAUDE_CODE_SESSION_ID, then $CLAUDE_SESSION_ID, then newest Claude Code transcript)")
|
|
2116
2107
|
.option("--ledger-timeout <ms>", "per-call ledger timeout in milliseconds")
|
|
2117
2108
|
.action(async (summary, options) => {
|
|
2118
2109
|
const cliOpts = {
|
|
2119
|
-
task: options.task,
|
|
2120
2110
|
verdict: options.verdict,
|
|
2121
2111
|
};
|
|
2112
|
+
if (options.task !== undefined)
|
|
2113
|
+
cliOpts.task = options.task;
|
|
2114
|
+
if (options.adhoc)
|
|
2115
|
+
cliOpts.adhoc = true;
|
|
2122
2116
|
if (options.config)
|
|
2123
2117
|
cliOpts.configPath = options.config;
|
|
2124
2118
|
if (options.project)
|
|
@@ -2153,140 +2147,48 @@ export function buildProgram(opts = {}) {
|
|
|
2153
2147
|
const sessionStart = program
|
|
2154
2148
|
.command("session-start")
|
|
2155
2149
|
.description("SessionStart hook entrypoints (called by Claude Code via settings.json)");
|
|
2156
|
-
sessionStart
|
|
2150
|
+
addLedgerTimeoutOption(addIdentityOptions(sessionStart
|
|
2157
2151
|
.command("preflight")
|
|
2158
2152
|
.description("SessionStart producer: run agent-preflight against the session cwd and, on a ready:true result, " +
|
|
2159
2153
|
"record a `preflight:${REPO}` fact to the evidence ledger so the preflight-before-* policies have a " +
|
|
2160
2154
|
"fresh tag to match. Reads SessionStart event JSON from stdin ({ session_id, cwd, hook_event_name }). " +
|
|
2161
2155
|
"Opt-in `session_start_preflight.setup: true` (default off) passes --setup through; " +
|
|
2162
2156
|
"see docs/CLI.md for the trust and scope caveats. " +
|
|
2163
|
-
"blocking:false
|
|
2164
|
-
.option("--config <path>", "manifest path (default: ~/.harness/harness.yaml; legacy fallback ~/.claude/harness.yaml)")
|
|
2165
|
-
.option("--project <name>", "apply per-project overrides")
|
|
2166
|
-
.option("--session <id>", "explicit session id (overrides stdin event + env). Use for manual / scripted invocations " +
|
|
2157
|
+
"blocking:false \u2014 every failure path logs to stderr and exits 0."), "explicit session id (overrides stdin event + env). Use for manual / scripted invocations " +
|
|
2167
2158
|
"where no SessionStart event JSON is piped on stdin. Without it the resolver tries " +
|
|
2168
2159
|
"stdin event → $CLAUDE_SESSION_ID → newest Claude Code transcript → 'default' (which logs " +
|
|
2169
|
-
"a loud warning since the literal 'default' session never satisfies a preflight-before-* gate).")
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
cliOpts
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
if (options.timeout) {
|
|
2181
|
-
const n = Number.parseInt(options.timeout, 10);
|
|
2182
|
-
if (Number.isFinite(n) && n > 0)
|
|
2183
|
-
cliOpts.preflightTimeoutMs = n;
|
|
2184
|
-
}
|
|
2185
|
-
if (options.ledgerTimeout) {
|
|
2186
|
-
const n = Number.parseInt(options.ledgerTimeout, 10);
|
|
2187
|
-
if (Number.isFinite(n) && n > 0)
|
|
2188
|
-
cliOpts.ledgerTimeoutMs = n;
|
|
2189
|
-
}
|
|
2190
|
-
// Opt into the bootstrap-staging side effect from the CLI entry
|
|
2191
|
-
// point only. Library callers (vitest cases) get the no-op default
|
|
2192
|
-
// so they cannot clobber the operator's real pending-approval file.
|
|
2193
|
-
cliOpts.stagePendingApproval = writePendingApproval;
|
|
2194
|
-
await runSessionStartPreflight(cliOpts);
|
|
2195
|
-
});
|
|
2196
|
-
sessionStart
|
|
2197
|
-
.command("branch-check")
|
|
2198
|
-
.description("SessionStart producer for the branch-protection pack: read .git/HEAD for the session cwd and, " +
|
|
2160
|
+
"a loud warning since the literal 'default' session never satisfies a preflight-before-* gate).").option("--timeout <ms>", "agent-preflight subprocess timeout in milliseconds (default 60000)")).action(preflightAction);
|
|
2161
|
+
// The three advisory producers below share one option set and one
|
|
2162
|
+
// action shape: only the description and the runner differ.
|
|
2163
|
+
const addSessionStartProducer = (name, description, run) => {
|
|
2164
|
+
addLedgerTimeoutOption(addCwdOption(addIdentityOptions(sessionStart.command(name).description(description), "explicit session id (overrides stdin event + env)"))).action(async (options) => {
|
|
2165
|
+
const cliOpts = {};
|
|
2166
|
+
applyCliOptions(options, cliOpts);
|
|
2167
|
+
await run(cliOpts);
|
|
2168
|
+
});
|
|
2169
|
+
};
|
|
2170
|
+
addSessionStartProducer("branch-check", "SessionStart producer for the branch-protection pack: read .git/HEAD for the session cwd and, " +
|
|
2199
2171
|
"when the branch is NOT in the operator's protected list (default: master, main, develop), " +
|
|
2200
2172
|
"record a `branch:non-protected:<branch>` fact to the evidence ledger so the pack's PreToolUse " +
|
|
2201
2173
|
"blocker has a fresh tag to satisfy its 5-minute freshness window. Also runnable on demand from " +
|
|
2202
|
-
"the operator's shell. blocking:false
|
|
2203
|
-
|
|
2204
|
-
.option("--project <name>", "apply per-project overrides")
|
|
2205
|
-
.option("--session <id>", "explicit session id (overrides stdin event + env)")
|
|
2206
|
-
.option("--cwd <path>", "override cwd resolution (default: stdin event.cwd then process.cwd())")
|
|
2207
|
-
.option("--ledger-timeout <ms>", "per-call ledger timeout in milliseconds")
|
|
2208
|
-
.action(async (options) => {
|
|
2209
|
-
const cliOpts = {};
|
|
2210
|
-
if (options.config)
|
|
2211
|
-
cliOpts.configPath = options.config;
|
|
2212
|
-
if (options.project)
|
|
2213
|
-
cliOpts.project = options.project;
|
|
2214
|
-
if (options.session)
|
|
2215
|
-
cliOpts.session = options.session;
|
|
2216
|
-
if (options.cwd)
|
|
2217
|
-
cliOpts.cwd = options.cwd;
|
|
2218
|
-
if (options.ledgerTimeout) {
|
|
2219
|
-
const n = Number.parseInt(options.ledgerTimeout, 10);
|
|
2220
|
-
if (Number.isFinite(n) && n > 0)
|
|
2221
|
-
cliOpts.ledgerTimeoutMs = n;
|
|
2222
|
-
}
|
|
2223
|
-
await runSessionStartBranchCheck(cliOpts);
|
|
2224
|
-
});
|
|
2225
|
-
sessionStart
|
|
2226
|
-
.command("toolchain-parity")
|
|
2227
|
-
.description("SessionStart producer (opt-in via `toolchain_parity.enabled: true`): writes THIS machine's " +
|
|
2174
|
+
"the operator's shell. blocking:false \u2014 every failure path logs to stderr and exits 0.", runSessionStartBranchCheck);
|
|
2175
|
+
addSessionStartProducer("toolchain-parity", "SessionStart producer (opt-in via `toolchain_parity.enabled: true`): writes THIS machine's " +
|
|
2228
2176
|
"toolchain snapshot (node version, npm globals, OW-Kit version, MCP server names) to " +
|
|
2229
2177
|
"`<machine_state_dir>/<profile>.json`, compares it against every OTHER snapshot file already " +
|
|
2230
2178
|
"in that directory, and records a `toolchain-parity:ok` / `toolchain-parity:drift:<n>` fact " +
|
|
2231
2179
|
"(with a `:unparseable-peer:<n>` suffix whenever a peer file failed to parse as JSON, so an " +
|
|
2232
2180
|
"unparseable peer never silently vanishes from the comparison) to the evidence ledger. " +
|
|
2233
|
-
"Purely advisory
|
|
2234
|
-
"Cross-machine transport of the snapshot files is agent-memory-sync's job, not this command's.")
|
|
2235
|
-
|
|
2236
|
-
.option("--project <name>", "apply per-project overrides")
|
|
2237
|
-
.option("--session <id>", "explicit session id (overrides stdin event + env)")
|
|
2238
|
-
.option("--cwd <path>", "override cwd resolution (default: stdin event.cwd then process.cwd())")
|
|
2239
|
-
.option("--ledger-timeout <ms>", "per-call ledger timeout in milliseconds")
|
|
2240
|
-
.action(async (options) => {
|
|
2241
|
-
const cliOpts = {};
|
|
2242
|
-
if (options.config)
|
|
2243
|
-
cliOpts.configPath = options.config;
|
|
2244
|
-
if (options.project)
|
|
2245
|
-
cliOpts.project = options.project;
|
|
2246
|
-
if (options.session)
|
|
2247
|
-
cliOpts.session = options.session;
|
|
2248
|
-
if (options.cwd)
|
|
2249
|
-
cliOpts.cwd = options.cwd;
|
|
2250
|
-
if (options.ledgerTimeout) {
|
|
2251
|
-
const n = Number.parseInt(options.ledgerTimeout, 10);
|
|
2252
|
-
if (Number.isFinite(n) && n > 0)
|
|
2253
|
-
cliOpts.ledgerTimeoutMs = n;
|
|
2254
|
-
}
|
|
2255
|
-
await runSessionStartToolchainParity(cliOpts);
|
|
2256
|
-
});
|
|
2257
|
-
sessionStart
|
|
2258
|
-
.command("stale-base-check")
|
|
2259
|
-
.description("SessionStart producer (opt-in via `stale_base_check.enabled: true`; task ce3903b0, incident " +
|
|
2181
|
+
"Purely advisory \u2014 never blocking, and never touches a peer's file. " +
|
|
2182
|
+
"Cross-machine transport of the snapshot files is agent-memory-sync's job, not this command's.", runSessionStartToolchainParity);
|
|
2183
|
+
addSessionStartProducer("stale-base-check", "SessionStart producer (opt-in via `stale_base_check.enabled: true`; task ce3903b0, incident " +
|
|
2260
2184
|
"ea8becf5): runs a LIVE `git fetch` of the remote default branch (never trusting the local " +
|
|
2261
|
-
"origin/<default> ref, which can itself be stale
|
|
2185
|
+
"origin/<default> ref, which can itself be stale \u2014 that is the exact bug this closes) and, when " +
|
|
2262
2186
|
"the current branch's base is behind, writes a WARNING to stderr naming how many commits behind, " +
|
|
2263
2187
|
"how old the missing work is, and the recovery command. Records a `stale-base:ok` / " +
|
|
2264
|
-
"`stale-base:behind:<n>` fact to the evidence ledger (audit-only
|
|
2188
|
+
"`stale-base:behind:<n>` fact to the evidence ledger (audit-only \u2014 no gate consumes it). " +
|
|
2265
2189
|
"Purely advisory: never blocks, and degrades cleanly (no fact written) when offline, the remote " +
|
|
2266
|
-
"or default branch can't be resolved, or credentials are missing. blocking:false
|
|
2267
|
-
"path logs to stderr and exits 0.")
|
|
2268
|
-
.option("--config <path>", "manifest path (default: ~/.harness/harness.yaml; legacy fallback ~/.claude/harness.yaml)")
|
|
2269
|
-
.option("--project <name>", "apply per-project overrides")
|
|
2270
|
-
.option("--session <id>", "explicit session id (overrides stdin event + env)")
|
|
2271
|
-
.option("--cwd <path>", "override cwd resolution (default: stdin event.cwd then process.cwd())")
|
|
2272
|
-
.option("--ledger-timeout <ms>", "per-call ledger timeout in milliseconds")
|
|
2273
|
-
.action(async (options) => {
|
|
2274
|
-
const cliOpts = {};
|
|
2275
|
-
if (options.config)
|
|
2276
|
-
cliOpts.configPath = options.config;
|
|
2277
|
-
if (options.project)
|
|
2278
|
-
cliOpts.project = options.project;
|
|
2279
|
-
if (options.session)
|
|
2280
|
-
cliOpts.session = options.session;
|
|
2281
|
-
if (options.cwd)
|
|
2282
|
-
cliOpts.cwd = options.cwd;
|
|
2283
|
-
if (options.ledgerTimeout) {
|
|
2284
|
-
const n = Number.parseInt(options.ledgerTimeout, 10);
|
|
2285
|
-
if (Number.isFinite(n) && n > 0)
|
|
2286
|
-
cliOpts.ledgerTimeoutMs = n;
|
|
2287
|
-
}
|
|
2288
|
-
await runSessionStartStaleBaseCheck(cliOpts);
|
|
2289
|
-
});
|
|
2190
|
+
"or default branch can't be resolved, or credentials are missing. blocking:false \u2014 every failure " +
|
|
2191
|
+
"path logs to stderr and exits 0.", runSessionStartStaleBaseCheck);
|
|
2290
2192
|
// `harness gate` — operator escape hatch for hard-blocking hooks.
|
|
2291
2193
|
// Task 8fcddb26: the understanding-before-execution PreToolUse hook can
|
|
2292
2194
|
// lock a Claude session out of every Bash call, and the recommended
|