@brainervirus/workit-opencode 0.8.4 → 0.8.6

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.
@@ -13,5 +13,6 @@ disable-model-invocation: true
13
13
  5. Pass only `message`; the tool itself recognizes an exact `--stay` flag and otherwise selects the new session.
14
14
  6. Report the structured success, failure stage, or partial result; never infer success.
15
15
  7. After any `workflow_handoff_session` result—success, partial, or failure—end the originating turn immediately after one status message. Never create todos, execute the plan inline, modify files, retry handoff, or call another tool.
16
+ 8. A destination run that executes the plan must still end with `workflow_plan_complete` (or the CLI `workit flow complete`) once the SDD ledger is complete and repository verification passes, and never finish the run while the plan is still `active`.
16
17
 
17
18
  Never emit a continuation prompt, use the clipboard, or ask the user to copy text. If selected, report the session ID only if the current session remains visible. If staying, report the seeded session ID. On failure, report `stage` and `error`; preserve any returned session for the session picker and never recreate it automatically. `todowrite` and `task` are unnecessary here.
@@ -34,8 +34,12 @@ For every plan task whose ID is absent from `completed_task_ids`:
34
34
  6. Dispatch separate `general` agents for spec-compliance review and code-quality review. **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 to `<SDD_DIR>/advisories.md` with the task id.
35
35
  7. Append the validated ledger line with `workflow_sdd_append_progress` using `confirmed: true`, then mark the task completed with `todowrite`.
36
36
 
37
+ 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.
38
+
37
39
  Never redispatch completed task IDs. Pass task briefs and review diffs to agents; do not make them reparse the plan. Keep commits on the in-place feature/bugfix branch.
38
40
 
39
41
  ## Final gate
40
42
 
41
43
  After all remaining tasks, dispatch a final full-branch code review, run `workflow_verify`, and report exact per-check results. 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. Only then may advisory fixes run. Use `workflow_git_context` for the final commit preview and the `wk-commit` skill for any approved commit. If a tracked stash reference exists, preview reapplication with `question`, then call `workflow_branch_setup` with `confirmed: true` only after approval.
44
+
45
+ **Mandatory:** end the run by calling `workflow_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 `workflow_verify` passes — a complete ledger and green verification are the tool's gates. Never finish the run while the plan is still `active`.
@@ -7,10 +7,10 @@ disable-model-invocation: true
7
7
  # Init
8
8
 
9
9
  1. Load this skill explicitly through OpenCode's `skill` tool.
10
- 2. Call the read-only `workflow_toolkit_init_status` context tool; its result is ground truth.
10
+ 2. Call the read-only `workit_init_status` context tool; its result is ground truth.
11
11
  3. Draft an exact preview of each missing scaffold and the active VCS provider.
12
12
  4. For each guarded mutation, use native `question` with concise choices and allow a custom answer.
13
- 5. Call `workflow_toolkit_init_apply` only after approval with `confirmed: true` and the chosen action.
13
+ 5. Call `workit_init_apply` only after approval with `confirmed: true` and the chosen action.
14
14
  6. Report the structured success, failure stage, or partial result; never infer success.
15
15
 
16
16
  Never ask for or accept tokens in chat. For missing YouTrack configuration, preview `youtrack_scaffold`; for missing VCS configuration, ask GitLab or GitHub, preview `vcs_scaffold`, and pass `vcs_provider`. Both provider token placeholders may be created, but identify which one is active. Show the returned token-create URL and local edit path after apply. Verification remains a separate `wk-status` run. `todowrite` and `task` are unnecessary here.
@@ -24,8 +24,8 @@ When the user wants to personalize the toolkit (locale, timezone, branch policy)
24
24
  3. **Branch policy preset** — gitflow / github-flow / trunk-based / custom.
25
25
  4. **Custom branch lists** (only when preset = custom): allowed patterns (`feature/*`, `codex/*`, …) and protected names (`main`, …).
26
26
 
27
- Then call `workflow_toolkit_init_apply` with `action: "config"`, `confirmed: true`, and the answered values. Report the written `config.json` path and its contents.
27
+ Then call `workit_init_apply` with `action: "config"`, `confirmed: true`, and the answered values. Report the written `config.json` path and its contents.
28
28
 
29
- After config, call `workflow_toolkit_init_apply` with `action: "gitignore"` and `confirmed: true` to ensure the project `.gitignore` covers `docs/*/sdd/` and common OS/editor entries (creates it if missing, preserves existing entries).
29
+ After config, call `workit_init_apply` with `action: "gitignore"` and `confirmed: true` to ensure the project `.gitignore` covers `docs/*/sdd/` and common OS/editor entries (creates it if missing, preserves existing entries).
30
30
 
31
- After gitignore, call `workflow_toolkit_init_apply` with `action: "hygiene"`, `confirmed: true`, and `include_open_source: true` for open-source repos — creates CHANGELOG.md (Keep a Changelog), README.md, .editorconfig, .gitattributes, and optionally LICENSE + CONTRIBUTING.md. Never overwrites existing files.
31
+ After gitignore, call `workit_init_apply` with `action: "hygiene"`, `confirmed: true`, and `include_open_source: true` for open-source repos — creates CHANGELOG.md (Keep a Changelog), README.md, .editorconfig, .gitattributes, and optionally LICENSE + CONTRIBUTING.md. Never overwrites existing files.
@@ -7,10 +7,10 @@ disable-model-invocation: true
7
7
  # Status
8
8
 
9
9
  1. Load this skill explicitly through OpenCode's `skill` tool.
10
- 2. Call the read-only `workflow_toolkit_status` context tool once; its result is ground truth.
10
+ 2. Call the read-only `workit_status` context tool once; its result is ground truth.
11
11
  3. Draft the health report from structured facts.
12
12
  4. This workflow has no guarded mutation and does not need `question`.
13
13
  5. Do not call any mutation tool.
14
14
  6. Report the structured success, failure stage, or partial result; never infer success.
15
15
 
16
- Show every `items[]` result, the resolved YouTrack settings and verification, the VCS provider and verification, and the exact `ready` verdict. For placeholders, point to the returned token creation and edit paths; never request tokens in chat. Use only `workflow_toolkit_status` and report its structured state. Do not run shell, Git, direct HTTP, isolated token verification, or any mutation. `todowrite` and `task` are unnecessary for this read-only workflow.
16
+ Show every `items[]` result, the resolved YouTrack settings and verification, the VCS provider and verification, and the exact `ready` verdict. For placeholders, point to the returned token creation and edit paths; never request tokens in chat. Use only `workit_status` and report its structured state. Do not run shell, Git, direct HTTP, isolated token verification, or any mutation. `todowrite` and `task` are unnecessary for this read-only workflow.
@@ -59,6 +59,8 @@ For each top-level task absent from `completed_task_ids`:
59
59
 
60
60
  Run a separate full-branch code review, then `workflow_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 `workflow_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 `workflow_branch_setup` with `confirmed: true` after approval.
61
61
 
62
+ **Mandatory:** end the run by calling `workflow_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 `workflow_verify` passes — a complete ledger and green verification are the tool's gates. Never finish the run while the plan is still `active`.
63
+
62
64
  ## Task order
63
65
 
64
66
  <TASK_LIST>
@@ -9,6 +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 `workflow_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
14
  - <project-wide requirements, one line each>
13
15
 
14
16
  ---
@@ -63,6 +63,7 @@ digraph process {
63
63
  "Read plan, note context and global constraints, create todos" [shape=box];
64
64
  "More tasks remain?" [shape=diamond];
65
65
  "Dispatch final code reviewer subagent (../requesting-code-review/code-reviewer.md)" [shape=box];
66
+ "Run verification, then workflow_plan_complete once the ledger is complete and verification passes" [shape=box];
66
67
  "Use superpowers:finishing-a-development-branch" [shape=box style=filled fillcolor=lightgreen];
67
68
 
68
69
  "Read plan, note context and global constraints, create todos" -> "Dispatch implementer subagent (./implementer-prompt.md)";
@@ -78,10 +79,13 @@ digraph process {
78
79
  "Mark task complete in todo list and progress ledger" -> "More tasks remain?";
79
80
  "More tasks remain?" -> "Dispatch implementer subagent (./implementer-prompt.md)" [label="yes"];
80
81
  "More tasks remain?" -> "Dispatch final code reviewer subagent (../requesting-code-review/code-reviewer.md)" [label="no"];
81
- "Dispatch final code reviewer subagent (../requesting-code-review/code-reviewer.md)" -> "Use superpowers:finishing-a-development-branch";
82
+ "Dispatch final code reviewer subagent (../requesting-code-review/code-reviewer.md)" -> "Run verification, then workflow_plan_complete once the ledger is complete and verification passes";
83
+ "Run verification, then workflow_plan_complete once the ledger is complete and verification passes" -> "Use superpowers:finishing-a-development-branch";
82
84
  }
83
85
  ```
84
86
 
87
+ **Mandatory completion:** after the final whole-branch review, run repository verification. Once the SDD ledger is complete and verification passes, end the run by calling `workflow_plan_complete` (or the CLI `workit flow complete`) — a complete ledger and green verification are the tool's gates. Never finish while the plan is still `active`.
88
+
85
89
  ## Pre-Flight Plan Review
86
90
 
87
91
  Before dispatching Task 1, scan the plan once for conflicts:
@@ -257,6 +261,10 @@ a ledger file, not only in todos.
257
261
  - When a task's review comes back clean, append one line to the ledger in
258
262
  the same message as your other bookkeeping:
259
263
  `Task N: complete (commits <base7>..<head7>, review clean)`.
264
+ - Each task produces exactly one contiguous non-empty commit range: fix
265
+ rounds append commits to it, never amend or rewrite an active review
266
+ range, and the ledger progress line records the task's real base..head
267
+ shas.
260
268
  - The ledger is your recovery map: the commits it names exist in git even
261
269
  when your context no longer remembers creating them. After compaction,
262
270
  trust the ledger and `git log` over your own recollection.
package/dist/plugin.js CHANGED
@@ -316,9 +316,9 @@ var compiledOpenCodeSections = () => {
316
316
 
317
317
  // packages/workit-opencode/src/bootstrap.ts
318
318
  var root = fileURLToPath(new URL("../assets/", import.meta.url));
319
- var marker = "<workflow-toolkit-contract>";
319
+ var marker = "<workit-contract>";
320
320
  var cached;
321
- var loadWorkflowBootstrap = (rootDir) => {
321
+ var loadWorkitBootstrap = (rootDir) => {
322
322
  const contractPath = path3.join(rootDir, "templates", "superpowers-doc-contract.md");
323
323
  try {
324
324
  return readFileSync3(contractPath, "utf8");
@@ -326,10 +326,10 @@ var loadWorkflowBootstrap = (rootDir) => {
326
326
  return null;
327
327
  }
328
328
  };
329
- var getWorkflowBootstrap = () => {
329
+ var getWorkitBootstrap = () => {
330
330
  if (cached !== undefined)
331
331
  return cached;
332
- const contract = loadWorkflowBootstrap(root);
332
+ const contract = loadWorkitBootstrap(root);
333
333
  if (contract === null) {
334
334
  cached = null;
335
335
  return null;
@@ -364,7 +364,7 @@ On success, use native \`question\` with exactly: Subagent-driven, Inline, Hando
364
364
  When the user asks about a library, framework, or API reference, prefer live docs (e.g. Context7 MCP \`resolve-library-id\` + \`query-docs\`) over training-data guesses.
365
365
  ${userSections ? `
366
366
  ${userSections}
367
- ` : ""}</workflow-toolkit-contract>`;
367
+ ` : ""}</workit-contract>`;
368
368
  return cached;
369
369
  };
370
370
 
@@ -1132,7 +1132,7 @@ function isWorkitPlugin(value) {
1132
1132
  const pkgPath = s.includes("/packages/workit-opencode/") || s.includes("/packages/workit-cursor/") || s.includes("/node_modules/@brainervirus/workit-opencode/") || s.includes("/node_modules/@brainervirus/workit-cursor/");
1133
1133
  return named(s, "workflow-toolkit") || named(s, "workflow-toolkit-opencode") || named(s, "local/workflow-toolkit") || named(s, "workit") || named(s, "local/workit") || named(s, "@brainervirus/workit-opencode") || named(s, "@brainervirus/workit-cursor") || url && pkgPath || s.startsWith("git+file://") && s.includes("workflow-toolkit");
1134
1134
  }
1135
- var CURSOR_RUNTIME_PACKAGE = "@brainervirus/workit-cursor@0.8.0";
1135
+ var CURSOR_RUNTIME_PACKAGE = "@brainervirus/workit-cursor@0.8.5";
1136
1136
  function cursorHooksEntry(_packageDir) {
1137
1137
  return {
1138
1138
  command: `npx -y --package=${CURSOR_RUNTIME_PACKAGE} workit-cursor-session-start`,
@@ -1538,6 +1538,18 @@ var registeredCursorHook = (res) => {
1538
1538
  return "invalid";
1539
1539
  return typeof entry.command === "string" ? entry.command : "invalid";
1540
1540
  };
1541
+ var validLocalDistHook = (command, res) => {
1542
+ const m = /^node\s+(.+)$/.exec(command.trim());
1543
+ if (!m)
1544
+ return false;
1545
+ const entry = m[1].trim();
1546
+ if (!path10.isAbsolute(entry))
1547
+ return false;
1548
+ if (path10.resolve(entry) !== path10.resolve(path10.join(res.cursorPluginDir, "dist", "cursor-session-start.js"))) {
1549
+ return false;
1550
+ }
1551
+ return validNodeEntry(entry, "node", res.env);
1552
+ };
1541
1553
  var checkLauncher = (res) => {
1542
1554
  const dev = res.dev;
1543
1555
  const hosts = hostsFor(res.host);
@@ -1553,7 +1565,7 @@ var checkLauncher = (res) => {
1553
1565
  const hook = registeredCursorHook(res);
1554
1566
  if (hook === "invalid") {
1555
1567
  missing.push(`cursor: canonical session-start hook in ${path10.join(res.cursorPluginDir, "hooks", "hooks-cursor.json")}`);
1556
- } else if (hook !== null && hook !== canonicalCursorHook) {
1568
+ } else if (hook !== null && hook !== canonicalCursorHook && !validLocalDistHook(hook, res)) {
1557
1569
  missing.push(`cursor: canonical session-start hook in ${path10.join(res.cursorPluginDir, "hooks", "hooks-cursor.json")} (registered ${hook})`);
1558
1570
  }
1559
1571
  }
@@ -3284,7 +3296,7 @@ function initStatusData(configDirPath = configDir()) {
3284
3296
  ok: fs4.existsSync(ytJson) && youtrackConfig !== null && !("error" in youtrackConfig),
3285
3297
  path: fs4.existsSync(ytJson) ? resolvePath(ytJson) : path16.resolve(ytJson),
3286
3298
  config_edit_path: resolvePath(ytJson),
3287
- fix: "workflow_toolkit_init_apply action=youtrack_scaffold"
3299
+ fix: "workit_init_apply action=youtrack_scaffold"
3288
3300
  });
3289
3301
  const ytTokenPath = youtrackConfig?.tokenFile ?? path16.join(configDirPath, "youtrack.token");
3290
3302
  const tokenText = fs4.existsSync(ytTokenPath) ? fs4.readFileSync(ytTokenPath, "utf8").trim() : "";
@@ -3347,7 +3359,7 @@ function initStatusData(configDirPath = configDir()) {
3347
3359
  ok: fs4.existsSync(vcsJson) && vcsCfg !== null && !("error" in vcsCfg),
3348
3360
  path: fs4.existsSync(vcsJson) ? resolvePath(vcsJson) : path16.resolve(vcsJson),
3349
3361
  config_edit_path: resolvePath(vcsJson),
3350
- fix: "workflow_toolkit_init_apply action=vcs_scaffold"
3362
+ fix: "workit_init_apply action=vcs_scaffold"
3351
3363
  });
3352
3364
  const provActive = vcsCfg && !("error" in vcsCfg) ? vcsCfg.provider : null;
3353
3365
  const tokenItem = (tid, label, rawPath, providerKey) => {
@@ -4352,8 +4364,13 @@ function sddReviewPackage({
4352
4364
  const contained = resolveDocsPath({ workspace_root, path: sdd_dir });
4353
4365
  if (!contained.ok)
4354
4366
  return { error: contained.error };
4367
+ if (base_sha === head_sha) {
4368
+ return {
4369
+ error: `empty commit range (base_sha ${base_sha} === head_sha ${head_sha}): nothing to review`,
4370
+ code: "empty_commit_range"
4371
+ };
4372
+ }
4355
4373
  const dir = contained.path;
4356
- mkdirSync8(dir, { recursive: true });
4357
4374
  const base7 = base_sha.slice(0, 7);
4358
4375
  const head7 = head_sha.slice(0, 7);
4359
4376
  const diffPath = path19.join(dir, `review-${base7}..${head7}.diff`);
@@ -4363,6 +4380,13 @@ function sddReviewPackage({
4363
4380
  encoding: "utf8",
4364
4381
  stdio: ["pipe", "pipe", "pipe"]
4365
4382
  });
4383
+ if (diff.trim() === "") {
4384
+ return {
4385
+ error: `empty commit range (${base_sha}..${head_sha}): diff is empty, nothing to review`,
4386
+ code: "empty_commit_range"
4387
+ };
4388
+ }
4389
+ mkdirSync8(dir, { recursive: true });
4366
4390
  writeFileSync10(diffPath, diff, "utf8");
4367
4391
  const rel = posix2(path19.relative(contained.base, diffPath));
4368
4392
  return { diff_path: rel, base_sha, head_sha, base7, head7 };
@@ -4370,7 +4394,7 @@ function sddReviewPackage({
4370
4394
  return { error: error instanceof Error ? error.message : "git diff failed" };
4371
4395
  }
4372
4396
  }
4373
- var PROGRESS_RE = /^Task\s+\d+:\s+complete\s+\(commits\s+[0-9a-f]{7,40}\.\.[0-9a-f]{7,40},/i;
4397
+ var PROGRESS_RE = /^Task\s+\d+:\s+complete\s+\(commits\s+([0-9a-f]{7,40})\.\.([0-9a-f]{7,40}),/i;
4374
4398
  function sddAppendProgress({
4375
4399
  progress_path,
4376
4400
  line,
@@ -4381,7 +4405,8 @@ function sddAppendProgress({
4381
4405
  return { error: contained.error };
4382
4406
  const path_ = contained.path;
4383
4407
  const trimmed = line.trim();
4384
- if (!PROGRESS_RE.test(trimmed)) {
4408
+ const match = PROGRESS_RE.exec(trimmed);
4409
+ if (!match || match[1].toLowerCase() === match[2].toLowerCase()) {
4385
4410
  return { error: "invalid progress line format" };
4386
4411
  }
4387
4412
  if (existsSync12(path_) && statSync5(path_).isDirectory()) {
@@ -6117,7 +6142,7 @@ var COORDINATOR_WRITE_TOOLS = [
6117
6142
  "workflow_template_edit",
6118
6143
  "workflow_changelog_apply",
6119
6144
  "workflow_branch_setup",
6120
- "workflow_toolkit_init_apply",
6145
+ "workit_init_apply",
6121
6146
  "workflow_docs_promote",
6122
6147
  "workflow_docs_layout",
6123
6148
  "workflow_docs_repo_link",
@@ -19470,12 +19495,12 @@ function createRepoTools(runtime = defaultRuntime) {
19470
19495
  return output(scriptResult(await runContext(root2, value), parse5));
19471
19496
  };
19472
19497
  return {
19473
- workflow_toolkit_init_status: tool({
19498
+ workit_init_status: tool({
19474
19499
  description: "Inspect toolkit initialization",
19475
19500
  args: {},
19476
19501
  execute: async (_input, context2) => output(scriptResult(await runtime.initStatus(context2.directory), json2))
19477
19502
  }),
19478
- workflow_toolkit_status: tool({
19503
+ workit_status: tool({
19479
19504
  description: "Inspect toolkit and repository state",
19480
19505
  args: {},
19481
19506
  execute: async (_input, context2) => output(scriptResult(await runtime.toolkitStatus(context2.directory), json2))
@@ -19623,7 +19648,7 @@ function createRepoTools(runtime = defaultRuntime) {
19623
19648
  })));
19624
19649
  }
19625
19650
  }),
19626
- workflow_toolkit_init_apply: tool({
19651
+ workit_init_apply: tool({
19627
19652
  description: "Apply a confirmed toolkit initialization action",
19628
19653
  args: {
19629
19654
  confirmed: tool.schema.boolean(),
@@ -22074,8 +22099,8 @@ var plugin = async ({ client, directory }) => {
22074
22099
  const firstAnchor = firstUser.parts.find((part) => part.type === "text") ?? firstUser.parts[0];
22075
22100
  const firstText = firstUser.parts.filter((part) => part.type === "text").map((part) => part.text ?? "").join(`
22076
22101
  `);
22077
- const bootstrap = getWorkflowBootstrap();
22078
- if (bootstrap && !firstText.includes("<workflow-toolkit-contract>")) {
22102
+ const bootstrap = getWorkitBootstrap();
22103
+ if (bootstrap && !firstText.includes("<workit-contract>")) {
22079
22104
  firstUser.parts.unshift({
22080
22105
  id: firstAnchor.id,
22081
22106
  sessionID: firstAnchor.sessionID,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-opencode",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "private": false,
5
5
  "description": "Workit OpenCode plugin (thin wrapper over @brainervirus/workit-core)",
6
6
  "keywords": [
@@ -34,7 +34,7 @@
34
34
  "typecheck": "tsc --noEmit"
35
35
  },
36
36
  "dependencies": {
37
- "@brainervirus/workit-core": "^0.8.4"
37
+ "@brainervirus/workit-core": "^0.8.6"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@opencode-ai/plugin": "1.17.7"