@srobroek/pi-beads-enforcer 0.9.0 → 0.9.3

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 CHANGED
@@ -1,3 +1,16 @@
1
+ ## beads [0.9.3](https://github.com/srobroek/harness-plugins/compare/beads--v0.9.2...beads--v0.9.3) (2026-11-24)
2
+
3
+ ## beads [0.9.2](https://github.com/srobroek/harness-plugins/compare/beads--v0.9.1...beads--v0.9.2) (2026-11-24)
4
+
5
+ ## beads [0.9.1](https://github.com/srobroek/harness-plugins/compare/beads--v0.9.0...beads--v0.9.1) (2026-11-24)
6
+
7
+ ### Bug Fixes
8
+
9
+ * **beads:** build close-evidence git commands from gitWrappers ([0caae40](https://github.com/srobroek/harness-plugins/commit/0caae40e06d63279d631d9914bfad9e3ce7473da))
10
+ * **beads:** make project plugin signal opt in ([e31958d](https://github.com/srobroek/harness-plugins/commit/e31958dd50cad74c832b01da3380626065a26cbc))
11
+ * **beads:** rename the store-pin env marker to HARNESS_BEADS_PIN ([f111b05](https://github.com/srobroek/harness-plugins/commit/f111b051e312b4fd6155486e45e145a9a199bc95))
12
+ * **beads:** use retired marker for opt-out ([7b31f27](https://github.com/srobroek/harness-plugins/commit/7b31f2702b245c5c40bcb4e791d5c426d6a77276))
13
+
1
14
  ## beads [0.9.0](https://github.com/srobroek/harness-plugins/compare/beads--v0.8.10...beads--v0.9.0) (2026-11-23)
2
15
 
3
16
  ### Features
package/README.md CHANGED
@@ -67,13 +67,14 @@ A refusal is thrown, so the model sees it as the tool error.
67
67
  primary checkout's from a linked worktree) and clears `BEADS_DOLT_SHARED_SERVER`
68
68
  in the child environment. An explicitly set `BEADS_DIR` is left alone, and it is the default ledger for
69
69
  claim tracking: a plain claim is tracked under that store (see Claim tracking).
70
- The pin also sets `SROBROEK_BEADS_PIN` to the same path. A process can inherit a pinned
70
+ The pin also sets `HARNESS_BEADS_PIN` to the same path. A process can inherit a pinned
71
71
  shell's environment, for example an OpenCode server restarted from that shell. When the
72
72
  two variables match, the plugin drops the inherited pin and pins each session to its own
73
73
  checkout's store. A `BEADS_DIR` that the user sets in a pinned shell differs from the
74
74
  marker, so the plugin keeps it. To select the marker's own path on purpose, clear the
75
- marker as well: `unset SROBROEK_BEADS_PIN; export BEADS_DIR=/path/.beads`. With
76
- `beads-dir-pin` off, the hook still drops an inherited pin but sets no new one.
75
+ marker as well: `unset HARNESS_BEADS_PIN; export BEADS_DIR=/path/.beads`. With
76
+ `beads-dir-pin` off, the hook still drops an inherited pin but sets no new one. Sessions
77
+ started before the upgrade keep the old marker until restarted.
77
78
 
78
79
  Every gate judges a `bd` write at the store the write lock runs it in. The lock's
79
80
  planner follows what the command does before the write:
@@ -279,6 +280,11 @@ read, and a location without a store are all allowed. Gate name:
279
280
  `bead-agent-routing`.
280
281
 
281
282
  ## Install
283
+ Install the Pi package from npm:
284
+
285
+ ```sh
286
+ pi install npm:@srobroek/pi-beads-enforcer
287
+ ```
282
288
 
283
289
  ```sh
284
290
  opencode plugin add 'github:srobroek/harness-plugins::path:plugins/beads/opencode'
@@ -300,9 +306,9 @@ It ships the skills and the two hooks in `hooks/claude-hooks.json`. Both hooks r
300
306
  - `SessionStart` adds `bd prime` and the session-start advisories as context, within
301
307
  Claude Code's 10,000-character limit. It runs on startup, resume, clear and compact.
302
308
  It also writes the store pin to `CLAUDE_ENV_FILE`: `BEADS_DIR` with its
303
- `SROBROEK_BEADS_PIN` marker, and an empty `BEADS_DOLT_SHARED_SERVER`. It drops an
309
+ `HARNESS_BEADS_PIN` marker, and an empty `BEADS_DOLT_SHARED_SERVER`. It drops an
304
310
  inherited pin first, so `bd prime`, the advisories and the pin share one store. In a
305
- directory without a store, it writes `unset BEADS_DIR SROBROEK_BEADS_PIN`, so Bash
311
+ directory without a store, it writes `unset BEADS_DIR HARNESS_BEADS_PIN`, so Bash
306
312
  leaves the inherited ledger too.
307
313
  - `PreToolUse` on `Bash` runs the shell gates above, with every gate on. It skips a
308
314
  command that names none of `bd`, `git` and `gh`. A refusal denies the call. A rewrite replaces
@@ -333,8 +339,7 @@ above on every `bash` call with every gate on, and it adds three pi-only gates a
333
339
  A refusal blocks the call with `<cause>; <fix>. (beads gate <name>)`. A call that passes
334
340
  gets two prefixes:
335
341
 
336
- - The store pin: `export` lines for `BEADS_DIR`, its `SROBROEK_BEADS_PIN` marker and an empty
337
- `BEADS_DOLT_SHARED_SERVER`. A directory without a store gets an `unset` of an inherited pin.
342
+ - The store pin: `export` lines for `BEADS_DIR`, its `HARNESS_BEADS_PIN` marker and an empty
338
343
  - The actor: `unset BEADS_ACTOR; export BD_ACTOR='pi/<root session>/.../<this session>';`.
339
344
 
340
345
  Every pi session gets its own actor, the interactive root session included. pi runs a
@@ -363,12 +368,19 @@ The OpenCode plugin and the Claude Code hook do not run these three gates.
363
368
  that names checkable evidence, as `rule://beads-evidence` asks. The gate accepts any of
364
369
  these:
365
370
 
366
- - a backticked command, or a tool command such as `bun test x.test.ts`
371
+ - a backticked command, or a tool command such as `bun test x.test.ts` (a git command
372
+ counts when it names git, or a wrapper listed in `gitWrappers`)
367
373
  - a path or a file name
368
374
  - a commit SHA, a PR or issue reference, or a URL
369
375
  - a test count or an exit code
370
376
 
371
377
  A reason such as `done` or `N/A` fails this gate.
378
+
379
+ pi passes no options to an extension, so this gate reads `gitWrappers` from `beads.json`
380
+ in pi's agent directory (`~/.pi/agent/beads.json`, or the same file under
381
+ `PI_CODING_AGENT_DIR`): `{ "gitWrappers": ["git", "<wrapper>"] }`. The default is
382
+ `["git"]` and a list replaces it. It is the only option pi reads; an unreadable or
383
+ malformed file leaves only `git` and warns at session start.
372
384
  3. `write-claim-gate`: in a pi-subagents child, `edit` and `write` need a claim. The rule
373
385
  covers a file in a checkout with a Beads store: the child must hold at least one
374
386
  `in_progress` claim in that store. The gate asks
@@ -413,7 +425,7 @@ These parts stay OpenCode-only:
413
425
  - claim tracking and lease heartbeats
414
426
  - the stop nudge and guarded claim release
415
427
  - subagent routing (`bead-agent-routing`) and the fork notice
416
- - session-start advisories and plugin options
428
+ - session-start advisories and the plugin options (pi reads only `gitWrappers`, above)
417
429
 
418
430
  # Project ledger store
419
431
 
@@ -2,8 +2,9 @@
2
2
  // Generated by scripts/build.ts. Do not edit.
3
3
  // plugins/beads/pi-src/beads.ts
4
4
  import { homedir } from "os";
5
- import { dirname as dirname8, isAbsolute as isAbsolute6, resolve as resolve10 } from "path";
5
+ import { dirname as dirname8, isAbsolute as isAbsolute6, join as join7, resolve as resolve10 } from "path";
6
6
  import { fileURLToPath } from "url";
7
+ import { getAgentDir } from "@earendil-works/pi-coding-agent";
7
8
 
8
9
  // lib/src/shell-tokenizer.ts
9
10
  var SEPARATORS = new Set([";", "&", "|", "(", ")", `
@@ -3108,6 +3109,72 @@ async function decideEmbeddedWrite(parsed, cwd, env, callID, deadline = Date.now
3108
3109
  }
3109
3110
  }
3110
3111
 
3112
+ // lib/src/git-wrappers.ts
3113
+ var DEFAULT_GIT_WRAPPERS = Object.freeze(["git"]);
3114
+ function readGitWrappers(options) {
3115
+ const raw = options?.gitWrappers;
3116
+ if (!Array.isArray(raw))
3117
+ return DEFAULT_GIT_WRAPPERS;
3118
+ const names = raw.filter((name) => typeof name === "string" && name !== "");
3119
+ return names.length === 0 ? DEFAULT_GIT_WRAPPERS : names;
3120
+ }
3121
+ function gitWrapperPattern(wrappers = DEFAULT_GIT_WRAPPERS) {
3122
+ return wrappers.map((name) => name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
3123
+ }
3124
+
3125
+ // lib/src/pi-options.ts
3126
+ import { readFileSync as readFileSync2 } from "fs";
3127
+ function loadPiOptionsFile(path, plugin, fallback) {
3128
+ let text;
3129
+ try {
3130
+ text = readFileSync2(path, "utf8");
3131
+ } catch (error) {
3132
+ if (error.code === "ENOENT")
3133
+ return { options: {} };
3134
+ return { options: {}, warning: `${plugin}: ${path} could not be read; ${fallback}.` };
3135
+ }
3136
+ let raw;
3137
+ try {
3138
+ raw = JSON.parse(text);
3139
+ } catch {
3140
+ return { options: {}, warning: `${plugin}: ${path} is not valid JSON; ${fallback}.` };
3141
+ }
3142
+ return { options: raw !== null && typeof raw === "object" && !Array.isArray(raw) ? raw : {} };
3143
+ }
3144
+
3145
+ // lib/src/pi-session-header.ts
3146
+ import { closeSync as closeSync3, lstatSync as lstatSync3, openSync as openSync3, readSync as readSync2 } from "fs";
3147
+ var HEADER_BYTES = 16 * 1024;
3148
+ function readSessionHeader(file) {
3149
+ let fd;
3150
+ try {
3151
+ if (!lstatSync3(file).isFile())
3152
+ return;
3153
+ fd = openSync3(file, "r");
3154
+ const buffer = Buffer.alloc(HEADER_BYTES);
3155
+ const length = readSync2(fd, buffer, 0, HEADER_BYTES, 0);
3156
+ const text = buffer.subarray(0, length).toString("utf8");
3157
+ const end = text.indexOf(`
3158
+ `);
3159
+ if (end < 0 && length === HEADER_BYTES)
3160
+ return;
3161
+ return headerView(JSON.parse(end < 0 ? text : text.slice(0, end)));
3162
+ } catch {
3163
+ return;
3164
+ } finally {
3165
+ if (fd !== undefined)
3166
+ closeSync3(fd);
3167
+ }
3168
+ }
3169
+ function headerView(value) {
3170
+ if (value === null || typeof value !== "object")
3171
+ return;
3172
+ const header = value;
3173
+ if (header.type !== "session" || typeof header.id !== "string" || header.id === "")
3174
+ return;
3175
+ return typeof header.parentSession === "string" && header.parentSession !== "" ? { id: header.id, parentSession: header.parentSession } : { id: header.id };
3176
+ }
3177
+
3111
3178
  // plugins/beads/pi-src/beads.ts
3112
3179
  import { Type } from "typebox";
3113
3180
 
@@ -3895,7 +3962,7 @@ function decideBdUpdateCloseParsed(parsed) {
3895
3962
 
3896
3963
  // plugins/beads/opencode/src/binary-hooks.ts
3897
3964
  import { spawnSync as spawnSync3 } from "child_process";
3898
- import { closeSync as closeSync3, existsSync as existsSync3, openSync as openSync3, readdirSync, readFileSync as readFileSync2, readSync as readSync2, realpathSync as realpathSync4, statSync as statSync4 } from "fs";
3965
+ import { closeSync as closeSync4, existsSync as existsSync3, openSync as openSync4, readdirSync, readFileSync as readFileSync3, readSync as readSync3, realpathSync as realpathSync4, statSync as statSync4 } from "fs";
3899
3966
  import { isAbsolute as isAbsolute4, join as join3, resolve as resolve4, sep } from "path";
3900
3967
  var BINARY_MAGICS = [
3901
3968
  [254, 237, 250, 206],
@@ -3937,16 +4004,16 @@ function hooksDirectory(cwd, git) {
3937
4004
  return existsSync3(conventional) ? conventional : undefined;
3938
4005
  }
3939
4006
  function fileHasMarker(path, magicsOnly = false) {
3940
- const fd = openSync3(path, "r");
4007
+ const fd = openSync4(path, "r");
3941
4008
  try {
3942
4009
  const bytes = Buffer.alloc(SAMPLE_BYTES);
3943
- const count = readSync2(fd, bytes, 0, bytes.length, 0);
4010
+ const count = readSync3(fd, bytes, 0, bytes.length, 0);
3944
4011
  const sample = bytes.subarray(0, count);
3945
4012
  if (!magicsOnly && sample.includes(0))
3946
4013
  return true;
3947
4014
  return BINARY_MAGICS.some((magic) => sample.length >= magic.length && magic.every((byte, index) => sample[index] === byte));
3948
4015
  } finally {
3949
- closeSync3(fd);
4016
+ closeSync4(fd);
3950
4017
  }
3951
4018
  }
3952
4019
  function hasBinaryHooks(cwd, git = runGit) {
@@ -4050,7 +4117,7 @@ function protectBinaryHookCommands(input, command, cwd, git = runGit) {
4050
4117
  }
4051
4118
 
4052
4119
  // plugins/beads/opencode/src/ledger-context.ts
4053
- import { existsSync as existsSync4, lstatSync as lstatSync3, realpathSync as realpathSync5 } from "fs";
4120
+ import { existsSync as existsSync4, lstatSync as lstatSync4, realpathSync as realpathSync5 } from "fs";
4054
4121
  import { basename as basename4, dirname as dirname4, join as join4, resolve as resolve5 } from "path";
4055
4122
  var SAFE_PREFIX = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
4056
4123
  function findLedger(from) {
@@ -4070,7 +4137,7 @@ function findLedger(from) {
4070
4137
  }
4071
4138
  function isRetired(store) {
4072
4139
  try {
4073
- return lstatSync3(join4(store, "RETIRED")).isFile();
4140
+ return lstatSync4(join4(store, "RETIRED")).isFile();
4074
4141
  } catch {
4075
4142
  return false;
4076
4143
  }
@@ -4159,7 +4226,7 @@ function unplacedBdRefusal(input) {
4159
4226
 
4160
4227
  // plugins/beads/opencode/src/pr-bead-link-gate.ts
4161
4228
  import { execFileSync } from "child_process";
4162
- import { closeSync as closeSync4, constants as constants3, existsSync as existsSync5, fstatSync as fstatSync2, lstatSync as lstatSync4, openSync as openSync4, readSync as readSync3, realpathSync as realpathSync6 } from "fs";
4229
+ import { closeSync as closeSync5, constants as constants3, existsSync as existsSync5, fstatSync as fstatSync2, lstatSync as lstatSync5, openSync as openSync5, readSync as readSync4, realpathSync as realpathSync6 } from "fs";
4163
4230
  import { basename as basename6, dirname as dirname5, join as join5, resolve as resolve6 } from "path";
4164
4231
 
4165
4232
  // plugins/beads/opencode/src/pr-create-form.ts
@@ -4647,7 +4714,7 @@ function beadsActive(dir) {
4647
4714
  const beads = join5(current, ".beads");
4648
4715
  if (existsSync5(beads)) {
4649
4716
  try {
4650
- return !lstatSync4(join5(beads, "RETIRED")).isFile();
4717
+ return !lstatSync5(join5(beads, "RETIRED")).isFile();
4651
4718
  } catch {
4652
4719
  return true;
4653
4720
  }
@@ -4715,7 +4782,7 @@ function readBodyFile(cwd) {
4715
4782
  const directory = resolve6(realpathSync6(cwd), dirname5(path));
4716
4783
  if (realpathSync6(directory) !== directory)
4717
4784
  return { ok: false, reason: "its directory is or goes through a symlink" };
4718
- fd = openSync4(join5(directory, basename6(path)), constants3.O_RDONLY | constants3.O_NOFOLLOW | constants3.O_NONBLOCK);
4785
+ fd = openSync5(join5(directory, basename6(path)), constants3.O_RDONLY | constants3.O_NOFOLLOW | constants3.O_NONBLOCK);
4719
4786
  const stat = fstatSync2(fd);
4720
4787
  if (!stat.isFile())
4721
4788
  return { ok: false, reason: "it is not a regular file" };
@@ -4724,7 +4791,7 @@ function readBodyFile(cwd) {
4724
4791
  const buffer = Buffer.alloc(MAX_BODY_BYTES + 1);
4725
4792
  let length = 0;
4726
4793
  while (length < buffer.length) {
4727
- const read = readSync3(fd, buffer, length, buffer.length - length, null);
4794
+ const read = readSync4(fd, buffer, length, buffer.length - length, null);
4728
4795
  if (read === 0)
4729
4796
  break;
4730
4797
  length += read;
@@ -4744,7 +4811,7 @@ function readBodyFile(cwd) {
4744
4811
  return { ok: false, reason: `it could not be opened as a regular file${code === undefined ? "" : ` (${code})`}`, cause: error };
4745
4812
  } finally {
4746
4813
  if (fd !== undefined)
4747
- closeSync4(fd);
4814
+ closeSync5(fd);
4748
4815
  }
4749
4816
  };
4750
4817
  }
@@ -4926,7 +4993,7 @@ ${command}`;
4926
4993
  }
4927
4994
 
4928
4995
  // plugins/beads/opencode/src/store-pin.ts
4929
- var PIN_MARKER_ENV = "SROBROEK_BEADS_PIN";
4996
+ var PIN_MARKER_ENV = "HARNESS_BEADS_PIN";
4930
4997
  function pinVariables(store) {
4931
4998
  return { ...EMBEDDED_PIN_ENV, BEADS_DIR: store, [PIN_MARKER_ENV]: store };
4932
4999
  }
@@ -4976,40 +5043,9 @@ import { existsSync as existsSync6, statSync as statSync5 } from "fs";
4976
5043
  import { dirname as dirname7, resolve as resolve9 } from "path";
4977
5044
 
4978
5045
  // plugins/beads/shared/pi-session.ts
4979
- import { closeSync as closeSync5, lstatSync as lstatSync5, openSync as openSync5, readSync as readSync4 } from "fs";
4980
5046
  import { basename as basename7, dirname as dirname6, isAbsolute as isAbsolute5, join as join6, relative, resolve as resolve8 } from "path";
4981
5047
  var SAFE_SEGMENT = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
4982
- var HEADER_BYTES = 16 * 1024;
4983
5048
  var MAX_LINEAGE_DEPTH = 16;
4984
- function readSessionHeader(file) {
4985
- let fd;
4986
- try {
4987
- if (!lstatSync5(file).isFile())
4988
- return;
4989
- fd = openSync5(file, "r");
4990
- const buffer = Buffer.alloc(HEADER_BYTES);
4991
- const length = readSync4(fd, buffer, 0, HEADER_BYTES, 0);
4992
- const text = buffer.subarray(0, length).toString("utf8");
4993
- const end = text.indexOf(`
4994
- `);
4995
- if (end < 0 && length === HEADER_BYTES)
4996
- return;
4997
- return headerView(JSON.parse(end < 0 ? text : text.slice(0, end)));
4998
- } catch {
4999
- return;
5000
- } finally {
5001
- if (fd !== undefined)
5002
- closeSync5(fd);
5003
- }
5004
- }
5005
- function headerView(value) {
5006
- if (value === null || typeof value !== "object")
5007
- return;
5008
- const header = value;
5009
- if (header.type !== "session" || typeof header.id !== "string" || header.id === "")
5010
- return;
5011
- return typeof header.parentSession === "string" && header.parentSession !== "" ? { id: header.id, parentSession: header.parentSession } : { id: header.id };
5012
- }
5013
5049
  function sessionLineage(session, readHeader = readSessionHeader, maxDepth = MAX_LINEAGE_DEPTH) {
5014
5050
  const lineage = [session.id];
5015
5051
  let parent = session.parentSession;
@@ -5198,14 +5234,14 @@ var EVIDENCE = [
5198
5234
  /(?:^|[\s(])(?:#|!)\d+\b|\b(?:PR|MR|pull request|merge request)\s*[#!]?\d+\b/i,
5199
5235
  /\b\d+\s+(?:pass(?:ed|es|ing)?|fail(?:ed|s|ures?|ing)?|tests?|specs?|checks?|errors?)\b/i,
5200
5236
  /\bexit(?:ed)?\s+(?:code\s+|status\s+)?\d+\b/i,
5201
- /\b(?:bun|bunx|npm|npx|pnpm|yarn|cargo|pytest|python3?|uv|just|make|tsc|biome|eslint|gh|git|dgit|bd|wt|pi)\s+[\w-]+/,
5202
5237
  /\bgo\s+(?:test|build|vet|run)\b/
5203
5238
  ];
5204
- function hasCheckableEvidence(text) {
5205
- return text.trim() !== "" && EVIDENCE.some((pattern) => pattern.test(text));
5239
+ var commandEvidence = (gitWrappers) => new RegExp(`\\b(?:bun|bunx|npm|npx|pnpm|yarn|cargo|pytest|python3?|uv|just|make|tsc|biome|eslint|gh|${gitWrapperPattern(gitWrappers)}|bd|wt|pi)\\s+[\\w-]+`);
5240
+ function hasCheckableEvidence(text, gitWrappers = DEFAULT_GIT_WRAPPERS) {
5241
+ return text.trim() !== "" && (EVIDENCE.some((pattern) => pattern.test(text)) || commandEvidence(gitWrappers).test(text));
5206
5242
  }
5207
5243
  var EVIDENCE_RESOLUTION = 'give the close a factual --reason naming the evidence, for example `bd close ID --reason "bun test x.test.ts: 12 pass; changed src/x.ts"`, or --reason-file with that text';
5208
- function closeEvidenceRefusal(reasons, cwd) {
5244
+ function closeEvidenceRefusal(reasons, cwd, gitWrappers = DEFAULT_GIT_WRAPPERS) {
5209
5245
  if (reasons.length === 0)
5210
5246
  return "bd close has no --reason, so the close records no evidence";
5211
5247
  for (const reason of reasons) {
@@ -5215,11 +5251,11 @@ function closeEvidenceRefusal(reasons, cwd) {
5215
5251
  const read = readBounded(resolve9(cwd, reason.path));
5216
5252
  if (read.kind !== "text")
5217
5253
  return `bd close --reason-file ${JSON.stringify(reason.path)} is not a small readable file`;
5218
- if (!hasCheckableEvidence(read.text))
5254
+ if (!hasCheckableEvidence(read.text, gitWrappers))
5219
5255
  return `the reason in ${JSON.stringify(reason.path)} carries no checkable evidence`;
5220
5256
  continue;
5221
5257
  }
5222
- if (!hasCheckableEvidence(reason.text))
5258
+ if (!hasCheckableEvidence(reason.text, gitWrappers))
5223
5259
  return `the close reason ${JSON.stringify(reason.text.slice(0, 120))} carries no checkable evidence (a command run, a changed path, a commit or PR, or a test result)`;
5224
5260
  }
5225
5261
  return;
@@ -5276,7 +5312,7 @@ async function decideBeadWork(command, cwd, deps) {
5276
5312
  continue;
5277
5313
  const target = deps.targets.get(site.shape);
5278
5314
  const where = target !== undefined && !("unresolved" in target) ? target.cwd : cwd;
5279
- const refusal = closeEvidenceRefusal(site.reasons, where);
5315
+ const refusal = closeEvidenceRefusal(site.reasons, where, deps.gitWrappers);
5280
5316
  if (refusal !== undefined)
5281
5317
  return { gate: EVIDENCE_GATE, cause: refusal, resolution: EVIDENCE_RESOLUTION };
5282
5318
  }
@@ -5848,6 +5884,7 @@ function systemDeps(env, cwd, signal) {
5848
5884
  var PIN_CACHE_MS = 5000;
5849
5885
  var EXTENSION_DIR = dirname8(fileURLToPath(import.meta.url));
5850
5886
  var HELD_CACHE_MS = 30000;
5887
+ var OPTIONS_FILE = "beads.json";
5851
5888
  var MAX_CLAIMED_CALLS = 1000;
5852
5889
  function claimedCalls() {
5853
5890
  const key = Symbol.for("com.srobroek.beads.pi.gated-calls.v1");
@@ -5892,6 +5929,8 @@ function setupBeadsPi(pi, deps = {}) {
5892
5929
  const pinFor = deps.pinFor ?? sessionPinFor;
5893
5930
  const readHeader = deps.readHeader ?? readSessionHeader;
5894
5931
  const baseEnv = () => withoutInheritedPin(deps.env ?? process.env);
5932
+ const loaded = loadPiOptionsFile(deps.optionsPath ?? join7(getAgentDir(), OPTIONS_FILE), "beads", "close evidence counts only `git` as git");
5933
+ const gitWrappers = readGitWrappers(loaded.options);
5895
5934
  const calls = claimedCalls();
5896
5935
  const pins = new Map;
5897
5936
  const identities = new Map;
@@ -5945,7 +5984,8 @@ function setupBeadsPi(pi, deps = {}) {
5945
5984
  env: selection.env,
5946
5985
  deadline,
5947
5986
  run,
5948
- targets: resolveBdTargets(command, cwd, selection.env)
5987
+ targets: resolveBdTargets(command, cwd, selection.env),
5988
+ gitWrappers
5949
5989
  });
5950
5990
  if (work !== undefined)
5951
5991
  return { block: true, reason: refusalText(work) };
@@ -5978,6 +6018,8 @@ function setupBeadsPi(pi, deps = {}) {
5978
6018
  return { block: true, reason: refusalText(writeClaimRefusal(target, store, actor, failure)) };
5979
6019
  };
5980
6020
  pi.on("session_start", (_event, ctx) => {
6021
+ if (loaded.warning !== undefined && ctx.hasUI)
6022
+ ctx.ui.notify(loaded.warning, "warning");
5981
6023
  if (identityOf(ctx).child)
5982
6024
  return;
5983
6025
  const env = lifecycleBdEnvironment(ctx.cwd, pinnedEnvironment(ctx.cwd, baseEnv(), cachedPinFor));
@@ -6043,6 +6085,7 @@ function beads_default(pi) {
6043
6085
  }
6044
6086
  export {
6045
6087
  HELD_CACHE_MS,
6088
+ OPTIONS_FILE,
6046
6089
  beads_default as default,
6047
6090
  keptAlive,
6048
6091
  refusalText,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srobroek/pi-beads-enforcer",
3
- "version": "0.9.0",
3
+ "version": "0.9.3",
4
4
  "description": "Beads issue tracking: bd prime session context, shell gates on bd, git and gh commands, store pinning and the Beads skills.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -23,6 +23,7 @@
23
23
  "provenance": true
24
24
  },
25
25
  "peerDependencies": {
26
+ "@earendil-works/pi-coding-agent": "*",
26
27
  "typebox": "*"
27
28
  },
28
29
  "pi": {