@brainervirus/workit-cli 0.10.0 → 1.0.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.
package/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  # @brainervirus/workit-cli
2
2
 
3
+ [![CI](https://github.com/BrainerVirus/workit/actions/workflows/ci.yml/badge.svg)](https://github.com/BrainerVirus/workit/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/@brainervirus/workit-cli.svg)](https://www.npmjs.com/package/@brainervirus/workit-cli)
5
+ [![license: MIT](https://img.shields.io/badge/license-MIT-green.svg)](../../LICENSE)
6
+
3
7
  The workit CLI — an interactive Ink wizard that configures workit for OpenCode and/or Cursor, plus an offline installation doctor.
4
8
 
5
9
  ## Requirements
6
10
 
7
- - **Node.js ≥ 22** — the published CLI is a self-contained Node bundle (no Bun runtime). Node 21 and below fail (`ERR_MODULE_NOT_FOUND`/ESM syntax or the `>=22` engine gate).
11
+ - **Node.js ≥ 24** — the published CLI is a self-contained Node bundle (no Bun runtime). Node 23 and below fail (`ERR_MODULE_NOT_FOUND`/ESM syntax or the `>=24` engine gate).
8
12
 
9
13
  ## Install
10
14
 
@@ -20,28 +24,34 @@ npx @brainervirus/workit-cli init
20
24
  workit init # interactive setup wizard
21
25
  workit doctor # offline installation health report
22
26
  workit doctor --json # machine-readable report
23
- workit flow status --plan docs/<slug>/plan.md # read the effective flow state
24
- workit flow pause --plan docs/<slug>/plan.md [--confirm] # active -> paused
25
- workit flow resume --plan docs/<slug>/plan.md [--confirm] # paused -> active
26
- workit flow complete --plan docs/<slug>/plan.md [--confirm] # complete (ledger + verification gated)
27
- workit flow review-package --plan docs/<slug>/plan.md --base <sha> --head <sha> [--confirm] # write a review diff
28
- workit flow append-advisory --plan docs/<slug>/plan.md --task <id> --text <text> [--confirm] # record an advisory review finding
29
- workit handoff --message "docs/<slug>/plan.md" # print the destination handoff prompt
30
- workit # help
27
+ workit <family> <action> [--payload <json|@file|->] [--task <id>] [--revision <uuid>] [--workspace-revision <uuid|null>] [--view full] [--actor <id>] [--confirm] [--json]
28
+ workit action <operation> --payload <JSON> [--preview] [--confirm] [--task <id>] [--json] # preview or run one approved external action
29
+ workit handoff --task <id> [--json] # export task state and compact destination context
30
+ workit cutover preview [--hosts ..] [--json] | apply [--hosts ..] [--resolution k=v] [--confirm] | rollback preview|apply <backupId> [--json] [--confirm]
31
+ workit uninstall # remove host registrations (keeps ~/.config/workit)
32
+ workit # help
31
33
  ```
32
34
 
33
35
  `workit init` guides you through: platform selection (OpenCode/Cursor), global config (locale, timezone, branch policy), YouTrack, VCS, workspaces (path globs → provider), and project hygiene files. The wizard is a TTY application — `workit init` requires an interactive terminal and prints guidance (exiting nonzero) when stdin is not a TTY.
34
36
 
35
37
  `workit doctor` checks the offline installation health and exits nonzero when problems are found; `--json` prints the full report as JSON instead of the human-readable table.
36
38
 
37
- `workit flow` maps the shared-core execution lifecycle (`pending`/`active`/`paused`/`completed`) to the CLI: `status` reads the effective flow state (approval digests, drift, execution, handoff-destination flag); `pause`/`resume`/`complete` mutate it with `--confirm` (or a TTY prompt when stdin is a TTY, exit 2 when neither applies); `review-package` writes the review diff for a `--base..--head` range through the shared core guard, which rejects empty ranges. `workit handoff` prints the core destination handoff prompt (four-choice menu, never the originating Handoff option) and marks the flow as a handoff destination; a second handoff on an already-marked destination is rejected. Domain/verification failures exit 1 with structured JSON on stderr; usage errors exit 2.
39
+ The task surface exposes the eight shared operation families (`task`, `policy`,
40
+ `evidence`, `finding`, `decision`, `worker`, `writer`, and `state`) and their 24
41
+ closed actions. Payloads can be inline JSON, a UTF-8 `@file`, or UTF-8 stdin
42
+ with `-`; `--json` preserves the structured Result shape and exits nonzero for
43
+ failures. Headless mutations that require consent use `--confirm` (agent-reported)
44
+ or an observed TTY prompt; the action route additionally requires an
45
+ interactive TTY — headless action calls return `needs_input` even with
46
+ `--confirm`. `workit handoff --task` is read-only and refuses to
47
+ emit a handoff when export and inspection revisions differ.
38
48
 
39
49
  ## Behavior
40
50
 
41
51
  - **Safe apply semantics** — a malformed `config.json` is detected before the wizard renders and reported as a friendly blocked output instead of crashing; the same guard runs after the Apply preview.
42
52
  - **Stable interaction** — unchanged wizard inputs are no-ops; they settle without React render warnings and never discard draft state.
43
53
  - **Clean terminal** — only `warn`/`error` diagnostics print to stderr; routine structured `info` records stay in the JSONL journal. Nonzero failures and human-readable errors remain visible.
44
- - **Node support** — the packed CLI runs on Node 22+; installation on Node 22.19 emits no engine warning from workit's dependency tree.
54
+ - **Node support** — the packed CLI runs on Node 24+; installation on Node 24 emits no engine warning from workit's dependency tree.
45
55
 
46
56
  ## Package scripts
47
57
 
@@ -1,73 +1,40 @@
1
- Load `using-superpowers`, `subagent-driven-development`, `test-driven-development`, and `verification-before-completion` through OpenCode's `skill` tool. Implement the existing plan; do not re-plan.
1
+ Load resolved method skills through the host skill loader when policy selects them. Implement the existing plan; do not re-plan.
2
2
 
3
3
  **Spec:** <SPEC_PATH>
4
4
  **Plan:** <PLAN_PATH>
5
5
  **Branch:** <BRANCH>
6
- **SDD:** `<SDD_DIR>`
7
-
8
- ## Handoff destination
9
-
10
- This session is a handoff destination for a continued plan. The originating session already recorded the post-plan menu choice; present exactly these four choices plus model deferral and never re-offer the originating handoff option:
11
-
12
- - Subagent-driven
13
- - Inline
14
- - Review spec first
15
- - Review plan first
16
- - Change model first
17
-
18
- <workflow-handoff-destination>true</workflow-handoff-destination>
19
6
 
20
7
  ## Hard gates
21
8
 
22
- - The parent is coordinator-only: it does not edit product code or perform delegated exploration.
23
- - Never use a worktree. Branch changes are in-place through `workit_branch_setup` on `feature/*` or `bugfix/*`; never commit on protected branches.
24
- - Working state, briefs, ledgers, and review diffs live only under gitignored `<SDD_DIR>` in `docs/<slug>/sdd/` and use `workit_sdd_*` tools.
25
- - Use native `todowrite` for visible task state as well as the gitignored ledger.
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.
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
- - 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.
31
-
32
- ## Flow gates (HARD)
33
-
34
- - `wk-implement` refuses to run unless the plan is `approved` (flow.json) and the post-plan menu was presented.
35
- - `wk-handoff` refuses to run unless both spec and plan are `approved`.
36
- - Sequence is enforced by tools: `workit_spec_approve`, `workit_plan_approve`, `workit_plan_menu` — never skip a step (the spec/plan self-review runs automatically inside the transition; only the final approval asks for your confirmation).
9
+ - Inspect task state before acting. On OpenCode, Cursor, Codex, and Pi use the eight shared `workit_*` families (`workit_task`, `workit_policy`, `workit_evidence`, `workit_finding`, `workit_decision`, `workit_worker`, `workit_writer`, `workit_state`). On the CLI host use `workit <family> <action>` with the same actions (hyphenated on the CLI).
10
+ - Never use a worktree. Branch changes are in-place through the approved `git.branch_setup` external action (CLI: `workit action git.branch_setup --payload …`).
11
+ - Task metadata lives under `.workit/`; never edit it directly. Record progress, evidence, findings, decisions, and worker state only through the shared operations.
12
+ - Helpers cannot widen scope, record binding decisions, close or pause the task, assign further helpers, or resolve blockers for the lead.
13
+ - On Cursor, pass the active workspace as `workspace_root` on every repository-scoped call.
37
14
 
38
15
  ## Setup
39
16
 
40
- 0. Call `workit_docs_validate` with the linked spec/plan paths. Hard-fail on any error before todos or branch setup.
41
- 1. Call `workit_sdd_context` with `<PLAN_PATH>` and initialize `todowrite` from returned tasks.
42
- 2. Call `workit_plan_tasks`; cache each top-level task's `section_text`.
43
- 3. Mark IDs in `completed_task_ids` completed and never redispatch them.
44
- 4. Call `workit_resolve_branch`, then show the current branch, target branch, and stash behavior before any in-place checkout/setup mutation.
45
- 5. Always use `question`: for a clean tree ask whether to proceed or cancel; for a dirty tree add the stash choice and describe what will be stashed.
46
- 6. Call `workit_branch_setup` with `confirmed: true` only after approval.
17
+ 1. If there is no active or paused task, call `workit_task` with `action: "start"` then `workit_policy` with `action: "assess"` (CLI: `workit task start …` then `workit policy assess …`).
18
+ 2. Load `workit-plan`, list tasks with `workit_task` `action: "list"`, and mirror visible todo state to the host UI.
19
+ 3. When policy requires a feature branch, resolve it with read-only `context.read` and apply `git.branch_setup` only after native approval.
47
20
 
48
21
  ## Remaining-task loop
49
22
 
50
- For each top-level task absent from `completed_task_ids`:
23
+ For each bounded plan task:
51
24
 
52
- 1. Mark it `in_progress` with `todowrite`.
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.
55
- 4. Create a working-state diff with `workit_sdd_review_package` and `confirmed: true`.
56
- 5. Delegate spec-compliance review and code-quality review to separate `general` agents.
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.
58
- 7. Append the validated ledger entry with `workit_sdd_append_progress` and `confirmed: true`; mark the todo completed.
25
+ 1. Mark the item in progress in the host todo UI and record boundary progress with `workit_task` `action: "progress"`.
26
+ 2. Route by policy: assign bounded workers with `workit_worker` `action: "assign"` when delegation is available; otherwise implement inline. Acquire product-write ownership with `workit_writer` `action: "acquire"` before repository mutations; release it when done.
27
+ 3. Record checks and artifacts with `workit_evidence` `action: "record"`. Record review concerns with `workit_finding` `action: "record"`; resolve or defer them with `finding.resolve`. Blocking findings may trigger at most **two** fix+re-review rounds per task; advisory taste/YAGNI items still use `finding.record` and never pause the loop by direct file edit.
28
+ 4. Never advance while a foreign writer is active or blocking findings remain open for the current candidate.
59
29
 
60
30
  ## Final gate
61
31
 
62
- Run a separate full-branch code review, then `workit_verify`. Present the full `<SDD_DIR>/advisories.md` roll-up once, then use native `question` so the user can choose which advisory items to fix, discuss, or discard. Report exact check results and never infer success. Use `workit_git_context` for a commit preview and load `wk-commit` through `skill` for an approved commit. If working state contains a stash reference, preview reapplication through `question`, then call `workit_branch_setup` with `confirmed: true` after approval.
63
-
64
- **Mandatory:** end the run by calling `workit_plan_complete` (OpenCode/Cursor) or the CLI `workit flow complete` (CLI host) after the final task once the SDD ledger is complete (all task IDs appended) and `workit_verify` passes — a complete ledger and green verification are the tool's gates. Never finish the run while the plan is still `active`.
32
+ Run repository verification (CLI: `workit doctor`; hosts: approved project verify when policy requires it). **Mandatory:** close the lead task with `workit_task` `action: "close"` (CLI: `workit task close --payload [--confirm]`) once requirements are satisfied and verification passes never finish while the task is still `active` or `paused`.
65
33
 
66
34
  ## Task order
67
35
 
68
36
  <TASK_LIST>
69
37
 
70
- ## Quality gate (HARD)
38
+ ## Quality gate
71
39
 
72
- - Specs/plans are written from `templates/spec-template.md` / `templates/plan-template.md`.
73
- - After `workit_docs_validate`, surface `quality` findings (spec scan). Hard findings (missing required section, missing CA-XX) block task start unless the user explicitly waives them. Warnings are advisory.
40
+ - Specs/plans follow `templates/spec-template.md` / `templates/plan-template.md`.
@@ -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:** Load `workit-implement` when policy selects implementation. Use bounded `workit_worker` delegation when the host supports it; otherwise execute inline within writer scope. Steps use checkbox (`- [ ]`) syntax for tracking.
4
4
 
5
5
  **Spec:** `docs/<slug>/spec.md`
6
6
  **Branch:** `feature/<slug>`
@@ -9,8 +9,8 @@
9
9
 
10
10
  ## Global Constraints
11
11
 
12
- - Each task lands exactly one contiguous non-empty commit range (`base..head`): fix rounds append commits to that range and never rewrite/amend an active review range; each progress line records the task's real base..head shas.
13
- - The final task ends execution with `workit_plan_complete` (or the CLI `workit flow complete`) once the SDD ledger is complete and repository verification passes — a run never finishes while the plan is still `active`.
12
+ - Each task lands exactly one contiguous non-empty commit range (`base..head`): fix rounds append commits to that range and never rewrite/amend an active review range; record the real base..head shas in task progress.
13
+ - The final task closes the lead Workit task with `workit_task` `action: "close"` (CLI: `workit task close --payload … [--confirm]`) once requirements are satisfied and repository verification passes — never finish while the task is still `active` or `paused`.
14
14
  - <project-wide requirements, one line each>
15
15
 
16
16
  ---
@@ -2,6 +2,9 @@
2
2
 
3
3
  **Branch:** `feature/<slug>`
4
4
 
5
+ **Change:** ADDED|MODIFIED|REMOVED — <one-sentence intent>. (Small work with
6
+ no durable agreement: `Spec: none (<reason>)`, no file.)
7
+
5
8
  ## Context
6
9
 
7
10
  <!-- Why does this exist? What problem does it solve? 1-3 sentences. -->
@@ -16,13 +19,14 @@
16
19
 
17
20
  ## Architecture
18
21
 
19
- <!-- REQUIRED if this spec has flows or architecture: render a mermaid diagram (workit_present_flow). -->
22
+ <!-- May be `N/A (<reason>)` when the change has no flows or architecture. -->
23
+ <!-- Otherwise REQUIRED: render a mermaid diagram (workit-diagram skill). -->
20
24
  ```mermaid
21
25
  flowchart TD
22
26
  A[Start] --> B[Step]
23
27
  ```
24
28
 
25
- <!-- REQUIRED if this spec touches UI: render an ASCII wireframe (workit_present_ascii). -->
29
+ <!-- REQUIRED if this spec touches UI: render an ASCII wireframe (workit-mockup skill). -->
26
30
  ```text
27
31
  ┌──────────────┐
28
32
  │ Header │
@@ -39,8 +43,16 @@ flowchart TD
39
43
  ## Acceptance criteria
40
44
 
41
45
  <!-- REQUIRED: enumerable, each verifiable. Numbered CA-01, CA-02, ... -->
46
+ <!-- Requirements use SHALL/MUST (one per bullet, observable, no HOW); each
47
+ carries at least one GIVEN/WHEN/THEN, including the most-regretted edge. -->
42
48
  - CA-01 …
43
- - CA-02 …
49
+
50
+ ## Review checklist
51
+
52
+ <!-- Before implementation: intent matches; nothing extra; each requirement
53
+ testable with an exercising scenario; most-cared case covered;
54
+ tasks trace to requirements; you would sign if built exactly as written. -->
55
+ - [ ] …
44
56
 
45
57
  ## Decisions
46
58
 
@@ -0,0 +1,12 @@
1
+ # Workit contract
2
+
3
+ Workit keeps one accountable lead and one shared task state. Inspect current
4
+ task state before acting; use only the shared operations for task, policy,
5
+ evidence, finding, decision, worker, writer, and state changes. Authority is
6
+ bounded by the requested scope, current revision, caller/session provenance, and
7
+ observed capabilities. Never claim host enforcement or evidence that the host
8
+ cannot provide. Preserve unresolved requirements, gaps, and uncertain workers.
9
+
10
+ Focused methods are loaded only when the resolved policy requires them. A method
11
+ must call the shared operations and must not create a second lifecycle, approval
12
+ chain, or task-state representation.