@workit-dev/codex 2.11.0 → 2.11.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": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -31544,78 +31544,6 @@ var MUTATING_REMOTE = new Set([
31544
31544
  "set-branches",
31545
31545
  "prune"
31546
31546
  ]);
31547
- var GIT_VERBS = {
31548
- log: "@d@l|@d @l",
31549
- show: "@d@l|@d @l",
31550
- diff: "@d|@d cached staged merge-base no-index",
31551
- "diff-tree": "@drtcm|@d root stdin no-commit-id",
31552
- "diff-index": "@dm|@d cached merge-base",
31553
- status: "sbu?zv|short branch porcelain? long untracked-files? ignored? ignore-submodules? show-stash ahead-behind no-ahead-behind renames no-renames find-renames? column? no-column null verbose",
31554
- "rev-parse": "q|verify short? abbrev-ref? symbolic symbolic-full-name show-toplevel show-prefix git-dir git-common-dir absolute-git-dir is-inside-work-tree is-inside-git-dir is-bare-repository show-cdup quiet all branches? tags? remotes? since= until= default= path-format= sq-quote",
31555
- "rev-list": "@l|@l count objects? left-only right-only",
31556
- "ls-files": "cdmoiskuvtzfx:X:|cached deleted modified others ignored stage unmerged killed directory no-empty-directory exclude-standard exclude= exclude-from= full-name abbrev? error-unmatch with-tree= eol deduplicate format= recurse-submodules sparse",
31557
- "ls-tree": "rdtlz|long name-only name-status object-only full-name full-tree abbrev? format=",
31558
- "cat-file": "tsepz|batch? batch-check? batch-all-objects follow-symlinks unordered buffer allow-unknown-type mailmap use-mailmap",
31559
- blame: "L:lstfnepwbcM?C?|porcelain line-porcelain incremental root show-stats show-name show-number show-email abbrev= reverse= first-parent date= ignore-rev= ignore-revs-file= minimal contents=",
31560
- describe: "|tags all long abbrev= contains always dirty? broken? match= exclude= first-parent exact-match candidates= debug",
31561
- "merge-base": "a|all octopus independent is-ancestor fork-point",
31562
- "for-each-ref": "|count= sort= format= color? shell perl python tcl points-at= merged? no-merged? contains? no-contains? ignore-case omit-empty exclude=",
31563
- shortlog: "@lsnec|@l summary numbered email committer group= format=",
31564
- "show-ref": "dsq|head verify heads tags branches hash? abbrev? quiet dereference exists",
31565
- "name-rev": "|tags refs= exclude= all annotate-stdin name-only no-undefined always",
31566
- grep: "aiIvnhHcEGFPlLzoWqwe:A:B:C:m:f:|cached untracked no-index no-exclude-standard exclude-standard recurse-submodules text ignore-case word-regexp invert-match line-number column count full-name extended-regexp basic-regexp fixed-strings perl-regexp files-with-matches name-only files-without-match null only-matching heading break show-function function-context max-depth= threads= and or not all-match quiet after-context= before-context= context= max-count= color? no-color",
31567
- "format-patch": "@do:nNks|@d stdout output-directory= numbered no-numbered start-number= subject-prefix= root cover-letter thread? signoff attach? inline? suffix= base=",
31568
- reflog: "@l|@l all expire= expire-unreachable= rewrite updateref stale-fix dry-run verbose",
31569
- "count-objects": "vH|verbose human-readable",
31570
- "check-ignore": "qvnz|quiet verbose stdin non-matching no-index",
31571
- var: "l|",
31572
- version: "|build-options",
31573
- "ls-remote": "htbq|heads tags branches refs quiet exit-code get-url symref sort=",
31574
- remote: "v|verbose",
31575
- config: "lz|get get-all get-regexp list local name-only null type= default=",
31576
- worktree: "fdqvzb:B:|force detach lock reason= orphan no-checkout checkout quiet track no-track guess-remote porcelain expire= verbose",
31577
- branch: "dDmMcCfvraliu:|delete move copy force list all remotes verbose contains? merged? no-merged? points-at= show-current set-upstream-to= unset-upstream track? no-track sort= format= color? column? ignore-case create-reflog",
31578
- tag: "lam:dfF:n?|list annotate message= file= delete force sort= format= contains? merged? no-merged? points-at= column? create-reflog ignore-case",
31579
- init: "+qb:|quiet bare initial-branch= object-format= ref-format= shared? separate-git-dir=",
31580
- add: "+AunNvf|all update intent-to-add force dry-run verbose ignore-errors ignore-removal no-all renormalize chmod= sparse",
31581
- commit: "+m:aqsnF:C:ouv|message= all amend no-edit allow-empty allow-empty-message author= date= signoff no-verify quiet file= reuse-message= fixup= squash= only include dry-run no-gpg-sign untracked-files? cleanup= reset-author verbose",
31582
- checkout: "+b:B:fqm|detach force orphan= quiet track? no-track merge ours theirs",
31583
- switch: "+c:C:dfqm|create= force-create= detach discard-changes force orphan= quiet track? no-track merge",
31584
- restore: "+s:SWq|source= staged worktree ours theirs merge quiet overlay no-overlay",
31585
- reset: "+qN|soft mixed hard merge keep quiet no-refresh",
31586
- rm: "+rfnq|cached force dry-run quiet ignore-unmatch",
31587
- mv: "+fnkv|force dry-run verbose",
31588
- merge: "+m:qvnX:|no-ff ff ff-only squash no-squash commit no-commit message= no-edit abort continue quit allow-unrelated-histories stat no-stat quiet verbose no-verify signoff strategy-option=",
31589
- stash: "+m:ukqa|message= include-untracked keep-index quiet all index staged",
31590
- apply: "+p:C:R3qv|check stat numstat summary index cached 3way reverse reject allow-empty exclude= include= verbose quiet whitespace= recount",
31591
- am: "+skq3|signoff keep 3way quiet abort continue skip quit whitespace= reject",
31592
- fetch: "+fqvptn|all depth= deepen= shallow-since= unshallow tags no-tags prune force quiet verbose dry-run update-shallow refmap=",
31593
- clone: "+nqlsb:o:|bare no-checkout depth= branch= origin= single-branch no-single-branch no-tags quiet shared local no-local filter= separate-git-dir=",
31594
- "cherry-pick": "+nm:sxX:|no-commit mainline= signoff abort continue skip quit allow-empty keep-redundant-commits ff strategy-option=",
31595
- revert: "+nm:sX:|no-commit mainline= signoff abort continue skip quit strategy-option= no-edit",
31596
- rebase: "+qvfnX:|onto= root abort continue skip quit keep-base no-ff force-rebase autosquash no-autosquash autostash no-autostash update-refs signoff quiet verbose stat no-stat committer-date-is-author-date reset-author-date rebase-merges? no-rebase-merges empty= strategy-option= apply merge",
31597
- clean: "+dfnqxXe:|dry-run force quiet exclude=",
31598
- bisect: "+|term-old= term-new= no-checkout first-parent"
31599
- };
31600
- var JUDGE_GIT = `a judge runs git ${Object.keys(GIT_VERBS).join(" ")} with the options each documents (no abbreviations), writing only in a scratch repo; no -c, no wrapper but timeout, nice, time, command, no env but PAGER=cat, GIT_PAGER=cat, GIT_OPTIONAL_LOCKS=0, LC_*, LANG, TZ; status outside scratch needs --no-optional-locks`;
31601
- var JUDGE_VERBS = {
31602
- check: true,
31603
- dir: true,
31604
- help: true,
31605
- "test-audit": true,
31606
- ledger: ["verdict", "list", "check", "ruling", "show"],
31607
- finding: ["record", "list"],
31608
- pr: ["status"],
31609
- ci: ["wait", "logs"],
31610
- fanout: ["status", "brief"],
31611
- models: ["show"],
31612
- lock: ["status"],
31613
- lease: ["status"],
31614
- grant: ["show"],
31615
- task: ["show", "list"],
31616
- doctor: ["--json"]
31617
- };
31618
- var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
31619
31547
 
31620
31548
  // packages/workit-core/src/hooks/standing.ts
31621
31549
  var DESCRIPTORS = {
@@ -20115,8 +20115,10 @@ var opaqueWrites = (input, scriptOf = (index) => input[index], fed) => {
20115
20115
  return curlOutputs(args);
20116
20116
  if (name === "perl")
20117
20117
  return inline(/^-[a-zA-Z]*[eE]$/);
20118
+ if (name.startsWith("python") && args.some((arg, at) => arg === "-m" && args[at + 1] !== "json.tool"))
20119
+ return [".", ...args.flatMap(pathsIn)];
20118
20120
  if (/^(?:python[\d.]*|node|bun|deno|ruby|php)$/.test(name))
20119
- return inline(/^-[a-zA-Z]*[ce]$|^--eval$|^-p$/);
20121
+ return inline(/^-[a-zA-Z]*[cep]$|^--(?:eval|print)$/);
20120
20122
  return shellScript2(words) === null ? null : ["."];
20121
20123
  };
20122
20124
  var CURL_LONG = [
@@ -20849,7 +20851,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
20849
20851
  shells.push(...read(named));
20850
20852
  shells.push(...preloads.flatMap(read));
20851
20853
  } else if (INTERPRETERS.test(verb)) {
20852
- const code = args.findIndex((arg) => /^-[a-zA-Z]*[ce]$|^--eval$/.test(arg));
20854
+ const code = args.findIndex((arg) => /^-[a-zA-Z]*[cep]$|^--(?:eval|print)$/.test(arg));
20853
20855
  if (code >= 0)
20854
20856
  others.push(...expansions(args[code + 1] ?? "", vars, loops));
20855
20857
  others.push(...named === undefined ? [...segment.stdin ?? [], ...inputs.flatMap(read), ...piped] : read(named), ...preloads.flatMap(read));
@@ -22673,50 +22675,38 @@ var shown = (target) => {
22673
22675
  const named = /^\.workit-(?:live-target$|runs-)/.test(path32.basename(target)) ? path32.dirname(target) : target;
22674
22676
  return path32.sep === "\\" ? named.replaceAll("/", "\\") : named;
22675
22677
  };
22676
- var unboundDeny = (input, target) => {
22677
- const unblock = "Work only in the worktree your brief names, which the lead made with `workit fanout worktree create <slice>`: edit files under it and run one verb per call against it (`workit git --cwd <worktree> commit -m … -- <paths>`, `workit check --cwd <worktree> <name>`). If your brief names no worktree, stop and report that to the lead.";
22678
- return {
22679
- kind: "deny",
22680
- reason: `workit worktree confinement: implementer ${input.session.agentId} is not working in a Workit worktree yet, and ${shown(target)} is outside every worktree \`workit fanout worktree create\` made, so it would change the lead's checkout. ${unblock}`,
22681
- unblock
22682
- };
22683
- };
22684
- var outsideDeny = (input, worktree, target) => {
22678
+ var runFrom = (dir, command) => `cd ${dir} && ${command.replace(/^\s*cd\s+\S+\s*(?:&&|;)\s*/, "")}`;
22679
+ var deny2 = (what, unblock) => ({
22680
+ kind: "deny",
22681
+ reason: `${what}.
22682
+ ${unblock}`,
22683
+ unblock
22684
+ });
22685
+ var unboundDeny = (input, target) => deny2(`workit worktree confinement: implementer ${input.session.agentId} is not working in a Workit worktree yet, and ${shown(target)} is outside every one`, "Why: work only in your brief's worktree (`workit fanout worktree create <slice>`); with none, tell the lead.");
22686
+ var outsideDeny = (input, worktree, target, command) => {
22685
22687
  const runner = runnerAt(target);
22686
- const unblock = `${runner === null ? "" : `Run \`${runner}\` from your worktree: \`cd ${worktree} && …\`. `}Edit only under ${worktree} and run git there, one verb per call: \`workit git --cwd ${worktree} commit -m … -- <paths>\`, \`workit check --cwd ${worktree} <name>\` (or \`git -C ${worktree} …\`); a command whose writes Workit cannot see is judged by the directory it runs in. Anything outside it is a follow-up for your report.`;
22687
- return {
22688
- kind: "deny",
22689
- reason: `workit worktree confinement: implementer ${input.session.agentId} is bound to the worktree ${worktree}, and ${runner === null ? `${shown(target)} is` : `\`${runner}\` runs in ${shown(target)},`} outside it. ${unblock}`,
22690
- unblock
22691
- };
22692
- };
22693
- var unknownDirDeny = (input, worktree) => {
22694
- const wt = worktree ?? "<worktree>";
22695
- const unblock = `Workit cannot resolve \`cd -\`, \`cd "$X"\` or \`popd\`: write by absolute path, \`git -C ${wt}\` or \`workit <verb> --cwd ${wt}\`.`;
22696
- return {
22697
- kind: "deny",
22698
- reason: `workit worktree confinement: implementer ${input.session.agentId} writes after an unknown directory change. ${unblock}`,
22699
- unblock
22700
- };
22688
+ return deny2(`workit worktree confinement: implementer ${input.session.agentId} is bound to the worktree ${worktree}, and ${runner === null ? `${shown(target)} is` : `\`${runner}\` runs in ${shown(target)},`} outside it`, runner !== null && command ? `Retry as: ${runFrom(worktree, command)}` : `Why: edit only under ${worktree}, git one verb per call (\`workit git --cwd ${worktree} commit -m … -- <paths>\`); the rest is a follow-up.`);
22701
22689
  };
22690
+ var unknownDirDeny = (input, worktree) => deny2(`workit worktree confinement: implementer ${input.session.agentId} writes after a directory change Workit cannot resolve (\`cd -\`, \`cd "$X"\`, \`popd\`)`, `Why: write by absolute path, \`git -C ${worktree ?? "<worktree>"}\` or \`workit <verb> --cwd\`.`);
22691
+ var refsOf = (targets) => [
22692
+ ...new Set(targets.flatMap((target) => path32.relative(UNKNOWN_VAR, path32.resolve(target)).split(path32.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
22693
+ ];
22702
22694
  var literalForm = (command, refs) => {
22703
22695
  let text = command;
22704
- for (const ref of refs) {
22696
+ for (const ref of refs.filter((one) => /^[$`]/.test(one))) {
22705
22697
  const placeholder = `<absolute path of ${ref}>`;
22706
22698
  const name = /^\$(\w+)$/.exec(ref)?.[1];
22707
22699
  text = name ? text.replace(new RegExp(`\\$\\{${name}[^}]*\\}|\\$${name}(?!\\w)`, "g"), placeholder) : text.replaceAll(ref, placeholder);
22708
22700
  }
22709
22701
  return text.length > 600 ? `${text.slice(0, 600)}…` : text;
22710
22702
  };
22711
- var unknownVarDeny = (input, worktree, targets, command) => {
22712
- const refs = [
22713
- ...new Set(targets.flatMap((target) => path32.relative(UNKNOWN_VAR, path32.resolve(target)).split(path32.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
22714
- ];
22703
+ var unknownVarDeny = (input, targets, command) => {
22704
+ const refs = refsOf(targets);
22715
22705
  let text = command ?? "";
22716
22706
  const first = [];
22717
22707
  const named = refs.map((ref) => {
22718
22708
  const name = /^\$(\w+)$/.exec(ref)?.[1];
22719
- const set = name ? new RegExp(`(^|[\\s;&|(])${name}=("?)(\\$\\([^()]*\\)|\`[^\`]*\`)\\2[ \\t]*(?:&&|;|\\n)?[ \\t]*`).exec(text) : null;
22709
+ const set = name ? new RegExp(`(^|[\\s;&|(])${name}=("?)(\\$\\([^()]*\\)|\`[^\`]*\`)\\2[ \\t]*(?:&&|;|\\n|$)[ \\t]*`).exec(text) : null;
22720
22710
  const sub = set?.[3] ?? (/^(?:\$\(|`)/.test(ref) ? ref : null);
22721
22711
  if (sub === null)
22722
22712
  return ref;
@@ -22725,15 +22715,8 @@ var unknownVarDeny = (input, worktree, targets, command) => {
22725
22715
  first.push(`Run \`${sub.slice(sub.startsWith("`") ? 1 : 2, -1).trim()}\` first, then`);
22726
22716
  return sub === ref ? ref : `${ref} (set by \`${sub}\`)`;
22727
22717
  });
22728
- const wt = worktree ?? "<worktree>";
22729
- const literal = literalForm(text, refs.filter((ref) => /^[$`]/.test(ref)));
22730
- const retry = command === undefined || literal === command ? "" : ` ${first.length ? `${first.join(" ")} retry` : "Retry"} as: \`${literal}\`.`;
22731
- const unblock = `Spell the path out instead of ${refs.join(", ")}: Workit follows only \`NAME=<literal>\`, \`$(mktemp …)\`, \`$(pwd)\`, \`$PWD\` after a literal \`cd\` and a \`for\` over literal words.${retry} Write under ${wt} or a temp dir.`;
22732
- return {
22733
- kind: "deny",
22734
- reason: `workit worktree confinement: implementer ${input.session.agentId} writes to a path built from ${named.join(", ")}, which Workit cannot resolve, so it cannot tell whether the write stays in its worktree. ${unblock}`,
22735
- unblock
22736
- };
22718
+ const literal = literalForm(text, refs);
22719
+ return deny2(`workit worktree confinement: implementer ${input.session.agentId} writes to a path built from ${named.join(", ")}, which Workit cannot resolve`, command === undefined || literal === command ? `Why: spell the path out; Workit follows only \`NAME=<literal>\`, \`$(pwd)\` and literal \`for\` words.` : first.length ? `${first.join(" ")} retry as: \`${literal}\`` : `Retry as: ${literal}`);
22737
22720
  };
22738
22721
  function confineImplementer(input, targets, command) {
22739
22722
  try {
@@ -22741,7 +22724,7 @@ function confineImplementer(input, targets, command) {
22741
22724
  return NONE5;
22742
22725
  const unresolved = targets.filter((target) => within(path32.resolve(target), UNKNOWN_VAR));
22743
22726
  if (unresolved.length > 0)
22744
- return unknownVarDeny(input, boundWorktree(input), unresolved, command);
22727
+ return unknownVarDeny(input, unresolved, command);
22745
22728
  if (targets.some((target) => within(path32.resolve(target), UNKNOWN_DIR)))
22746
22729
  return unknownDirDeny(input, boundWorktree(input));
22747
22730
  const bindings = canonical5(bindingDir());
@@ -22761,7 +22744,7 @@ function confineImplementer(input, targets, command) {
22761
22744
  }
22762
22745
  const root = canonical5(worktree);
22763
22746
  const outside = judged.find(({ real }) => !within(real, root) || within(real, bindings));
22764
- return outside ? outsideDeny(input, worktree, outside.named) : NONE5;
22747
+ return outside ? outsideDeny(input, worktree, outside.named, command) : NONE5;
22765
22748
  } catch {
22766
22749
  return NONE5;
22767
22750
  }
@@ -22826,14 +22809,7 @@ var leadOwnedWorkit = (args) => !args.includes("--help") && args.some((_, start)
22826
22809
  const [verb, sub] = skipWorkitGlobals(args.slice(start)).rest;
22827
22810
  return verb === "fanout" && /^(?:plan|worktree)$/.test(sub ?? "");
22828
22811
  });
22829
- var leadOwnedDeny = (input, command) => {
22830
- const unblock = "Worktrees, branches other than your own, refs, tags, remotes, git config, the shared stash and the fan-out plan belong to the lead: report what you need changed as a follow-up instead.";
22831
- return {
22832
- kind: "deny",
22833
- reason: `workit worktree confinement: implementer ${input.session.agentId} may not run \`${command.slice(0, 160)}\`. ${unblock}`,
22834
- unblock
22835
- };
22836
- };
22812
+ var leadOwnedDeny = (input, command) => deny2(`workit worktree confinement: implementer ${input.session.agentId} may not run \`${command.slice(0, 160)}\``, "Why: worktrees, other branches, refs, remotes, git config, the stash and the fan-out plan belong to the lead: a follow-up.");
22837
22813
  function confineImplementerShell(input, command, dialect = "posix") {
22838
22814
  try {
22839
22815
  if (!input.session.agentId || hostIsolated(input.cwd, input.session.agentId))
@@ -22843,6 +22819,9 @@ function confineImplementerShell(input, command, dialect = "posix") {
22843
22819
  } catch {}
22844
22820
  return confineImplementer(input, shellMutationTargets(input.cwd, command, dialect, true), command);
22845
22821
  }
22822
+ var LITERAL_SET = /^\s*([A-Za-z_]\w*)=(['"]?)((?:[\w@%+=:./\\-]|(?<=[^\s:=])~)*)\2[ \t]*(?:;|&&|\n)\s*/;
22823
+ var SPELLED = /^(?:[A-Za-z]|wt|wd|dir|repo|root|base|sha|ref|branch|file|out|scratch|worktree|WT|WD|DIR|REPO|ROOT|BASE|SHA|REF|BRANCH|FILE|OUT|SCRATCH|WORKTREE)$/;
22824
+ var ENV_READ = /^(?:GIT_|LD_|DYLD_|NODE_|PYTHON|PERL|RUBY|BASH|EPOCH|(?:ENV|IFS|CDPATH|PS\d|PWD|OLDPWD|REPLY|OPTARG|OPTIND|MAPFILE|S?RANDOM|SECONDS|LINENO|E?UID|PPID|_|HOSTNAME|HISTCMD)$)/;
22846
22825
  var SCRATCH = ".workit-scratch";
22847
22826
  var SHELL_NAMES = /^(?:sh|bash|zsh|dash|ksh|mksh|ash)$/;
22848
22827
  var INTERPRETERS2 = /^(?:python[\d.]*|node|bun|deno|ruby|perl|php)$/;
@@ -22960,7 +22939,8 @@ var GIT_VERBS = {
22960
22939
  var: "l|",
22961
22940
  version: "|build-options",
22962
22941
  "ls-remote": "htbq|heads tags branches refs quiet exit-code get-url symref sort=",
22963
- remote: "v|verbose",
22942
+ remote: "v|verbose push all",
22943
+ "range-diff": "@d|@d creation-factor= no-dual-color left-only right-only",
22964
22944
  config: "lz|get get-all get-regexp list local name-only null type= default=",
22965
22945
  worktree: "fdqvzb:B:|force detach lock reason= orphan no-checkout checkout quiet track no-track guess-remote porcelain expire= verbose",
22966
22946
  branch: "dDmMcCfvraliu:|delete move copy force list all remotes verbose contains? merged? no-merged? points-at= show-current set-upstream-to= unset-upstream track? no-track sort= format= color? column? ignore-case create-reflog",
@@ -23046,7 +23026,7 @@ var gitKind = (args, local = () => true) => {
23046
23026
  case "worktree":
23047
23027
  return first === "list" ? "read" : /^(?:add|remove)$/.test(first) ? "write" : null;
23048
23028
  case "remote":
23049
- return !first || first === "show" && named.length === 2 && local(second, true) ? "read" : null;
23029
+ return !first || first === "get-url" || first === "show" && named.length === 2 && local(second, true) ? "read" : null;
23050
23030
  case "ls-remote":
23051
23031
  return local(first || "origin", true) ? "read" : null;
23052
23032
  case "bisect":
@@ -23063,7 +23043,6 @@ var gitKind = (args, local = () => true) => {
23063
23043
  }
23064
23044
  return GIT_VERBS[verb].startsWith("+") ? "write" : "read";
23065
23045
  };
23066
- var JUDGE_GIT = `a judge runs git ${Object.keys(GIT_VERBS).join(" ")} with the options each documents (no abbreviations), writing only in a scratch repo; no -c, no wrapper but timeout, nice, time, command, no env but PAGER=cat, GIT_PAGER=cat, GIT_OPTIONAL_LOCKS=0, LC_*, LANG, TZ; status outside scratch needs --no-optional-locks`;
23067
23046
  var remoteIn = (dir, name, repo) => {
23068
23047
  const shared = path32.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo, false)?.[1] : undefined;
23069
23048
  if (!shared)
@@ -23106,14 +23085,12 @@ var judgeGit = (command, repo, cwd, depth = 0) => {
23106
23085
  why ??= `\`${word}\` is not allowed`;
23107
23086
  let index = start < 0 ? words.length : start + 1;
23108
23087
  let dir = "";
23109
- let unlocked = lead.includes("GIT_OPTIONAL_LOCKS=0");
23110
23088
  for (;!why && words[index]?.startsWith("-") && words[index] !== "--version"; index++) {
23111
23089
  const word = words[index];
23112
23090
  const flag = /^--(git-dir|work-tree)(?:=([\s\S]*))?$/.exec(word);
23113
23091
  const value = flag?.[2] ?? (/^(?:-C|--git-dir|--work-tree)$/.test(word) ? words[++index] : "");
23114
23092
  if (word === "-C")
23115
23093
  dir = value;
23116
- unlocked ||= word === "--no-optional-locks";
23117
23094
  if (flag ? !literalIn(value, repo) : !/^(?:-C|-P|--no-pager|--no-optional-locks)$/.test(word))
23118
23095
  why = `\`${word}\` is not allowed`;
23119
23096
  }
@@ -23125,11 +23102,6 @@ var judgeGit = (command, repo, cwd, depth = 0) => {
23125
23102
  const fetches = args[0] === "fetch" && plainFetch(args.slice(1)) && home && (home.workit || commonDir(home.root) === repo) && !words.some((word) => /^--[gw]/.test(word));
23126
23103
  if (!fetches && !gitKind(args, local))
23127
23104
  why = `\`git ${args.slice(0, 2).join(" ")}\` is not allowed`;
23128
- else if (args[0] === "status" && !unlocked) {
23129
- const dirs = path32.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo) : null;
23130
- if (!dirs?.length || !dirs.every((gitDir) => inScratch(gitDir, repo)))
23131
- why = "`git status` refreshes the index outside scratch: add --no-optional-locks";
23132
- }
23133
23105
  }
23134
23106
  const shell = /^(?:grep|egrep|rg|echo|printf|cat)$/.test(name) ? -1 : words.findIndex((word) => /^(?:sh|bash|zsh|dash|ksh|mksh|ash)$/.test(path32.basename(word)));
23135
23107
  const scripts = [
@@ -23195,7 +23167,6 @@ var workitCalls = (command, depth = 0, aliases = new Map) => depth > 4 ? [] : co
23195
23167
  at++;
23196
23168
  return [words.slice(at + 1)];
23197
23169
  });
23198
- var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
23199
23170
  var judgeRefusal = (command, fed, depth = 0) => {
23200
23171
  let moved = false;
23201
23172
  for (const segment of segmentsOf(command)) {
@@ -23217,6 +23188,9 @@ var judgeRefusal = (command, fed, depth = 0) => {
23217
23188
  moved = true;
23218
23189
  if (name === "eval" || (name === "source" || name === ".") && FED.test(args[0] ?? ""))
23219
23190
  return unseen;
23191
+ const set = words.find((word) => /^(?:NODE_OPTIONS|PYTHON(?:STARTUP|PATH|HOME)|PERL5(?:OPT|LIB)|RUBY(?:OPT|LIB)|LD_\w+|DYLD_\w+|REPLY|OPTARG|OPTIND|MAPFILE|READLINE_\w+|S?RANDOM|SECONDS|LINENO|E?UID|PPID|OLDPWD|_|HOSTNAME|HISTCMD|EPOCH\w*)=/.test(word));
23192
+ if (set)
23193
+ return `\`${set.slice(0, 80)}\` sets a loader or shell-set name`;
23220
23194
  if (SHELL_NAMES.test(name)) {
23221
23195
  let operand;
23222
23196
  let stdin = false;
@@ -23263,7 +23237,7 @@ var judgeRefusal = (command, fed, depth = 0) => {
23263
23237
  for (const args of workitCalls(command)) {
23264
23238
  const call = judgeVerbRefused(args);
23265
23239
  if (call)
23266
- return `\`${call}\` is not a judge's job: a judge runs only ${JUDGE_JOB}`;
23240
+ return `\`${call}\` is not a judge's job: a judge runs only read-only workit verbs`;
23267
23241
  }
23268
23242
  return null;
23269
23243
  };
@@ -23285,20 +23259,31 @@ var substitutingHeredoc = (command) => {
23285
23259
  }
23286
23260
  return false;
23287
23261
  };
23288
- var judgeDeny = (input, what, target) => {
23262
+ var judgeDeny = (input, what, target, retry) => {
23289
23263
  const role = input.session.agentType?.endsWith("reviewer") ? "reviewer" : "verifier";
23290
23264
  const root = checkoutOf2(input.cwd)?.root;
23291
23265
  const candidate = target ? checkoutOf2(target)?.root : undefined;
23292
- const also = root && candidate && candidate !== root && commonDir(candidate) === commonDir(root) ? ` or ${path32.join(candidate, SCRATCH)}` : "";
23293
- const scratch = root ? `${path32.join(root, SCRATCH)}${also}` : `${SCRATCH}/ at the root of the checkout you judge`;
23294
- 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\`, \`workit ledger verdict\` and \`workit finding record\` stay allowed; a change the candidate needs is a finding, not an edit.`;
23266
+ const other = root && candidate && candidate !== root && commonDir(candidate) === commonDir(root) ? path32.join(candidate, SCRATCH) : undefined;
23267
+ const scratch = root ? `${path32.join(root, SCRATCH)}${other ? ` or ${other}` : ""}` : `${SCRATCH}/ at the root of the checkout you judge`;
23268
+ const call = root ? retry?.((other ?? path32.join(root, SCRATCH)).replaceAll("\\", "/")) : null;
23269
+ const unblock = call ? `Retry as: ${call}` : "Why: write only there (mkdir -p it); a fix the candidate needs is a finding (`workit finding record`).";
23295
23270
  return {
23296
23271
  kind: "deny",
23297
- reason: `workit scratch confinement: ${role} ${input.session.agentId} may write only in its scratch dir ${scratch}, and ${what}. ${unblock}`,
23272
+ reason: `workit scratch confinement: ${role} ${input.session.agentId} may write only in its scratch dir ${scratch}, and ${what}.
23273
+ ${unblock}`,
23298
23274
  unblock
23299
23275
  };
23300
23276
  };
23301
- function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
23277
+ var movedInto = (command, cwd, target, dir) => {
23278
+ for (const { words, redirects } of segmentsOf(command))
23279
+ for (const word of [...redirects, ...path32.basename(words[0] ?? "") === "tee" ? words : []])
23280
+ if (path32.resolve(cwd, word) === path32.resolve(cwd, target)) {
23281
+ const moved = command.replace(new RegExp(`((?:>>?\\|?|\\btee(?:\\s+-a)?)\\s*)(['"]?)${word.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&")}\\2(?![^\\s;&|)])`), (_, lead) => `${lead}${dir}/${path32.basename(word)}`);
23282
+ return moved === command ? null : moved;
23283
+ }
23284
+ return null;
23285
+ };
23286
+ function confineJudge(input, targets, placeholders = placeholdersOf(targets), command) {
23302
23287
  try {
23303
23288
  if (!input.session.agentId)
23304
23289
  return NONE5;
@@ -23311,7 +23296,10 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
23311
23296
  for (const target of targets) {
23312
23297
  const resolved = path32.resolve(target);
23313
23298
  if (within(resolved, UNKNOWN_VAR) || within(resolved, UNKNOWN_DIR))
23314
- return judgeDeny(input, "it writes to a path Workit cannot resolve (a variable, a command substitution or `cd -`): spell the path out");
23299
+ return judgeDeny(input, "it writes to a path Workit cannot resolve", undefined, () => {
23300
+ const literal = command && literalForm(command, refsOf([target]));
23301
+ return literal === command ? null : literal;
23302
+ });
23315
23303
  const real = canonical5(target);
23316
23304
  const runsGit = placeholders.has(target) && /^\.workit-(?:runs-git|live-target)$/.test(path32.basename(target));
23317
23305
  const gitDirs = runsGit ? gitDirsAt(path32.dirname(real), repo) : [];
@@ -23320,17 +23308,43 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
23320
23308
  if (runsGit ? gitDirs.length > 0 ? gitDirs.every(scratch) : scratch(real) : scratch(real) && !inGitDir(real))
23321
23309
  continue;
23322
23310
  const runner = runnerAt(target);
23323
- return judgeDeny(input, runner === null ? `${shown(target)} is outside it` : `\`${runner}\` runs in ${shown(target)}, outside it`, target);
23311
+ return judgeDeny(input, runner === null ? `${shown(target)} is outside it` : `\`${runner}\` runs in ${shown(target)}, outside it`, target, (dir) => !command || runsGit ? null : runner === null ? movedInto(command, input.cwd, target, dir) : runFrom(dir, command));
23324
23312
  }
23325
23313
  return NONE5;
23326
23314
  } catch {
23327
23315
  return NONE5;
23328
23316
  }
23329
23317
  }
23318
+ var spelledIn = (text, name, value) => text.replace(new RegExp(`\\$(?:${name}(?!\\w)|\\{${name}\\})`, "g"), () => value);
23319
+ var variableRefusal = (command) => {
23320
+ let rest = command;
23321
+ const sets = [];
23322
+ for (let set;set = LITERAL_SET.exec(rest); rest = rest.slice(set[0].length))
23323
+ sets.push([set[1], set[3]]);
23324
+ const loop = /^\s*for\s+(\w+)\s+in\s+([\w@%+=:./ \t-]*?)\s*[;\n]\s*do\s([\s\S]*?);?\s*done\s*$/.exec(rest);
23325
+ for (const name of [...sets.map(([one]) => one), ...loop ? [loop[1]] : []])
23326
+ if (new RegExp(`\\$(?:${name}(?!\\w)|\\{${name}(?![\\w}])|\\{${name}\\})(?![\\s/";&|)]|$)`).test(rest))
23327
+ return { why: `\`$${name}\` has a modifier, subscript or suffix Workit does not spell in` };
23328
+ const odd = [...sets.map(([one]) => one), ...loop ? [loop[1]] : []].find((name) => !SPELLED.test(name) || process.env[name] !== undefined || ENV_READ.test(name));
23329
+ const used = sets.filter(([name]) => name === odd || new RegExp(`\\$\\{?${name}(?!\\w)`).test(rest));
23330
+ if (used.length)
23331
+ return {
23332
+ why: odd ? `\`${odd}=\` sets a name the shell, zsh or git reads itself` : `\`$${used[0][0]}\` is a path from a variable, which Workit does not follow for a judge`,
23333
+ retry: used.reduce((text, [name, value]) => spelledIn(text, name, value), rest)
23334
+ };
23335
+ const items = loop?.[2].split(/\s+/).filter(Boolean) ?? [];
23336
+ return loop && (loop[1] === odd || new RegExp(`\\$\\{?${loop[1]}(?!\\w)`).test(loop[3])) ? {
23337
+ why: `\`$${loop[1]}\` is a loop variable, which Workit does not follow for a judge`,
23338
+ retry: items.length > 16 ? undefined : items.map((item) => spelledIn(loop[3].trim(), loop[1], item)).join("; ")
23339
+ } : null;
23340
+ };
23330
23341
  function confineJudgeShell(input, command, dialect = "posix") {
23331
23342
  try {
23332
23343
  if (!input.session.agentId)
23333
23344
  return NONE5;
23345
+ const variable = dialect === "posix" ? variableRefusal(command) : null;
23346
+ if (variable)
23347
+ return judgeDeny(input, variable.why, undefined, () => variable.retry);
23334
23348
  const fed = [];
23335
23349
  let refused;
23336
23350
  try {
@@ -23342,8 +23356,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
23342
23356
  const judged = checkoutOf2(input.cwd);
23343
23357
  try {
23344
23358
  const why = judgeGit(command, judged ? commonDir(judged.root) : null, /\b(?:cd|chdir|pushd|popd)\b/.test(command) ? null : input.cwd);
23345
- if (why)
23346
- refused = `${why}: ${JUDGE_GIT}`;
23359
+ refused = why;
23347
23360
  } catch {
23348
23361
  refused = "Workit cannot read this command: split it into simpler ones";
23349
23362
  }
@@ -23351,7 +23364,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
23351
23364
  if (refused)
23352
23365
  return judgeDeny(input, refused);
23353
23366
  if (dialect === "posix" && substitutingHeredoc(command.replaceAll("\\\n", "")))
23354
- return judgeDeny(input, "an unquoted heredoc runs the `$(…)` or backtick command in its body: quote the delimiter (<<'EOF')");
23367
+ return judgeDeny(input, "an unquoted heredoc runs the `$(…)` or backtick command in its body: quote the delimiter (<<'EOF')", undefined, () => command.replace(/<<(-?)[ \t]*(\w+)/g, "<<$1'$2'"));
23355
23368
  let git = [];
23356
23369
  try {
23357
23370
  git = rawInvocations(command, dialect).flatMap(({ tool, dir, args }) => tool === "git" && (args[0] === "push" || leadOwnedGit(args) || gitKind(args) === "write" && !/^(?:init|clone)$/.test(args[0]) && !(args[0] === "fetch" && plainFetch(args.slice(1)))) ? [
@@ -23362,7 +23375,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
23362
23375
  shellMutationTargets(input.cwd, command, dialect, true),
23363
23376
  ...fed.map((body) => shellMutationTargets(input.cwd, body, "posix", true))
23364
23377
  ];
23365
- return confineJudge(input, [...lists.flat(), ...git], new Set([...git, ...lists.flatMap((list) => [...placeholdersOf(list)])]));
23378
+ return confineJudge(input, [...lists.flat(), ...git], new Set([...git, ...lists.flatMap((list) => [...placeholdersOf(list)])]), command);
23366
23379
  } catch {
23367
23380
  return NONE5;
23368
23381
  }
@@ -24448,9 +24461,11 @@ var ytrackGate = (cwd, command, dialect, ask) => {
24448
24461
  const run = calls.length ? ` Run ${calls.join(", then ")} instead, each as its own plain call: it asks the user first.` : "";
24449
24462
  const user = bare.length ? ask ? ` For ${bare.join(", ")}, run it as its own plain call: the host asks the user.` : ` For ${bare.join(", ")}, the user decides: ask the user, and if they agree they run it in their own terminal.` : "";
24450
24463
  const rerun = writes.some((write) => write.gap === NOT_PLAIN.gap) ? " To get the named workit youtrack call instead, rerun the ytrack call as one plain command, with no wrapper, loop, substitution or script around it." : "";
24464
+ const retry = writes.find((write) => write.workit)?.workit ?? (rerun ? writes.find((write) => write.gap === NOT_PLAIN.gap)?.command : undefined);
24451
24465
  return {
24452
24466
  kind: "deny",
24453
- reason: `${why}${run}${user}${rerun}`,
24467
+ reason: `${why}${run}${user}${rerun}${retry ? `
24468
+ Retry as: ${retry}` : ""}`,
24454
24469
  unblock: writes[0]?.workit ?? null
24455
24470
  };
24456
24471
  };
@@ -101,7 +101,7 @@ if (quiet) {
101
101
  `);
102
102
  } else {
103
103
  try {
104
- const { runCodexHook } = await import("./workit-hook-py08h373.js");
104
+ const { runCodexHook } = await import("./workit-hook-3e2eetcr.js");
105
105
  await runCodexHook([payload]);
106
106
  } catch (error) {
107
107
  const { answerRuntimeFailure } = await import("./workit-hook-9k8dtngs.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/codex",
3
- "version": "2.11.0",
3
+ "version": "2.11.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": "^2.11.0",
45
- "@workit-dev/mcp": "^2.11.0"
44
+ "@workit-dev/core": "^2.11.1",
45
+ "@workit-dev/mcp": "^2.11.1"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"