@workit-dev/codex 1.2.0 → 1.2.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workit",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -2,12 +2,12 @@
2
2
  name = "workit-reviewer"
3
3
  description = "Fresh-context reviewer for a workit branch or PR - spec fidelity and standards as separate axes, test quality and blast radius - that records findings and a non-author verdict. Use for independent review of a diff, branch or PR."
4
4
  sandbox_mode = "read-only"
5
- developer_instructions = '''You are the workit reviewer. Review the real candidate, never the author's
6
- description of it. Follow the workit-review skill (`$workit-review`).
5
+ developer_instructions = '''You are the workit reviewer. Review the real candidate, not the author's
6
+ account. Follow the workit-review skill (`$workit-review`).
7
7
 
8
8
  1. Pin the candidate: `git rev-parse HEAD`, the base, `git diff <base>...HEAD`;
9
- for a PR, `workit pr status --json` for checks and unresolved threads.
10
- 2. Read the intent: brief or acceptance criteria, spec, PR body, and
9
+ for a PR, `workit pr status --json` (checks, unresolved threads).
10
+ 2. Read the intent: brief or acceptance, spec, PR body, and
11
11
  `workit ledger list --type decision`.
12
12
  3. Judge two axes separately: spec fidelity (missing, creep, wrong; quote the
13
13
  line) and standards (repo rules first, then smells). Then test quality
@@ -15,18 +15,20 @@ description of it. Follow the workit-review skill (`$workit-review`).
15
15
  touched contract or caller, run with `workit check -- <cmd>`; label anything
16
16
  unproven UNPROVEN.
17
17
  4. Each finding: file:line, severity (blocker, major, minor, nit), evidence
18
- (hunk, test or command output), concrete fix.
18
+ (hunk, test or output), concrete fix.
19
19
  5. Record the verdict:
20
- start from the exact verdict command the SubagentStart hook put in your context (it names no --session or --token: your shell already acts as your own session); it already names `--kind review`:
20
+ start from the exact verdict command the SubagentStart hook gave you (it names no --session or --token: your shell already acts as your own session); it names `--kind review`:
21
21
  `workit ledger verdict verified|failed|blocked --kind review --branch <b> --how "<what you read and ran>"`
22
- (`verified` with `--kind review`: no blocker or major finding left).
23
- Record a design choice you had to make as `workit ledger ruling`.
22
+ (`verified`: no blocker or major left).
23
+ Record a design choice as `workit ledger ruling`.
24
24
 
25
25
  Before your final report, wait for or stop every background command you started
26
26
  (the host shows you running while one lives); never report with one still running.
27
27
 
28
- Stay read-only: read and test commands only, never commits, pushes, merges or
29
- edits. If the ledger refuses you as an author, report that instead of a verdict.
28
+ Never commit, push, merge or edit. Write only in the checkout's
29
+ `.workit-scratch/`: generated test cases go into files there via a quoted
30
+ heredoc (`<<'EOF'`), never run by the shell. If the ledger refuses you as an
31
+ author, report that instead of a verdict.
30
32
 
31
33
  Codex runs you in a read-only sandbox. `workit check` and `workit ledger verdict` write outside it: run them with escalated permissions (Codex asks the user). If escalation is refused or unavailable, record nothing and report the verdict you would record as blocked.
32
34
  '''
@@ -2,37 +2,38 @@
2
2
  name = "workit-verifier"
3
3
  description = "Independently verifies a workit candidate (branch, commit or PR) on its real surface and records a SHA-keyed verdict in the ledger. Use after an implementer finishes and before shipping, never on work this session authored."
4
4
  sandbox_mode = "read-only"
5
- developer_instructions = '''You are the workit verifier. You did not write the candidate and you never
6
- change it: you observe, judge and record. Start from the goal and work
7
- backward: what must be true, what must exist, what must be wired. The author's
8
- summary is a claim, not evidence; assume the goal is not met until you observe
9
- it.
5
+ developer_instructions = '''You are the workit verifier. You did not write the candidate and never
6
+ change it: you observe, judge and record. Work backward from the goal: what
7
+ must be true, exist and be wired. The author's summary is a claim:
8
+ the goal is unmet until you observe it.
10
9
 
11
10
  1. Pin the candidate in its own checkout (run workit as
12
11
  `workit <verb> --cwd <worktree> …`, verb first; never `cd` first): `git -C <worktree> rev-parse HEAD` and `git -C <worktree> status --short`. A dirty tree
13
- or a moving HEAD is itself a finding, and the ledger refuses a verdict on it.
12
+ or a moving HEAD is a finding; the ledger refuses a verdict on it.
14
13
  2. Read the brief: goal, acceptance (Given/When/Then), verify commands.
15
- 3. Run every verify command through the CLI so the result is observed:
14
+ 3. Run every verify command through the CLI:
16
15
  `workit check <name>` for configured checks, `workit check -- <cmd>` for the
17
16
  rest. Never substitute an easier command. Run every configured check by name
18
- (your SubagentStart context lists them) or cite green CI on that head; otherwise, `verified` is refused.
17
+ (your SubagentStart context lists them) or cite green CI on that head, else `verified` is refused.
19
18
  4. Drive the real surface with the project's `verify-<app>` skill when it
20
19
  exists (`$workit-verify-app` generates one). Tests alone are unit evidence.
21
- 5. Judge each acceptance line as met, not met, or not verifiable, citing what
20
+ 5. Judge each acceptance line met, not met or not verifiable, citing what
22
21
  you observed. Label every claim measured, inferred or guess.
23
22
  6. Record the verdict, then report it:
24
23
  start from the exact verdict command the SubagentStart hook put in your context (it names no --session or --token: your shell already acts as your own session, never set WORKIT_SESSION_ID) and pick its `--kind <live|unit>`:
25
24
  `workit ledger verdict verified|tests-verified|type-check-only|failed|blocked --kind <live|unit> --branch <b> --how "<what you ran and saw>"`.
26
- `verified` means the change was observed working on its real surface
25
+ `verified` means the change was seen working on its real surface
27
26
  (verify-<app>, `--kind live`); `tests-verified` means only tests ran. If the ledger refuses you as an author, report that;
28
- never pass `--self` to get around it.
27
+ never pass `--self`.
29
28
 
30
29
  Before your final report, wait for or stop every background command you started
31
30
  (the host shows you running while one lives); never report with one still running.
32
31
 
32
+ Write only in the checkout's `.workit-scratch/`: a generated test case goes in
33
+ a file there via a quoted heredoc (`<<'EOF'`), never run by the shell.
34
+
33
35
  Report: candidate SHA, each check with its exit code, each acceptance line,
34
- the verdict row you recorded. Do not fix anything you find: a failing check is
35
- a verdict, not a task.
36
+ the verdict row you recorded. Fix nothing: a failing check is a verdict.
36
37
 
37
38
  Codex runs you in a read-only sandbox. `workit check` and `workit ledger verdict` write outside it: run them with escalated permissions (Codex asks the user). If escalation is refused or unavailable, record nothing and report the verdict you would record as blocked.
38
39
  '''
@@ -31133,6 +31133,19 @@ var MUTATING_REMOTE = new Set([
31133
31133
  "set-branches",
31134
31134
  "prune"
31135
31135
  ]);
31136
+ var JUDGE_VERBS = {
31137
+ check: true,
31138
+ dir: true,
31139
+ help: true,
31140
+ "test-audit": true,
31141
+ ledger: ["verdict", "finding", "list", "check", "ruling"],
31142
+ pr: ["status"],
31143
+ ci: ["wait", "logs"],
31144
+ fanout: ["status", "brief"],
31145
+ models: ["show"],
31146
+ lock: ["status"]
31147
+ };
31148
+ var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
31136
31149
 
31137
31150
  // packages/workit-core/src/hooks/standing.ts
31138
31151
  var DESCRIPTORS = {
@@ -20418,7 +20418,7 @@ var shellScript2 = (words) => {
20418
20418
  return null;
20419
20419
  for (let index = 1;index < words.length; index++) {
20420
20420
  const word = words[index];
20421
- if (/^-[a-z]*c$/.test(word))
20421
+ if (/^-[a-z]*c[a-z]*$/.test(word))
20422
20422
  return words[index + 1] ?? null;
20423
20423
  if (/^[-+][oO]$/.test(word))
20424
20424
  index++;
@@ -20449,8 +20449,16 @@ var opaqueWrites = (input, scriptOf = (index) => input[index]) => {
20449
20449
  const files = operands(args);
20450
20450
  const has = (pattern) => args.some((arg) => pattern.test(arg));
20451
20451
  const listed = (named) => named.length ? named : ["."];
20452
- if (name === "unlink" || name === "shred")
20452
+ if (name === "unlink" || name === "shred" || name === "mkfifo")
20453
20453
  return listed(files);
20454
+ if (name === "wget")
20455
+ return wgetOutputs(args);
20456
+ if (name === "tar")
20457
+ return tarOutputs(args);
20458
+ if (name === "unzip")
20459
+ return has(/^-[a-zA-Z]*[lptvzZ]/) ? null : listed(args.flatMap((arg, at) => arg.startsWith("-d") ? [arg.slice(2) || args[at + 1] || "."] : []));
20460
+ if (name === "git")
20461
+ return gitOutputs(args);
20454
20462
  if (/^(?:chmod|chown|chgrp|chattr)$/.test(name))
20455
20463
  return listed(has(/^--reference/) ? files : files.slice(1));
20456
20464
  if (name === "rsync") {
@@ -20570,6 +20578,85 @@ var curlOutputs = (args) => {
20570
20578
  files.push(...dirs.length ? dirs : ["."]);
20571
20579
  return files.length > 0 ? files : null;
20572
20580
  };
20581
+ var valueOf = (args, option) => {
20582
+ const at = args.findIndex((arg) => option.test(arg));
20583
+ return at < 0 ? undefined : option.exec(args[at])?.[1] || args[at + 1];
20584
+ };
20585
+ var wgetOutputs = (args) => {
20586
+ const named = valueOf(args, /^(?:-[a-zA-Z]*O|--output-document=?)(.*)$/s);
20587
+ const logs = [/^-[a-zA-Z]*[oa](.*)$/s, /^--(?:output-file|append-output)=?(.*)$/s].flatMap((option) => valueOf(args, option) ?? []);
20588
+ if (named === undefined)
20589
+ return [...logs, valueOf(args, /^(?:-[a-zA-Z]*P|--directory-prefix=?)(.*)$/s) ?? "."];
20590
+ return named === "-" ? logs : [...logs, named];
20591
+ };
20592
+ var tarOutputs = (args) => {
20593
+ const letters = args.filter((arg, at) => at === 0 && !arg.startsWith("-") || /^-[a-zA-Z]+$/.test(arg)).join("").replaceAll("C", "");
20594
+ const long = (pattern) => args.some((arg) => pattern.test(arg));
20595
+ const extract = /x/.test(letters) || long(/^--(?:extract|get)$/);
20596
+ const creates = /[cruA]/.test(letters) || long(/^--(?:create|append|update|concatenate|delete)$/);
20597
+ if (!extract && !creates)
20598
+ return null;
20599
+ const files = [];
20600
+ if (extract) {
20601
+ const dirs = args.flatMap((arg, at) => /^-C|^--directory(?:=|$)/.test(arg) ? [arg.replace(/^-C|^--directory=?/, "") || args[at + 1] || "."] : []);
20602
+ files.push(...dirs.length ? dirs : ["."]);
20603
+ }
20604
+ const old = args[0] !== undefined && !args[0].startsWith("-") && args[0].includes("f");
20605
+ const archive = old ? args[1] : valueOf(args, /^(?:-[a-zA-Z]*f|--file=?)(.*)$/s);
20606
+ if (creates && archive !== undefined && archive !== "-")
20607
+ files.push(archive);
20608
+ return files;
20609
+ };
20610
+ var CONFIG_READ = /^(?:--get(?:-all|-regexp|-urlmatch)?|--list|-l|get|list)$/;
20611
+ var CONFIG_WRITE = /^(?:--(?:unset(?:-all)?|add|replace-all|rename-section|remove-section|edit)|-e|set|unset|rename-section|remove-section|edit)$/;
20612
+ var CONFIG_VALUE = /^(?:--file|-f|--blob|--type|--default|--comment)$/;
20613
+ var configWrites = (rest) => {
20614
+ if (rest.some((arg) => CONFIG_READ.test(arg)))
20615
+ return false;
20616
+ if (rest.some((arg) => CONFIG_WRITE.test(arg)))
20617
+ return true;
20618
+ let named = 0;
20619
+ for (let index = 0;index < rest.length; index++)
20620
+ if (CONFIG_VALUE.test(rest[index]))
20621
+ index++;
20622
+ else if (!rest[index].startsWith("-"))
20623
+ named++;
20624
+ return named > 1;
20625
+ };
20626
+ var GIT_VALUE = /^(?:-[Ccbouj]|--(?:git-dir|work-tree|namespace|config-env|branch|origin|config|depth|reference(?:-if-able)?|template|separate-git-dir|upload-pack|jobs|filter|initial-branch|object-format))$/;
20627
+ var gitOutputs = (args) => {
20628
+ let at = 0;
20629
+ let base;
20630
+ for (;args[at]?.startsWith("-"); at += GIT_VALUE.test(args[at]) ? 2 : 1)
20631
+ if (args[at] === "-C")
20632
+ base = args[at + 1];
20633
+ const [sub = "", ...rest] = args.slice(at);
20634
+ if (rest.some((arg) => arg === "--help" || arg === "-h"))
20635
+ return null;
20636
+ const names = rest.filter((arg, index) => !arg.startsWith("-") && !GIT_VALUE.test(rest[index - 1] ?? ""));
20637
+ const has = (pattern) => rest.some((arg) => pattern.test(arg));
20638
+ const files = [];
20639
+ const output = valueOf(rest, sub === "archive" ? /^(?:-o|--output=?)(.*)$/s : /^--output=?(.*)$/s);
20640
+ if (output !== undefined)
20641
+ files.push(output);
20642
+ if (sub === "init")
20643
+ files.push(names[0] ?? ".");
20644
+ if (sub === "clone")
20645
+ files.push(names[1] ?? names[0]?.replace(/(?:\.git)?[\\/]*$/, "").split(/[\\/:]/).at(-1) ?? ".");
20646
+ if (sub === "format-patch" && !has(/^--stdout$/))
20647
+ files.push(valueOf(rest, /^(?:-o|--output-directory=?)(.*)$/s) ?? ".");
20648
+ if (sub === "bundle" && names[0] === "create" && names[1])
20649
+ files.push(names[1]);
20650
+ if (sub === "config" && configWrites(rest))
20651
+ files.push(has(/^--global$/) ? "~/.gitconfig" : has(/^--system$/) ? "/etc/gitconfig" : valueOf(rest, /^(?:-f|--file=?)(.*)$/s) ?? ".");
20652
+ const branchWrite = has(/^-[a-zA-Z]*[dDfmMcCu]|^--(?:delete|force|move|copy|set-upstream|unset-upstream|edit)/) || names.length > 0 && !has(/^-[a-zA-Z]*[lavr]|^--(?:list|all|remotes|verbose|show|contains|no-contains|merged|no-merged|points-at|format|sort)/);
20653
+ if (sub === "fetch" || sub === "gc" || sub === "branch" && branchWrite)
20654
+ files.push(".");
20655
+ if (base === undefined)
20656
+ return files.length ? files : null;
20657
+ const under = (file) => file === "." ? `${base}/${OPAQUE_TARGET}git` : /^[/~$]|^[A-Za-z]:[\\/]/.test(file) ? file : `${base}/${file}`;
20658
+ return files.length ? files.map(under) : null;
20659
+ };
20573
20660
  var pathsIn = (text) => [
20574
20661
  ...text.matchAll(/(?<![\w.~:/$-])(?:~\/|\/|[A-Za-z]:\/|\.\.(?:\/|$))[^\s'"`$),;:*?<>|\\[\]{}]*/g)
20575
20662
  ].map((match) => match[0]);
@@ -22726,9 +22813,6 @@ var MUTATING_REMOTE = new Set([
22726
22813
  "set-branches",
22727
22814
  "prune"
22728
22815
  ]);
22729
- var CONFIG_READ = /^(?:--get(?:-all|-regexp|-urlmatch)?|--list|-l|get|list)$/;
22730
- var CONFIG_WRITE = /^(?:--(?:unset(?:-all)?|add|replace-all|rename-section|remove-section|edit)|-e|set|unset|rename-section|remove-section|edit)$/;
22731
- var CONFIG_VALUE = /^(?:--file|-f|--blob|--type|--default|--comment)$/;
22732
22816
  var leadOwnedGit = (args) => {
22733
22817
  const [sub = "", ...rest] = args;
22734
22818
  if (rest.some((arg) => arg === "--help" || arg === "-h"))
@@ -22767,19 +22851,8 @@ var leadOwnedGit = (args) => {
22767
22851
  return names[0] === "drop" || names[0] === "clear";
22768
22852
  case "remote":
22769
22853
  return MUTATING_REMOTE.has(names[0] ?? "");
22770
- case "config": {
22771
- if (rest.some((arg) => CONFIG_READ.test(arg)))
22772
- return false;
22773
- if (rest.some((arg) => CONFIG_WRITE.test(arg)))
22774
- return true;
22775
- let operands = 0;
22776
- for (let index = 0;index < rest.length; index++)
22777
- if (CONFIG_VALUE.test(rest[index]))
22778
- index++;
22779
- else if (!rest[index].startsWith("-"))
22780
- operands++;
22781
- return operands > 1;
22782
- }
22854
+ case "config":
22855
+ return configWrites(rest);
22783
22856
  default:
22784
22857
  return false;
22785
22858
  }
@@ -22807,6 +22880,223 @@ function confineImplementerShell(input, command, dialect = "posix") {
22807
22880
  } catch {}
22808
22881
  return confineImplementer(input, shellMutationTargets(input.cwd, command, dialect, true), command);
22809
22882
  }
22883
+ var SCRATCH = ".workit-scratch";
22884
+ var SHELL_NAMES = /^(?:sh|bash|zsh|dash|ksh|mksh|ash)$/;
22885
+ var INTERPRETERS = /^(?:python[\d.]*|node|bun|deno|ruby|perl|php)$/;
22886
+ var FED = /^(?:-|\/dev\/stdin|\/dev\/fd\/0|\/proc\/self\/fd\/0)$|^<\(/;
22887
+ var LEADS = /^(?:sudo|doas|env|command|builtin|exec|nohup|time|nice|timeout|stdbuf|xargs|busybox|!|\{|if|then|else|elif|do|while|until|\w+=.*|[-\d].*)$/s;
22888
+ var RUNS = /^(?:sh|bash|zsh|dash|ksh|mksh|ash|python[\d.]*|node|bun|deno|ruby|perl|php|eval|source|\.|workit)$/;
22889
+ var INLINE = /^-[a-zA-Z]*[ceEpm]$|^--(?:eval|print|test|version|help)$|^-[hvV]$/;
22890
+ var VALUED = /^-[WXIrC]$|^--(?:require|import|loader|conditions|input-type)$/;
22891
+ var commonDir = (root) => {
22892
+ const dotGit = path30.join(root, ".git");
22893
+ if (!fs21.statSync(dotGit).isFile())
22894
+ return canonical4(dotGit);
22895
+ const admin = path30.resolve(root, /^gitdir:\s*(.+)$/mu.exec(fs21.readFileSync(dotGit, "utf8"))?.[1]?.trim() ?? "");
22896
+ const common = path30.join(admin, "commondir");
22897
+ return canonical4(fs21.existsSync(common) ? path30.resolve(admin, fs21.readFileSync(common, "utf8").trim()) : admin);
22898
+ };
22899
+ var inScratch = (real, repo) => {
22900
+ const checkout = checkoutOf2(real);
22901
+ return checkout !== null && within(real, path30.join(checkout.root, SCRATCH)) && (repo === null || commonDir(checkout.root) === repo);
22902
+ };
22903
+ var JUDGE_VERBS = {
22904
+ check: true,
22905
+ dir: true,
22906
+ help: true,
22907
+ "test-audit": true,
22908
+ ledger: ["verdict", "finding", "list", "check", "ruling"],
22909
+ pr: ["status"],
22910
+ ci: ["wait", "logs"],
22911
+ fanout: ["status", "brief"],
22912
+ models: ["show"],
22913
+ lock: ["status"]
22914
+ };
22915
+ var HELP = /^(?:--help|-h)$/;
22916
+ var judgeVerbRefused = (args) => {
22917
+ const { rest } = skipWorkitGlobals(args);
22918
+ const end = rest.indexOf("--");
22919
+ const call = end < 0 ? rest : rest.slice(0, end);
22920
+ const [verb, sub = ""] = call;
22921
+ if (verb === undefined || verb === "--version" || HELP.test(verb) || HELP.test(sub))
22922
+ return null;
22923
+ const allowed = Object.hasOwn(JUDGE_VERBS, verb) ? JUDGE_VERBS[verb] : [];
22924
+ const ok = allowed === true ? !(verb === "test-audit" && call.some((arg) => /^--mutate(?:=|$)/.test(arg))) : allowed.includes(sub);
22925
+ return ok ? null : `workit ${call.join(" ")}`;
22926
+ };
22927
+ var CLI_RUNNERS = /^(?:npx|bunx|pnpx|npm|pnpm|yarn|bun|node|nodejs|deno|tsx|ts-node)$/;
22928
+ var CLI_ENTRY = /(?:^|[=\\/])(?:workit(?:\.(?:exe|cmd|[cm]?js))?|@workit-dev\/cli(?:@\S*)?)$|(?:workit-cli|@workit-dev[\\/]cli)[\\/](?:src[\\/](?:index|main)|dist[\\/]index)\.[cm]?[jt]sx?$/;
22929
+ var workitCalls = (command, depth = 0, aliases = new Map) => depth > 4 ? [] : commandLines(command).flatMap((words) => {
22930
+ const name = path30.basename(words[0] ?? "").toLowerCase();
22931
+ if (name === "alias")
22932
+ return words.flatMap((word) => {
22933
+ const set = /^([\w-]+)=(.*)$/s.exec(word);
22934
+ if (!set)
22935
+ return [];
22936
+ aliases.set(set[1], set[2]);
22937
+ return workitCalls(set[2], depth + 1, aliases);
22938
+ });
22939
+ const body = aliases.get(words[0] ?? "");
22940
+ if (body !== undefined)
22941
+ return workitCalls([body, ...words.slice(1).map((word) => `'${word.replaceAll("'", `'\\''`)}'`)].join(" "), depth + 1, aliases);
22942
+ let at = /^workit(?:\.exe|\.cmd)?$/.test(name) ? 0 : CLI_RUNNERS.test(name) ? words.findIndex((word, index) => index > 0 && CLI_ENTRY.test(word)) : -1;
22943
+ if (at < 0)
22944
+ return [];
22945
+ while (words[at + 1] === "--" || CLI_ENTRY.test(words[at + 1] ?? ""))
22946
+ at++;
22947
+ return [words.slice(at + 1)];
22948
+ });
22949
+ var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
22950
+ var judgeRefusal = (command, fed, depth = 0) => {
22951
+ let moved = false;
22952
+ for (const segment of segmentsOf(command)) {
22953
+ const nested = (script) => script !== undefined && depth < 4 ? judgeRefusal(script, fed, depth + 1) : null;
22954
+ for (const sub of segment.subs ?? []) {
22955
+ const why = nested(sub);
22956
+ if (why)
22957
+ return why;
22958
+ }
22959
+ const { words } = segment;
22960
+ const runs = (word = "") => RUNS.test(path30.basename(word).toLowerCase());
22961
+ let at = 0;
22962
+ while (at < words.length && (LEADS.test(words[at]) || /^-\w$/.test(words[at - 1] ?? "") && !runs(words[at])))
22963
+ at++;
22964
+ const name = path30.basename(words[at] ?? "").toLowerCase();
22965
+ const args = words.slice(at + 1);
22966
+ const unseen = `\`${words.join(" ").slice(0, 80)}\` runs a script Workit cannot read (piped, on stdin, a process substitution or eval): write the case to a file in ${SCRATCH} and dispatch it from a test instead`;
22967
+ if (/^(?:cd|chdir|pushd|popd)$/.test(name))
22968
+ moved = true;
22969
+ if (name === "eval" || (name === "source" || name === ".") && FED.test(args[0] ?? ""))
22970
+ return unseen;
22971
+ if (SHELL_NAMES.test(name)) {
22972
+ let operand;
22973
+ let stdin = false;
22974
+ let inline;
22975
+ for (let index = 0;index < args.length && inline === undefined; index++) {
22976
+ const arg = args[index];
22977
+ if (/^-[a-zA-Z]*c[a-zA-Z]*$/.test(arg))
22978
+ inline = index + 1;
22979
+ else if (/^[-+][oO]$/.test(arg))
22980
+ index++;
22981
+ else if (arg === "--" || !/^[-+]/.test(arg)) {
22982
+ operand = arg === "--" ? args[index + 1] : arg;
22983
+ break;
22984
+ } else if (/^-[a-zA-Z]*s/.test(arg))
22985
+ stdin = true;
22986
+ }
22987
+ if (inline !== undefined) {
22988
+ const why = nested(args[inline]);
22989
+ if (why)
22990
+ return why;
22991
+ } else if (operand === undefined || stdin || FED.test(operand)) {
22992
+ if (!segment.stdin?.length || moved || operand !== undefined && !stdin)
22993
+ return unseen;
22994
+ fed.push(...segment.stdin);
22995
+ for (const body of segment.stdin) {
22996
+ const why = nested(body);
22997
+ if (why)
22998
+ return why;
22999
+ }
23000
+ }
23001
+ }
23002
+ if (INTERPRETERS.test(name) && !args.some((arg) => INLINE.test(arg))) {
23003
+ const operand = args.find((arg, index) => (arg === "-" || !arg.startsWith("-")) && !VALUED.test(args[index - 1] ?? ""));
23004
+ if (FED.test(operand ?? "") || operand === undefined && !/^(?:bun|deno)$/.test(name))
23005
+ return unseen;
23006
+ }
23007
+ const tail = workitCheckTail(words.slice(at));
23008
+ if (tail) {
23009
+ const why = nested("script" in tail ? tail.script : tail.argv.map((word) => `'${word.replaceAll("'", `'\\''`)}'`).join(" "));
23010
+ if (why)
23011
+ return why;
23012
+ }
23013
+ }
23014
+ for (const args of workitCalls(command)) {
23015
+ const call = judgeVerbRefused(args);
23016
+ if (call)
23017
+ return `\`${call}\` is not a judge's job: a judge runs only ${JUDGE_JOB}`;
23018
+ }
23019
+ return null;
23020
+ };
23021
+ var substitutingHeredoc = (command) => {
23022
+ for (const match of command.matchAll(/(?<!<)<<-?[ \t]*([^\s<>;&|()]+)/g)) {
23023
+ const delimiter = match[1];
23024
+ if (/['"\\]/.test(delimiter))
23025
+ continue;
23026
+ const newline = command.indexOf(`
23027
+ `, match.index + match[0].length);
23028
+ if (newline < 0)
23029
+ continue;
23030
+ const lines = command.slice(newline + 1).split(`
23031
+ `);
23032
+ const end = lines.findIndex((line) => line.trim() === delimiter);
23033
+ if (/\$\((?!\()|`/.test((end < 0 ? lines : lines.slice(0, end)).join(`
23034
+ `)))
23035
+ return true;
23036
+ }
23037
+ return false;
23038
+ };
23039
+ var judgeDeny = (input, what) => {
23040
+ const role = input.session.agentType?.endsWith("reviewer") ? "reviewer" : "verifier";
23041
+ const root = checkoutOf2(input.cwd)?.root;
23042
+ const scratch = root ? path30.join(root, SCRATCH) : `${SCRATCH}/ at the root of the checkout you judge`;
23043
+ const unblock = `Write only under ${scratch} (mkdir -p it): put a generated case in a file there with a quoted heredoc (<<'EOF') and never run it in the shell. Reads, \`workit check\` and \`workit ledger verdict|finding\` stay allowed; a change the candidate needs is a finding, not an edit.`;
23044
+ return {
23045
+ kind: "deny",
23046
+ reason: `workit scratch confinement: ${role} ${input.session.agentId} may write only in its scratch dir ${scratch}, and ${what}. ${unblock}`,
23047
+ unblock
23048
+ };
23049
+ };
23050
+ function confineJudge(input, targets) {
23051
+ try {
23052
+ if (!input.session.agentId)
23053
+ return NONE5;
23054
+ const judged = checkoutOf2(input.cwd);
23055
+ const repo = judged ? commonDir(judged.root) : null;
23056
+ for (const target of targets) {
23057
+ const resolved = path30.resolve(target);
23058
+ if (within(resolved, UNKNOWN_VAR) || within(resolved, UNKNOWN_DIR))
23059
+ return judgeDeny(input, "it writes to a path Workit cannot resolve (a variable, a command substitution or `cd -`): spell the path out");
23060
+ if (inScratch(canonical4(target), repo))
23061
+ continue;
23062
+ const runner = runnerAt(target);
23063
+ return judgeDeny(input, runner === null ? `${shown(target)} is outside it` : `\`${runner}\` runs in ${shown(target)}, outside it`);
23064
+ }
23065
+ return NONE5;
23066
+ } catch {
23067
+ return NONE5;
23068
+ }
23069
+ }
23070
+ function confineJudgeShell(input, command, dialect = "posix") {
23071
+ try {
23072
+ if (!input.session.agentId)
23073
+ return NONE5;
23074
+ const fed = [];
23075
+ let refused;
23076
+ try {
23077
+ refused = dialect === "posix" ? judgeRefusal(command, fed) : null;
23078
+ } catch {
23079
+ refused = "Workit cannot read this command: split it into simpler ones";
23080
+ }
23081
+ if (refused)
23082
+ return judgeDeny(input, refused);
23083
+ if (dialect === "posix" && substitutingHeredoc(command))
23084
+ return judgeDeny(input, "an unquoted heredoc runs the `$(…)` or backtick command in its body: quote the delimiter (<<'EOF')");
23085
+ let git = [];
23086
+ try {
23087
+ git = rawInvocations(command, dialect).flatMap(({ tool, dir, args }) => tool === "git" && (args[0] === "push" || leadOwnedGit(args)) ? [
23088
+ path30.join(dir === undefined ? UNKNOWN_DIR : path30.resolve(input.cwd, dir ?? "."), `${OPAQUE_TARGET}git`)
23089
+ ] : []);
23090
+ } catch {}
23091
+ return confineJudge(input, [
23092
+ ...shellMutationTargets(input.cwd, command, dialect, true),
23093
+ ...fed.flatMap((body) => shellMutationTargets(input.cwd, body, "posix", true)),
23094
+ ...git
23095
+ ]);
23096
+ } catch {
23097
+ return NONE5;
23098
+ }
23099
+ }
22810
23100
 
22811
23101
  // packages/workit-core/src/hooks/steering.ts
22812
23102
  var ROLES = {
@@ -23380,7 +23670,7 @@ var usable2 = (value) => value === "native" || value === "partial";
23380
23670
  var NONE6 = { kind: "none" };
23381
23671
  var resendsOnChange = (descriptor) => descriptor.context.turnResend === "on-change" && usable2(descriptor.context.perTurn);
23382
23672
  var offered = new Set;
23383
- var implementerAgent = (input, descriptor) => Boolean(input.session.agentId) && input.session.agentType !== null && workitRole(descriptor, input.session.agentType) === "implementer";
23673
+ var agentRole = (input, descriptor) => input.session.agentId && input.session.agentType !== null ? workitRole(descriptor, input.session.agentType) : null;
23384
23674
  var LIMIT_TEXT_MAX = 1000;
23385
23675
  var usageLimitOnStop = (input, agentId, text) => {
23386
23676
  try {
@@ -23494,12 +23784,14 @@ function decide(input, deps) {
23494
23784
  unblock: null
23495
23785
  };
23496
23786
  }
23497
- if (canDeny && implementerAgent(input, descriptor)) {
23498
- const confined = confineImplementerShell(input, event.command, event.dialect);
23787
+ const role = canDeny ? agentRole(input, descriptor) : null;
23788
+ if (role) {
23789
+ const confined = (role === "implementer" ? confineImplementerShell : confineJudgeShell)(input, event.command, event.dialect);
23499
23790
  if (confined.kind === "deny")
23500
23791
  return confined;
23501
23792
  }
23502
- const gate = usable2(descriptor.events["write.pre"].support) ? shellGate(input.cwd, event.command, liveOwner(input, descriptor.transport), event.dialect) : NONE6;
23793
+ const owner = role === "judge" ? null : liveOwner(input, descriptor.transport);
23794
+ const gate = usable2(descriptor.events["write.pre"].support) ? shellGate(input.cwd, event.command, owner, event.dialect) : NONE6;
23503
23795
  if (gate.kind === "deny")
23504
23796
  return gate;
23505
23797
  const plan = heavyGate(input.cwd, event.command, {
@@ -23546,12 +23838,14 @@ function decide(input, deps) {
23546
23838
  case "write.pre": {
23547
23839
  if (!usable2(descriptor.events["write.pre"].support))
23548
23840
  return NONE6;
23549
- if (implementerAgent(input, descriptor)) {
23550
- const confined = confineImplementer(input, liveTargets(input.cwd, event.paths));
23841
+ const role = agentRole(input, descriptor);
23842
+ if (role) {
23843
+ const targets = liveTargets(input.cwd, event.paths);
23844
+ const confined = role === "implementer" ? confineImplementer(input, targets) : confineJudge(input, targets);
23551
23845
  if (confined.kind === "deny")
23552
23846
  return confined;
23553
23847
  }
23554
- return writeGate(input.cwd, event.paths, liveOwner(input, descriptor.transport));
23848
+ return writeGate(input.cwd, event.paths, role === "judge" ? null : liveOwner(input, descriptor.transport));
23555
23849
  }
23556
23850
  case "subagent.start":
23557
23851
  if (workitRole(descriptor, event.agentType) === "judge")
@@ -60,7 +60,7 @@ var quietEvent = () => {
60
60
  const tool = value.tool_name.toLowerCase();
61
61
  if (event === "PreToolUse" && WRITE_TOOLS.has(tool.replace(/[_-]/g, "")))
62
62
  return null;
63
- if (event === "PreToolUse" && value.agent_type === "workit-implementer")
63
+ if (event === "PreToolUse" && /^workit-(?:implementer|verifier|reviewer)$/.test(String(value.agent_type ?? "")))
64
64
  return null;
65
65
  const shell = SHELL_TOOLS.has(tool);
66
66
  const command = value.tool_input?.command;
@@ -84,7 +84,7 @@ if (quiet) {
84
84
  `);
85
85
  } else {
86
86
  try {
87
- const { runCodexHook } = await import("./workit-hook-1t5fcvt5.js");
87
+ const { runCodexHook } = await import("./workit-hook-nsn8wg8v.js");
88
88
  await runCodexHook([payload]);
89
89
  } catch (error) {
90
90
  const { answerRuntimeFailure } = await import("./workit-hook-ehy7rps6.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/codex",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
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": [
@@ -41,8 +41,8 @@
41
41
  "build": "bun scripts/build.ts"
42
42
  },
43
43
  "devDependencies": {
44
- "@workit-dev/core": "^1.2.0",
45
- "@workit-dev/mcp": "^1.2.0"
44
+ "@workit-dev/core": "^1.2.1",
45
+ "@workit-dev/mcp": "^1.2.1"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"