@brainervirus/workit-cli 0.10.0 → 0.11.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.
@@ -24,10 +24,10 @@ This session is a handoff destination for a continued plan. The originating sess
24
24
  - Working state, briefs, ledgers, and review diffs live only under gitignored `<SDD_DIR>` in `docs/<slug>/sdd/` and use `workit_sdd_*` tools.
25
25
  - Use native `todowrite` for visible task state as well as the gitignored ledger.
26
26
  - Use native `question` for branch/stash choices and guarded external mutations; call mutation tools only after approval with `confirmed: true` (grounded in the recorded NativeChoiceEvidence).
27
- - Flow-tool confirmations are never agent-typed booleans and never caller-supplied evidence objects: on OpenCode the plugin records the user's native-`question` answer as a host-observed one-use receipt (`attested: true`, `callID`, `selectedLabel`, `recordedAt`) consumed by `workit_spec_approve` / `workit_plan_approve` / `workit_plan_menu` — no evidence argument exists, and delegated worker status comes from host session parentage (`parentID`), never a caller `role` field. On Cursor, confirmations are policy-only (`attested: false`) and subagent-driven execution is rejected as unsupported.
27
+ - Flow-tool confirmations are never agent-typed booleans and never caller-supplied evidence objects: on OpenCode the plugin records the user's native-`question` answer as a host-observed one-use receipt (`attested: true`, `callID`, `selectedLabel`, `recordedAt`) consumed by `workit_spec_approve` / `workit_plan_approve` / `workit_plan_menu` — no evidence argument exists, and delegated worker status comes from host session parentage (`parentID`), never a caller `role` field. On Cursor, confirmations are policy-only (`attested: false`), Subagent-driven execution is supported through the one-time `coordinator_lease` and per-task `delegation_token` minted by `workit_delegate` (fail-closed validation; no `parentID` identity exists on Cursor), and Inline runs single-agent in the current session.
28
28
  - Delegated authority is direct-child-only: a worker is the session whose host `parentID` exactly equals the activating coordinator's recorded `coordinator_session_id`; missing, mismatched, or multi-owner lineage fails closed with `delegation_lineage_denied`, and nested `opencode` launches are denied during active delegated work. An authorized child receives only the compact worker contract (execute the supplied brief, follow TDD, land one contiguous non-empty commit range, report results) — never coordinator guidance, `wk-implement`, or ledger management; coordinator bookkeeping via `workit_sdd_*` stays with the coordinator session.
29
29
  - On Cursor, for every repository-scoped `workit_*` call, pass the active Cursor workspace as `workspace_root`; never rely on the MCP process default.
30
- - Use native `task` with only the built-in `explore` and `general` agents.
30
+ - Use native `task` with only the built-in `explore` and `general` agents (OpenCode); on Cursor, Subagent-driven dispatches Cursor-native subagents with a task `delegation_token`, Inline runs single-agent in the current session.
31
31
 
32
32
  ## Flow gates (HARD)
33
33
 
@@ -51,7 +51,7 @@ For each top-level task absent from `completed_task_ids`:
51
51
 
52
52
  1. Mark it `in_progress` with `todowrite`.
53
53
  2. Create a working-state brief with `workit_sdd_task_brief` and `confirmed: true`.
54
- 3. Delegate read-only discovery, when needed, to an `explore` agent. Delegate implementation to a fresh `general` agent. Product changes follow TDD.
54
+ 3. Route by the approved execution mode: **Subagent-driven** delegates read-only discovery to an `explore` (OpenCode) agent, delegates implementation to a fresh `general` (OpenCode) agent (on Cursor, the coordinator mints a `delegation_token` with `workit_delegate` and the subagent prompt carries the raw token — the worker passes it as `delegation_token` on its mutation calls, and appending progress revokes it), and the coordinator never edits product code; **Inline** executes every task in the current agent with no dispatch and no token minting. Product changes follow TDD.
55
55
  4. Create a working-state diff with `workit_sdd_review_package` and `confirmed: true`.
56
56
  5. Delegate spec-compliance review and code-quality review to separate `general` agents.
57
57
  6. **Blocking** findings (Critical, Important, or spec-compliance) may trigger at most **two** fix+re-review rounds per task. **Advisory** findings (Minor, style, YAGNI, taste) never pause the loop — append them with `workit_sdd_append_advisory` (`--task <id> --text <text>`, `confirmed: true`) instead of an unrestricted file edit.
@@ -1,6 +1,6 @@
1
1
  # <Feature> Implementation Plan
2
2
 
3
- > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
3
+ > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. On Cursor the two paths are: **Subagent-driven** — Cursor-native subagents dispatched by the coordinator, each carrying a task-scoped `delegation_token` minted with `workit_delegate` from the one-time `coordinator_lease`; **Inline** — `executing-plans` in the current session, single-agent, no dispatch, no token minting. Steps use checkbox (`- [ ]`) syntax for tracking.
4
4
 
5
5
  **Spec:** `docs/<slug>/spec.md`
6
6
  **Branch:** `feature/<slug>`
@@ -1,6 +1,6 @@
1
1
  # Superpowers document contract
2
2
 
3
- Use OpenCode's native `question` for every bounded user choice. Give concise choices and allow a custom answer; if the tool is unavailable, ask one concise plain-text question. Use `skill` to load workflow and Superpowers skills, `todowrite` for task state, and `task` for delegated work.
3
+ Use OpenCode's native `question` for every bounded user choice. Give concise choices and allow a custom answer; if the tool is unavailable, ask one concise plain-text question. Use `skill` to load workflow and Superpowers skills, `todowrite` for task state, and `task` for delegated work (OpenCode) or the host-native equivalent — on Cursor, Subagent-driven dispatches Cursor-native subagents with a task `delegation_token`, Inline runs single-agent in the current session.
4
4
 
5
5
  ## Tracked document layout
6
6
 
@@ -35,7 +35,7 @@ Before writing **Branch:** into a new spec or plan, call `workit_docs_branch` an
35
35
  - Commits use `wk-commit` after its native `question` confirmation.
36
36
  - Continuation uses `wk-handoff`, whose `workit_handoff_session` creates and seeds the OpenCode session automatically.
37
37
  - Never use worktrees. Resolve the declared branch with `workit_resolve_branch`, preview dirty-tree stash choices with `question`, and apply an approved in-place checkout through `workit_branch_setup` with `confirmed: true` (grounded in the recorded NativeChoiceEvidence).
38
- - Flow-tool confirmations are never agent-typed booleans and never caller-supplied evidence objects: on OpenCode the plugin records the user's native-`question` answer as a host-observed one-use receipt (`attested: true`, `callID`, `selectedLabel`, `recordedAt`) consumed by `workit_spec_approve` / `workit_plan_approve` / `workit_plan_menu` — no evidence argument exists, and delegated worker status comes from host session parentage (`parentID`), never a caller `role` field. On Cursor, confirmations are policy-only (`attested: false`) and subagent-driven execution is rejected as unsupported.
38
+ - Flow-tool confirmations are never agent-typed booleans and never caller-supplied evidence objects: on OpenCode the plugin records the user's native-`question` answer as a host-observed one-use receipt (`attested: true`, `callID`, `selectedLabel`, `recordedAt`) consumed by `workit_spec_approve` / `workit_plan_approve` / `workit_plan_menu` — no evidence argument exists, and delegated worker status comes from host session parentage (`parentID`), never a caller `role` field. On Cursor, confirmations are policy-only (`attested: false`), Subagent-driven execution is supported through the one-time `coordinator_lease` and per-task `delegation_token` minted by `workit_delegate` (fail-closed validation; no `parentID` identity exists on Cursor), and Inline runs single-agent in the current session.
39
39
  - Keep all SDD state under the gitignored `docs/<slug>/sdd/`; use `workit_sdd_context` and the registered `workit_sdd_*` tools.
40
40
  - After implementation, use `question` before an approved stash reapply through `workit_branch_setup` with `confirmed: true`.
41
41
 
package/dist/index.js CHANGED
@@ -46979,7 +46979,7 @@ import {
46979
46979
  unlinkSync as unlinkSync3,
46980
46980
  writeFileSync as writeFileSync9
46981
46981
  } from "node:fs";
46982
- import { createHash } from "node:crypto";
46982
+ import { createHash, randomBytes } from "node:crypto";
46983
46983
  import path19 from "node:path";
46984
46984
 
46985
46985
  // packages/workit-core/src/core/docs-validate.ts
@@ -47970,7 +47970,6 @@ root: ${cwd2}
47970
47970
 
47971
47971
  // packages/workit-core/src/core/flow-state.ts
47972
47972
  var COORDINATOR_RECOVERY_TEXT = "A subagent-driven plan is active: coordinator product edits are blocked. " + "Delegate product mutations to an authenticated delegated worker via `task` / `wk-implement` instead of " + "editing in the coordinator session.";
47973
- var CURSOR_SUBAGENT_UNSUPPORTED_TEXT = "Cursor cannot execute subagent-driven plans: the MCP has no child-session " + "support. Choose Inline, Handoff, or a review option in this session, or " + "run the plan in OpenCode with `wk-implement`.";
47974
47973
  var MENU_CHOICES = [
47975
47974
  "subagent-driven",
47976
47975
  "inline",
@@ -48000,6 +47999,21 @@ var resolveDoc = (root, slug, docPath, kind) => {
48000
47999
  return { ok: false, error: resolved.error };
48001
48000
  return { ok: true, path: resolved.layout[kind === "spec" ? "spec" : "plan"] };
48002
48001
  };
48002
+ var normalizeDelegation = (v) => {
48003
+ if (v === null || v === undefined)
48004
+ return null;
48005
+ if (!isRecord4(v))
48006
+ return null;
48007
+ const hash = (x) => typeof x === "string" && HEX64_RE.test(x) ? x : null;
48008
+ return {
48009
+ coordinator_lease_hash: hash(v.coordinator_lease_hash),
48010
+ active_task_id: typeof v.active_task_id === "number" && Number.isSafeInteger(v.active_task_id) ? v.active_task_id : null,
48011
+ token_hash: hash(v.token_hash),
48012
+ token_workspace: typeof v.token_workspace === "string" ? v.token_workspace : null,
48013
+ token_slug: typeof v.token_slug === "string" ? v.token_slug : null,
48014
+ status: v.status === "active" ? "active" : "revoked"
48015
+ };
48016
+ };
48003
48017
  var HEX64_RE = /^[0-9a-f]{64}$/;
48004
48018
  var FLOW_STATUSES = ["draft", "self_reviewed", "approved"];
48005
48019
  var EXECUTION_STATUSES = ["pending", "active", "paused", "completed"];
@@ -48124,7 +48138,8 @@ var validateState = (parsed, slug) => {
48124
48138
  status: execRaw?.status ?? "pending",
48125
48139
  mode: execRaw?.mode ?? null,
48126
48140
  evidence: execRaw?.evidence ?? null,
48127
- coordinator_session_id: execRaw?.coordinator_session_id ?? null
48141
+ coordinator_session_id: execRaw?.coordinator_session_id ?? null,
48142
+ ...execRaw?.delegation !== undefined ? { delegation: normalizeDelegation(execRaw.delegation) } : {}
48128
48143
  },
48129
48144
  handoff_destination: parsed.handoff_destination ?? false,
48130
48145
  updated_at: parsed.updated_at ?? Date.now()
@@ -48261,7 +48276,13 @@ var resetForSpecDrift = (state) => ({
48261
48276
  spec: { ...state.spec, status: "draft", evidence: null, approved_digest: null },
48262
48277
  plan: { ...state.plan, status: "draft", evidence: null, approved_digest: null },
48263
48278
  menu: { presented: false, chosen: "", evidence: null },
48264
- execution: { status: "pending", mode: null, evidence: null, coordinator_session_id: null },
48279
+ execution: {
48280
+ status: "pending",
48281
+ mode: null,
48282
+ evidence: null,
48283
+ coordinator_session_id: null,
48284
+ ...state.execution.delegation !== undefined ? { delegation: null } : {}
48285
+ },
48265
48286
  handoff_destination: false,
48266
48287
  updated_at: Date.now()
48267
48288
  });
@@ -48311,7 +48332,12 @@ var deriveLegacyExecution = (root, slug, state) => {
48311
48332
  coordinator_session_id: null
48312
48333
  };
48313
48334
  }
48314
- return { status: "pending", mode: null, evidence: null, coordinator_session_id: null };
48335
+ return {
48336
+ status: "pending",
48337
+ mode: null,
48338
+ evidence: null,
48339
+ coordinator_session_id: null
48340
+ };
48315
48341
  };
48316
48342
  var normalizeCompatibility = (root, slug, parsed, state) => {
48317
48343
  if (!isRecord4(parsed) || !("execution" in parsed)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-cli",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "private": false,
5
5
  "description": "Workit interactive setup wizard (Ink TUI)",
6
6
  "keywords": [
@@ -34,9 +34,9 @@
34
34
  "typecheck": "tsc --noEmit"
35
35
  },
36
36
  "dependencies": {
37
- "@brainervirus/workit-core": "^0.10.0",
38
- "@brainervirus/workit-cursor": "^0.10.0",
39
- "@brainervirus/workit-opencode": "^0.10.0",
37
+ "@brainervirus/workit-core": "^0.11.0",
38
+ "@brainervirus/workit-cursor": "^0.11.0",
39
+ "@brainervirus/workit-opencode": "^0.11.0",
40
40
  "@inkjs/ui": "2.0.0",
41
41
  "ink": "7.1.1",
42
42
  "react": "19.2.8"