@workit-dev/opencode 2.16.2 → 2.17.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.
@@ -20,16 +20,15 @@ units of ~100+ lines each. Coupled work stays with one owner. Workit never spawn
20
20
  PR (`references/orchestration.md`).
21
21
  2. **Record standing orders** (`workit ledger standing add "<order>"`): every
22
22
  user directive all workers share. Directives decay across resumes.
23
- 3. **Brief each worker verbatim**: `workit fanout worktree create <slice>`
24
- (every host), then `workit fanout brief <slice>` (WORKTREE, SCRATCH, rules).
25
- Never hand-edit it; change the plan or the standing orders and render again.
23
+ 3. **Make the worktrees**: `workit fanout worktree create <slice>…` (every host; `--name <plan.json>`
24
+ registers the file) prints per slice its `WORKTREE:` line and the exact spawn, whose prompt points
25
+ the worker at `workit fanout brief <slice> --name <plan>`. Never hand-edit it; change the plan or
26
+ the standing orders. One unplanned slice needs no plan (`--branch <b>` optional).
26
27
  4. **Spawn in a rolling window**, in the background, each in its own worktree:
27
- keep 4-6 in flight and refill from `spawnable` in `workit fanout status` as
28
- each one finishes. Assign before spawn (OpenCode: `workit worker assign`); each prompt carries
29
- the brief, or a pointer: its `WORKER`, `TIER`, `TIMEBOX` and `WORKTREE` lines plus "run `workit fanout brief <slice>` and follow it"
30
- (budget and model hooks read those lines), so batched OpenCode launches each bind their worker.
31
- Model: the brief's `model:` and `effort:` lines (`workit models show`), else TIER (`references/orchestration.md`).
32
- Claude Code: the `implementer` agent; its spawn hook drops `isolation` and refuses a prompt without a WORKTREE line.
28
+ keep 4-6 in flight and refill from `spawnable` in `workit fanout status`.
29
+ Assign before spawn (OpenCode: `workit worker assign`); each prompt is the printed one
30
+ (budget and model hooks read its WORKTREE, WORKER, TIER and TIMEBOX lines), so batched OpenCode launches each bind their worker.
31
+ Claude Code: copy the printed `SPAWN:` args (a model only when the TIER differs from the agent file); the hook drops `isolation` and refuses a prompt naming no Workit worktree with a `Retry as:`.
33
32
  5. **Judge liveness by side effects only:** `workit fanout status` (head age,
34
33
  PR, CI, verdict, landed; STUCK past the TIMEBOX). Stop a stuck worker and
35
34
  observe that it exited (a timeout is not proof); stop a finished one when its
@@ -103,6 +103,27 @@ is the slice's STUCK threshold in `workit fanout status`. `"fanIn":
103
103
  }
104
104
  ```
105
105
 
106
+ ## Worktrees and the spawn they print
107
+
108
+ `workit fanout worktree create a b c` makes each slice's worktree and prints,
109
+ per slice, `WORKTREE: <path>` and the spawn that carries it. Its prompt starts
110
+ with that WORKTREE line, then `WORKER`, `TIER`, `TIMEBOX` and
111
+ "Run `workit fanout brief <slice> --name <plan>` and follow it exactly.";
112
+ Claude Code's `SPAWN:` line names `model` only when the TIER differs from the
113
+ `implementer` agent file. `--name` takes the plan's name or its file (`--plan`
114
+ is the same flag): a file is registered in that call, and a name no plan has
115
+ registers the one file in `workit dir plans` that starts with it. The plan
116
+ check refuses a slice branch the workspace branch policy refuses and names the
117
+ allowed one.
118
+
119
+ One unplanned slice: `workit fanout worktree create fix-login [--branch
120
+ fix/login] [--base <b>] [--tier <t>]` (no plan holds it) records a one-slice plan named after it
121
+ (the lead's prompt states the task) and prints the same lines; two or more
122
+ slices need a plan file. Claude Code's spawn gate passes a
123
+ `workit:implementer` prompt that names a Workit-made worktree as a WORKTREE
124
+ line, as its path, or as a brief file holding a WORKTREE line; otherwise its
125
+ deny is two lines ending in that ad-hoc command as `Retry as:`.
126
+
106
127
  ## Identity and git rules per host
107
128
 
108
129
  `workit fanout brief` renders the identity line, the model lines and RULES 1
package/dist/plugin.js CHANGED
@@ -28873,7 +28873,7 @@ var standingSinceStart = (input) => {
28873
28873
  }
28874
28874
  };
28875
28875
  // packages/workit-core/src/hooks/cwd-normalize.ts
28876
- var DIR = String.raw`[A-Za-z0-9_./@%+:,=-]+|'[^'$${"`"}\\\n]*'|"[^"$${"`"}\\!\n]*"`;
28876
+ var DIR = String.raw`(?:[A-Za-z0-9_./@%+:,=-]|(?<=[A-Za-z0-9])~)+|'[^'$${"`"}\n]*'|"(?:[^"$${"`"}\\!\n]|\\(?=[^"$${"`"}\\!\n]))*"`;
28877
28877
  var COMPOUND2 = new RegExp(String.raw`^\s*cd\s+(${DIR})\s*&&\s*(workit(?:\s[\s\S]*)?)$`, "u");
28878
28878
  var GLOBALS_FIRST = new RegExp(String.raw`^(\s*workit)((?:\s+(?:--json|--cwd(?:=|\s+)(?:${DIR})))+)\s+([a-z][a-z-]*)(?=\s|$)`, "u");
28879
28879
  var VERB_FIRST = /^((?:--json\s+)*)([a-z][a-z-]*)(?=\s|$)/u;
@@ -31237,12 +31237,17 @@ function planFinished(cwd, plan, rows) {
31237
31237
  }).landed;
31238
31238
  });
31239
31239
  }
31240
+ var isAdhocPlan = (plan) => plan.slices.length === 1 && plan.slices[0].id === plan.name;
31240
31241
  function selectFanout(cwd, name, current, session = null) {
31241
31242
  if (name) {
31242
31243
  const read = readFanout(cwd, name);
31243
31244
  if (!read.ok)
31244
31245
  return read;
31245
- return read.data ? { ok: true, data: read.data } : fanoutFail("not_found", `no fanout plan named ${name}`, "workit fanout plan <plan.json>");
31246
+ if (read.data)
31247
+ return { ok: true, data: read.data };
31248
+ const names = listFanouts(cwd);
31249
+ const known = names.ok ? names.data.map((plan) => plan.name) : [];
31250
+ return fanoutFail("not_found", `no fanout plan named ${name}${known.length ? ` (registered: ${known.join(", ")})` : " (none is registered)"}`, `workit fanout plan <plan.json>, or pass the plan file as --name <path>/plan.json`, { registered: known });
31246
31251
  }
31247
31252
  const all = listFanouts(cwd);
31248
31253
  if (!all.ok)
@@ -31270,7 +31275,11 @@ function selectFanout(cwd, name, current, session = null) {
31270
31275
  const holding = active(all.data.filter((plan) => plan.slices.some((slice) => slice.branch === current)));
31271
31276
  if (holding.length === 1)
31272
31277
  return { ok: true, data: holding[0] };
31273
- const led = holding.length === 0 && session ? active(all.data.filter((plan) => plan.leadSession === session)) : [];
31278
+ const real = (plans) => {
31279
+ const planned = plans.filter((plan) => !isAdhocPlan(plan));
31280
+ return planned.length ? planned : plans;
31281
+ };
31282
+ const led = holding.length === 0 && session ? real(active(all.data.filter((plan) => plan.leadSession === session))) : [];
31274
31283
  if (led.length === 1)
31275
31284
  return { ok: true, data: led[0] };
31276
31285
  const pool = holding.length > 1 ? holding : led.length > 1 ? led : active(all.data);
@@ -32344,16 +32353,25 @@ names (its WORKTREE line), which the lead made with
32344
32353
  \`workit fanout worktree create <slice>\` before spawning you; never in the
32345
32354
  lead's checkout.
32346
32355
 
32356
+ Your first step: a prompt that points at the brief (its WORKTREE, WORKER, TIER
32357
+ and TIMEBOX lines and \`workit fanout brief <slice> --name <plan>\`) means run
32358
+ that command and follow its text; a prompt that names a brief file means read
32359
+ that file.
32360
+
32347
32361
  Refuse to start without a complete brief. It must state: goal, scope (files
32348
32362
  or areas you may touch), acceptance (observable outcomes), verify (exact
32349
32363
  commands), timebox, forbidden (what you must not touch or do), report (what to
32350
32364
  hand back), standing orders, mode (\`new\` or \`resume\`) and the worktree path.
32351
- If a field is missing, report which and stop.
32365
+ If a field is missing, report which and stop. An unplanned slice
32366
+ (\`fanout worktree create <slice>\` with no plan) has a short brief: the lead's
32367
+ prompt states the task, and its acceptance and verify count as the brief's.
32352
32368
 
32353
32369
  1. In a Workit worktree (the default), run each git and check command against
32354
32370
  it, one verb per call:
32355
32371
  \`workit git --cwd <worktree> commit …\`, \`workit check --cwd <worktree> <name>\`
32356
32372
  (verb first, so the host's allow rules match).
32373
+ Read-only git (\`status\`, \`log\`, \`diff\`, \`show\`) is plain
32374
+ \`git -C <worktree> …\`; \`workit git\` takes branch, commit, stage and push.
32357
32375
  Never \`cd <worktree> && …\` chains, \`$VAR\` paths or compound commands. Edit
32358
32376
  files by their path under the worktree. Workit's hooks deny an edit or a
32359
32377
  mutating git command outside it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/opencode",
3
- "version": "2.16.2",
3
+ "version": "2.17.1",
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": "^2.16.2"
44
+ "@workit-dev/core": "^2.17.1"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=24"