@srobroek/pi-speckit-beads 3.2.4 → 3.2.6

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,15 @@
1
+ ## speckit-beads [3.2.6](https://github.com/srobroek/harness-plugins/compare/speckit-beads--v3.2.5...speckit-beads--v3.2.6) (2026-12-05)
2
+
3
+ ### Bug Fixes
4
+
5
+ * review follow-ups from the sweep PRs (speckit-beads, ratchet, code-challenge, docs, tests) ([#385](https://github.com/srobroek/harness-plugins/issues/385)) ([4fa9eb6](https://github.com/srobroek/harness-plugins/commit/4fa9eb6570bccea9d0dfae1a7b4af4922b5876b5))
6
+
7
+ ## speckit-beads [3.2.5](https://github.com/srobroek/harness-plugins/compare/speckit-beads--v3.2.4...speckit-beads--v3.2.5) (2026-12-05)
8
+
9
+ ### Bug Fixes
10
+
11
+ * **speckit-beads, design:** code-challenge sweep group 4 ([#364](https://github.com/srobroek/harness-plugins/issues/364)) ([0442d95](https://github.com/srobroek/harness-plugins/commit/0442d952dd4f74c8ea5190ff22c5bcacc89b62ff))
12
+
1
13
  ## speckit-beads [3.2.4](https://github.com/srobroek/harness-plugins/compare/speckit-beads--v3.2.3...speckit-beads--v3.2.4) (2026-12-05)
2
14
 
3
15
  ### Bug Fixes
@@ -913,6 +913,16 @@ function outsideArtifacts(paths, prefix, requested) {
913
913
  return requested !== undefined && !requested.some((root) => local === root || local.startsWith(`${root}/`));
914
914
  });
915
915
  }
916
+ var OPERATION_MARKERS = [
917
+ ["MERGE_HEAD", "merge"],
918
+ ["CHERRY_PICK_HEAD", "cherry-pick"],
919
+ ["REVERT_HEAD", "revert"],
920
+ ["rebase-merge", "rebase"],
921
+ ["rebase-apply", "rebase"]
922
+ ];
923
+ function operationInProgress(exists) {
924
+ return OPERATION_MARKERS.find(([marker]) => exists(marker))?.[1];
925
+ }
916
926
  var GIT_SELECTORS = new Set([
917
927
  "GIT_DIR",
918
928
  "GIT_WORK_TREE",
@@ -1079,6 +1089,26 @@ async function executeCommit(input, workspace, makeGit = (hooks) => gitIn(worksp
1079
1089
  rmSync(scratch, { recursive: true, force: true });
1080
1090
  }
1081
1091
  }
1092
+ async function unfinishedWork(git, workspace) {
1093
+ const where = await git(["rev-parse", ...OPERATION_MARKERS.flatMap(([marker]) => ["--git-path", marker])]);
1094
+ if (!where.ok)
1095
+ return where.reason;
1096
+ const found = where.stdout.split(`
1097
+ `).filter(Boolean);
1098
+ const operation = operationInProgress((marker) => {
1099
+ const at = OPERATION_MARKERS.findIndex(([name]) => name === marker);
1100
+ const path = found[at];
1101
+ return path !== undefined && existsSync2(resolve2(workspace, path));
1102
+ });
1103
+ if (operation !== undefined)
1104
+ return `refused: a ${operation} is in progress. Finish or abort it before committing the artifacts.`;
1105
+ const unmerged = await git(["ls-files", "-u", "-z", "--no-recurse-submodules"]);
1106
+ if (!unmerged.ok)
1107
+ return unmerged.reason;
1108
+ if (unmerged.stdout !== "")
1109
+ return `refused: the index has unmerged paths: ${[...new Set(names(unmerged.stdout).map((record) => record.slice(record.indexOf("\t") + 1)))].join(", ")}. Resolve them first.`;
1110
+ return;
1111
+ }
1082
1112
  async function commitIn(request, workspace, git, index) {
1083
1113
  const located = await git(["rev-parse", "--show-toplevel", "--show-prefix"]);
1084
1114
  if (!located.ok)
@@ -1087,6 +1117,9 @@ async function commitIn(request, workspace, git, index) {
1087
1117
  `);
1088
1118
  if (resolve2(toplevel, base) !== realpathOrSelf(workspace))
1089
1119
  return refuse(`refused: git resolved the workspace to ${resolve2(toplevel, base)}, not ${workspace}`);
1120
+ const unfinished = await unfinishedWork(git, workspace);
1121
+ if (unfinished !== undefined)
1122
+ return refuse(unfinished);
1090
1123
  const parent = await git(["rev-parse", "-q", "--verify", "HEAD^{commit}"]);
1091
1124
  const head = parent.ok ? parent.stdout.trim() : undefined;
1092
1125
  const paths = request.paths ?? [];
@@ -1197,6 +1230,9 @@ async function commitIn(request, workspace, git, index) {
1197
1230
  if (!created.ok)
1198
1231
  return refuse(created.reason);
1199
1232
  const commit = created.stdout.trim();
1233
+ const unfinishedNow = await unfinishedWork(git, workspace);
1234
+ if (unfinishedNow !== undefined)
1235
+ return refuse(unfinishedNow);
1200
1236
  const moved = await git(["update-ref", "-m", `speckit_commit: ${message.split(`
1201
1237
  `, 1)[0]}`, "HEAD", commit, head ?? ""]);
1202
1238
  if (!moved.ok)
@@ -1486,11 +1522,12 @@ function parseSpecifyMajorMinor(versionOut) {
1486
1522
  return null;
1487
1523
  return { major: Number(m[1]), minor: Number(m[2]) };
1488
1524
  }
1525
+ var SPECIFY_MINIMUM = { major: 1, minor: 4 };
1489
1526
  function specifyVersionOk(versionOut) {
1490
1527
  const v = parseSpecifyMajorMinor(versionOut);
1491
1528
  if (!v)
1492
1529
  return false;
1493
- return v.major > 0 || v.major === 0 && v.minor >= 12;
1530
+ return v.major > SPECIFY_MINIMUM.major || v.major === SPECIFY_MINIMUM.major && v.minor >= SPECIFY_MINIMUM.minor;
1494
1531
  }
1495
1532
  function ensureGitignore(repo) {
1496
1533
  safePath(join5(repo, ".gitignore"), repo);
@@ -1632,7 +1669,7 @@ async function runSetup(params, cwd, signal) {
1632
1669
  const ver = await run(["specify", "--version"], repo, deadline, signal);
1633
1670
  if (ver.exitCode !== 0 || !specifyVersionOk(`${ver.stdout}
1634
1671
  ${ver.stderr}`))
1635
- return fail(`specify-cli >= 0.12.0 required. Got: ${ver.stdout || ver.stderr}`);
1672
+ return fail(`specify-cli >= ${SPECIFY_MINIMUM.major}.${SPECIFY_MINIMUM.minor}.0 required. Got: ${ver.stdout || ver.stderr}`);
1636
1673
  record(current, "done", ver.stdout.trim());
1637
1674
  current = "specify init";
1638
1675
  if (existsSync3(join5(repo, ".specify")) && !params.force)
@@ -2253,8 +2290,15 @@ async function migrateRoutine(root, options, command) {
2253
2290
  if (resolutions.some((row) => after.find((issue) => issue.id === row.gate)?.status !== "closed" || after.find((issue) => issue.id === row.step)?.status !== "closed"))
2254
2291
  throw new Error("Routine migration readback failed; do not record approvals as declined");
2255
2292
  }
2256
- async function specEpic(spec, named, rows, command) {
2257
- const id = named ?? (() => {
2293
+ async function recordedEpic(root, command) {
2294
+ if (root?.parent === undefined)
2295
+ return;
2296
+ const parent = issueList(await command(["show", root.parent]))[0];
2297
+ return parent?.issue_type === "epic" && !isRunRoot(parent) && parent.status !== "closed" ? parent : undefined;
2298
+ }
2299
+ async function specEpic(spec, named, rows, root, command) {
2300
+ const recorded = named === undefined ? await recordedEpic(root, command) : undefined;
2301
+ const id = named ?? recorded?.id ?? (() => {
2258
2302
  const open = rows.filter((row) => row.issue_type === "epic" && !isRunRoot(row) && row.status !== "closed");
2259
2303
  if (open.length > 1)
2260
2304
  throw new Error(`Several open epics carry spec_id ${spec} (${open.map((row) => row.id).join(", ")}); pass epic to choose one`);
@@ -2262,7 +2306,7 @@ async function specEpic(spec, named, rows, command) {
2262
2306
  })();
2263
2307
  if (id === undefined)
2264
2308
  return;
2265
- const epic = issueList(await command(["show", id]))[0];
2309
+ const epic = recorded ?? issueList(await command(["show", id]))[0];
2266
2310
  if (epic?.issue_type !== "epic" || isRunRoot(epic))
2267
2311
  throw new Error(`${id} is not a feature epic`);
2268
2312
  if (epic.status === "closed")
@@ -2368,7 +2412,7 @@ async function startSpec(input, command) {
2368
2412
  const question = `Explicitly migrate existing run ${root.id} to omit routine approvals, resolving only its routine formula approval gates while preserving history? Yes or no.`;
2369
2413
  return { status: "MIGRATION_REQUIRED", root: root.id, question, text: question };
2370
2414
  }
2371
- const epic = await specEpic(options.spec, options.epic, rows, command);
2415
+ const epic = await specEpic(options.spec, options.epic, rows, root, command);
2372
2416
  const warnings = [epic && blockedEpicWarning(epic)].filter((warning) => !!warning);
2373
2417
  const placed = root && epic ? await placeExisting(root, epic, { ...options, profile }, command) : undefined;
2374
2418
  if (placed?.kind === "ask")
@@ -3136,6 +3180,14 @@ function createdRootOf(created, formula) {
3136
3180
  const id = mapping[formula];
3137
3181
  return typeof id === "string" ? id : undefined;
3138
3182
  }
3183
+ function captureUtf8(stream) {
3184
+ let text = "";
3185
+ stream.setEncoding("utf8");
3186
+ stream.on("data", (chunk) => {
3187
+ text += chunk;
3188
+ });
3189
+ return () => text;
3190
+ }
3139
3191
  async function runSpecStart(options, signal, commandMs = COMMAND_MS, module = BEADS_LOCK, timers = globalThis) {
3140
3192
  const started = Date.now();
3141
3193
  const cwd = realpathSync4(options.workspace);
@@ -3197,14 +3249,8 @@ async function runSpecStart(options, signal, commandMs = COMMAND_MS, module = BE
3197
3249
  timers.clearTimeout(grace);
3198
3250
  signal?.removeEventListener("abort", cancel);
3199
3251
  };
3200
- let stdout = "";
3201
- let stderr = "";
3202
- child.stdout.on("data", (bytes) => {
3203
- stdout += bytes.toString();
3204
- });
3205
- child.stderr.on("data", (bytes) => {
3206
- stderr += bytes.toString();
3207
- });
3252
+ const stdout = captureUtf8(child.stdout);
3253
+ const stderr = captureUtf8(child.stderr);
3208
3254
  child.on("error", (error) => {
3209
3255
  settle();
3210
3256
  reject(error);
@@ -3216,7 +3262,7 @@ async function runSpecStart(options, signal, commandMs = COMMAND_MS, module = BE
3216
3262
  return;
3217
3263
  }
3218
3264
  if (code !== 0) {
3219
- reject(new Error(stderr.trim() || `Beads command exited ${code}; inspect the run before retrying`));
3265
+ reject(new Error(stderr().trim() || `Beads command exited ${code}; inspect the run before retrying`));
3220
3266
  return;
3221
3267
  }
3222
3268
  completedSteps.push(step);
@@ -3226,7 +3272,7 @@ async function runSpecStart(options, signal, commandMs = COMMAND_MS, module = BE
3226
3272
  }
3227
3273
  let value;
3228
3274
  try {
3229
- value = JSON.parse(stdout);
3275
+ value = JSON.parse(stdout());
3230
3276
  } catch {
3231
3277
  reject(new Error("Beads returned invalid JSON; inspect the run before retrying"));
3232
3278
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srobroek/pi-speckit-beads",
3
- "version": "3.2.4",
3
+ "version": "3.2.6",
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"