@brainervirus/workit-opencode 8.31.0 → 8.31.1

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 +18 -5
  2. package/package.json +2 -2
package/dist/plugin.js CHANGED
@@ -14149,6 +14149,18 @@ function diffHash(cwd, base, head) {
14149
14149
  }
14150
14150
  return `sha256:${hash.digest("hex")}`;
14151
14151
  }
14152
+ function cleanRebase(cwd, range) {
14153
+ if (!Object.values(range).every(safeRef2))
14154
+ return false;
14155
+ const fromFork = git4(cwd, ["merge-base", range.fromBase, range.from]);
14156
+ const toFork = git4(cwd, ["merge-base", range.toBase, range.to]);
14157
+ if (!fromFork || !toFork || fromFork === toFork)
14158
+ return false;
14159
+ const merged = gitRun2(cwd, ["merge-tree", "--write-tree", "--no-messages", `--merge-base=${fromFork}`, toFork, range.from], GIT_TIMEOUTS.worktree);
14160
+ const tree = merged.ok ? merged.stdout.split(`
14161
+ `)[0]?.trim() : null;
14162
+ return Boolean(tree) && tree === git4(cwd, ["rev-parse", "--verify", "-q", `${range.to}^{tree}`]);
14163
+ }
14152
14164
  function storeRoot(cwd) {
14153
14165
  const location = resolveStore(path16.resolve(cwd));
14154
14166
  if (location instanceof Error)
@@ -14812,23 +14824,24 @@ function checkVerdicts(cwd, branch, ledgerRows) {
14812
14824
  return drift;
14813
14825
  };
14814
14826
  const exactCache = new Map;
14815
- const exactCarry = (row) => {
14816
- if (FAILING.has(String(row.result)))
14817
- return true;
14827
+ const exactMatch = (row) => {
14818
14828
  let exact = exactCache.get(row);
14819
14829
  if (exact === undefined) {
14820
14830
  const toBase = row.base ?? fallbackBase;
14821
14831
  const toBaseSha = toBase ? resolveCommit(cwd, toBase) : null;
14822
14832
  const fromBase = row.baseSha ?? toBaseSha;
14823
- exact = Boolean(row.head && head && toBaseSha && fromBase && sameOwnChange(cwd, { from: row.head, to: head, fromBase, toBase: toBaseSha }));
14833
+ const range = row.head && head && toBaseSha && fromBase ? { from: row.head, to: head, fromBase, toBase: toBaseSha } : null;
14834
+ exact = !range ? null : sameOwnChange(cwd, range) ? "same" : cleanRebase(cwd, range) ? "rebase" : null;
14824
14835
  exactCache.set(row, exact);
14825
14836
  }
14826
14837
  return exact;
14827
14838
  };
14839
+ const exactCarry = (row) => FAILING.has(String(row.result)) || exactMatch(row) !== null;
14828
14840
  const keyBasis = (row) => {
14829
14841
  const basis = verdictBasis(row, { head, ...keyFor(row.base ?? fallbackBase) });
14830
14842
  return basis === "carried" && !exactCarry(row) ? "stale" : basis;
14831
14843
  };
14844
+ const rebaseNote = (row) => row.head && head && row.head !== head && !FAILING.has(String(row.result)) && keyBasis(row) === "carried" && exactMatch(row) === "rebase" ? { rule: "rebase", since: row.head, files: [] } : null;
14832
14845
  const restacked = (row) => restackCarries(FAILING.has(String(row.result)) ? null : cwd, rows, branch, row.head, head);
14833
14846
  const carryOf = (row) => {
14834
14847
  if (keyBasis(row) !== "stale")
@@ -14906,7 +14919,7 @@ function checkVerdicts(cwd, branch, ledgerRows) {
14906
14919
  independent: independence.length === 0,
14907
14920
  accepted: reasons.length === 0,
14908
14921
  reasons,
14909
- carry: basis === "carried" ? carryOf(row) : null,
14922
+ carry: basis === "carried" ? rebaseNote(row) ?? carryOf(row) : null,
14910
14923
  verdict: row
14911
14924
  });
14912
14925
  if (reasons.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-opencode",
3
- "version": "8.31.0",
3
+ "version": "8.31.1",
4
4
  "private": false,
5
5
  "description": "Workit OpenCode plugin — native tools, adaptive policy, and sixteen method skills",
6
6
  "keywords": [
@@ -39,7 +39,7 @@
39
39
  "typecheck": "tsc --noEmit"
40
40
  },
41
41
  "devDependencies": {
42
- "@brainervirus/workit-core": "^8.31.0",
42
+ "@brainervirus/workit-core": "^8.31.1",
43
43
  "@opencode/plugin": "2.0.18"
44
44
  },
45
45
  "engines": {