@brainervirus/workit-opencode 6.0.0 → 7.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,90 +1,35 @@
1
1
  # @brainervirus/workit-opencode
2
2
 
3
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-opencode.svg)](https://www.npmjs.com/package/@brainervirus/workit-opencode)
5
- [![license: MIT](https://img.shields.io/badge/license-MIT-green.svg)](../../LICENSE)
4
+ [![npm](https://img.shields.io/npm/v/@brainervirus/workit-opencode.svg)](https://www.npmjs.com/package/@brainervirus/workit-opencode)
5
+ [![license: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/BrainerVirus/workit/blob/main/LICENSE)
6
6
 
7
- OpenCode plugin for Workit — optional coordination, policy, delegation, handoff, and read-only context. Native OpenCode tools execute Git, hosting, YouTrack and documentation effects.
7
+ [Workit](https://github.com/BrainerVirus/workit) for OpenCode 2.0.18+: the seven task families,
8
+ read-only `workit_context` and `workit_init_apply` as native tools, the
9
+ eleven method skills with `/wk-*` commands, direct-child delegation, and
10
+ context injection on session start and after compaction. Requires Node.js 24+.
8
11
 
9
- ## Install
10
-
11
- ```jsonc
12
- // opencode.json / opencode.jsonc
12
+ ```json
13
13
  {
14
14
  "$schema": "https://opencode.ai/config.json",
15
15
  "plugins": ["@brainervirus/workit-opencode"]
16
16
  }
17
17
  ```
18
18
 
19
- OpenCode 2.x reads `"plugins"` and still normalizes the older `"plugin"` key.
20
-
21
- Local dev variant (absolute path to this repo):
22
-
23
- ```jsonc
24
- {
25
- "$schema": "https://opencode.ai/config.json",
26
- "plugins": ["file:///path/to/workit/packages/workit-opencode"]
27
- }
28
- ```
29
-
30
- Requirements: OpenCode 2.0.18+, Node ≥ 24. The published plugin is a
31
- self-contained Node bundle whose default export is the V2 plugin definition
32
- (`{ id: "workit", setup }`). Workit 3.0 removed the OpenCode 1.x `server()`
33
- adapter; OpenCode 1.x hosts must stay on Workit 2.x by pinning
34
- `"plugin": ["@brainervirus/workit-opencode@2"]` (the V1 key) until they upgrade
35
- OpenCode.
36
-
37
- ## What it provides
38
-
39
- - **Seven native operation tools** — `workit_task`, `workit_policy`, `workit_evidence`, `workit_finding`, `workit_decision`, `workit_worker`, and `workit_state`.
40
- - **Read-only context and init tools** — `workit_context` accepts `{ "kind": "git" }` and the existing PR/YouTrack/changelog/release/affected context fields; `workit_init_apply` keeps confirmed configuration initialization.
41
- - **Eleven policy-selected method skills** — shape, implement, review, debug, ship, continue, bdd, test-audit,
42
- deslop, fanout, and verify-app.
43
- - **Native lifecycle hooks** — direct-child task workers and compact task bootstrap/restoration. Workit registers no question hooks.
19
+ Local checkout: run `bun packages/workit-opencode/scripts/build.ts`, then pin
20
+ `"file:///path/to/workit/packages/workit-opencode"`. OpenCode 1.x must stay on
21
+ `"plugin": ["@brainervirus/workit-opencode@2"]`.
44
22
 
45
- ## Host-native behavior
46
-
47
- - **Delegation** — native `task` workers are direct-child-only; nested or uncertain lineage is denied (`delegation_lineage_denied`).
48
- - **Continuity** — compact task context carries the newest decisions and bounded redacted choice summaries, injected once on session start and once after compaction; unobservable shell surfaces are labeled `agent_guided`.
49
-
50
- Workit does not register `workit_external_action` on OpenCode.
51
- Use native tools for mutations under the host permissions and target conventions;
52
- no Workit task or decision is needed merely to run an ordinary command. Decisions
53
- are durable records that satisfy decision requirements; they never authorize an
54
- effect. Delivery limits come from OpenCode permissions plus the workspace
55
- autonomy grants (`workit grant show`).
56
- Old action/decision history is preserved. Inspect and reconcile any uncertain
57
- effect before retrying; removal does not settle or migrate it.
58
-
59
- ## Upgrade from Workit 1.x
60
-
61
- Workit 2.0 removes the managed external-action tool on both OpenCode versions.
62
- Use native host tools for mutations and `workit_context` for read-only context.
63
- Existing task and action history remains untouched; reconcile uncertain effects
64
- before retrying them.
65
-
66
- ## Bundle / runtime model
67
-
68
- The build bundles the `@opencode/plugin` SDK surface used by the adapter into `dist/plugin.js`, so the published plugin has **no** runtime dependency on the SDK (it stays a development/build-only pin). The plugin loads through its real package entry `dist/plugin.js`; only the eleven method skills ship under `assets/`.
69
-
70
- The plugin registers nine tools (the seven families, `workit_context` and
71
- `workit_init_apply`) with `codemode: false`, the eleven
72
- skills and up to eleven `wk-*` commands. Existing user skills and commands
73
- are preserved; an alias is added only when its Workit skill is registered. It
74
- also provides direct-child subagent
75
- lineage with durable dispatch claims, and bootstrap/task/worker context plus
76
- compaction injection. Its shell
77
- permission hook adds branch-name policy denials for direct, unquoted literal
78
- branch-creation forms only. It leaves compliant branches, PR and worktree
79
- commands, and unsupported shell syntax to OpenCode's native permission rules.
80
-
81
- ## Package scripts
23
+ Effects (git, forge, files) run through OpenCode's native tools and the
24
+ `workit` CLI under OpenCode permissions plus the workspace
25
+ [grants](https://github.com/BrainerVirus/workit/blob/main/docs/guides/grants.md). The permission hook denies direct, unquoted
26
+ branch-creation commands that break the naming policy, and edits or
27
+ recognizable shell writes while the branch task has an open product choice or
28
+ needs a plan ([before-write gate](https://github.com/BrainerVirus/workit/blob/main/docs/guides/verification.md)). Tools take flat
29
+ fields. Details:
30
+ [hosts guide](https://github.com/BrainerVirus/workit/blob/main/docs/guides/hosts.md#opencode).
82
31
 
83
32
  ```bash
84
- bun run build # bundle dist/plugin.js + assets
85
- bun run typecheck # tsc --noEmit
33
+ bun run build # bundle dist/plugin.js (self-contained, no runtime SDK dependency)
34
+ bun run typecheck
86
35
  ```
87
-
88
- ## Docs
89
-
90
- Full usage: https://github.com/BrainerVirus/workit#readme
@@ -22,7 +22,7 @@ behavior. A change that wants new behavior is its own change.
22
22
  validator that changes behavior is not deslop.
23
23
  5. **Re-run the checks** and report lines removed, not lines written. Nothing
24
24
  to clean is a valid result: say what you checked ("0 removals; ran knip and
25
- read the diff"). When a tracked task lists a `pre-pr-cleanup` requirement,
25
+ read the diff"). When a tracked task lists a `pre-pr-cleanup` requirement (≤6.x tasks),
26
26
  record this result as its evidence.
27
27
 
28
28
  ## Example
@@ -11,6 +11,9 @@ description: Build a requested change in small verified steps - follow local pat
11
11
  neighbour that already does something similar. Copy its patterns, names and
12
12
  error handling. Repo rules (AGENTS.md, CLAUDE.md, lint config) win.
13
13
  2. On the default branch? Branch first: `workit git branch --kind feature --slug <s>`.
14
+ Tracking it? Judge once: `workit policy assess --judge risk=normal
15
+ behavior=yes product-choice=no plan=no` (trivial and no for a mechanical
16
+ fix); Workit derives what close needs.
14
17
  3. Small steps that each leave the tree green. Behavior change: write the
15
18
  acceptance as Given/When/Then and see a test fail first (workit-bdd).
16
19
  Mechanical change: the existing checks are enough.
@@ -24,10 +27,12 @@ description: Build a requested change in small verified steps - follow local pat
24
27
  PR (`workit git push`, `workit pr create --fill`, then workit-ship) only when
25
28
  that was requested, or the request implies delivery and `workit grant show`
26
29
  reports `defaultEndpoint` `pr`; otherwise the endpoint is `commit`.
27
- 7. Hand off verification. Never record a passing verdict on your own work.
28
- Start a fresh verifier with its own session (`WORKIT_SESSION_ID=<yours>-v1`;
29
- Claude Code: the `verifier` agent, which the hook gives one); it runs
30
- verify-<app> and `workit ledger verdict`. Before saying done, reconcile
30
+ 7. Verify. Normal risk: after `workit check test` passes, record your own
31
+ `workit ledger verdict tests-verified --self --how "<what you ran>"`; it
32
+ reads self-reviewed, never verified. High risk, a workspace with
33
+ `verification: independent` (`workit grant show`) or a verified merge needs
34
+ a fresh verifier with its own session (`WORKIT_SESSION_ID=<yours>-v1`;
35
+ Claude Code: the `verifier` agent). Before saying done, reconcile
31
36
  every named deliverable against the target checkout and observe it (for a push:
32
37
  `workit verify-delivery push`).
33
38
 
@@ -8,6 +8,8 @@ description: Independent review of a diff, branch or PR - intent fidelity and st
8
8
  Review the candidate, never the author's summary of it. A session that wrote a
9
9
  commit on the branch cannot record a passing verdict: if that is you, hand the
10
10
  review to a fresh agent (Claude Code: the `reviewer` or `verifier` agent).
11
+ An author's `--self` verdict reads self-reviewed and never counts as
12
+ independent; `type-check-only` never proves a behavior change.
11
13
 
12
14
  1. Pin the candidate: `git rev-parse HEAD`, the base, `git diff <base>...HEAD`;
13
15
  for a PR, `workit pr status --json` (checks, unresolved threads).
@@ -43,7 +43,7 @@ a choice that is hard to reverse, surprising and a real trade-off; a glossary
43
43
  entry for a term you had to resolve; `.out-of-scope/<concept>.md` for a rejected
44
44
  request that will come back. A one-file mechanical fix gets none. Formats and
45
45
  triggers: `references/knowledge.md`. Record each settled choice once:
46
- `workit ledger decision "<what>" --why "<why>"`.
46
+ `workit ledger decision "<what>" --why "<why>"`; cite a plan: `workit policy assess --ref <path>`.
47
47
 
48
48
  ## 5. Slice as tracer bullets
49
49
 
@@ -33,7 +33,7 @@ merge: Stop at PR-ready unless the user set merge as the endpoint.
33
33
  `workit ci rerun --failed --reason flake` (once per head). Real: reproduce
34
34
  with `workit check`, fix the root cause, batch fixes into one push.
35
35
  6. **Verified.** After the last push a non-author records a verdict
36
- (workit-review). Land only when granted: `workit stack land` (the
36
+ (workit-review); `pr status` showing self-reviewed is not verified. Land only when granted: `workit stack land` (the
37
37
  contiguous verified run from the root) or `workit pr merge`.
38
38
  7. **Observe it landed:** `workit verify-delivery pr` or `merge`.
39
39