@workit-dev/opencode 1.0.4 → 1.1.2

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.
@@ -54,7 +54,7 @@ units of ~100+ lines each. Coupled work stays with one owner. Workit never spawn
54
54
  landed. Then `workit ledger check --branch <b>` per slice, land in `fanout
55
55
  status` order, release the worktrees you made, and `workit ledger standing
56
56
  clear`. Only you touch topology: workers never rebase, retarget or merge,
57
- except the integration-tip merge in integration mode. Then ship
57
+ except the integration-tip rebase (integration mode). Then ship
58
58
  (call the skill tool with `workit-ship`) up to `defaultEndpoint` from `workit grant show`.
59
59
 
60
60
  ## Example
@@ -21,7 +21,7 @@ TIER: <mundane | standard | hard: how much model the slice needs>
21
21
  TIMEBOX: <wall clock, N tool calls (hard: 180, else 120) and the call by which the full gates ran (60%); past it without a new commit you will be replaced>
22
22
  SCRATCH: <your own temp dir: the one `fanout worktree create` printed, else `mktemp -d`; never a shared path>
23
23
  FORBIDDEN: <no edits outside SCOPE; no new dependencies; ...>
24
- FAN-IN: <one PR per slice: no rebase, retarget, merge or force-push | integration: merge the integration tip before reporting, nothing else>
24
+ FAN-IN: <one PR per slice: no rebase, retarget, merge or force-push | integration: rebase onto the integration tip, nothing else>
25
25
  REPORT: branch, head SHA, files changed, each VERIFY command with its exit code,
26
26
  each ACCEPTANCE line met / not met, rulings you made (`workit ledger ruling`),
27
27
  anything out of scope as a follow-up, not a diff.
@@ -153,12 +153,12 @@ Only when the user wants one PR for the whole fanout:
153
153
  <trunk>`) and plan with `"fanIn": "integration"` and `--trunk
154
154
  <integration>`. Planning refuses integration mode on origin's default
155
155
  branch.
156
- 2. Every brief then tells the worker to merge the integration tip into its
157
- branch before reporting (the fast-forward rule). That merge is the only
158
- one a worker makes, and only in this mode.
156
+ 2. Every brief then tells the worker to run `workit git rebase --onto
157
+ <integration>` before reporting (the fast-forward rule): its only rebase,
158
+ and only in this mode. A conflict comes back to you.
159
159
  3. Land each verified slice with `git merge --ff-only <slice-branch>` in the
160
160
  integration checkout. Not a fast-forward (the tip moved since the worker
161
- merged)? Resume the worker to merge again; never a merge commit of your own.
161
+ rebased)? Resume the worker to rebase again; never a merge commit of your own.
162
162
  4. `workit fanout check` gates against the integration branch; a slice whose
163
163
  tip is on it reads as landed. When all have landed, ship the integration
164
164
  branch as one PR (call the skill tool with `workit-ship`).
@@ -41,7 +41,7 @@ the same check. Fix round and recheck both failed: a decider (call the skill too
41
41
  and the stop point unless merge is granted.
42
42
  3. **Conflicts or a required rebase.** Rewrite only a branch this session or
43
43
  its stack created (yours in `workit ledger list --type commit.recorded` or
44
- `workit stack status`): rebase onto the base, `workit git push
44
+ `workit stack status`): `workit git rebase`, then `workit git push
45
45
  --force-with-lease` (`workit stack sync` in a stack). Anyone else's branch:
46
46
  report that a rebase is needed and stop.
47
47
  4. **Review threads** (`workit pr threads`). Check each claim in the code; fix
package/dist/plugin.js CHANGED
@@ -27194,36 +27194,50 @@ var DESCRIPTORS = {
27194
27194
  pi: PI_DESCRIPTOR
27195
27195
  };
27196
27196
  var workerOfLead = (input) => input.session.agentType === null || workitRole(DESCRIPTORS[input.host], input.session.agentType) !== null;
27197
- var worksFor = (plan, input, branch) => {
27197
+ var worksFor = (plan, input, branches) => {
27198
27198
  const session = input.session.id;
27199
27199
  if (plan.leads.includes(session) && !input.session.agentId)
27200
- return false;
27200
+ return null;
27201
+ if (branches.some((branch) => plan.branches.includes(branch)))
27202
+ return "slice";
27201
27203
  const lead = leadOf2(input);
27202
27204
  if (lead && plan.leads.includes(lead) && workerOfLead(input))
27203
- return true;
27204
- if (plan.leads.some((each) => session.startsWith(`${each}-w-`)))
27205
- return true;
27206
- const current = branch();
27207
- return current !== null && plan.branches.includes(current);
27205
+ return "lead";
27206
+ return plan.leads.some((each) => session.startsWith(`${each}-w-`)) ? "lead" : null;
27207
+ };
27208
+ var agentBranches = (input, rows) => {
27209
+ const { id, agentId } = input.session;
27210
+ const bound = agentId ? rows.findLast((row) => row.type === "worktree.bound" && row.actor.session === id && row.actor.agentId === agentId && typeof row.worktree === "string")?.worktree : undefined;
27211
+ const dirs = typeof bound === "string" ? [input.cwd, bound] : [input.cwd];
27212
+ return dirs.map((dir) => currentBranch(dir)).filter((branch) => !!branch);
27208
27213
  };
27209
27214
  var standingFor = (input, store, rev) => {
27210
27215
  const orders = new Map;
27211
27216
  const ledger = readLedger(input.cwd);
27212
27217
  const rows = ledger.ok ? ledger.value.rows : [];
27213
- let branch;
27214
- const lazyBranch = () => branch === undefined ? branch = currentBranch(input.cwd) : branch;
27215
- for (const plan of readPlans(store))
27216
- if (worksFor(plan, input, lazyBranch))
27217
- for (const row of activeStanding(rows, plan.name, plan.leads.length ? plan.leads : null))
27218
- orders.set(row.id, row);
27219
- return { rev, orders, rows };
27218
+ const branches = agentBranches(input, rows);
27219
+ const matched = readPlans(store).map((plan) => ({
27220
+ plan,
27221
+ how: worksFor(plan, input, branches)
27222
+ }));
27223
+ const tied = matched.some(({ how }) => how === "slice");
27224
+ const plans = matched.filter(({ how }) => tied ? how === "slice" : how !== null);
27225
+ for (const { plan } of plans)
27226
+ for (const row of activeStanding(rows, plan.name, plan.leads.length ? plan.leads : null))
27227
+ orders.set(row.id, row);
27228
+ return {
27229
+ rev,
27230
+ orders,
27231
+ rows,
27232
+ fanouts: new Set(plans.map(({ plan }) => plan.name))
27233
+ };
27220
27234
  };
27221
27235
  var fanoutOf = (row) => typeof row.fanout === "string" ? row.fanout : "?";
27222
27236
  var changedSince = (now, ids) => {
27223
27237
  const known = new Set(ids);
27224
27238
  const added = [...now.orders.values()].filter((row) => !known.has(row.id));
27225
27239
  const byId = new Map(now.rows.map((row) => [row.id, row]));
27226
- const dropped = ids.filter((id) => !now.orders.has(id)).map((id) => byId.get(id)).filter((row) => row !== undefined);
27240
+ const dropped = ids.filter((id) => !now.orders.has(id)).map((id) => byId.get(id)).filter((row) => row !== undefined && now.fanouts.has(fanoutOf(row)));
27227
27241
  if (!added.length && !dropped.length)
27228
27242
  return null;
27229
27243
  const fanouts = [...new Set([...added, ...dropped].map(fanoutOf))].join(", ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/opencode",
3
- "version": "1.0.4",
3
+ "version": "1.1.2",
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.0.4"
44
+ "@workit-dev/core": "^1.1.2"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=24"