sh-ast 0.7.0 → 0.8.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,19 @@ 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; path-only names do not alias other paths.
226
+
227
+ Matching is a lexical analysis assumption: `PATH` and the filesystem are not
228
+ consulted. Without an exact override, `/opt/mytools/env rm x` follows the `env`
229
+ grammar and resolves to `rm`, even if that file is not the system utility. A
230
+ dynamic word such as `"$dir/env"` is never matched.
231
+
205
232
  `resolveArgv0` follows only documented wrapper grammars. The default `env` and
206
233
  `sudo` entries accept assignment names beyond shell identifiers, such as `A-B`
207
234
  or `名`. `env` recognizes assignments after `--` and ends option scanning at its
@@ -215,6 +242,64 @@ Existing `skipAssignmentOperands: true` tables retain their ASCII shell-identifi
215
242
  rule before `--`. Wrapper assignment operands do not change `assignmentsSkipped`,
216
243
  which counts only shell-level prefixes.
217
244
 
245
+ When the effective command is a shell interpreter (`bash`, `sh`, `dash`, `zsh`,
246
+ `ksh`, `ksh93`, `mksh`, matched by the final path segment, so `/bin/bash` too)
247
+ invoked with `-c`, `resolveArgv0` reports `effective: { static: false, reason:
248
+ 'embedded-command' }`, the same result as `env -S`: the command that runs is
249
+ inside the string operand, which is never parsed. The interpreter's word stays
250
+ available as `chain.at(-2)` and `chainIndices.at(-1)` is the option word that
251
+ selected `-c`. Clustered flags (`-ec`, `-lc`), preceding options (`-o pipefail`,
252
+ `+o`, `-e`) and `--` follow each shell's own option grammar, so `bash script.sh`,
253
+ `bash -e script.sh`, `bash -- -c` and `bash -o c` still resolve to `bash`. A
254
+ dynamic word in option position (`bash "$opts" -c ls`, `bash -c"$y" x`) is
255
+ undecidable and also resolves to `bash`; there `static: true` means only that the
256
+ interpreter's name is known, not that the command is a plain shell invocation. `DEFAULT_EMBEDDED_COMMAND_INTERPRETERS` is the overridable
257
+ table; `ResolveArgv0Options.embeddedCommandInterpreters: []` restores the previous
258
+ behavior.
259
+
260
+ The table models zsh's `--emulate MODE` / `+-emulate MODE` operands and option
261
+ terminators, including `-b` / `+b` after their current cluster (`zsh -b -c x`
262
+ keeps `zsh`, while `zsh -bc x` is embedded). The ksh entry permits an omitted
263
+ `-o` / `+o` operand before another signed option (`ksh +o -c x` is embedded);
264
+ this was executed on ksh93u+ AJM 2012-08-01, not ksh93u+m or mksh. Bash, dash
265
+ and zsh keep consuming the next word as that operand. Options that themselves
266
+ change the grammar, such as zsh's `shoptionletters`, require a custom table.
267
+
268
+ Custom interpreter names must be basenames: use `names: ['bash']` for both
269
+ `/bin/bash` and `./bash`. Names containing `/`, null/undefined entries and
270
+ malformed grammar fields throw `ShAnalyzeInvalidWrapperSpecError`. The first
271
+ matching basename entry wins. Wrapper names retain their distinct policy:
272
+ exact matches first, then a basename fallback for absolute paths only.
273
+
274
+ Bash's single-dash long-option aliases are recognized before clusters:
275
+ `bash -rcfile /dev/null s` and `bash -restricted s` stay static, while
276
+ `bash -rcfile /dev/null -c x` records selector index 3. Custom grammars can
277
+ list exact operand-free long options in `noOperandLongOptions`. Separate
278
+ option operands must be static: an expansion such as `"$@"` may produce
279
+ multiple actual arguments, so `bash -o "$@" -c x` and
280
+ `bash --rcfile "$@" -c x` stop at the static interpreter. Sparse custom
281
+ tables and sparse grammar-field arrays are rejected just like entries
282
+ explicitly holding `undefined`.
283
+
284
+ The command selector `c` is reserved and cannot be declared an operand-taking
285
+ option in a custom interpreter entry; exact-token fields cannot contain `-c`.
286
+ `embeddedCommandInterpreters` must be an array: `null` and other non-array
287
+ containers throw `ShAnalyzeInvalidWrapperSpecError`; `undefined` uses defaults.
288
+ Ksh/ksh93 `+c`, `+ec` and `+o +c` run scripts instead of selecting a string.
289
+ Apple ksh's `-R` consumes a database-path operand. Ksh's lone `+` ends option processing;
290
+ `ksh -c +` has no command string, while `ksh -c + x` is embedded (executed on
291
+ ksh93u+ AJM 2012-08-01).
292
+
293
+ Known limits: the table models common option spellings and is not a full
294
+ emulation of each shell's option parser. Unusual spellings can be misclassified
295
+ in either direction:
296
+
297
+ - Bash/sh single-dash long options after a short option, e.g. `bash -e -rcfile M`.
298
+ - `ksh -c +c M`, or a dynamic word after `-c` that expands to an option.
299
+ - mksh's selector-bearing operands in `mksh -o -c M` and `mksh -o +c M`.
300
+ - A lone `+` before `-c`, e.g. `bash + -c M`.
301
+ - Zsh grammar switches, e.g. `zsh -o shoptionletters -b -c M`.
302
+
218
303
  ## Migration from 0.3
219
304
 
220
305
  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,4BAA4B,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChF,YAAY,EACV,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAU5B,OAAO,EAAE,gCAAgC,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAIpG,mBAAmB,iCAAiC,CAAC;AACrD,YAAY,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,cAAc,EACd,cAAc,GACf,MAAM,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,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,6EA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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,20 +27,33 @@ 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. It is an **absolute path** (starts with `/`) whose final segment
41
+ * equals one of `names`: `/usr/bin/env`, `/usr/bin/sudo`, `/opt/x/nice`
42
+ * and `/usr//bin/env` resolve as `env`, `sudo` and `nice`. The chain
43
+ * keeps the word as written, so a consumer still sees the path.
44
+ *
45
+ * Relative paths and paths with a trailing slash do not use the
46
+ * final-segment fallback. They can still match an explicitly listed name,
47
+ * such as `./with-retry` or `/opt/with-retry/`. Custom plain names also
48
+ * acquire absolute-path aliases; a path-only name does not acquire aliases
49
+ * for other paths with the same final segment.
50
+ *
51
+ * This is a lexical analysis assumption, not executable identity:
52
+ * `PATH` is not consulted and the filesystem is not read. Without an
53
+ * exact override, an unrelated executable named `/opt/mytools/env` uses
54
+ * the `env` entry's grammar. The chain preserves the original path so
55
+ * callers can apply their own policy. A word with an expansion
56
+ * (`"$dir/env"`) is not `static` and is never matched.
44
57
  */
45
58
  readonly names: readonly string[];
46
59
  /**
@@ -178,6 +191,145 @@ export interface WrapperSpec {
178
191
  * @public
179
192
  */
180
193
  export declare const DEFAULT_TRANSPARENT_WRAPPERS: readonly WrapperSpec[];
194
+ /**
195
+ * A data-only description of one shell interpreter whose `-c` option makes the
196
+ * next operand a command string run by that shell (`bash -c 'rm x'`). Like
197
+ * `env -S`, the command that runs lives *inside* an operand, so
198
+ * {@link resolveArgv0} reports `'embedded-command'` instead of the
199
+ * interpreter's own name as the effective command.
200
+ * The selector `c` is reserved: exact-token fields (`noOperandLongOptions`,
201
+ * `operandLongOptions`, `optionTerminatorWords`) cannot contain `-c`.
202
+ *
203
+ * Only the option grammar needed to decide *whether `-c` is an option* is
204
+ * described: which options consume an operand word (so that `-o c` or
205
+ * `-o pipefail -c` are not misread) and where option parsing ends. Everything
206
+ * else about the interpreter — what its other options mean, whether a given
207
+ * option name is valid — is irrelevant to that decision and unmodeled; an
208
+ * invalid invocation that a real shell would reject is still reported
209
+ * conservatively, since nothing is guessed about what it would run.
210
+ *
211
+ * Option parsing ends at the first statically known word that is not an
212
+ * option, at `--`, at a lone `-`, or at a table-defined terminator; afterwards
213
+ * a word shaped like `-c` is an ordinary script operand. A dynamic word in
214
+ * option position leaves the question undecidable, so scanning stops and the interpreter is reported
215
+ * exactly as before (its own static name). In that case `static: true` means
216
+ * only that the interpreter's name is known; it does not mean the command is a
217
+ * plain shell invocation, because `bash "$f" -c x` runs `x` when `$f` is `-x`.
218
+ *
219
+ * This shape may grow new optional fields in a **minor** release; existing
220
+ * fields' meaning never changes.
221
+ *
222
+ * @public
223
+ */
224
+ export interface EmbeddedCommandInterpreterSpec {
225
+ /**
226
+ * The interpreter's name, matched against a static command word's final
227
+ * path segment: `bash`, `/bin/bash` and `/usr/local/bin/bash` all match
228
+ * `['bash']`. Only the command word is reduced to its final segment;
229
+ * entries containing `/` (such as `['/bin/bash']`) are rejected with
230
+ * {@link ShAnalyzeInvalidWrapperSpecError}. Use `['bash']` to recognize
231
+ * path-qualified invocations. The first entry containing the segment wins.
232
+ *
233
+ * Unlike {@link WrapperSpec.names}, which tries exact names first and
234
+ * falls back to the final segment only for absolute paths, interpreter
235
+ * matching uses only the final segment, including for relative paths
236
+ * such as `./bash`. The question here is whether a command string is
237
+ * embedded, not which executable would be located.
238
+ */
239
+ readonly names: readonly string[];
240
+ /**
241
+ * Single option letters (without a sign) that take a name or value operand
242
+ * under both `-` and `+`, e.g. `['o']` for `-o pipefail` / `+o pipefail`.
243
+ * A letter listed here never selects the command string itself, so
244
+ * `bash -o c script` keeps `c` as an option *name*.
245
+ * The selector `c` is reserved and cannot be listed as an operand option;
246
+ * conflicting entries throw {@link ShAnalyzeInvalidWrapperSpecError}.
247
+ */
248
+ readonly operandOptions: readonly string[];
249
+ /**
250
+ * How an {@link EmbeddedCommandInterpreterSpec.operandOptions} letter
251
+ * receives its operand inside a clustered word:
252
+ *
253
+ * - `'separate-word'` — always the next word; remaining letters in the
254
+ * cluster are still options (`bash -oc errexit 'cmd'` is `-o errexit -c`).
255
+ * - `'rest-of-cluster'` — the remainder of the word if any, else the next
256
+ * word; later letters in the same word are part of the operand
257
+ * (`zsh -oc` names an option `c`).
258
+ */
259
+ readonly operandAttachment: 'separate-word' | 'rest-of-cluster';
260
+ /**
261
+ * Letters from {@link EmbeddedCommandInterpreterSpec.operandOptions} whose
262
+ * separate operand may be omitted before a word beginning with `-` or `+`.
263
+ * An attached operand still belongs to the option. For example, ksh93u+
264
+ * treats `-o -c cmd` and `+o -c cmd` as an operand-free option listing
265
+ * followed by `-c`; bash, dash and zsh consume `-c` as the option name.
266
+ * A dynamic potential operand makes this distinction undecidable.
267
+ */
268
+ readonly optionalOperandOptions?: readonly string[];
269
+ /**
270
+ * No-operand letters that end option scanning after the current cluster,
271
+ * under either sign. Remaining letters in that cluster still take effect:
272
+ * zsh's `-b -c script` runs the file `-c`, but `-bc cmd` selects a string.
273
+ * These letters must not include `c` or an operand-taking letter.
274
+ */
275
+ readonly optionTerminatorLetters?: readonly string[];
276
+ /**
277
+ * Additional whole words that end option scanning, like zsh's `+` and `+-`.
278
+ * The terminator is not a command string; an already-selected `-c` needs
279
+ * a following word. `--` and a lone `-` are always terminators.
280
+ */
281
+ readonly optionTerminatorWords?: readonly string[];
282
+ /**
283
+ * Exact long-option words that take a separate operand, recognized before
284
+ * short-option clusters regardless of prefix: bash's `--rcfile FILE` and
285
+ * `-rcfile FILE`, or zsh's `--emulate sh`. A dynamic operand stops scanning
286
+ * because its expansion may produce multiple actual arguments.
287
+ */
288
+ readonly operandLongOptions?: readonly string[];
289
+ /**
290
+ * Exact long-option words with no operand, recognized before short-option
291
+ * clusters. Bash's `-restricted` and `-noprofile` are whole long options,
292
+ * not clusters containing `c` or `o`. Unlisted `--name` / `+-name` words
293
+ * are also treated as operand-free; option validity is not checked.
294
+ */
295
+ readonly noOperandLongOptions?: readonly string[];
296
+ /**
297
+ * `true` if the interpreter also treats `+c` as selecting the command
298
+ * string. Other shells do not select command mode with `+c`.
299
+ */
300
+ readonly plusCSelectsCommand?: boolean;
301
+ }
302
+ /**
303
+ * `sh-ast/analyze`'s default {@link EmbeddedCommandInterpreterSpec} table:
304
+ * the shells whose `-c` option makes {@link resolveArgv0} report
305
+ * `'embedded-command'`. Each entry's option grammar is hand-derived from the
306
+ * cited manual. Basic clusters and required operands were cross-checked on
307
+ * Linux bash 5.2.21, dash 0.5.12, zsh 5.9, ksh93u+m 1.0.8 and mksh R59.
308
+ * Long-option, termination and omitted-operand cases were checked on macOS
309
+ * bash 5.3.9 and 3.2.57 (also `/bin/sh`), Apple dash-16, zsh 5.9 and ksh93u+
310
+ * AJM 2012-08-01. Omitted `-o`/`+o` operands before another signed option
311
+ * were confirmed only on that ksh93u+ build, not ksh93u+m or mksh. Builds can
312
+ * differ: macOS's ksh93u+ differs from the cited 93u+m for `ksh -o c "echo X"`.
313
+ * The `sh` entry also models bash's long options because `sh` can be bash.
314
+ * Named options that change the option grammar itself (such as zsh's
315
+ * `shoptionletters`) are not interpreted; a custom table is needed for that
316
+ * grammar. It is data, not policy:
317
+ * it names no dangerous commands and a caller can replace or extend it via
318
+ * {@link ResolveArgv0Options.embeddedCommandInterpreters}; an empty array
319
+ * restores the behavior in which an interpreter is an ordinary effective
320
+ * command.
321
+ *
322
+ * Frozen, including each entry and its arrays.
323
+ *
324
+ * @see https://www.gnu.org/software/bash/manual/bash.html#Invoking-Bash — bash
325
+ * @see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html — POSIX `sh`
326
+ * @see https://man7.org/linux/man-pages/man1/dash.1.html — dash(1)
327
+ * @see https://zsh.sourceforge.io/Doc/Release/Invocation-and-Startup.html — zsh
328
+ * @see https://github.com/ksh93/ksh — ksh93u+m `sh(1)`
329
+ * @see https://man.mirbsd.org/mksh.1 — mksh(1)
330
+ * @public
331
+ */
332
+ export declare const DEFAULT_EMBEDDED_COMMAND_INTERPRETERS: readonly EmbeddedCommandInterpreterSpec[];
181
333
  /**
182
334
  * Options accepted by {@link resolveArgv0}.
183
335
  *
@@ -199,6 +351,19 @@ export interface ResolveArgv0Options {
199
351
  * flag matching.
200
352
  */
201
353
  readonly transparentWrappers?: readonly WrapperSpec[];
354
+ /**
355
+ * The shell interpreters whose `-c` operand is reported as an
356
+ * `'embedded-command'`. Defaults to
357
+ * {@link DEFAULT_EMBEDDED_COMMAND_INTERPRETERS}. Pass a replacement array to
358
+ * add or drop interpreters; an empty array disables the behavior, so every
359
+ * interpreter resolves as an ordinary effective command.
360
+ *
361
+ * Validated at the {@link resolveArgv0} boundary like
362
+ * {@link ResolveArgv0Options.transparentWrappers}: the table must be an
363
+ * array. A non-array value (including `null`) or malformed entry throws
364
+ * {@link ShAnalyzeInvalidWrapperSpecError}; only `undefined` uses defaults.
365
+ */
366
+ readonly embeddedCommandInterpreters?: readonly EmbeddedCommandInterpreterSpec[];
202
367
  }
203
368
  /**
204
369
  * Why {@link resolveArgv0} couldn't identify a single, definite effective
@@ -215,7 +380,10 @@ export interface ResolveArgv0Options {
215
380
  * - `'embedded-command'` — a wrapper flag whose value structurally embeds
216
381
  * the real command rather than naming it as a separate word (e.g.
217
382
  * `env -S 'rm -rf /'` — see {@link WrapperSpec.unresolvableFlags}'s doc
218
- * comment).
383
+ * comment), or a shell interpreter's `-c` option (`bash -c 'rm x'`, see
384
+ * {@link EmbeddedCommandInterpreterSpec}). In both cases the chain's
385
+ * second-to-last element is the wrapper or interpreter word, so its name
386
+ * stays available.
219
387
  * - `'ambiguous-assignment'` — a statically known assignment operand whose
220
388
  * acceptance differs across supported utility implementations, such as
221
389
  * `env =value cmd` (GNU/glibc accepts an empty name; BSD rejects it).
@@ -332,7 +500,7 @@ export interface Argv0Resolution {
332
500
  * command) or add their own (e.g. a project's `with-retry` helper) and
333
501
  * both directions are followed identically to any built-in entry.
334
502
  *
335
- * **A statically-unknowable word is never guessed through** — three
503
+ * **A statically-unknowable word is never guessed through** — four
336
504
  * distinct cases all stop the chain immediately at that word rather than
337
505
  * falling back to any other guess:
338
506
  *
@@ -353,6 +521,30 @@ export interface Argv0Resolution {
353
521
  * reports `effective: { static: false, reason: 'embedded-command' }`
354
522
  * (see {@link WrapperSpec.unresolvableFlags}'s doc comment).
355
523
  *
524
+ * 4. The effective command is a shell interpreter
525
+ * ({@link DEFAULT_EMBEDDED_COMMAND_INTERPRETERS}) invoked with `-c` —
526
+ * `bash -c "$x"`, `sudo sh -ec ls` — and the command that runs is
527
+ * inside the string operand. The result is the same
528
+ * `'embedded-command'` shape `env -S` produces: the interpreter word is
529
+ * `chain.at(-2)` and `chainIndices.at(-1)` is the option word that
530
+ * selected `-c`. `bash script.sh`, `bash -e script.sh`, `bash -- -c`
531
+ * and `bash -o c` are not `-c` invocations and resolve to `bash` as
532
+ * before. A dynamic word in option position (`bash "$f" -c x`,
533
+ * `bash -c"$y" x`) is undecidable, so the interpreter stays a static
534
+ * `bash`: `static: true` then means only that the name is known, not that
535
+ * the command is a plain shell invocation. The `-c` string itself is never
536
+ * parsed.
537
+ *
538
+ * Known limits: the table models common option spellings, not a full
539
+ * emulation of each shell's option parser. Unusual spellings can be
540
+ * misclassified in either direction:
541
+ *
542
+ * - Bash/sh single-dash long options after a short option, e.g. `bash -e -rcfile M`.
543
+ * - `ksh -c +c M`, or a dynamic word after `-c` that expands to an option.
544
+ * - mksh's selector-bearing operands in `mksh -o -c M` and `mksh -o +c M`.
545
+ * - A lone `+` before `-c`, e.g. `bash + -c M`.
546
+ * - Zsh grammar switches, e.g. `zsh -o shoptionletters -b -c M`.
547
+ *
356
548
  * `VAR=val` shell-assignment prefixes on the `CallExpr` itself
357
549
  * (`CommandSite.node.Assigns`, e.g. `FOO=bar rm x`) are always skipped and
358
550
  * counted in {@link Argv0Resolution.assignmentsSkipped} — a mechanism
@@ -367,7 +559,8 @@ export interface Argv0Resolution {
367
559
  * least one argv word; see its doc comment), not a "malformed shell
368
560
  * source" case.
369
561
  * @throws {@link ShAnalyzeInvalidWrapperSpecError} if
370
- * `options.transparentWrappers` contains a malformed entry (see
562
+ * `options.transparentWrappers` or `options.embeddedCommandInterpreters`
563
+ * contains a malformed entry (see
371
564
  * {@link ResolveArgv0Options.transparentWrappers}'s doc comment).
372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