@srobroek/pi-speckit-beads 3.2.1 → 3.2.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,11 @@
1
+ ## speckit-beads [3.2.3](https://github.com/srobroek/harness-plugins/compare/speckit-beads--v3.2.2...speckit-beads--v3.2.3) (2026-12-05)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **beads:** show the guarded reassign when bd refuses a claim made by this session's old actor ([#346](https://github.com/srobroek/harness-plugins/issues/346)) ([7a87489](https://github.com/srobroek/harness-plugins/commit/7a874897fc80381148ec0aaefe70022323d89229))
6
+
7
+ ## speckit-beads [3.2.2](https://github.com/srobroek/harness-plugins/compare/speckit-beads--v3.2.1...speckit-beads--v3.2.2) (2026-12-05)
8
+
1
9
  ## speckit-beads [3.2.1](https://github.com/srobroek/harness-plugins/compare/speckit-beads--v3.2.0...speckit-beads--v3.2.1) (2026-12-05)
2
10
 
3
11
  ## speckit-beads [3.2.0](https://github.com/srobroek/harness-plugins/compare/speckit-beads--v3.1.0...speckit-beads--v3.2.0) (2026-12-05)
@@ -2,7 +2,7 @@
2
2
  // Generated by scripts/build.ts. Do not edit.
3
3
  // plugins/speckit-beads/pi-src/speckit-beads.ts
4
4
  import { randomUUID as randomUUID2 } from "crypto";
5
- import { join as join9 } from "path";
5
+ import { join as join10 } from "path";
6
6
  import { getAgentDir } from "@earendil-works/pi-coding-agent";
7
7
 
8
8
  // lib/src/external-directories.ts
@@ -1214,9 +1214,197 @@ The index was not synced for these paths: ${synced.reason}`}`,
1214
1214
  }
1215
1215
 
1216
1216
  // plugins/speckit-beads/opencode/src/setup.ts
1217
- import { appendFileSync, copyFileSync, existsSync as existsSync3, lstatSync as lstatSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync } from "fs";
1218
- import { dirname as dirname3, isAbsolute as isAbsolute2, join as join4, relative as relative2, resolve as resolve3, sep } from "path";
1217
+ import { appendFileSync, existsSync as existsSync3, lstatSync as lstatSync3, readFileSync as readFileSync4, writeFileSync } from "fs";
1218
+ import { dirname as dirname3, isAbsolute as isAbsolute3, join as join5, relative as relative2, resolve as resolve4, sep } from "path";
1219
1219
  import { fileURLToPath } from "url";
1220
+
1221
+ // lib/src/formulas.ts
1222
+ import { accessSync, constants as constants2, copyFileSync, lstatSync as lstatSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync3, statSync as statSync2 } from "fs";
1223
+ import { isAbsolute as isAbsolute2, join as join4, resolve as resolve3 } from "path";
1224
+ function describeFormulaFailure(failure) {
1225
+ const paths = failure.paths.join(", ");
1226
+ switch (failure.kind) {
1227
+ case "symlinked-directory":
1228
+ return `refusing symlinked path: ${paths}`;
1229
+ case "no-workspace":
1230
+ return `not a beads workspace: ${paths} has no .beads/ (run bd init there first)`;
1231
+ case "destination-not-directory":
1232
+ return `formula destination is not a directory: ${paths}`;
1233
+ case "source-symlink":
1234
+ case "source-missing":
1235
+ return `shipped formula missing or unsafe: ${paths}`;
1236
+ case "source-unreadable":
1237
+ return `shipped formula unreadable (${failure.code}): ${paths}`;
1238
+ case "destination-symlink":
1239
+ case "destination-not-file":
1240
+ case "destinations-unsafe":
1241
+ return `refusing non-file formula destination: ${paths}`;
1242
+ case "divergent":
1243
+ return `refusing to overwrite divergent formulas (pass force=true to replace them): ${paths}`;
1244
+ case "destination-unreadable":
1245
+ return `cannot read formula destination (${failure.code}): ${paths}`;
1246
+ case "destination-unwritable":
1247
+ return `cannot write formula destination (${failure.code}): ${paths}${failure.copied.length > 0 ? `; already copied: ${failure.copied.join(", ")}` : ""}`;
1248
+ }
1249
+ }
1250
+ function errorCode(error) {
1251
+ return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : "UNKNOWN";
1252
+ }
1253
+ function probe(path) {
1254
+ try {
1255
+ return { stat: lstatSync2(path, { throwIfNoEntry: false }) };
1256
+ } catch (error) {
1257
+ return { code: errorCode(error) };
1258
+ }
1259
+ }
1260
+ function isNonDirectory(path) {
1261
+ try {
1262
+ return !statSync2(path).isDirectory();
1263
+ } catch {
1264
+ return false;
1265
+ }
1266
+ }
1267
+ function installFormulas(options) {
1268
+ const { workspace, cwd, sourceDir, force = false, requireWorkspace = true, sourcePreflight = [], refusals = "unsafe-first" } = options;
1269
+ const repo = isAbsolute2(workspace) ? workspace : resolve3(cwd, workspace);
1270
+ const beads = join4(repo, ".beads");
1271
+ const destination = join4(beads, "formulas");
1272
+ const fail = (failure) => ({
1273
+ ok: false,
1274
+ text: describeFormulaFailure(failure),
1275
+ copied: failure.kind === "destination-unwritable" ? failure.copied : [],
1276
+ unchanged: [],
1277
+ destination,
1278
+ failure
1279
+ });
1280
+ const beadsProbe = probe(beads);
1281
+ const rootIsFile = "code" in beadsProbe && beadsProbe.code === "ENOTDIR" && isNonDirectory(repo);
1282
+ if ("code" in beadsProbe && !rootIsFile)
1283
+ return fail({ kind: "destination-unreadable", paths: [beads], code: beadsProbe.code });
1284
+ const beadsStat = "stat" in beadsProbe ? beadsProbe.stat : undefined;
1285
+ if (beadsStat?.isSymbolicLink())
1286
+ return fail({ kind: "symlinked-directory", paths: [beads] });
1287
+ const formulasProbe = beadsStat?.isDirectory() ? probe(destination) : { stat: undefined };
1288
+ if ("code" in formulasProbe)
1289
+ return fail({ kind: "destination-unreadable", paths: [destination], code: formulasProbe.code });
1290
+ const destStat = formulasProbe.stat;
1291
+ if (destStat?.isSymbolicLink())
1292
+ return fail({ kind: "symlinked-directory", paths: [destination] });
1293
+ if (requireWorkspace && !beadsStat?.isDirectory())
1294
+ return fail({ kind: "no-workspace", paths: [repo] });
1295
+ if (rootIsFile)
1296
+ return fail({ kind: "destination-not-directory", paths: [destination] });
1297
+ if (beadsStat && !beadsStat.isDirectory())
1298
+ return fail({ kind: "destination-not-directory", paths: [destination] });
1299
+ if (destStat && !destStat.isDirectory() && refusals !== "first")
1300
+ return fail({ kind: "destination-not-directory", paths: [destination] });
1301
+ const sourceOf = (name) => join4(sourceDir, `${name}.formula.toml`);
1302
+ const sourceRefusal = (name) => {
1303
+ const src = sourceOf(name);
1304
+ const found = probe(src);
1305
+ if ("code" in found)
1306
+ return { kind: "source-unreadable", paths: [src], code: found.code };
1307
+ if (!found.stat)
1308
+ return { kind: "source-missing", paths: [src] };
1309
+ if (found.stat.isSymbolicLink())
1310
+ return { kind: "source-symlink", paths: [src] };
1311
+ return found.stat.isFile() ? undefined : { kind: "source-missing", paths: [src] };
1312
+ };
1313
+ for (const name of sourcePreflight) {
1314
+ const refusal = sourceRefusal(name);
1315
+ if (refusal)
1316
+ return fail(refusal);
1317
+ }
1318
+ let names;
1319
+ try {
1320
+ names = typeof options.names === "function" ? options.names() : options.names;
1321
+ } catch (error) {
1322
+ return fail({ kind: "source-unreadable", paths: [sourceDir], code: errorCode(error) });
1323
+ }
1324
+ const copies = [];
1325
+ const unchanged = [];
1326
+ const divergent = [];
1327
+ const unsafe = [];
1328
+ for (const name of names) {
1329
+ const src = sourceOf(name);
1330
+ const dest = join4(destination, `${name}.formula.toml`);
1331
+ if (refusals === "first") {
1332
+ const sourceProbe = probe(src);
1333
+ if ("code" in sourceProbe)
1334
+ return fail({ kind: "source-unreadable", paths: [src], code: sourceProbe.code });
1335
+ if (sourceProbe.stat?.isSymbolicLink())
1336
+ return fail({ kind: "source-symlink", paths: [src] });
1337
+ const destProbe = probe(dest);
1338
+ if ("code" in destProbe)
1339
+ return fail({ kind: "destination-unreadable", paths: [dest], code: destProbe.code });
1340
+ if (destProbe.stat?.isSymbolicLink())
1341
+ return fail({ kind: "destination-symlink", paths: [dest] });
1342
+ }
1343
+ const refusal = sourceRefusal(name);
1344
+ if (refusal)
1345
+ return fail(refusal);
1346
+ const found = probe(dest);
1347
+ if ("code" in found)
1348
+ return fail({ kind: "destination-unreadable", paths: [dest], code: found.code });
1349
+ const st = found.stat;
1350
+ const reason = st?.isSymbolicLink() ? "destination-symlink" : st && !st.isFile() ? "destination-not-file" : undefined;
1351
+ if (reason !== undefined) {
1352
+ if (refusals !== "collect")
1353
+ return fail({ kind: reason, paths: [dest] });
1354
+ unsafe.push({ reason, path: dest });
1355
+ continue;
1356
+ }
1357
+ if (st) {
1358
+ let shipped;
1359
+ try {
1360
+ shipped = readFileSync3(src);
1361
+ } catch (error) {
1362
+ return fail({ kind: "source-unreadable", paths: [src], code: errorCode(error) });
1363
+ }
1364
+ let installed;
1365
+ try {
1366
+ installed = readFileSync3(dest);
1367
+ } catch (error) {
1368
+ return fail({ kind: "destination-unreadable", paths: [dest], code: errorCode(error) });
1369
+ }
1370
+ if (shipped.equals(installed)) {
1371
+ unchanged.push(name);
1372
+ continue;
1373
+ }
1374
+ if (refusals === "first" && !force)
1375
+ return fail({ kind: "divergent", paths: [dest] });
1376
+ divergent.push(dest);
1377
+ }
1378
+ copies.push({ src, dest, name });
1379
+ }
1380
+ if (unsafe.length > 0)
1381
+ return fail({ kind: "destinations-unsafe", paths: unsafe.map(({ path }) => path), reasons: unsafe.map(({ reason }) => reason) });
1382
+ if (divergent.length > 0 && !force)
1383
+ return fail({ kind: "divergent", paths: divergent });
1384
+ for (const { src } of copies) {
1385
+ try {
1386
+ accessSync(src, constants2.R_OK);
1387
+ } catch (error) {
1388
+ return fail({ kind: "source-unreadable", paths: [src], code: errorCode(error) });
1389
+ }
1390
+ }
1391
+ const copied = [];
1392
+ let writing = destination;
1393
+ try {
1394
+ mkdirSync2(destination, { recursive: true });
1395
+ for (const { src, dest, name } of copies) {
1396
+ writing = dest;
1397
+ copyFileSync(src, dest);
1398
+ copied.push(name);
1399
+ }
1400
+ } catch (error) {
1401
+ return fail({ kind: "destination-unwritable", paths: [writing], code: errorCode(error), copied });
1402
+ }
1403
+ const text = copied.length > 0 ? `copied ${copied.join(", ")} into ${destination}` : `every formula already in ${destination}`;
1404
+ return { ok: true, text, copied, unchanged, destination };
1405
+ }
1406
+
1407
+ // plugins/speckit-beads/opencode/src/setup.ts
1220
1408
  var PHASE_TIMEOUT_MS = 60000;
1221
1409
  var STOPPED = "stopped by the tool call; rerun to resume, finished phases are skipped";
1222
1410
  var isStopped = (signal) => signal?.aborted === true;
@@ -1290,7 +1478,7 @@ var testPluginRoot = null;
1290
1478
  function pluginRoot() {
1291
1479
  if (testPluginRoot)
1292
1480
  return testPluginRoot;
1293
- return join4(dirname3(fileURLToPath(import.meta.url)), "..");
1481
+ return join5(dirname3(fileURLToPath(import.meta.url)), "..");
1294
1482
  }
1295
1483
  function parseSpecifyMajorMinor(versionOut) {
1296
1484
  const m = versionOut.match(/(\d+)\.(\d+)/);
@@ -1305,9 +1493,9 @@ function specifyVersionOk(versionOut) {
1305
1493
  return v.major > 0 || v.major === 0 && v.minor >= 12;
1306
1494
  }
1307
1495
  function ensureGitignore(repo) {
1308
- safePath(join4(repo, ".gitignore"), repo);
1309
- const gi = join4(repo, ".gitignore");
1310
- const existing = existsSync3(gi) ? readFileSync3(gi, "utf8") : "";
1496
+ safePath(join5(repo, ".gitignore"), repo);
1497
+ const gi = join5(repo, ".gitignore");
1498
+ const existing = existsSync3(gi) ? readFileSync4(gi, "utf8") : "";
1311
1499
  if (existing.split(`
1312
1500
  `).some((l) => l.trim() === GITIGNORE_ENTRY)) {
1313
1501
  return "gitignore already has spec-status.md";
@@ -1324,54 +1512,60 @@ function ensureGitignore(repo) {
1324
1512
  return "appended specs/**/spec-status.md to .gitignore";
1325
1513
  }
1326
1514
  function safePath(path, base) {
1327
- const root = resolve3(base);
1328
- const rel = relative2(root, resolve3(path));
1329
- if (rel.startsWith("..") || isAbsolute2(rel))
1515
+ const root = resolve4(base);
1516
+ const rel = relative2(root, resolve4(path));
1517
+ if (rel.startsWith("..") || isAbsolute3(rel))
1330
1518
  throw new Error(`path escapes ${root}: ${path}`);
1331
1519
  let current = root;
1332
1520
  for (const part of rel.split(sep === "\\" ? /[\\/]/ : "/").filter(Boolean)) {
1333
- current = join4(current, part);
1334
- const st = lstatSync2(current, { throwIfNoEntry: false });
1521
+ current = join5(current, part);
1522
+ const st = lstatSync3(current, { throwIfNoEntry: false });
1335
1523
  if (st?.isSymbolicLink())
1336
1524
  throw new Error(`unsafe symlink: ${current}`);
1337
1525
  }
1338
1526
  }
1339
- function installFormulas(repo, srcDir) {
1340
- const destDir = join4(repo, ".beads", "formulas");
1341
- safePath(destDir, repo);
1342
- const copies = [];
1343
- for (const name of FORMULAS) {
1344
- const src = join4(srcDir, `${name}.formula.toml`);
1345
- const dest = join4(destDir, `${name}.formula.toml`);
1346
- safePath(src, srcDir);
1347
- safePath(dest, repo);
1348
- if (!lstatSync2(src, { throwIfNoEntry: false })?.isFile()) {
1349
- throw new Error(`required formula missing or unsafe: ${src}`);
1350
- }
1351
- const st = lstatSync2(dest, { throwIfNoEntry: false });
1352
- if (st && (!st.isFile() || !readFileSync3(src).equals(readFileSync3(dest)))) {
1353
- throw new Error(`refusing divergent formula destination: ${dest}`);
1354
- }
1355
- if (!st)
1356
- copies.push({ src, dest, name });
1357
- }
1358
- mkdirSync2(destDir, { recursive: true });
1359
- for (const { src, dest } of copies)
1360
- copyFileSync(src, dest);
1361
- return copies.map(({ name }) => `copied ${name}`);
1527
+ function installRefusal(failure) {
1528
+ const paths = failure.paths.join(", ");
1529
+ switch (failure.kind) {
1530
+ case "symlinked-directory":
1531
+ case "source-symlink":
1532
+ case "destination-symlink":
1533
+ return `unsafe symlink: ${paths}`;
1534
+ case "source-missing":
1535
+ return `required formula missing or unsafe: ${paths}`;
1536
+ case "source-unreadable":
1537
+ return `required formula missing or unsafe: ${paths} (${failure.code})`;
1538
+ case "destination-not-directory":
1539
+ return `formula destination is not a directory: ${paths}`;
1540
+ case "destination-unreadable":
1541
+ return `cannot read formula destination (${failure.code}): ${paths}`;
1542
+ case "destination-unwritable":
1543
+ return `cannot write formula destination (${failure.code}): ${paths}${failure.copied.length > 0 ? `; already copied: ${failure.copied.join(", ")}` : ""}`;
1544
+ case "no-workspace":
1545
+ case "destination-not-file":
1546
+ case "destinations-unsafe":
1547
+ case "divergent":
1548
+ return `refusing divergent formula destination: ${paths}`;
1549
+ }
1550
+ }
1551
+ function installFormulas2(repo, srcDir) {
1552
+ const result = installFormulas({ workspace: repo, cwd: process.cwd(), names: FORMULAS, sourceDir: srcDir, requireWorkspace: false, refusals: "first" });
1553
+ if (result.failure !== undefined)
1554
+ throw new Error(installRefusal(result.failure));
1555
+ return result.copied.map((name) => `copied ${name}`);
1362
1556
  }
1363
1557
  function storyFormulaNote(repo) {
1364
- if (lstatSync2(join4(repo, ".beads", "formulas", "beads-feature.formula.toml"), { throwIfNoEntry: false })?.isFile())
1558
+ if (lstatSync3(join5(repo, ".beads", "formulas", "beads-feature.formula.toml"), { throwIfNoEntry: false })?.isFile())
1365
1559
  return;
1366
1560
  return "beads-feature is not installed; run the beads plugin's beads_formulas tool to split user stories into features";
1367
1561
  }
1368
1562
  function installedExtensions(repo) {
1369
- const registry = join4(repo, ".specify", "extensions", ".registry");
1563
+ const registry = join5(repo, ".specify", "extensions", ".registry");
1370
1564
  safePath(registry, repo);
1371
1565
  if (!existsSync3(registry))
1372
1566
  return new Set;
1373
1567
  try {
1374
- const data = JSON.parse(readFileSync3(registry, "utf8"));
1568
+ const data = JSON.parse(readFileSync4(registry, "utf8"));
1375
1569
  const extensions = data !== null && typeof data === "object" && "extensions" in data ? data.extensions : undefined;
1376
1570
  if (extensions === null || typeof extensions !== "object" || Array.isArray(extensions))
1377
1571
  return new Set;
@@ -1381,11 +1575,11 @@ function installedExtensions(repo) {
1381
1575
  }
1382
1576
  }
1383
1577
  function communityCatalogState(repo) {
1384
- const config = join4(repo, ".specify", "extension-catalogs.yml");
1578
+ const config = join5(repo, ".specify", "extension-catalogs.yml");
1385
1579
  safePath(config, repo);
1386
1580
  if (!existsSync3(config))
1387
1581
  return "absent";
1388
- const parsed = Bun.YAML.parse(readFileSync3(config, "utf8"));
1582
+ const parsed = Bun.YAML.parse(readFileSync4(config, "utf8"));
1389
1583
  const catalogs = parsed !== null && typeof parsed === "object" && "catalogs" in parsed && Array.isArray(parsed.catalogs) ? parsed.catalogs : [];
1390
1584
  let conflict = false;
1391
1585
  for (const entry of catalogs) {
@@ -1406,7 +1600,7 @@ function output(result) {
1406
1600
  `) || `exit ${result.exitCode}`;
1407
1601
  }
1408
1602
  async function runSetup(params, cwd, signal) {
1409
- const repo = resolve3(cwd, params.workspace ?? ".");
1603
+ const repo = resolve4(cwd, params.workspace ?? ".");
1410
1604
  const phases = [];
1411
1605
  const record = (phase, status, detail) => phases.push({ phase, status, detail });
1412
1606
  const finish = () => ({
@@ -1424,9 +1618,9 @@ async function runSetup(params, cwd, signal) {
1424
1618
  return finish();
1425
1619
  };
1426
1620
  try {
1427
- safePath(join4(repo, ".specify"), repo);
1428
- safePath(join4(repo, ".beads"), repo);
1429
- safePath(join4(repo, ".gitignore"), repo);
1621
+ safePath(join5(repo, ".specify"), repo);
1622
+ safePath(join5(repo, ".beads"), repo);
1623
+ safePath(join5(repo, ".gitignore"), repo);
1430
1624
  if (params.skipSpecify)
1431
1625
  record("specify", "skipped", "skipSpecify: specify CLI steps omitted");
1432
1626
  else {
@@ -1441,7 +1635,7 @@ ${ver.stderr}`))
1441
1635
  return fail(`specify-cli >= 0.12.0 required. Got: ${ver.stdout || ver.stderr}`);
1442
1636
  record(current, "done", ver.stdout.trim());
1443
1637
  current = "specify init";
1444
- if (existsSync3(join4(repo, ".specify")) && !params.force)
1638
+ if (existsSync3(join5(repo, ".specify")) && !params.force)
1445
1639
  record(current, "skipped", ".specify already present (pass force=true to re-scaffold)");
1446
1640
  else {
1447
1641
  const init = await run([
@@ -1511,7 +1705,7 @@ ${ver.stderr}`))
1511
1705
  record(current, "done", "bd init --skip-hooks");
1512
1706
  }
1513
1707
  current = "formulas";
1514
- const copied = installFormulas(repo, join4(pluginRoot(), "formulas"));
1708
+ const copied = installFormulas2(repo, join5(pluginRoot(), "formulas"));
1515
1709
  const story = storyFormulaNote(repo);
1516
1710
  const formulas = copied.length ? copied.join(", ") : "every formula already present";
1517
1711
  record(current, copied.length ? "done" : "skipped", story ? `${formulas}; ${story}` : formulas);
@@ -1542,9 +1736,9 @@ function defineMode(spec) {
1542
1736
 
1543
1737
  // plugins/speckit-beads/opencode/src/workflow.ts
1544
1738
  import { existsSync as existsSync4 } from "fs";
1545
- import { isAbsolute as isAbsolute3, join as join5, relative as relative3, sep as sep2 } from "path";
1739
+ import { isAbsolute as isAbsolute4, join as join6, relative as relative3, sep as sep2 } from "path";
1546
1740
  function usesSpeckit(directory) {
1547
- return existsSync4(join5(directory, ".specify"));
1741
+ return existsSync4(join6(directory, ".specify"));
1548
1742
  }
1549
1743
  function speckitWorkspace(directory, projectRoot, detect = usesSpeckit) {
1550
1744
  if (detect(directory))
@@ -1552,7 +1746,7 @@ function speckitWorkspace(directory, projectRoot, detect = usesSpeckit) {
1552
1746
  if (projectRoot === undefined || projectRoot === directory)
1553
1747
  return;
1554
1748
  const path = relative3(projectRoot, directory);
1555
- const inside = path !== "" && path !== ".." && !path.startsWith(`..${sep2}`) && !isAbsolute3(path);
1749
+ const inside = path !== "" && path !== ".." && !path.startsWith(`..${sep2}`) && !isAbsolute4(path);
1556
1750
  return inside && detect(projectRoot) ? projectRoot : undefined;
1557
1751
  }
1558
1752
 
@@ -1692,7 +1886,7 @@ ${refusal}
1692
1886
  }
1693
1887
 
1694
1888
  // plugins/speckit-beads/opencode/src/tasks-guard.ts
1695
- import { dirname as dirname4, isAbsolute as isAbsolute4, resolve as resolve4 } from "path";
1889
+ import { dirname as dirname4, isAbsolute as isAbsolute5, resolve as resolve5 } from "path";
1696
1890
 
1697
1891
  // lib/src/tool-targets.ts
1698
1892
  var WRITE_TOOLS = new Set(["edit", "write", "patch"]);
@@ -1859,7 +2053,7 @@ function repoOf(path) {
1859
2053
  }
1860
2054
  function tasksTargets(tool, input, directory) {
1861
2055
  if (WRITE_TOOLS.has(tool)) {
1862
- const hits = writeTargets(tool, input).filter(isTasksMd).map((path) => isAbsolute4(path) ? path : resolve4(directory, path));
2056
+ const hits = writeTargets(tool, input).filter(isTasksMd).map((path) => isAbsolute5(path) ? path : resolve5(directory, path));
1863
2057
  return hits.length > 0 ? [...new Set(hits.map(repoOf))] : undefined;
1864
2058
  }
1865
2059
  if (!isShellTool(tool))
@@ -1884,7 +2078,7 @@ async function decideToolCall(tool, input, directory, probe, reason = DENY_REASO
1884
2078
  }
1885
2079
 
1886
2080
  // plugins/speckit-beads/opencode/src/tools.ts
1887
- import { isAbsolute as isAbsolute8, resolve as resolve8 } from "path";
2081
+ import { isAbsolute as isAbsolute9, resolve as resolve9 } from "path";
1888
2082
 
1889
2083
  // plugins/speckit-beads/opencode/src/spec-start.ts
1890
2084
  var APPROVAL_QUESTION = "Require routine human approval checkpoints for this spec/run? Yes or no.";
@@ -2235,7 +2429,7 @@ async function startSpec(input, command) {
2235
2429
  import { spawn } from "child_process";
2236
2430
  import { randomUUID } from "crypto";
2237
2431
  import { realpathSync as realpathSync4 } from "fs";
2238
- import { join as join8 } from "path";
2432
+ import { join as join9 } from "path";
2239
2433
 
2240
2434
  // lib/src/bd-embedded-write-lock.ts
2241
2435
  import { spawnSync as spawnSync2 } from "child_process";
@@ -2243,13 +2437,13 @@ import {
2243
2437
  closeSync as closeSync3,
2244
2438
  existsSync as existsSync5,
2245
2439
  openSync as openSync3,
2246
- readFileSync as readFileSync4,
2247
- statSync as statSync4,
2440
+ readFileSync as readFileSync5,
2441
+ statSync as statSync5,
2248
2442
  unlinkSync,
2249
2443
  writeSync
2250
2444
  } from "fs";
2251
2445
  import { hostname } from "os";
2252
- import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute7, join as join7, resolve as resolve7 } from "path";
2446
+ import { basename as basename4, dirname as dirname6, isAbsolute as isAbsolute8, join as join8, resolve as resolve8 } from "path";
2253
2447
 
2254
2448
  // lib/src/backoff.ts
2255
2449
  var POLL_MS = 20;
@@ -2261,6 +2455,9 @@ function backoffDelayMs(attempt, random = Math.random) {
2261
2455
 
2262
2456
  // lib/src/shell-command.ts
2263
2457
  var INTERPRETERS = new Set(["bash", "sh", "zsh", "dash", "ksh"]);
2458
+ // lib/src/beads-host.ts
2459
+ var GLOBAL_VALUE_FLAGS = new Set(["--actor", "--database", "--db", "-C", "--directory", "--dolt-auto-commit", "--mem-profile"]);
2460
+ var LEDGER_FLAGS = new Set(["--database", "--db", "-C", "--directory"]);
2264
2461
  // lib/src/bd-actor-gate.ts
2265
2462
  var VALUE_FLAGS = new Set([
2266
2463
  "--actor",
@@ -2303,18 +2500,18 @@ function flagEnabled(tokens, names) {
2303
2500
  var TRUTHY = { "": true, "1": true, t: true, T: true, TRUE: true, true: true, True: true };
2304
2501
 
2305
2502
  // lib/src/beads-ledger.ts
2306
- import { realpathSync as realpathSync2, statSync as statSync2 } from "fs";
2307
- import { isAbsolute as isAbsolute5, join as join6, resolve as resolve5 } from "path";
2503
+ import { realpathSync as realpathSync2, statSync as statSync3 } from "fs";
2504
+ import { isAbsolute as isAbsolute6, join as join7, resolve as resolve6 } from "path";
2308
2505
 
2309
2506
  // lib/src/bounded-read.ts
2310
- import { closeSync as closeSync2, constants as constants2, fstatSync as fstatSync2, lstatSync as lstatSync3, openSync as openSync2, readSync } from "fs";
2507
+ import { closeSync as closeSync2, constants as constants3, fstatSync as fstatSync2, lstatSync as lstatSync4, openSync as openSync2, readSync } from "fs";
2311
2508
  var MAX_LEDGER_FILE_BYTES = 64 * 1024;
2312
2509
  function readBoundedBytes(path, maxBytes) {
2313
2510
  let fd;
2314
2511
  try {
2315
- if (!lstatSync3(path).isFile())
2512
+ if (!lstatSync4(path).isFile())
2316
2513
  return { kind: "unreadable", reason: "not-regular" };
2317
- fd = openSync2(path, constants2.O_RDONLY | constants2.O_NOFOLLOW | constants2.O_NONBLOCK);
2514
+ fd = openSync2(path, constants3.O_RDONLY | constants3.O_NOFOLLOW | constants3.O_NONBLOCK);
2318
2515
  const info = fstatSync2(fd);
2319
2516
  if (!info.isFile())
2320
2517
  return { kind: "unreadable", reason: "not-regular" };
@@ -2349,7 +2546,7 @@ function readBounded(path, maxBytes = MAX_LEDGER_FILE_BYTES) {
2349
2546
  // lib/src/beads-ledger.ts
2350
2547
  function isDirectory2(path) {
2351
2548
  try {
2352
- return statSync2(path).isDirectory();
2549
+ return statSync3(path).isDirectory();
2353
2550
  } catch {
2354
2551
  return false;
2355
2552
  }
@@ -2358,14 +2555,14 @@ function canonicalPath(path) {
2358
2555
  try {
2359
2556
  return realpathSync2(path);
2360
2557
  } catch {
2361
- return resolve5(path);
2558
+ return resolve6(path);
2362
2559
  }
2363
2560
  }
2364
2561
 
2365
2562
  // lib/src/beads-store.ts
2366
2563
  import { spawnSync } from "child_process";
2367
- import { lstatSync as lstatSync4, realpathSync as realpathSync3, statSync as statSync3 } from "fs";
2368
- import { basename as basename3, dirname as dirname5, isAbsolute as isAbsolute6, resolve as resolve6 } from "path";
2564
+ import { lstatSync as lstatSync5, realpathSync as realpathSync3, statSync as statSync4 } from "fs";
2565
+ import { basename as basename3, dirname as dirname5, isAbsolute as isAbsolute7, resolve as resolve7 } from "path";
2369
2566
  function repoIdentity(cwd) {
2370
2567
  if (cwd.includes("\x00"))
2371
2568
  return;
@@ -2384,7 +2581,7 @@ function repoIdentity(cwd) {
2384
2581
  }
2385
2582
  const out = String(result.stdout ?? "").trim();
2386
2583
  try {
2387
- return realpathSync3(isAbsolute6(out) ? out : resolve6(cwd, out));
2584
+ return realpathSync3(isAbsolute7(out) ? out : resolve7(cwd, out));
2388
2585
  } catch {
2389
2586
  return;
2390
2587
  }
@@ -2398,7 +2595,7 @@ function repositoryState(cwd) {
2398
2595
  }
2399
2596
  for (;; ) {
2400
2597
  try {
2401
- lstatSync4(resolve6(current, ".git"));
2598
+ lstatSync5(resolve7(current, ".git"));
2402
2599
  return "present";
2403
2600
  } catch (error) {
2404
2601
  if (!(error instanceof Error) || !("code" in error) || error.code !== "ENOENT")
@@ -2411,19 +2608,19 @@ function repositoryState(cwd) {
2411
2608
  }
2412
2609
  }
2413
2610
  function sessionPinCandidates(cwd) {
2414
- const local = resolve6(cwd, ".beads");
2611
+ const local = resolve7(cwd, ".beads");
2415
2612
  const common = repoIdentity(cwd);
2416
2613
  if (common === undefined)
2417
2614
  return [];
2418
2615
  if (common !== cwd && common.endsWith("/.git")) {
2419
- const primaryRoot = resolve6(common, "..");
2616
+ const primaryRoot = resolve7(common, "..");
2420
2617
  try {
2421
2618
  if (realpathSync3(cwd) === primaryRoot)
2422
2619
  return [local];
2423
2620
  } catch {
2424
2621
  return [];
2425
2622
  }
2426
- return [resolve6(primaryRoot, ".beads"), local];
2623
+ return [resolve7(primaryRoot, ".beads"), local];
2427
2624
  }
2428
2625
  return [local];
2429
2626
  }
@@ -2434,13 +2631,13 @@ function sessionPinFor(cwd) {
2434
2631
  return existingStore(sessionPinCandidates(cwd));
2435
2632
  }
2436
2633
  function storeFromBeadsDb(value, cwd) {
2437
- const path = resolve6(cwd, value);
2634
+ const path = resolve7(cwd, value);
2438
2635
  return basename3(path) === ".beads" ? path : dirname5(path);
2439
2636
  }
2440
2637
  function ambientStore(cwd, env, walkUp = sessionPinFor) {
2441
2638
  const dir = env.BEADS_DIR;
2442
2639
  if (dir !== undefined && dir !== "")
2443
- return resolve6(cwd, dir);
2640
+ return resolve7(cwd, dir);
2444
2641
  const found = walkUp(cwd);
2445
2642
  if (found !== undefined)
2446
2643
  return found;
@@ -2481,7 +2678,7 @@ function processStartIdentity(pid) {
2481
2678
  return identityForTests(pid);
2482
2679
  try {
2483
2680
  if (process.platform === "linux") {
2484
- const stat = readFileSync4(`/proc/${pid}/stat`, "utf8");
2681
+ const stat = readFileSync5(`/proc/${pid}/stat`, "utf8");
2485
2682
  const identity = parseLinuxStatStartIdentity(stat);
2486
2683
  if (identity !== undefined)
2487
2684
  return identity;
@@ -2539,25 +2736,25 @@ function selectedStoreFor(globals, cwd, env) {
2539
2736
  const target = absolute(db, base);
2540
2737
  if (!existsSync5(target))
2541
2738
  return;
2542
- return isDirectory2(target) ? target : join7(target, "..");
2739
+ return isDirectory2(target) ? target : join8(target, "..");
2543
2740
  }
2544
2741
  if (directory !== undefined)
2545
2742
  return sessionPinFor(base);
2546
2743
  return ambientStore(cwd, env);
2547
2744
  }
2548
2745
  function absolute(path, cwd) {
2549
- return isAbsolute7(path) ? path : resolve7(cwd, path);
2746
+ return isAbsolute8(path) ? path : resolve8(cwd, path);
2550
2747
  }
2551
2748
  function canonicalStore(store) {
2552
2749
  return store === undefined ? undefined : canonicalPath(store);
2553
2750
  }
2554
2751
  function embedded(store) {
2555
2752
  for (const file of ["metadata.json", "config.yaml"]) {
2556
- const read = readBounded(join7(store, file));
2753
+ const read = readBounded(join8(store, file));
2557
2754
  if (read.kind === "unreadable" || read.kind === "text" && read.text !== "")
2558
2755
  return true;
2559
2756
  }
2560
- return isDirectory2(join7(store, "embeddeddolt"));
2757
+ return isDirectory2(join8(store, "embeddeddolt"));
2561
2758
  }
2562
2759
  function embeddedStoreFor(cwd, env = process.env) {
2563
2760
  const store = storeFor([], cwd, env);
@@ -2607,7 +2804,7 @@ var MIGRATE_SKIPS_STORE_INIT = new Set([
2607
2804
  var LIST_PREFIXES = new Set(["then", "else", "do"]);
2608
2805
  function ageOf(path) {
2609
2806
  try {
2610
- return Date.now() - statSync4(path).mtimeMs;
2807
+ return Date.now() - statSync5(path).mtimeMs;
2611
2808
  } catch {
2612
2809
  return 0;
2613
2810
  }
@@ -2726,7 +2923,7 @@ function wakeHead(lock) {
2726
2923
  registry().queues.get(lock)?.[0]?.wake?.();
2727
2924
  }
2728
2925
  async function hold(store, owner, waitMs = WAIT_MS, signal) {
2729
- const lock = join7(store, LOCK_NAME);
2926
+ const lock = join8(store, LOCK_NAME);
2730
2927
  const { owned, queues } = registry();
2731
2928
  const deadline = Date.now() + waitMs;
2732
2929
  let attempt = 0;
@@ -2772,7 +2969,7 @@ async function hold(store, owner, waitMs = WAIT_MS, signal) {
2772
2969
  reason: `Beads embedded write lock could not be taken at ${lock} (${code ?? "unknown error"}). The write was refused rather than risk a second writer on the embedded Dolt journal.`
2773
2970
  };
2774
2971
  }
2775
- const steal = join7(store, STEAL_NAME);
2972
+ const steal = join8(store, STEAL_NAME);
2776
2973
  const unsafe = unsafeRecord(lock) ? lock : unsafeRecord(steal) ? steal : undefined;
2777
2974
  if (unsafe !== undefined) {
2778
2975
  return {
@@ -2817,7 +3014,7 @@ async function hold(store, owner, waitMs = WAIT_MS, signal) {
2817
3014
  }
2818
3015
  }
2819
3016
  function withOwnership(storeLock, token, change) {
2820
- const steal = join7(dirname6(storeLock), STEAL_NAME);
3017
+ const steal = join8(dirname6(storeLock), STEAL_NAME);
2821
3018
  let fd;
2822
3019
  try {
2823
3020
  fd = openSync3(steal, "wx");
@@ -2839,7 +3036,7 @@ function withOwnership(storeLock, token, change) {
2839
3036
  }
2840
3037
  }
2841
3038
  function release(store, owner) {
2842
- const lock = join7(store, LOCK_NAME);
3039
+ const lock = join8(store, LOCK_NAME);
2843
3040
  const owned = registry().owned;
2844
3041
  const held = owned.get(lock);
2845
3042
  if (held === undefined)
@@ -2933,7 +3130,7 @@ async function runSpecStart(options, signal, commandMs = COMMAND_MS, module = BE
2933
3130
  const cwd = realpathSync4(options.workspace);
2934
3131
  const env = {
2935
3132
  ...process.env,
2936
- BEADS_DIR: realpathSync4(join8(cwd, ".beads")),
3133
+ BEADS_DIR: realpathSync4(join9(cwd, ".beads")),
2937
3134
  GIT_TERMINAL_PROMPT: "0",
2938
3135
  SSH_ASKPASS: "/usr/bin/false",
2939
3136
  SSH_ASKPASS_REQUIRE: "force",
@@ -3102,14 +3299,14 @@ var START_INPUT = {
3102
3299
  };
3103
3300
  var START_DESCRIPTION = `Start or resume a spec workflow, with an explicit routine approval choice from the user before pouring.
3104
3301
  ` + "Persists and reads back the answer, reuses it on resume, and requires separate consent to migrate an existing gated run. Nests a new run under the spec's feature epic and titles it <spec> (<profile>); moving an existing unparented run needs the user's yes to REPARENT_REQUIRED. Refuses an epic that blocks on a step of the run, and warns when the epic's open blocks edges would hide the run from bd ready. Holds the Beads store's write lock for the whole start. Returns CHOICE_REQUIRED, MIGRATION_REQUIRED or REPARENT_REQUIRED with a question to ask the user, READY when the run can advance, or INCOMPLETE (store-lock wait ran out, a bd command passed its bound, or cancellation) with the step reached and whether a pour was issued; inspect the run before retrying. Reviews, tests and safety confirmations remain required.";
3105
- var within = (base, path) => path === undefined ? base : isAbsolute8(path) ? path : resolve8(base, path);
3302
+ var within = (base, path) => path === undefined ? base : isAbsolute9(path) ? path : resolve9(base, path);
3106
3303
  var record = (input) => input !== null && typeof input === "object" && !Array.isArray(input) ? input : {};
3107
3304
  function toolDirectory(input, session, speckitWorkspace) {
3108
3305
  return record(input).workspace === undefined ? speckitWorkspace(session) ?? session : session;
3109
3306
  }
3110
3307
  function setupTarget(input, directory) {
3111
3308
  const workspace = record(input).workspace;
3112
- return typeof workspace === "string" && workspace !== "" ? resolve8(directory, workspace) : directory;
3309
+ return typeof workspace === "string" && workspace !== "" ? resolve9(directory, workspace) : directory;
3113
3310
  }
3114
3311
  var SETUP_KEYS = new Set(Object.keys(setupInput("").properties));
3115
3312
  function readSetupParams(input) {
@@ -3212,7 +3409,7 @@ async function executeStart(input, directory, signal, lock = BEADS_LOCK) {
3212
3409
 
3213
3410
  // plugins/speckit-beads/pi-src/ready-watch.ts
3214
3411
  import { execFile } from "child_process";
3215
- import { resolve as resolve9 } from "path";
3412
+ import { resolve as resolve10 } from "path";
3216
3413
  import { promisify } from "util";
3217
3414
 
3218
3415
  // lib/src/beads-pin.ts
@@ -3294,7 +3491,7 @@ async function watchLedger(cwd, env = process.env) {
3294
3491
  const store = pinnedEnvironment(cwd, env).BEADS_DIR;
3295
3492
  if (store === undefined || store === "")
3296
3493
  throw new Error("No Beads ledger resolves for this checkout");
3297
- return resolve9(cwd, store);
3494
+ return resolve10(cwd, store);
3298
3495
  }
3299
3496
  function watchEnv(ledger, base = process.env) {
3300
3497
  const env = {
@@ -3399,7 +3596,7 @@ function createReadyWatch(scope, options) {
3399
3596
 
3400
3597
  // plugins/speckit-beads/pi-src/routes.ts
3401
3598
  import { homedir as homedir2 } from "os";
3402
- import { isAbsolute as isAbsolute9, resolve as resolve10 } from "path";
3599
+ import { isAbsolute as isAbsolute10, resolve as resolve11 } from "path";
3403
3600
  var WORKFLOW_SECTION = "speckit_workflow";
3404
3601
  var MESSAGE_TYPE = "speckit-beads";
3405
3602
  function guardReason(settingsPath) {
@@ -3431,7 +3628,7 @@ User input: ${command.args}` };
3431
3628
  function toolPath(path, cwd) {
3432
3629
  const plain = path.startsWith("@") ? path.slice(1) : path;
3433
3630
  const expanded = plain === "~" ? homedir2() : plain.startsWith("~/") ? `${homedir2()}${plain.slice(1)}` : plain;
3434
- return isAbsolute9(expanded) ? expanded : resolve10(cwd, expanded);
3631
+ return isAbsolute10(expanded) ? expanded : resolve11(cwd, expanded);
3435
3632
  }
3436
3633
  function readCommand(path) {
3437
3634
  const normal = path.replaceAll("\\", "/");
@@ -3467,7 +3664,7 @@ function notify(ctx, message) {
3467
3664
  `);
3468
3665
  }
3469
3666
  function setupSpeckitPi(pi, deps = {}) {
3470
- const settingsPath = deps.settingsPath ?? join9(getAgentDir(), PI_SETTINGS_FILE);
3667
+ const settingsPath = deps.settingsPath ?? join10(getAgentDir(), PI_SETTINGS_FILE);
3471
3668
  const loaded = loadPiPluginSettings(settingsPath, "speckit-beads", "the defaults apply");
3472
3669
  const options = parseOptions(loaded.options, PI_INTEGRATION);
3473
3670
  const probe = deps.probe ?? ((directory) => beadsActive(directory));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srobroek/pi-speckit-beads",
3
- "version": "3.2.1",
3
+ "version": "3.2.3",
4
4
  "description": "SpecKit on Beads: a tasks.md guard, setup, ledger and bugfix skills, formulas, and the speckit-sync and speckit-verify subagents.",
5
5
  "keywords": [
6
6
  "pi-package"