@workit-dev/codex 2.25.5 → 2.25.6

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.25.5",
3
+ "version": "2.25.6",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -25016,7 +25016,7 @@ var GIT_VALUE_OPTIONS = new Set([
25016
25016
  "--super-prefix"
25017
25017
  ]);
25018
25018
  var GIT_CONFIG_OPTIONS = new Set(["-c", "--config-env", "--git-dir"]);
25019
- var XARGS_VALUES = new Set(["-n", "-L", "-l", "-P", "-d", "-E", "-e", "-s", "-a", "--arg-file", "--delimiter"].concat([
25019
+ var XARGS_VALUES = new Set(["-n", "-L", "-l", "-P", "-d", "-E", "-e", "-s", "-a", "-R", "--arg-file", "--delimiter"].concat([
25020
25020
  "--max-args",
25021
25021
  "--max-lines",
25022
25022
  "--max-procs",
@@ -32133,6 +32133,34 @@ var liveProbe = {
32133
32133
  };
32134
32134
  var PIDS = new Map;
32135
32135
 
32136
+ // packages/workit-core/src/hooks/windows-reads.ts
32137
+ var READ_CMDLETS = new Set([
32138
+ "foreach-object",
32139
+ "out-string",
32140
+ "out-null",
32141
+ "out-host",
32142
+ "write-output",
32143
+ "write-host",
32144
+ "write-verbose",
32145
+ "write-warning",
32146
+ "write-error",
32147
+ "write-debug",
32148
+ "write-information",
32149
+ "test-path",
32150
+ "test-json",
32151
+ "resolve-path",
32152
+ "convert-path",
32153
+ "join-path",
32154
+ "split-path",
32155
+ "compare-object",
32156
+ "group-object",
32157
+ "set-location",
32158
+ "push-location",
32159
+ "pop-location",
32160
+ "help"
32161
+ ]);
32162
+ var LOADER_ENV = /^(?:GIT_\w*|PAGER|EDITOR|VISUAL|PATH|LD_\w*|DYLD_\w*|NODE_OPTIONS|PYTHON\w*|BASH_ENV|ENV|PERL5(?:OPT|LIB)|RUBY(?:OPT|LIB))$/i;
32163
+
32136
32164
  // packages/workit-core/src/hooks/write-gate.ts
32137
32165
  var CASE_INSENSITIVE = process.platform === "darwin" || process.platform === "win32";
32138
32166
  var PREFIXES2 = new Set(["sudo", "command", "env", "nohup", "time", "exec", "xargs", "busybox"]);
@@ -32168,6 +32196,7 @@ var PUSHD2 = new Set(["pushd", "push-location"]);
32168
32196
  var POPD2 = new Set(["popd", "pop-location"]);
32169
32197
  var UNKNOWN_DIR = path35.resolve(path35.parse(process.cwd()).root, ".workit-unknown-dir");
32170
32198
  var DECLARERS = new Set(["export", "declare", "typeset", "local", "readonly"]);
32199
+ var POSIX_LOADER = new RegExp(LOADER_ENV.source);
32171
32200
  var REBINDS_ANY = new Set([
32172
32201
  "source",
32173
32202
  ".",
@@ -14643,7 +14643,7 @@ var literalOutput = (segment) => {
14643
14643
  };
14644
14644
  var stdinOf = (segment, previous) => segment.stdin ? segment.stdin.join(`
14645
14645
  `) : literalOutput(previous);
14646
- var XARGS_VALUES = new Set(["-n", "-L", "-l", "-P", "-d", "-E", "-e", "-s", "-a", "--arg-file", "--delimiter"].concat([
14646
+ var XARGS_VALUES = new Set(["-n", "-L", "-l", "-P", "-d", "-E", "-e", "-s", "-a", "-R", "--arg-file", "--delimiter"].concat([
14647
14647
  "--max-args",
14648
14648
  "--max-lines",
14649
14649
  "--max-procs",
@@ -14653,6 +14653,7 @@ var XARGS_VALUES = new Set(["-n", "-L", "-l", "-P", "-d", "-E", "-e", "-s", "-a"
14653
14653
  ]));
14654
14654
  var xargsCommands = (words, input) => {
14655
14655
  let replace = null;
14656
+ let insert = null;
14656
14657
  let index = 1;
14657
14658
  for (;index < words.length; index++) {
14658
14659
  const word = words[index];
@@ -14664,6 +14665,10 @@ var xargsCommands = (words, input) => {
14664
14665
  break;
14665
14666
  if (word === "-I")
14666
14667
  replace = words[++index] ?? "{}";
14668
+ else if (word === "-J")
14669
+ insert = words[++index] ?? null;
14670
+ else if (/^-J./.test(word))
14671
+ insert = word.slice(2);
14667
14672
  else if (word === "--replace" || word === "-i")
14668
14673
  replace = "{}";
14669
14674
  else if (word.startsWith("--replace="))
@@ -14678,8 +14683,12 @@ var xargsCommands = (words, input) => {
14678
14683
  return [];
14679
14684
  if (input === undefined)
14680
14685
  return [command];
14686
+ const fed = input.split(/\s+/).filter(Boolean);
14687
+ const at = insert === null ? -1 : command.indexOf(insert);
14688
+ if (at >= 0)
14689
+ return [[...command.slice(0, at), ...fed, ...command.slice(at + 1)]];
14681
14690
  if (replace === null)
14682
- return [[...command, ...input.split(/\s+/).filter(Boolean)]];
14691
+ return [[...command, ...fed]];
14683
14692
  const token = replace;
14684
14693
  return input.split(`
14685
14694
  `).map((line) => line.trim()).filter(Boolean).slice(0, MAX_EXPANSIONS).map((line) => command.map((word) => word.replaceAll(token, line)));
@@ -14697,50 +14706,83 @@ var findCommands = (words) => {
14697
14706
  }
14698
14707
  return found;
14699
14708
  };
14700
- var POWERSHELL_VALUES = /^-(?:f|file|ex|executionpolicy|wd|workingdirectory|config|configurationname|o|outputformat|if|inputformat|inp|w|windowstyle|settingsfile|custompipename|psconsolefile)$/;
14701
- var powershellScript = (words, stdin) => {
14709
+ var POWERSHELL_PARAMETERS = [
14710
+ { name: "command", min: 1, kind: "script" },
14711
+ { name: "commandwithargs", min: 8, aliases: ["cwa"], kind: "args", host: "pwsh" },
14712
+ { name: "configurationname", min: 7, aliases: ["config"], kind: "opaque" },
14713
+ { name: "configurationfile", min: 14, kind: "opaque", host: "pwsh" },
14714
+ { name: "custompipename", min: 2, kind: "value", host: "pwsh" },
14715
+ { name: "encodedcommand", min: 3, aliases: ["e", "ec"], kind: "encoded" },
14716
+ { name: "encodedarguments", min: 8, aliases: ["ea"], kind: "opaque", host: "pwsh" },
14717
+ { name: "executionpolicy", min: 2, aliases: ["ep"], kind: "value" },
14718
+ { name: "file", min: 1, kind: "opaque" },
14719
+ { name: "help", min: 1, aliases: ["?"], kind: "info" },
14720
+ { name: "inputformat", min: 3, aliases: ["if"], kind: "value" },
14721
+ { name: "interactive", min: 4, aliases: ["i"], kind: "switch", host: "pwsh" },
14722
+ { name: "login", min: 1, kind: "opaque", host: "pwsh" },
14723
+ { name: "mta", min: 3, kind: "switch" },
14724
+ { name: "noexit", min: 3, kind: "opaque" },
14725
+ { name: "nologo", min: 3, kind: "switch" },
14726
+ { name: "noninteractive", min: 3, kind: "switch" },
14727
+ { name: "noprofile", min: 3, kind: "switch" },
14728
+ { name: "noprofileloadtime", min: 10, kind: "switch", host: "pwsh" },
14729
+ { name: "outputformat", min: 1, aliases: ["of"], kind: "value" },
14730
+ { name: "psconsolefile", min: 2, kind: "opaque", host: "powershell" },
14731
+ { name: "settingsfile", min: 2, aliases: ["settings"], kind: "opaque", host: "pwsh" },
14732
+ { name: "sshservermode", min: 2, aliases: ["sshs"], kind: "opaque", host: "pwsh" },
14733
+ { name: "sta", min: 3, kind: "switch" },
14734
+ { name: "version", min: 1, kind: "info", host: "pwsh" },
14735
+ { name: "version", min: 1, kind: "value", host: "powershell" },
14736
+ { name: "windowstyle", min: 1, kind: "value" },
14737
+ { name: "workingdirectory", min: 2, aliases: ["wd"], kind: "value" }
14738
+ ];
14739
+ var powershellRun = (words, stdin) => {
14740
+ const host = /powershell/i.test(words[0] ?? "") ? "powershell" : "pwsh";
14741
+ let opaque = false;
14702
14742
  for (let index = 1;index < words.length; index++) {
14703
14743
  const word = words[index];
14704
14744
  if (!/^[-/]/.test(word))
14705
- return null;
14706
- const flag = word.replace(/^[-/]+/, "").toLowerCase();
14707
- if (!flag)
14708
- return null;
14709
- if (flag === "e" || flag === "ec" || flag.length >= 2 && "encodedcommand".startsWith(flag)) {
14745
+ return host === "powershell" ? { script: words.slice(index).join(" "), opaque } : { script: null, opaque: true };
14746
+ const [, key = "", glued] = /^(?:--?|\/)([^:=]*)(?:[:=](.*))?$/s.exec(word) ?? [];
14747
+ const flag = key.toLowerCase();
14748
+ const matches = POWERSHELL_PARAMETERS.filter((parameter) => (parameter.host ?? host) === host && flag !== "" && (parameter.aliases?.includes(flag) || flag.length >= parameter.min && parameter.name.startsWith(flag)));
14749
+ if (matches.length !== 1) {
14750
+ opaque = true;
14751
+ continue;
14752
+ }
14753
+ const [{ kind }] = matches;
14754
+ const value = glued ?? words[index + 1];
14755
+ if (kind === "info")
14756
+ return { script: null, opaque: opaque || index < words.length - 1 };
14757
+ if (kind === "encoded") {
14710
14758
  try {
14711
- return Buffer.from(words[index + 1] ?? "", "base64").toString("utf16le");
14759
+ return { script: Buffer.from(value ?? "", "base64").toString("utf16le"), opaque: true };
14712
14760
  } catch {
14713
- return null;
14761
+ return { script: null, opaque: true };
14714
14762
  }
14715
14763
  }
14716
- if (flag === "cwa" || flag.length >= 8 && "commandwithargs".startsWith(flag))
14717
- return words[index + 1] ?? null;
14718
- if ("command".startsWith(flag))
14719
- return words[index + 1] === "-" ? stdin ?? null : words.slice(index + 1).join(" ");
14720
- if (POWERSHELL_VALUES.test(`-${flag}`)) {
14721
- if (flag === "f" || flag === "file")
14722
- return null;
14723
- index++;
14764
+ if (kind === "args")
14765
+ return {
14766
+ script: value ?? null,
14767
+ opaque: opaque || glued !== undefined || value === undefined
14768
+ };
14769
+ if (kind === "script") {
14770
+ if (value === "-")
14771
+ return { script: stdin ?? null, opaque: true };
14772
+ const rest = glued === undefined ? words.slice(index + 1) : [glued, ...words.slice(index + 1)];
14773
+ return {
14774
+ script: rest.join(" ") || null,
14775
+ opaque: opaque || glued !== undefined || !rest.length
14776
+ };
14724
14777
  }
14725
- }
14726
- return null;
14727
- };
14728
- var powershellOpaque = (words) => {
14729
- for (let index = 1;index < words.length; index++) {
14730
- const flag = /^[-/]+(.+)/.exec(words[index])?.[1].toLowerCase();
14731
- if (flag === undefined)
14732
- return !/powershell/i.test(words[0]);
14733
- if (flag === "e" || flag === "ec" || flag.length >= 2 && "encodedcommand".startsWith(flag))
14734
- return true;
14735
- if ("command".startsWith(flag) || flag === "cwa" || flag.startsWith("commandwith"))
14736
- return false;
14737
- if (flag === "f" || flag === "file")
14738
- return true;
14739
- if (POWERSHELL_VALUES.test(`-${flag}`))
14778
+ opaque ||= kind === "opaque";
14779
+ if (kind !== "switch" && glued === undefined)
14740
14780
  index++;
14741
14781
  }
14742
- return false;
14782
+ return { script: null, opaque: true };
14743
14783
  };
14784
+ var powershellScript = (words, stdin) => powershellRun(words, stdin).script;
14785
+ var powershellOpaque = (words) => powershellRun(words).opaque;
14744
14786
  var cmdScript = (words) => {
14745
14787
  const at = words.findIndex((word, index) => index > 0 && /^\/[ck]$/i.test(word));
14746
14788
  if (at > 0)
@@ -17720,6 +17762,315 @@ var claimLiveSession = (target, owner, deps = {}) => {
17720
17762
  } catch {}
17721
17763
  };
17722
17764
 
17765
+ // packages/workit-core/src/hooks/windows-reads.ts
17766
+ var READ_CMDLETS = new Set([
17767
+ "foreach-object",
17768
+ "out-string",
17769
+ "out-null",
17770
+ "out-host",
17771
+ "write-output",
17772
+ "write-host",
17773
+ "write-verbose",
17774
+ "write-warning",
17775
+ "write-error",
17776
+ "write-debug",
17777
+ "write-information",
17778
+ "test-path",
17779
+ "test-json",
17780
+ "resolve-path",
17781
+ "convert-path",
17782
+ "join-path",
17783
+ "split-path",
17784
+ "compare-object",
17785
+ "group-object",
17786
+ "set-location",
17787
+ "push-location",
17788
+ "pop-location",
17789
+ "help"
17790
+ ]);
17791
+ var READ_VERBS = /^(?:get|select|where|measure|sort|format|convertfrom|convertto)-/;
17792
+ var ALIASES = {
17793
+ "?": "where-object",
17794
+ "%": "foreach-object",
17795
+ foreach: "foreach-object",
17796
+ where: "where-object",
17797
+ cat: "get-content",
17798
+ gc: "get-content",
17799
+ type: "get-content",
17800
+ cd: "set-location",
17801
+ chdir: "set-location",
17802
+ sl: "set-location",
17803
+ pushd: "push-location",
17804
+ popd: "pop-location",
17805
+ pwd: "get-location",
17806
+ gl: "get-location",
17807
+ dir: "get-childitem",
17808
+ ls: "get-childitem",
17809
+ gci: "get-childitem",
17810
+ gi: "get-item",
17811
+ gp: "get-itemproperty",
17812
+ gpv: "get-itempropertyvalue",
17813
+ gcm: "get-command",
17814
+ gm: "get-member",
17815
+ gal: "get-alias",
17816
+ gv: "get-variable",
17817
+ gmo: "get-module",
17818
+ gps: "get-process",
17819
+ ps: "get-process",
17820
+ gsv: "get-service",
17821
+ gdr: "get-psdrive",
17822
+ gcb: "get-clipboard",
17823
+ gin: "get-computerinfo",
17824
+ gtz: "get-timezone",
17825
+ gu: "get-unique",
17826
+ ghy: "get-history",
17827
+ h: "get-history",
17828
+ history: "get-history",
17829
+ gjb: "get-job",
17830
+ gerr: "get-error",
17831
+ select: "select-object",
17832
+ sls: "select-string",
17833
+ sort: "sort-object",
17834
+ measure: "measure-object",
17835
+ group: "group-object",
17836
+ compare: "compare-object",
17837
+ diff: "compare-object",
17838
+ fl: "format-list",
17839
+ ft: "format-table",
17840
+ fw: "format-wide",
17841
+ fc: "format-custom",
17842
+ fhx: "format-hex",
17843
+ echo: "write-output",
17844
+ write: "write-output",
17845
+ oh: "out-host",
17846
+ rvpa: "resolve-path",
17847
+ cvpa: "convert-path",
17848
+ man: "help",
17849
+ ac: "add-content",
17850
+ sc: "set-content",
17851
+ clc: "clear-content",
17852
+ cli: "clear-item",
17853
+ clp: "clear-itemproperty",
17854
+ clv: "clear-variable",
17855
+ copy: "copy-item",
17856
+ cp: "copy-item",
17857
+ cpi: "copy-item",
17858
+ cpp: "copy-itemproperty",
17859
+ del: "remove-item",
17860
+ erase: "remove-item",
17861
+ rd: "remove-item",
17862
+ ri: "remove-item",
17863
+ rm: "remove-item",
17864
+ rmdir: "remove-item",
17865
+ rp: "remove-itemproperty",
17866
+ rv: "remove-variable",
17867
+ mi: "move-item",
17868
+ move: "move-item",
17869
+ mv: "move-item",
17870
+ mp: "move-itemproperty",
17871
+ ren: "rename-item",
17872
+ rni: "rename-item",
17873
+ rnp: "rename-itemproperty",
17874
+ ni: "new-item",
17875
+ md: "new-item",
17876
+ mkdir: "new-item",
17877
+ mount: "new-psdrive",
17878
+ ndr: "new-psdrive",
17879
+ nal: "new-alias",
17880
+ nv: "new-variable",
17881
+ nmo: "new-module",
17882
+ si: "set-item",
17883
+ sp: "set-itemproperty",
17884
+ sv: "set-variable",
17885
+ set: "set-variable",
17886
+ sal: "set-alias",
17887
+ scb: "set-clipboard",
17888
+ epal: "export-alias",
17889
+ epcsv: "export-csv",
17890
+ ipal: "import-alias",
17891
+ ipmo: "import-module",
17892
+ ipcsv: "import-csv",
17893
+ tee: "tee-object",
17894
+ start: "start-process",
17895
+ saps: "start-process",
17896
+ sajb: "start-job",
17897
+ sleep: "start-sleep",
17898
+ ii: "invoke-item",
17899
+ icm: "invoke-command",
17900
+ iex: "invoke-expression",
17901
+ ihy: "invoke-history",
17902
+ r: "invoke-history",
17903
+ irm: "invoke-restmethod",
17904
+ iwr: "invoke-webrequest",
17905
+ kill: "stop-process",
17906
+ spps: "stop-process",
17907
+ ogv: "out-gridview"
17908
+ };
17909
+ var KEYWORDS2 = /^(?:if|elseif|else|switch|while|do|until|for|foreach|try|catch|finally|return|break|continue|exit|throw|param|begin|process|end)$/;
17910
+ var WINDOWS_WRITERS = /^(?:xcopy|robocopy|attrib|icacls|cacls|takeown|compact|cipher|expand|extrac32|makecab|fsutil|reg|regedit|setx|schtasks|msiexec|certutil|bitsadmin|replace|subst|mountvol|format|diskpart|wsl|cscript|wscript|mshta|rundll32|regsvr32|call)$/;
17911
+ var READ_METHODS = /^(?:trim(?:start|end)?|split|contains(?:key|value)?|startswith|endswith|substring|(?:last)?indexof(?:any)?|to(?:lower|upper)(?:invariant)?|tostring|tochararray|pad(?:left|right)|equals|compareto|gettype|gethashcode|normalize|where)$/i;
17912
+ var READ_MEMBERS = /^(?:name|fullname|basename|extension|length|count|directory|directoryname|parent|root|exists|mode|lastwritetime(?:utc)?|creationtime(?:utc)?|lastaccesstime(?:utc)?|attributes|linktype|target|pspath|pschildname|path|line|linenumber|filename|matches|value|key|keys|values|id|processname|source|definition|version)$/i;
17913
+ var LOADER_ENV = /^(?:GIT_\w*|PAGER|EDITOR|VISUAL|PATH|LD_\w*|DYLD_\w*|NODE_OPTIONS|PYTHON\w*|BASH_ENV|ENV|PERL5(?:OPT|LIB)|RUBY(?:OPT|LIB))$/i;
17914
+ var CMD_VAR = /%[^%\s]+%|![^!\s]+!/;
17915
+ var NULL_SINK = /^(?:\$null|nul|\/dev\/null)$/i;
17916
+ var pwshCode = (text) => {
17917
+ let out = "";
17918
+ for (let at = 0;at < text.length; at++) {
17919
+ const char = text[at];
17920
+ const here = char === "@" && /['"]/.test(text[at + 1] ?? "") ? text[at + 1] : null;
17921
+ if (char === "<" && text[at + 1] === "#") {
17922
+ const end = text.indexOf("#>", at + 2);
17923
+ at = end < 0 ? text.length : end + 1;
17924
+ } else if (char === "#" && (at === 0 || /[\s;|{(]/.test(text[at - 1])))
17925
+ for (;at < text.length && text[at] !== `
17926
+ `; at++)
17927
+ ;
17928
+ else if (here !== null || char === "'" || char === '"') {
17929
+ const quote = here ?? char;
17930
+ const close = here === null ? quote : `
17931
+ ${quote}@`;
17932
+ let end = at + (here === null ? 1 : 2);
17933
+ const kept = [];
17934
+ while (end < text.length && !text.startsWith(close, end)) {
17935
+ if (quote === '"' && text[end] === "`")
17936
+ end++;
17937
+ else if (quote === "'" && here === null && text.startsWith("''", end))
17938
+ end++;
17939
+ else if (quote === '"' && text.startsWith("$(", end)) {
17940
+ let depth = 0;
17941
+ const start = end;
17942
+ for (;end < text.length; end++)
17943
+ if (text[end] === "(")
17944
+ depth++;
17945
+ else if (text[end] === ")" && --depth === 0)
17946
+ break;
17947
+ kept.push(text.slice(start, end + 1));
17948
+ }
17949
+ end++;
17950
+ }
17951
+ out += `S${kept.join(" ")}`;
17952
+ at = end + close.length - 1;
17953
+ } else
17954
+ out += char;
17955
+ }
17956
+ return out;
17957
+ };
17958
+ var powershellTextWriter = (text) => {
17959
+ const code = pwshCode(text);
17960
+ if (/(?<![&>])&(?![&>])/.test(code))
17961
+ return "&";
17962
+ const statics = /([^\s;|{(]*)\s*::\s*(\w*)/.exec(code);
17963
+ if (statics)
17964
+ return `${statics[1]}::${statics[2]}`;
17965
+ for (const [, name] of code.matchAll(/\$\{?env:(\w+)\}?\s*[-+]?=/gi))
17966
+ if (LOADER_ENV.test(name))
17967
+ return `$env:${name} =`;
17968
+ for (const [, name] of code.matchAll(/\.([A-Za-z_]\w*)\(/g))
17969
+ if (!READ_METHODS.test(name))
17970
+ return `.${name}()`;
17971
+ const member = /\.([A-Za-z_]\w*)\s*[-+*/%]?=/.exec(code);
17972
+ if (member)
17973
+ return `.${member[1]} =`;
17974
+ const drive = /\$\{?(function|alias):/i.exec(code);
17975
+ return drive ? `$${drive[1]}:` : null;
17976
+ };
17977
+ var subexpressions = (word) => {
17978
+ const found = [];
17979
+ for (let at = word.indexOf("$(");at >= 0; at = word.indexOf("$(", at + 1)) {
17980
+ let depth = 0;
17981
+ let end = at + 1;
17982
+ for (;end < word.length; end++)
17983
+ if (word[end] === "(")
17984
+ depth++;
17985
+ else if (word[end] === ")" && --depth === 0)
17986
+ break;
17987
+ found.push(word.slice(at + 2, end));
17988
+ }
17989
+ return found;
17990
+ };
17991
+ var cmdletOf = (name) => {
17992
+ const lower = name.toLowerCase().replace(/[\u2013-\u2015]/g, "-");
17993
+ if (ALIASES[lower] !== undefined)
17994
+ return ALIASES[lower];
17995
+ return /^[a-z]+-[a-z0-9]+$/.test(lower) ? lower : null;
17996
+ };
17997
+ var readCmdlet = (cmdlet) => READ_VERBS.test(cmdlet) || READ_CMDLETS.has(cmdlet);
17998
+ var pwshStatementWriter = (segment, depth, prev, next) => {
17999
+ if (segment.redirects.some((file) => !NULL_SINK.test(file)))
18000
+ return ">";
18001
+ let words = segment.words;
18002
+ const glued = /^((?:\[[^\]]*\])*\$[^=\s]+)[-+*/%?]?=(.+)$/s.exec(words[0] ?? "");
18003
+ if (glued)
18004
+ words = [glued[2], ...words.slice(1)];
18005
+ else if (/^(?:\[[^\]]*\])*\$/.test(words[0] ?? "") && /^[-+*/%?]?=$/.test(words[1] ?? ""))
18006
+ words = words.slice(2);
18007
+ for (const word of words)
18008
+ for (const inner of depth < 4 ? subexpressions(word) : [])
18009
+ if (/\S/.test(inner)) {
18010
+ const why = pwshScriptWriter(inner, depth + 1);
18011
+ if (why)
18012
+ return why;
18013
+ }
18014
+ const first = words[0];
18015
+ if (first === undefined)
18016
+ return null;
18017
+ if (first === ".")
18018
+ return ". (dot-source)";
18019
+ if (CMD_VAR.test(first))
18020
+ return first;
18021
+ if (/^[$@(['"\d-]/.test(first) || /^\.[A-Za-z_]/.test(first))
18022
+ return null;
18023
+ if (/[\\/:.]/.test(first))
18024
+ return first;
18025
+ const lower = first.toLowerCase();
18026
+ if (KEYWORDS2.test(lower) && (lower !== "foreach" || words.length === 1 && !prev?.pipe))
18027
+ return null;
18028
+ if (/^(?:function|filter|class|enum|workflow|configuration)$/.test(lower))
18029
+ return first;
18030
+ if (/^(?:pwsh|powershell|cmd)$/.test(lower))
18031
+ return null;
18032
+ const cmdlet = cmdletOf(first);
18033
+ if (cmdlet === null)
18034
+ return WINDOWS_WRITERS.test(lower) ? first : null;
18035
+ if (!readCmdlet(cmdlet))
18036
+ return first;
18037
+ if (cmdlet === "foreach-object") {
18038
+ if (next?.group === "open")
18039
+ return `${first} (…)`;
18040
+ for (const arg of words.slice(1))
18041
+ if (!arg.startsWith("-") && !/^\d+$/.test(arg) && !READ_MEMBERS.test(arg) && !READ_METHODS.test(arg))
18042
+ return `${first} ${arg}`;
18043
+ }
18044
+ return null;
18045
+ };
18046
+ var pwshScriptWriter = (script, depth = 0) => {
18047
+ const why = powershellTextWriter(script);
18048
+ if (why)
18049
+ return why;
18050
+ const segments = segmentsOf(script, "powershell");
18051
+ for (const [at, segment] of segments.entries()) {
18052
+ const statement = pwshStatementWriter(segment, depth, segments[at - 1], segments[at + 1]);
18053
+ if (statement)
18054
+ return statement;
18055
+ }
18056
+ return null;
18057
+ };
18058
+ var CMD_READS = /^(?:dir|type|echo|cd|chdir|set|where|findstr|find|ver|vol|tree|more|rem)$/;
18059
+ var cmdStatementWriter = (segment) => {
18060
+ if (segment.redirects.some((file) => !NULL_SINK.test(file)))
18061
+ return ">";
18062
+ const [first, ...args] = segment.words;
18063
+ if (first === undefined)
18064
+ return null;
18065
+ const name = first.replace(/^@/, "").toLowerCase().replace(/^(echo)[.:(/\\].*$/, "$1");
18066
+ if (!CMD_READS.test(name))
18067
+ return first;
18068
+ if (name === "set" && args.some((arg) => arg.includes("=") || /^\/[ap]$/i.test(arg)))
18069
+ return first;
18070
+ return null;
18071
+ };
18072
+ var windowsStatementWriter = (segment, cmd, text, prev, next) => cmd ? cmdStatementWriter(segment) : text ?? pwshStatementWriter(segment, 0, prev, next);
18073
+
17723
18074
  // packages/workit-core/src/hooks/write-gate.ts
17724
18075
  var NONE3 = { kind: "none" };
17725
18076
  var CASE_INSENSITIVE = process.platform === "darwin" || process.platform === "win32";
@@ -18143,13 +18494,14 @@ var shellScript3 = (words) => {
18143
18494
  }
18144
18495
  return null;
18145
18496
  };
18146
- var CMD_VAR = /%[^%\s]+%|![^!\s]+!/;
18147
- var XARGS_VALUE = /^-[InLPdsEa]$/;
18497
+ var XARGS_VALUE = /^-[InLPdsEaJR]$/;
18148
18498
  var runsWriter = (words) => {
18149
18499
  const filled = [
18150
18500
  ...words.filter((word) => word !== ";" && word !== "+").map((word) => word.includes("{}") ? "eval" : word),
18151
18501
  "eval"
18152
18502
  ];
18503
+ if (pastLead(filled)[0] === "eval")
18504
+ return true;
18153
18505
  const edits = editsOf(filled);
18154
18506
  return edits === null || edits.length > 0 || opaqueWrites(filled) !== null;
18155
18507
  };
@@ -18161,14 +18513,20 @@ var opaqueWrites = (input, scriptOf = (index) => input[index], fed, loads = fals
18161
18513
  for (;words[at]?.startsWith("-"); at += XARGS_VALUE.test(words[at]) ? 2 : 1)
18162
18514
  token = words[at] === "-I" ? words[at + 1] ?? token : /^-[Ii](.+)|^--replace=(.+)/s.exec(words[at])?.slice(1).join("") ?? token;
18163
18515
  const named = pastLead(words.slice(at))[0] ?? "";
18164
- return named.includes(token) || named.includes("{}") || runsWriter(words.slice(at)) ? ["."] : null;
18516
+ if (at >= words.length)
18517
+ return null;
18518
+ return named.includes(token) || named.includes("{}") || words.slice(1, at).some((word) => word.startsWith("-J")) || runsWriter(words.slice(at)) ? ["."] : null;
18165
18519
  }
18166
18520
  const [verb, ...args] = words;
18167
18521
  const name = (verb?.split(/[\\/]/).at(-1) ?? "").toLowerCase().replace(/\.exe$/, "");
18168
18522
  if (/^(?:flock|watch|ssh|parallel|script|su|runuser|strace|iex|invoke-expression)$/.test(name) || (name === "pwsh" || name === "powershell") && powershellOpaque(words))
18169
18523
  return ["."];
18524
+ if (CMD_VAR.test(verb ?? ""))
18525
+ return ["."];
18170
18526
  if (name === "mklink" && args.some((arg) => CMD_VAR.test(arg)))
18171
18527
  return ["."];
18528
+ if (name === "cmd" && cmdScript(words) === null && !args.includes("/?"))
18529
+ return ["."];
18172
18530
  const files = operands(args);
18173
18531
  const has = (pattern) => args.some((arg) => pattern.test(arg));
18174
18532
  const listed = (named) => named.length ? named : ["."];
@@ -18679,6 +19037,20 @@ var commandWords = (words) => {
18679
19037
  start++;
18680
19038
  return words.slice(start);
18681
19039
  };
19040
+ var POSIX_LOADER = new RegExp(LOADER_ENV.source);
19041
+ var loaderAssignment = (words) => {
19042
+ for (const word of words) {
19043
+ const name = /^(\w+)\+?=/.exec(word)?.[1];
19044
+ if (/^(?:(?:GIT_)?PAGER=cat|GIT_OPTIONAL_LOCKS=0)$/.test(word))
19045
+ continue;
19046
+ if (name !== undefined) {
19047
+ if (POSIX_LOADER.test(name))
19048
+ return word.split("=")[0];
19049
+ } else if (!DECLARERS.has(word) && word !== "env" && !word.startsWith("-"))
19050
+ return;
19051
+ }
19052
+ return;
19053
+ };
18682
19054
  var REBINDS_ANY = new Set([
18683
19055
  "source",
18684
19056
  ".",
@@ -18873,8 +19245,11 @@ var homeExpanded = (file) => {
18873
19245
  const match = /^(?:~|\$HOME|\$\{HOME\})(?=\/|$)/.exec(file);
18874
19246
  return match ? (process.env.HOME || os9.homedir()) + file.slice(match[0].length) : file;
18875
19247
  };
18876
- var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherited = new Map) => {
19248
+ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherited = new Map, inCmd = false) => {
18877
19249
  const targets = [];
19250
+ const windowsReads = strict === true && dialect === "powershell";
19251
+ const textWriter = windowsReads && !inCmd ? powershellTextWriter(command) : null;
19252
+ let loader;
18878
19253
  const written = new Map;
18879
19254
  let dir = cwd;
18880
19255
  let stack = [];
@@ -18939,6 +19314,13 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
18939
19314
  ({ dir, stack, vars, loops } = saved);
18940
19315
  continue;
18941
19316
  }
19317
+ const unreadable = windowsReads && dir !== undefined && segment.words.length > 0 ? windowsStatementWriter(segment, inCmd, textWriter, segments[segments.indexOf(segment) - 1], segments[segments.indexOf(segment) + 1]) : null;
19318
+ if (unreadable !== null && dir !== undefined)
19319
+ targets.push(placeholderIn(dir, `${OPAQUE_TARGET}${encodeURIComponent(unreadable)}`));
19320
+ if (strict === true && dialect === "posix")
19321
+ loader ??= loaderAssignment(commandWords(segment.words));
19322
+ if (loader !== undefined && dir !== undefined && segment.words.length > 0)
19323
+ targets.push(placeholderIn(dir, `${OPAQUE_TARGET}${encodeURIComponent(loader)}`));
18942
19324
  const body = commandWords(segment.words);
18943
19325
  const before = segments[segments.indexOf(segment) - 1];
18944
19326
  const feeder = before?.pipe ? before : undefined;
@@ -19025,8 +19407,10 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
19025
19407
  const windows = strict && depth < 4 ? windowsScript(words, segment.stdin?.join(`
19026
19408
  `)) : null;
19027
19409
  const cmd = /^cmd(?:\.exe)?$/.test(commandName2(pastLead(words)[0] ?? ""));
19410
+ if (windows !== null && dir !== undefined && dialect === "posix" && segment.expands?.length)
19411
+ targets.push(placeholderIn(dir, `${OPAQUE_TARGET}${commandName2(pastLead(words)[0] ?? "")}`));
19028
19412
  if (windows !== null && dir !== undefined)
19029
- for (const file of segmentTargets(dir, windows, "powershell", depth + 1, strict, vars))
19413
+ for (const file of segmentTargets(dir, windows, "powershell", depth + 1, strict, vars, cmd))
19030
19414
  targets.push(cmd && CMD_VAR.test(file) ? placeholderIn(dir, `${OPAQUE_TARGET}cmd`) : file);
19031
19415
  const bare = strict && depth < 4 ? unwrapped2(words) : null;
19032
19416
  if (bare?.length && dir !== undefined)
@@ -19156,7 +19540,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
19156
19540
  targets.push(placeholderIn(dir, DIR_TARGET));
19157
19541
  }
19158
19542
  for (const file of [...segment.redirects, ...edits ?? []])
19159
- if (!/^\/dev\/(?:null|stdout|stderr|tty)$/.test(file))
19543
+ if (!/^\/dev\/(?:null|stdout|stderr|tty)$/.test(file) && !(dialect === "powershell" && /^(?:\$null|nul)$/i.test(file)))
19160
19544
  targets.push(...atAll(file));
19161
19545
  if (dir !== undefined)
19162
19546
  for (const invocation of workitInvocations(body.map(quoteWord2).join(" "), "posix")) {
@@ -101,7 +101,7 @@ if (quiet) {
101
101
  `);
102
102
  } else {
103
103
  try {
104
- const { runCodexHook } = await import("./workit-hook-rwd65mxz.js");
104
+ const { runCodexHook } = await import("./workit-hook-c77z370x.js");
105
105
  await runCodexHook([payload]);
106
106
  } catch (error) {
107
107
  const { answerRuntimeFailure } = await import("./workit-hook-2j7nwxvz.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/codex",
3
- "version": "2.25.5",
3
+ "version": "2.25.6",
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.25.5",
45
- "@workit-dev/mcp": "^2.25.5"
44
+ "@workit-dev/core": "^2.25.6",
45
+ "@workit-dev/mcp": "^2.25.6"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"