@workit-dev/opencode 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/plugin.js +39 -5
  2. package/package.json +2 -2
package/dist/plugin.js CHANGED
@@ -15807,6 +15807,19 @@ var PR_ROW_TYPES = new Set([
15807
15807
  "pr.merged",
15808
15808
  "pr.linked"
15809
15809
  ]);
15810
+ var HOLD_ROW_TYPES = new Set(["branch.hold", "branch.hold.cleared"]);
15811
+ function branchHold(rows, branch) {
15812
+ let hold = null;
15813
+ for (const row of rows) {
15814
+ if (row.branch !== branch || row.observer !== "workit_cli")
15815
+ continue;
15816
+ if (row.type === "branch.hold")
15817
+ hold = row;
15818
+ else if (row.type === "branch.hold.cleared" || row.type === "push.verified")
15819
+ hold = null;
15820
+ }
15821
+ return hold;
15822
+ }
15810
15823
  var err = (code, error, unblock) => ({
15811
15824
  ok: false,
15812
15825
  code,
@@ -16317,6 +16330,19 @@ function verdictBasis(verdict, current) {
16317
16330
  return "stale";
16318
16331
  }
16319
16332
  var isLiveVerdict = (row, retired) => row.type === "verdict" && typeof row.result === "string" && !retired.has(row.id);
16333
+ var VOID_TYPE = "verdict.voided";
16334
+ function verdictVoids(rows, options = {}) {
16335
+ const voids = new Map;
16336
+ for (const row of rows)
16337
+ if (row.type === VOID_TYPE && row.observer === "workit_cli" && typeof row.target === "string" && (options.chained ? row.integrity === "verified" : row.integrity !== "unverified") && !voids.has(row.target))
16338
+ voids.set(row.target, {
16339
+ id: row.id,
16340
+ at: row.at,
16341
+ reason: str2(row.reason) ?? "",
16342
+ by: row.actor.session
16343
+ });
16344
+ return voids;
16345
+ }
16320
16346
  function trailerSessions(cwd, base, head) {
16321
16347
  if (!base || !head || !safeRef2(base) || !safeRef2(head))
16322
16348
  return [];
@@ -16655,6 +16681,8 @@ function checkVerdictsOnce(cwd, branch, ledgerRows) {
16655
16681
  for (const row of rows)
16656
16682
  if (row.type === "verdict" && row.supersedes && !row.supersedeIgnored && trustReasons(cwd, row).length === 0)
16657
16683
  retired.add(row.supersedes);
16684
+ for (const id of verdictVoids(rows, { chained: true }).keys())
16685
+ retired.add(id);
16658
16686
  const byKind = new Map;
16659
16687
  for (const row of rows.toSorted(byRank))
16660
16688
  if (isLiveVerdict(row, retired) && scope(row)) {
@@ -16788,7 +16816,7 @@ function importMirroredVerdicts(cwd, branch) {
16788
16816
  const mirror = readLedgerAt(cwd, file, { integrity: true });
16789
16817
  if (!mirror.ok)
16790
16818
  return [];
16791
- const candidates = mirror.value.rows.filter((row) => row.type === "verdict" && row.branch === branch && row.integrity === "verified");
16819
+ const candidates = mirror.value.rows.filter((row) => (row.type === "verdict" || row.type === VOID_TYPE) && row.branch === branch && row.integrity === "verified");
16792
16820
  const added = new Set;
16793
16821
  try {
16794
16822
  fs16.mkdirSync(path20.dirname(local.value), { recursive: true });
@@ -16814,7 +16842,10 @@ function importMirroredVerdicts(cwd, branch) {
16814
16842
  integrityReason: _reason,
16815
16843
  ...fields
16816
16844
  } = row;
16817
- const written = appendLine(local.value, (previous) => ({ ok: true, value: sealed(fields, id, at, previous).line }), { heldLock: true });
16845
+ const written = appendLine(local.value, (previous) => ({
16846
+ ok: true,
16847
+ value: sealed(fields, id, at, previous).line
16848
+ }), { heldLock: true });
16818
16849
  if (!written.ok)
16819
16850
  return false;
16820
16851
  ids.add(id);
@@ -16855,6 +16886,8 @@ var OBSERVED_ONLY = new Set([
16855
16886
  "check",
16856
16887
  "merge.unverified",
16857
16888
  "policy.judged",
16889
+ "verdict.voided",
16890
+ ...HOLD_ROW_TYPES,
16858
16891
  ...PR_ROW_TYPES
16859
16892
  ]);
16860
16893
 
@@ -24435,7 +24468,8 @@ var WORKIT_BYPASS_FLAGS = ["--unverified", "--overwrite-unintegrated"];
24435
24468
  var WORKIT_USER_ONLY = [
24436
24469
  ["release", "notes", "approve"],
24437
24470
  ["grant", "set"],
24438
- ["grant", "raise"]
24471
+ ["grant", "raise"],
24472
+ ["ledger", "void"]
24439
24473
  ];
24440
24474
  var ALLOWED = new Set(WORKIT_ALLOWED_VERBS);
24441
24475
  var hasWordsInOrder = (words, needle) => {
@@ -26695,7 +26729,7 @@ var unpushed = (cwd, branch, endpoint, mine, merged) => {
26695
26729
  return null;
26696
26730
  return {
26697
26731
  kind: "unpushed",
26698
- reason: `${branch} has ${count} commit(s) of this session not on ${remote}, and this workspace's endpoint is \`${endpoint}\` (\`workit grant show\`): push them with \`workit git push\`${endpoint === "pr" ? ", then open or update the PR (`workit pr create --fill`)" : ""}.`
26732
+ reason: `${branch} has ${count} commit(s) of this session not on ${remote}, and this workspace's endpoint is \`${endpoint}\` (\`workit grant show\`): push them with \`workit git push\`${endpoint === "pr" ? ", then open or update the PR (`workit pr create --fill`)" : ""}. If the user said not yet, record it once with \`workit git hold --why "<their words>"\` and stop.`
26699
26733
  };
26700
26734
  };
26701
26735
  var redChecks = (cwd, rows, pr, head, endpoint) => {
@@ -26774,7 +26808,7 @@ function stopObligation(input, descriptor) {
26774
26808
  return null;
26775
26809
  const autonomy = resolveAutonomy(input.cwd);
26776
26810
  const endpoint = autonomy.effectiveEndpoint;
26777
- if (endpoint !== "commit") {
26811
+ if (endpoint !== "commit" && !branchHold(rows, branch)) {
26778
26812
  const left = unpushed(input.cwd, branch, endpoint, commits, mergedHeads(rows));
26779
26813
  if (left)
26780
26814
  return { ...left, head };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/opencode",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "private": false,
5
5
  "description": "Workit OpenCode plugin — native tools, adaptive policy, and sixteen method skills",
6
6
  "keywords": [
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@opencode/plugin": "2.0.18",
44
- "@workit-dev/core": "^1.2.1"
44
+ "@workit-dev/core": "^1.3.0"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=24"