@brainervirus/workit-claude-code 8.29.0 → 8.29.1

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
@@ -9144,12 +9144,15 @@ function sessionClaimRefusal(env, claimed, cwd, options = {}) {
9144
9144
  };
9145
9145
  if (real.kind === "none" || !real.session)
9146
9146
  return null;
9147
- const ownShell = claimed === real.session && !(real.kind === "declared" && claimed.includes(":")) || real.kind === "derived" && claimed.endsWith(`:${real.session}`);
9148
- if (ownShell)
9149
- return options.flag ? {
9147
+ const ownShell = isOwnShellClaim(real, claimed);
9148
+ if (ownShell) {
9149
+ if (!options.flag || real.kind === "derived")
9150
+ return null;
9151
+ return {
9150
9152
  error: `session_flag: --session ${claimed} names this shell's own ${real.host} session; on a host only an issued subagent id is passed as --session`,
9151
9153
  unblock: "drop --session: the shell's own session is already the acting one"
9152
- } : null;
9154
+ };
9155
+ }
9153
9156
  const issuedClaim = claimed === real.session || claimed.startsWith(`${real.session}:`);
9154
9157
  if (issuedClaim) {
9155
9158
  const binding = issuedBinding(cwd, claimed);
@@ -9213,7 +9216,10 @@ var HOST_SESSION_VARS, family = (host) => host?.replace(/_(?:cli|desktop)$/, "")
9213
9216
  } catch {
9214
9217
  return { stored: null, leadBound: safeList(dir).length > 0 };
9215
9218
  }
9216
- }, leadOf = (session) => session.slice(0, session.lastIndexOf(":")), OWN_CHILD_SHELL, HOST_SET_VARIABLE;
9219
+ }, leadOf = (session) => session.slice(0, session.lastIndexOf(":")), OWN_CHILD_SHELL, isOwnShellClaim = (real, claimed) => claimed === real.session && !(real.kind === "declared" && claimed.includes(":")) || real.kind === "derived" && claimed.endsWith(`:${real.session}`), namesOwnDerivedSession = (env, claimed) => {
9220
+ const real = realHostSession(env);
9221
+ return real.kind === "derived" && isOwnShellClaim(real, claimed);
9222
+ }, HOST_SET_VARIABLE;
9217
9223
  var init_host_session = __esm(() => {
9218
9224
  init_branch();
9219
9225
  init_logger();
@@ -9245,7 +9251,7 @@ var package_default;
9245
9251
  var init_package = __esm(() => {
9246
9252
  package_default = {
9247
9253
  name: "@brainervirus/workit-cli",
9248
- version: "8.29.0",
9254
+ version: "8.29.1",
9249
9255
  private: false,
9250
9256
  description: "Workit CLI — setup wizard, doctor, and task control for agentic coding workflows",
9251
9257
  keywords: [
@@ -9283,13 +9289,13 @@ var init_package = __esm(() => {
9283
9289
  },
9284
9290
  dependencies: {
9285
9291
  "@babel/parser": "7.29.9",
9286
- "@brainervirus/workit-cursor": "^8.29.0",
9292
+ "@brainervirus/workit-cursor": "^8.29.1",
9287
9293
  "@inkjs/ui": "2.0.0",
9288
9294
  ink: "7.1.1",
9289
9295
  react: "19.2.8"
9290
9296
  },
9291
9297
  devDependencies: {
9292
- "@brainervirus/workit-core": "^8.29.0"
9298
+ "@brainervirus/workit-core": "^8.29.1"
9293
9299
  },
9294
9300
  engines: {
9295
9301
  node: ">=24"
@@ -18152,17 +18158,21 @@ function workitCheckTail(words) {
18152
18158
  return null;
18153
18159
  return args.slice(0, split).includes("--shell") ? { script: tail.join(" "), cwd } : { argv: tail, cwd };
18154
18160
  }
18155
- function simpleCommand(command, dialect = "posix", depth = 0) {
18161
+ function simpleCommand(command, dialect = "posix", depth = 0, shaped = false) {
18156
18162
  let segments;
18157
18163
  try {
18158
18164
  segments = segmentsOf(command, dialect);
18159
18165
  } catch {
18160
18166
  return null;
18161
18167
  }
18162
- if (segments.length !== 1)
18168
+ const filter = shaped && segments.length === 2 ? segments[1] : null;
18169
+ if (filter) {
18170
+ if (!segments[0].pipe || !OUTPUT_FILTERS.has(commandName(filter.words[0])) || filter.group || filter.pipe || filter.unanalyzable || filter.subs?.length || filter.stdin?.length)
18171
+ return null;
18172
+ } else if (segments.length !== 1)
18163
18173
  return null;
18164
18174
  const [segment] = segments;
18165
- if (segment.group || segment.pipe || segment.unanalyzable || segment.redirects.length || segment.subs?.length || segment.stdin?.length)
18175
+ if (segment.group || segment.pipe && !filter || segment.unanalyzable || segment.redirects.length && !shaped || segment.subs?.length || segment.stdin?.length)
18166
18176
  return null;
18167
18177
  const { words } = stripPrefixes(segment.words);
18168
18178
  const name = commandName(words[0]);
@@ -18498,7 +18508,7 @@ var SHELLS, POWERSHELLS, EVALS, WRAPPERS, WRAPPER_VALUES, KEYWORDS, DECLARATIONS
18498
18508
  ...Object.keys(env).length ? { env } : {},
18499
18509
  ...stdin === undefined ? {} : { stdin }
18500
18510
  };
18501
- }, RECENT, LAUNCHERS, WORKIT_PACKAGE, PACKAGE_RUNNERS, WORKIT_GLOBAL, PUSH_VALUE_OPTIONS, VALUE_OPTIONS, API_VALUES, API_FIELDS, GIT_COMMANDS;
18511
+ }, RECENT, LAUNCHERS, WORKIT_PACKAGE, PACKAGE_RUNNERS, OUTPUT_FILTERS, WORKIT_GLOBAL, PUSH_VALUE_OPTIONS, VALUE_OPTIONS, API_VALUES, API_FIELDS, GIT_COMMANDS;
18502
18512
  var init_raw_git = __esm(() => {
18503
18513
  init_branch();
18504
18514
  init_branch_policy();
@@ -18582,6 +18592,7 @@ var init_raw_git = __esm(() => {
18582
18592
  ]);
18583
18593
  WORKIT_PACKAGE = /^@brainervirus\/workit-cli(?:@\S*)?$/;
18584
18594
  PACKAGE_RUNNERS = new Set(["npx", "bunx", "pnpx"]);
18595
+ OUTPUT_FILTERS = new Set(["tail", "head", "grep"]);
18585
18596
  WORKIT_GLOBAL = /^--(?:cwd|session|token|as)(=|$)/;
18586
18597
  PUSH_VALUE_OPTIONS = new Set(["-o", "--push-option", "--receive-pack", "--exec", "--repo"]);
18587
18598
  VALUE_OPTIONS = {
@@ -66814,7 +66825,7 @@ function permissionHealth(host, options = {}) {
66814
66825
  detail: `${target.file} lacks ${missing.length} Workit entr${missing.length === 1 ? "y" : "ies"} (${missing[0]}${missing.length > 1 ? ", …" : ""})`
66815
66826
  };
66816
66827
  }
66817
- var PERMISSION_HOSTS, CLAUDE_ALLOW, CLAUDE_ASK, AUTO_MODE_ENVIRONMENT = "Org-specific CLIs: workit — the user's delivery CLI. Its push, pr merge, release and PR-thread verbs run only under per-workspace grants and non-author verdicts the user configured in ~/.config/workit, outside the agent's reach.", AUTO_MODE_ALLOW = "Workit-gated delivery: `workit pr merge`, `workit git push --force-with-lease` on the session's own branch, `workit release` and `workit pr reply/resolve` on the session's repo are authorized by the user's standing Workit grants; not Merge Without Review, Git Destructive or External System Writes. Does NOT cover `--unverified`, `--admin` or any bypass flag.", DEFAULTS2 = "$defaults", CURSOR_ALLOW, CODEX_HEADER, codexRulesText = () => {
66828
+ var PERMISSION_HOSTS, CLAUDE_ALLOW, CLAUDE_ASK, AUTO_MODE_ENVIRONMENT = "Org-specific CLIs: workit — the user's delivery CLI. Its push, pr merge, release and PR-thread verbs run only under per-workspace grants and non-author verdicts the user configured in ~/.config/workit, outside the agent's reach.", AUTO_MODE_ALLOW = "Workit-gated delivery: `workit pr merge`, `workit git push --force-with-lease` on the session's own branch, `workit release` and `workit pr reply/resolve` on the session's repo are authorized by the user's standing Workit grants; not Merge Without Review, Git Destructive or External System Writes. Does NOT cover `--unverified`, `--admin` or any bypass flag.", DEFAULTS2 = "$defaults", CHECK_NAMES, LOCK_VERBS, LEASE_PREFIXES, CURSOR_ALLOW, CODEX_HEADER, codexRulesText = () => {
66818
66829
  const rules = [...WORKIT_ALLOWED_VERBS, "--version"].map((verb) => {
66819
66830
  const examples = verb === "git" ? `
66820
66831
  match = [["workit", "git", "push", "--cwd", "/w"]],
@@ -66826,6 +66837,12 @@ var PERMISSION_HOSTS, CLAUDE_ALLOW, CLAUDE_ASK, AUTO_MODE_ENVIRONMENT = "Org-spe
66826
66837
  )
66827
66838
  `;
66828
66839
  });
66840
+ const lease = LEASE_PREFIXES.map((rest) => `prefix_rule(
66841
+ pattern = ${JSON.stringify(["workit", ...rest])},
66842
+ decision = "allow",
66843
+ justification = "Workit heavy-check lease: runs the repo's configured check, or reads the lease",
66844
+ )
66845
+ `);
66829
66846
  const grant = `prefix_rule(
66830
66847
  pattern = ["workit", "grant"],
66831
66848
  decision = "prompt",
@@ -66833,7 +66850,7 @@ var PERMISSION_HOSTS, CLAUDE_ALLOW, CLAUDE_ASK, AUTO_MODE_ENVIRONMENT = "Org-spe
66833
66850
  )
66834
66851
  `;
66835
66852
  return `${CODEX_HEADER}
66836
- ${[...rules, grant].join(`
66853
+ ${[...rules, ...lease, grant].join(`
66837
66854
  `)}`;
66838
66855
  }, isRecord5 = (v) => v !== null && typeof v === "object" && !Array.isArray(v), emptyOwned = () => ({ lists: {}, created: [], env: {} }), clone4 = (value) => structuredClone(value), objectAt = (root, keys, owned) => {
66839
66856
  let node = root;
@@ -66984,8 +67001,15 @@ var init_host_permissions = __esm(() => {
66984
67001
  "Bash(workit * --unverified*)",
66985
67002
  "Bash(workit * --overwrite-unintegrated*)"
66986
67003
  ];
67004
+ CHECK_NAMES = ["test", "lint", "typecheck", "build", "format", "docs"];
67005
+ LOCK_VERBS = ["status", "wait"];
67006
+ LEASE_PREFIXES = [
67007
+ ...CHECK_NAMES.map((name) => ["check", name]),
67008
+ ...LOCK_VERBS.map((verb) => ["lock", verb])
67009
+ ];
66987
67010
  CURSOR_ALLOW = [
66988
67011
  ...WORKIT_ALLOWED_VERBS.map((verb) => `Shell(workit ${verb})`),
67012
+ ...LEASE_PREFIXES.map((rest) => `Shell(workit ${rest.join(" ")})`),
66989
67013
  "Shell(workit --version)"
66990
67014
  ];
66991
67015
  CODEX_HEADER = "# Workit-owned: written by `workit setup`, removed by `workit uninstall`.\n" + `# Workit's own grants, verdict gates and branch policy decide these verbs.
@@ -76224,7 +76248,7 @@ function heavyPlan(command, options) {
76224
76248
  const heavy = heavyLines(lines, options);
76225
76249
  if (!heavy.length)
76226
76250
  return { kind: "none" };
76227
- const simple = simpleCommand(command, dialect);
76251
+ const simple = simpleCommand(command, dialect, 0, true);
76228
76252
  const single = simple && !WORKIT.test(baseName2(simple[0])) && heavyLines([simple], options)[0];
76229
76253
  const judged = single ? [{ words: lines.flat(), text: command }] : heavy.map((match) => ({
76230
76254
  words: match.line,
@@ -76236,7 +76260,7 @@ function heavyPlan(command, options) {
76236
76260
  if (!verdict.ok)
76237
76261
  return {
76238
76262
  kind: "passthrough",
76239
- note: `workit: \`${command.trim()}\` is heavy but runs outside the heavy-check lease because a host permission rule names it (or \`workit\` is allowlisted); the host decides.`
76263
+ note: ""
76240
76264
  };
76241
76265
  }
76242
76266
  if (single) {
@@ -76246,7 +76270,7 @@ function heavyPlan(command, options) {
76246
76270
  const parts = heavy.map((match) => leaseCommand(match.line));
76247
76271
  return {
76248
76272
  kind: "split",
76249
- reason: `heavy_command: \`${command.trim()}\` chains heavy work (${heavy.map((match) => match.reason).join("; ")}) with other commands, and a chain cannot run under the machine-wide heavy-check lease. Run each heavy part alone as \`workit check --heavy -- <segment>\` (here: ${parts.map((part) => `\`${part}\``).join("; ")}); run the other parts as their own commands.`,
76273
+ reason: `heavy_command: \`${command.trim()}\` chains heavy work (${heavy.map((match) => match.reason).join("; ")}) with other commands, and a chain cannot run under the machine-wide heavy-check lease. Run the heavy part alone, now: \`${parts[0]}\`; then run the other parts as their own commands${parts.length > 1 ? ", each heavy one the same way" : ""}.`,
76250
76274
  unblock: parts[0] ?? null
76251
76275
  };
76252
76276
  }
@@ -87938,6 +87962,8 @@ var USAGE13 = "workit ledger decision|ruling|verdict|standing|list|check ... (wo
87938
87962
  if (values.session !== undefined) {
87939
87963
  if (!SESSION_SAFE2.test(values.session))
87940
87964
  return new Error("--session must be 1-128 characters of [A-Za-z0-9_.:@/+-]");
87965
+ if (namesOwnDerivedSession(io.env, values.session))
87966
+ return { actor, source: "env" };
87941
87967
  return { actor: { ...actor, session: values.session }, source: "flag" };
87942
87968
  }
87943
87969
  if (values.as !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-claude-code",
3
- "version": "8.29.0",
3
+ "version": "8.29.1",
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.29.0",
43
- "@brainervirus/workit-core": "^8.29.0"
42
+ "@brainervirus/workit-cli": "^8.29.1",
43
+ "@brainervirus/workit-core": "^8.29.1"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=24"