@hasna/hooks 0.12.16 → 0.12.18

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.
@@ -65,6 +65,12 @@ export interface ExecutorFinding {
65
65
  * read). The caller fails closed: under a protected root it refuses.
66
66
  */
67
67
  unresolved: boolean;
68
+ /**
69
+ * Files the command writes because its own program says so (sed's `w`, `W`
70
+ * and `s///w` targets), as written. The caller judges each as a write target,
71
+ * exactly as it judges a `>` redirect target.
72
+ */
73
+ writes?: string[];
68
74
  }
69
75
 
70
76
  const baseName = (word: string): string => word.split("/").pop() ?? "";
@@ -119,7 +125,7 @@ const SSH_LOCAL_EXEC_OPTS = new Set(["proxycommand", "localcommand", "knownhosts
119
125
  * `>`/`|` are NOT dangerous here — the shell already took the real redirections
120
126
  * and pipes, so inside the program they are comparison/bit operators.
121
127
  */
122
- const C_INTERP_DANGER = /(?:`|\$\()|\b(?:system|exec|execve|execvp|popen|spawn|posix_spawn|fork|subprocess|Popen|check_output|check_call|shell_exec|passthru|proc_open|pcntl_exec|qx|open|fopen|sysopen|unlink|remove|delete|rmtree|rmdir|mkdir|rename|truncate|ftruncate|chmod|chown|symlink|writeFile|createWriteStream|appendFile|child_process|FileUtils|shutil|Kernel|require|import|load|eval|os|sys|io|fs|File|IO|Dir|Path|pathlib)/;
128
+ const C_INTERP_DANGER = /(?:`|\$\()|\b(?:system|exec|execve|execvp|popen|spawn|posix_spawn|fork|subprocess|Popen|check_output|check_call|shell_exec|passthru|proc_open|pcntl_exec|qx|open|fopen|sysopen|unlink|remove|delete|rmtree|rmdir|mkdir|rename|truncate|ftruncate|chmod|chown|symlink|writeFile|createWriteStream|appendFile|child_process|FileUtils|shutil|Kernel|require|import|load|eval|os|sys|io|fs|File|IO|Dir|Path|pathlib|Deno|Bun)|%x\W/;
123
129
 
124
130
  /**
125
131
  * awk danger: `system()` or a pipe/redirect (`| "cmd"`, `print > "file"`), a
@@ -182,6 +188,25 @@ function interpPrograms(name: string, words: string[], index: number, opaque: (a
182
188
  return { programs, unresolved };
183
189
  }
184
190
 
191
+ /**
192
+ * `deno eval [OPTIONS] CODE [ARGS…]`: deno runs CODE inline. The subcommand is
193
+ * the first word after deno that is not an option (`-L`/`--log-level` take a
194
+ * value). Every later word that is not an option is judged as the program, so
195
+ * an option value cannot hide it; an expanded one is unresolved.
196
+ */
197
+ function denoEvalPrograms(words: string[], index: number, opaque: (at: number) => boolean): ExecutorFinding | null {
198
+ let at = index + 1;
199
+ for (; at < words.length && words[at].startsWith("-"); at++) if (words[at] === "-L" || words[at] === "--log-level") at++;
200
+ if (words[at] !== "eval" || opaque(at)) return null;
201
+ const programs: EmbeddedProgram[] = [];
202
+ let unresolved = false;
203
+ for (at++; at < words.length; at++) {
204
+ if (opaque(at)) { unresolved = true; continue; }
205
+ if (!words[at].startsWith("-")) programs.push({ text: words[at], kind: "c-interp" });
206
+ }
207
+ return programs.length === 0 && !unresolved ? null : { programs, unresolved };
208
+ }
209
+
185
210
  /** The awk program: every `-e` value, or the first bare operand; `-f` file is unresolved. */
186
211
  function awkProgram(words: string[], index: number, opaque: (at: number) => boolean): ExecutorFinding {
187
212
  const programs: EmbeddedProgram[] = [];
@@ -499,11 +524,10 @@ function gitPrograms(words: string[], index: number, opaque: (at: number) => boo
499
524
  /**
500
525
  * The text a shell word stands for when it is a plain literal, or null when the
501
526
  * shell can change it: a `$` expansion or substitution (unquoted or in double
502
- * quotes), a backtick, an unquoted glob, brace or leading tilde, `$"…"`, or a
503
- * `$'…'` holding an escape this reader does not decode.
527
+ * quotes), a backtick, an unquoted glob, brace or leading tilde, `$"…"`, or
528
+ * ANSI-C quoting `$'…'`, whose escapes differ between shells.
504
529
  */
505
530
  export function literalWord(raw: string): string | null {
506
- const ANSI: Record<string, string> = { n: "\n", t: "\t", r: "\r", a: "\x07", b: "\b", e: "\x1b", E: "\x1b", f: "\f", v: "\v", "\\": "\\", "'": "'", '"': '"', "?": "?" };
507
531
  if (/^~/.test(raw)) return null;
508
532
  let out = "";
509
533
  for (let i = 0; i < raw.length; i++) {
@@ -513,19 +537,6 @@ export function literalWord(raw: string): string | null {
513
537
  if (end < 0) return null;
514
538
  out += raw.slice(i + 1, end);
515
539
  i = end;
516
- } else if (ch === "$" && raw[i + 1] === "'") {
517
- let j = i + 2;
518
- for (; j < raw.length && raw[j] !== "'"; j++) {
519
- if (raw[j] !== "\\") { out += raw[j]; continue; }
520
- const c = raw[j + 1];
521
- let m: RegExpMatchArray | null;
522
- if (c !== undefined && Object.hasOwn(ANSI, c)) { out += ANSI[c]; j++; }
523
- else if ((m = raw.slice(j + 1).match(/^[0-7]{1,3}/))) { out += String.fromCharCode(parseInt(m[0], 8) & 0xff); j += m[0].length; }
524
- else if ((m = raw.slice(j + 1).match(/^x([0-9A-Fa-f]{1,2})/))) { out += String.fromCharCode(parseInt(m[1], 16)); j += m[0].length; }
525
- else return null;
526
- }
527
- if (j >= raw.length) return null;
528
- i = j;
529
540
  } else if (ch === "$" || ch === "\x60") {
530
541
  return null;
531
542
  } else if (ch === '"') {
@@ -585,15 +596,22 @@ export interface ShellProgram {
585
596
  * cluster, `-lc`, `-ec`) or `eval WORD…`, from the RAW words of one simple
586
597
  * command (redirections removed) with the command word at `index`. A literal
587
598
  * program is returned for the caller to classify as it does today; a program
588
- * that is not a plain literal (an expansion, a substitution, an undecodable
599
+ * that is not a plain literal (an expansion, a substitution, ANSI-C quoting
589
600
  * `$'…'`, an unquoted expansion where `-c` could hide, or an eval of several
590
601
  * words) is `literal: false` and the caller fails closed. Null when the command
591
602
  * runs no inline program (a script file, stdin).
592
603
  */
593
- export function shellProgram(raw: string[], index: number): ShellProgram | null {
604
+ /**
605
+ * `text` with every `\'` inside an ANSI-C `$'…'` word written `\x27`, which
606
+ * the shell decodes to the same quote. The shared lexer does not follow a
607
+ * `\'` there (it stops trusting the command), but reads this spelling.
608
+ */
609
+ export const ansiPlain = (text: string): string =>
610
+ text.replace(/\$'(?:[^'\\]|\\[\s\S])*'/g, (word) => word.replace(/\\[\s\S]/g, (pair) => (pair === "\\'" ? "\\x27" : pair)));
611
+
612
+ export function shellProgram(raw: string[], index: number, decodeName: (raw: string) => string | null = literalWord): ShellProgram | null {
594
613
  if (index < 0 || index >= raw.length) return null;
595
- const nameText = literalWord(raw[index]);
596
- const name = baseName(nameText ?? "");
614
+ const name = baseName(decodeName(raw[index]) ?? "");
597
615
  if (name === "eval") {
598
616
  let at = index + 1;
599
617
  if (literalWord(raw[at] ?? "") === "--") at++;
@@ -627,92 +645,217 @@ export function shellProgram(raw: string[], index: number): ShellProgram | null
627
645
  }
628
646
 
629
647
  /**
630
- * sed scripts (the `e`/`s///e` execute forms and the `w`/`W`/`s///w` file
631
- * writes), without `-i`. `-i` is already a write the guards model; it is left
632
- * to them. Returns the program with kind "shell" when it executes (fail closed
633
- * through `unresolved` for the `e` command, whose command comes from input),
634
- * and marks a write with no execute by an empty program list and `unresolved`
635
- * false — the caller then treats sed as a writer, not an executor.
648
+ * sed (GNU sed 4.9 grammar; BSD's `-i ''`/`-i .bak` suffix word is read too).
649
+ * Its script can execute (`e`, `s///e`) and write files (`w`, `W`, `s///w`,
650
+ * which sed opens, truncating them, before it reads any input). Returns:
651
+ * - `unresolved` when a script cannot be read exactly: an expanded script or
652
+ * option word, a `-f` script file, an option sed does not know, or a script
653
+ * this reader cannot parse (fail closed);
654
+ * - the scripts as shell programs, unresolved, when one executes (the command
655
+ * it runs comes from the input);
656
+ * - otherwise the write targets in `writes` (none for a filter such as
657
+ * `sed -n 1p`), for the caller to judge as write targets.
658
+ * Null when sed neither executes nor writes a file through its script.
636
659
  */
637
660
  function sedPrograms(words: string[], index: number, opaque: (at: number) => boolean): ExecutorFinding | null {
638
- // Collect the script text: -e values, the first bare operand, or -f (unread).
661
+ const readings = sedReadings(words, index, opaque);
662
+ if (readings === null) return { programs: [], unresolved: true };
663
+ const writes = new Set<string>();
664
+ for (const { scripts, mayFail } of readings) {
665
+ const script = sedParseScript(scripts.join("\n"));
666
+ if (script === null) {
667
+ // sed opens each `w` file while it compiles, so a script that fails part
668
+ // way may already have truncated one: fail closed. The one exception is
669
+ // GNU's reading of a BSD `-i` suffix word as the script, which fails at
670
+ // its first character, before anything is opened.
671
+ if (mayFail) continue;
672
+ return { programs: [], unresolved: true };
673
+ }
674
+ if (script.executes) return { programs: scripts.map((text) => ({ text, kind: "shell" as const })), unresolved: true };
675
+ for (const file of script.writes) writes.add(file);
676
+ }
677
+ if (writes.size === 0) return null;
678
+ return { programs: [], unresolved: false, writes: [...writes] };
679
+ }
680
+
681
+ /**
682
+ * GNU sed long options (without `--`), matched exactly or by a unique prefix
683
+ * as getopt_long does. The last two take a value (attached with `=` or the
684
+ * next word); `in-place` takes one only attached; `file` names a script file.
685
+ */
686
+ const SED_LONG = "quiet silent debug follow-symlinks posix regexp-extended separate sandbox unbuffered null-data zero-terminated binary help version in-place file expression line-length".split(" ");
687
+
688
+ /**
689
+ * The script fragments of a sed command, per reading. GNU getopt permutes, so
690
+ * every `-e`/`--expression` before `--` counts, and without one the first
691
+ * operand is the script. BSD sed reads the word after a lone `-i` as the
692
+ * backup suffix when it is empty or starts with `.` (`-i ''`, `-i .bak`), and
693
+ * after `-I` (`-Ibak` attached); that reading is added (and, for `-I`, which
694
+ * GNU rejects, it is the only one). Null when a script cannot be read: an
695
+ * expanded script or option word, a `-f`/`--file` script file, or an option
696
+ * sed does not know.
697
+ */
698
+ function sedReadings(words: string[], index: number, opaque: (at: number) => boolean): Array<{ scripts: string[]; mayFail: boolean }> | null {
639
699
  const scripts: string[] = [];
640
- let unresolvedScript = false;
641
- let hadInPlace = false;
642
- let at = index + 1;
643
- let sawScript = false;
644
- for (; at < words.length; at++) {
700
+ const operands: number[] = [];
701
+ let bsd = false;
702
+ let suffixAt = -1;
703
+ let gnuRejects = false;
704
+ let endOfOptions = false;
705
+ for (let at = index + 1; at < words.length; at++) {
645
706
  const word = words[at];
646
- if (word === "--") { at++; break; }
647
- if (word === "-i" || word.startsWith("-i") || word.startsWith("--in-place")) { hadInPlace = true; continue; }
648
- if (word === "-e" || word === "--expression") {
649
- sawScript = true;
650
- if (at + 1 < words.length && !opaque(at + 1)) scripts.push(words[++at]);
651
- else unresolvedScript = true;
652
- } else if (word.startsWith("-e")) { sawScript = true; scripts.push(word.slice(2)); }
653
- else if (word.startsWith("--expression=")) { sawScript = true; scripts.push(word.slice("--expression=".length)); }
654
- else if (word === "-f" || word === "--file") { sawScript = true; unresolvedScript = true; if (word === "-f") at++; }
655
- else if (word.startsWith("-f") || word.startsWith("--file=")) { sawScript = true; unresolvedScript = true; }
656
- else if (!word.startsWith("-") || word === "-") break;
657
- }
658
- if (hadInPlace) return null; // -i is the guards' existing write handling
659
- if (!sawScript) {
660
- if (at < words.length) {
661
- if (opaque(at)) unresolvedScript = true;
662
- else scripts.push(words[at]);
663
- } else return null;
707
+ if (endOfOptions || !/^-./.test(word)) { operands.push(at); continue; }
708
+ if (opaque(at)) return null;
709
+ if (word === "--") { endOfOptions = true; continue; }
710
+ let option: string;
711
+ let value: string | undefined;
712
+ if (word[1] === "-") {
713
+ const eq = word.indexOf("=");
714
+ const flag = (eq < 0 ? word : word.slice(0, eq)).slice(2);
715
+ const names = SED_LONG.filter((name) => name.startsWith(flag));
716
+ const name = SED_LONG.includes(flag) ? flag : names.length === 1 ? names[0] : "";
717
+ if (SED_LONG.indexOf(name) < 15) { if (!name) return null; continue; }
718
+ option = name[0];
719
+ if (eq >= 0) value = word.slice(eq + 1);
720
+ } else {
721
+ let i = 1;
722
+ while ("nrEsuzb".includes(word[i] ?? "_")) i++;
723
+ option = word[i] ?? "";
724
+ if (option === "i" || option === "I") {
725
+ // GNU `-i[SUFFIX]` takes the rest of the word; BSD `-i SUFFIX` and
726
+ // `-I SUFFIX` may take the next word.
727
+ const next = i === word.length - 1 && at + 1 < words.length && !opaque(at + 1) ? words[at + 1] : undefined;
728
+ if (option === "I") {
729
+ gnuRejects = bsd = true;
730
+ if (i === word.length - 1) { if (next === undefined) return null; suffixAt = at + 1; }
731
+ } else if (next === "" || next?.startsWith(".")) {
732
+ bsd = true;
733
+ suffixAt = at + 1;
734
+ }
735
+ continue;
736
+ }
737
+ if (option === "") continue;
738
+ if (!"efl".includes(option)) return null;
739
+ value = word.slice(i + 1) || undefined;
740
+ }
741
+ if (option === "f") return null;
742
+ if (value === undefined) {
743
+ value = words[++at];
744
+ if (value === undefined || opaque(at)) return null;
745
+ }
746
+ if (option === "e") scripts.push(value);
664
747
  }
665
- const text = scripts.join("\n");
666
- const executes = unresolvedScript || sedScriptExecutes(text);
667
- const writes = sedScriptWrites(text);
668
- if (!executes && !writes) return null;
669
- // An executing sed runs a command we usually cannot see (the pattern space),
670
- // so it is unresolved unless the visible script already names a delete verb.
671
- if (executes) return { programs: scripts.map((s) => ({ text: s, kind: "shell" as const })), unresolved: true };
672
- // A writing sed (`w`/`W`/`s///w`) names its file in the script; the caller
673
- // reads it as a write target. No local execution.
674
- return { programs: [], unresolved: false };
748
+ const reading = (skip: number): string[] | null => {
749
+ if (scripts.length > 0) return scripts;
750
+ const first = operands.find((at) => at !== skip);
751
+ return first === undefined ? [] : opaque(first) ? null : [words[first]];
752
+ };
753
+ const readings: Array<{ scripts: string[] | null; mayFail: boolean }> = [];
754
+ // GNU reads a BSD suffix word itself as the script, and fails at once.
755
+ if (!gnuRejects) readings.push({ scripts: reading(-1), mayFail: suffixAt >= 0 && scripts.length === 0 && operands[0] === suffixAt });
756
+ if (bsd) readings.push({ scripts: reading(suffixAt), mayFail: false });
757
+ return readings.some((r) => r.scripts === null) ? null : (readings as Array<{ scripts: string[]; mayFail: boolean }>);
675
758
  }
676
759
 
677
- /** An optional sed address (line number, `$`, `/regex/`, ranges and `!`) before a command. */
678
- const SED_ADDRESS = String.raw`[\s0-9$,!]*(?:\/(?:\\.|[^\/\n])*\/[\s0-9$,!]*)?`;
760
+ /**
761
+ * Read a sed script as GNU sed 4.9 tokenizes it (compile.c), for the files it
762
+ * writes and whether it executes. It follows every construct that takes an
763
+ * argument, exactly: regex addresses (`/re/`, `\cREc`, bracket expressions
764
+ * read whole), labels (`: b t T v`, to whitespace or `;`), the text commands
765
+ * (`a i c`, to the end of the line, a backslash escaping the next character),
766
+ * `r R w W e` (to the end of the line), comments, and `s`/`y` with any
767
+ * delimiter, including the flags of `s` (`w FILE` to the end of the line).
768
+ * Every other character is stepped over, so a script sed rejects still yields
769
+ * every `w` file it names: sed opens those while compiling, before any error
770
+ * stops it. `/dev/stdout` and `/dev/stderr` are not files. Null when a
771
+ * delimited argument is not terminated: the script cannot be read.
772
+ */
773
+ export function sedParseScript(script: string): { writes: string[]; executes: boolean } | null {
774
+ const writes: string[] = [];
775
+ let executes = false;
776
+ let i = 0;
777
+ const n = script.length;
778
+ const c = () => script[i] ?? "";
779
+ const rest = () => {
780
+ while (c() === " " || c() === "\t") i++;
781
+ const start = i;
782
+ const end = script.indexOf("\n", i);
783
+ i = end < 0 ? n : end;
784
+ return script.slice(start, i);
785
+ };
786
+ const file = () => { const name = rest(); if (name && !/^\/dev\/std(?:out|err)$/.test(name)) writes.push(name); };
787
+ // match_slash: up to an unescaped delimiter; a raw newline ends it
788
+ // unterminated. In a regex (an address, the pattern of `s`) a bracket
789
+ // expression is read whole, so the delimiter inside it (`s/[/]/x/`) is
790
+ // literal, as GNU sed 4.9 reads it; a backslash inside a bracket is
791
+ // literal. The replacement of `s` and both parts of `y` are not regexes.
792
+ const delimited = (delim: string, regex: boolean): boolean => {
793
+ for (; i < n; i++) {
794
+ const ch = script[i];
795
+ if (ch === "\n") return false;
796
+ if (ch === "\\") { if (++i >= n) return false; }
797
+ else if (ch === delim) { i++; return true; }
798
+ else if (regex && ch === "[") {
799
+ let j = i + 1;
800
+ if (script[j] === "^") j++;
801
+ if (script[j] === "]") j++;
802
+ for (; script[j] !== "]"; j++) {
803
+ if (j >= n || script[j] === "\n") return false;
804
+ if (script[j] === "[" && ":.=".includes(script[j + 1] || "\n")) {
805
+ const close = script.indexOf(script[j + 1] + "]", j + 2);
806
+ if (close < 0 || script.slice(j, close).includes("\n")) return false;
807
+ j = close + 1;
808
+ }
809
+ }
810
+ i = j;
811
+ }
812
+ }
813
+ return false;
814
+ };
815
+ while (i < n) {
816
+ const cmd = script[i++];
817
+ if (cmd === "/" || cmd === "\\") {
818
+ // A regex address, then its I/M flags (stepped over below).
819
+ const delim = cmd === "\\" ? script[i++] ?? "" : "/";
820
+ if (!delim || delim === "\n" || !delimited(delim, true)) return null;
821
+ } else if (cmd === "#") rest();
822
+ else if (":btTv".includes(cmd)) { while (c() === " " || c() === "\t") i++; while (i < n && !/[\s;]/.test(c())) i++; }
823
+ else if ("aic".includes(cmd)) {
824
+ // GNU sed 4.9 read_text: after `a\` the next character is the text's
825
+ // first character taken literally (a newline there starts the text on
826
+ // the next line); GNU's one-liner `a text` starts at the first non-blank.
827
+ // A backslash escapes the next character, so only an unescaped newline
828
+ // ends the text: `a\\<newline>e cmd` ends at the newline and `e cmd` is
829
+ // a command.
830
+ while (c() === " " || c() === "\t") i++;
831
+ if (c() === "\\") i += 2;
832
+ for (; i < n && script[i] !== "\n"; i++) if (script[i] === "\\") i++;
833
+ } else if (cmd === "e") { executes = true; rest(); }
834
+ else if (cmd === "r" || cmd === "R") rest();
835
+ else if (cmd === "w" || cmd === "W") file();
836
+ else if (cmd === "s" || cmd === "y") {
837
+ const delim = script[i++] ?? "";
838
+ if (!delim || delim === "\n" || delim === "\\" || !delimited(delim, cmd === "s") || !delimited(delim, false)) return null;
839
+ // The flags of `s`; `w` takes the rest of the line.
840
+ for (; cmd === "s" && " \tgpiImMe0123456789w".includes(c() || "_"); i++) {
841
+ if (c() === "e") executes = true;
842
+ if (c() === "w") { i++; file(); break; }
843
+ }
844
+ }
845
+ }
846
+ return { writes, executes };
847
+ }
679
848
 
680
- /** Whether a sed script executes: an `e` command, or an `s///` with the `e` flag. */
849
+ /** Whether a sed script executes: an `e` command, or an `s///` with the `e` flag (unparseable: true). */
681
850
  export function sedScriptExecutes(script: string): boolean {
682
- // The `e` command: `e` optionally followed by a shell command, at the start
683
- // of a command (line start, `;`, `{`) after any address. Not the `e` flag of
684
- // `s`, handled next.
685
- if (new RegExp(`(?:^|[;{\\n])${SED_ADDRESS}e(?:\\s|$|[^A-Za-z])`).test(script)) return true;
686
- // `s<delim>…<delim>…<delim>` with a flag run containing `e`.
687
- return sedSubstFlags(script).some((flags) => flags.includes("e"));
851
+ const parsed = sedParseScript(script);
852
+ return parsed === null || parsed.executes;
688
853
  }
689
854
 
690
- /** Whether a sed script writes a file: a `w`/`W` command, or an `s///` with the `w` flag. */
855
+ /** Whether a sed script writes a file: a `w`/`W` command, or an `s///` with the `w` flag (unparseable: true). */
691
856
  export function sedScriptWrites(script: string): boolean {
692
- if (new RegExp(`(?:^|[;{\\n])${SED_ADDRESS}[wW]\\s+\\S`).test(script)) return true;
693
- return sedSubstFlags(script).some((flags) => flags.includes("w"));
694
- }
695
-
696
- /** The flag runs of every `s<delim>pat<delim>rep<delim>FLAGS` in a sed script (best effort). */
697
- function sedSubstFlags(script: string): string[] {
698
- const flags: string[] = [];
699
- for (let i = 0; i < script.length; i++) {
700
- if (script[i] !== "s") continue;
701
- if (i > 0 && /[A-Za-z0-9_]/.test(script[i - 1])) continue;
702
- const delim = script[i + 1];
703
- if (!delim || /[\sA-Za-z0-9\\]/.test(delim)) continue;
704
- let seen = 0;
705
- let j = i + 2;
706
- for (; j < script.length && seen < 2; j++) {
707
- if (script[j] === "\\") { j++; continue; }
708
- if (script[j] === delim) seen++;
709
- }
710
- if (seen < 2) continue;
711
- const run = script.slice(j).match(/^[a-zA-Z0-9]*/);
712
- flags.push(run ? run[0] : "");
713
- i = j;
714
- }
715
- return flags;
857
+ const parsed = sedParseScript(script);
858
+ return parsed === null || parsed.writes.length > 0;
716
859
  }
717
860
 
718
861
  /** A command a launcher runs: its words are `words[start..end)` of the launcher's segment. */
@@ -831,6 +974,10 @@ export function launchedCommands(words: string[], index: number, skip: (at: numb
831
974
  export function localExecutor(words: string[], index: number, opaque: (at: number) => boolean): ExecutorFinding | null {
832
975
  if (index < 0 || index >= words.length) return null;
833
976
  const name = baseName(words[index]);
977
+ if (name === "deno") {
978
+ const evaluated = denoEvalPrograms(words, index, opaque);
979
+ if (evaluated) return evaluated;
980
+ }
834
981
  if (Object.hasOwn(INTERP_PROGRAM_FLAGS, name) || VERSIONED_INTERP.test(name)) return interpPrograms(name, words, index, opaque);
835
982
  if (AWK_NAMES.has(name)) return awkProgram(words, index, opaque);
836
983
  if (SSH_NAMES.has(name)) return sshPrograms(words, index, opaque);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/hooks",
3
- "version": "0.12.16",
3
+ "version": "0.12.18",
4
4
  "description": "Open source hooks library for AI coding agents - Install safety, quality, and automation hooks with a single command",
5
5
  "type": "module",
6
6
  "bin": {