@workit-dev/codex 2.25.4 → 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.4",
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,34 +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
  }
14778
+ opaque ||= kind === "opaque";
14779
+ if (kind !== "switch" && glued === undefined)
14780
+ index++;
14725
14781
  }
14726
- return null;
14782
+ return { script: null, opaque: true };
14727
14783
  };
14784
+ var powershellScript = (words, stdin) => powershellRun(words, stdin).script;
14785
+ var powershellOpaque = (words) => powershellRun(words).opaque;
14728
14786
  var cmdScript = (words) => {
14729
14787
  const at = words.findIndex((word, index) => index > 0 && /^\/[ck]$/i.test(word));
14730
14788
  if (at > 0)
@@ -17704,6 +17762,315 @@ var claimLiveSession = (target, owner, deps = {}) => {
17704
17762
  } catch {}
17705
17763
  };
17706
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
+
17707
18074
  // packages/workit-core/src/hooks/write-gate.ts
17708
18075
  var NONE3 = { kind: "none" };
17709
18076
  var CASE_INSENSITIVE = process.platform === "darwin" || process.platform === "win32";
@@ -17822,11 +18189,17 @@ var editsOf = (input) => {
17822
18189
  case "cp":
17823
18190
  case "ln":
17824
18191
  case "install": {
17825
- const into = valueOf(args, /^(?:-t|--target-directory=?)(.*)$/s);
18192
+ const into = valueOf(args, /^(?:-[a-zA-Z]*t|--target-directory=?)(.*)$/s);
17826
18193
  if (into !== undefined)
17827
18194
  return [into];
17828
- const last = operands(args).at(-1);
17829
- return last ? [last] : null;
18195
+ const files = operands(args);
18196
+ if (name === "ln" && files.length === 1)
18197
+ return [path30.basename(files[0])];
18198
+ return files.length ? [files.at(-1)] : null;
18199
+ }
18200
+ case "mklink": {
18201
+ const link = args.find((arg) => !/^\/[dhj]$/i.test(arg));
18202
+ return link ? [link] : null;
17830
18203
  }
17831
18204
  case "dd":
17832
18205
  return args.filter((item) => item.startsWith("of=")).map((item) => item.slice(3));
@@ -17855,10 +18228,15 @@ var editsOf = (input) => {
17855
18228
  case "del":
17856
18229
  case "copy-item":
17857
18230
  case "move-item": {
17858
- const flag = args.findIndex((item) => /^-(?:path|filepath|literalpath|destination)$/i.test(item));
17859
- if (flag >= 0)
17860
- return args[flag + 1] ? [args[flag + 1]] : null;
17861
- const files = operands(args);
18231
+ const named = valueOf(args, /^-(?:path|filepath|literalpath|destination)(?::(.+))?$/is);
18232
+ if (named !== undefined || args.some((item) => /^-(?:path|filepath|literalpath|destination)$/i.test(item)))
18233
+ return named ? [named] : null;
18234
+ const files = args.filter((item, at) => !item.startsWith("-") && !/^-(?:itemtype|type|value|target|encoding|name)$/i.test(args[at - 1] ?? ""));
18235
+ if (files.length === 0 && (name === "new-item" || name === "ni")) {
18236
+ const leaf = valueOf(args, /^-name(?::(.+))?$/is);
18237
+ if (leaf)
18238
+ return [leaf];
18239
+ }
17862
18240
  if (name === "move-item")
17863
18241
  return files.length ? files : null;
17864
18242
  const file = name === "copy-item" ? files.at(-1) : files[0];
@@ -18116,12 +18494,14 @@ var shellScript3 = (words) => {
18116
18494
  }
18117
18495
  return null;
18118
18496
  };
18119
- var XARGS_VALUE = /^-[IinLPdsEa]$/;
18497
+ var XARGS_VALUE = /^-[InLPdsEaJR]$/;
18120
18498
  var runsWriter = (words) => {
18121
18499
  const filled = [
18122
18500
  ...words.filter((word) => word !== ";" && word !== "+").map((word) => word.includes("{}") ? "eval" : word),
18123
18501
  "eval"
18124
18502
  ];
18503
+ if (pastLead(filled)[0] === "eval")
18504
+ return true;
18125
18505
  const edits = editsOf(filled);
18126
18506
  return edits === null || edits.length > 0 || opaqueWrites(filled) !== null;
18127
18507
  };
@@ -18129,13 +18509,23 @@ var opaqueWrites = (input, scriptOf = (index) => input[index], fed, loads = fals
18129
18509
  const words = pastLead(input);
18130
18510
  if (words[0] === "xargs") {
18131
18511
  let at = 1;
18132
- while (words[at]?.startsWith("-"))
18133
- at += XARGS_VALUE.test(words[at]) ? 2 : 1;
18134
- return runsWriter(words.slice(at)) ? ["."] : null;
18512
+ let token = "{}";
18513
+ for (;words[at]?.startsWith("-"); at += XARGS_VALUE.test(words[at]) ? 2 : 1)
18514
+ token = words[at] === "-I" ? words[at + 1] ?? token : /^-[Ii](.+)|^--replace=(.+)/s.exec(words[at])?.slice(1).join("") ?? token;
18515
+ const named = pastLead(words.slice(at))[0] ?? "";
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;
18135
18519
  }
18136
18520
  const [verb, ...args] = words;
18137
- const name = (verb?.split(/[\\/]/).at(-1) ?? "").toLowerCase();
18138
- if (/^(?:flock|watch|ssh|parallel|script|su|runuser|strace)$/.test(name))
18521
+ const name = (verb?.split(/[\\/]/).at(-1) ?? "").toLowerCase().replace(/\.exe$/, "");
18522
+ if (/^(?:flock|watch|ssh|parallel|script|su|runuser|strace|iex|invoke-expression)$/.test(name) || (name === "pwsh" || name === "powershell") && powershellOpaque(words))
18523
+ return ["."];
18524
+ if (CMD_VAR.test(verb ?? ""))
18525
+ return ["."];
18526
+ if (name === "mklink" && args.some((arg) => CMD_VAR.test(arg)))
18527
+ return ["."];
18528
+ if (name === "cmd" && cmdScript(words) === null && !args.includes("/?"))
18139
18529
  return ["."];
18140
18530
  const files = operands(args);
18141
18531
  const has = (pattern) => args.some((arg) => pattern.test(arg));
@@ -18409,7 +18799,7 @@ var PATHS = /(?<![\w.~:/$-])(?:~\/|\/|[A-Za-z]:\/|\.\.(?:\/|$))[^\s'"`$),;:*?<>|
18409
18799
  var pathsIn = (text) => [...text.matchAll(PATHS)].map((match) => match[0]);
18410
18800
  var linkSources = (args, at) => {
18411
18801
  const names = operands([...args]);
18412
- const into = args.indexOf("-t");
18802
+ const into = args.findIndex((arg) => /^-[a-zA-Z]*t$/.test(arg));
18413
18803
  const dest = into >= 0 ? args[into + 1] : names.length > 1 ? names.at(-1) : ".";
18414
18804
  const sources = names.filter((name, index) => into >= 0 ? name !== dest : index < names.length - 1 || names.length === 1);
18415
18805
  const target = dest === undefined ? null : at(dest);
@@ -18647,6 +19037,20 @@ var commandWords = (words) => {
18647
19037
  start++;
18648
19038
  return words.slice(start);
18649
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
+ };
18650
19054
  var REBINDS_ANY = new Set([
18651
19055
  "source",
18652
19056
  ".",
@@ -18841,8 +19245,11 @@ var homeExpanded = (file) => {
18841
19245
  const match = /^(?:~|\$HOME|\$\{HOME\})(?=\/|$)/.exec(file);
18842
19246
  return match ? (process.env.HOME || os9.homedir()) + file.slice(match[0].length) : file;
18843
19247
  };
18844
- 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) => {
18845
19249
  const targets = [];
19250
+ const windowsReads = strict === true && dialect === "powershell";
19251
+ const textWriter = windowsReads && !inCmd ? powershellTextWriter(command) : null;
19252
+ let loader;
18846
19253
  const written = new Map;
18847
19254
  let dir = cwd;
18848
19255
  let stack = [];
@@ -18907,6 +19314,13 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
18907
19314
  ({ dir, stack, vars, loops } = saved);
18908
19315
  continue;
18909
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)}`));
18910
19324
  const body = commandWords(segment.words);
18911
19325
  const before = segments[segments.indexOf(segment) - 1];
18912
19326
  const feeder = before?.pipe ? before : undefined;
@@ -18992,8 +19406,12 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
18992
19406
  targets.push(...segmentTargets(runIn, inner, "posix", depth + 1, strict, runIn === dir ? vars : unPwd()));
18993
19407
  const windows = strict && depth < 4 ? windowsScript(words, segment.stdin?.join(`
18994
19408
  `)) : null;
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] ?? "")}`));
18995
19412
  if (windows !== null && dir !== undefined)
18996
- targets.push(...segmentTargets(dir, windows, "powershell", depth + 1, strict, vars));
19413
+ for (const file of segmentTargets(dir, windows, "powershell", depth + 1, strict, vars, cmd))
19414
+ targets.push(cmd && CMD_VAR.test(file) ? placeholderIn(dir, `${OPAQUE_TARGET}cmd`) : file);
18997
19415
  const bare = strict && depth < 4 ? unwrapped2(words) : null;
18998
19416
  if (bare?.length && dir !== undefined)
18999
19417
  targets.push(...segmentTargets(dir, bare.flatMap((word) => expansions(word, vars, loops)).map(quoteWord2).join(" "), "posix", depth + 1, strict, vars));
@@ -19122,7 +19540,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
19122
19540
  targets.push(placeholderIn(dir, DIR_TARGET));
19123
19541
  }
19124
19542
  for (const file of [...segment.redirects, ...edits ?? []])
19125
- if (!/^\/dev\/(?:null|stdout|stderr|tty)$/.test(file))
19543
+ if (!/^\/dev\/(?:null|stdout|stderr|tty)$/.test(file) && !(dialect === "powershell" && /^(?:\$null|nul)$/i.test(file)))
19126
19544
  targets.push(...atAll(file));
19127
19545
  if (dir !== undefined)
19128
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-sbgw8r70.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.4",
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.4",
45
- "@workit-dev/mcp": "^2.25.4"
44
+ "@workit-dev/core": "^2.25.6",
45
+ "@workit-dev/mcp": "^2.25.6"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"