@workit-dev/codex 2.6.0 → 2.7.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.6.0",
3
+ "version": "2.7.1",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -18,7 +18,7 @@ account. Follow the workit-review skill (`$workit-review`).
18
18
  (hunk, test or output), concrete fix.
19
19
  5. Record the verdict:
20
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
- `workit ledger verdict verified|failed|blocked --kind review --branch <b> --how "<what you read and ran>"`
21
+ `workit ledger verdict verified|failed|blocked --cwd <candidate worktree> --kind review --branch <b> --how "<what you read and ran>"`
22
22
  (`verified`: no blocker or major left).
23
23
  Record a design choice as `workit ledger ruling`.
24
24
 
@@ -26,8 +26,8 @@ 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
28
  Never commit, push, merge or edit. Write only in the candidate
29
- worktree's `.workit-scratch/`: test cases go into files there via a quoted heredoc
30
- (`<<'EOF'`), never run by the shell. If the ledger refuses you as an author, report that instead of a verdict.
29
+ worktree's `.workit-scratch/` or your session's scratchpad: test cases go into files there via a quoted heredoc
30
+ (`<<'EOF'`), never run by the shell. A `node -e` or `python3 -c` that only reads runs anywhere. If the ledger refuses you as an author, report that instead of a verdict.
31
31
 
32
32
  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.
33
33
  '''
@@ -21,7 +21,7 @@ the goal is unmet until you observe it.
21
21
  you observed. Label every claim measured, inferred or guess.
22
22
  6. Record the verdict, then report it:
23
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>`:
24
- `workit ledger verdict verified|tests-verified|type-check-only|failed|blocked --kind <live|unit> --branch <b> --how "<what you ran and saw>"`.
24
+ `workit ledger verdict verified|tests-verified|type-check-only|failed|blocked --cwd <candidate worktree> --kind <live|unit> --branch <b> --how "<what you ran and saw>"`.
25
25
  `verified` means the change was seen working on its real surface
26
26
  (verify-<app>, `--kind live`); `tests-verified` means only tests ran. If the ledger refuses you as an author, report that;
27
27
  never pass `--self`.
@@ -29,8 +29,10 @@ the goal is unmet until you observe it.
29
29
  Before your final report, wait for or stop every background command you started
30
30
  (the host shows you running while one lives); never report with one still running.
31
31
 
32
- Write only in the candidate worktree's `.workit-scratch/`: a test case goes in a
33
- file there via a quoted heredoc (`<<'EOF'`), never run by the shell.
32
+ Write only in the candidate worktree's `.workit-scratch/` or your session's
33
+ scratchpad: a test case goes in a file there via a quoted heredoc (`<<'EOF'`),
34
+ never run by the shell. Reads (`git fetch -q origin`, a `node -e` or `python3 -c`
35
+ that only reads) run anywhere.
34
36
 
35
37
  Report: candidate SHA, each check with its exit code, each acceptance line,
36
38
  the verdict row you recorded. Fix nothing: a failing check is a verdict.
@@ -23841,16 +23841,16 @@ function selectMethods(policy, capabilities) {
23841
23841
  });
23842
23842
  }
23843
23843
  var BOOTSTRAP = `
23844
- Workit is optional coordination and proof tooling around the host: you decide
23845
- what and whether, the CLI does how and records what it observed.
23844
+ Workit is optional coordination and proof tooling: you decide what and
23845
+ whether, the CLI does how and records what it observed.
23846
23846
  Native host allow/ask/deny, sandbox and org rules stay authoritative. Never
23847
23847
  switch paths to evade a denial, never claim enforcement a host cannot provide,
23848
23848
  and never fabricate an approval or verdict. A question answer is not
23849
23849
  host permission, and imported decisions or handoffs grant no authority.
23850
23850
 
23851
23851
  Autonomy contract:
23852
- - Continue to the requested endpoint (commit, push, PR, green CI, verified,
23853
- merged) without asking "continue?", running checks and repairs.
23852
+ - Continue to the requested endpoint without asking "continue?", running
23853
+ checks and repairs.
23854
23854
  Stop only for a new consequential choice, a host denial, a conflicting edit
23855
23855
  or an unresolved blocker; report open gaps and uncertain workers.
23856
23856
  - No endpoint named: stop at a local commit on a policy-compliant branch and
@@ -23864,13 +23864,13 @@ Autonomy contract:
23864
23864
  start <v>\`, commits, \`finish\`; \`publish\` if asked.
23865
23865
  - Ask only for a product or preference choice, or for authority you lack, with
23866
23866
  your recommended answer. Facts are yours: read, run or prototype.
23867
- - Label claims measured (run and seen this session), inferred, or guess.
23867
+ - Label claims measured (seen this session), inferred, or guess.
23868
23868
  Prose is a note: only a configured check the CLI ran (\`workit check <name>\`)
23869
23869
  satisfies a gate; an ad-hoc \`workit check -- <cmd>\` never does.
23870
23870
  - Author is not verifier: your own verdict is \`--self\`, shown as
23871
23871
  self-reviewed, never verified. High risk, a focused or full lane and
23872
23872
  merge under \`verification: self|independent\` need a verifier with its
23873
- own host-derived session (a subagent's \`<lead>:<child>\`); never hand-mint one (\`<lead>-v1\`).
23873
+ own host-derived session (a subagent's \`<lead>:<child>\`); never hand-mint one.
23874
23874
  - A local-commit endpoint does not imply PR readiness, and a local commit alone
23875
23875
  is not evidence of a requested remote push. Before reporting delivery,
23876
23876
  reconcile every requested item and observe it (\`workit verify-delivery\`).
@@ -23883,23 +23883,25 @@ verb per shell call, never \`cd <dir> && workit\`. zsh-safe: no \`echo =====\`
23883
23883
  Add Co-Authored-By via \`workit git commit --trailer "K: v" -- <paths>\`, never
23884
23884
  an amend.
23885
23885
  The task families (task, policy, evidence, finding, decision, worker, state)
23886
- are optional continuity for tracked work; each branch has one implicit task,
23887
- and a solo edit needs no task. A decision records a user choice; it never
23888
- authorizes an effect. Judge work once with
23886
+ are optional continuity for tracked work; a solo edit needs no task. A
23887
+ decision records a user choice; it never authorizes an effect. Judge work
23888
+ once with
23889
23889
  \`workit policy assess --judge risk= behavior= product-choice= plan=\`.
23890
23890
  Across repositories, bind items to checkout, branch and endpoint, resolve
23891
23891
  competing targets before a mutation, and reconcile an uncertain
23892
23892
  effect before a retry.
23893
23893
 
23894
23894
  Mid-task: never silently drop or resume an objective (workit-continue).
23895
+ Notes, drafts, logs, resume files: \`workit dir notes|handoffs\` (outside the
23896
+ repo), never the repo tree.
23895
23897
 
23896
- Skills: load the skill, never act from memory (aliases /wk-<name>).
23898
+ Skills: load the skill, never act from memory.
23897
23899
  - brainstorm, plan, spec, grill, should we: workit-shape
23898
23900
  - implement, build, add a feature: workit-implement
23899
23901
  - review, blast radius: workit-review
23900
23902
  - bug, broken, flaky, regression: workit-debug
23901
23903
  - ship, babysit, CI, merge: workit-ship
23902
- - resume, pick up, handoff, interruption: workit-continue
23904
+ - resume, pick up, handoff, interruption, leaving, tomorrow, end of day, pause: workit-continue
23903
23905
  - BDD, TDD, acceptance criteria, Given/When/Then: workit-bdd
23904
23906
  - test audit, tautology, weak tests: workit-test-audit
23905
23907
  - deslop, slop, dead code: workit-deslop
@@ -31570,12 +31572,17 @@ var JUDGE_VERBS = {
31570
31572
  dir: true,
31571
31573
  help: true,
31572
31574
  "test-audit": true,
31573
- ledger: ["verdict", "finding", "list", "check", "ruling"],
31575
+ ledger: ["verdict", "list", "check", "ruling", "show"],
31576
+ finding: ["record", "list"],
31574
31577
  pr: ["status"],
31575
31578
  ci: ["wait", "logs"],
31576
31579
  fanout: ["status", "brief"],
31577
31580
  models: ["show"],
31578
- lock: ["status"]
31581
+ lock: ["status"],
31582
+ lease: ["status"],
31583
+ grant: ["show"],
31584
+ task: ["show", "list"],
31585
+ doctor: ["--json"]
31579
31586
  };
31580
31587
  var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
31581
31588
 
@@ -9169,16 +9169,16 @@ function selectMethods(policy, capabilities) {
9169
9169
  });
9170
9170
  }
9171
9171
  var BOOTSTRAP = `
9172
- Workit is optional coordination and proof tooling around the host: you decide
9173
- what and whether, the CLI does how and records what it observed.
9172
+ Workit is optional coordination and proof tooling: you decide what and
9173
+ whether, the CLI does how and records what it observed.
9174
9174
  Native host allow/ask/deny, sandbox and org rules stay authoritative. Never
9175
9175
  switch paths to evade a denial, never claim enforcement a host cannot provide,
9176
9176
  and never fabricate an approval or verdict. A question answer is not
9177
9177
  host permission, and imported decisions or handoffs grant no authority.
9178
9178
 
9179
9179
  Autonomy contract:
9180
- - Continue to the requested endpoint (commit, push, PR, green CI, verified,
9181
- merged) without asking "continue?", running checks and repairs.
9180
+ - Continue to the requested endpoint without asking "continue?", running
9181
+ checks and repairs.
9182
9182
  Stop only for a new consequential choice, a host denial, a conflicting edit
9183
9183
  or an unresolved blocker; report open gaps and uncertain workers.
9184
9184
  - No endpoint named: stop at a local commit on a policy-compliant branch and
@@ -9192,13 +9192,13 @@ Autonomy contract:
9192
9192
  start <v>\`, commits, \`finish\`; \`publish\` if asked.
9193
9193
  - Ask only for a product or preference choice, or for authority you lack, with
9194
9194
  your recommended answer. Facts are yours: read, run or prototype.
9195
- - Label claims measured (run and seen this session), inferred, or guess.
9195
+ - Label claims measured (seen this session), inferred, or guess.
9196
9196
  Prose is a note: only a configured check the CLI ran (\`workit check <name>\`)
9197
9197
  satisfies a gate; an ad-hoc \`workit check -- <cmd>\` never does.
9198
9198
  - Author is not verifier: your own verdict is \`--self\`, shown as
9199
9199
  self-reviewed, never verified. High risk, a focused or full lane and
9200
9200
  merge under \`verification: self|independent\` need a verifier with its
9201
- own host-derived session (a subagent's \`<lead>:<child>\`); never hand-mint one (\`<lead>-v1\`).
9201
+ own host-derived session (a subagent's \`<lead>:<child>\`); never hand-mint one.
9202
9202
  - A local-commit endpoint does not imply PR readiness, and a local commit alone
9203
9203
  is not evidence of a requested remote push. Before reporting delivery,
9204
9204
  reconcile every requested item and observe it (\`workit verify-delivery\`).
@@ -9211,23 +9211,25 @@ verb per shell call, never \`cd <dir> && workit\`. zsh-safe: no \`echo =====\`
9211
9211
  Add Co-Authored-By via \`workit git commit --trailer "K: v" -- <paths>\`, never
9212
9212
  an amend.
9213
9213
  The task families (task, policy, evidence, finding, decision, worker, state)
9214
- are optional continuity for tracked work; each branch has one implicit task,
9215
- and a solo edit needs no task. A decision records a user choice; it never
9216
- authorizes an effect. Judge work once with
9214
+ are optional continuity for tracked work; a solo edit needs no task. A
9215
+ decision records a user choice; it never authorizes an effect. Judge work
9216
+ once with
9217
9217
  \`workit policy assess --judge risk= behavior= product-choice= plan=\`.
9218
9218
  Across repositories, bind items to checkout, branch and endpoint, resolve
9219
9219
  competing targets before a mutation, and reconcile an uncertain
9220
9220
  effect before a retry.
9221
9221
 
9222
9222
  Mid-task: never silently drop or resume an objective (workit-continue).
9223
+ Notes, drafts, logs, resume files: \`workit dir notes|handoffs\` (outside the
9224
+ repo), never the repo tree.
9223
9225
 
9224
- Skills: load the skill, never act from memory (aliases /wk-<name>).
9226
+ Skills: load the skill, never act from memory.
9225
9227
  - brainstorm, plan, spec, grill, should we: workit-shape
9226
9228
  - implement, build, add a feature: workit-implement
9227
9229
  - review, blast radius: workit-review
9228
9230
  - bug, broken, flaky, regression: workit-debug
9229
9231
  - ship, babysit, CI, merge: workit-ship
9230
- - resume, pick up, handoff, interruption: workit-continue
9232
+ - resume, pick up, handoff, interruption, leaving, tomorrow, end of day, pause: workit-continue
9231
9233
  - BDD, TDD, acceptance criteria, Given/When/Then: workit-bdd
9232
9234
  - test audit, tautology, weak tests: workit-test-audit
9233
9235
  - deslop, slop, dead code: workit-deslop
@@ -19813,6 +19815,12 @@ var isConfigDir = (file) => configDirs().some((dir) => canonical4(dir) === canon
19813
19815
  var isRoot = (file) => isConfigDir(file) || /^(?:issued[^\\/]*|approvals)$/.test(path29.relative(canonical4(resolveStateDir()), canonical4(file)));
19814
19816
  var READ_CALLS = /^(?:print|log|info|warn|error|debug|puts|readdir(?:Sync)?|listdir|scandir|iterdir|glob|l?stat(?:Sync)?|exists(?:Sync)?|isdir|isfile|is_dir|is_file|access(?:Sync)?|realpath(?:Sync)?|dirname|basename|relative|str|repr|len)$/;
19815
19817
  var MUTATING_CALLS = /^(?:renames?(?:Sync)?|move|copy(?:2|file|tree|File)?(?:Sync)?|cp(?:Sync)?|rm(?:tree|dir|Sync|dirSync)?|unlink(?:Sync)?|remove(?:dirs)?|mkdirs?(?:Sync)?|makedirs|mkdtemp(?:Sync)?|(?:sym|hard)?link(?:Sync|_to)?|write\w*|append\w*|truncate(?:Sync)?|ch(?:mod|own)(?:Sync)?|touch|open(?:Sync)?|dump|save|extractall|unpack_archive|put_contents|mv|FileUtils)$/;
19818
+ var SPAWNS = /subprocess|child_process|WriteStream|tempfile|sqlite|inplace|getattr|spawn|\bvm\b|Function\s*\(|FileIO|ZipFile|tarfile|shelve|FileHandler|filename\s*=|savefig|utime|ch(?:mod|own)|mkfifo|mknod|\.(?:delete|to_\w+)\s*\(|Path\b.*\.replace\(|Bun\.\$|O_(?:WR|RDW|CR|AP|TR)|(?:PYTHON|NODE_)\w*=|-r\b|--(?:require|import|[\w-]*loader)|\bos\.replace|\b(?:system|popen|exec\w*|fork|eval|shutil|(?:unlink|rename|remove)\w*)\b|\]\s*\(|\brequire\s*\(\s*(?!(['"])(?:(?![a-zA-Z]:)[\w@][^'"]*|[^'"]*\.json)\1)/;
19819
+ var FREE_OPEN = /\bopen\w*\s*\(\s*(?:(['"])(?![rbtUwax+]*\1)[^'"]*\1|[\w.]+)?\s*(?:,\s*(?:(['"])[rbt]*\2|encoding\s*=\s*(['"])[\w-]+\3)\s*)*\)/g;
19820
+ var writesIn = (text) => {
19821
+ const bare = text.replace(FREE_OPEN, "").replace(/std(?:out|err)\.write|(?<![fF][rR]?)(['"])(?:\\.|(?!\1)[^\\\n])*\1/g, "");
19822
+ return SPAWNS.test(text) || /['"]/.test(bare) || /\$\{|\\[ux]|(?:^|[(,=:;!&|?{}[\s])\/(?![/*])[^/\n]*['"]/.test(text) || [...bare.matchAll(/[\w$]+/g)].some(([word]) => !/^(?:append|copy)$/.test(word) && MUTATING_CALLS.test(word));
19823
+ };
19816
19824
  var PATH_CALLS = /^(?:join|resolve|normalize|abspath|expanduser|expandvars|Path|PurePath|fspath)$/;
19817
19825
  var rootUse = (text, at) => {
19818
19826
  let call;
@@ -19887,11 +19895,14 @@ var shellScript2 = (words) => {
19887
19895
  };
19888
19896
  var XARGS_VALUE = /^-[IinLPdsEa]$/;
19889
19897
  var runsWriter = (words) => {
19890
- const filled = [...words.filter((word) => word !== "{}" && word !== ";" && word !== "+"), "x"];
19898
+ const filled = [
19899
+ ...words.filter((word) => word !== ";" && word !== "+").map((word) => word.includes("{}") ? "eval" : word),
19900
+ "eval"
19901
+ ];
19891
19902
  const edits = editsOf(filled);
19892
19903
  return edits === null || edits.length > 0 || opaqueWrites(filled) !== null;
19893
19904
  };
19894
- var opaqueWrites = (input, scriptOf = (index) => input[index]) => {
19905
+ var opaqueWrites = (input, scriptOf = (index) => input[index], fed) => {
19895
19906
  let words = input;
19896
19907
  while (words.length && (PREFIXES2.has(words[0]) || /^\w+=/.test(words[0]))) {
19897
19908
  if (words[0] === "xargs") {
@@ -19948,17 +19959,17 @@ var opaqueWrites = (input, scriptOf = (index) => input[index]) => {
19948
19959
  }
19949
19960
  const inline = (flag) => {
19950
19961
  const at = args.findIndex((arg) => flag.test(arg));
19951
- if (at < 0)
19962
+ if (at < 0 && (fed === undefined || !/^(?:-|\/dev\/stdin)?$/.test(scriptArgs(name, args).named ?? "")))
19952
19963
  return null;
19953
19964
  const runs = input.length - args.length - 1;
19954
- return [
19965
+ const texts = input.map((word, index) => index === runs || index < runs && !/^\w+=/.test(word) ? "" : scriptOf(index));
19966
+ return /^(?:python[\d.]*|node|bun)$/.test(name) && [
19967
+ at < 0 ? fed : texts[runs + at + 2],
19968
+ ...texts.slice(0, runs + 1 + (at < 0 ? args.length : at))
19969
+ ].every((text) => text !== undefined && text !== null && !writesIn(text)) ? null : [
19955
19970
  ".",
19956
- ...input.flatMap((word, index) => {
19957
- if (index === runs || index < runs && !/^\w+=/.test(word))
19958
- return [];
19959
- const text = scriptOf(index);
19960
- return text === undefined ? [unknownVarTarget(word)] : pathsIn(text);
19961
- })
19971
+ ...pathsIn(fed ?? ""),
19972
+ ...texts.flatMap((text, index) => text === undefined ? [unknownVarTarget(input[index])] : pathsIn(text))
19962
19973
  ];
19963
19974
  };
19964
19975
  if (name === "curl")
@@ -20081,6 +20092,7 @@ var configWrites = (rest) => {
20081
20092
  named++;
20082
20093
  return named > 1;
20083
20094
  };
20095
+ var plainFetch = (rest) => /^(?:\w[\w.-]*(?: [^-+:\s][^:\s]*)?)?$/.test(rest.filter((arg) => !/^-[qv]$|^--(?:quiet|verbose)$/.test(arg)).join(" "));
20084
20096
  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))$/;
20085
20097
  var gitOutputs = (args) => {
20086
20098
  let at = 0;
@@ -20122,7 +20134,7 @@ var gitOutputs = (args) => {
20122
20134
  if (sub === "config" && configWrites(rest))
20123
20135
  files.push(has(/^--global$/) ? "~/.gitconfig" : has(/^--system$/) ? "/etc/gitconfig" : valueOf(rest, /^(?:-f|--file=?)(.*)$/s) ?? ".");
20124
20136
  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)/);
20125
- if (sub === "fetch" || sub === "gc" || sub === "branch" && branchWrite)
20137
+ if (sub === "fetch" && !plainFetch(rest) || sub === "gc" || sub === "branch" && branchWrite)
20126
20138
  files.push(".");
20127
20139
  if (base === undefined)
20128
20140
  return files.length ? files : null;
@@ -20551,6 +20563,8 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
20551
20563
  const made = mktempPath(value, dir);
20552
20564
  if (made !== null)
20553
20565
  return made;
20566
+ if (/^(?:\$\(\s*pwd\s*\)|`pwd`)$/.test(value) && !redefined && dir !== UNKNOWN_DIR)
20567
+ return dir ?? null;
20554
20568
  const all = expansions(value, vars, loops).map(homeExpanded);
20555
20569
  return all.length === 1 && unresolvedRefs(all[0]).length === 0 ? all[0] : null;
20556
20570
  };
@@ -20737,6 +20751,8 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
20737
20751
  for (const sub of depth < 4 ? segment.subs ?? [] : [])
20738
20752
  targets.push(...segmentTargets(runIn, sub, dialect, depth + 1, strict, vars));
20739
20753
  const expanding = new Set(segment.expands ?? []);
20754
+ const stdin = segment.stdin?.join(`
20755
+ `);
20740
20756
  const scriptOf = (index) => {
20741
20757
  const word = body[index];
20742
20758
  if (word === undefined || !expanding.has(keywords + index))
@@ -20745,7 +20761,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
20745
20761
  return all.some((text) => unresolvedRefs(text).some(unescaped)) ? undefined : all.join(`
20746
20762
  `);
20747
20763
  };
20748
- const opaque = segment.unanalyzable ? ["."] : inner === null ? opaqueWrites(body, scriptOf) : null;
20764
+ const opaque = segment.unanalyzable ? ["."] : inner === null ? opaqueWrites(body, scriptOf, stdin && (/[$`]/.test(stdin) && /<<-?[ \t]*[^'"\\\s]/.test(command.replaceAll("\\\n", "")) ? null : stdin)) : null;
20749
20765
  const ran = words.findIndex((word) => word === "xargs" || !PREFIXES2.has(word));
20750
20766
  const runner = words[ran];
20751
20767
  if (runner !== undefined && expanding.has(keywords + lead + ran) && unresolvedRefs(homeExpanded(runner)).length > 0)
@@ -20761,15 +20777,13 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
20761
20777
  if (ln >= 0 && words.slice(0, ln).every((word) => PREFIXES2.has(word)) && (strict !== "registry" || !lnArgs.some((arg) => /^-[a-zA-Z]*s|^--symbolic$/.test(arg))))
20762
20778
  targets.push(...linkSources(lnArgs, at));
20763
20779
  }
20764
- for (const file of segment.redirects)
20765
- if (!/^\/dev\/(?:null|stdout|stderr|tty)$/.test(file))
20766
- targets.push(...atAll(file));
20767
20780
  const edits = editsOf(body);
20768
20781
  if (edits === null) {
20769
20782
  if (dir !== undefined)
20770
20783
  targets.push(placeholderIn(dir, DIR_TARGET));
20771
- } else
20772
- for (const file of edits)
20784
+ }
20785
+ for (const file of [...segment.redirects, ...edits ?? []])
20786
+ if (!/^\/dev\/(?:null|stdout|stderr|tty)$/.test(file))
20773
20787
  targets.push(...atAll(file));
20774
20788
  if (dir !== undefined)
20775
20789
  for (const invocation of workitInvocations(body.map(quoteWord2).join(" "), "posix")) {
@@ -22383,6 +22397,7 @@ function neededChecks(lane, configured) {
22383
22397
  // packages/workit-core/src/hooks/worktree-confine.ts
22384
22398
  import { createHash as createHash16 } from "node:crypto";
22385
22399
  import fs21 from "node:fs";
22400
+ import os9 from "node:os";
22386
22401
  import path32 from "node:path";
22387
22402
  var FANOUT_TOKEN_FILE = "workit-fanout-token";
22388
22403
  var NONE5 = { kind: "none" };
@@ -22574,10 +22589,10 @@ var unknownVarDeny = (input, worktree, targets, command) => {
22574
22589
  const wt = worktree ?? "<worktree>";
22575
22590
  const literal = literalForm(text, refs.filter((ref) => /^[$`]/.test(ref)));
22576
22591
  const retry = command === undefined || literal === command ? "" : ` ${first.length ? `${first.join(" ")} retry` : "Retry"} as: \`${literal}\`.`;
22577
- const unblock = `Spell the path out instead of ${refs.join(", ")}: Workit follows only a plain \`NAME=<literal>\` set earlier in the same command, \`$(mktemp …)\`, \`$PWD\` after a literal \`cd\` and a \`for\` over literal words.${retry} Write under ${wt} (\`workit git --cwd ${wt} …\`, \`workit check --cwd ${wt} …\`) or a temp dir.`;
22592
+ 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.`;
22578
22593
  return {
22579
22594
  kind: "deny",
22580
- reason: `workit worktree confinement: implementer ${input.session.agentId} writes to a path built from ${named.join(", ")}, which Workit cannot resolve (a command substitution, a loop over unknown or split words, a conditional, a binder such as read or eval, or an options file sets it), so it cannot tell whether the write stays in its worktree. ${unblock}`,
22595
+ 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}`,
22581
22596
  unblock
22582
22597
  };
22583
22598
  };
@@ -22703,7 +22718,8 @@ var inScratch = (real, repo) => {
22703
22718
  if (path32.basename(dir) !== SCRATCH)
22704
22719
  continue;
22705
22720
  const root = path32.dirname(dir);
22706
- if (checkoutOf2(root)?.root === root && (repo === null || commonDir(root) === repo))
22721
+ const checkout = checkoutOf2(root);
22722
+ if (checkout?.root === root && (repo === null || checkout.workit || commonDir(root) === repo))
22707
22723
  return true;
22708
22724
  }
22709
22725
  return false;
@@ -22916,7 +22932,7 @@ var remoteIn = (dir, name, repo) => {
22916
22932
  const url = configEntries(fs21.readFileSync(path32.join(shared, "config"), "utf8")).find(([key]) => key === `remote.${name}.url`.toLowerCase())?.[1];
22917
22933
  return url !== undefined && literalIn(url, repo, true);
22918
22934
  };
22919
- var judgeGit = (command, repo, depth = 0) => {
22935
+ var judgeGit = (command, repo, cwd, depth = 0) => {
22920
22936
  const runsGit = /\bgit\b/.test(command);
22921
22937
  for (const segment of segmentsOf(command)) {
22922
22938
  const words = segment.words;
@@ -22965,7 +22981,10 @@ var judgeGit = (command, repo, depth = 0) => {
22965
22981
  const args = words[index] === "--version" ? ["version"] : words.slice(index);
22966
22982
  if (!why && start >= 0) {
22967
22983
  const local = (source, remote) => remote && /^[\w-][\w.-]*$/.test(source) ? remoteIn(dir, source, repo) : literalIn(source, repo, true);
22968
- if (!gitKind(args, local))
22984
+ const runsIn = path32.isAbsolute(dir) ? dir : cwd && path32.resolve(cwd, dir);
22985
+ const home = runsIn && checkoutOf2(runsIn);
22986
+ const fetches = args[0] === "fetch" && plainFetch(args.slice(1)) && home && (home.workit || commonDir(home.root) === repo) && !words.some((word) => /^--[gw]/.test(word));
22987
+ if (!fetches && !gitKind(args, local))
22969
22988
  why = `\`git ${args.slice(0, 2).join(" ")}\` is not allowed`;
22970
22989
  else if (args[0] === "status" && !unlocked) {
22971
22990
  const dirs = path32.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo) : null;
@@ -22981,7 +23000,7 @@ var judgeGit = (command, repo, depth = 0) => {
22981
23000
  if (shell > at && scripts.some((script) => /git/.test(script)) && (!/^(?:timeout|nice|time|command)$/.test(name) || words.slice(at + 1, shell).some((word) => !/^(?:-[\w-]+|\d[\w.]*)$/.test(word))))
22982
23001
  why ??= `\`${name}\` runs git`;
22983
23002
  for (const script of [...segment.subs ?? [], ...scripts])
22984
- why ??= depth < 4 ? judgeGit(script, repo, depth + 1) : "scripts nest too deep for Workit to read";
23003
+ why ??= depth < 4 ? judgeGit(script, repo, cwd, depth + 1) : "scripts nest too deep for Workit to read";
22985
23004
  if (why)
22986
23005
  return why;
22987
23006
  }
@@ -22992,12 +23011,17 @@ var JUDGE_VERBS = {
22992
23011
  dir: true,
22993
23012
  help: true,
22994
23013
  "test-audit": true,
22995
- ledger: ["verdict", "finding", "list", "check", "ruling"],
23014
+ ledger: ["verdict", "list", "check", "ruling", "show"],
23015
+ finding: ["record", "list"],
22996
23016
  pr: ["status"],
22997
23017
  ci: ["wait", "logs"],
22998
23018
  fanout: ["status", "brief"],
22999
23019
  models: ["show"],
23000
- lock: ["status"]
23020
+ lock: ["status"],
23021
+ lease: ["status"],
23022
+ grant: ["show"],
23023
+ task: ["show", "list"],
23024
+ doctor: ["--json"]
23001
23025
  };
23002
23026
  var HELP = /^(?:--help|-h)$/;
23003
23027
  var judgeVerbRefused = (args) => {
@@ -23008,8 +23032,7 @@ var judgeVerbRefused = (args) => {
23008
23032
  if (verb === undefined || verb === "--version" || HELP.test(verb) || HELP.test(sub))
23009
23033
  return null;
23010
23034
  const allowed = Object.hasOwn(JUDGE_VERBS, verb) ? JUDGE_VERBS[verb] : [];
23011
- const ok = allowed === true ? !(verb === "test-audit" && call.some((arg) => /^--mutate(?:=|$)/.test(arg))) : allowed.includes(sub);
23012
- return ok ? null : `workit ${call.join(" ")}`;
23035
+ return (allowed === true || allowed.includes(sub)) && (verb !== "doctor" || call.length < 3) && !call.some((arg) => /^--(?:mutate|fix)\b/.test(arg)) ? null : `workit ${call.join(" ")}`;
23013
23036
  };
23014
23037
  var CLI_RUNNERS = /^(?:npx|bunx|pnpx|npm|pnpm|yarn|bun|node|nodejs|deno|tsx|ts-node)$/;
23015
23038
  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?$/;
@@ -23088,7 +23111,7 @@ var judgeRefusal = (command, fed, depth = 0) => {
23088
23111
  }
23089
23112
  if (INTERPRETERS2.test(name) && !args.some((arg) => INLINE.test(arg))) {
23090
23113
  const operand = args.find((arg, index) => (arg === "-" || !arg.startsWith("-")) && !VALUED.test(args[index - 1] ?? ""));
23091
- if (FED.test(operand ?? "") || operand === undefined && !/^(?:bun|deno)$/.test(name))
23114
+ if ((FED.test(operand ?? "") || operand === undefined && !/^(?:bun|deno)$/.test(name)) && !(segment.stdin?.length && /^(?:-|\/dev\/stdin)?$/.test(operand ?? "")))
23092
23115
  return unseen;
23093
23116
  }
23094
23117
  const tail = workitCheckTail(words.slice(at));
@@ -23129,7 +23152,7 @@ var judgeDeny = (input, what, target) => {
23129
23152
  const candidate = target ? checkoutOf2(target)?.root : undefined;
23130
23153
  const also = root && candidate && candidate !== root && commonDir(candidate) === commonDir(root) ? ` or ${path32.join(candidate, SCRATCH)}` : "";
23131
23154
  const scratch = root ? `${path32.join(root, SCRATCH)}${also}` : `${SCRATCH}/ at the root of the checkout you judge`;
23132
- 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.`;
23155
+ 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.`;
23133
23156
  return {
23134
23157
  kind: "deny",
23135
23158
  reason: `workit scratch confinement: ${role} ${input.session.agentId} may write only in its scratch dir ${scratch}, and ${what}. ${unblock}`,
@@ -23142,6 +23165,10 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
23142
23165
  return NONE5;
23143
23166
  const judged = checkoutOf2(input.cwd);
23144
23167
  const repo = judged ? commonDir(judged.root) : null;
23168
+ const scratch = (real) => inScratch(real, repo) || [os9.tmpdir(), "/tmp"].some((dir) => {
23169
+ const [host, , session] = path32.relative(canonical5(dir), real).split(path32.sep);
23170
+ return /^claude-\d+$/.test(host) && session === input.session.id;
23171
+ });
23145
23172
  for (const target of targets) {
23146
23173
  const resolved = path32.resolve(target);
23147
23174
  if (within(resolved, UNKNOWN_VAR) || within(resolved, UNKNOWN_DIR))
@@ -23151,7 +23178,7 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
23151
23178
  const gitDirs = runsGit ? gitDirsAt(path32.dirname(real), repo) : [];
23152
23179
  if (gitDirs === null)
23153
23180
  return judgeDeny(input, `git in ${shown(target)} uses a git dir or config Workit cannot check`);
23154
- if (runsGit ? gitDirs.length > 0 ? gitDirs.every((dir) => inScratch(dir, repo)) : inScratch(real, repo) : inScratch(real, repo) && !inGitDir(real))
23181
+ if (runsGit ? gitDirs.length > 0 ? gitDirs.every(scratch) : scratch(real) : scratch(real) && !inGitDir(real))
23155
23182
  continue;
23156
23183
  const runner = runnerAt(target);
23157
23184
  return judgeDeny(input, runner === null ? `${shown(target)} is outside it` : `\`${runner}\` runs in ${shown(target)}, outside it`, target);
@@ -23175,7 +23202,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
23175
23202
  if (!refused && dialect === "posix") {
23176
23203
  const judged = checkoutOf2(input.cwd);
23177
23204
  try {
23178
- const why = judgeGit(command, judged ? commonDir(judged.root) : null);
23205
+ const why = judgeGit(command, judged ? commonDir(judged.root) : null, /\b(?:cd|chdir|pushd|popd)\b/.test(command) ? null : input.cwd);
23179
23206
  if (why)
23180
23207
  refused = `${why}: ${JUDGE_GIT}`;
23181
23208
  } catch {
@@ -23184,11 +23211,11 @@ function confineJudgeShell(input, command, dialect = "posix") {
23184
23211
  }
23185
23212
  if (refused)
23186
23213
  return judgeDeny(input, refused);
23187
- if (dialect === "posix" && substitutingHeredoc(command))
23214
+ if (dialect === "posix" && substitutingHeredoc(command.replaceAll("\\\n", "")))
23188
23215
  return judgeDeny(input, "an unquoted heredoc runs the `$(…)` or backtick command in its body: quote the delimiter (<<'EOF')");
23189
23216
  let git = [];
23190
23217
  try {
23191
- git = rawInvocations(command, dialect).flatMap(({ tool, dir, args }) => tool === "git" && (args[0] === "push" || leadOwnedGit(args) || gitKind(args) === "write" && !/^(?:init|clone)$/.test(args[0])) ? [
23218
+ 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)))) ? [
23192
23219
  path32.join(dir === undefined ? UNKNOWN_DIR : path32.resolve(input.cwd, dir ?? "."), `${OPAQUE_TARGET}git`)
23193
23220
  ] : []);
23194
23221
  } catch {}
@@ -23454,7 +23481,7 @@ var cdWorkitSplit = (command) => {
23454
23481
 
23455
23482
  // packages/workit-core/src/hooks/model-limit.ts
23456
23483
  import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync4, readSync, statSync as statSync5 } from "node:fs";
23457
- import os9 from "node:os";
23484
+ import os10 from "node:os";
23458
23485
  import path34 from "node:path";
23459
23486
  var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
23460
23487
  var WEEKDAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
@@ -23660,7 +23687,7 @@ var listDir = (dir) => {
23660
23687
  };
23661
23688
  var SCAN_MS = 30 * 60000;
23662
23689
  var scanClaudeTranscripts = (cwd, env, now = new Date) => {
23663
- const projects = path34.join(env.CLAUDE_CONFIG_DIR || path34.join(env.HOME || os9.homedir(), ".claude"), "projects");
23690
+ const projects = path34.join(env.CLAUDE_CONFIG_DIR || path34.join(env.HOME || os10.homedir(), ".claude"), "projects");
23664
23691
  const project = path34.join(projects, claudeProjectSlug(cwd));
23665
23692
  const notes = [];
23666
23693
  const files = listDir(project).flatMap((entry) => entry.endsWith(".jsonl") ? [{ file: entry, worker: false }] : listDir(path34.join(entry, "subagents")).filter((file) => file.endsWith(".jsonl")).map((file) => ({ file, worker: true })));
@@ -24311,6 +24338,7 @@ var usageLimitOnStop = (input, agentId, text) => {
24311
24338
  };
24312
24339
  var subagentSession = (session, agentId) => [session, agentId].filter((part) => Boolean(part)).join(":").replace(/[^A-Za-z0-9_.:@/+-]/g, "-").slice(0, 128);
24313
24340
  var isolatedGit = (cwd) => `Run git as plain, separate commands inside your worktree (\`git switch -c <branch> <base>\`, ${workspaceTrailers(cwd).enabled ? '`git commit --trailer "Workit-Session=<your session>"`, `git push`; `workit doctor --fix` can install a prepare-commit-msg hook that adds the trailer' : "`git commit` (this workspace sets trailers: false: add no Workit-Session trailer), `git push`"}; add Co-Authored-By with \`git commit --trailer\` in the same commit, never by amending), never \`workit git …\`: Claude Code's worktree isolation refuses a command that wraps git and cannot be turned off (https://code.claude.com/docs/en/worktrees#how-claude-code-enforces-isolation). Never dodge that check by renaming or re-wrapping git. Use workit for the non-git verbs (\`workit check\`, \`workit ledger\`, \`workit pr\`).`;
24341
+ var JUDGE_CWD = " Add `--cwd <candidate worktree>` when your shell is elsewhere.";
24314
24342
  var subagentStartText = (input, descriptor, event) => {
24315
24343
  const session = input.session.id ?? null;
24316
24344
  const { role, isolated, git } = agentSteering(descriptor, input.cwd, {
@@ -24337,12 +24365,12 @@ ${subagentStartText({ ...input, cwd: "" }, descriptor, event)}`;
24337
24365
  const checks = judgeChecksLine(cwd);
24338
24366
  const checksText = checks ? ` ${checks}` : "";
24339
24367
  if (descriptor.host === "codex_cli" || descriptor.host === "codex_desktop")
24340
- return `${readOnly} Its shell already acts as its own Workit session, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${verdictCommand({ branch, judge })}\`. Add no session or token option to it, and never set WORKIT_SESSION_ID by hand.${checksText}`;
24368
+ return `${readOnly} Its shell already acts as its own Workit session, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${verdictCommand({ branch, judge })}\`.${JUDGE_CWD} Add no session or token option to it, and never set WORKIT_SESSION_ID by hand.${checksText}`;
24341
24369
  const token = session ? recordIssuedSession(cwd, session, own) : null;
24342
24370
  if (session && !token)
24343
24371
  return `${readOnly} ${own} was already issued to an earlier subagent, so no token is handed out again and a verdict under it would be refused (unbound_session). Record no verdict as ${own}: spawn a fresh verifier or reviewer, which gets its own session and token.`;
24344
24372
  const line = verdictCommand({ branch, judge, session: own, token });
24345
- return `${readOnly} Its own Workit session is ${own}, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${line}\`.${token ? " The token is this subagent's alone: never write it into a report, a file or a commit. --token needs a workit CLI at least as new as this plugin; if the CLI answers that --token is an unknown option, update the workit CLI (workit upgrade --cli) and record again." : ""}${checksText}`;
24373
+ return `${readOnly} Its own Workit session is ${own}, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${line}\`.${JUDGE_CWD}${token ? " The token is this subagent's alone: never write it into a report, a file or a commit. --token needs a workit CLI at least as new as this plugin; if the CLI answers that --token is an unknown option, update the workit CLI (workit upgrade --cli) and record again." : ""}${checksText}`;
24346
24374
  };
24347
24375
  var PRE_TOOL = new Set(["shell.pre", "write.pre", "tool.pre"]);
24348
24376
  function handleHook(input, deps) {
@@ -98,7 +98,7 @@ if (quiet) {
98
98
  `);
99
99
  } else {
100
100
  try {
101
- const { runCodexHook } = await import("./workit-hook-74basyv3.js");
101
+ const { runCodexHook } = await import("./workit-hook-10n413q9.js");
102
102
  await runCodexHook([payload]);
103
103
  } catch (error) {
104
104
  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.6.0",
3
+ "version": "2.7.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.6.0",
45
- "@workit-dev/mcp": "^2.6.0"
44
+ "@workit-dev/core": "^2.7.1",
45
+ "@workit-dev/mcp": "^2.7.1"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: workit-continue
3
- description: Keep work on track across interruptions and sessions - sort new input, checkpoint, hand off with a resume brief, and pick up by verifying inherited claims. Use for resume, pick up, handoff, new session, interruption, change of direction.
3
+ description: Keep work on track across interruptions and sessions - sort new input, checkpoint, hand off with a resume brief, pick up by verifying claims. Use for resume, pick up, handoff, leaving, tomorrow, end of day, pause, interruption, change of direction.
4
4
  ---
5
5
 
6
6
  # Continue without losing the thread
@@ -12,8 +12,7 @@ description: Keep work on track across interruptions and sessions - sort new inp
12
12
  keep going.
13
13
  - **Separate request:** do not silently resume an old objective, and do not
14
14
  drop the current one. Checkpoint it (below) if it must continue later, then
15
- start the new work. Held items stay parked with their resume condition until
16
- the user resumes them.
15
+ start the new work. Held items stay parked with their resume condition.
17
16
 
18
17
  ## Checkpoint and hand off
19
18
 
@@ -25,8 +24,9 @@ workit handoff --note "<state in one line>" --next "<next command>" --record
25
24
  The brief carries the branch, HEAD, dirty state, check freshness, verdict,
26
25
  rulings and the next command. Add only what it cannot know: choices still
27
26
  open, approaches that failed and why. Work spanning repos gets one brief per
28
- checkout, each with its branch and delivery endpoint. Notes too long for
29
- `--note` go in a file under `workit dir handoffs`; name its path in the note.
27
+ checkout, each with its branch and delivery endpoint. Notes, drafts and logs
28
+ go in `workit dir notes` or `workit dir handoffs`, never the repo tree; name
29
+ the file in `--note`.
30
30
 
31
31
  ## Pick up
32
32
 
@@ -40,8 +40,8 @@ checkout, each with its branch and delivery endpoint. Notes too long for
40
40
 
41
41
  ## Example
42
42
 
43
- Bad: a new session re-reads the whole codebase, re-asks the user which
44
- approach to take, and redoes a finished slice.
43
+ Bad: a new session re-reads the codebase, re-asks a settled approach and
44
+ redoes a finished slice.
45
45
 
46
46
  Good: "`workit handoff`: feature/usage at 4be1, `test` stale, verdict none,
47
47
  next `workit check test`. Re-ran it: exit 0. The brief says PR #42 is open: