@brainervirus/workit-claude-code 8.40.2 → 8.40.3

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/dist/workit.js CHANGED
@@ -9317,7 +9317,7 @@ var package_default;
9317
9317
  var init_package = __esm(() => {
9318
9318
  package_default = {
9319
9319
  name: "@brainervirus/workit-cli",
9320
- version: "8.40.2",
9320
+ version: "8.40.3",
9321
9321
  private: false,
9322
9322
  description: "Workit CLI — setup wizard, doctor, and task control for agentic coding workflows",
9323
9323
  keywords: [
@@ -9355,13 +9355,13 @@ var init_package = __esm(() => {
9355
9355
  },
9356
9356
  dependencies: {
9357
9357
  "@babel/parser": "7.29.9",
9358
- "@brainervirus/workit-cursor": "^8.40.2",
9358
+ "@brainervirus/workit-cursor": "^8.40.3",
9359
9359
  "@inkjs/ui": "2.0.0",
9360
9360
  ink: "7.1.1",
9361
9361
  react: "19.2.8"
9362
9362
  },
9363
9363
  devDependencies: {
9364
- "@brainervirus/workit-core": "^8.40.2"
9364
+ "@brainervirus/workit-core": "^8.40.3"
9365
9365
  },
9366
9366
  engines: {
9367
9367
  node: ">=24"
@@ -19011,8 +19011,97 @@ var init_policy_resolver = __esm(() => {
19011
19011
  init_derive();
19012
19012
  });
19013
19013
 
19014
- // packages/workit-core/src/core/task-engine.ts
19014
+ // packages/workit-core/src/core/task-view.ts
19015
19015
  import { realpathSync as realpathSync4 } from "node:fs";
19016
+ function contextRootError(store, context) {
19017
+ try {
19018
+ realpathSync4(context.root);
19019
+ const root = checkoutRootOf(context.root);
19020
+ if (root !== store.root && !sameDirectoryIdentity(root, store.root))
19021
+ return failure2("invalid_input", "operation context root does not match the task store root");
19022
+ } catch {
19023
+ return failure2("invalid_input", "operation context root cannot be resolved");
19024
+ }
19025
+ return success(null, null, null);
19026
+ }
19027
+ function helperEntry(task, context, requireSession = false, requireActive = false) {
19028
+ const workerId = context.workerId ?? null;
19029
+ if (workerId === null)
19030
+ return failure2("permission_denied", "operation is lead-only");
19031
+ const worker = task.workers.find((entry) => entry.id === workerId);
19032
+ if (!worker)
19033
+ return failure2("permission_denied", "worker is not assigned to this task");
19034
+ if (worker.data.session && !sameSession2(worker.data.session, context))
19035
+ return failure2("permission_denied", "worker session does not match the caller");
19036
+ if (requireSession && (!worker.data.session || !sameSession2(worker.data.session, context)))
19037
+ return failure2("permission_denied", "worker session has not been observed");
19038
+ if (requireActive && worker.data.state !== "running")
19039
+ return failure2("permission_denied", "worker is not active");
19040
+ return success(null, null, worker);
19041
+ }
19042
+ function helperTaskGuard(task, context, allowRead = false) {
19043
+ if ((context.workerId ?? null) === null)
19044
+ return success(null, null, null);
19045
+ const worker = helperEntry(task, context);
19046
+ if (!worker.ok)
19047
+ return worker;
19048
+ return allowRead ? success(null, null, null) : failure2("permission_denied", "helpers cannot control task lifecycle or scope");
19049
+ }
19050
+ function taskView(store, context, task, capture = true, freshness = treeFreshness(store.root)) {
19051
+ const workspace = store.readWorkspace();
19052
+ if (!workspace.ok)
19053
+ return workspace;
19054
+ if (!workspace.data)
19055
+ return failure2("not_found", "workspace not found");
19056
+ const historical = task.status === "closed" ? task.candidates.at(-1) : undefined;
19057
+ const current = historical ? success(null, null, historical) : capture ? captureCandidate(store.root, task.intent.data.scope, environment()) : success(null, null, task.candidates.at(-1) ?? null);
19058
+ if (!current.ok)
19059
+ return current;
19060
+ const evaluationWorkspace = workspace.data;
19061
+ const tree = freshness;
19062
+ const requirements = evaluateRequirements(task, evaluationWorkspace, context.capabilities, current.data, store.root, context.caller, tree);
19063
+ return success(task.revision, workspace.data.revision, {
19064
+ task,
19065
+ workspace: evaluationWorkspace,
19066
+ capabilities: context.capabilities,
19067
+ requirements,
19068
+ evidence: evaluateEvidence(task, current.data, tree)
19069
+ });
19070
+ }
19071
+ function compactContext(store, context, taskId, freshness, origin = null) {
19072
+ const root = contextRootError(store, context);
19073
+ if (!root.ok)
19074
+ return root;
19075
+ const base = origin && store.readStoreTask(origin.taskId);
19076
+ const inherited = base?.ok && base.data ? {
19077
+ origin: origin.origin,
19078
+ taskId: base.data.id,
19079
+ decisions: base.data.decisions.filter((entry) => entry.data.revoked === null)
19080
+ } : null;
19081
+ if (taskId === null)
19082
+ return success(null, null, inherited?.decisions.length ? compactTaskContext(null, inherited) : "");
19083
+ const task = store.readTask(taskId);
19084
+ if (!task.ok)
19085
+ return task;
19086
+ const helper = helperTaskGuard(task.data, context, true);
19087
+ if (!helper.ok)
19088
+ return helper;
19089
+ const view = taskView(store, context, task.data, false, freshness ?? signalFreshness(store.root));
19090
+ if (!view.ok)
19091
+ return view;
19092
+ return success(view.revision, view.workspaceRevision, compactTaskContext(view.data, inherited));
19093
+ }
19094
+ var environment = () => [], sameSession2 = (value, context) => typeof value === "object" && value !== null && value.kind === "host" && value.host === context.caller.host && value.handle === context.caller.actor;
19095
+ var init_task_view = __esm(() => {
19096
+ init_task_contract();
19097
+ init_paths();
19098
+ init_task_store();
19099
+ init_task_context();
19100
+ init_task_evaluation();
19101
+ });
19102
+
19103
+ // packages/workit-core/src/core/task-engine.ts
19104
+ import { realpathSync as realpathSync5 } from "node:fs";
19016
19105
 
19017
19106
  class WorkitCore {
19018
19107
  store;
@@ -19026,15 +19115,7 @@ class WorkitCore {
19026
19115
  return this.context.workerId !== null && this.context.workerId !== undefined;
19027
19116
  }
19028
19117
  contextRootError() {
19029
- try {
19030
- realpathSync4(this.context.root);
19031
- const root = checkoutRootOf(this.context.root);
19032
- if (root !== this.store.root && !sameDirectoryIdentity(root, this.store.root))
19033
- return failure2("invalid_input", "operation context root does not match the task store root");
19034
- } catch {
19035
- return failure2("invalid_input", "operation context root cannot be resolved");
19036
- }
19037
- return success(null, null, null);
19118
+ return contextRootError(this.store, this.context);
19038
19119
  }
19039
19120
  fillRevisions(input, task, workspace) {
19040
19121
  if (input.expectedRevision === undefined && task)
@@ -19082,27 +19163,10 @@ class WorkitCore {
19082
19163
  return success(null, null, { ...request, taskId: found.data.task.id });
19083
19164
  }
19084
19165
  helperEntry(task, requireSession = false, requireActive = false) {
19085
- const workerId = this.context.workerId ?? null;
19086
- if (workerId === null)
19087
- return failure2("permission_denied", "operation is lead-only");
19088
- const worker = task.workers.find((entry) => entry.id === workerId);
19089
- if (!worker)
19090
- return failure2("permission_denied", "worker is not assigned to this task");
19091
- if (worker.data.session && !sameSession2(worker.data.session, this.context))
19092
- return failure2("permission_denied", "worker session does not match the caller");
19093
- if (requireSession && (!worker.data.session || !sameSession2(worker.data.session, this.context)))
19094
- return failure2("permission_denied", "worker session has not been observed");
19095
- if (requireActive && worker.data.state !== "running")
19096
- return failure2("permission_denied", "worker is not active");
19097
- return success(null, null, worker);
19166
+ return helperEntry(task, this.context, requireSession, requireActive);
19098
19167
  }
19099
19168
  helperTaskGuard(task, allowRead = false) {
19100
- if ((this.context.workerId ?? null) === null)
19101
- return success(null, null, null);
19102
- const worker = this.helperEntry(task);
19103
- if (!worker.ok)
19104
- return worker;
19105
- return allowRead ? success(null, null, null) : failure2("permission_denied", "helpers cannot control task lifecycle or scope");
19169
+ return helperTaskGuard(task, this.context, allowRead);
19106
19170
  }
19107
19171
  activeWorkerBlocker(task) {
19108
19172
  if (task.workers.some((entry) => workerBlocksTransition("close", entry.data.state)))
@@ -20012,48 +20076,10 @@ class WorkitCore {
20012
20076
  });
20013
20077
  }
20014
20078
  compactContext(taskId, freshness, origin = null) {
20015
- const root = this.contextRootError();
20016
- if (!root.ok)
20017
- return root;
20018
- const base = origin && this.store.readStoreTask(origin.taskId);
20019
- const inherited = base?.ok && base.data ? {
20020
- origin: origin.origin,
20021
- taskId: base.data.id,
20022
- decisions: base.data.decisions.filter((entry) => entry.data.revoked === null)
20023
- } : null;
20024
- if (taskId === null)
20025
- return success(null, null, inherited?.decisions.length ? compactTaskContext(null, inherited) : "");
20026
- const task = this.store.readTask(taskId);
20027
- if (!task.ok)
20028
- return task;
20029
- const helper = this.helperTaskGuard(task.data, true);
20030
- if (!helper.ok)
20031
- return helper;
20032
- const view = this.view(task.data, false, freshness ?? signalFreshness(this.store.root));
20033
- if (!view.ok)
20034
- return view;
20035
- return success(view.revision, view.workspaceRevision, compactTaskContext(view.data, inherited));
20079
+ return compactContext(this.store, this.context, taskId, freshness, origin);
20036
20080
  }
20037
- view(task, capture = true, freshness = treeFreshness(this.store.root)) {
20038
- const workspace = this.store.readWorkspace();
20039
- if (!workspace.ok)
20040
- return workspace;
20041
- if (!workspace.data)
20042
- return failure2("not_found", "workspace not found");
20043
- const historical = task.status === "closed" ? task.candidates.at(-1) : undefined;
20044
- const current = historical ? success(null, null, historical) : capture ? captureCandidate(this.store.root, task.intent.data.scope, environment()) : success(null, null, task.candidates.at(-1) ?? null);
20045
- if (!current.ok)
20046
- return current;
20047
- const evaluationWorkspace = workspace.data;
20048
- const tree = freshness;
20049
- const requirements = evaluateRequirements(task, evaluationWorkspace, this.context.capabilities, current.data, this.store.root, this.context.caller, tree);
20050
- return success(task.revision, workspace.data.revision, {
20051
- task,
20052
- workspace: evaluationWorkspace,
20053
- capabilities: this.context.capabilities,
20054
- requirements,
20055
- evidence: evaluateEvidence(task, current.data, tree)
20056
- });
20081
+ view(task, capture = true, freshness) {
20082
+ return taskView(this.store, this.context, task, capture, freshness);
20057
20083
  }
20058
20084
  reconcileResume(view, observations = []) {
20059
20085
  const root = this.contextRootError();
@@ -20064,7 +20090,7 @@ class WorkitCore {
20064
20090
  if (view.task.workspaceId !== view.workspace.id)
20065
20091
  return failure2("invalid_input", "task and workspace bindings are invalid");
20066
20092
  try {
20067
- if (realpathSync4(view.workspace.root) !== this.store.root)
20093
+ if (realpathSync5(view.workspace.root) !== this.store.root)
20068
20094
  return failure2("invalid_input", "task view root does not match the task store");
20069
20095
  } catch {
20070
20096
  return failure2("invalid_input", "task view root cannot be resolved");
@@ -20324,7 +20350,7 @@ var MAX_JUDGED_REFS = 5, workspaceVerification = (root) => {
20324
20350
  host: context.caller.host,
20325
20351
  session: { kind: "host", host: context.caller.host, handle: context.caller.actor },
20326
20352
  workerId: context.workerId ?? null
20327
- }), environment = () => [], sameSession2 = (value, context) => typeof value === "object" && value !== null && value.kind === "host" && value.host === context.caller.host && value.handle === context.caller.actor, verifiedWorkers, sameValue = (left, right) => {
20353
+ }), verifiedWorkers, sameValue = (left, right) => {
20328
20354
  try {
20329
20355
  return canonicalJson(left) === canonicalJson(right);
20330
20356
  } catch {
@@ -20643,8 +20669,7 @@ var init_task_engine = __esm(() => {
20643
20669
  init_ledger();
20644
20670
  init_rev();
20645
20671
  init_autonomy();
20646
- init_task_store();
20647
- init_paths();
20672
+ init_task_view();
20648
20673
  init_store_lock();
20649
20674
  init_task_context();
20650
20675
  init_workers();
@@ -21286,10 +21311,10 @@ var init_context_read = __esm(() => {
21286
21311
  });
21287
21312
 
21288
21313
  // packages/workit-core/src/core.ts
21289
- import { existsSync as existsSync8, realpathSync as realpathSync5 } from "node:fs";
21314
+ import { existsSync as existsSync8, realpathSync as realpathSync6 } from "node:fs";
21290
21315
  import path26 from "node:path";
21291
21316
  function resolveInside(root, candidate) {
21292
- const base = realpathSync5(root);
21317
+ const base = realpathSync6(root);
21293
21318
  const target = path26.resolve(base, candidate);
21294
21319
  if (target !== base && !target.startsWith(base + path26.sep)) {
21295
21320
  throw new Error("path must stay inside repository root");
@@ -21297,7 +21322,7 @@ function resolveInside(root, candidate) {
21297
21322
  let ancestor = target;
21298
21323
  while (!existsSync8(ancestor))
21299
21324
  ancestor = path26.dirname(ancestor);
21300
- const canonicalAncestor = realpathSync5(ancestor);
21325
+ const canonicalAncestor = realpathSync6(ancestor);
21301
21326
  if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path26.sep)) {
21302
21327
  throw new Error("path must stay inside repository root");
21303
21328
  }
@@ -66051,7 +66076,7 @@ import {
66051
66076
  existsSync as existsSync12,
66052
66077
  readFileSync as readFileSync13,
66053
66078
  readdirSync as readdirSync6,
66054
- realpathSync as realpathSync6,
66079
+ realpathSync as realpathSync7,
66055
66080
  statSync as statSync2
66056
66081
  } from "node:fs";
66057
66082
  import os9 from "node:os";
@@ -66491,7 +66516,7 @@ var resolveWindowsShimScript = (shim) => {
66491
66516
  return found;
66492
66517
  }, isClaudeWorkitInstalled = (home, env = process.env, cwd = process.cwd()) => claudeWorkitInstalls(home, env, cwd).length > 0, findNpmCli = (npm) => {
66493
66518
  try {
66494
- const resolved = realpathSync6(npm);
66519
+ const resolved = realpathSync7(npm);
66495
66520
  if (path33.basename(resolved) === "npm-cli.js")
66496
66521
  return resolved;
66497
66522
  } catch {}
@@ -66989,7 +67014,7 @@ import {
66989
67014
  readdirSync as readdirSync9,
66990
67015
  mkdirSync as mkdirSync7,
66991
67016
  readFileSync as readFileSync17,
66992
- realpathSync as realpathSync7,
67017
+ realpathSync as realpathSync8,
66993
67018
  rmSync as rmSync3,
66994
67019
  statSync as statSync5
66995
67020
  } from "node:fs";
@@ -67212,7 +67237,7 @@ function applyHostPermissions(plan, options = {}) {
67212
67237
  continue;
67213
67238
  }
67214
67239
  try {
67215
- const target = change.before === null ? change.file : realpathSync7(change.file);
67240
+ const target = change.before === null ? change.file : realpathSync8(change.file);
67216
67241
  if (change.before !== null) {
67217
67242
  const backups = path38.join(paths.stateDir, "host-permissions-backup");
67218
67243
  mkdirSync7(backups, { recursive: true, mode: 448 });
@@ -70027,7 +70052,7 @@ import {
70027
70052
  mkdtempSync as mkdtempSync2,
70028
70053
  readFileSync as readFileSync19,
70029
70054
  readdirSync as readdirSync11,
70030
- realpathSync as realpathSync8,
70055
+ realpathSync as realpathSync9,
70031
70056
  renameSync as renameSync5,
70032
70057
  rmSync as rmSync5,
70033
70058
  statSync as statSync7,
@@ -70473,7 +70498,7 @@ function applyOpenCode(root, res) {
70473
70498
  };
70474
70499
  }
70475
70500
  function copyPluginDir(src, dest) {
70476
- const realSrc = realpathSync8(src);
70501
+ const realSrc = realpathSync9(src);
70477
70502
  const marker = path40.join(dest, ".workit-root");
70478
70503
  const destIsLink = existsSync17(dest) && lstatSync6(dest).isSymbolicLink();
70479
70504
  const synced = !destIsLink && readFileSafe(marker)?.trim() === realSrc && samePluginContent(realSrc, dest, dest);
@@ -70912,7 +70937,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
70912
70937
  return (require2.resolve.paths(name) ?? []).map((dir) => path40.join(dir, name));
70913
70938
  }, realRoot = (root) => {
70914
70939
  try {
70915
- return realpathSync8(root);
70940
+ return realpathSync9(root);
70916
70941
  } catch {
70917
70942
  return root;
70918
70943
  }
@@ -71972,7 +71997,7 @@ var init_wizard_state = __esm(() => {
71972
71997
  });
71973
71998
 
71974
71999
  // packages/workit-cli/src/admin/uninstall.ts
71975
- import { existsSync as existsSync19, readFileSync as readFileSync21, realpathSync as realpathSync9, rmSync as rmSync7, writeFileSync as writeFileSync12 } from "node:fs";
72000
+ import { existsSync as existsSync19, readFileSync as readFileSync21, realpathSync as realpathSync10, rmSync as rmSync7, writeFileSync as writeFileSync12 } from "node:fs";
71976
72001
  import os14 from "node:os";
71977
72002
  import path43 from "node:path";
71978
72003
  function cleanCursorSettings(settings, pluginDir) {
@@ -72280,7 +72305,7 @@ var resolveUninstallPaths = (options = {}) => {
72280
72305
  return false;
72281
72306
  }
72282
72307
  try {
72283
- return realpathSync9(actionPath) === realpathSync9(expected);
72308
+ return realpathSync10(actionPath) === realpathSync10(expected);
72284
72309
  } catch {
72285
72310
  return true;
72286
72311
  }
@@ -106874,7 +106899,7 @@ import {
106874
106899
  readdirSync as readdirSync15,
106875
106900
  readFileSync as readFileSync30,
106876
106901
  readlinkSync as readlinkSync3,
106877
- realpathSync as realpathSync10,
106902
+ realpathSync as realpathSync11,
106878
106903
  renameSync as renameSync7,
106879
106904
  rmSync as rmSync9,
106880
106905
  statSync as statSync11,
@@ -107011,7 +107036,7 @@ function linkNodeModules(origin, target, repo, copy) {
107011
107036
  if (entry.isSymbolicLink()) {
107012
107037
  let real;
107013
107038
  try {
107014
- real = realpathSync10(from);
107039
+ real = realpathSync11(from);
107015
107040
  } catch {
107016
107041
  continue;
107017
107042
  }
@@ -107027,11 +107052,11 @@ function linkNodeModules(origin, target, repo, copy) {
107027
107052
  function copySymlink(repo, tree, from, to) {
107028
107053
  let real = null;
107029
107054
  try {
107030
- real = realpathSync10(from);
107055
+ real = realpathSync11(from);
107031
107056
  } catch {
107032
107057
  real = null;
107033
107058
  }
107034
- const realRepo = realpathSync10(repo);
107059
+ const realRepo = realpathSync11(repo);
107035
107060
  if (real && inside5(realRepo, real)) {
107036
107061
  symlinkSync(path72.relative(path72.dirname(to), path72.join(tree, path72.relative(realRepo, real))), to);
107037
107062
  return;
@@ -107045,7 +107070,7 @@ function writeInside(copy, file, content) {
107045
107070
  const target = path72.join(copy, file);
107046
107071
  try {
107047
107072
  const stat = lstatSync8(target);
107048
- if (!stat.isFile() || !inside5(realpathSync10(copy), realpathSync10(path72.dirname(target))))
107073
+ if (!stat.isFile() || !inside5(realpathSync11(copy), realpathSync11(path72.dirname(target))))
107049
107074
  return false;
107050
107075
  } catch {
107051
107076
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-claude-code",
3
- "version": "8.40.2",
3
+ "version": "8.40.3",
4
4
  "private": false,
5
5
  "description": "Workit Claude Code plugin — session and per-turn task context, branch policy on git shell commands, workit method skills, and verifier/reviewer/implementer agents",
6
6
  "keywords": [
@@ -39,8 +39,8 @@
39
39
  "build": "bun scripts/build.ts"
40
40
  },
41
41
  "devDependencies": {
42
- "@brainervirus/workit-cli": "^8.40.2",
43
- "@brainervirus/workit-core": "^8.40.2"
42
+ "@brainervirus/workit-cli": "^8.40.3",
43
+ "@brainervirus/workit-core": "^8.40.3"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=24"