sh-ast 0.7.0 → 0.9.0

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.
package/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # sh-ast
2
2
 
3
3
  A synchronous TypeScript interface to the `syntax` package of
4
- [mvdan/sh](https://github.com/mvdan/sh), pinned to **v3.13.1**. Parsing returns
4
+ [mvdan/sh](https://github.com/mvdan/sh), pinned to **v3.13.1 with maintained corrections**
5
+ ([source and provenance](https://github.com/mike-north/sh-ast/tree/main/third_party/mvdan-sh)). These are the official Unicode sentinel backport and an owned, behavior-preserving change that scans consecutive comments iteratively. Parsing returns
5
6
  mutable records preserving upstream fields, defaults, nulls, numeric operators,
6
7
  byte strings, and token positions. First use initializes WebAssembly synchronously
7
8
  in Node.js; no initialization promise is required.
@@ -92,9 +93,22 @@ unsupported constructed nodes whose requested bound panics upstream.
92
93
  `PrintError` retains ordinary upstream printer failures, and `PrintPanicError`
93
94
  retains panics from printing representable inputs. `WalkPanicError` represents
94
95
  upstream-equivalent traversal panics; callback exceptions retain their identity.
95
- All extend `ShAstError`. The conservative structural-depth guard throws
96
- `ShParseMaxDepthError` before potentially exhausting the WASM stack. It is a
97
- binding resource constraint and can reject deeply nested quoted or commented text.
96
+ All extend `ShAstError`. Parsing enforces a 128-unit native node-nesting budget.
97
+ The counter includes open statement, word, and expression work plus iterative
98
+ construction of deep operator trees; it is not a stack-frame count or a total
99
+ input-size limit. Exceeding it throws `ShParseMaxDepthError` with stable code
100
+ `SH_AST_PARSE_MAX_DEPTH`, no partial File or position sidecar, and permits later
101
+ parse calls on the same runtime. `maxDepth` is the native budget; the historical
102
+ field name `estimatedDepth` now carries the rejected native work counter.
103
+ Grammar errors found first retain their ordinary `ParseError` precedence.
104
+ Flat comment runs are scanned iteratively, with no separate comment-count limit.
105
+
106
+ This is an empirical binding resource constraint, not an upstream grammar rule
107
+ or a universal stack-safety guarantee. Repeated direct and ordinary ESLint calls
108
+ were tested on Node 22; arbitrary pre-existing JS recursion can consume the host
109
+ stack margin. Valid syntax can exceed this budget. The policy does not establish
110
+ safety for arbitrary constructed ASTs or other recursive operations
111
+ ([tracked separately](https://github.com/mike-north/sh-ast/issues/71)).
98
112
  Printing collects complete output; large trees or indentation widths can consume
99
113
  substantial memory and time. The parse guard does not bound arbitrary constructed
100
114
  printing inputs. No arbitrary writer, partial-output, or reusable-printer protocol
@@ -202,6 +216,31 @@ function isAndCommand(command: BinaryCmd): boolean {
202
216
  const unnamed: RawOperator<'BinCmdOperator'> = rawOperator('BinCmdOperator', 500);
203
217
  ```
204
218
 
219
+ `resolveArgv0` first searches the whole wrapper table for an exact name. An
220
+ explicit path entry wins even if a plain-name entry appears earlier. Only when
221
+ there is no exact match does an **absolute** path use its final segment
222
+ (`/usr/bin/env`, `/usr//bin/env`); `chain` keeps the word as written. Relative
223
+ paths (`./env`, `bin/env`) and trailing-slash paths have no such fallback, but
224
+ can match names explicitly listed in a custom table. Custom plain names also
225
+ acquire absolute-path aliases unless marked as builtins; path-only names do
226
+ not alias other paths.
227
+
228
+ `WrapperSpec.shellBuiltin: true` identifies a shell builtin, which can only
229
+ match an exact entry in `names`. A path reaches an external executable rather
230
+ than a builtin, so the default `command` and `exec` entries do not match
231
+ `/tmp/command` or `/tmp/exec`. For example, `/tmp/command eval "$x"` keeps
232
+ `/tmp/command` as its static effective command; `command eval "$x"` still
233
+ resolves to `eval`. The external wrappers `env`, `sudo`, `nice`, `nohup`,
234
+ `timeout` and `time` retain their absolute-path aliases. Custom tables may
235
+ mark their own builtin (`{ names: ['builtin'], shellBuiltin: true }`);
236
+ false or omitted retains the existing matching behavior. Explicit path entries
237
+ still match exactly. Non-boolean values throw `ShAnalyzeInvalidWrapperSpecError`.
238
+
239
+ Matching is a lexical analysis assumption: `PATH` and the filesystem are not
240
+ consulted. Without an exact override, `/opt/mytools/env rm x` follows the `env`
241
+ grammar and resolves to `rm`, even if that file is not the system utility. A
242
+ dynamic word such as `"$dir/env"` is never matched.
243
+
205
244
  `resolveArgv0` follows only documented wrapper grammars. The default `env` and
206
245
  `sudo` entries accept assignment names beyond shell identifiers, such as `A-B`
207
246
  or `名`. `env` recognizes assignments after `--` and ends option scanning at its
@@ -215,6 +254,64 @@ Existing `skipAssignmentOperands: true` tables retain their ASCII shell-identifi
215
254
  rule before `--`. Wrapper assignment operands do not change `assignmentsSkipped`,
216
255
  which counts only shell-level prefixes.
217
256
 
257
+ When the effective command is a shell interpreter (`bash`, `sh`, `dash`, `zsh`,
258
+ `ksh`, `ksh93`, `mksh`, matched by the final path segment, so `/bin/bash` too)
259
+ invoked with `-c`, `resolveArgv0` reports `effective: { static: false, reason:
260
+ 'embedded-command' }`, the same result as `env -S`: the command that runs is
261
+ inside the string operand, which is never parsed. The interpreter's word stays
262
+ available as `chain.at(-2)` and `chainIndices.at(-1)` is the option word that
263
+ selected `-c`. Clustered flags (`-ec`, `-lc`), preceding options (`-o pipefail`,
264
+ `+o`, `-e`) and `--` follow each shell's own option grammar, so `bash script.sh`,
265
+ `bash -e script.sh`, `bash -- -c` and `bash -o c` still resolve to `bash`. A
266
+ dynamic word in option position (`bash "$opts" -c ls`, `bash -c"$y" x`) is
267
+ undecidable and also resolves to `bash`; there `static: true` means only that the
268
+ interpreter's name is known, not that the command is a plain shell invocation. `DEFAULT_EMBEDDED_COMMAND_INTERPRETERS` is the overridable
269
+ table; `ResolveArgv0Options.embeddedCommandInterpreters: []` restores the previous
270
+ behavior.
271
+
272
+ The table models zsh's `--emulate MODE` / `+-emulate MODE` operands and option
273
+ terminators, including `-b` / `+b` after their current cluster (`zsh -b -c x`
274
+ keeps `zsh`, while `zsh -bc x` is embedded). The ksh entry permits an omitted
275
+ `-o` / `+o` operand before another signed option (`ksh +o -c x` is embedded);
276
+ this was executed on ksh93u+ AJM 2012-08-01, not ksh93u+m or mksh. Bash, dash
277
+ and zsh keep consuming the next word as that operand. Options that themselves
278
+ change the grammar, such as zsh's `shoptionletters`, require a custom table.
279
+
280
+ Custom interpreter names must be basenames: use `names: ['bash']` for both
281
+ `/bin/bash` and `./bash`. Names containing `/`, null/undefined entries and
282
+ malformed grammar fields throw `ShAnalyzeInvalidWrapperSpecError`. The first
283
+ matching basename entry wins. Wrapper names retain their distinct policy:
284
+ exact matches first, then a basename fallback for absolute paths only.
285
+
286
+ Bash's single-dash long-option aliases are recognized before clusters:
287
+ `bash -rcfile /dev/null s` and `bash -restricted s` stay static, while
288
+ `bash -rcfile /dev/null -c x` records selector index 3. Custom grammars can
289
+ list exact operand-free long options in `noOperandLongOptions`. Separate
290
+ option operands must be static: an expansion such as `"$@"` may produce
291
+ multiple actual arguments, so `bash -o "$@" -c x` and
292
+ `bash --rcfile "$@" -c x` stop at the static interpreter. Sparse custom
293
+ tables and sparse grammar-field arrays are rejected just like entries
294
+ explicitly holding `undefined`.
295
+
296
+ The command selector `c` is reserved and cannot be declared an operand-taking
297
+ option in a custom interpreter entry; exact-token fields cannot contain `-c`.
298
+ `embeddedCommandInterpreters` must be an array: `null` and other non-array
299
+ containers throw `ShAnalyzeInvalidWrapperSpecError`; `undefined` uses defaults.
300
+ Ksh/ksh93 `+c`, `+ec` and `+o +c` run scripts instead of selecting a string.
301
+ Apple ksh's `-R` consumes a database-path operand. Ksh's lone `+` ends option processing;
302
+ `ksh -c +` has no command string, while `ksh -c + x` is embedded (executed on
303
+ ksh93u+ AJM 2012-08-01).
304
+
305
+ Known limits: the table models common option spellings and is not a full
306
+ emulation of each shell's option parser. Unusual spellings can be misclassified
307
+ in either direction:
308
+
309
+ - Bash/sh single-dash long options after a short option, e.g. `bash -e -rcfile M`.
310
+ - `ksh -c +c M`, or a dynamic word after `-c` that expands to an option.
311
+ - mksh's selector-bearing operands in `mksh -o -c M` and `mksh -o +c M`.
312
+ - A lone `+` before `-c`, e.g. `bash + -c M`.
313
+ - Zsh grammar switches, e.g. `zsh -o shoptionletters -b -c M`.
314
+
218
315
  ## Migration from 0.3
219
316
 
220
317
  Fields now use upstream spelling (`Type`, `Stmts`, `Cmd`, `Value`) and explicit
@@ -25,8 +25,8 @@ export { resolveWord } from './resolve-word.js';
25
25
  export type { ResolveWordOptions, WordResolution, WordResolutionReason } from './resolve-word.js';
26
26
  export { enumerateCommands } from './enumerate-commands.js';
27
27
  export type { CommandContext, CommandSite } from './enumerate-commands.js';
28
- export { DEFAULT_TRANSPARENT_WRAPPERS, resolveArgv0 } from './resolve-argv0.js';
29
- export type { Argv0ChainWord, Argv0Resolution, Argv0UnresolvedReason, Argv0UnresolvedWord, ResolveArgv0Options, WrapperSpec, } from './resolve-argv0.js';
28
+ export { DEFAULT_EMBEDDED_COMMAND_INTERPRETERS, DEFAULT_TRANSPARENT_WRAPPERS, resolveArgv0, } from './resolve-argv0.js';
29
+ export type { Argv0ChainWord, Argv0Resolution, Argv0UnresolvedReason, Argv0UnresolvedWord, EmbeddedCommandInterpreterSpec, ResolveArgv0Options, WrapperSpec, } from './resolve-argv0.js';
30
30
  export { ShAnalyzeInvalidWrapperSpecError, ShAnalyzeMaxDepthError, ShAstError } from '../errors.js';
31
31
  export type * from '../../generated/syntax-types.js';
32
32
  export type { BinAritOperator, BinCmdOperator, BinTestOperator, CaseOperator, GlobOperator, OperatorFamily, ParExpOperator, ParNamesOperator, ProcOperator, RawOperator, RedirOperator, UnAritOperator, UnTestOperator, } from '../../generated/syntax-constants.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/analyze/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAElG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EAAE,4BA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,EACR,GAAG,EACH,QAAQ,EACR,MAAM,EACN,UAAU,EACV,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,GAAG,EACH,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,MAAM,EACN,UAAU,EACV,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,YAAY,EACZ,OAAO,EACP,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,OAAO,EACP,YAAY,GACb,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/analyze/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAElG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MA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AM,EACN,aAAa,EACb,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,MAAM,EACN,UAAU,EACV,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,GAAG,EACH,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,MAAM,EACN,UAAU,EACV,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,YAAY,EACZ,OAAO,EACP,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,OAAO,EACP,YAAY,GACb,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
@@ -23,7 +23,7 @@
23
23
  */
24
24
  export { resolveWord } from './resolve-word.js';
25
25
  export { enumerateCommands } from './enumerate-commands.js';
26
- export { DEFAULT_TRANSPARENT_WRAPPERS, resolveArgv0 } from './resolve-argv0.js';
26
+ export { DEFAULT_EMBEDDED_COMMAND_INTERPRETERS, DEFAULT_TRANSPARENT_WRAPPERS, resolveArgv0, } from './resolve-argv0.js';
27
27
  // Re-exported from the root errors module so a consumer of enumerateCommands/
28
28
  // resolveArgv0 can `import { ShAnalyzeMaxDepthError } from 'sh-ast/analyze'`
29
29
  // without also reaching into the root `sh-ast` entry point. `ShAstError`
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/analyze/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,OAAO,EAAE,4BAA4B,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAUhF,8EAA8E;AAC9E,6EAA6E;AAC7E,yEAAyE;AACzE,4DAA4D;AAC5D,yEAAyE;AACzE,0EAA0E;AAC1E,2EAA2E;AAC3E,aAAa;AACb,OAAO,EAAE,gCAAgC,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAqBpG,gFAAgF;AAChF,gFAAgF;AAChF,OAAO,EACL,GAAG,EACH,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,GAAG,EACH,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,OAAO,EACP,MAAM,EACN,UAAU,EACV,OAAO,EACP,MAAM,EACN,YAAY,EACZ,cAAc,EACd,KAAK,EACL,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,KAAK,EACL,KAAK,EACL,SAAS,EACT,MAAM,EACN,KAAK,EACL,QAAQ,EACR,GAAG,EACH,YAAY,EACZ,kBAAkB,EAClB,KAAK,EACL,MAAM,EACN,GAAG,EACH,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,GAAG,EACH,UAAU,EACV,OAAO,EACP,aAAa,EACb,cAAc,EACd,aAAa,EACb,GAAG,EACH,IAAI,EACJ,GAAG,EACH,GAAG,EACH,QAAQ,EACR,UAAU,EACV,GAAG,EACH,UAAU,EACV,KAAK,EACL,GAAG,EACH,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,GAAG,EACH,GAAG,EACH,EAAE,EACF,MAAM,EACN,OAAO,EACP,WAAW,EACX,MAAM,EACN,MAAM,EACN,aAAa,EACb,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,MAAM,EACN,UAAU,EACV,OAAO,EACP,KAAK,EACL,QAAQ,EACR,MAAM,EACN,GAAG,EACH,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,MAAM,EACN,UAAU,EACV,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,YAAY,EACZ,OAAO,EACP,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,OAAO,EACP,YAAY,GACb,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/analyze/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CA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M,EACN,GAAG,EACH,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,MAAM,EACN,UAAU,EACV,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,EACL,KAAK,EACL,OAAO,EACP,YAAY,EACZ,OAAO,EACP,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,OAAO,EACP,YAAY,GACb,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC"}
@@ -27,22 +27,47 @@ import type { WordResolution } from './resolve-word.js';
27
27
  */
28
28
  export interface WrapperSpec {
29
29
  /**
30
- * The literal, exact argv0 text (after quote/escape removal) that
31
- * identifies this wrapper — e.g. `['env']`. Matched only against a
32
- * `static: true` word; see {@link WrapperSpec}'s doc comment.
30
+ * The command name that identifies this wrapper — e.g. `['env']`.
31
+ * Matched only against a `static: true` word; see {@link WrapperSpec}'s
32
+ * doc comment.
33
33
  *
34
- * Matching is **exact-name-only** — never basename matching. `sudo` does
35
- * not match `/usr/bin/sudo` or `./sudo`; only a word whose *entire*
36
- * resolved text equals one of `names` is recognized. This is a
37
- * deliberate, narrower-than-real-world policy choice (a real shell would
38
- * happily run `/usr/bin/sudo`), not an oversight: silently treating any
39
- * path *ending in* a known wrapper name as that wrapper would be a
40
- * different, broader matching policy this package isn't making on a
41
- * caller's behalf. A caller who wants path-aware matching can express it
42
- * explicitly via a custom {@link ResolveArgv0Options.transparentWrappers}
43
- * table (e.g. `names: ['sudo', '/usr/bin/sudo']`).
34
+ * Matching first searches the entire table for an exact name. Only when
35
+ * no exact entry exists does it try an absolute path's final segment:
36
+ *
37
+ * 1. Its entire resolved text (after quote/escape removal) equals one of
38
+ * `names`: `env`, or a path a caller listed verbatim. An exact path
39
+ * entry takes precedence over a plain-name entry even if listed later.
40
+ * 2. The spec does not declare {@link WrapperSpec.shellBuiltin | shellBuiltin: true},
41
+ * and the word is an **absolute path** (starts with `/`) whose final segment
42
+ * equals one of `names`: `/usr/bin/env`, `/usr/bin/sudo`, `/opt/x/nice`
43
+ * and `/usr//bin/env` resolve as `env`, `sudo` and `nice`. The chain
44
+ * keeps the word as written, so a consumer still sees the path.
45
+ *
46
+ * Relative paths and paths with a trailing slash do not use the
47
+ * final-segment fallback. They can still match an explicitly listed name,
48
+ * such as `./with-retry` or `/opt/with-retry/`. Custom plain names also
49
+ * acquire absolute-path aliases unless `shellBuiltin: true`; a path-only
50
+ * name does not acquire aliases for other paths with the same final segment.
51
+ *
52
+ * This is a lexical analysis assumption, not executable identity:
53
+ * `PATH` is not consulted and the filesystem is not read. Without an
54
+ * exact override, an unrelated executable named `/opt/mytools/env` uses
55
+ * the `env` entry's grammar. The chain preserves the original path so
56
+ * callers can apply their own policy. A word with an expansion
57
+ * (`"$dir/env"`) is not `static` and is never matched.
44
58
  */
45
59
  readonly names: readonly string[];
60
+ /**
61
+ * Whether this wrapper represents a shell builtin rather than an external
62
+ * utility. A path cannot reach a builtin: `/tmp/command` names an external
63
+ * executable, so its arguments must not be interpreted as builtin operands.
64
+ * When true, only exact entries in {@link WrapperSpec.names} match; the
65
+ * absolute-path final-segment fallback is disabled. Explicitly listed path
66
+ * entries still match exactly. False or omitted preserves utility matching.
67
+ * The defaults mark `command` and `exec`; custom tables may mark their own
68
+ * builtins, such as `builtin`.
69
+ */
70
+ readonly shellBuiltin?: boolean;
46
71
  /**
47
72
  * Legacy shorthand for {@link WrapperSpec.assignmentOperands}'s
48
73
  * `'shell-identifier'` grammar: skip statically resolved `NAME=value`
@@ -178,6 +203,145 @@ export interface WrapperSpec {
178
203
  * @public
179
204
  */
180
205
  export declare const DEFAULT_TRANSPARENT_WRAPPERS: readonly WrapperSpec[];
206
+ /**
207
+ * A data-only description of one shell interpreter whose `-c` option makes the
208
+ * next operand a command string run by that shell (`bash -c 'rm x'`). Like
209
+ * `env -S`, the command that runs lives *inside* an operand, so
210
+ * {@link resolveArgv0} reports `'embedded-command'` instead of the
211
+ * interpreter's own name as the effective command.
212
+ * The selector `c` is reserved: exact-token fields (`noOperandLongOptions`,
213
+ * `operandLongOptions`, `optionTerminatorWords`) cannot contain `-c`.
214
+ *
215
+ * Only the option grammar needed to decide *whether `-c` is an option* is
216
+ * described: which options consume an operand word (so that `-o c` or
217
+ * `-o pipefail -c` are not misread) and where option parsing ends. Everything
218
+ * else about the interpreter — what its other options mean, whether a given
219
+ * option name is valid — is irrelevant to that decision and unmodeled; an
220
+ * invalid invocation that a real shell would reject is still reported
221
+ * conservatively, since nothing is guessed about what it would run.
222
+ *
223
+ * Option parsing ends at the first statically known word that is not an
224
+ * option, at `--`, at a lone `-`, or at a table-defined terminator; afterwards
225
+ * a word shaped like `-c` is an ordinary script operand. A dynamic word in
226
+ * option position leaves the question undecidable, so scanning stops and the interpreter is reported
227
+ * exactly as before (its own static name). In that case `static: true` means
228
+ * only that the interpreter's name is known; it does not mean the command is a
229
+ * plain shell invocation, because `bash "$f" -c x` runs `x` when `$f` is `-x`.
230
+ *
231
+ * This shape may grow new optional fields in a **minor** release; existing
232
+ * fields' meaning never changes.
233
+ *
234
+ * @public
235
+ */
236
+ export interface EmbeddedCommandInterpreterSpec {
237
+ /**
238
+ * The interpreter's name, matched against a static command word's final
239
+ * path segment: `bash`, `/bin/bash` and `/usr/local/bin/bash` all match
240
+ * `['bash']`. Only the command word is reduced to its final segment;
241
+ * entries containing `/` (such as `['/bin/bash']`) are rejected with
242
+ * {@link ShAnalyzeInvalidWrapperSpecError}. Use `['bash']` to recognize
243
+ * path-qualified invocations. The first entry containing the segment wins.
244
+ *
245
+ * Unlike {@link WrapperSpec.names}, which tries exact names first and
246
+ * falls back to the final segment only for absolute paths, interpreter
247
+ * matching uses only the final segment, including for relative paths
248
+ * such as `./bash`. The question here is whether a command string is
249
+ * embedded, not which executable would be located.
250
+ */
251
+ readonly names: readonly string[];
252
+ /**
253
+ * Single option letters (without a sign) that take a name or value operand
254
+ * under both `-` and `+`, e.g. `['o']` for `-o pipefail` / `+o pipefail`.
255
+ * A letter listed here never selects the command string itself, so
256
+ * `bash -o c script` keeps `c` as an option *name*.
257
+ * The selector `c` is reserved and cannot be listed as an operand option;
258
+ * conflicting entries throw {@link ShAnalyzeInvalidWrapperSpecError}.
259
+ */
260
+ readonly operandOptions: readonly string[];
261
+ /**
262
+ * How an {@link EmbeddedCommandInterpreterSpec.operandOptions} letter
263
+ * receives its operand inside a clustered word:
264
+ *
265
+ * - `'separate-word'` — always the next word; remaining letters in the
266
+ * cluster are still options (`bash -oc errexit 'cmd'` is `-o errexit -c`).
267
+ * - `'rest-of-cluster'` — the remainder of the word if any, else the next
268
+ * word; later letters in the same word are part of the operand
269
+ * (`zsh -oc` names an option `c`).
270
+ */
271
+ readonly operandAttachment: 'separate-word' | 'rest-of-cluster';
272
+ /**
273
+ * Letters from {@link EmbeddedCommandInterpreterSpec.operandOptions} whose
274
+ * separate operand may be omitted before a word beginning with `-` or `+`.
275
+ * An attached operand still belongs to the option. For example, ksh93u+
276
+ * treats `-o -c cmd` and `+o -c cmd` as an operand-free option listing
277
+ * followed by `-c`; bash, dash and zsh consume `-c` as the option name.
278
+ * A dynamic potential operand makes this distinction undecidable.
279
+ */
280
+ readonly optionalOperandOptions?: readonly string[];
281
+ /**
282
+ * No-operand letters that end option scanning after the current cluster,
283
+ * under either sign. Remaining letters in that cluster still take effect:
284
+ * zsh's `-b -c script` runs the file `-c`, but `-bc cmd` selects a string.
285
+ * These letters must not include `c` or an operand-taking letter.
286
+ */
287
+ readonly optionTerminatorLetters?: readonly string[];
288
+ /**
289
+ * Additional whole words that end option scanning, like zsh's `+` and `+-`.
290
+ * The terminator is not a command string; an already-selected `-c` needs
291
+ * a following word. `--` and a lone `-` are always terminators.
292
+ */
293
+ readonly optionTerminatorWords?: readonly string[];
294
+ /**
295
+ * Exact long-option words that take a separate operand, recognized before
296
+ * short-option clusters regardless of prefix: bash's `--rcfile FILE` and
297
+ * `-rcfile FILE`, or zsh's `--emulate sh`. A dynamic operand stops scanning
298
+ * because its expansion may produce multiple actual arguments.
299
+ */
300
+ readonly operandLongOptions?: readonly string[];
301
+ /**
302
+ * Exact long-option words with no operand, recognized before short-option
303
+ * clusters. Bash's `-restricted` and `-noprofile` are whole long options,
304
+ * not clusters containing `c` or `o`. Unlisted `--name` / `+-name` words
305
+ * are also treated as operand-free; option validity is not checked.
306
+ */
307
+ readonly noOperandLongOptions?: readonly string[];
308
+ /**
309
+ * `true` if the interpreter also treats `+c` as selecting the command
310
+ * string. Other shells do not select command mode with `+c`.
311
+ */
312
+ readonly plusCSelectsCommand?: boolean;
313
+ }
314
+ /**
315
+ * `sh-ast/analyze`'s default {@link EmbeddedCommandInterpreterSpec} table:
316
+ * the shells whose `-c` option makes {@link resolveArgv0} report
317
+ * `'embedded-command'`. Each entry's option grammar is hand-derived from the
318
+ * cited manual. Basic clusters and required operands were cross-checked on
319
+ * Linux bash 5.2.21, dash 0.5.12, zsh 5.9, ksh93u+m 1.0.8 and mksh R59.
320
+ * Long-option, termination and omitted-operand cases were checked on macOS
321
+ * bash 5.3.9 and 3.2.57 (also `/bin/sh`), Apple dash-16, zsh 5.9 and ksh93u+
322
+ * AJM 2012-08-01. Omitted `-o`/`+o` operands before another signed option
323
+ * were confirmed only on that ksh93u+ build, not ksh93u+m or mksh. Builds can
324
+ * differ: macOS's ksh93u+ differs from the cited 93u+m for `ksh -o c "echo X"`.
325
+ * The `sh` entry also models bash's long options because `sh` can be bash.
326
+ * Named options that change the option grammar itself (such as zsh's
327
+ * `shoptionletters`) are not interpreted; a custom table is needed for that
328
+ * grammar. It is data, not policy:
329
+ * it names no dangerous commands and a caller can replace or extend it via
330
+ * {@link ResolveArgv0Options.embeddedCommandInterpreters}; an empty array
331
+ * restores the behavior in which an interpreter is an ordinary effective
332
+ * command.
333
+ *
334
+ * Frozen, including each entry and its arrays.
335
+ *
336
+ * @see https://www.gnu.org/software/bash/manual/bash.html#Invoking-Bash — bash
337
+ * @see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html — POSIX `sh`
338
+ * @see https://man7.org/linux/man-pages/man1/dash.1.html — dash(1)
339
+ * @see https://zsh.sourceforge.io/Doc/Release/Invocation-and-Startup.html — zsh
340
+ * @see https://github.com/ksh93/ksh — ksh93u+m `sh(1)`
341
+ * @see https://man.mirbsd.org/mksh.1 — mksh(1)
342
+ * @public
343
+ */
344
+ export declare const DEFAULT_EMBEDDED_COMMAND_INTERPRETERS: readonly EmbeddedCommandInterpreterSpec[];
181
345
  /**
182
346
  * Options accepted by {@link resolveArgv0}.
183
347
  *
@@ -199,6 +363,19 @@ export interface ResolveArgv0Options {
199
363
  * flag matching.
200
364
  */
201
365
  readonly transparentWrappers?: readonly WrapperSpec[];
366
+ /**
367
+ * The shell interpreters whose `-c` operand is reported as an
368
+ * `'embedded-command'`. Defaults to
369
+ * {@link DEFAULT_EMBEDDED_COMMAND_INTERPRETERS}. Pass a replacement array to
370
+ * add or drop interpreters; an empty array disables the behavior, so every
371
+ * interpreter resolves as an ordinary effective command.
372
+ *
373
+ * Validated at the {@link resolveArgv0} boundary like
374
+ * {@link ResolveArgv0Options.transparentWrappers}: the table must be an
375
+ * array. A non-array value (including `null`) or malformed entry throws
376
+ * {@link ShAnalyzeInvalidWrapperSpecError}; only `undefined` uses defaults.
377
+ */
378
+ readonly embeddedCommandInterpreters?: readonly EmbeddedCommandInterpreterSpec[];
202
379
  }
203
380
  /**
204
381
  * Why {@link resolveArgv0} couldn't identify a single, definite effective
@@ -215,7 +392,10 @@ export interface ResolveArgv0Options {
215
392
  * - `'embedded-command'` — a wrapper flag whose value structurally embeds
216
393
  * the real command rather than naming it as a separate word (e.g.
217
394
  * `env -S 'rm -rf /'` — see {@link WrapperSpec.unresolvableFlags}'s doc
218
- * comment).
395
+ * comment), or a shell interpreter's `-c` option (`bash -c 'rm x'`, see
396
+ * {@link EmbeddedCommandInterpreterSpec}). In both cases the chain's
397
+ * second-to-last element is the wrapper or interpreter word, so its name
398
+ * stays available.
219
399
  * - `'ambiguous-assignment'` — a statically known assignment operand whose
220
400
  * acceptance differs across supported utility implementations, such as
221
401
  * `env =value cmd` (GNU/glibc accepts an empty name; BSD rejects it).
@@ -332,7 +512,7 @@ export interface Argv0Resolution {
332
512
  * command) or add their own (e.g. a project's `with-retry` helper) and
333
513
  * both directions are followed identically to any built-in entry.
334
514
  *
335
- * **A statically-unknowable word is never guessed through** — three
515
+ * **A statically-unknowable word is never guessed through** — four
336
516
  * distinct cases all stop the chain immediately at that word rather than
337
517
  * falling back to any other guess:
338
518
  *
@@ -353,6 +533,30 @@ export interface Argv0Resolution {
353
533
  * reports `effective: { static: false, reason: 'embedded-command' }`
354
534
  * (see {@link WrapperSpec.unresolvableFlags}'s doc comment).
355
535
  *
536
+ * 4. The effective command is a shell interpreter
537
+ * ({@link DEFAULT_EMBEDDED_COMMAND_INTERPRETERS}) invoked with `-c` —
538
+ * `bash -c "$x"`, `sudo sh -ec ls` — and the command that runs is
539
+ * inside the string operand. The result is the same
540
+ * `'embedded-command'` shape `env -S` produces: the interpreter word is
541
+ * `chain.at(-2)` and `chainIndices.at(-1)` is the option word that
542
+ * selected `-c`. `bash script.sh`, `bash -e script.sh`, `bash -- -c`
543
+ * and `bash -o c` are not `-c` invocations and resolve to `bash` as
544
+ * before. A dynamic word in option position (`bash "$f" -c x`,
545
+ * `bash -c"$y" x`) is undecidable, so the interpreter stays a static
546
+ * `bash`: `static: true` then means only that the name is known, not that
547
+ * the command is a plain shell invocation. The `-c` string itself is never
548
+ * parsed.
549
+ *
550
+ * Known limits: the table models common option spellings, not a full
551
+ * emulation of each shell's option parser. Unusual spellings can be
552
+ * misclassified in either direction:
553
+ *
554
+ * - Bash/sh single-dash long options after a short option, e.g. `bash -e -rcfile M`.
555
+ * - `ksh -c +c M`, or a dynamic word after `-c` that expands to an option.
556
+ * - mksh's selector-bearing operands in `mksh -o -c M` and `mksh -o +c M`.
557
+ * - A lone `+` before `-c`, e.g. `bash + -c M`.
558
+ * - Zsh grammar switches, e.g. `zsh -o shoptionletters -b -c M`.
559
+ *
356
560
  * `VAR=val` shell-assignment prefixes on the `CallExpr` itself
357
561
  * (`CommandSite.node.Assigns`, e.g. `FOO=bar rm x`) are always skipped and
358
562
  * counted in {@link Argv0Resolution.assignmentsSkipped} — a mechanism
@@ -367,7 +571,8 @@ export interface Argv0Resolution {
367
571
  * least one argv word; see its doc comment), not a "malformed shell
368
572
  * source" case.
369
573
  * @throws {@link ShAnalyzeInvalidWrapperSpecError} if
370
- * `options.transparentWrappers` contains a malformed entry (see
574
+ * `options.transparentWrappers` or `options.embeddedCommandInterpreters`
575
+ * contains a malformed entry (see
371
576
  * {@link ResolveArgv0Options.transparentWrappers}'s doc comment).
372
577
  * @public
373
578
  */
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-argv0.d.ts","sourceRoot":"","sources":["../../src/analyze/resolve-argv0.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;;;;;;OAeG;IACH,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