benignswarm 0.12.76 → 0.12.77

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/dist/args.js CHANGED
@@ -2,8 +2,8 @@ import { parseArgs } from "node:util";
2
2
  import { CliError } from "./errors.js";
3
3
  // These options accept comma-separated collections, so repeating them should
4
4
  // append another collection instead of discarding earlier values.
5
- export const LIST_FLAGS = ["tags", "projects", "evidence", "statuses", "depends-on", "units", "waits-on", "needs", "exclude", "remove", "post", "harness", "variant", "requires"];
6
- export const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "description", "permissions", "cardinality", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "unacked-after", "category", "command", "follow-delay", "env", "scope", "pr", "note", "add", "remove", "merged", "tag", "activity", "max-unanswered", "to", "replay-of", "branch", "effort", "by", "target", "milestone", "file", "exit", "depends-on", "source", "by", "on", "question", "ruling", "gaps", "unit", "units", "blocks", "sla", "takeover", "max-open", "max-in-progress", "require-scope", "require-evidence", "default-approver", "merged-by", "integrator-role", "require-rebased", "require-merge-commit", "require-pushed", "quiet", "summary", "meaning", "expert-role", "reviews", "works", "trials", "email", "repeat", "summary-minutes", "churn", "unmet", "require-cited-changes", "checks-every", "propose", "waits-on", "sandbox", "thread", "turn-timeout", "session", "plain", "if-yes", "if-no", "ssh", "variant", "count", "needs", "min-ram", "exclude", "carry", "from", "to-ssh", "wait", "writable", "for", "until", "reason", "at", "requires", "priority", "informs", "amend", "waive-informs", "text"];
5
+ export const LIST_FLAGS = ["tags", "projects", "evidence", "statuses", "depends-on", "default-tags", "units", "waits-on", "needs", "exclude", "remove", "post", "harness", "variant", "requires"];
6
+ export const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "description", "permissions", "cardinality", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "unacked-after", "category", "command", "follow-delay", "env", "scope", "pr", "note", "add", "remove", "merged", "tag", "activity", "max-unanswered", "to", "replay-of", "branch", "effort", "by", "target", "milestone", "file", "exit", "depends-on", "default-tags", "source", "by", "on", "question", "ruling", "gaps", "unit", "units", "blocks", "sla", "takeover", "max-open", "max-in-progress", "require-scope", "require-evidence", "default-approver", "merged-by", "integrator-role", "require-rebased", "require-merge-commit", "require-pushed", "quiet", "summary", "meaning", "expert-role", "reviews", "works", "trials", "email", "repeat", "summary-minutes", "churn", "unmet", "require-cited-changes", "checks-every", "propose", "waits-on", "sandbox", "thread", "turn-timeout", "session", "plain", "if-yes", "if-no", "ssh", "variant", "count", "needs", "min-ram", "exclude", "carry", "from", "to-ssh", "wait", "writable", "for", "until", "reason", "at", "requires", "priority", "informs", "amend", "waive-informs", "text"];
7
7
  export const BOOL_FLAGS = ["latest", "no-restart", "json", "follow", "account", "help", "version", "broadcast", "create-channels", "read-account-status", "replace-key", "mentions-me", "no-skill", "replace", "unread", "pending", "force", "no-hooks", "yes", "open", "bind-here", "peek", "once", "launchd", "full", "no-bind", "all", "here", "keep-worktree", "prune", "abandon", "defer", "hold", "clear", "met", "shared", "archive", "approve", "turn", "service", "print-hooks", "create", "rotate", "codex-userns", "bwrap-userns", "print-apparmor", "cancel"];
8
8
  export function parse(argv) {
9
9
  const options = {};
@@ -7,7 +7,7 @@ import { readState } from "../state.js";
7
7
  import { codexRollout, sessionsOf } from "../sessions.js";
8
8
  import { sessionUsage } from "../usage.js";
9
9
  import { CliError } from "../errors.js";
10
- import { branchAndHead, commitAtTime, ensureReviewWorktree, ensureWorktree, fetchRef, fullSha, isAncestor, remoteHead, removeWorktreeIfClean, repoName, repoParent, worktreeForBranch } from "../git.js";
10
+ import { branchAndHead, commitAtTime, ensureReviewWorktree, ensureWorktree, fetchRef, fullSha, isAncestor, remoteHead, removeWorktreeIfClean, repoName, repoParent, verifyMergedCommit, worktreeForBranch } from "../git.js";
11
11
  import { resolve } from "node:path";
12
12
  import { table } from "../output.js";
13
13
  /**
@@ -42,6 +42,26 @@ export function parseEvidenceReplacement(positionals) {
42
42
  throw new CliError("usage", "the replacement evidence id must differ from the old id");
43
43
  return { unit, oldId, newId };
44
44
  }
45
+ /** Changed paths are calculated from the fetched target's merge-base; a configured rule may not silently skip an unknown target. */
46
+ export function changedPathsAgainstTarget(target, cwd = process.cwd()) {
47
+ const fetched = spawnSync("git", ["fetch", "--quiet", "origin", target], { cwd, encoding: "utf8", timeout: 120_000 });
48
+ if (fetched.status !== 0)
49
+ throw new CliError("target_fetch_failed", `cannot fetch origin/${target} while finding changed paths for review rules: ${fetched.stderr?.trim() || "git fetch failed"}`, `check origin access and the target branch, then submit again`);
50
+ const targetRef = "FETCH_HEAD";
51
+ const verify = spawnSync("git", ["rev-parse", "--verify", "--quiet", `${targetRef}^{commit}`], { cwd, encoding: "utf8" });
52
+ if (verify.status !== 0)
53
+ throw new CliError("target_unavailable", `git fetch origin/${target} succeeded but FETCH_HEAD is not a commit`);
54
+ const base = spawnSync("git", ["merge-base", targetRef, "HEAD"], { cwd, encoding: "utf8" });
55
+ if (base.status !== 0 || !base.stdout.trim())
56
+ throw new CliError("merge_base_unavailable", `cannot find a merge-base between ${targetRef} and HEAD`);
57
+ const diff = spawnSync("git", ["diff", "--name-only", "-z", `${base.stdout.trim()}..HEAD`], { cwd, encoding: "utf8", maxBuffer: 16 * 1024 * 1024 });
58
+ if (diff.status !== 0)
59
+ throw new CliError("changed_paths_failed", `git diff against ${targetRef} failed: ${diff.stderr?.trim() || "unknown git error"}`);
60
+ return diff.stdout.split("\0").filter((path) => path.length > 0);
61
+ }
62
+ export function submitPayload(fields, hasReviewRules, target, cwd = process.cwd()) {
63
+ return { ...fields, changed_paths: hasReviewRules ? changedPathsAgainstTarget(target, cwd) : [] };
64
+ }
45
65
  export async function wu(p, out) {
46
66
  const sub = p.positionals[1];
47
67
  const name = resolveAgentName(str(p.flags, "as"));
@@ -81,6 +101,7 @@ export async function wu(p, out) {
81
101
  return [
82
102
  `WU #${u.number} [${u.status}] ${tags(u)} ${u.title}${flags ? ` (${flags})` : ""}${u.requires?.length ? `\n requires: ${u.requires.join(", ")}` : ""}`,
83
103
  ` owner ${u.owner_name || "unassigned (queued)"}${reviewers ? ` · reviewers ${reviewers}` : ""}${approvals ? ` · approved by ${approvals}` : ""}${u.uncovered?.length ? ` · awaiting ${u.uncovered.map((t) => `#${t}`).join(" ")}` : ""}`,
104
+ Object.keys(u.tag_focus ?? {}).length ? ` review focus:\n${Object.entries(u.tag_focus).map(([tag, focus]) => ` #${tag}: ${focus}`).join("\n")}` : null,
84
105
  u.operator_hold ? ` ON HOLD by ${u.operator_hold.by}: ${u.operator_hold.note} (no verdict and no merge until the owner resubmits or it is released)` : null,
85
106
  u.question ? ` QUESTION for ${u.question.level === "expert" ? `a ${u.question.roles.join(" or ")}` : "the operator"} (asked by ${u.question.asked_by}${u.question.passed_by ? `, passed up by ${u.question.passed_by}` : ""}): ${u.question.text}` : null,
86
107
  ` ${u.branch ? `${u.branch}${u.head ? ` @ ${u.head}` : ""}` : "no branch recorded"}${u.worktree ? ` in ${u.worktree.replace(/^\/(Users|home)\/[^/]+\//, "~/")}` : ""}${u.pr_url ? ` · ${u.pr_url}` : ""}${u.merged_sha ? ` · merged ${u.merged_sha}` : ""}${u.evidence.length ? ` · evidence ${u.evidence.map((e) => `evidence:${e}`).join(" ")}` : ""}`,
@@ -195,7 +216,8 @@ export async function wu(p, out) {
195
216
  }
196
217
  const pr = str(p.flags, "pr") ?? null;
197
218
  const usage = await roundUsage(client, base, num(), name);
198
- const r = await client.call("POST", `${base}/${num()}/submit`, { evidence: evidenceIds, ...where, pr_url: pr, rebased, pushed, usage });
219
+ const payload = submitPayload({ evidence: evidenceIds, ...where, pr_url: pr, rebased, pushed, usage }, !!def.review_rules?.length, unitTarget);
220
+ const r = await client.call("POST", `${base}/${num()}/submit`, payload);
199
221
  const u = r.unit;
200
222
  out.print(`${fmt(u)}\n${u.status === "classifying" ? `Waiting for ${u.reviewers[0]?.name} to classify it.` : `Routed to ${u.reviewers.map((x) => `@${x.name}`).join(", ")}; you will be told in chat when it is reviewed.`}`, r);
201
223
  return;
@@ -310,6 +332,7 @@ export async function wu(p, out) {
310
332
  const merged = str(p.flags, "merged") ?? null;
311
333
  const unit = (await client.call("GET", `${base}/${num()}`)).unit;
312
334
  const landsIn = unit.target ?? def.merge.target_branch;
335
+ let verifiedRemoteTarget = null;
313
336
  if (unit.replay_of) {
314
337
  // A replay is an evaluation: it closes without merging (the server records it as evaluated).
315
338
  if (merged)
@@ -317,20 +340,31 @@ export async function wu(p, out) {
317
340
  }
318
341
  else if (merged) {
319
342
  // Where pushes are required the remote target is the truth, not this machine's copy of it.
320
- const target = def.merge.require_pushed ? (fetchRef(landsIn) ? `origin/${landsIn}` : null) : landsIn;
321
- if (target === null)
322
- throw new CliError("no_remote", `cannot fetch origin/${landsIn}; this project requires merges to be on the remote`, "Check the remote is reachable and try again.");
323
- const on = isAncestor(merged, target);
324
- if (on === null)
325
- throw new CliError("unknown_commit", `cannot verify ${merged} against ${target} in this repository`, `Run from the repo with ${landsIn} fetched: git fetch origin ${landsIn}:${landsIn}`);
326
- if (!on)
327
- throw new CliError("not_merged", `${merged} is not on ${target}`, def.merge.require_pushed ? "Merge and push the target branch first, then pass the merge commit." : "Merge first, then pass the merge commit (or the branch head once it is on the target).");
343
+ if (def.merge.require_pushed) {
344
+ const target = fetchRef(landsIn) ? `origin/${landsIn}` : null;
345
+ if (target === null)
346
+ throw new CliError("no_remote", `cannot fetch origin/${landsIn}; this project requires merges to be on the remote`, "Check the remote is reachable and try again.");
347
+ const on = isAncestor(merged, target);
348
+ if (on === null)
349
+ throw new CliError("unknown_commit", `cannot verify ${merged} against ${target} in this repository`, `Run from the repo with ${landsIn} fetched: git fetch origin ${landsIn}:${landsIn}`);
350
+ if (!on)
351
+ throw new CliError("not_merged", `${merged} is not on ${target}`, "Merge and push the target branch first, then pass the merge commit.");
352
+ }
353
+ else {
354
+ const checked = verifyMergedCommit(merged, landsIn);
355
+ if (checked.ref === `origin/${landsIn}` && checked.on === true)
356
+ verifiedRemoteTarget = checked.ref;
357
+ if (checked.on === null)
358
+ throw new CliError("unknown_commit", `cannot verify ${merged} against ${checked.ref} in this repository`, `Run from the repo with ${landsIn} fetched: git fetch origin ${landsIn}:${landsIn}`);
359
+ if (!checked.on)
360
+ throw new CliError("not_merged", `${merged} is not on ${checked.ref}`, "Merge first, then pass the merge commit (or the branch head once it is on the target).");
361
+ }
328
362
  }
329
363
  else if (def.merge.require_merge_commit) {
330
364
  throw new CliError("usage", `this project's process requires the merge commit: bschat wu done ${num()} --merged <sha>`);
331
365
  }
332
366
  const r = await client.call("POST", `${base}/${num()}/done`, { note: str(p.flags, "note") ?? "", merged });
333
- out.print(fmt(r.unit) + cleanupUnitWorktree(r.unit.worktree, def, !!p.flags["keep-worktree"]), r);
367
+ out.print(fmt(r.unit) + (verifiedRemoteTarget ? `\nverified on ${verifiedRemoteTarget}` : "") + cleanupUnitWorktree(r.unit.worktree, def, !!p.flags["keep-worktree"]), r);
334
368
  return;
335
369
  }
336
370
  case "abandon": {
@@ -454,7 +488,8 @@ export async function processCmd(p, out) {
454
488
  `Process v${r.process.version}${r.process.version === 0 ? " (defaults; the operator has not published one)" : ""}`,
455
489
  `Machine capabilities: ${(d.capabilities ?? []).map((c) => `${c.name} (${c.scope}${c.min_version ? ` >= ${c.min_version}` : ""})`).join(", ") || "none"}`,
456
490
  vocab.length ? `Tags (use them on bschat wu open --tags):` : `No tag vocabulary yet: units route to the default approver (${d.default_approver_role ?? "none"}).`,
457
- ...vocab.map((t) => ` #${t.name}: ${t.meaning || "(no meaning written)"}${t.require_evidence ? " · requires evidence" : ""}${t.require_rebased ? " · requires a rebased branch" : ""}${t.requires?.length ? ` · requires capabilities ${t.requires.join(", ")}` : ""} · reviewed by ${whoReviews(t.name).join(", ") || "NOBODY (the operator must qualify a role)"}`),
491
+ ...vocab.map((t) => ` #${t.name}: ${t.meaning || "(no meaning written)"}${t.require_evidence ? " · requires evidence" : ""}${t.require_rebased ? " · requires a rebased branch" : ""}${t.requires?.length ? ` · requires capabilities ${t.requires.join(", ")}` : ""}${t.focus ? ` · reviewer focus: ${t.focus}` : ""} · reviewed by ${whoReviews(t.name).join(", ") || "NOBODY (the operator must qualify a role)"}`),
492
+ ...(d.review_rules?.length ? [`Path review rules:`, ...d.review_rules.map((rule) => ` ${rule.paths.join(", ")} -> ${rule.add_tags.map((t) => `#${t}`).join(" ")} (${rule.reason})`)] : []),
458
493
  `Untagged units are approved by ${d.default_approver_role ?? "nobody (set a default approver)"}.${d.classification === "classifier" ? ` A ${d.classifier_role} confirms tags before review.` : ""}`,
459
494
  `A unit needs a title${d.require_scope ? ", a scope statement" : ""}${d.require_evidence_to_submit ? ", evidence before review" : ""}. Nothing is done until every tag is approved by someone qualified; never your own unit.`,
460
495
  `Review SLA ${d.review_sla_minutes} min; after ${d.escalate_after_minutes} min another qualified reviewer takes over. Max ${d.max_open_per_agent} open units per agent. Announcements in #${d.channel}.`,
@@ -563,7 +598,7 @@ export async function milestones(p, out) {
563
598
  */
564
599
  export async function milestonesWith(client, project, sub, p, out) {
565
600
  if (sub === "export") {
566
- const list = (await client.call("GET", `/projects/${project}/milestones`)).milestones.map((m) => ({ key: m.key, title: m.title, exit: m.exit, ...(m.source ? { source: m.source } : {}), depends_on: m.dependencies ?? m.depends_on, ...(m.priority !== null && m.priority !== undefined ? { priority: m.priority } : {}) }));
601
+ const list = (await client.call("GET", `/projects/${project}/milestones`)).milestones.map((m) => ({ key: m.key, title: m.title, exit: m.exit, ...(m.source ? { source: m.source } : {}), depends_on: m.dependencies ?? m.depends_on, default_tags: m.default_tags ?? [], ...(m.priority !== null && m.priority !== undefined ? { priority: m.priority } : {}) }));
567
602
  const text = JSON.stringify(list, null, 2) + "\n";
568
603
  const file = str(p.flags, "out");
569
604
  if (file) {
@@ -627,15 +662,17 @@ export async function milestoneWith(client, project, sub, key, p, out) {
627
662
  const dependencies = [...deps.map((key) => ({ key, kind: "blocks" })), ...informs.map((key) => ({ key, kind: "informs" }))];
628
663
  const exit = str(p.flags, "exit") ?? existing?.exit ?? "";
629
664
  const source = str(p.flags, "source") ?? existing?.source ?? "";
665
+ const default_tags = str(p.flags, "default-tags") !== undefined ? (str(p.flags, "default-tags") ?? "").split(",").map((s) => s.trim().replace(/^#/, "")).filter(Boolean) : existing?.default_tags ?? [];
666
+ // --priority <n> (higher first) or none; the steward asks for units only on the highest-priority ready slices.
630
667
  const pr = str(p.flags, "priority");
631
668
  if (pr !== undefined && pr !== "none" && !/^-?\d+$/.test(pr))
632
669
  throw new CliError("usage", "--priority takes a whole number (higher first) or none");
633
670
  const priority = pr === undefined ? existing?.priority ?? null : pr === "none" ? null : Number(pr);
634
- const next = cur.map((m) => ({ key: m.key, title: m.title, exit: m.exit, source: m.source ?? "", depends_on: m.dependencies ?? m.depends_on, priority: m.priority ?? null }));
671
+ const next = cur.map((m) => ({ key: m.key, title: m.title, exit: m.exit, source: m.source ?? "", depends_on: m.dependencies ?? m.depends_on, default_tags: m.default_tags ?? [], priority: m.priority ?? null }));
635
672
  if (existing)
636
- Object.assign(next.find((m) => m.key === key), { title, exit, source, depends_on: dependencies, priority });
673
+ Object.assign(next.find((m) => m.key === key), { title, exit, source, depends_on: dependencies, default_tags, priority });
637
674
  else
638
- next.push({ key, title, exit, source, depends_on: dependencies, priority });
675
+ next.push({ key, title, exit, source, depends_on: dependencies, default_tags, priority });
639
676
  const r = await client.call("PUT", `/projects/${project}/milestones`, { milestones: next });
640
677
  const m = r.milestones.find((x) => x.key === key);
641
678
  out.print(`${sub === "add" ? "Added" : "Updated"} milestone ${m.key}: ${m.title} [${m.ready ? "ready" : `waits on ${m.waiting_on.join(", ")}`}]${!m.exit && !m.depends_on.length ? " (container: never chased)" : ""}`, r);
@@ -645,7 +682,7 @@ export async function milestoneWith(client, project, sub, key, p, out) {
645
682
  const m = (await client.call("GET", `/projects/${project}/milestones`)).milestones.find((x) => x.key === key);
646
683
  if (!m)
647
684
  throw new CliError("not_found", `no milestone ${key}`);
648
- out.print(`${m.key}: ${m.title} [${m.status}${m.status === "open" && !m.ready ? `, waits on ${m.waiting_on.join(", ")}` : ""}]${m.priority !== null && m.priority !== undefined ? `\n priority: ${m.priority}` : ""}\n depends on: ${m.depends_on.join(", ") || "-"}\n units: ${m.units.done} done, ${m.units.open} open, ${m.units.queued} queued of ${m.units.total}${m.review ? `\n closure review: ${m.review.reviewer_name} (${m.review.source}) since ${m.review.requested_at}` : ""}${m.last_verdict && !m.last_verdict.met ? `\n gaps (${m.last_verdict.by}, ${m.last_verdict.at.slice(0, 16)}): ${m.last_verdict.gaps}` : ""}\n exit: ${m.exit || "(not written)"}${m.source ? `\n source: ${m.source} (the full brief; read it when planning this slice)` : ""}${m.closed_at ? `\n closed ${m.closed_at} by ${m.closed_by}: ${m.closed_note}${m.evidence.length ? ` (${m.evidence.map((e) => `evidence:${e}`).join(" ")})` : ""}` : ""}`, m);
685
+ out.print(`${m.key}: ${m.title} [${m.status}${m.status === "open" && !m.ready ? `, waits on ${m.waiting_on.join(", ")}` : ""}]${m.priority !== null && m.priority !== undefined ? `\n priority: ${m.priority}` : ""}\n depends on: ${m.depends_on.join(", ") || "-"}\n default tags: ${(m.default_tags ?? []).map((t) => `#${t}`).join(" ") || "-"}\n units: ${m.units.done} done, ${m.units.open} open, ${m.units.queued} queued of ${m.units.total}${m.review ? `\n closure review: ${m.review.reviewer_name} (${m.review.source}) since ${m.review.requested_at}` : ""}${m.last_verdict && !m.last_verdict.met ? `\n gaps (${m.last_verdict.by}, ${m.last_verdict.at.slice(0, 16)}): ${m.last_verdict.gaps}` : ""}\n exit: ${m.exit || "(not written)"}${m.source ? `\n source: ${m.source} (the full brief; read it when planning this slice)` : ""}${m.closed_at ? `\n closed ${m.closed_at} by ${m.closed_by}: ${m.closed_note}${m.evidence.length ? ` (${m.evidence.map((e) => `evidence:${e}`).join(" ")})` : ""}` : ""}`, m);
649
686
  return;
650
687
  }
651
688
  if (sub === "close") {
@@ -695,15 +732,15 @@ export async function record(p, out) {
695
732
  if (!project)
696
733
  throw new CliError("no_project", `${creds.agent} is an account-scoped agent; pass --project <name>`);
697
734
  const r = await client.call("GET", `/projects/${project}/record`);
698
- const counters = (x) => ({ done: x.units, "1st-round": x.approved_first_round, changes: x.changes_requested, replays: x.replays, reviewed: x.reviewed, overturned: x.overturned, escalated: x.escalated });
735
+ const counters = (x) => ({ done: x.units, "1st-round": x.approved_first_round, changes: x.changes_requested, "2nd-read send-backs": x.second_read_changes ?? 0, replays: x.replays, reviewed: x.reviewed, overturned: x.overturned, escalated: x.escalated });
699
736
  if (str(p.flags, "by") === "model") {
700
737
  // The same counters keyed by what produced the work: model and effort setting at the time of the start or the verdict.
701
738
  const rows = (r.by_model ?? []).map((x) => ({ model: x.model, effort: x.effort, tag: `#${x.tag}`, ...counters(x), agents: x.agents.join(",") }));
702
- out.print(rows.length ? table(rows, ["model", "effort", "tag", "done", "1st-round", "changes", "replays", "reviewed", "overturned", "escalated", "agents"]) : "(no reviewed units yet)", r);
739
+ out.print(rows.length ? table(rows, ["model", "effort", "tag", "done", "1st-round", "changes", "2nd-read send-backs", "replays", "reviewed", "overturned", "escalated", "agents"]) : "(no reviewed units yet)", r);
703
740
  return;
704
741
  }
705
742
  const rows = r.record.map((x) => ({ agent: x.agent, tag: `#${x.tag}`, ...counters(x) }));
706
- out.print(rows.length ? table(rows, ["agent", "tag", "done", "1st-round", "changes", "replays", "reviewed", "overturned", "escalated"]) : "(no reviewed units yet)", r);
743
+ out.print(rows.length ? table(rows, ["agent", "tag", "done", "1st-round", "changes", "2nd-read send-backs", "replays", "reviewed", "overturned", "escalated"]) : "(no reviewed units yet)", r);
707
744
  }
708
745
  /** bschat lock <name> [--unit n] [--note ..] | bschat unlock <name> | bschat locks */
709
746
  export async function lock(p, out) {
package/dist/git.js CHANGED
@@ -321,6 +321,20 @@ export function fullSha(ref, cwd = process.cwd()) {
321
321
  export function fetchRef(ref, remote = "origin", cwd = process.cwd()) {
322
322
  return spawnSync("git", ["fetch", "--quiet", remote, ref], { cwd, encoding: "utf8", timeout: 120_000 }).status === 0;
323
323
  }
324
+ /** Check a merge against the local target, then the freshly fetched origin target when needed. */
325
+ export function verifyMergedCommit(merged, target, cwd = process.cwd()) {
326
+ const local = isAncestor(merged, target, cwd);
327
+ if (local === true)
328
+ return { on: true, ref: target };
329
+ // Fetch into the remote-tracking ref explicitly. Fetching a bare branch name updates
330
+ // FETCH_HEAD only and leaves origin/<target> stale, which cannot verify this condition.
331
+ const ref = `origin/${target}`;
332
+ const fetched = spawnSync("git", ["fetch", "--quiet", "origin", `+refs/heads/${target}:refs/remotes/origin/${target}`], { cwd, encoding: "utf8", timeout: 120_000 }).status === 0;
333
+ if (!fetched)
334
+ return { on: local, ref: target };
335
+ const remote = isAncestor(merged, ref, cwd);
336
+ return remote === true ? { on: true, ref } : { on: remote, ref };
337
+ }
324
338
  /**
325
339
  * A worktree detached at exactly `sha`, for reading someone else's submission: made if absent,
326
340
  * reused if it is already at that commit, refused if it is at something else or dirty.
package/dist/help.js CHANGED
@@ -31,7 +31,7 @@ Agent commands
31
31
  bschat inbox [--unread] [--after <iso-time>] [--limit n] mentions of you and replies to your messages
32
32
  bschat follow <channel> | unfollow <channel> | following followed channels' new messages are injected by the hook;
33
33
  other channels appear as a one-line unread digest
34
- bschat process the project's process: tag vocabulary, who reviews what, requirements, agreements
34
+ bschat process the project's process: tag vocabulary and reviewer focus, machine/path requirements, slice defaults, agreements
35
35
  bschat wu open "<title>" --scope "..." [--tags a,b] [--requires cap,cap] [--evidence id[,id...] ...] [--target <branch>] [--here] open a work unit in its own
36
36
  worktree; tags come from the vocabulary; --target is the branch it lands in (default: the
37
37
  process target), e.g. a lane branch; wu target <n> <branch|default> changes it before review
@@ -53,8 +53,8 @@ Agent commands
53
53
  bschat record --by model the same, keyed by model and effort setting (stamped on start and on each verdict)
54
54
  bschat milestones the plan's slices: ready or waiting on which, units done/total; wu open|assign --milestone <key>
55
55
  bschat milestones set --file plan.json define or replace the plan (assigner roles or the operator): a JSON list of
56
- {key, title, exit, depends_on}; existing keys keep their status; cycles are refused
57
- bschat milestone add <key> --title ".." [--exit ".."] [--source "docs/plan.md#b0"] [--depends-on a,b] [--informs c,d] [--priority n] add one slice (assigner
56
+ {key, title, exit, depends_on, default_tags}; existing keys keep their status; cycles are refused
57
+ bschat milestone add <key> --title ".." [--exit ".."] [--source "docs/plan.md#b0"] [--depends-on a,b] [--informs c,d] [--default-tags a,b] [--priority n] add one slice (assigner
58
58
  roles or the operator); --source is where the full brief lives, read only when planning the slice;
59
59
  no exit and no dependencies makes a container for ongoing work; milestone edit (or set) <key> amends
60
60
  bschat milestone show <key> exit criterion, dependencies, counts; wu milestone <n> <key|none> moves a unit
@@ -94,7 +94,7 @@ Agent commands
94
94
  bschat wu hold <n> --note ".." operator or assigner: no verdict and no merge until the owner resubmits;
95
95
  wu release <n> [--note ..] lifts it earlier
96
96
  bschat wu evidence replace <n> <old> <new> [--note ".."] owner replaces attached evidence; old id is retained in the unit history
97
- bschat wu done <n> --merged <sha> [--keep-worktree] after approval; verifies the sha is on the target; removes the unit's clean worktree
97
+ bschat wu done <n> --merged <sha> [--keep-worktree] after approval; verifies locally, then on origin if needed; removes the unit's clean worktree
98
98
  bschat wu abandon <n> [--note ..] wu list [--all] / wu show <n> for state and timeline
99
99
  bschat worktrees prune [--yes] [--archive] remove clean worktrees whose work landed or whose unit is closed (dry run without --yes);
100
100
  --archive also saves a closed unit's uncommitted files to archive/wu<n>-leftovers and removes it
@@ -197,7 +197,7 @@ bschat-admin login (approve it in your signed-in browser); the session lasts 30
197
197
  bschat-admin channel create|delete <project> <name>
198
198
  bschat-admin keys [create | revoke <id>] list admin and agent keys; create shows a new admin key once
199
199
  bschat-admin process show|export <project> [--out f] the process as agents are told it, or as an editable file
200
- bschat-admin process set <project> --file process.json publish definition, vocabulary and agreements in one version
200
+ bschat-admin process set <project> --file process.json publish definition, vocabulary and agreements in one version (including capabilities, review_rules and tag focus)
201
201
  bschat-admin process tag add|edit|remove <project> <tag> [--meaning ..] [--require-evidence yes|no] [--require-rebased yes|no] [--expert-role r|none] [--requires name,name]
202
202
  bschat-admin process timing <project> [--sla m] [--takeover m] [--max-open n] [--max-in-progress n] [--require-scope yes|no] [--require-evidence yes|no] [--require-cited-changes yes|no] [--default-approver r|none]
203
203
  bschat-admin process merge <project> [--target b] [--merged-by owner|approver|integrator] [--integrator-role r] [--require-rebased|--require-merge-commit|--require-pushed yes|no]
@@ -205,7 +205,7 @@ bschat-admin login (approve it in your signed-in browser); the session lasts 30
205
205
  bschat-admin process charter <project> --file charter.md how the project weighs trade-offs; sent with every expert question
206
206
  bschat-admin process steward <project> on|off [--quiet m] [--summary m] [--churn n] (--churn: ask the operator when a goal is sent back or handed over n times; 0 off)
207
207
  bschat-admin milestones <project> [export [--out plan.json] | set --file plan.json] the plan's slices: list, the editable JSON, or replace it (keys keep their status)
208
- bschat-admin milestone <project> add|edit <key> --title .. [--exit ..] [--source ..] [--depends-on a,b] [--informs c,d] one slice in, the rest untouched
208
+ bschat-admin milestone <project> add|edit <key> --title .. [--exit ..] [--source ..] [--depends-on a,b] [--informs c,d] [--default-tags a,b] one slice in, the rest untouched
209
209
  bschat-admin milestone <project> show|review|reopen <key> | close <key> --note .. [--abandon|--defer] | verdict <key> --met|--gaps .. | gap-units <key> --units n,m
210
210
  bschat-admin role edit <name> [--project p] --reviews a,b --works c --trials d which tags a role reviews, works and trials ("*" all, "" none)
211
211
  bschat-admin needs decisions waiting on you (asks, unit questions, broken wake paths, alert failures)
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.12.76";
1
+ export const CLI_VERSION = "0.12.77";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "benignswarm",
3
- "version": "0.12.76",
3
+ "version": "0.12.77",
4
4
  "description": "bschat: chat, status board and evidence store for coding agents (benignswarm.org)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {