@brainervirus/workit-codex 8.21.0 → 8.22.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workit",
3
- "version": "8.21.0",
3
+ "version": "8.22.0",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -8,8 +8,8 @@ backward: what must be true, what must exist, what must be wired. The author's
8
8
  summary is a claim, not evidence; assume the goal is not met until you observe
9
9
  it.
10
10
 
11
- 1. Pin the candidate in its own checkout (`cd` into the worker's worktree, or
12
- pass `--cwd`): `git rev-parse HEAD` and `git status --short`. A dirty tree
11
+ 1. Pin the candidate in its own checkout (run workit with `--cwd <worktree>`;
12
+ never `cd` first): `git -C <worktree> rev-parse HEAD` and `git -C <worktree> status --short`. A dirty tree
13
13
  or a moving HEAD is itself a finding, and the ledger refuses a verdict on it.
14
14
  2. Read the brief: goal, acceptance (Given/When/Then), verify commands.
15
15
  3. Run every verify command through the CLI so the result is observed:
@@ -28828,6 +28828,9 @@ var WRITE_TOOLS = new Set([
28828
28828
  ]);
28829
28829
  // packages/workit-core/src/hooks/standing.ts
28830
28830
  var sinceStart = new Map;
28831
+ // packages/workit-core/src/hooks/cwd-normalize.ts
28832
+ var FILTERS = new Set(["tail", "head", "grep"]);
28833
+
28831
28834
  // packages/workit-core/src/hooks/handle.ts
28832
28835
  var offered = new Set;
28833
28836
  var PRE_TOOL = new Set(["shell.pre", "write.pre", "tool.pre"]);
@@ -125,6 +125,9 @@ Autonomy contract:
125
125
  CLI first: if a step has one right answer, use the \`workit\` verb instead of
126
126
  hand-running git, gh or glab (\`workit git|pr|ci|check|help\`;
127
127
  else \`npx -y @brainervirus/workit-cli\`).
128
+ Other checkout: \`workit --cwd <dir> <verb>\` (Codex: \`<verb> --cwd <dir>\`); one workit
129
+ verb per shell call, never \`cd <dir> && workit\`. zsh-safe: no \`echo =====\`
130
+ (\`printf '%s\\n' ---\`), quote globs and URLs, no variable named \`status\` or \`path\`.
128
131
  Add Co-Authored-By via \`workit git commit --trailer "K: v" -- <paths>\`, never
129
132
  an amend.
130
133
  The task families (task, policy, evidence, finding, decision, worker, state)
@@ -22262,6 +22265,40 @@ var standingDelta = (input) => {
22262
22265
  }
22263
22266
  };
22264
22267
  var sinceStart = new Map;
22268
+ // packages/workit-core/src/hooks/cwd-normalize.ts
22269
+ var COMPOUND = /^\s*cd\s+([A-Za-z0-9_./@%+:,=-]+|'[^'$`\\\n]*'|"[^"$`\\!\n]*")\s*&&\s*(workit(?:\s[\s\S]*)?)$/u;
22270
+ var FILTERS = new Set(["tail", "head", "grep"]);
22271
+ var stdinOnly = (words) => {
22272
+ const [name, ...args] = words;
22273
+ const operands = args.filter((w) => !w.startsWith("-"));
22274
+ if (name === "grep")
22275
+ return operands.length <= 1 && !args.some((w) => /^-[^-]*[rRf]|^--(recursive|file)/u.test(w));
22276
+ return operands.every((w) => /^\d+$/u.test(w)) && !args.some((w) => w.startsWith("--output"));
22277
+ };
22278
+ var cwdRewrite = (command) => {
22279
+ const match = COMPOUND.exec(command);
22280
+ const dir = match?.[1];
22281
+ const rest = match?.[2];
22282
+ if (!dir || !rest || dir.startsWith("-"))
22283
+ return null;
22284
+ if (/[&;<>`\n]/u.test(rest.replaceAll("2>&1", "")))
22285
+ return null;
22286
+ const segments = segmentsOf(rest);
22287
+ const [head, ...filters] = segments;
22288
+ if (!head || head.words[0] !== "workit")
22289
+ return null;
22290
+ if (head.words.some((w) => w === "--cwd" || w.startsWith("--cwd=")))
22291
+ return null;
22292
+ const clean = (s) => !s.unanalyzable && !s.group && !s.subs?.length && !s.stdin?.length && !s.redirects.length;
22293
+ if (!segments.every(clean))
22294
+ return null;
22295
+ if (!segments.slice(0, -1).every((s) => s.pipe))
22296
+ return null;
22297
+ if (!filters.every((s) => FILTERS.has(s.words[0] ?? "") && stdinOnly(s.words)))
22298
+ return null;
22299
+ return `workit --cwd ${dir} ${rest.slice("workit".length).trimStart()}`.trimEnd();
22300
+ };
22301
+
22265
22302
  // packages/workit-core/src/hooks/handle.ts
22266
22303
  var usable2 = (value) => value === "native" || value === "partial";
22267
22304
  var NONE5 = { kind: "none" };
@@ -22371,19 +22408,21 @@ function decide(input, deps) {
22371
22408
  if (plan.kind === "rewrite" && !rewrites && canDeny)
22372
22409
  return heavyDenial(event.command, plan);
22373
22410
  const lease = plan.kind === "rewrite" && rewrites ? plan : null;
22411
+ const cwdCommand = !lease && rewrites && input.host === "claude_code" ? cwdRewrite(event.command) : null;
22374
22412
  const aside = plan.kind === "passthrough" ? plan.note : null;
22375
22413
  noteRawCommit(input, event.command, postTool ? callKey(event.toolUseId, event.command) : NEXT_COMMAND);
22376
- const rewritten = (text) => lease ? {
22414
+ const rewrittenTo = lease?.command ?? cwdCommand;
22415
+ const rewritten = (text) => rewrittenTo ? {
22377
22416
  kind: "rewrite",
22378
- command: lease.command,
22379
- input: event.toolInput ? { ...event.toolInput, command: lease.command } : null,
22417
+ command: rewrittenTo,
22418
+ input: event.toolInput ? { ...event.toolInput, command: rewrittenTo } : null,
22380
22419
  text
22381
22420
  } : NONE5;
22382
22421
  if (descriptor.transport !== "hook-process")
22383
22422
  return rewritten(null);
22384
22423
  const nudged = withContextLine(withContextLine(canDeny ? rawGitPre(input, event.command) : NONE5, aside), shipNudge(input, event.command));
22385
22424
  if (!lease)
22386
- return nudged;
22425
+ return cwdCommand && nudged.kind !== "deny" ? rewritten(nudged.kind === "context" ? nudged.text : null) : nudged;
22387
22426
  return rewritten([rewriteNote(lease), nudged.kind === "context" ? nudged.text : null].filter(Boolean).join(`
22388
22427
  `));
22389
22428
  }
@@ -47,6 +47,6 @@ if (quiet)
47
47
  process.stdout.write(`${JSON.stringify({ hookSpecificOutput: { hookEventName: quiet } })}
48
48
  `);
49
49
  else {
50
- const { runCodexHook } = await import("./workit-hook-xhk0gksg.js");
50
+ const { runCodexHook } = await import("./workit-hook-vnqp9m7p.js");
51
51
  await runCodexHook([payload]);
52
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-codex",
3
- "version": "8.21.0",
3
+ "version": "8.22.0",
4
4
  "private": false,
5
5
  "description": "Workit Codex CLI/desktop plugin — shared MCP transport, hooks, 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-core": "^8.21.0",
43
- "@brainervirus/workit-mcp": "^8.21.0"
42
+ "@brainervirus/workit-core": "^8.22.0",
43
+ "@brainervirus/workit-mcp": "^8.22.0"
44
44
  },
45
45
  "engines": {
46
46
  "node": ">=24"