shfs 0.1.1 → 0.1.3
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/dist/{fs-DSmBon4m.d.mts → fs-rz7EnuDE.d.mts} +2 -1
- package/dist/fs.d.mts +2 -1
- package/dist/fs.mjs +50 -18
- package/dist/fs.mjs.map +1 -1
- package/dist/index.d.mts +17 -16
- package/dist/index.mjs +1057 -321
- package/dist/index.mjs.map +1 -1
- package/dist/path-BR0nl4aX.mjs +12 -0
- package/dist/path-BR0nl4aX.mjs.map +1 -0
- package/dist/util/path.d.mts +5 -0
- package/dist/util/path.mjs +3 -0
- package/package.json +12 -6
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["map","files","SourcePosition","Token","StringSourceReader","ParseSyntaxError","Parser","files"],"sources":["../../compiler/dist/index.mjs","../src/consumer/consumer.ts","../src/operator/cat/cat.ts","../src/operator/cp/cp.ts","../src/operator/head/head.ts","../src/operator/ls/ls.ts","../src/operator/mkdir/mkdir.ts","../src/operator/mv/mv.ts","../src/operator/rm/rm.ts","../src/operator/tail/tail.ts","../src/operator/touch/touch.ts","../src/execute/producers.ts","../src/execute/execute.ts","../src/util/lazy.ts","../src/shell/shell.ts"],"sourcesContent":["//#region src/ir.ts\n/**\n* Create a literal ExpandedWord.\n*/\nfunction literal(value) {\n\treturn {\n\t\tkind: \"literal\",\n\t\tvalue\n\t};\n}\n/**\n* Create a SimpleCommandIR for testing purposes.\n* Convenience helper that creates a command with a name and arguments.\n*/\nfunction cmd(name, args, redirections = []) {\n\treturn {\n\t\tname: literal(name),\n\t\targs,\n\t\tredirections\n\t};\n}\n/**\n* Create a glob ExpandedWord.\n*/\nfunction glob(pattern, expanded = []) {\n\treturn {\n\t\tkind: \"glob\",\n\t\tpattern,\n\t\texpanded\n\t};\n}\n/**\n* Create a command substitution ExpandedWord.\n*/\nfunction commandSub(command, output = []) {\n\treturn {\n\t\tkind: \"commandSub\",\n\t\tcommand,\n\t\toutput\n\t};\n}\n/**\n* Extract the string value from an ExpandedWord.\n* For globs, returns the pattern. For command subs, returns the command.\n*/\nfunction expandedWordToString(word) {\n\tswitch (word.kind) {\n\t\tcase \"literal\": return word.value;\n\t\tcase \"glob\": return word.pattern;\n\t\tcase \"commandSub\": return word.command;\n\t\tdefault: {\n\t\t\tconst _exhaustive = word;\n\t\t\tthrow new Error(`Unknown word kind: ${JSON.stringify(_exhaustive)}`);\n\t\t}\n\t}\n}\n/**\n* Extract paths from an array of ExpandedWords.\n* For globs and command subs, expands to their resolved values.\n*/\nfunction extractPathsFromExpandedWords(words) {\n\treturn words.flatMap((word) => {\n\t\tswitch (word.kind) {\n\t\t\tcase \"literal\": return [word.value];\n\t\t\tcase \"glob\": return word.expanded.length > 0 ? word.expanded : [word.pattern];\n\t\t\tcase \"commandSub\": return word.output;\n\t\t\tdefault: {\n\t\t\t\tconst _exhaustive = word;\n\t\t\t\tthrow new Error(`Unknown word kind: ${JSON.stringify(_exhaustive)}`);\n\t\t\t}\n\t\t}\n\t});\n}\n\n//#endregion\n//#region src/compile/command/arg/utils.ts\nconst NEGATIVE_NUMBER_REGEX$2 = /^(?:-\\d+(?:\\.\\d+)?|-\\.\\d+)$/;\nfunction isNegativeNumberToken(token) {\n\treturn NEGATIVE_NUMBER_REGEX$2.test(token);\n}\nfunction startsWithLongPrefix(token) {\n\treturn token.length >= 2 && token[0] === \"-\" && token[1] === \"-\";\n}\nfunction startsWithShortPrefix(token) {\n\treturn token.length >= 1 && token[0] === \"-\" && !startsWithLongPrefix(token);\n}\nfunction startsWithNoLongPrefix(token) {\n\treturn token.startsWith(\"--no-\") && token.length > 5;\n}\nfunction splitNameBeforeEquals(token) {\n\tconst eq = token.indexOf(\"=\");\n\treturn eq === -1 ? token : token.slice(0, eq);\n}\n\n//#endregion\n//#region src/compile/command/arg/parse.ts\nconst SHORT_NAME_REGEX = /^[A-Za-z]$/;\nconst LONG_NAME_REGEX = /^[A-Za-z0-9][A-Za-z0-9-]*$/;\nfunction parseArgs(args, flagDefs) {\n\tconst index = buildFlagIndex(flagDefs);\n\tconst flags$1 = Object.create(null);\n\tconst positional = [];\n\tlet endOfFlags = false;\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst token = args[i];\n\t\tif (token === void 0) continue;\n\t\tif (endOfFlags) {\n\t\t\tpositional.push(token);\n\t\t\tcontinue;\n\t\t}\n\t\tif (token === \"--\") {\n\t\t\tendOfFlags = true;\n\t\t\tcontinue;\n\t\t}\n\t\tif (token === \"-\") {\n\t\t\tpositional.push(token);\n\t\t\tcontinue;\n\t\t}\n\t\tif (isNegativeNumberToken(token)) {\n\t\t\tpositional.push(token);\n\t\t\tcontinue;\n\t\t}\n\t\tif (startsWithLongPrefix(token)) {\n\t\t\ti = parseLongToken(args, i, token, index, flags$1);\n\t\t\tcontinue;\n\t\t}\n\t\tif (startsWithShortPrefix(token)) {\n\t\t\ti = parseShortToken(args, i, token, index, flags$1);\n\t\t\tcontinue;\n\t\t}\n\t\tpositional.push(token);\n\t}\n\treturn {\n\t\tflags: flags$1,\n\t\tpositional\n\t};\n}\nfunction buildFlagIndex(flagDefs) {\n\tconst short = /* @__PURE__ */ new Map();\n\tconst long = /* @__PURE__ */ new Map();\n\tconst add = (map, token, entry) => {\n\t\tconst prev = map.get(token);\n\t\tif (!prev) {\n\t\t\tmap.set(token, entry);\n\t\t\treturn;\n\t\t}\n\t\tthrow new Error(`Duplicate flag token \"${token}\" for \"${entry.canonical}\" and \"${prev.canonical}\"`);\n\t};\n\tfor (const [canonical, def] of Object.entries(flagDefs)) {\n\t\tif (!SHORT_NAME_REGEX.test(def.short)) throw new Error(`Invalid short flag for \"${canonical}\": \"${def.short}\". Expected a single letter [A-Za-z].`);\n\t\tadd(short, `-${def.short}`, {\n\t\t\tcanonical,\n\t\t\tdef\n\t\t});\n\t\tif (def.long) {\n\t\t\tif (!LONG_NAME_REGEX.test(def.long)) throw new Error(`Invalid long flag for \"${canonical}\": \"${def.long}\". Expected [A-Za-z0-9][A-Za-z0-9-]*.`);\n\t\t\tadd(long, `--${def.long}`, {\n\t\t\t\tcanonical,\n\t\t\t\tdef\n\t\t\t});\n\t\t}\n\t}\n\tconst isFlagToken = (token) => {\n\t\tif (token === \"--\") return true;\n\t\tif (token === \"-\") return false;\n\t\tif (startsWithLongPrefix(token)) {\n\t\t\tconst name = splitNameBeforeEquals(token);\n\t\t\tif (long.has(name)) return true;\n\t\t\tif (startsWithNoLongPrefix(name)) {\n\t\t\t\tconst base = `--${name.slice(5)}`;\n\t\t\t\tconst entry = long.get(base);\n\t\t\t\treturn !!entry && !entry.def.takesValue;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tif (startsWithShortPrefix(token)) {\n\t\t\tconst ch = token[1] ?? \"\";\n\t\t\tif (!SHORT_NAME_REGEX.test(ch)) return false;\n\t\t\treturn short.has(`-${ch}`);\n\t\t}\n\t\treturn false;\n\t};\n\treturn {\n\t\tshort,\n\t\tlong,\n\t\tisFlagToken\n\t};\n}\nfunction parseLongToken(args, index, token, flagsIndex, out) {\n\tif (startsWithNoLongPrefix(token) && !token.includes(\"=\")) {\n\t\tconst base = `--${token.slice(5)}`;\n\t\tconst entry$1 = flagsIndex.long.get(base);\n\t\tif (!entry$1) throw new Error(`Unknown flag: ${token}`);\n\t\tif (entry$1.def.takesValue) throw new Error(`Flag ${base} takes a value; \"${token}\" is invalid.`);\n\t\tsetBoolean(out, entry$1.canonical, false);\n\t\treturn index;\n\t}\n\tif (token.includes(\"=\")) {\n\t\tconst eq = token.indexOf(\"=\");\n\t\tconst name = token.slice(0, eq);\n\t\tconst value$1 = token.slice(eq + 1);\n\t\tconst entry$1 = flagsIndex.long.get(name);\n\t\tif (!entry$1) throw new Error(`Unknown flag: ${name}`);\n\t\tif (!entry$1.def.takesValue) throw new Error(`Flag ${name} does not take a value.`);\n\t\tsetValue(out, entry$1, value$1);\n\t\treturn index;\n\t}\n\tconst entry = flagsIndex.long.get(token);\n\tif (!entry) throw new Error(`Unknown flag: ${token}`);\n\tif (!entry.def.takesValue) {\n\t\tsetBoolean(out, entry.canonical, true);\n\t\treturn index;\n\t}\n\tconst { value, newIndex } = consumeValue(args, index, token, flagsIndex);\n\tsetValue(out, entry, value);\n\treturn newIndex;\n}\nfunction parseShortToken(args, index, token, flagsIndex, out) {\n\tif (token.length >= 3 && token[2] === \"=\") {\n\t\tconst name = token.slice(0, 2);\n\t\tconst value = token.slice(3);\n\t\tconst entry = flagsIndex.short.get(name);\n\t\tif (!entry) throw new Error(`Unknown flag: ${name}`);\n\t\tif (!entry.def.takesValue) throw new Error(`Flag ${name} does not take a value.`);\n\t\tsetValue(out, entry, value);\n\t\treturn index;\n\t}\n\tif (token.length === 2) {\n\t\tconst entry = flagsIndex.short.get(token);\n\t\tif (!entry) throw new Error(`Unknown flag: ${token}`);\n\t\tif (!entry.def.takesValue) {\n\t\t\tsetBoolean(out, entry.canonical, true);\n\t\t\treturn index;\n\t\t}\n\t\tconst { value, newIndex } = consumeValue(args, index, token, flagsIndex);\n\t\tsetValue(out, entry, value);\n\t\treturn newIndex;\n\t}\n\tfor (let j = 1; j < token.length; j++) {\n\t\tconst ch = token[j] ?? \"\";\n\t\tif (!SHORT_NAME_REGEX.test(ch)) throw new Error(`Invalid short flag character \"${ch}\" in \"${token}\". Short flags must be letters.`);\n\t\tconst name = `-${ch}`;\n\t\tconst entry = flagsIndex.short.get(name);\n\t\tif (!entry) throw new Error(`Unknown flag: ${name}`);\n\t\tif (!entry.def.takesValue) {\n\t\t\tsetBoolean(out, entry.canonical, true);\n\t\t\tcontinue;\n\t\t}\n\t\tconst rest = token.slice(j + 1);\n\t\tif (rest.startsWith(\"=\")) {\n\t\t\tsetValue(out, entry, rest.slice(1));\n\t\t\treturn index;\n\t\t}\n\t\tif (rest.length === 0) {\n\t\t\tconst { value, newIndex } = consumeValue(args, index, name, flagsIndex);\n\t\t\tsetValue(out, entry, value);\n\t\t\treturn newIndex;\n\t\t}\n\t\tconst first = rest[0] ?? \"\";\n\t\tif (SHORT_NAME_REGEX.test(first) && flagsIndex.short.has(`-${first}`)) throw new Error(`Ambiguous short flag cluster \"${token}\": ${name} takes a value, but \"${rest}\" begins with \"-${first}\" which is also a flag. Use \"${name}=${rest}\" or pass the value as a separate argument.`);\n\t\tsetValue(out, entry, rest);\n\t\treturn index;\n\t}\n\treturn index;\n}\nfunction consumeValue(args, index, flagToken, flagsIndex) {\n\tconst nextIndex = index + 1;\n\tif (nextIndex >= args.length) throw new Error(`Flag ${flagToken} requires a value.`);\n\tconst next = args[nextIndex];\n\tif (next === void 0) throw new Error(`Flag ${flagToken} requires a value.`);\n\tif (next === \"--\") throw new Error(`Flag ${flagToken} requires a value (got \"--\").`);\n\tif (flagsIndex.isFlagToken(next)) throw new Error(`Flag ${flagToken} requires a value (got \"${next}\").`);\n\treturn {\n\t\tvalue: next,\n\t\tnewIndex: nextIndex\n\t};\n}\nfunction setBoolean(out, canonical, value) {\n\tout[canonical] = value;\n}\nfunction setValue(out, entry, value) {\n\tconst { canonical, def } = entry;\n\tconst existing = out[canonical];\n\tif (existing === void 0) {\n\t\tout[canonical] = value;\n\t\treturn;\n\t}\n\tif (!def.multiple) throw new Error(`Duplicate flag \"${canonical}\". If it is intended to repeat, set { multiple: true } in its definition.`);\n\tif (Array.isArray(existing)) {\n\t\texisting.push(value);\n\t\treturn;\n\t}\n\tif (typeof existing === \"string\") {\n\t\tout[canonical] = [existing, value];\n\t\treturn;\n\t}\n\tthrow new Error(`Invalid state for flag \"${canonical}\".`);\n}\n\n//#endregion\n//#region src/compile/command/cat/cat.ts\n/**\n* cat command handler for the AST-based compiler.\n*/\nconst flags = {\n\tnumber: {\n\t\tshort: \"n\",\n\t\ttakesValue: false\n\t},\n\tnumberNonBlank: {\n\t\tshort: \"b\",\n\t\ttakesValue: false\n\t},\n\tshowAll: {\n\t\tshort: \"A\",\n\t\ttakesValue: false\n\t},\n\tshowEnds: {\n\t\tshort: \"E\",\n\t\ttakesValue: false\n\t},\n\tshowNonprinting: {\n\t\tshort: \"v\",\n\t\ttakesValue: false\n\t},\n\tshowTabs: {\n\t\tshort: \"T\",\n\t\ttakesValue: false\n\t},\n\tsqueezeBlank: {\n\t\tshort: \"s\",\n\t\ttakesValue: false\n\t}\n};\n/**\n* Compile a cat command from SimpleCommandIR to StepIR.\n*/\nfunction compileCat(cmd$1) {\n\tconst parsed = parseArgs(cmd$1.args.map(expandedWordToString), flags);\n\tconst fileArgs = [];\n\tfor (const arg of cmd$1.args) if (!expandedWordToString(arg).startsWith(\"-\")) fileArgs.push(arg);\n\tconst hasInputRedirection = cmd$1.redirections.some((redirection) => redirection.kind === \"input\");\n\tif (fileArgs.length === 0 && !hasInputRedirection) throw new Error(\"cat requires at least one file\");\n\treturn {\n\t\tcmd: \"cat\",\n\t\targs: {\n\t\t\tfiles: fileArgs,\n\t\t\tnumberLines: parsed.flags.number === true,\n\t\t\tnumberNonBlank: parsed.flags.numberNonBlank === true,\n\t\t\tshowAll: parsed.flags.showAll === true,\n\t\t\tshowEnds: parsed.flags.showEnds === true,\n\t\t\tshowNonprinting: parsed.flags.showNonprinting === true,\n\t\t\tshowTabs: parsed.flags.showTabs === true,\n\t\t\tsqueezeBlank: parsed.flags.squeezeBlank === true\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/cp/cp.ts\n/**\n* cp command handler for the AST-based compiler.\n*/\n/**\n* Compile a cp command from SimpleCommandIR to StepIR.\n*/\nfunction compileCp(cmd$1) {\n\tlet recursive = false;\n\tconst filteredArgs = [];\n\tfor (const arg of cmd$1.args) {\n\t\tconst argStr = expandedWordToString(arg);\n\t\tif (argStr === \"-r\") recursive = true;\n\t\telse if (argStr !== \"-f\" && argStr !== \"-i\") filteredArgs.push(arg);\n\t}\n\tif (filteredArgs.length < 2) throw new Error(\"cp requires source and destination\");\n\tconst dest = filteredArgs.pop();\n\tif (!dest) throw new Error(\"cp requires source and destination\");\n\treturn {\n\t\tcmd: \"cp\",\n\t\targs: {\n\t\t\tdest,\n\t\t\trecursive,\n\t\t\tsrcs: filteredArgs\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/head/head.ts\n/**\n* head command handler for the AST-based compiler.\n*/\nconst NEGATIVE_NUMBER_REGEX$1 = /^-\\d+$/;\n/**\n* Compile a head command from SimpleCommandIR to StepIR.\n*/\nfunction compileHead(cmd$1) {\n\tlet n = 10;\n\tconst files = [];\n\tlet skipNext = false;\n\tfor (let i = 0; i < cmd$1.args.length; i++) {\n\t\tif (skipNext) {\n\t\t\tskipNext = false;\n\t\t\tcontinue;\n\t\t}\n\t\tconst arg = cmd$1.args[i];\n\t\tif (!arg) continue;\n\t\tconst argStr = expandedWordToString(arg);\n\t\tif (argStr === \"-n\") {\n\t\t\tconst numArg = cmd$1.args[i + 1];\n\t\t\tif (!numArg) throw new Error(\"head -n requires a number\");\n\t\t\tn = Number(expandedWordToString(numArg));\n\t\t\tif (!Number.isFinite(n)) throw new Error(\"Invalid head count\");\n\t\t\tskipNext = true;\n\t\t} else if (argStr.startsWith(\"-\") && NEGATIVE_NUMBER_REGEX$1.test(argStr)) n = Number(argStr.slice(1));\n\t\telse if (argStr.startsWith(\"-\")) throw new Error(\"Unknown head option\");\n\t\telse files.push(arg);\n\t}\n\treturn {\n\t\tcmd: \"head\",\n\t\targs: {\n\t\t\tfiles,\n\t\t\tn\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/ls/ls.ts\n/**\n* ls command handler for the AST-based compiler.\n*/\n/**\n* Compile an ls command from SimpleCommandIR to StepIR.\n*/\nfunction compileLs(cmd$1) {\n\treturn {\n\t\tcmd: \"ls\",\n\t\targs: { paths: cmd$1.args.length === 0 ? [literal(\".\")] : cmd$1.args }\n\t};\n}\n\n//#endregion\n//#region src/compile/command/mkdir/mkdir.ts\n/**\n* mkdir command handler for the AST-based compiler.\n*/\n/**\n* Compile a mkdir command from SimpleCommandIR to StepIR.\n*/\nfunction compileMkdir(cmd$1) {\n\tlet recursive = false;\n\tconst paths = [];\n\tfor (const arg of cmd$1.args) if (expandedWordToString(arg) === \"-p\") recursive = true;\n\telse paths.push(arg);\n\tif (paths.length === 0) throw new Error(\"mkdir requires at least one path\");\n\treturn {\n\t\tcmd: \"mkdir\",\n\t\targs: {\n\t\t\tpaths,\n\t\t\trecursive\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/mv/mv.ts\n/**\n* mv command handler for the AST-based compiler.\n*/\n/**\n* Compile a mv command from SimpleCommandIR to StepIR.\n*/\nfunction compileMv(cmd$1) {\n\tconst filteredArgs = [];\n\tfor (const arg of cmd$1.args) {\n\t\tconst argStr = expandedWordToString(arg);\n\t\tif (argStr !== \"-f\" && argStr !== \"-i\") filteredArgs.push(arg);\n\t}\n\tif (filteredArgs.length < 2) throw new Error(\"mv requires source and destination\");\n\tconst dest = filteredArgs.pop();\n\tif (!dest) throw new Error(\"mv requires source and destination\");\n\treturn {\n\t\tcmd: \"mv\",\n\t\targs: {\n\t\t\tdest,\n\t\t\tsrcs: filteredArgs\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/rm/rm.ts\n/**\n* rm command handler for the AST-based compiler.\n*/\n/**\n* Compile a rm command from SimpleCommandIR to StepIR.\n*/\nfunction compileRm(cmd$1) {\n\tlet recursive = false;\n\tconst paths = [];\n\tfor (const arg of cmd$1.args) {\n\t\tconst argStr = expandedWordToString(arg);\n\t\tif (argStr === \"-r\") recursive = true;\n\t\telse if (argStr !== \"-f\" && argStr !== \"-i\") paths.push(arg);\n\t}\n\tif (paths.length === 0) throw new Error(\"rm requires at least one path\");\n\treturn {\n\t\tcmd: \"rm\",\n\t\targs: {\n\t\t\tpaths,\n\t\t\trecursive\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/tail/tail.ts\n/**\n* tail command handler for the AST-based compiler.\n*/\nconst NEGATIVE_NUMBER_REGEX = /^-\\d+$/;\n/**\n* Compile a tail command from SimpleCommandIR to StepIR.\n*/\nfunction compileTail(cmd$1) {\n\tlet n = 10;\n\tconst files = [];\n\tlet skipNext = false;\n\tfor (let i = 0; i < cmd$1.args.length; i++) {\n\t\tif (skipNext) {\n\t\t\tskipNext = false;\n\t\t\tcontinue;\n\t\t}\n\t\tconst arg = cmd$1.args[i];\n\t\tif (!arg) continue;\n\t\tconst argStr = expandedWordToString(arg);\n\t\tif (argStr === \"-n\") {\n\t\t\tconst numArg = cmd$1.args[i + 1];\n\t\t\tif (!numArg) throw new Error(\"tail -n requires a number\");\n\t\t\tn = Number(expandedWordToString(numArg));\n\t\t\tif (!Number.isFinite(n)) throw new Error(\"Invalid tail count\");\n\t\t\tskipNext = true;\n\t\t} else if (argStr.startsWith(\"-\") && NEGATIVE_NUMBER_REGEX.test(argStr)) n = Number(argStr.slice(1));\n\t\telse if (argStr.startsWith(\"-\")) throw new Error(\"Unknown tail option\");\n\t\telse files.push(arg);\n\t}\n\treturn {\n\t\tcmd: \"tail\",\n\t\targs: {\n\t\t\tfiles,\n\t\t\tn\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/touch/touch.ts\n/**\n* touch command handler for the AST-based compiler.\n*/\n/**\n* Compile a touch command from SimpleCommandIR to StepIR.\n*/\nfunction compileTouch(cmd$1) {\n\tconst files = [];\n\tfor (const arg of cmd$1.args) if (!expandedWordToString(arg).startsWith(\"-\")) files.push(arg);\n\tif (files.length === 0) throw new Error(\"touch requires at least one file\");\n\treturn {\n\t\tcmd: \"touch\",\n\t\targs: { files }\n\t};\n}\n\n//#endregion\n//#region src/compile/command/handler.ts\nlet CommandHandler;\n(function(_CommandHandler) {\n\tconst handlers = {\n\t\tcat: compileCat,\n\t\tcp: compileCp,\n\t\thead: compileHead,\n\t\tls: compileLs,\n\t\tmkdir: compileMkdir,\n\t\tmv: compileMv,\n\t\trm: compileRm,\n\t\ttail: compileTail,\n\t\ttouch: compileTouch\n\t};\n\tfunction get(name) {\n\t\tconst handler = handlers[name];\n\t\tif (!handler) throw new Error(`Unknown command: ${name}`);\n\t\treturn handler;\n\t}\n\t_CommandHandler.get = get;\n\tfunction has(name) {\n\t\treturn name in handlers;\n\t}\n\t_CommandHandler.has = has;\n\tfunction register(name, handler) {\n\t\thandlers[name] = handler;\n\t}\n\t_CommandHandler.register = register;\n})(CommandHandler || (CommandHandler = {}));\n\n//#endregion\n//#region src/compile/compile.ts\n/**\n* AST-based compiler for the Fish subset parser.\n*\n* This compiler traverses the AST and produces a PipelineIR\n* with enhanced word expansion information.\n*\n* Key differences from the old compile.ts:\n* - Accepts Program from the new parser (not ShellAST)\n* - Produces PipelineIR with ExpandedWord types\n* - Preserves word structure for runtime expansion\n*/\n/**\n* Compile a Program AST to a PipelineIR.\n*\n* @param program The parsed Program AST\n* @returns The compiled PipelineIR\n*/\nfunction compile(program) {\n\treturn new ProgramCompiler().compileProgram(program);\n}\n/**\n* Compiler that traverses the AST to produce IR.\n*\n* Note: We don't implement the Visitor interface directly because\n* different AST nodes need to return different types. Instead, we\n* manually traverse the AST with type-specific methods.\n*/\nvar ProgramCompiler = class {\n\t/**\n\t* Compile a Program to a PipelineIR.\n\t*/\n\tcompileProgram(node) {\n\t\treturn this.compilePipeline(node.pipeline);\n\t}\n\t/**\n\t* Compile a Pipeline to a PipelineIR.\n\t*/\n\tcompilePipeline(node) {\n\t\tconst commands = node.commands.map((cmd$1) => this.compileSimpleCommand(cmd$1));\n\t\tif (commands.length === 0) throw new Error(\"Pipeline must contain at least one command\");\n\t\tconst firstCmd = commands[0];\n\t\tif (!firstCmd) throw new Error(\"Pipeline must contain at least one command\");\n\t\treturn {\n\t\t\tsource: this.determineSource(firstCmd),\n\t\t\tsteps: commands.map((cmd$1) => this.compileCommandToStep(cmd$1)),\n\t\t\tfirstCommand: firstCmd\n\t\t};\n\t}\n\t/**\n\t* Compile a SimpleCommand to a SimpleCommandIR.\n\t*/\n\tcompileSimpleCommand(node) {\n\t\treturn {\n\t\t\tname: this.expandWord(node.name),\n\t\t\targs: node.args.map((arg) => this.expandWord(arg)),\n\t\t\tredirections: node.redirections.map((r) => this.compileRedirection(r))\n\t\t};\n\t}\n\t/**\n\t* Compile a Redirection to a RedirectionIR.\n\t*/\n\tcompileRedirection(node) {\n\t\treturn {\n\t\t\tkind: node.redirectKind,\n\t\t\ttarget: this.expandWord(node.target)\n\t\t};\n\t}\n\t/**\n\t* Expand a Word to an ExpandedWord.\n\t* Handles concatenation of literal parts and detection of globs/command subs.\n\t*/\n\texpandWord(word) {\n\t\tconst parts = word.parts;\n\t\tif (parts.length === 0) return literal(\"\");\n\t\tif (parts.length === 1) {\n\t\t\tconst part = parts[0];\n\t\t\tif (!part) return literal(\"\");\n\t\t\treturn this.expandWordPart(part);\n\t\t}\n\t\tif (parts.every((p) => p.kind === \"literal\")) return literal(parts.map((p) => p.value).join(\"\"));\n\t\tif (parts.some((p) => p.kind === \"glob\")) return glob(parts.map((p) => {\n\t\t\tif (p.kind === \"literal\") return p.value;\n\t\t\tif (p.kind === \"glob\") return p.pattern;\n\t\t\treturn \"\";\n\t\t}).join(\"\"));\n\t\tif (parts.some((p) => p.kind === \"commandSub\")) {\n\t\t\tconst cmdSubPart = parts.find((p) => p.kind === \"commandSub\");\n\t\t\treturn commandSub(this.serializeProgram(cmdSubPart.program));\n\t\t}\n\t\treturn literal(parts.filter((p) => p.kind === \"literal\").map((p) => p.value).join(\"\"));\n\t}\n\t/**\n\t* Expand a single WordPart to an ExpandedWord.\n\t*/\n\texpandWordPart(part) {\n\t\tswitch (part.kind) {\n\t\t\tcase \"literal\": return literal(part.value);\n\t\t\tcase \"glob\": return glob(part.pattern);\n\t\t\tcase \"commandSub\": return commandSub(this.serializeProgram(part.program));\n\t\t\tdefault: {\n\t\t\t\tconst _exhaustive = part;\n\t\t\t\tthrow new Error(`Unknown word part kind: ${JSON.stringify(_exhaustive)}`);\n\t\t\t}\n\t\t}\n\t}\n\t/**\n\t* Determine the source for a pipeline based on the first command.\n\t*/\n\tdetermineSource(firstCmd) {\n\t\tconst firstArg = firstCmd.args[0];\n\t\tif (firstArg?.kind === \"literal\") return {\n\t\t\tkind: \"fs\",\n\t\t\tglob: firstArg.value\n\t\t};\n\t\tif (firstArg?.kind === \"glob\") return {\n\t\t\tkind: \"fs\",\n\t\t\tglob: firstArg.pattern\n\t\t};\n\t\treturn {\n\t\t\tkind: \"fs\",\n\t\t\tglob: \"**/*\"\n\t\t};\n\t}\n\t/**\n\t* Compile a SimpleCommandIR to a StepIR.\n\t*/\n\tcompileCommandToStep(cmd$1) {\n\t\tconst cmdName = this.extractLiteralString(cmd$1.name);\n\t\tif (!cmdName) throw new Error(\"Command name must be a literal string\");\n\t\treturn {\n\t\t\t...CommandHandler.get(cmdName)(cmd$1),\n\t\t\tredirections: cmd$1.redirections\n\t\t};\n\t}\n\t/**\n\t* Extract the literal string value from an ExpandedWord.\n\t* Returns null if the word is not a literal.\n\t*/\n\textractLiteralString(word) {\n\t\tif (word.kind === \"literal\") return word.value;\n\t\treturn null;\n\t}\n\t/**\n\t* Serialize a Program AST back to a string representation.\n\t* Used for storing command substitution content.\n\t*/\n\tserializeProgram(program) {\n\t\treturn program.pipeline.commands.map((cmd$1) => {\n\t\t\tconst name = cmd$1.name.literalValue ?? \"?\";\n\t\t\tconst args = cmd$1.args.map((arg) => arg.literalValue ?? \"?\").join(\" \");\n\t\t\treturn args ? `${name} ${args}` : name;\n\t\t}).join(\" | \");\n\t}\n};\n\n//#endregion\n//#region src/lexer/position.ts\n/**\n* Represents a position in source code.\n*/\nvar SourcePosition = class SourcePosition {\n\tline;\n\tcolumn;\n\toffset;\n\tconstructor(line, column, offset) {\n\t\tthis.line = line;\n\t\tthis.column = column;\n\t\tthis.offset = offset;\n\t}\n\tstatic ZERO = new SourcePosition(1, 1, 0);\n\ttoString() {\n\t\treturn `${this.line}:${this.column}`;\n\t}\n\tspan(end) {\n\t\treturn new SourceSpan(this, end);\n\t}\n};\n/**\n* Represents a span of source code from start to end position.\n*/\nvar SourceSpan = class {\n\tstart;\n\tend;\n\tconstructor(start, end) {\n\t\tthis.start = start;\n\t\tthis.end = end;\n\t}\n\ttoString() {\n\t\treturn `${this.start}-${this.end}`;\n\t}\n};\n\n//#endregion\n//#region src/lexer/context.ts\n/**\n* Lexer states for the fish subset lexer state machine.\n*\n* Simplified for the subset - only tracks quoting and command substitution.\n*/\nconst LexerState = {\n\tNORMAL: 0,\n\tSINGLE_QUOTED: 1,\n\tDOUBLE_QUOTED: 2,\n\tCOMMAND_SUB: 3\n};\n/**\n* Manages the lexer state stack for tracking nested contexts.\n*\n* Fish subset has simple quoting:\n* - Single quotes: literal, no escapes, no substitution\n* - Double quotes: command substitution allowed, minimal escaping (\\\", \\\\)\n*/\nvar StateContext = class {\n\tstack = [LexerState.NORMAL];\n\t/**\n\t* Get the current lexer state.\n\t*/\n\tget current() {\n\t\treturn this.stack.at(-1) ?? LexerState.NORMAL;\n\t}\n\t/**\n\t* Get the stack depth.\n\t*/\n\tget depth() {\n\t\treturn this.stack.length;\n\t}\n\t/**\n\t* Check if we're inside any quote context.\n\t*/\n\tget inQuotes() {\n\t\tconst s = this.current;\n\t\treturn s === LexerState.SINGLE_QUOTED || s === LexerState.DOUBLE_QUOTED;\n\t}\n\t/**\n\t* Check if we're inside single quotes.\n\t*/\n\tget inSingleQuote() {\n\t\treturn this.current === LexerState.SINGLE_QUOTED;\n\t}\n\t/**\n\t* Check if we're inside double quotes.\n\t*/\n\tget inDoubleQuote() {\n\t\treturn this.current === LexerState.DOUBLE_QUOTED;\n\t}\n\t/**\n\t* Check if we're inside a command substitution.\n\t*/\n\tget inCommandSub() {\n\t\treturn this.current === LexerState.COMMAND_SUB;\n\t}\n\t/**\n\t* Push a new state onto the stack.\n\t*/\n\tpush(state) {\n\t\tthis.stack.push(state);\n\t}\n\t/**\n\t* Pop the current state from the stack.\n\t*/\n\tpop() {\n\t\tif (this.stack.length > 1) return this.stack.pop() ?? LexerState.NORMAL;\n\t\treturn LexerState.NORMAL;\n\t}\n\t/**\n\t* Reset the context to initial state.\n\t*/\n\treset() {\n\t\tthis.stack = [LexerState.NORMAL];\n\t}\n\t/**\n\t* Check if any parent context is double-quoted.\n\t* Useful for determining if command substitution should occur.\n\t*/\n\thasDoubleQuoteParent() {\n\t\treturn this.stack.includes(LexerState.DOUBLE_QUOTED);\n\t}\n\t/**\n\t* Check if any parent context is single-quoted.\n\t* If true, no expansions should occur.\n\t*/\n\thasSingleQuoteParent() {\n\t\treturn this.stack.includes(LexerState.SINGLE_QUOTED);\n\t}\n};\n\n//#endregion\n//#region src/lexer/token.ts\n/**\n* Token types for the fish subset lexer.\n*\n* This is a simplified subset of fish shell syntax focused on:\n* - Pipelines\n* - Command substitution (...)\n* - Globbing (* ? [...])\n* - Basic quoting\n* - Comments\n*\n* NOT supported: variables, brace expansion, control flow, functions\n*/\nconst TokenKind = {\n\tEOF: 0,\n\tERROR: 1,\n\tNEWLINE: 2,\n\tCOMMENT: 3,\n\tWORD: 4,\n\tNAME: 5,\n\tNUMBER: 6,\n\tPIPE: 7,\n\tLPAREN: 8,\n\tRPAREN: 9,\n\tLESS: 10,\n\tGREAT: 11,\n\tCOMMAND_SUB: 12,\n\tGLOB: 13\n};\n/**\n* Create an empty flags object.\n*/\nfunction createEmptyFlags() {\n\treturn {\n\t\tquoted: false,\n\t\tsingleQuoted: false,\n\t\tdoubleQuoted: false,\n\t\tcontainsExpansion: false,\n\t\tcontainsGlob: false\n\t};\n}\n/**\n* Check if any quote flag is set.\n*/\nfunction isQuoted(flags$1) {\n\treturn flags$1.quoted || flags$1.singleQuoted || flags$1.doubleQuoted;\n}\n/**\n* Human-readable names for token kinds.\n*/\nconst TOKEN_KIND_NAMES = {\n\t[TokenKind.EOF]: \"EOF\",\n\t[TokenKind.ERROR]: \"ERROR\",\n\t[TokenKind.NEWLINE]: \"NEWLINE\",\n\t[TokenKind.COMMENT]: \"COMMENT\",\n\t[TokenKind.WORD]: \"WORD\",\n\t[TokenKind.NAME]: \"NAME\",\n\t[TokenKind.NUMBER]: \"NUMBER\",\n\t[TokenKind.PIPE]: \"PIPE\",\n\t[TokenKind.LPAREN]: \"LPAREN\",\n\t[TokenKind.RPAREN]: \"RPAREN\",\n\t[TokenKind.LESS]: \"LESS\",\n\t[TokenKind.GREAT]: \"GREAT\",\n\t[TokenKind.COMMAND_SUB]: \"COMMAND_SUB\",\n\t[TokenKind.GLOB]: \"GLOB\"\n};\n/**\n* Canonical spellings for operators and special tokens.\n*/\nconst TOKEN_SPELLINGS = new Map([\n\t[TokenKind.EOF, \"<eof>\"],\n\t[TokenKind.ERROR, \"<error>\"],\n\t[TokenKind.NEWLINE, \"\\\\n\"],\n\t[TokenKind.PIPE, \"|\"],\n\t[TokenKind.LPAREN, \"(\"],\n\t[TokenKind.RPAREN, \")\"],\n\t[TokenKind.LESS, \"<\"],\n\t[TokenKind.GREAT, \">\"]\n]);\n/**\n* Represents a single token from the lexer.\n*/\nvar Token = class Token {\n\tkind;\n\tspelling;\n\tspan;\n\tflags;\n\tconstructor(kind, spelling, span, flags$1 = createEmptyFlags()) {\n\t\tthis.kind = kind;\n\t\tthis.spelling = spelling;\n\t\tthis.span = span;\n\t\tthis.flags = flags$1;\n\t}\n\t/**\n\t* Get the canonical spelling for a token kind.\n\t*/\n\tstatic spell(kind) {\n\t\treturn TOKEN_SPELLINGS.get(kind) ?? \"<unknown>\";\n\t}\n\t/**\n\t* Get the name of a token kind.\n\t*/\n\tstatic kindName(kind) {\n\t\treturn TOKEN_KIND_NAMES[kind] ?? \"UNKNOWN\";\n\t}\n\t/**\n\t* Check if this token is an operator.\n\t*/\n\tget isOperator() {\n\t\treturn this.kind >= TokenKind.PIPE && this.kind <= TokenKind.GREAT;\n\t}\n\t/**\n\t* Check if this token has any quote flags set.\n\t*/\n\tget isQuoted() {\n\t\treturn isQuoted(this.flags);\n\t}\n\t/**\n\t* Check if this token contains expansions (command substitution).\n\t*/\n\tget hasExpansions() {\n\t\treturn this.flags.containsExpansion;\n\t}\n\t/**\n\t* Check if this token contains glob patterns.\n\t*/\n\tget hasGlob() {\n\t\treturn this.flags.containsGlob;\n\t}\n\ttoString() {\n\t\treturn `Token(${Token.kindName(this.kind)}, \"${this.spelling}\", ${this.span})`;\n\t}\n};\n\n//#endregion\n//#region src/lexer/operators.ts\n/**\n* Multi-character operators sorted by length (longest first) for greedy matching.\n*\n* For the fish subset, we only support:\n* - | (pipe)\n* - > (output redirection - Phase 2)\n* - < (input redirection - Phase 2)\n*\n* NOT supported: &&, ||, >>, &>, >?, ;, &\n*/\nconst OPERATORS = [];\n/**\n* Single-character operators for O(1) lookup.\n*/\nconst SINGLE_CHAR_OPS = new Map([\n\t[\"|\", TokenKind.PIPE],\n\t[\"<\", TokenKind.LESS],\n\t[\">\", TokenKind.GREAT]\n]);\n/**\n* Characters that definitively end a word (token boundary).\n*/\nconst WORD_BOUNDARY_CHARS = new Set([\n\t\" \",\n\t\"\t\",\n\t\"\\n\",\n\t\"|\",\n\t\"<\",\n\t\">\",\n\t\"(\",\n\t\")\",\n\t\"\\0\"\n]);\n\n//#endregion\n//#region src/lexer/source-reader.ts\n/**\n* In-memory implementation of SourceReader (fast).\n*/\nvar StringSourceReader = class StringSourceReader {\n\tstatic EOF = \"\\0\";\n\tinput;\n\tpos = 0;\n\tline = 1;\n\tcolumn = 1;\n\tmarkState = null;\n\tconstructor(input) {\n\t\tthis.input = input;\n\t}\n\tget eof() {\n\t\treturn this.pos >= this.input.length;\n\t}\n\tget position() {\n\t\treturn new SourcePosition(this.line, this.column, this.pos);\n\t}\n\tpeek(offset = 0) {\n\t\tconst idx = this.pos + offset;\n\t\tconst char = this.input[idx];\n\t\treturn char !== void 0 ? char : StringSourceReader.EOF;\n\t}\n\tadvance() {\n\t\tif (this.eof) return StringSourceReader.EOF;\n\t\tconst char = this.input[this.pos];\n\t\tif (char === void 0) return StringSourceReader.EOF;\n\t\tthis.pos++;\n\t\tif (char === \"\\n\") {\n\t\t\tthis.line++;\n\t\t\tthis.column = 1;\n\t\t} else this.column++;\n\t\treturn char;\n\t}\n\tmark() {\n\t\tthis.markState = {\n\t\t\tpos: this.pos,\n\t\t\tline: this.line,\n\t\t\tcolumn: this.column\n\t\t};\n\t}\n\treset() {\n\t\tif (this.markState) {\n\t\t\tthis.pos = this.markState.pos;\n\t\t\tthis.line = this.markState.line;\n\t\t\tthis.column = this.markState.column;\n\t\t\tthis.markState = null;\n\t\t}\n\t}\n};\n\n//#endregion\n//#region src/lexer/scanner.ts\nconst NUMBER_PATTERN = /^[0-9]+$/;\nconst NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_-]*$/;\n/**\n* Merge two flags objects, combining their values.\n*/\nfunction mergeFlags(a, b) {\n\treturn {\n\t\tquoted: a.quoted || b.quoted,\n\t\tsingleQuoted: a.singleQuoted || b.singleQuoted,\n\t\tdoubleQuoted: a.doubleQuoted || b.doubleQuoted,\n\t\tcontainsExpansion: a.containsExpansion || b.containsExpansion,\n\t\tcontainsGlob: a.containsGlob || b.containsGlob\n\t};\n}\n/**\n* The main Scanner class for tokenizing fish subset source code.\n*\n* This lexer implements a fish-inspired subset with:\n* - Pipelines (|)\n* - Command substitution (...)\n* - Globbing (* ? [...])\n* - Single quotes (literal, no escapes)\n* - Double quotes (command substitution allowed, minimal escaping)\n* - Comments (#)\n* - Redirection (> <) - Phase 2\n*\n* NOT supported:\n* - Variables ($var)\n* - Brace expansion ({a,b})\n* - Control flow (if, for, while, etc.)\n* - Functions\n* - Background (&)\n* - Semicolons (;)\n* - and/or/not keywords\n* - Tilde expansion (~)\n* - Recursive globbing (**)\n*/\nvar Scanner = class {\n\tsource;\n\tstateCtx = new StateContext();\n\tdebug = false;\n\tconstructor(input) {\n\t\tthis.source = typeof input === \"string\" ? new StringSourceReader(input) : input;\n\t}\n\t/**\n\t* Enable debug logging of tokens.\n\t*/\n\tenableDebugging() {\n\t\tthis.debug = true;\n\t\treturn this;\n\t}\n\t/**\n\t* Main entry: get next token.\n\t*/\n\tgetToken() {\n\t\tthis.skipWhitespace();\n\t\tconst start = this.source.position;\n\t\tconst token = this.nextToken(start);\n\t\tif (this.debug) console.log(token.toString());\n\t\treturn token;\n\t}\n\t/**\n\t* Tokenize all input.\n\t*/\n\ttokenize() {\n\t\tconst tokens = [];\n\t\tlet token;\n\t\tdo {\n\t\t\ttoken = this.getToken();\n\t\t\ttokens.push(token);\n\t\t} while (token.kind !== TokenKind.EOF);\n\t\treturn tokens;\n\t}\n\tnextToken(start) {\n\t\tconst c0 = this.source.peek();\n\t\tif (this.source.eof || c0 === \"\\0\") return this.makeToken(TokenKind.EOF, \"\", start);\n\t\tif (c0 === \"#\") return this.readComment(start);\n\t\tif (c0 === \"\\n\") {\n\t\t\tthis.source.advance();\n\t\t\treturn this.makeToken(TokenKind.NEWLINE, \"\\n\", start);\n\t\t}\n\t\tconst opToken = this.tryMatchOperator(start);\n\t\tif (opToken) return opToken;\n\t\tconst singleOp = SINGLE_CHAR_OPS.get(c0);\n\t\tif (singleOp !== void 0) {\n\t\t\tthis.source.advance();\n\t\t\treturn this.makeToken(singleOp, c0, start);\n\t\t}\n\t\tif (c0 === \"(\") {\n\t\t\tthis.source.advance();\n\t\t\treturn this.makeToken(TokenKind.LPAREN, \"(\", start);\n\t\t}\n\t\tif (c0 === \")\") {\n\t\t\tthis.source.advance();\n\t\t\treturn this.makeToken(TokenKind.RPAREN, \")\", start);\n\t\t}\n\t\treturn this.readWord(start);\n\t}\n\ttryMatchOperator(start) {\n\t\tconst chars = this.source.peek() + this.source.peek(1);\n\t\tfor (const op of OPERATORS) if (chars.startsWith(op.pattern)) {\n\t\t\tfor (const _ of op.pattern) this.source.advance();\n\t\t\treturn this.makeToken(op.kind, op.pattern, start);\n\t\t}\n\t\treturn null;\n\t}\n\treadWord(start) {\n\t\tconst fastResult = this.tryFastPath(start);\n\t\tif (fastResult) return fastResult;\n\t\treturn this.readComplexWord(start);\n\t}\n\ttryFastPath(start) {\n\t\tthis.source.mark();\n\t\tlet spelling = \"\";\n\t\twhile (!this.source.eof) {\n\t\t\tconst c = this.source.peek();\n\t\t\tif (this.isSpecialChar(c)) break;\n\t\t\tspelling += this.source.advance();\n\t\t}\n\t\tif (spelling.length === 0) {\n\t\t\tthis.source.reset();\n\t\t\treturn null;\n\t\t}\n\t\tconst next = this.source.peek();\n\t\tif (this.isWordBoundary(next)) return this.classifyWord(spelling, start, createEmptyFlags());\n\t\tthis.source.reset();\n\t\treturn null;\n\t}\n\treadComplexWord(start) {\n\t\tthis.stateCtx.reset();\n\t\tlet spelling = \"\";\n\t\tlet flags$1 = createEmptyFlags();\n\t\twhile (!this.source.eof) {\n\t\t\tconst c = this.source.peek();\n\t\t\tif (!this.stateCtx.inQuotes && this.isWordBoundary(c)) break;\n\t\t\tconst result = this.processChar(c);\n\t\t\tspelling += result.chars;\n\t\t\tflags$1 = mergeFlags(flags$1, result.flags);\n\t\t\tif (result.done) break;\n\t\t}\n\t\treturn this.classifyWord(spelling, start, flags$1);\n\t}\n\tprocessChar(c) {\n\t\tif (c === \"'\" && !this.stateCtx.inDoubleQuote) return this.handleSingleQuote();\n\t\tif (c === \"\\\"\" && !this.stateCtx.inSingleQuote) return this.handleDoubleQuote();\n\t\tif (c === \"\\\\\" && !this.stateCtx.inSingleQuote) return this.handleEscape();\n\t\tif (c === \"(\" && !this.stateCtx.inSingleQuote) return this.readCommandSubstitution();\n\t\tif ((c === \"*\" || c === \"?\") && !this.stateCtx.inQuotes) return this.handleGlobChar(c);\n\t\tif (c === \"[\" && !this.stateCtx.inQuotes) return this.readCharacterClass();\n\t\tthis.source.advance();\n\t\treturn {\n\t\t\tchars: c,\n\t\t\tflags: createEmptyFlags(),\n\t\t\tdone: false\n\t\t};\n\t}\n\thandleGlobChar(c) {\n\t\tthis.source.advance();\n\t\tconst flags$1 = createEmptyFlags();\n\t\tflags$1.containsGlob = true;\n\t\treturn {\n\t\t\tchars: c,\n\t\t\tflags: flags$1,\n\t\t\tdone: false\n\t\t};\n\t}\n\thandleSingleQuote() {\n\t\tif (this.stateCtx.inSingleQuote) {\n\t\t\tthis.stateCtx.pop();\n\t\t\tthis.source.advance();\n\t\t\treturn {\n\t\t\t\tchars: \"\",\n\t\t\t\tflags: createEmptyFlags(),\n\t\t\t\tdone: false\n\t\t\t};\n\t\t}\n\t\tthis.stateCtx.push(LexerState.SINGLE_QUOTED);\n\t\tthis.source.advance();\n\t\tconst flags$1 = createEmptyFlags();\n\t\tflags$1.singleQuoted = true;\n\t\tflags$1.quoted = true;\n\t\treturn {\n\t\t\tchars: \"\",\n\t\t\tflags: flags$1,\n\t\t\tdone: false\n\t\t};\n\t}\n\thandleDoubleQuote() {\n\t\tif (this.stateCtx.inDoubleQuote) {\n\t\t\tthis.stateCtx.pop();\n\t\t\tthis.source.advance();\n\t\t\treturn {\n\t\t\t\tchars: \"\",\n\t\t\t\tflags: createEmptyFlags(),\n\t\t\t\tdone: false\n\t\t\t};\n\t\t}\n\t\tthis.stateCtx.push(LexerState.DOUBLE_QUOTED);\n\t\tthis.source.advance();\n\t\tconst flags$1 = createEmptyFlags();\n\t\tflags$1.doubleQuoted = true;\n\t\tflags$1.quoted = true;\n\t\treturn {\n\t\t\tchars: \"\",\n\t\t\tflags: flags$1,\n\t\t\tdone: false\n\t\t};\n\t}\n\thandleEscape() {\n\t\tthis.source.advance();\n\t\tconst next = this.source.peek();\n\t\tif (this.source.eof || next === \"\\0\") return {\n\t\t\tchars: \"\\\\\",\n\t\t\tflags: createEmptyFlags(),\n\t\t\tdone: false\n\t\t};\n\t\tif (next === \"\\n\") {\n\t\t\tthis.source.advance();\n\t\t\treturn {\n\t\t\t\tchars: \"\",\n\t\t\t\tflags: createEmptyFlags(),\n\t\t\t\tdone: false\n\t\t\t};\n\t\t}\n\t\tif (this.stateCtx.inDoubleQuote) {\n\t\t\tif (\"\\\"\\\\\".includes(next)) {\n\t\t\t\tthis.source.advance();\n\t\t\t\treturn {\n\t\t\t\t\tchars: next,\n\t\t\t\t\tflags: createEmptyFlags(),\n\t\t\t\t\tdone: false\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tchars: \"\\\\\",\n\t\t\t\tflags: createEmptyFlags(),\n\t\t\t\tdone: false\n\t\t\t};\n\t\t}\n\t\tthis.source.advance();\n\t\treturn {\n\t\t\tchars: next,\n\t\t\tflags: createEmptyFlags(),\n\t\t\tdone: false\n\t\t};\n\t}\n\treadCommandSubstitution() {\n\t\tlet result = \"\";\n\t\tresult += this.source.advance();\n\t\tlet depth = 1;\n\t\twhile (depth > 0 && !this.source.eof) {\n\t\t\tconst c = this.source.peek();\n\t\t\tif (c === \"(\") {\n\t\t\t\tdepth++;\n\t\t\t\tresult += this.source.advance();\n\t\t\t} else if (c === \")\") {\n\t\t\t\tdepth--;\n\t\t\t\tresult += this.source.advance();\n\t\t\t} else if (c === \"'\" || c === \"\\\"\") result += this.skipQuotedContent(c);\n\t\t\telse if (c === \"\\\\\" && !this.source.eof) {\n\t\t\t\tresult += this.source.advance();\n\t\t\t\tif (!this.source.eof) result += this.source.advance();\n\t\t\t} else result += this.source.advance();\n\t\t}\n\t\tconst flags$1 = createEmptyFlags();\n\t\tflags$1.containsExpansion = true;\n\t\treturn {\n\t\t\tchars: result,\n\t\t\tflags: flags$1,\n\t\t\tdone: false\n\t\t};\n\t}\n\treadCharacterClass() {\n\t\tlet result = \"\";\n\t\tresult += this.source.advance();\n\t\tif (this.source.peek() === \"!\" || this.source.peek() === \"^\") result += this.source.advance();\n\t\tif (this.source.peek() === \"]\") result += this.source.advance();\n\t\twhile (!this.source.eof && this.source.peek() !== \"]\") result += this.source.advance();\n\t\tif (this.source.peek() === \"]\") result += this.source.advance();\n\t\tconst flags$1 = createEmptyFlags();\n\t\tflags$1.containsGlob = true;\n\t\treturn {\n\t\t\tchars: result,\n\t\t\tflags: flags$1,\n\t\t\tdone: false\n\t\t};\n\t}\n\tskipQuotedContent(quoteChar) {\n\t\tlet result = \"\";\n\t\tresult += this.source.advance();\n\t\twhile (!this.source.eof && this.source.peek() !== quoteChar) {\n\t\t\tconst c = this.source.peek();\n\t\t\tresult += this.source.advance();\n\t\t\tif (c === \"\\\\\" && quoteChar === \"\\\"\" && !this.source.eof) result += this.source.advance();\n\t\t}\n\t\tif (this.source.peek() === quoteChar) result += this.source.advance();\n\t\treturn result;\n\t}\n\tclassifyWord(spelling, start, flags$1) {\n\t\tif (NUMBER_PATTERN.test(spelling)) return this.makeToken(TokenKind.NUMBER, spelling, start, flags$1);\n\t\tif (NAME_PATTERN.test(spelling)) return this.makeToken(TokenKind.NAME, spelling, start, flags$1);\n\t\treturn this.makeToken(TokenKind.WORD, spelling, start, flags$1);\n\t}\n\tskipWhitespace() {\n\t\twhile (!this.source.eof) {\n\t\t\tconst c = this.source.peek();\n\t\t\tif (c === \" \" || c === \"\t\") this.source.advance();\n\t\t\telse if (c === \"\\\\\" && this.source.peek(1) === \"\\n\") {\n\t\t\t\tthis.source.advance();\n\t\t\t\tthis.source.advance();\n\t\t\t} else break;\n\t\t}\n\t}\n\treadComment(start) {\n\t\tlet spelling = \"\";\n\t\twhile (!this.source.eof && this.source.peek() !== \"\\n\") spelling += this.source.advance();\n\t\treturn this.makeToken(TokenKind.COMMENT, spelling, start);\n\t}\n\tisSpecialChar(c) {\n\t\treturn \" \t\\n|<>()\\\"'\\\\*?[#\".includes(c);\n\t}\n\tisWordBoundary(c) {\n\t\treturn WORD_BOUNDARY_CHARS.has(c) || c === \"\\0\";\n\t}\n\tmakeToken(kind, spelling, start, flags$1 = createEmptyFlags()) {\n\t\treturn new Token(kind, spelling, start.span(this.source.position), flags$1);\n\t}\n};\n\n//#endregion\n//#region src/parser/ast.ts\n/**\n* Base class for all AST nodes.\n* Every node has a source span for error reporting.\n*/\nvar ASTNode = class {\n\tspan;\n\tconstructor(span) {\n\t\tthis.span = span;\n\t}\n};\n/**\n* Root AST node representing a complete program.\n* A program is a single pipeline (Fish subset does not support multiple statements).\n*/\nvar Program = class extends ASTNode {\n\tpipeline;\n\tconstructor(span, pipeline) {\n\t\tsuper(span);\n\t\tthis.pipeline = pipeline;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitProgram(this);\n\t}\n};\n/**\n* A pipeline of one or more commands connected by pipes.\n* Example: `ls | grep foo | sort`\n*/\nvar Pipeline = class extends ASTNode {\n\tcommands;\n\tconstructor(span, commands) {\n\t\tsuper(span);\n\t\tthis.commands = commands;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitPipeline(this);\n\t}\n};\n/**\n* A simple command with a name, arguments, and optional redirections.\n* Example: `grep -n pattern file.txt > output.txt`\n*/\nvar SimpleCommand = class extends ASTNode {\n\t/** The command name (first word) */\n\tname;\n\t/** Command arguments (remaining words) */\n\targs;\n\t/** Redirections (Phase 2) */\n\tredirections;\n\tconstructor(span, name, args, redirections = []) {\n\t\tsuper(span);\n\t\tthis.name = name;\n\t\tthis.args = args;\n\t\tthis.redirections = redirections;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitSimpleCommand(this);\n\t}\n};\n/**\n* A word is a sequence of word parts.\n* Parts can be literals, globs, or command substitutions.\n* Example: `foo*.txt` has a literal part \"foo\", a glob part \"*\", and a literal part \".txt\"\n*/\nvar Word = class extends ASTNode {\n\tparts;\n\t/** True if the word was quoted (single or double) */\n\tquoted;\n\tconstructor(span, parts, quoted = false) {\n\t\tsuper(span);\n\t\tthis.parts = parts;\n\t\tthis.quoted = quoted;\n\t}\n\t/**\n\t* Get the literal value if this word has no expansions.\n\t* Returns null if the word contains globs or command substitutions.\n\t*/\n\tget literalValue() {\n\t\tif (this.parts.every((p) => p.kind === \"literal\")) return this.parts.map((p) => p.value).join(\"\");\n\t\treturn null;\n\t}\n\t/**\n\t* Check if this word contains any glob patterns.\n\t*/\n\tget hasGlob() {\n\t\treturn this.parts.some((p) => p.kind === \"glob\");\n\t}\n\t/**\n\t* Check if this word contains command substitution.\n\t*/\n\tget hasCommandSub() {\n\t\treturn this.parts.some((p) => p.kind === \"commandSub\");\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitWord(this);\n\t}\n};\n/**\n* A literal string part of a word.\n*/\nvar LiteralPart = class {\n\tkind = \"literal\";\n\tspan;\n\tvalue;\n\tconstructor(span, value) {\n\t\tthis.span = span;\n\t\tthis.value = value;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitLiteralPart(this);\n\t}\n};\n/**\n* A glob pattern part of a word.\n* Examples: `*`, `?`, `[abc]`, `[a-z]`, `[!abc]`\n*/\nvar GlobPart = class {\n\tkind = \"glob\";\n\tspan;\n\tpattern;\n\tconstructor(span, pattern) {\n\t\tthis.span = span;\n\t\tthis.pattern = pattern;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitGlobPart(this);\n\t}\n};\n/**\n* A command substitution part of a word.\n* Example: `(ls -la)`\n*\n* The inner program is parsed recursively.\n*/\nvar CommandSubPart = class {\n\tkind = \"commandSub\";\n\tspan;\n\t/** The inner program to execute */\n\tprogram;\n\tconstructor(span, program) {\n\t\tthis.span = span;\n\t\tthis.program = program;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitCommandSubPart(this);\n\t}\n};\n/**\n* A redirection (input or output).\n* Examples: `< input.txt`, `> output.txt`\n*/\nvar Redirection = class extends ASTNode {\n\tredirectKind;\n\ttarget;\n\tconstructor(span, redirectKind, target) {\n\t\tsuper(span);\n\t\tthis.redirectKind = redirectKind;\n\t\tthis.target = target;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitRedirection(this);\n\t}\n};\n\n//#endregion\n//#region src/parser/command.ts\n/**\n* Command parser for the Fish subset parser.\n*\n* Handles parsing of commands:\n* - Simple commands (name + args)\n* - Redirections (< > Phase 2)\n*/\n/**\n* Parser for commands.\n*\n* A command in the Fish subset is:\n* - A simple command: name followed by arguments and optional redirections\n*\n* Fish subset does NOT support:\n* - Compound commands (if, for, while, function, etc.)\n* - Background execution (&)\n* - Semicolons (;)\n*/\nvar CommandParser = class {\n\tparser;\n\twordParser;\n\tconstructor(parser, wordParser) {\n\t\tthis.parser = parser;\n\t\tthis.wordParser = wordParser;\n\t}\n\t/**\n\t* Parse a command.\n\t* Returns null if no command is present.\n\t*/\n\tparseCommand() {\n\t\treturn this.parseSimpleCommand();\n\t}\n\t/**\n\t* Parse a simple command: name + args + redirections.\n\t*\n\t* Grammar:\n\t* simple_command ::= word+ (redirection)*\n\t*/\n\tparseSimpleCommand() {\n\t\tconst startPos = this.parser.currentToken.span.start;\n\t\tconst name = this.wordParser.parseWord();\n\t\tif (!name) return null;\n\t\tconst args = [];\n\t\tconst redirections = [];\n\t\twhile (!this.isCommandTerminator()) {\n\t\t\tconst redir = this.parseRedirection();\n\t\t\tif (redir) {\n\t\t\t\tredirections.push(redir);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst word = this.wordParser.parseWord();\n\t\t\tif (word) args.push(word);\n\t\t\telse break;\n\t\t}\n\t\tconst endPos = this.parser.previousTokenPosition;\n\t\treturn new SimpleCommand(new SourceSpan(startPos, endPos), name, args, redirections);\n\t}\n\t/**\n\t* Parse a redirection if present.\n\t*\n\t* Grammar:\n\t* redirection ::= '<' word | '>' word\n\t*/\n\tparseRedirection() {\n\t\tconst token = this.parser.currentToken;\n\t\tif (token.kind === TokenKind.LESS) {\n\t\t\tconst startPos = token.span.start;\n\t\t\tthis.parser.advance();\n\t\t\tconst target = this.wordParser.parseWord();\n\t\t\tif (!target) {\n\t\t\t\tthis.parser.syntacticError(\"Expected filename after <\", \"word\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst endPos = this.parser.previousTokenPosition;\n\t\t\treturn new Redirection(new SourceSpan(startPos, endPos), \"input\", target);\n\t\t}\n\t\tif (token.kind === TokenKind.GREAT) {\n\t\t\tconst startPos = token.span.start;\n\t\t\tthis.parser.advance();\n\t\t\tconst target = this.wordParser.parseWord();\n\t\t\tif (!target) {\n\t\t\t\tthis.parser.syntacticError(\"Expected filename after >\", \"word\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst endPos = this.parser.previousTokenPosition;\n\t\t\treturn new Redirection(new SourceSpan(startPos, endPos), \"output\", target);\n\t\t}\n\t\treturn null;\n\t}\n\t/**\n\t* Check if current token terminates a command.\n\t*/\n\tisCommandTerminator() {\n\t\tconst kind = this.parser.currentToken.kind;\n\t\treturn kind === TokenKind.PIPE || kind === TokenKind.NEWLINE || kind === TokenKind.EOF;\n\t}\n};\n\n//#endregion\n//#region src/parser/error-reporter.ts\n/**\n* Error reporter for collecting parser diagnostics.\n*\n* Supports both immediate error throwing and error collection modes.\n*/\nvar ErrorReporter = class {\n\tdiagnostics = [];\n\terrorCount = 0;\n\twarningCount = 0;\n\t/**\n\t* Report an error.\n\t*/\n\treportError(message, span, code) {\n\t\tthis.diagnostics.push({\n\t\t\tseverity: \"error\",\n\t\t\tmessage,\n\t\t\tspan,\n\t\t\tcode\n\t\t});\n\t\tthis.errorCount++;\n\t}\n\t/**\n\t* Report a warning.\n\t*/\n\treportWarning(message, span, code) {\n\t\tthis.diagnostics.push({\n\t\t\tseverity: \"warning\",\n\t\t\tmessage,\n\t\t\tspan,\n\t\t\tcode\n\t\t});\n\t\tthis.warningCount++;\n\t}\n\t/**\n\t* Report an informational message.\n\t*/\n\treportInfo(message, span, code) {\n\t\tthis.diagnostics.push({\n\t\t\tseverity: \"info\",\n\t\t\tmessage,\n\t\t\tspan,\n\t\t\tcode\n\t\t});\n\t}\n\t/**\n\t* Check if any errors have been reported.\n\t*/\n\thasErrors() {\n\t\treturn this.errorCount > 0;\n\t}\n\t/**\n\t* Check if any warnings have been reported.\n\t*/\n\thasWarnings() {\n\t\treturn this.warningCount > 0;\n\t}\n\t/**\n\t* Get the number of errors.\n\t*/\n\tgetErrorCount() {\n\t\treturn this.errorCount;\n\t}\n\t/**\n\t* Get the number of warnings.\n\t*/\n\tgetWarningCount() {\n\t\treturn this.warningCount;\n\t}\n\t/**\n\t* Get all diagnostics.\n\t*/\n\tgetDiagnostics() {\n\t\treturn this.diagnostics;\n\t}\n\t/**\n\t* Get only error diagnostics.\n\t*/\n\tgetErrors() {\n\t\treturn this.diagnostics.filter((d) => d.severity === \"error\");\n\t}\n\t/**\n\t* Get only warning diagnostics.\n\t*/\n\tgetWarnings() {\n\t\treturn this.diagnostics.filter((d) => d.severity === \"warning\");\n\t}\n\t/**\n\t* Clear all diagnostics.\n\t*/\n\tclear() {\n\t\tthis.diagnostics.length = 0;\n\t\tthis.errorCount = 0;\n\t\tthis.warningCount = 0;\n\t}\n\t/**\n\t* Format all diagnostics as a string for display.\n\t*/\n\tformat() {\n\t\treturn this.diagnostics.map((d) => {\n\t\t\tconst loc = `${d.span.start.line}:${d.span.start.column}`;\n\t\t\tlet prefix;\n\t\t\tif (d.severity === \"error\") prefix = \"Error\";\n\t\t\telse if (d.severity === \"warning\") prefix = \"Warning\";\n\t\t\telse prefix = \"Info\";\n\t\t\tconst code = d.code ? ` [${d.code}]` : \"\";\n\t\t\treturn `${prefix}${code} at ${loc}: ${d.message}`;\n\t\t}).join(\"\\n\");\n\t}\n};\n\n//#endregion\n//#region src/parser/statement.ts\n/**\n* Statement parser for the Fish subset parser.\n*\n* Handles parsing of:\n* - Pipelines (command | command | ...)\n*\n* Fish subset does NOT support:\n* - Multiple statements (no ; or newline-separated statements)\n* - Control flow (if, for, while, etc.)\n*/\n/**\n* Parser for statements and pipelines.\n*\n* In the Fish subset, a program is a single pipeline.\n*/\nvar StatementParser = class {\n\tparser;\n\tcommandParser;\n\tconstructor(parser, commandParser) {\n\t\tthis.parser = parser;\n\t\tthis.commandParser = commandParser;\n\t}\n\t/**\n\t* Parse a pipeline.\n\t*\n\t* Grammar:\n\t* pipeline ::= command ('|' command)*\n\t*/\n\tparsePipeline() {\n\t\tconst startPos = this.parser.currentToken.span.start;\n\t\tconst firstCommand = this.commandParser.parseCommand();\n\t\tif (!firstCommand) return null;\n\t\tconst commands = [firstCommand];\n\t\twhile (this.parser.currentToken.kind === TokenKind.PIPE) {\n\t\t\tthis.parser.advance();\n\t\t\tthis.skipNewlines();\n\t\t\tconst command = this.commandParser.parseCommand();\n\t\t\tif (!command) {\n\t\t\t\tthis.parser.syntacticError(\"Expected command after |\", \"command\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcommands.push(command);\n\t\t}\n\t\tconst endPos = this.parser.previousTokenPosition;\n\t\treturn new Pipeline(new SourceSpan(startPos, endPos), commands);\n\t}\n\t/**\n\t* Skip newline tokens (for line continuation after pipe).\n\t*/\n\tskipNewlines() {\n\t\twhile (this.parser.currentToken.kind === TokenKind.NEWLINE) this.parser.advance();\n\t}\n};\n\n//#endregion\n//#region src/parser/syntax-error.ts\n/**\n* Exception thrown when a syntax error is encountered during parsing.\n*/\nvar ParseSyntaxError = class ParseSyntaxError extends Error {\n\t/** The source span where the error occurred */\n\tspan;\n\t/** Additional context about the error */\n\tcontext;\n\tconstructor(message, span, context) {\n\t\tsuper(ParseSyntaxError.formatMessage(message, span, context));\n\t\tthis.name = \"ParseSyntaxError\";\n\t\tthis.span = span;\n\t\tthis.context = context;\n\t\tif (Error.captureStackTrace) Error.captureStackTrace(this, ParseSyntaxError);\n\t}\n\t/**\n\t* Format an error message with position information.\n\t*/\n\tstatic formatMessage(message, span, context) {\n\t\tconst base = `Syntax error at ${`${span.start.line}:${span.start.column}`}: ${message}`;\n\t\treturn context ? `${base} (${context})` : base;\n\t}\n\t/**\n\t* Get the line number where the error occurred.\n\t*/\n\tget line() {\n\t\treturn this.span.start.line;\n\t}\n\t/**\n\t* Get the column number where the error occurred.\n\t*/\n\tget column() {\n\t\treturn this.span.start.column;\n\t}\n};\n/**\n* Exception thrown when the parser encounters an unexpected end of input.\n*/\nvar UnexpectedEOFError = class extends ParseSyntaxError {\n\tconstructor(expected, span) {\n\t\tsuper(`Unexpected end of input, expected ${expected}`, span);\n\t\tthis.name = \"UnexpectedEOFError\";\n\t}\n};\n/**\n* Exception thrown when the parser encounters an unexpected token.\n*/\nvar UnexpectedTokenError = class extends ParseSyntaxError {\n\tfound;\n\texpected;\n\tconstructor(found, expected, span) {\n\t\tsuper(`Unexpected token '${found}', expected ${expected}`, span);\n\t\tthis.name = \"UnexpectedTokenError\";\n\t\tthis.found = found;\n\t\tthis.expected = expected;\n\t}\n};\n\n//#endregion\n//#region src/parser/word.ts\n/**\n* Word parser for the Fish subset parser.\n*\n* Handles parsing of words and their components:\n* - Literal text\n* - Glob patterns (* ? [...])\n* - Command substitution (...)\n* - Quoted strings\n*/\n/**\n* Parser for words and word parts.\n*\n* A word can consist of:\n* - Literal parts (plain text)\n* - Glob parts (* ? [...])\n* - Command substitution parts (...)\n*/\nvar WordParser = class {\n\tparser;\n\tconstructor(parser) {\n\t\tthis.parser = parser;\n\t}\n\t/**\n\t* Parse a single word from the current position.\n\t* Returns null if no word is present.\n\t*\n\t* A word consists of a single token from the scanner.\n\t* The token may contain multiple parts (literal, glob, command substitution)\n\t* which are parsed and combined into a single Word AST node.\n\t*/\n\tparseWord() {\n\t\tconst token = this.parser.currentToken;\n\t\tif (!this.isWordToken(token)) return null;\n\t\tconst startPos = token.span.start;\n\t\tconst part = this.parseWordPart(token);\n\t\tconst parts = part ? [part] : [];\n\t\tif (parts.length === 0) return null;\n\t\tthis.parser.advance();\n\t\tconst endPos = token.span.end;\n\t\tconst span = new SourceSpan(startPos, endPos);\n\t\tconst quoted = token.isQuoted;\n\t\treturn new Word(span, parts, quoted);\n\t}\n\t/**\n\t* Parse a single word part from a token.\n\t*/\n\tparseWordPart(token) {\n\t\tif (token.hasExpansions) return this.parseCommandSubstitution(token);\n\t\tif (token.hasGlob) return this.parseGlobPart(token);\n\t\treturn new LiteralPart(token.span, token.spelling);\n\t}\n\t/**\n\t* Parse a command substitution from a token.\n\t* The token spelling contains the full (...) content.\n\t*/\n\tparseCommandSubstitution(token) {\n\t\tlet inner = token.spelling;\n\t\tif (inner.startsWith(\"(\") && inner.endsWith(\")\")) inner = inner.slice(1, -1);\n\t\tconst innerProgram = this.parser.parseSubstitution(inner);\n\t\treturn new CommandSubPart(token.span, innerProgram);\n\t}\n\t/**\n\t* Parse a glob pattern from a token.\n\t*/\n\tparseGlobPart(token) {\n\t\treturn new GlobPart(token.span, token.spelling);\n\t}\n\t/**\n\t* Check if a token can be part of a word.\n\t*/\n\tisWordToken(token) {\n\t\tconst kind = token.kind;\n\t\treturn kind === TokenKind.WORD || kind === TokenKind.NAME || kind === TokenKind.NUMBER || kind === TokenKind.GLOB || kind === TokenKind.COMMAND_SUB;\n\t}\n};\n\n//#endregion\n//#region src/parser/parser.ts\n/**\n* Main parser for the Fish subset language.\n*\n* This is a modular, recursive descent (LL-style) parser inspired by\n* the VC Parser architecture. It uses single-token lookahead (LL(1))\n* and streams tokens from the lexer.\n*\n* The parser delegates to sub-parsers:\n* - StatementParser: pipelines\n* - CommandParser: simple commands\n* - WordParser: words and expansions\n*\n* Fish subset features supported:\n* - Pipelines (|)\n* - Command substitution (...)\n* - Globbing (* ? [...])\n* - Redirections (< >) - Phase 2\n* - Comments (#)\n*\n* NOT supported:\n* - Variables ($var)\n* - Control flow (if, for, while, etc.)\n* - Functions\n* - Brace expansion\n* - Semicolons\n* - Background jobs (&)\n*/\n/**\n* Main parser class for the Fish subset language.\n*\n* Usage:\n* ```typescript\n* const parser = new Parser('ls | grep foo');\n* const ast = parser.parse();\n* ```\n*/\nvar Parser = class Parser {\n\t/** The scanner/lexer for tokenization */\n\tscanner;\n\t/** Error reporter for collecting diagnostics */\n\terrorReporter;\n\t/** Current token being examined */\n\t_currentToken;\n\t/** Position of the previous token (for span tracking) */\n\t_previousTokenPosition;\n\t/** Sub-parsers */\n\twordParser;\n\tcommandParser;\n\tstatementParser;\n\t/** Recursion depth for command substitution */\n\tsubstitutionDepth;\n\t/** Maximum recursion depth */\n\tstatic MAX_SUBSTITUTION_DEPTH = 10;\n\tconstructor(input, errorReporter, depth = 0) {\n\t\tthis.scanner = typeof input === \"string\" ? new Scanner(input) : input;\n\t\tthis.errorReporter = errorReporter ?? new ErrorReporter();\n\t\tthis.substitutionDepth = depth;\n\t\tthis._currentToken = this.scanner.getToken();\n\t\tthis._previousTokenPosition = this._currentToken.span.start;\n\t\tthis.wordParser = new WordParser(this);\n\t\tthis.commandParser = new CommandParser(this, this.wordParser);\n\t\tthis.statementParser = new StatementParser(this, this.commandParser);\n\t}\n\t/**\n\t* Parse the input and return a Program AST.\n\t* @throws SyntaxError if the input is invalid\n\t*/\n\tparse() {\n\t\treturn this.parseProgram();\n\t}\n\t/**\n\t* Get the error reporter for accessing diagnostics.\n\t*/\n\tgetErrorReporter() {\n\t\treturn this.errorReporter;\n\t}\n\t/**\n\t* Get the current token.\n\t*/\n\tget currentToken() {\n\t\treturn this._currentToken;\n\t}\n\t/**\n\t* Get the position of the previous token.\n\t*/\n\tget previousTokenPosition() {\n\t\treturn this._previousTokenPosition;\n\t}\n\t/**\n\t* Advance to the next token.\n\t*/\n\tadvance() {\n\t\tthis._previousTokenPosition = this._currentToken.span.end;\n\t\tthis._currentToken = this.scanner.getToken();\n\t}\n\t/**\n\t* Match the current token against an expected kind.\n\t* Advances if matched, throws error if not.\n\t*\n\t* @param expected The expected token kind\n\t* @throws SyntaxError if the current token doesn't match\n\t*/\n\tmatch(expected) {\n\t\tif (this._currentToken.kind === expected) {\n\t\t\tthis._previousTokenPosition = this._currentToken.span.end;\n\t\t\tthis._currentToken = this.scanner.getToken();\n\t\t} else this.syntacticError(`Expected ${Token.kindName(expected)}`, Token.kindName(expected));\n\t}\n\t/**\n\t* Accept a token if it matches the expected kind.\n\t* Returns true and advances if matched, false otherwise.\n\t*\n\t* @param expected The expected token kind\n\t* @returns true if the token was accepted\n\t*/\n\taccept(expected) {\n\t\tif (this._currentToken.kind === expected) {\n\t\t\tthis._previousTokenPosition = this._currentToken.span.end;\n\t\t\tthis._currentToken = this.scanner.getToken();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t* Check if the current token matches the expected kind.\n\t* Does not advance.\n\t*\n\t* @param expected The expected token kind\n\t* @returns true if the current token matches\n\t*/\n\tcheck(expected) {\n\t\treturn this._currentToken.kind === expected;\n\t}\n\t/**\n\t* Start tracking a span from the current token position.\n\t*/\n\tstartSpan() {\n\t\treturn this._currentToken.span.start;\n\t}\n\t/**\n\t* Finish a span at the previous token position.\n\t*/\n\tfinishSpan(start) {\n\t\treturn new SourceSpan(start, this._previousTokenPosition);\n\t}\n\t/**\n\t* Report a syntactic error and throw an exception.\n\t*\n\t* @param message Error message\n\t* @param expected What was expected (for error context)\n\t* @throws SyntaxError always\n\t*/\n\tsyntacticError(message, expected) {\n\t\tconst span = this._currentToken.span;\n\t\tthis.errorReporter.reportError(message, span);\n\t\tif (this._currentToken.kind === TokenKind.EOF) throw new UnexpectedEOFError(expected, span);\n\t\tthrow new UnexpectedTokenError(this._currentToken.spelling || Token.kindName(this._currentToken.kind), expected, span);\n\t}\n\t/**\n\t* Parse a complete program.\n\t*\n\t* Grammar:\n\t* program ::= pipeline\n\t*/\n\tparseProgram() {\n\t\tconst startPos = this.startSpan();\n\t\tthis.skipIgnorable();\n\t\tconst pipeline = this.statementParser.parsePipeline();\n\t\tif (!pipeline) this.syntacticError(\"Expected command\", \"command\");\n\t\tthis.skipIgnorable();\n\t\tif (this._currentToken.kind !== TokenKind.EOF) this.syntacticError(\"Unexpected token after pipeline\", \"end of input\");\n\t\treturn new Program(this.finishSpan(startPos), pipeline);\n\t}\n\t/**\n\t* Parse a command substitution (inner program).\n\t* Called recursively when parsing (...) content.\n\t*\n\t* @param input The inner content of the command substitution\n\t* @returns The parsed program\n\t*/\n\tparseSubstitution(input) {\n\t\tif (this.substitutionDepth >= Parser.MAX_SUBSTITUTION_DEPTH) throw new ParseSyntaxError(\"Maximum command substitution depth exceeded\", this._currentToken.span);\n\t\treturn new Parser(input, this.errorReporter, this.substitutionDepth + 1).parse();\n\t}\n\t/**\n\t* Skip comments and newlines.\n\t*/\n\tskipIgnorable() {\n\t\twhile (this._currentToken.kind === TokenKind.COMMENT || this._currentToken.kind === TokenKind.NEWLINE) this.advance();\n\t}\n};\n/**\n* Parse a Fish subset input string and return the AST.\n*\n* @param input The input string to parse\n* @returns The parsed Program AST\n* @throws SyntaxError if the input is invalid\n*/\nfunction parse(input) {\n\treturn new Parser(input).parse();\n}\n\n//#endregion\nexport { Parser, cmd, commandSub, compile, expandedWordToString, extractPathsFromExpandedWords, glob, literal, parse };","import type { Record } from '../record';\nimport type { Stream } from '../stream';\n\n/**\n * A Consumer terminates a stream.\n * It pulls values and produces a final result or side-effect.\n */\nexport type Consumer<T, R = void> = (input: Stream<T>) => Promise<R>;\n\n/**\n * Collects the entire stream into memory.\n * Pure from an API perspective.\n */\nexport function collect<T>(): Consumer<T, T[]> {\n\treturn async (input) => {\n\t\tconst out: T[] = [];\n\t\tfor await (const item of input) {\n\t\t\tout.push(item);\n\t\t}\n\t\treturn out;\n\t};\n}\n\n/**\n * Streams records directly to stdout.\n * Side-effecting, non-buffering.\n */\nexport function stdout(): Consumer<Record> {\n\treturn async (input) => {\n\t\tfor await (const record of input) {\n\t\t\tprocess.stdout.write(`${format(record)}\\n`);\n\t\t}\n\t};\n}\n\nfunction format(record: Record): string {\n\tswitch (record.kind) {\n\t\tcase 'line':\n\t\t\treturn record.text;\n\t\tcase 'json':\n\t\t\treturn JSON.stringify(record.value);\n\t\tcase 'file':\n\t\t\treturn record.path;\n\t\tdefault:\n\t\t\tthrow new Error('Unknown record kind');\n\t}\n}\n","import type { FS } from '../../fs/fs';\nimport type { FileRecord, LineRecord } from '../../record';\nimport type { Transducer } from '../types';\n\nexport function cat(fs: FS): Transducer<FileRecord, LineRecord> {\n\treturn async function* (input) {\n\t\tfor await (const file of input) {\n\t\t\tlet lineNum = 1;\n\t\t\tfor await (const text of fs.readLines(file.path)) {\n\t\t\t\tyield {\n\t\t\t\t\tfile: file.path,\n\t\t\t\t\tkind: 'line',\n\t\t\t\t\tlineNum: lineNum++,\n\t\t\t\t\ttext,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t};\n}\n","import type { FS } from '../../fs/fs';\nimport type { Effect } from '../types';\n\n// export function cp(fs: FS, dest: string): Sink<FileRecord, void> {\n// \treturn async (input) => {\n// \t\tfor await (const record of input) {\n// \t\t\tconst content = await fs.readFile(record.path);\n// \t\t\tawait fs.writeFile(dest, content);\n// \t\t}\n// \t};\n// }\n\n// export function cp(fs: FS): Effect<{ srcs: string[]; dest: string }> {\n// \treturn async ({ srcs, dest }) => {\n// \t\tawait Promise.all(\n// \t\t\tsrcs.map(async (src) => {\n// \t\t\t\tconst content = await fs.readFile(src);\n// \t\t\t\tawait fs.writeFile(dest, content);\n// \t\t\t})\n// \t\t);\n// \t};\n// }\n\n// missing recursive ?\n\nexport function cp(\n\tfs: FS\n): Effect<{ src: string; dest: string; recursive: boolean }> {\n\treturn async ({ src, dest }) => {\n\t\tconst content = await fs.readFile(src);\n\t\tawait fs.writeFile(dest, content);\n\t};\n}\n","import type { FS } from '../../fs/fs';\nimport type { FileRecord, LineRecord } from '../../record';\nimport type { Transducer } from '../types';\n\nexport function head(fs: FS): Transducer<FileRecord, LineRecord> {\n\treturn async function* (input) {\n\t\tfor await (const file of input) {\n\t\t\tlet lineNum = 0;\n\t\t\tfor await (const text of fs.readLines(file.path)) {\n\t\t\t\tif (lineNum >= 10) {\n\t\t\t\t\tbreak; // Default to 10 lines\n\t\t\t\t}\n\t\t\t\tyield {\n\t\t\t\t\tfile: file.path,\n\t\t\t\t\tkind: 'line',\n\t\t\t\t\tlineNum: ++lineNum,\n\t\t\t\t\ttext,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t};\n}\n\nexport function headWithN(\n\tfs: FS,\n\tn: number\n): Transducer<FileRecord, LineRecord> {\n\treturn async function* (input) {\n\t\tfor await (const file of input) {\n\t\t\tlet lineNum = 0;\n\t\t\tfor await (const text of fs.readLines(file.path)) {\n\t\t\t\tif (lineNum >= n) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tyield {\n\t\t\t\t\tfile: file.path,\n\t\t\t\t\tkind: 'line',\n\t\t\t\t\tlineNum: ++lineNum,\n\t\t\t\t\ttext,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t};\n}\n","import type { FS } from '../../fs/fs';\nimport type { FileRecord } from '../../record';\nimport type { Stream } from '../../stream';\n\nexport async function* ls(fs: FS, path: string): Stream<FileRecord> {\n\tfor await (const p of fs.readdir(path)) {\n\t\tyield { kind: 'file', path: p };\n\t}\n}\n","import type { FS } from '../../fs/fs';\nimport type { Effect } from '../types';\n\nexport function mkdir(fs: FS): Effect<{\n\tpath: string;\n\trecursive: boolean;\n}> {\n\treturn async ({ path, recursive }) => {\n\t\tawait fs.mkdir(path, recursive);\n\t};\n}\n","import type { FS } from '../../fs/fs';\nimport type { Effect } from '../types';\n\nconst MULTIPLE_SLASH_REGEX = /\\/+/g;\n\nfunction extractFileName(path: string): string {\n\tconst lastSlashIndex = path.lastIndexOf('/');\n\tif (lastSlashIndex === -1) {\n\t\treturn path;\n\t}\n\treturn path.slice(lastSlashIndex + 1);\n}\n\nexport function mv(fs: FS): Effect<{ srcs: string[]; dest: string }> {\n\treturn async ({ srcs, dest }) => {\n\t\tif (srcs.length === 1) {\n\t\t\tconst src = srcs[0];\n\t\t\tif (src === undefined) {\n\t\t\t\tthrow new Error('Source path is required');\n\t\t\t}\n\t\t\t// Check if dest is a directory\n\t\t\ttry {\n\t\t\t\tconst destStat = await fs.stat(dest);\n\t\t\t\tif (destStat.isDirectory) {\n\t\t\t\t\t// Move file into directory\n\t\t\t\t\tconst fileName = extractFileName(src);\n\t\t\t\t\tconst newPath = `${dest}/${fileName}`.replace(\n\t\t\t\t\t\tMULTIPLE_SLASH_REGEX,\n\t\t\t\t\t\t'/'\n\t\t\t\t\t);\n\t\t\t\t\tawait moveFile(fs, src, newPath);\n\t\t\t\t} else {\n\t\t\t\t\t// Dest is a file, throw error\n\t\t\t\t\tthrow new Error(`Destination file already exists: ${dest}`);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\t// Check if error is about existing file\n\t\t\t\tif ((error as Error).message.includes('already exists')) {\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\t// Dest doesn't exist, move src to dest\n\t\t\t\tawait moveFile(fs, src, dest);\n\t\t\t}\n\t\t} else {\n\t\t\t// If multiple sources, dest must be a directory\n\t\t\t// and each source is moved into that directory\n\t\t\tfor (const src of srcs) {\n\t\t\t\tconst fileName = extractFileName(src);\n\t\t\t\tconst fullDest = dest.endsWith('/')\n\t\t\t\t\t? dest + fileName\n\t\t\t\t\t: `${dest}/${fileName}`;\n\t\t\t\tconst newPath = fullDest.replace(MULTIPLE_SLASH_REGEX, '/');\n\t\t\t\tawait moveFile(fs, src, newPath);\n\t\t\t}\n\t\t}\n\t};\n}\n\nasync function moveFile(fs: FS, src: string, dest: string): Promise<void> {\n\tconst content = await fs.readFile(src);\n\tawait fs.writeFile(dest, content);\n\tawait fs.deleteFile(src);\n}\n","import type { FS } from '../../fs/fs';\nimport type { Effect } from '../types';\n\nexport function rm(fs: FS): Effect<{ path: string; recursive: boolean }> {\n\treturn async ({ path }) => {\n\t\tawait fs.deleteFile(path);\n\t};\n}\n","import type { LineRecord } from '../../record';\nimport type { Transducer } from '../types';\n\nexport function tail(n: number): Transducer<LineRecord, LineRecord> {\n\treturn async function* (input) {\n\t\tconst buf: LineRecord[] = [];\n\t\tfor await (const x of input) {\n\t\t\tbuf.push(x);\n\t\t\tif (buf.length > n) {\n\t\t\t\tbuf.shift();\n\t\t\t}\n\t\t}\n\t\tyield* buf;\n\t};\n}\n","import type { FS } from '../../fs/fs';\nimport type { Effect } from '../types';\n\nexport function touch(fs: FS): Effect<{ files: string[] }> {\n\treturn async ({ files }) => {\n\t\tfor (const file of files) {\n\t\t\tif (!(await fs.exists(file))) {\n\t\t\t\tawait fs.writeFile(file, new Uint8Array());\n\t\t\t}\n\t\t}\n\t};\n}\n","import type { FS } from '../fs/fs';\nimport type { Transducer } from '../operator/types';\nimport type { FileRecord, LineRecord } from '../record';\nimport type { Stream } from '../stream';\n\nexport function lines(fs: FS): Transducer<FileRecord, LineRecord> {\n\treturn async function* (input) {\n\t\tfor await (const f of input) {\n\t\t\tlet lineNum = 1;\n\t\t\tfor await (const line of fs.readLines(f.path)) {\n\t\t\t\tyield {\n\t\t\t\t\tfile: f.path,\n\t\t\t\t\tkind: 'line',\n\t\t\t\t\tlineNum: lineNum++,\n\t\t\t\t\ttext: line,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t};\n}\n\nexport async function* files(...paths: string[]): Stream<FileRecord> {\n\tfor (const path of paths) {\n\t\tyield { kind: 'file', path };\n\t}\n}\n","import {\n\texpandedWordToString,\n\textractPathsFromExpandedWords,\n\ttype PipelineIR,\n\ttype RedirectionIR,\n\ttype StepIR,\n} from '@shfs/compiler';\nimport { map, pipe } from 'remeda';\nimport type { FS } from '../fs/fs';\nimport { cat } from '../operator/cat/cat';\nimport { cp } from '../operator/cp/cp';\nimport { headWithN } from '../operator/head/head';\nimport { ls } from '../operator/ls/ls';\nimport { mkdir } from '../operator/mkdir/mkdir';\nimport { mv } from '../operator/mv/mv';\nimport { rm } from '../operator/rm/rm';\nimport { tail } from '../operator/tail/tail';\nimport { touch } from '../operator/touch/touch';\nimport type { Record } from '../record';\nimport type { Stream } from '../stream';\nimport { files } from './producers';\n\nexport type ExecuteResult =\n\t| { kind: 'stream'; value: Stream<Record> }\n\t| { kind: 'sink'; value: Promise<void> };\n\nconst textEncoder = new TextEncoder();\n\n/**\n * Execute compiles a PipelineIR into an executable result.\n * Returns either a stream (for producers/transducers) or a promise (for sinks).\n */\nexport function execute(ir: PipelineIR, fs: FS): ExecuteResult {\n\tconst step = ir.steps[0];\n\tif (!step) {\n\t\treturn {\n\t\t\tkind: 'stream',\n\t\t\tvalue: (async function* () {\n\t\t\t\t// Empty stream - no steps to execute\n\t\t\t})(),\n\t\t};\n\t}\n\n\tlet result: ExecuteResult;\n\n\tswitch (step.cmd) {\n\t\tcase 'cat': {\n\t\t\tconst inputPath = getRedirectPath(step.redirections, 'input');\n\t\t\tconst filePaths = withInputRedirect(\n\t\t\t\textractPathsFromExpandedWords(step.args.files),\n\t\t\t\tinputPath\n\t\t\t);\n\t\t\tresult = {\n\t\t\t\tkind: 'stream',\n\t\t\t\tvalue: pipe(files(...filePaths), cat(fs)),\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase 'cp': {\n\t\t\tconst srcPaths = extractPathsFromExpandedWords(step.args.srcs);\n\t\t\tconst destPath = expandedWordToString(step.args.dest);\n\t\t\tresult = {\n\t\t\t\tkind: 'sink',\n\t\t\t\tvalue: Promise.all(\n\t\t\t\t\tmap(srcPaths, (src) =>\n\t\t\t\t\t\tcp(fs)({\n\t\t\t\t\t\t\tsrc,\n\t\t\t\t\t\t\tdest: destPath,\n\t\t\t\t\t\t\trecursive: step.args.recursive,\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t).then(),\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase 'head': {\n\t\t\tconst inputPath = getRedirectPath(step.redirections, 'input');\n\t\t\tconst filePaths = withInputRedirect(\n\t\t\t\textractPathsFromExpandedWords(step.args.files),\n\t\t\t\tinputPath\n\t\t\t);\n\t\t\tresult = {\n\t\t\t\tkind: 'stream',\n\t\t\t\tvalue: pipe(files(...filePaths), headWithN(fs, step.args.n)),\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase 'ls': {\n\t\t\tconst paths = extractPathsFromExpandedWords(step.args.paths);\n\t\t\tresult = {\n\t\t\t\tkind: 'stream',\n\t\t\t\tvalue: (async function* () {\n\t\t\t\t\tconst results = await Promise.all(\n\t\t\t\t\t\tmap(paths, (path) => ls(fs, path))\n\t\t\t\t\t).then();\n\n\t\t\t\t\tfor (const file of results) {\n\t\t\t\t\t\tyield* file;\n\t\t\t\t\t}\n\t\t\t\t})(),\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase 'mkdir': {\n\t\t\tconst paths = extractPathsFromExpandedWords(step.args.paths);\n\t\t\tresult = {\n\t\t\t\tkind: 'sink',\n\t\t\t\tvalue: Promise.all(\n\t\t\t\t\tmap(paths, (path) =>\n\t\t\t\t\t\tmkdir(fs)({ path, recursive: step.args.recursive })\n\t\t\t\t\t)\n\t\t\t\t).then(),\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase 'mv': {\n\t\t\tconst srcPaths = extractPathsFromExpandedWords(step.args.srcs);\n\t\t\tconst destPath = expandedWordToString(step.args.dest);\n\t\t\tresult = {\n\t\t\t\tkind: 'sink',\n\t\t\t\tvalue: mv(fs)({ srcs: srcPaths, dest: destPath }),\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase 'rm': {\n\t\t\tconst paths = extractPathsFromExpandedWords(step.args.paths);\n\t\t\tresult = {\n\t\t\t\tkind: 'sink',\n\t\t\t\tvalue: Promise.all(\n\t\t\t\t\tmap(paths, (path) =>\n\t\t\t\t\t\trm(fs)({ path, recursive: step.args.recursive })\n\t\t\t\t\t)\n\t\t\t\t).then(),\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase 'tail': {\n\t\t\tconst inputPath = getRedirectPath(step.redirections, 'input');\n\t\t\tconst filePaths = withInputRedirect(\n\t\t\t\textractPathsFromExpandedWords(step.args.files),\n\t\t\t\tinputPath\n\t\t\t);\n\t\t\tresult = {\n\t\t\t\tkind: 'stream',\n\t\t\t\tvalue: (async function* () {\n\t\t\t\t\tconst results = await Promise.all(\n\t\t\t\t\t\tmap(filePaths, (file) =>\n\t\t\t\t\t\t\tpipe(files(file), cat(fs), tail(step.args.n))\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\tfor (const lines of results) {\n\t\t\t\t\t\tyield* lines;\n\t\t\t\t\t}\n\t\t\t\t})(),\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase 'touch': {\n\t\t\tconst filePaths = extractPathsFromExpandedWords(step.args.files);\n\t\t\tresult = {\n\t\t\t\tkind: 'sink',\n\t\t\t\tvalue: touch(fs)({ files: filePaths }),\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\tthrow new Error(\n\t\t\t\t`Unknown command: ${String((step as { cmd: string }).cmd)}`\n\t\t\t);\n\t}\n\n\treturn applyOutputRedirect(result, step, fs);\n}\n\nfunction getRedirectPath(\n\tredirections: RedirectionIR[] | undefined,\n\tkind: RedirectionIR['kind']\n): string | null {\n\tif (!redirections) {\n\t\treturn null;\n\t}\n\n\tlet redirectedPath: string | null = null;\n\tfor (const redirection of redirections) {\n\t\tif (redirection.kind === kind) {\n\t\t\tredirectedPath = expandedWordToString(redirection.target);\n\t\t}\n\t}\n\treturn redirectedPath;\n}\n\nfunction withInputRedirect(\n\tpaths: string[],\n\tinputPath: string | null\n): string[] {\n\tif (paths.length > 0 || !inputPath) {\n\t\treturn paths;\n\t}\n\treturn [inputPath];\n}\n\nfunction applyOutputRedirect(\n\tresult: ExecuteResult,\n\tstep: StepIR,\n\tfs: FS\n): ExecuteResult {\n\tconst outputPath = getRedirectPath(step.redirections, 'output');\n\tif (!outputPath) {\n\t\treturn result;\n\t}\n\n\tif (result.kind === 'stream') {\n\t\treturn {\n\t\t\tkind: 'sink',\n\t\t\tvalue: writeStreamToFile(result.value, outputPath, fs),\n\t\t};\n\t}\n\n\treturn {\n\t\tkind: 'sink',\n\t\tvalue: result.value.then(async () => {\n\t\t\tawait fs.writeFile(outputPath, textEncoder.encode(''));\n\t\t}),\n\t};\n}\n\nasync function writeStreamToFile(\n\tstream: Stream<Record>,\n\tpath: string,\n\tfs: FS\n): Promise<void> {\n\tconst outputChunks: string[] = [];\n\tfor await (const record of stream) {\n\t\toutputChunks.push(formatRecord(record));\n\t}\n\tawait fs.writeFile(path, textEncoder.encode(outputChunks.join('\\n')));\n}\n\nfunction formatRecord(record: Record): string {\n\tswitch (record.kind) {\n\t\tcase 'line':\n\t\t\treturn record.text;\n\t\tcase 'file':\n\t\t\treturn record.path;\n\t\tcase 'json':\n\t\t\treturn JSON.stringify(record.value);\n\t\tdefault:\n\t\t\tthrow new Error('Unknown record kind');\n\t}\n}\n","export function lazy<T>(fn: () => T) {\n\tlet value: T | undefined;\n\tlet loaded = false;\n\n\treturn (): T => {\n\t\tif (loaded) {\n\t\t\treturn value as T;\n\t\t}\n\n\t\tloaded = true;\n\t\tvalue = fn();\n\t\treturn value as T;\n\t};\n}\n","import { compile, type PipelineIR, parse } from '@shfs/compiler';\n\nimport { collect } from '../consumer/consumer';\nimport { type ExecuteResult, execute } from '../execute/execute';\nimport type { FS } from '../fs/fs';\nimport type { Record } from '../record';\nimport { lazy } from '../util/lazy';\n\nasync function collectRecords(result: ExecuteResult): Promise<Record[]> {\n\tif (result.kind === 'sink') {\n\t\tawait result.value;\n\t\treturn [];\n\t}\n\treturn collect<Record>()(result.value);\n}\n\nexport class Shell {\n\tprivate readonly fs: FS;\n\n\tconstructor(fs: FS) {\n\t\tthis.fs = fs;\n\t}\n\n\t$ = (strings: TemplateStringsArray, ...exprs: unknown[]) => {\n\t\treturn this._exec(strings, ...exprs);\n\t};\n\n\texec(strings: TemplateStringsArray, ...exprs: unknown[]) {\n\t\treturn this._exec(strings, ...exprs);\n\t}\n\n\tprivate _exec(strings: TemplateStringsArray, ...exprs: unknown[]) {\n\t\tconst source = String.raw(strings, ...exprs);\n\t\tconst fs = this.fs;\n\n\t\tconst ir = lazy<PipelineIR>(() => {\n\t\t\tconst ast = parse(source);\n\t\t\treturn compile(ast);\n\t\t});\n\n\t\treturn {\n\t\t\tasync json(): Promise<unknown[]> {\n\t\t\t\tconst records = await collectRecords(execute(ir(), fs));\n\t\t\t\treturn records\n\t\t\t\t\t.filter((r) => r.kind === 'json')\n\t\t\t\t\t.map((r) => r.value);\n\t\t\t},\n\n\t\t\tasync lines(): Promise<string[]> {\n\t\t\t\tconst records = await collectRecords(execute(ir(), fs));\n\t\t\t\treturn records\n\t\t\t\t\t.filter((r) => r.kind === 'line')\n\t\t\t\t\t.map((r) => r.text);\n\t\t\t},\n\n\t\t\tasync raw(): Promise<Record[]> {\n\t\t\t\treturn await collectRecords(execute(ir(), fs));\n\t\t\t},\n\n\t\t\tasync stdout(): Promise<void> {\n\t\t\t\tconst result = execute(ir(), fs);\n\t\t\t\tif (result.kind === 'sink') {\n\t\t\t\t\tawait result.value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfor await (const r of result.value) {\n\t\t\t\t\tif (r.kind === 'line') {\n\t\t\t\t\t\tprocess.stdout.write(`${r.text}\\n`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tasync text(): Promise<string> {\n\t\t\t\tconst records = await collectRecords(execute(ir(), fs));\n\t\t\t\treturn records\n\t\t\t\t\t.map((r) => {\n\t\t\t\t\t\tif (r.kind === 'line') {\n\t\t\t\t\t\t\treturn r.text;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (r.kind === 'file') {\n\t\t\t\t\t\t\treturn r.path;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (r.kind === 'json') {\n\t\t\t\t\t\t\treturn JSON.stringify(r.value);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t})\n\t\t\t\t\t.join('\\n');\n\t\t\t},\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;AAIA,SAAS,QAAQ,OAAO;AACvB,QAAO;EACN,MAAM;EACN;EACA;;;;;AAgBF,SAAS,KAAK,SAAS,WAAW,EAAE,EAAE;AACrC,QAAO;EACN,MAAM;EACN;EACA;EACA;;;;;AAKF,SAAS,WAAW,SAAS,SAAS,EAAE,EAAE;AACzC,QAAO;EACN,MAAM;EACN;EACA;EACA;;;;;;AAMF,SAAS,qBAAqB,MAAM;AACnC,SAAQ,KAAK,MAAb;EACC,KAAK,UAAW,QAAO,KAAK;EAC5B,KAAK,OAAQ,QAAO,KAAK;EACzB,KAAK,aAAc,QAAO,KAAK;EAC/B,SAAS;GACR,MAAM,cAAc;AACpB,SAAM,IAAI,MAAM,sBAAsB,KAAK,UAAU,YAAY,GAAG;;;;;;;;AAQvE,SAAS,8BAA8B,OAAO;AAC7C,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E,MAAM;AAE/B,YAAO;MACN,CACD,KAAK,KAAK;;GAEb"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["normalizeOptions","ROOT_DIRECTORY","files","SourcePosition","Token","StringSourceReader","ParseSyntaxError","Parser","TRAILING_SLASH_REGEX","MULTIPLE_SLASH_REGEX","trimTrailingSlash","joinPath","basename","isDirectory","glob","TRAILING_SLASH_REGEX","MULTIPLE_SLASH_REGEX","trimTrailingSlash","ROOT_DIRECTORY","files","MULTIPLE_SLASH_REGEX","TRAILING_SLASH_REGEX","ROOT_DIRECTORY","normalizeAbsolutePath","normalizeCwd"],"sources":["../../compiler/dist/index.mjs","../src/consumer/consumer.ts","../src/operator/cat/cat.ts","../src/operator/cp/cp.ts","../src/operator/head/head.ts","../src/operator/ls/ls.ts","../src/operator/mkdir/mkdir.ts","../src/operator/mv/mv.ts","../src/operator/pwd/pwd.ts","../src/operator/rm/rm.ts","../src/operator/tail/tail.ts","../src/operator/touch/touch.ts","../src/execute/producers.ts","../src/execute/execute.ts","../src/util/lazy.ts","../src/shell/shell.ts"],"sourcesContent":["//#region src/ir.ts\n/**\n* Create a literal ExpandedWord.\n*/\nfunction literal(value) {\n\treturn {\n\t\tkind: \"literal\",\n\t\tvalue\n\t};\n}\n/**\n* Create a SimpleCommandIR for testing purposes.\n* Convenience helper that creates a command with a name and arguments.\n*/\nfunction cmd(name, args, redirections = []) {\n\treturn {\n\t\tname: literal(name),\n\t\targs,\n\t\tredirections\n\t};\n}\n/**\n* Create a glob ExpandedWord.\n*/\nfunction glob(pattern, expanded = []) {\n\treturn {\n\t\tkind: \"glob\",\n\t\tpattern,\n\t\texpanded\n\t};\n}\n/**\n* Create a command substitution ExpandedWord.\n*/\nfunction commandSub(command, output = []) {\n\treturn {\n\t\tkind: \"commandSub\",\n\t\tcommand,\n\t\toutput\n\t};\n}\n/**\n* Extract the string value from an ExpandedWord.\n* For globs, returns the pattern. For command subs, returns the command.\n*/\nfunction expandedWordToString(word) {\n\tswitch (word.kind) {\n\t\tcase \"literal\": return word.value;\n\t\tcase \"glob\": return word.pattern;\n\t\tcase \"commandSub\": return word.command;\n\t\tdefault: {\n\t\t\tconst _exhaustive = word;\n\t\t\tthrow new Error(`Unknown word kind: ${JSON.stringify(_exhaustive)}`);\n\t\t}\n\t}\n}\n/**\n* Extract paths from an array of ExpandedWords.\n* For globs and command subs, expands to their resolved values.\n*/\nfunction extractPathsFromExpandedWords(words) {\n\treturn words.flatMap((word) => {\n\t\tswitch (word.kind) {\n\t\t\tcase \"literal\": return [word.value];\n\t\t\tcase \"glob\": return word.expanded.length > 0 ? word.expanded : [word.pattern];\n\t\t\tcase \"commandSub\": return word.output;\n\t\t\tdefault: {\n\t\t\t\tconst _exhaustive = word;\n\t\t\t\tthrow new Error(`Unknown word kind: ${JSON.stringify(_exhaustive)}`);\n\t\t\t}\n\t\t}\n\t});\n}\n\n//#endregion\n//#region src/compile/command/arg/utils.ts\nconst NEGATIVE_NUMBER_REGEX = /^(?:-\\d+(?:\\.\\d+)?|-\\.\\d+)$/;\nfunction isNegativeNumberToken(token) {\n\treturn NEGATIVE_NUMBER_REGEX.test(token);\n}\nfunction startsWithLongPrefix(token) {\n\treturn token.length >= 2 && token[0] === \"-\" && token[1] === \"-\";\n}\nfunction startsWithShortPrefix(token) {\n\treturn token.length >= 1 && token[0] === \"-\" && !startsWithLongPrefix(token);\n}\nfunction startsWithNoLongPrefix(token) {\n\treturn token.startsWith(\"--no-\") && token.length > 5;\n}\nfunction splitNameBeforeEquals(token) {\n\tconst eq = token.indexOf(\"=\");\n\treturn eq === -1 ? token : token.slice(0, eq);\n}\n\n//#endregion\n//#region src/compile/command/arg/parse.ts\nconst SHORT_NAME_REGEX = /^[A-Za-z]$/;\nconst LONG_NAME_REGEX = /^[A-Za-z0-9][A-Za-z0-9-]*$/;\nconst UNKNOWN_FLAG_PREFIX$2 = \"Unknown flag: \";\nfunction createArgParser(flagDefs) {\n\tconst index = buildFlagIndex(flagDefs);\n\treturn (args, options) => {\n\t\treturn parseArgsWithIndex(args, index, options);\n\t};\n}\nfunction createWordParser(flagDefs, wordToString) {\n\tconst parseWithIndex = createArgParser(flagDefs);\n\treturn (words, options) => {\n\t\tconst parsed = parseWithIndex(words.map(wordToString), options);\n\t\tconst positionalWords = parsed.positionalIndices.flatMap((index) => {\n\t\t\tconst word = words[index];\n\t\t\treturn word === void 0 ? [] : [word];\n\t\t});\n\t\treturn {\n\t\t\t...parsed,\n\t\t\tpositionalWords\n\t\t};\n\t};\n}\nfunction parseArgsWithIndex(args, index, options) {\n\tconst normalizedOptions = normalizeOptions(options);\n\tconst negativeNumberValueEntry = getNegativeNumberValueEntry(normalizedOptions, index);\n\tlet consumedValueIndices = Object.create(null);\n\tlet flags = Object.create(null);\n\tconst positional = [];\n\tconst positionalIndices = [];\n\tlet endOfFlags = false;\n\tfor (let i = 0; i < args.length; i++) {\n\t\tconst token = args[i];\n\t\tif (token === void 0) continue;\n\t\tconst result = processToken({\n\t\t\targs,\n\t\t\tconsumedValueIndices,\n\t\t\tendOfFlags,\n\t\t\tflags,\n\t\t\tflagsIndex: index,\n\t\t\tindex: i,\n\t\t\tnegativeNumberValueEntry,\n\t\t\tpositional,\n\t\t\tpositionalIndices,\n\t\t\ttoken,\n\t\t\tunknownFlagPolicy: normalizedOptions.unknownFlagPolicy\n\t\t});\n\t\tconsumedValueIndices = result.consumedValueIndices;\n\t\tendOfFlags = result.endOfFlags;\n\t\tflags = result.flags;\n\t\ti = result.newIndex;\n\t}\n\treturn {\n\t\tconsumedValueIndices,\n\t\tflags,\n\t\tpositional,\n\t\tpositionalIndices\n\t};\n}\nfunction processToken(params) {\n\tconst { args, consumedValueIndices, endOfFlags, flags, flagsIndex, index, negativeNumberValueEntry, positional, positionalIndices, token, unknownFlagPolicy } = params;\n\tif (endOfFlags || token === \"-\") {\n\t\tappendPositional(positional, positionalIndices, token, index);\n\t\treturn {\n\t\t\tconsumedValueIndices,\n\t\t\tendOfFlags,\n\t\t\tflags,\n\t\t\tnewIndex: index\n\t\t};\n\t}\n\tif (token === \"--\") return {\n\t\tconsumedValueIndices,\n\t\tendOfFlags: true,\n\t\tflags,\n\t\tnewIndex: index\n\t};\n\tif (isNegativeNumberToken(token)) {\n\t\tif (!negativeNumberValueEntry) {\n\t\t\tappendPositional(positional, positionalIndices, token, index);\n\t\t\treturn {\n\t\t\t\tconsumedValueIndices,\n\t\t\t\tendOfFlags,\n\t\t\t\tflags,\n\t\t\t\tnewIndex: index\n\t\t\t};\n\t\t}\n\t\tsetValue(flags, consumedValueIndices, negativeNumberValueEntry, token.slice(1), index);\n\t\treturn {\n\t\t\tconsumedValueIndices,\n\t\t\tendOfFlags,\n\t\t\tflags,\n\t\t\tnewIndex: index\n\t\t};\n\t}\n\tconst parser = getTokenParser(token);\n\tif (!parser) {\n\t\tappendPositional(positional, positionalIndices, token, index);\n\t\treturn {\n\t\t\tconsumedValueIndices,\n\t\t\tendOfFlags,\n\t\t\tflags,\n\t\t\tnewIndex: index\n\t\t};\n\t}\n\tconst parsed = parsePotentialFlagToken(args, index, token, flagsIndex, flags, consumedValueIndices, unknownFlagPolicy, parser);\n\tif (!parsed) {\n\t\thandleUnrecognizedToken(unknownFlagPolicy, positional, positionalIndices, token, index);\n\t\treturn {\n\t\t\tconsumedValueIndices,\n\t\t\tendOfFlags,\n\t\t\tflags,\n\t\t\tnewIndex: index\n\t\t};\n\t}\n\treturn {\n\t\tconsumedValueIndices: parsed.consumedValueIndices,\n\t\tendOfFlags,\n\t\tflags: parsed.flags,\n\t\tnewIndex: parsed.newIndex\n\t};\n}\nfunction getTokenParser(token) {\n\tif (startsWithLongPrefix(token)) return parseLongToken;\n\tif (startsWithShortPrefix(token)) return parseShortToken;\n}\nfunction normalizeOptions(options) {\n\treturn {\n\t\tnegativeNumberPolicy: options?.negativeNumberPolicy ?? \"positional\",\n\t\tnegativeNumberFlag: options?.negativeNumberFlag,\n\t\tunknownFlagPolicy: options?.unknownFlagPolicy ?? \"error\"\n\t};\n}\nfunction getNegativeNumberValueEntry(options, index) {\n\tif (options.negativeNumberPolicy === \"positional\") return;\n\tif (!options.negativeNumberFlag) throw new Error(\"negativeNumberFlag is required when negativeNumberPolicy is \\\"value\\\".\");\n\tconst entry = index.canonical.get(options.negativeNumberFlag);\n\tif (!entry) throw new Error(`Unknown negativeNumberFlag: \"${options.negativeNumberFlag}\".`);\n\tif (!entry.def.takesValue) throw new Error(`negativeNumberFlag \"${options.negativeNumberFlag}\" must reference a flag that takes a value.`);\n\treturn entry;\n}\nfunction appendPositional(positional, positionalIndices, token, index) {\n\tpositional.push(token);\n\tpositionalIndices.push(index);\n}\nfunction parsePotentialFlagToken(args, index, token, flagsIndex, currentFlags, currentConsumedValueIndices, unknownFlagPolicy, parser) {\n\tif (unknownFlagPolicy === \"error\") return {\n\t\tconsumedValueIndices: currentConsumedValueIndices,\n\t\tflags: currentFlags,\n\t\tnewIndex: parser(args, index, token, flagsIndex, currentFlags, currentConsumedValueIndices)\n\t};\n\tconst candidateFlags = cloneFlags(currentFlags);\n\tconst candidateConsumedValueIndices = cloneConsumedValueIndices(currentConsumedValueIndices);\n\ttry {\n\t\treturn {\n\t\t\tconsumedValueIndices: candidateConsumedValueIndices,\n\t\t\tflags: candidateFlags,\n\t\t\tnewIndex: parser(args, index, token, flagsIndex, candidateFlags, candidateConsumedValueIndices)\n\t\t};\n\t} catch (error) {\n\t\tif (isUnknownFlagError(error)) return null;\n\t\tthrow error;\n\t}\n}\nfunction handleUnrecognizedToken(policy, positional, positionalIndices, token, index) {\n\tif (policy === \"positional\") appendPositional(positional, positionalIndices, token, index);\n}\nfunction cloneFlags(source) {\n\tconst cloned = Object.create(null);\n\tfor (const [key, value] of Object.entries(source)) cloned[key] = Array.isArray(value) ? [...value] : value;\n\treturn cloned;\n}\nfunction cloneConsumedValueIndices(source) {\n\tconst cloned = Object.create(null);\n\tfor (const [key, value] of Object.entries(source)) cloned[key] = [...value];\n\treturn cloned;\n}\nfunction buildFlagIndex(flagDefs) {\n\tconst canonical = /* @__PURE__ */ new Map();\n\tconst short = /* @__PURE__ */ new Map();\n\tconst long = /* @__PURE__ */ new Map();\n\tconst add = (map, token, entry) => {\n\t\tconst prev = map.get(token);\n\t\tif (!prev) {\n\t\t\tmap.set(token, entry);\n\t\t\treturn;\n\t\t}\n\t\tthrow new Error(`Duplicate flag token \"${token}\" for \"${entry.canonical}\" and \"${prev.canonical}\"`);\n\t};\n\tfor (const [canonicalName, def] of Object.entries(flagDefs)) {\n\t\tif (!SHORT_NAME_REGEX.test(def.short)) throw new Error(`Invalid short flag for \"${canonicalName}\": \"${def.short}\". Expected a single letter [A-Za-z].`);\n\t\tconst entry = {\n\t\t\tcanonical: canonicalName,\n\t\t\tdef\n\t\t};\n\t\tcanonical.set(canonicalName, entry);\n\t\tadd(short, `-${def.short}`, entry);\n\t\tif (def.long) {\n\t\t\tif (!LONG_NAME_REGEX.test(def.long)) throw new Error(`Invalid long flag for \"${canonicalName}\": \"${def.long}\". Expected [A-Za-z0-9][A-Za-z0-9-]*.`);\n\t\t\tadd(long, `--${def.long}`, entry);\n\t\t}\n\t}\n\tconst isFlagToken = (token) => {\n\t\tif (token === \"--\") return true;\n\t\tif (token === \"-\") return false;\n\t\tif (startsWithLongPrefix(token)) {\n\t\t\tconst name = splitNameBeforeEquals(token);\n\t\t\tif (long.has(name)) return true;\n\t\t\tif (startsWithNoLongPrefix(name)) {\n\t\t\t\tconst base = `--${name.slice(5)}`;\n\t\t\t\tconst entry = long.get(base);\n\t\t\t\treturn !!entry && !entry.def.takesValue;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tif (startsWithShortPrefix(token)) {\n\t\t\tconst ch = token[1] ?? \"\";\n\t\t\tif (!SHORT_NAME_REGEX.test(ch)) return false;\n\t\t\treturn short.has(`-${ch}`);\n\t\t}\n\t\treturn false;\n\t};\n\treturn {\n\t\tcanonical,\n\t\tshort,\n\t\tlong,\n\t\tisFlagToken\n\t};\n}\nfunction parseLongToken(args, index, token, flagsIndex, out, consumedValueIndices) {\n\tif (startsWithNoLongPrefix(token) && !token.includes(\"=\")) {\n\t\tconst base = `--${token.slice(5)}`;\n\t\tconst entry$1 = flagsIndex.long.get(base);\n\t\tif (!entry$1) throwUnknownFlag(token);\n\t\tif (entry$1.def.takesValue) throw new Error(`Flag ${base} takes a value; \"${token}\" is invalid.`);\n\t\tsetBoolean(out, entry$1.canonical, false);\n\t\treturn index;\n\t}\n\tif (token.includes(\"=\")) {\n\t\tconst eq = token.indexOf(\"=\");\n\t\tconst name = token.slice(0, eq);\n\t\tconst value$1 = token.slice(eq + 1);\n\t\tconst entry$1 = flagsIndex.long.get(name);\n\t\tif (!entry$1) throwUnknownFlag(name);\n\t\tif (!entry$1.def.takesValue) throw new Error(`Flag ${name} does not take a value.`);\n\t\tsetValue(out, consumedValueIndices, entry$1, value$1, index);\n\t\treturn index;\n\t}\n\tconst entry = flagsIndex.long.get(token);\n\tif (!entry) throwUnknownFlag(token);\n\tif (!entry.def.takesValue) {\n\t\tsetBoolean(out, entry.canonical, true);\n\t\treturn index;\n\t}\n\tconst { newIndex, value, valueIndex } = consumeValue(args, index, token, flagsIndex);\n\tsetValue(out, consumedValueIndices, entry, value, valueIndex);\n\treturn newIndex;\n}\nfunction parseShortToken(args, index, token, flagsIndex, out, consumedValueIndices) {\n\tif (token.length >= 3 && token[2] === \"=\") return parseShortEqualsToken(index, token, flagsIndex, out, consumedValueIndices);\n\tif (token.length === 2) return parseSingleShortToken(args, index, token, flagsIndex, out, consumedValueIndices);\n\treturn parseShortClusterToken(args, index, token, flagsIndex, out, consumedValueIndices);\n}\nfunction parseShortEqualsToken(index, token, flagsIndex, out, consumedValueIndices) {\n\tconst name = token.slice(0, 2);\n\tconst value = token.slice(3);\n\tconst entry = getRequiredShortEntry(flagsIndex, name);\n\tassertTakesValue(entry, name);\n\tsetValue(out, consumedValueIndices, entry, value, index);\n\treturn index;\n}\nfunction parseSingleShortToken(args, index, token, flagsIndex, out, consumedValueIndices) {\n\tconst entry = getRequiredShortEntry(flagsIndex, token);\n\tif (!entry.def.takesValue) {\n\t\tsetBoolean(out, entry.canonical, true);\n\t\treturn index;\n\t}\n\tconst { newIndex, value, valueIndex } = consumeValue(args, index, token, flagsIndex);\n\tsetValue(out, consumedValueIndices, entry, value, valueIndex);\n\treturn newIndex;\n}\nfunction parseShortClusterToken(args, index, token, flagsIndex, out, consumedValueIndices) {\n\tfor (let j = 1; j < token.length; j++) {\n\t\tconst ch = token[j] ?? \"\";\n\t\tassertValidShortCharacter(token, ch);\n\t\tconst name = `-${ch}`;\n\t\tconst entry = getRequiredShortEntry(flagsIndex, name);\n\t\tif (!entry.def.takesValue) {\n\t\t\tsetBoolean(out, entry.canonical, true);\n\t\t\tcontinue;\n\t\t}\n\t\treturn parseValueFlagInShortCluster(args, index, token, j, name, entry, flagsIndex, out, consumedValueIndices);\n\t}\n\treturn index;\n}\nfunction parseValueFlagInShortCluster(args, index, token, flagPosition, name, entry, flagsIndex, out, consumedValueIndices) {\n\tconst rest = token.slice(flagPosition + 1);\n\tif (rest.startsWith(\"=\")) {\n\t\tsetValue(out, consumedValueIndices, entry, rest.slice(1), index);\n\t\treturn index;\n\t}\n\tif (rest.length === 0) {\n\t\tconst { newIndex, value, valueIndex } = consumeValue(args, index, name, flagsIndex);\n\t\tsetValue(out, consumedValueIndices, entry, value, valueIndex);\n\t\treturn newIndex;\n\t}\n\tassertNotAmbiguousShortValue(token, name, rest, flagsIndex);\n\tsetValue(out, consumedValueIndices, entry, rest, index);\n\treturn index;\n}\nfunction getRequiredShortEntry(flagsIndex, name) {\n\tconst entry = flagsIndex.short.get(name);\n\tif (!entry) throwUnknownFlag(name);\n\treturn entry;\n}\nfunction assertValidShortCharacter(token, ch) {\n\tif (SHORT_NAME_REGEX.test(ch)) return;\n\tthrow new Error(`Invalid short flag character \"${ch}\" in \"${token}\". Short flags must be letters.`);\n}\nfunction assertTakesValue(entry, token) {\n\tif (entry.def.takesValue) return;\n\tthrow new Error(`Flag ${token} does not take a value.`);\n}\nfunction assertNotAmbiguousShortValue(token, name, rest, flagsIndex) {\n\tconst first = rest[0] ?? \"\";\n\tif (!(SHORT_NAME_REGEX.test(first) && flagsIndex.short.has(`-${first}`))) return;\n\tthrow new Error(`Ambiguous short flag cluster \"${token}\": ${name} takes a value, but \"${rest}\" begins with \"-${first}\" which is also a flag. Use \"${name}=${rest}\" or pass the value as a separate argument.`);\n}\nfunction consumeValue(args, index, flagToken, flagsIndex) {\n\tconst nextIndex = index + 1;\n\tif (nextIndex >= args.length) throw new Error(`Flag ${flagToken} requires a value.`);\n\tconst next = args[nextIndex];\n\tif (next === void 0) throw new Error(`Flag ${flagToken} requires a value.`);\n\tif (next === \"--\") throw new Error(`Flag ${flagToken} requires a value (got \"--\").`);\n\tif (flagsIndex.isFlagToken(next)) throw new Error(`Flag ${flagToken} requires a value (got \"${next}\").`);\n\treturn {\n\t\tvalue: next,\n\t\tnewIndex: nextIndex,\n\t\tvalueIndex: nextIndex\n\t};\n}\nfunction setBoolean(out, canonical, value) {\n\tout[canonical] = value;\n}\nfunction setValue(out, consumedValueIndices, entry, value, valueIndex) {\n\tconst { canonical, def } = entry;\n\tconst existing = out[canonical];\n\tif (existing === void 0) {\n\t\tout[canonical] = value;\n\t\trecordConsumedValueIndex(consumedValueIndices, canonical, valueIndex);\n\t\treturn;\n\t}\n\tif (!def.multiple) throw new Error(`Duplicate flag \"${canonical}\". If it is intended to repeat, set { multiple: true } in its definition.`);\n\tif (Array.isArray(existing)) {\n\t\texisting.push(value);\n\t\trecordConsumedValueIndex(consumedValueIndices, canonical, valueIndex);\n\t\treturn;\n\t}\n\tif (typeof existing === \"string\") {\n\t\tout[canonical] = [existing, value];\n\t\trecordConsumedValueIndex(consumedValueIndices, canonical, valueIndex);\n\t\treturn;\n\t}\n\tthrow new Error(`Invalid state for flag \"${canonical}\".`);\n}\nfunction recordConsumedValueIndex(consumedValueIndices, canonical, valueIndex) {\n\tconst existing = consumedValueIndices[canonical];\n\tif (!existing) {\n\t\tconsumedValueIndices[canonical] = [valueIndex];\n\t\treturn;\n\t}\n\texisting.push(valueIndex);\n}\nfunction throwUnknownFlag(token) {\n\tthrow new Error(`${UNKNOWN_FLAG_PREFIX$2}${token}`);\n}\nfunction isUnknownFlagError(error) {\n\tif (!(error instanceof Error)) return false;\n\treturn error.message.startsWith(UNKNOWN_FLAG_PREFIX$2);\n}\n\n//#endregion\n//#region src/compile/command/cat/cat.ts\n/**\n* cat command handler for the AST-based compiler.\n*/\nconst parseCatArgs = createArgParser({\n\tnumber: {\n\t\tshort: \"n\",\n\t\ttakesValue: false\n\t},\n\tnumberNonBlank: {\n\t\tshort: \"b\",\n\t\ttakesValue: false\n\t},\n\tshowAll: {\n\t\tshort: \"A\",\n\t\ttakesValue: false\n\t},\n\tshowEnds: {\n\t\tshort: \"E\",\n\t\ttakesValue: false\n\t},\n\tshowNonprinting: {\n\t\tshort: \"v\",\n\t\ttakesValue: false\n\t},\n\tshowTabs: {\n\t\tshort: \"T\",\n\t\ttakesValue: false\n\t},\n\tsqueezeBlank: {\n\t\tshort: \"s\",\n\t\ttakesValue: false\n\t}\n});\n/**\n* Compile a cat command from SimpleCommandIR to StepIR.\n*/\nfunction compileCat(cmd$1) {\n\tconst parsed = parseCatArgs(cmd$1.args.map(expandedWordToString));\n\tconst fileArgs = [];\n\tfor (const positionalIndex of parsed.positionalIndices) {\n\t\tconst arg = cmd$1.args[positionalIndex];\n\t\tif (arg !== void 0) fileArgs.push(arg);\n\t}\n\tconst hasInputRedirection = cmd$1.redirections.some((redirection) => redirection.kind === \"input\");\n\tif (fileArgs.length === 0 && !hasInputRedirection) throw new Error(\"cat requires at least one file\");\n\treturn {\n\t\tcmd: \"cat\",\n\t\targs: {\n\t\t\tfiles: fileArgs,\n\t\t\tnumberLines: parsed.flags.number === true,\n\t\t\tnumberNonBlank: parsed.flags.numberNonBlank === true,\n\t\t\tshowAll: parsed.flags.showAll === true,\n\t\t\tshowEnds: parsed.flags.showEnds === true,\n\t\t\tshowNonprinting: parsed.flags.showNonprinting === true,\n\t\t\tshowTabs: parsed.flags.showTabs === true,\n\t\t\tsqueezeBlank: parsed.flags.squeezeBlank === true\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/cd/cd.ts\n/**\n* cd command handler for the AST-based compiler.\n*/\nconst ROOT_DIRECTORY = \"/\";\n/**\n* Compile a cd command from SimpleCommandIR to StepIR.\n*/\nfunction compileCd(cmd$1) {\n\tif (cmd$1.args.length > 1) throw new Error(\"cd accepts at most one path\");\n\treturn {\n\t\tcmd: \"cd\",\n\t\targs: { path: cmd$1.args[0] ?? literal(ROOT_DIRECTORY) }\n\t};\n}\n\n//#endregion\n//#region src/compile/command/cp/cp.ts\n/**\n* cp command handler for the AST-based compiler.\n*/\nconst parseCpArgs = createWordParser({\n\tforce: {\n\t\tshort: \"f\",\n\t\ttakesValue: false\n\t},\n\tinteractive: {\n\t\tshort: \"i\",\n\t\ttakesValue: false\n\t},\n\trecursive: {\n\t\tshort: \"r\",\n\t\ttakesValue: false\n\t}\n}, expandedWordToString);\n/**\n* Compile a cp command from SimpleCommandIR to StepIR.\n*/\nfunction compileCp(cmd$1) {\n\tconst parsed = parseCpArgs(cmd$1.args, { unknownFlagPolicy: \"positional\" });\n\tconst recursive = parsed.flags.recursive === true;\n\tconst force = parsed.flags.force === true;\n\tconst interactive = parsed.flags.interactive === true;\n\tconst filteredArgs = parsed.positionalWords;\n\tif (filteredArgs.length < 2) throw new Error(\"cp requires source and destination\");\n\tconst dest = filteredArgs.pop();\n\tif (!dest) throw new Error(\"cp requires source and destination\");\n\treturn {\n\t\tcmd: \"cp\",\n\t\targs: {\n\t\t\tdest,\n\t\t\tforce,\n\t\t\tinteractive,\n\t\t\trecursive,\n\t\t\tsrcs: filteredArgs\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/head/head.ts\n/**\n* head command handler for the AST-based compiler.\n*/\nconst DEFAULT_LINE_COUNT$1 = 10;\nconst parseHeadArgs = createWordParser({ lines: {\n\tmultiple: true,\n\tshort: \"n\",\n\ttakesValue: true\n} }, expandedWordToString);\nconst MISSING_N_VALUE_PREFIX$1 = \"Flag -n requires a value\";\nconst UNKNOWN_FLAG_PREFIX$1 = \"Unknown flag:\";\n/**\n* Compile a head command from SimpleCommandIR to StepIR.\n*/\nfunction compileHead(cmd$1) {\n\tconst parsed = parseHeadArgsOrThrow(cmd$1.args);\n\tconst n = parseHeadCount(parsed.flags.lines);\n\treturn {\n\t\tcmd: \"head\",\n\t\targs: {\n\t\t\tfiles: parsed.positionalWords,\n\t\t\tn\n\t\t}\n\t};\n}\nfunction parseHeadCount(value) {\n\tconst lastValue = getLastValueToken$1(value);\n\tif (lastValue === void 0) return DEFAULT_LINE_COUNT$1;\n\tconst parsedValue = Number(lastValue);\n\tif (!Number.isFinite(parsedValue)) throw new Error(\"Invalid head count\");\n\treturn parsedValue;\n}\nfunction getLastValueToken$1(value) {\n\tif (value === void 0) return;\n\tif (typeof value === \"string\") return value;\n\tif (Array.isArray(value)) return value.at(-1);\n\tthrow new Error(\"Invalid head count\");\n}\nfunction parseHeadArgsOrThrow(args) {\n\ttry {\n\t\treturn parseHeadArgs(args, {\n\t\t\tnegativeNumberFlag: \"lines\",\n\t\t\tnegativeNumberPolicy: \"value\"\n\t\t});\n\t} catch (error) {\n\t\tif (!(error instanceof Error)) throw new Error(\"Unknown head option\");\n\t\tif (error.message.startsWith(MISSING_N_VALUE_PREFIX$1)) throw new Error(\"head -n requires a number\");\n\t\tif (error.message.startsWith(UNKNOWN_FLAG_PREFIX$1)) throw new Error(\"Unknown head option\");\n\t\tthrow error;\n\t}\n}\n\n//#endregion\n//#region src/compile/command/ls/ls.ts\n/**\n* ls command handler for the AST-based compiler.\n*/\nconst parseLsArgs = createWordParser({\n\tlongFormat: {\n\t\tshort: \"l\",\n\t\ttakesValue: false\n\t},\n\tshowAll: {\n\t\tshort: \"a\",\n\t\ttakesValue: false\n\t}\n}, expandedWordToString);\n/**\n* Compile an ls command from SimpleCommandIR to StepIR.\n*/\nfunction compileLs(cmd$1) {\n\tconst parsed = parseLsArgs(cmd$1.args, { unknownFlagPolicy: \"positional\" });\n\tconst paths = parsed.positionalWords.length === 0 ? [literal(\".\")] : parsed.positionalWords;\n\treturn {\n\t\tcmd: \"ls\",\n\t\targs: {\n\t\t\tlongFormat: parsed.flags.longFormat === true,\n\t\t\tpaths,\n\t\t\tshowAll: parsed.flags.showAll === true\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/mkdir/mkdir.ts\n/**\n* mkdir command handler for the AST-based compiler.\n*/\nconst parseMkdirArgs = createWordParser({ parents: {\n\tshort: \"p\",\n\ttakesValue: false\n} }, expandedWordToString);\n/**\n* Compile a mkdir command from SimpleCommandIR to StepIR.\n*/\nfunction compileMkdir(cmd$1) {\n\tconst parsed = parseMkdirArgs(cmd$1.args, { unknownFlagPolicy: \"positional\" });\n\tconst parents = parsed.flags.parents === true;\n\tconst recursive = parents;\n\tconst paths = parsed.positionalWords;\n\tif (paths.length === 0) throw new Error(\"mkdir requires at least one path\");\n\treturn {\n\t\tcmd: \"mkdir\",\n\t\targs: {\n\t\t\tparents,\n\t\t\tpaths,\n\t\t\trecursive\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/mv/mv.ts\n/**\n* mv command handler for the AST-based compiler.\n*/\nconst parseMvArgs = createWordParser({\n\tforce: {\n\t\tshort: \"f\",\n\t\ttakesValue: false\n\t},\n\tinteractive: {\n\t\tshort: \"i\",\n\t\ttakesValue: false\n\t}\n}, expandedWordToString);\n/**\n* Compile a mv command from SimpleCommandIR to StepIR.\n*/\nfunction compileMv(cmd$1) {\n\tconst parsed = parseMvArgs(cmd$1.args, { unknownFlagPolicy: \"positional\" });\n\tconst force = parsed.flags.force === true;\n\tconst interactive = parsed.flags.interactive === true;\n\tconst filteredArgs = parsed.positionalWords;\n\tif (filteredArgs.length < 2) throw new Error(\"mv requires source and destination\");\n\tconst dest = filteredArgs.pop();\n\tif (!dest) throw new Error(\"mv requires source and destination\");\n\treturn {\n\t\tcmd: \"mv\",\n\t\targs: {\n\t\t\tdest,\n\t\t\tforce,\n\t\t\tinteractive,\n\t\t\tsrcs: filteredArgs\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/pwd/pwd.ts\n/**\n* Compile a pwd command from SimpleCommandIR to StepIR.\n*/\nfunction compilePwd(cmd$1) {\n\tif (cmd$1.args.length > 0) throw new Error(\"pwd does not take any arguments\");\n\treturn {\n\t\tcmd: \"pwd\",\n\t\targs: {}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/rm/rm.ts\n/**\n* rm command handler for the AST-based compiler.\n*/\nconst parseRmArgs = createWordParser({\n\tforce: {\n\t\tshort: \"f\",\n\t\ttakesValue: false\n\t},\n\tinteractive: {\n\t\tshort: \"i\",\n\t\ttakesValue: false\n\t},\n\trecursive: {\n\t\tshort: \"r\",\n\t\ttakesValue: false\n\t}\n}, expandedWordToString);\n/**\n* Compile a rm command from SimpleCommandIR to StepIR.\n*/\nfunction compileRm(cmd$1) {\n\tconst parsed = parseRmArgs(cmd$1.args, { unknownFlagPolicy: \"positional\" });\n\tconst recursive = parsed.flags.recursive === true;\n\tconst force = parsed.flags.force === true;\n\tconst interactive = parsed.flags.interactive === true;\n\tconst paths = parsed.positionalWords;\n\tif (paths.length === 0) throw new Error(\"rm requires at least one path\");\n\treturn {\n\t\tcmd: \"rm\",\n\t\targs: {\n\t\t\tforce,\n\t\t\tinteractive,\n\t\t\tpaths,\n\t\t\trecursive\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/tail/tail.ts\n/**\n* tail command handler for the AST-based compiler.\n*/\nconst DEFAULT_LINE_COUNT = 10;\nconst parseTailArgs = createWordParser({ lines: {\n\tmultiple: true,\n\tshort: \"n\",\n\ttakesValue: true\n} }, expandedWordToString);\nconst MISSING_N_VALUE_PREFIX = \"Flag -n requires a value\";\nconst UNKNOWN_FLAG_PREFIX = \"Unknown flag:\";\n/**\n* Compile a tail command from SimpleCommandIR to StepIR.\n*/\nfunction compileTail(cmd$1) {\n\tconst parsed = parseTailArgsOrThrow(cmd$1.args);\n\tconst n = parseTailCount(parsed.flags.lines);\n\treturn {\n\t\tcmd: \"tail\",\n\t\targs: {\n\t\t\tfiles: parsed.positionalWords,\n\t\t\tn\n\t\t}\n\t};\n}\nfunction parseTailCount(value) {\n\tconst lastValue = getLastValueToken(value);\n\tif (lastValue === void 0) return DEFAULT_LINE_COUNT;\n\tconst parsedValue = Number(lastValue);\n\tif (!Number.isFinite(parsedValue)) throw new Error(\"Invalid tail count\");\n\treturn parsedValue;\n}\nfunction getLastValueToken(value) {\n\tif (value === void 0) return;\n\tif (typeof value === \"string\") return value;\n\tif (Array.isArray(value)) return value.at(-1);\n\tthrow new Error(\"Invalid tail count\");\n}\nfunction parseTailArgsOrThrow(args) {\n\ttry {\n\t\treturn parseTailArgs(args, {\n\t\t\tnegativeNumberFlag: \"lines\",\n\t\t\tnegativeNumberPolicy: \"value\"\n\t\t});\n\t} catch (error) {\n\t\tthrow normalizeTailParseError(error);\n\t}\n}\nfunction normalizeTailParseError(error) {\n\tif (!(error instanceof Error)) return /* @__PURE__ */ new Error(\"Unknown tail option\");\n\tif (error.message.startsWith(MISSING_N_VALUE_PREFIX)) return /* @__PURE__ */ new Error(\"tail -n requires a number\");\n\tif (error.message.startsWith(UNKNOWN_FLAG_PREFIX)) return /* @__PURE__ */ new Error(\"Unknown tail option\");\n\treturn error;\n}\n\n//#endregion\n//#region src/compile/command/touch/touch.ts\n/**\n* touch command handler for the AST-based compiler.\n*/\nconst parseTouchArgs = createWordParser({\n\taccessTimeOnly: {\n\t\tshort: \"a\",\n\t\ttakesValue: false\n\t},\n\tmodificationTimeOnly: {\n\t\tshort: \"m\",\n\t\ttakesValue: false\n\t}\n}, expandedWordToString);\n/**\n* Compile a touch command from SimpleCommandIR to StepIR.\n*/\nfunction compileTouch(cmd$1) {\n\tconst parsed = parseTouchArgs(cmd$1.args, { unknownFlagPolicy: \"positional\" });\n\tconst accessTimeOnly = parsed.flags.accessTimeOnly === true;\n\tconst modificationTimeOnly = parsed.flags.modificationTimeOnly === true;\n\tconst files = parsed.positionalWords.filter((arg) => {\n\t\treturn !expandedWordToString(arg).startsWith(\"-\");\n\t});\n\tif (files.length === 0) throw new Error(\"touch requires at least one file\");\n\treturn {\n\t\tcmd: \"touch\",\n\t\targs: {\n\t\t\taccessTimeOnly,\n\t\t\tfiles,\n\t\t\tmodificationTimeOnly\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/compile/command/handler.ts\nlet CommandHandler;\n(function(_CommandHandler) {\n\tconst handlers = {\n\t\tcat: compileCat,\n\t\tcd: compileCd,\n\t\tcp: compileCp,\n\t\thead: compileHead,\n\t\tls: compileLs,\n\t\tmkdir: compileMkdir,\n\t\tmv: compileMv,\n\t\tpwd: compilePwd,\n\t\trm: compileRm,\n\t\ttail: compileTail,\n\t\ttouch: compileTouch\n\t};\n\tfunction get(name) {\n\t\tconst handler = handlers[name];\n\t\tif (!handler) throw new Error(`Unknown command: ${name}`);\n\t\treturn handler;\n\t}\n\t_CommandHandler.get = get;\n\tfunction has(name) {\n\t\treturn name in handlers;\n\t}\n\t_CommandHandler.has = has;\n\tfunction register(name, handler) {\n\t\thandlers[name] = handler;\n\t}\n\t_CommandHandler.register = register;\n})(CommandHandler || (CommandHandler = {}));\n\n//#endregion\n//#region src/compile/compile.ts\n/**\n* AST-based compiler for the Fish subset parser.\n*\n* This compiler traverses the AST and produces a PipelineIR\n* with enhanced word expansion information.\n*\n* Key differences from the old compile.ts:\n* - Accepts Program from the new parser (not ShellAST)\n* - Produces PipelineIR with ExpandedWord types\n* - Preserves word structure for runtime expansion\n*/\n/**\n* Compile a Program AST to a PipelineIR.\n*\n* @param program The parsed Program AST\n* @returns The compiled PipelineIR\n*/\nfunction compile(program) {\n\treturn new ProgramCompiler().compileProgram(program);\n}\n/**\n* Compiler that traverses the AST to produce IR.\n*\n* Note: We don't implement the Visitor interface directly because\n* different AST nodes need to return different types. Instead, we\n* manually traverse the AST with type-specific methods.\n*/\nvar ProgramCompiler = class {\n\t/**\n\t* Compile a Program to a PipelineIR.\n\t*/\n\tcompileProgram(node) {\n\t\treturn this.compilePipeline(node.pipeline);\n\t}\n\t/**\n\t* Compile a Pipeline to a PipelineIR.\n\t*/\n\tcompilePipeline(node) {\n\t\tconst commands = node.commands.map((cmd$1) => this.compileSimpleCommand(cmd$1));\n\t\tif (commands.length === 0) throw new Error(\"Pipeline must contain at least one command\");\n\t\tconst firstCmd = commands[0];\n\t\tif (!firstCmd) throw new Error(\"Pipeline must contain at least one command\");\n\t\treturn {\n\t\t\tsource: this.determineSource(firstCmd),\n\t\t\tsteps: commands.map((cmd$1) => this.compileCommandToStep(cmd$1)),\n\t\t\tfirstCommand: firstCmd\n\t\t};\n\t}\n\t/**\n\t* Compile a SimpleCommand to a SimpleCommandIR.\n\t*/\n\tcompileSimpleCommand(node) {\n\t\treturn {\n\t\t\tname: this.expandWord(node.name),\n\t\t\targs: node.args.map((arg) => this.expandWord(arg)),\n\t\t\tredirections: node.redirections.map((r) => this.compileRedirection(r))\n\t\t};\n\t}\n\t/**\n\t* Compile a Redirection to a RedirectionIR.\n\t*/\n\tcompileRedirection(node) {\n\t\treturn {\n\t\t\tkind: node.redirectKind,\n\t\t\ttarget: this.expandWord(node.target)\n\t\t};\n\t}\n\t/**\n\t* Expand a Word to an ExpandedWord.\n\t* Handles concatenation of literal parts and detection of globs/command subs.\n\t*/\n\texpandWord(word) {\n\t\tconst parts = word.parts;\n\t\tif (parts.length === 0) return literal(\"\");\n\t\tif (parts.length === 1) {\n\t\t\tconst part = parts[0];\n\t\t\tif (!part) return literal(\"\");\n\t\t\treturn this.expandWordPart(part);\n\t\t}\n\t\tif (parts.every((p) => p.kind === \"literal\")) return literal(parts.map((p) => p.value).join(\"\"));\n\t\tif (parts.some((p) => p.kind === \"glob\")) return glob(parts.map((p) => {\n\t\t\tif (p.kind === \"literal\") return p.value;\n\t\t\tif (p.kind === \"glob\") return p.pattern;\n\t\t\treturn \"\";\n\t\t}).join(\"\"));\n\t\tif (parts.some((p) => p.kind === \"commandSub\")) {\n\t\t\tconst cmdSubPart = parts.find((p) => p.kind === \"commandSub\");\n\t\t\treturn commandSub(this.serializeProgram(cmdSubPart.program));\n\t\t}\n\t\treturn literal(parts.filter((p) => p.kind === \"literal\").map((p) => p.value).join(\"\"));\n\t}\n\t/**\n\t* Expand a single WordPart to an ExpandedWord.\n\t*/\n\texpandWordPart(part) {\n\t\tswitch (part.kind) {\n\t\t\tcase \"literal\": return literal(part.value);\n\t\t\tcase \"glob\": return glob(part.pattern);\n\t\t\tcase \"commandSub\": return commandSub(this.serializeProgram(part.program));\n\t\t\tdefault: {\n\t\t\t\tconst _exhaustive = part;\n\t\t\t\tthrow new Error(`Unknown word part kind: ${JSON.stringify(_exhaustive)}`);\n\t\t\t}\n\t\t}\n\t}\n\t/**\n\t* Determine the source for a pipeline based on the first command.\n\t*/\n\tdetermineSource(firstCmd) {\n\t\tconst firstArg = firstCmd.args[0];\n\t\tif (firstArg?.kind === \"literal\") return {\n\t\t\tkind: \"fs\",\n\t\t\tglob: firstArg.value\n\t\t};\n\t\tif (firstArg?.kind === \"glob\") return {\n\t\t\tkind: \"fs\",\n\t\t\tglob: firstArg.pattern\n\t\t};\n\t\treturn {\n\t\t\tkind: \"fs\",\n\t\t\tglob: \"**/*\"\n\t\t};\n\t}\n\t/**\n\t* Compile a SimpleCommandIR to a StepIR.\n\t*/\n\tcompileCommandToStep(cmd$1) {\n\t\tconst cmdName = this.extractLiteralString(cmd$1.name);\n\t\tif (!cmdName) throw new Error(\"Command name must be a literal string\");\n\t\treturn {\n\t\t\t...CommandHandler.get(cmdName)(cmd$1),\n\t\t\tredirections: cmd$1.redirections\n\t\t};\n\t}\n\t/**\n\t* Extract the literal string value from an ExpandedWord.\n\t* Returns null if the word is not a literal.\n\t*/\n\textractLiteralString(word) {\n\t\tif (word.kind === \"literal\") return word.value;\n\t\treturn null;\n\t}\n\t/**\n\t* Serialize a Program AST back to a string representation.\n\t* Used for storing command substitution content.\n\t*/\n\tserializeProgram(program) {\n\t\treturn program.pipeline.commands.map((cmd$1) => {\n\t\t\tconst name = cmd$1.name.literalValue ?? \"?\";\n\t\t\tconst args = cmd$1.args.map((arg) => arg.literalValue ?? \"?\").join(\" \");\n\t\t\treturn args ? `${name} ${args}` : name;\n\t\t}).join(\" | \");\n\t}\n};\n\n//#endregion\n//#region src/lexer/position.ts\n/**\n* Represents a position in source code.\n*/\nvar SourcePosition = class SourcePosition {\n\tline;\n\tcolumn;\n\toffset;\n\tconstructor(line, column, offset) {\n\t\tthis.line = line;\n\t\tthis.column = column;\n\t\tthis.offset = offset;\n\t}\n\tstatic ZERO = new SourcePosition(1, 1, 0);\n\ttoString() {\n\t\treturn `${this.line}:${this.column}`;\n\t}\n\tspan(end) {\n\t\treturn new SourceSpan(this, end);\n\t}\n};\n/**\n* Represents a span of source code from start to end position.\n*/\nvar SourceSpan = class {\n\tstart;\n\tend;\n\tconstructor(start, end) {\n\t\tthis.start = start;\n\t\tthis.end = end;\n\t}\n\ttoString() {\n\t\treturn `${this.start}-${this.end}`;\n\t}\n};\n\n//#endregion\n//#region src/lexer/context.ts\n/**\n* Lexer states for the fish subset lexer state machine.\n*\n* Simplified for the subset - only tracks quoting and command substitution.\n*/\nconst LexerState = {\n\tNORMAL: 0,\n\tSINGLE_QUOTED: 1,\n\tDOUBLE_QUOTED: 2,\n\tCOMMAND_SUB: 3\n};\n/**\n* Manages the lexer state stack for tracking nested contexts.\n*\n* Fish subset has simple quoting:\n* - Single quotes: literal, no escapes, no substitution\n* - Double quotes: command substitution allowed, minimal escaping (\\\", \\\\)\n*/\nvar StateContext = class {\n\tstack = [LexerState.NORMAL];\n\t/**\n\t* Get the current lexer state.\n\t*/\n\tget current() {\n\t\treturn this.stack.at(-1) ?? LexerState.NORMAL;\n\t}\n\t/**\n\t* Get the stack depth.\n\t*/\n\tget depth() {\n\t\treturn this.stack.length;\n\t}\n\t/**\n\t* Check if we're inside any quote context.\n\t*/\n\tget inQuotes() {\n\t\tconst s = this.current;\n\t\treturn s === LexerState.SINGLE_QUOTED || s === LexerState.DOUBLE_QUOTED;\n\t}\n\t/**\n\t* Check if we're inside single quotes.\n\t*/\n\tget inSingleQuote() {\n\t\treturn this.current === LexerState.SINGLE_QUOTED;\n\t}\n\t/**\n\t* Check if we're inside double quotes.\n\t*/\n\tget inDoubleQuote() {\n\t\treturn this.current === LexerState.DOUBLE_QUOTED;\n\t}\n\t/**\n\t* Check if we're inside a command substitution.\n\t*/\n\tget inCommandSub() {\n\t\treturn this.current === LexerState.COMMAND_SUB;\n\t}\n\t/**\n\t* Push a new state onto the stack.\n\t*/\n\tpush(state) {\n\t\tthis.stack.push(state);\n\t}\n\t/**\n\t* Pop the current state from the stack.\n\t*/\n\tpop() {\n\t\tif (this.stack.length > 1) return this.stack.pop() ?? LexerState.NORMAL;\n\t\treturn LexerState.NORMAL;\n\t}\n\t/**\n\t* Reset the context to initial state.\n\t*/\n\treset() {\n\t\tthis.stack = [LexerState.NORMAL];\n\t}\n\t/**\n\t* Check if any parent context is double-quoted.\n\t* Useful for determining if command substitution should occur.\n\t*/\n\thasDoubleQuoteParent() {\n\t\treturn this.stack.includes(LexerState.DOUBLE_QUOTED);\n\t}\n\t/**\n\t* Check if any parent context is single-quoted.\n\t* If true, no expansions should occur.\n\t*/\n\thasSingleQuoteParent() {\n\t\treturn this.stack.includes(LexerState.SINGLE_QUOTED);\n\t}\n};\n\n//#endregion\n//#region src/lexer/token.ts\n/**\n* Token types for the fish subset lexer.\n*\n* This is a simplified subset of fish shell syntax focused on:\n* - Pipelines\n* - Command substitution (...)\n* - Globbing (* ? [...])\n* - Basic quoting\n* - Comments\n*\n* NOT supported: variables, brace expansion, control flow, functions\n*/\nconst TokenKind = {\n\tEOF: 0,\n\tERROR: 1,\n\tNEWLINE: 2,\n\tCOMMENT: 3,\n\tWORD: 4,\n\tNAME: 5,\n\tNUMBER: 6,\n\tPIPE: 7,\n\tLPAREN: 8,\n\tRPAREN: 9,\n\tLESS: 10,\n\tGREAT: 11,\n\tCOMMAND_SUB: 12,\n\tGLOB: 13\n};\n/**\n* Create an empty flags object.\n*/\nfunction createEmptyFlags() {\n\treturn {\n\t\tquoted: false,\n\t\tsingleQuoted: false,\n\t\tdoubleQuoted: false,\n\t\tcontainsExpansion: false,\n\t\tcontainsGlob: false\n\t};\n}\n/**\n* Check if any quote flag is set.\n*/\nfunction isQuoted(flags) {\n\treturn flags.quoted || flags.singleQuoted || flags.doubleQuoted;\n}\n/**\n* Human-readable names for token kinds.\n*/\nconst TOKEN_KIND_NAMES = {\n\t[TokenKind.EOF]: \"EOF\",\n\t[TokenKind.ERROR]: \"ERROR\",\n\t[TokenKind.NEWLINE]: \"NEWLINE\",\n\t[TokenKind.COMMENT]: \"COMMENT\",\n\t[TokenKind.WORD]: \"WORD\",\n\t[TokenKind.NAME]: \"NAME\",\n\t[TokenKind.NUMBER]: \"NUMBER\",\n\t[TokenKind.PIPE]: \"PIPE\",\n\t[TokenKind.LPAREN]: \"LPAREN\",\n\t[TokenKind.RPAREN]: \"RPAREN\",\n\t[TokenKind.LESS]: \"LESS\",\n\t[TokenKind.GREAT]: \"GREAT\",\n\t[TokenKind.COMMAND_SUB]: \"COMMAND_SUB\",\n\t[TokenKind.GLOB]: \"GLOB\"\n};\n/**\n* Canonical spellings for operators and special tokens.\n*/\nconst TOKEN_SPELLINGS = new Map([\n\t[TokenKind.EOF, \"<eof>\"],\n\t[TokenKind.ERROR, \"<error>\"],\n\t[TokenKind.NEWLINE, \"\\\\n\"],\n\t[TokenKind.PIPE, \"|\"],\n\t[TokenKind.LPAREN, \"(\"],\n\t[TokenKind.RPAREN, \")\"],\n\t[TokenKind.LESS, \"<\"],\n\t[TokenKind.GREAT, \">\"]\n]);\n/**\n* Represents a single token from the lexer.\n*/\nvar Token = class Token {\n\tkind;\n\tspelling;\n\tspan;\n\tflags;\n\tconstructor(kind, spelling, span, flags = createEmptyFlags()) {\n\t\tthis.kind = kind;\n\t\tthis.spelling = spelling;\n\t\tthis.span = span;\n\t\tthis.flags = flags;\n\t}\n\t/**\n\t* Get the canonical spelling for a token kind.\n\t*/\n\tstatic spell(kind) {\n\t\treturn TOKEN_SPELLINGS.get(kind) ?? \"<unknown>\";\n\t}\n\t/**\n\t* Get the name of a token kind.\n\t*/\n\tstatic kindName(kind) {\n\t\treturn TOKEN_KIND_NAMES[kind] ?? \"UNKNOWN\";\n\t}\n\t/**\n\t* Check if this token is an operator.\n\t*/\n\tget isOperator() {\n\t\treturn this.kind >= TokenKind.PIPE && this.kind <= TokenKind.GREAT;\n\t}\n\t/**\n\t* Check if this token has any quote flags set.\n\t*/\n\tget isQuoted() {\n\t\treturn isQuoted(this.flags);\n\t}\n\t/**\n\t* Check if this token contains expansions (command substitution).\n\t*/\n\tget hasExpansions() {\n\t\treturn this.flags.containsExpansion;\n\t}\n\t/**\n\t* Check if this token contains glob patterns.\n\t*/\n\tget hasGlob() {\n\t\treturn this.flags.containsGlob;\n\t}\n\ttoString() {\n\t\treturn `Token(${Token.kindName(this.kind)}, \"${this.spelling}\", ${this.span})`;\n\t}\n};\n\n//#endregion\n//#region src/lexer/operators.ts\n/**\n* Multi-character operators sorted by length (longest first) for greedy matching.\n*\n* For the fish subset, we only support:\n* - | (pipe)\n* - > (output redirection - Phase 2)\n* - < (input redirection - Phase 2)\n*\n* NOT supported: &&, ||, >>, &>, >?, ;, &\n*/\nconst OPERATORS = [];\n/**\n* Single-character operators for O(1) lookup.\n*/\nconst SINGLE_CHAR_OPS = new Map([\n\t[\"|\", TokenKind.PIPE],\n\t[\"<\", TokenKind.LESS],\n\t[\">\", TokenKind.GREAT]\n]);\n/**\n* Characters that definitively end a word (token boundary).\n*/\nconst WORD_BOUNDARY_CHARS = new Set([\n\t\" \",\n\t\"\t\",\n\t\"\\n\",\n\t\"|\",\n\t\"<\",\n\t\">\",\n\t\"(\",\n\t\")\",\n\t\"\\0\"\n]);\n\n//#endregion\n//#region src/lexer/source-reader.ts\n/**\n* In-memory implementation of SourceReader (fast).\n*/\nvar StringSourceReader = class StringSourceReader {\n\tstatic EOF = \"\\0\";\n\tinput;\n\tpos = 0;\n\tline = 1;\n\tcolumn = 1;\n\tmarkState = null;\n\tconstructor(input) {\n\t\tthis.input = input;\n\t}\n\tget eof() {\n\t\treturn this.pos >= this.input.length;\n\t}\n\tget position() {\n\t\treturn new SourcePosition(this.line, this.column, this.pos);\n\t}\n\tpeek(offset = 0) {\n\t\tconst idx = this.pos + offset;\n\t\tconst char = this.input[idx];\n\t\treturn char !== void 0 ? char : StringSourceReader.EOF;\n\t}\n\tadvance() {\n\t\tif (this.eof) return StringSourceReader.EOF;\n\t\tconst char = this.input[this.pos];\n\t\tif (char === void 0) return StringSourceReader.EOF;\n\t\tthis.pos++;\n\t\tif (char === \"\\n\") {\n\t\t\tthis.line++;\n\t\t\tthis.column = 1;\n\t\t} else this.column++;\n\t\treturn char;\n\t}\n\tmark() {\n\t\tthis.markState = {\n\t\t\tpos: this.pos,\n\t\t\tline: this.line,\n\t\t\tcolumn: this.column\n\t\t};\n\t}\n\treset() {\n\t\tif (this.markState) {\n\t\t\tthis.pos = this.markState.pos;\n\t\t\tthis.line = this.markState.line;\n\t\t\tthis.column = this.markState.column;\n\t\t\tthis.markState = null;\n\t\t}\n\t}\n};\n\n//#endregion\n//#region src/lexer/scanner.ts\nconst NUMBER_PATTERN = /^[0-9]+$/;\nconst NAME_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_-]*$/;\n/**\n* Merge two flags objects, combining their values.\n*/\nfunction mergeFlags(a, b) {\n\treturn {\n\t\tquoted: a.quoted || b.quoted,\n\t\tsingleQuoted: a.singleQuoted || b.singleQuoted,\n\t\tdoubleQuoted: a.doubleQuoted || b.doubleQuoted,\n\t\tcontainsExpansion: a.containsExpansion || b.containsExpansion,\n\t\tcontainsGlob: a.containsGlob || b.containsGlob\n\t};\n}\n/**\n* The main Scanner class for tokenizing fish subset source code.\n*\n* This lexer implements a fish-inspired subset with:\n* - Pipelines (|)\n* - Command substitution (...)\n* - Globbing (* ? [...])\n* - Single quotes (literal, no escapes)\n* - Double quotes (command substitution allowed, minimal escaping)\n* - Comments (#)\n* - Redirection (> <) - Phase 2\n*\n* NOT supported:\n* - Variables ($var)\n* - Brace expansion ({a,b})\n* - Control flow (if, for, while, etc.)\n* - Functions\n* - Background (&)\n* - Semicolons (;)\n* - and/or/not keywords\n* - Tilde expansion (~)\n* - Recursive globbing (**)\n*/\nvar Scanner = class {\n\tsource;\n\tstateCtx = new StateContext();\n\tdebug = false;\n\tconstructor(input) {\n\t\tthis.source = typeof input === \"string\" ? new StringSourceReader(input) : input;\n\t}\n\t/**\n\t* Enable debug logging of tokens.\n\t*/\n\tenableDebugging() {\n\t\tthis.debug = true;\n\t\treturn this;\n\t}\n\t/**\n\t* Main entry: get next token.\n\t*/\n\tgetToken() {\n\t\tthis.skipWhitespace();\n\t\tconst start = this.source.position;\n\t\tconst token = this.nextToken(start);\n\t\tif (this.debug) console.log(token.toString());\n\t\treturn token;\n\t}\n\t/**\n\t* Tokenize all input.\n\t*/\n\ttokenize() {\n\t\tconst tokens = [];\n\t\tlet token;\n\t\tdo {\n\t\t\ttoken = this.getToken();\n\t\t\ttokens.push(token);\n\t\t} while (token.kind !== TokenKind.EOF);\n\t\treturn tokens;\n\t}\n\tnextToken(start) {\n\t\tconst c0 = this.source.peek();\n\t\tif (this.source.eof || c0 === \"\\0\") return this.makeToken(TokenKind.EOF, \"\", start);\n\t\tif (c0 === \"#\") return this.readComment(start);\n\t\tif (c0 === \"\\n\") {\n\t\t\tthis.source.advance();\n\t\t\treturn this.makeToken(TokenKind.NEWLINE, \"\\n\", start);\n\t\t}\n\t\tconst opToken = this.tryMatchOperator(start);\n\t\tif (opToken) return opToken;\n\t\tconst singleOp = SINGLE_CHAR_OPS.get(c0);\n\t\tif (singleOp !== void 0) {\n\t\t\tthis.source.advance();\n\t\t\treturn this.makeToken(singleOp, c0, start);\n\t\t}\n\t\tif (c0 === \"(\") {\n\t\t\tthis.source.advance();\n\t\t\treturn this.makeToken(TokenKind.LPAREN, \"(\", start);\n\t\t}\n\t\tif (c0 === \")\") {\n\t\t\tthis.source.advance();\n\t\t\treturn this.makeToken(TokenKind.RPAREN, \")\", start);\n\t\t}\n\t\treturn this.readWord(start);\n\t}\n\ttryMatchOperator(start) {\n\t\tconst chars = this.source.peek() + this.source.peek(1);\n\t\tfor (const op of OPERATORS) if (chars.startsWith(op.pattern)) {\n\t\t\tfor (const _ of op.pattern) this.source.advance();\n\t\t\treturn this.makeToken(op.kind, op.pattern, start);\n\t\t}\n\t\treturn null;\n\t}\n\treadWord(start) {\n\t\tconst fastResult = this.tryFastPath(start);\n\t\tif (fastResult) return fastResult;\n\t\treturn this.readComplexWord(start);\n\t}\n\ttryFastPath(start) {\n\t\tthis.source.mark();\n\t\tlet spelling = \"\";\n\t\twhile (!this.source.eof) {\n\t\t\tconst c = this.source.peek();\n\t\t\tif (this.isSpecialChar(c)) break;\n\t\t\tspelling += this.source.advance();\n\t\t}\n\t\tif (spelling.length === 0) {\n\t\t\tthis.source.reset();\n\t\t\treturn null;\n\t\t}\n\t\tconst next = this.source.peek();\n\t\tif (this.isWordBoundary(next)) return this.classifyWord(spelling, start, createEmptyFlags());\n\t\tthis.source.reset();\n\t\treturn null;\n\t}\n\treadComplexWord(start) {\n\t\tthis.stateCtx.reset();\n\t\tlet spelling = \"\";\n\t\tlet flags = createEmptyFlags();\n\t\twhile (!this.source.eof) {\n\t\t\tconst c = this.source.peek();\n\t\t\tif (!this.stateCtx.inQuotes && this.isWordBoundary(c)) break;\n\t\t\tconst result = this.processChar(c);\n\t\t\tspelling += result.chars;\n\t\t\tflags = mergeFlags(flags, result.flags);\n\t\t\tif (result.done) break;\n\t\t}\n\t\treturn this.classifyWord(spelling, start, flags);\n\t}\n\tprocessChar(c) {\n\t\tif (c === \"'\" && !this.stateCtx.inDoubleQuote) return this.handleSingleQuote();\n\t\tif (c === \"\\\"\" && !this.stateCtx.inSingleQuote) return this.handleDoubleQuote();\n\t\tif (c === \"\\\\\" && !this.stateCtx.inSingleQuote) return this.handleEscape();\n\t\tif (c === \"(\" && !this.stateCtx.inSingleQuote) return this.readCommandSubstitution();\n\t\tif ((c === \"*\" || c === \"?\") && !this.stateCtx.inQuotes) return this.handleGlobChar(c);\n\t\tif (c === \"[\" && !this.stateCtx.inQuotes) return this.readCharacterClass();\n\t\tthis.source.advance();\n\t\treturn {\n\t\t\tchars: c,\n\t\t\tflags: createEmptyFlags(),\n\t\t\tdone: false\n\t\t};\n\t}\n\thandleGlobChar(c) {\n\t\tthis.source.advance();\n\t\tconst flags = createEmptyFlags();\n\t\tflags.containsGlob = true;\n\t\treturn {\n\t\t\tchars: c,\n\t\t\tflags,\n\t\t\tdone: false\n\t\t};\n\t}\n\thandleSingleQuote() {\n\t\tif (this.stateCtx.inSingleQuote) {\n\t\t\tthis.stateCtx.pop();\n\t\t\tthis.source.advance();\n\t\t\treturn {\n\t\t\t\tchars: \"\",\n\t\t\t\tflags: createEmptyFlags(),\n\t\t\t\tdone: false\n\t\t\t};\n\t\t}\n\t\tthis.stateCtx.push(LexerState.SINGLE_QUOTED);\n\t\tthis.source.advance();\n\t\tconst flags = createEmptyFlags();\n\t\tflags.singleQuoted = true;\n\t\tflags.quoted = true;\n\t\treturn {\n\t\t\tchars: \"\",\n\t\t\tflags,\n\t\t\tdone: false\n\t\t};\n\t}\n\thandleDoubleQuote() {\n\t\tif (this.stateCtx.inDoubleQuote) {\n\t\t\tthis.stateCtx.pop();\n\t\t\tthis.source.advance();\n\t\t\treturn {\n\t\t\t\tchars: \"\",\n\t\t\t\tflags: createEmptyFlags(),\n\t\t\t\tdone: false\n\t\t\t};\n\t\t}\n\t\tthis.stateCtx.push(LexerState.DOUBLE_QUOTED);\n\t\tthis.source.advance();\n\t\tconst flags = createEmptyFlags();\n\t\tflags.doubleQuoted = true;\n\t\tflags.quoted = true;\n\t\treturn {\n\t\t\tchars: \"\",\n\t\t\tflags,\n\t\t\tdone: false\n\t\t};\n\t}\n\thandleEscape() {\n\t\tthis.source.advance();\n\t\tconst next = this.source.peek();\n\t\tif (this.source.eof || next === \"\\0\") return {\n\t\t\tchars: \"\\\\\",\n\t\t\tflags: createEmptyFlags(),\n\t\t\tdone: false\n\t\t};\n\t\tif (next === \"\\n\") {\n\t\t\tthis.source.advance();\n\t\t\treturn {\n\t\t\t\tchars: \"\",\n\t\t\t\tflags: createEmptyFlags(),\n\t\t\t\tdone: false\n\t\t\t};\n\t\t}\n\t\tif (this.stateCtx.inDoubleQuote) {\n\t\t\tif (\"\\\"\\\\\".includes(next)) {\n\t\t\t\tthis.source.advance();\n\t\t\t\treturn {\n\t\t\t\t\tchars: next,\n\t\t\t\t\tflags: createEmptyFlags(),\n\t\t\t\t\tdone: false\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tchars: \"\\\\\",\n\t\t\t\tflags: createEmptyFlags(),\n\t\t\t\tdone: false\n\t\t\t};\n\t\t}\n\t\tthis.source.advance();\n\t\treturn {\n\t\t\tchars: next,\n\t\t\tflags: createEmptyFlags(),\n\t\t\tdone: false\n\t\t};\n\t}\n\treadCommandSubstitution() {\n\t\tlet result = \"\";\n\t\tresult += this.source.advance();\n\t\tlet depth = 1;\n\t\twhile (depth > 0 && !this.source.eof) {\n\t\t\tconst c = this.source.peek();\n\t\t\tif (c === \"(\") {\n\t\t\t\tdepth++;\n\t\t\t\tresult += this.source.advance();\n\t\t\t} else if (c === \")\") {\n\t\t\t\tdepth--;\n\t\t\t\tresult += this.source.advance();\n\t\t\t} else if (c === \"'\" || c === \"\\\"\") result += this.skipQuotedContent(c);\n\t\t\telse if (c === \"\\\\\" && !this.source.eof) {\n\t\t\t\tresult += this.source.advance();\n\t\t\t\tif (!this.source.eof) result += this.source.advance();\n\t\t\t} else result += this.source.advance();\n\t\t}\n\t\tconst flags = createEmptyFlags();\n\t\tflags.containsExpansion = true;\n\t\treturn {\n\t\t\tchars: result,\n\t\t\tflags,\n\t\t\tdone: false\n\t\t};\n\t}\n\treadCharacterClass() {\n\t\tlet result = \"\";\n\t\tresult += this.source.advance();\n\t\tif (this.source.peek() === \"!\" || this.source.peek() === \"^\") result += this.source.advance();\n\t\tif (this.source.peek() === \"]\") result += this.source.advance();\n\t\twhile (!this.source.eof && this.source.peek() !== \"]\") result += this.source.advance();\n\t\tif (this.source.peek() === \"]\") result += this.source.advance();\n\t\tconst flags = createEmptyFlags();\n\t\tflags.containsGlob = true;\n\t\treturn {\n\t\t\tchars: result,\n\t\t\tflags,\n\t\t\tdone: false\n\t\t};\n\t}\n\tskipQuotedContent(quoteChar) {\n\t\tlet result = \"\";\n\t\tresult += this.source.advance();\n\t\twhile (!this.source.eof && this.source.peek() !== quoteChar) {\n\t\t\tconst c = this.source.peek();\n\t\t\tresult += this.source.advance();\n\t\t\tif (c === \"\\\\\" && quoteChar === \"\\\"\" && !this.source.eof) result += this.source.advance();\n\t\t}\n\t\tif (this.source.peek() === quoteChar) result += this.source.advance();\n\t\treturn result;\n\t}\n\tclassifyWord(spelling, start, flags) {\n\t\tif (NUMBER_PATTERN.test(spelling)) return this.makeToken(TokenKind.NUMBER, spelling, start, flags);\n\t\tif (NAME_PATTERN.test(spelling)) return this.makeToken(TokenKind.NAME, spelling, start, flags);\n\t\treturn this.makeToken(TokenKind.WORD, spelling, start, flags);\n\t}\n\tskipWhitespace() {\n\t\twhile (!this.source.eof) {\n\t\t\tconst c = this.source.peek();\n\t\t\tif (c === \" \" || c === \"\t\") this.source.advance();\n\t\t\telse if (c === \"\\\\\" && this.source.peek(1) === \"\\n\") {\n\t\t\t\tthis.source.advance();\n\t\t\t\tthis.source.advance();\n\t\t\t} else break;\n\t\t}\n\t}\n\treadComment(start) {\n\t\tlet spelling = \"\";\n\t\twhile (!this.source.eof && this.source.peek() !== \"\\n\") spelling += this.source.advance();\n\t\treturn this.makeToken(TokenKind.COMMENT, spelling, start);\n\t}\n\tisSpecialChar(c) {\n\t\treturn \" \t\\n|<>()\\\"'\\\\*?[#\".includes(c);\n\t}\n\tisWordBoundary(c) {\n\t\treturn WORD_BOUNDARY_CHARS.has(c) || c === \"\\0\";\n\t}\n\tmakeToken(kind, spelling, start, flags = createEmptyFlags()) {\n\t\treturn new Token(kind, spelling, start.span(this.source.position), flags);\n\t}\n};\n\n//#endregion\n//#region src/parser/ast.ts\n/**\n* Base class for all AST nodes.\n* Every node has a source span for error reporting.\n*/\nvar ASTNode = class {\n\tspan;\n\tconstructor(span) {\n\t\tthis.span = span;\n\t}\n};\n/**\n* Root AST node representing a complete program.\n* A program is a single pipeline (Fish subset does not support multiple statements).\n*/\nvar Program = class extends ASTNode {\n\tpipeline;\n\tconstructor(span, pipeline) {\n\t\tsuper(span);\n\t\tthis.pipeline = pipeline;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitProgram(this);\n\t}\n};\n/**\n* A pipeline of one or more commands connected by pipes.\n* Example: `ls | grep foo | sort`\n*/\nvar Pipeline = class extends ASTNode {\n\tcommands;\n\tconstructor(span, commands) {\n\t\tsuper(span);\n\t\tthis.commands = commands;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitPipeline(this);\n\t}\n};\n/**\n* A simple command with a name, arguments, and optional redirections.\n* Example: `grep -n pattern file.txt > output.txt`\n*/\nvar SimpleCommand = class extends ASTNode {\n\t/** The command name (first word) */\n\tname;\n\t/** Command arguments (remaining words) */\n\targs;\n\t/** Redirections (Phase 2) */\n\tredirections;\n\tconstructor(span, name, args, redirections = []) {\n\t\tsuper(span);\n\t\tthis.name = name;\n\t\tthis.args = args;\n\t\tthis.redirections = redirections;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitSimpleCommand(this);\n\t}\n};\n/**\n* A word is a sequence of word parts.\n* Parts can be literals, globs, or command substitutions.\n* Example: `foo*.txt` has a literal part \"foo\", a glob part \"*\", and a literal part \".txt\"\n*/\nvar Word = class extends ASTNode {\n\tparts;\n\t/** True if the word was quoted (single or double) */\n\tquoted;\n\tconstructor(span, parts, quoted = false) {\n\t\tsuper(span);\n\t\tthis.parts = parts;\n\t\tthis.quoted = quoted;\n\t}\n\t/**\n\t* Get the literal value if this word has no expansions.\n\t* Returns null if the word contains globs or command substitutions.\n\t*/\n\tget literalValue() {\n\t\tif (this.parts.every((p) => p.kind === \"literal\")) return this.parts.map((p) => p.value).join(\"\");\n\t\treturn null;\n\t}\n\t/**\n\t* Check if this word contains any glob patterns.\n\t*/\n\tget hasGlob() {\n\t\treturn this.parts.some((p) => p.kind === \"glob\");\n\t}\n\t/**\n\t* Check if this word contains command substitution.\n\t*/\n\tget hasCommandSub() {\n\t\treturn this.parts.some((p) => p.kind === \"commandSub\");\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitWord(this);\n\t}\n};\n/**\n* A literal string part of a word.\n*/\nvar LiteralPart = class {\n\tkind = \"literal\";\n\tspan;\n\tvalue;\n\tconstructor(span, value) {\n\t\tthis.span = span;\n\t\tthis.value = value;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitLiteralPart(this);\n\t}\n};\n/**\n* A glob pattern part of a word.\n* Examples: `*`, `?`, `[abc]`, `[a-z]`, `[!abc]`\n*/\nvar GlobPart = class {\n\tkind = \"glob\";\n\tspan;\n\tpattern;\n\tconstructor(span, pattern) {\n\t\tthis.span = span;\n\t\tthis.pattern = pattern;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitGlobPart(this);\n\t}\n};\n/**\n* A command substitution part of a word.\n* Example: `(ls -la)`\n*\n* The inner program is parsed recursively.\n*/\nvar CommandSubPart = class {\n\tkind = \"commandSub\";\n\tspan;\n\t/** The inner program to execute */\n\tprogram;\n\tconstructor(span, program) {\n\t\tthis.span = span;\n\t\tthis.program = program;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitCommandSubPart(this);\n\t}\n};\n/**\n* A redirection (input or output).\n* Examples: `< input.txt`, `> output.txt`\n*/\nvar Redirection = class extends ASTNode {\n\tredirectKind;\n\ttarget;\n\tconstructor(span, redirectKind, target) {\n\t\tsuper(span);\n\t\tthis.redirectKind = redirectKind;\n\t\tthis.target = target;\n\t}\n\taccept(visitor) {\n\t\treturn visitor.visitRedirection(this);\n\t}\n};\n\n//#endregion\n//#region src/parser/command.ts\n/**\n* Command parser for the Fish subset parser.\n*\n* Handles parsing of commands:\n* - Simple commands (name + args)\n* - Redirections (< > Phase 2)\n*/\n/**\n* Parser for commands.\n*\n* A command in the Fish subset is:\n* - A simple command: name followed by arguments and optional redirections\n*\n* Fish subset does NOT support:\n* - Compound commands (if, for, while, function, etc.)\n* - Background execution (&)\n* - Semicolons (;)\n*/\nvar CommandParser = class {\n\tparser;\n\twordParser;\n\tconstructor(parser, wordParser) {\n\t\tthis.parser = parser;\n\t\tthis.wordParser = wordParser;\n\t}\n\t/**\n\t* Parse a command.\n\t* Returns null if no command is present.\n\t*/\n\tparseCommand() {\n\t\treturn this.parseSimpleCommand();\n\t}\n\t/**\n\t* Parse a simple command: name + args + redirections.\n\t*\n\t* Grammar:\n\t* simple_command ::= word+ (redirection)*\n\t*/\n\tparseSimpleCommand() {\n\t\tconst startPos = this.parser.currentToken.span.start;\n\t\tconst name = this.wordParser.parseWord();\n\t\tif (!name) return null;\n\t\tconst args = [];\n\t\tconst redirections = [];\n\t\twhile (!this.isCommandTerminator()) {\n\t\t\tconst redir = this.parseRedirection();\n\t\t\tif (redir) {\n\t\t\t\tredirections.push(redir);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst word = this.wordParser.parseWord();\n\t\t\tif (word) args.push(word);\n\t\t\telse break;\n\t\t}\n\t\tconst endPos = this.parser.previousTokenPosition;\n\t\treturn new SimpleCommand(new SourceSpan(startPos, endPos), name, args, redirections);\n\t}\n\t/**\n\t* Parse a redirection if present.\n\t*\n\t* Grammar:\n\t* redirection ::= '<' word | '>' word\n\t*/\n\tparseRedirection() {\n\t\tconst token = this.parser.currentToken;\n\t\tif (token.kind === TokenKind.LESS) {\n\t\t\tconst startPos = token.span.start;\n\t\t\tthis.parser.advance();\n\t\t\tconst target = this.wordParser.parseWord();\n\t\t\tif (!target) {\n\t\t\t\tthis.parser.syntacticError(\"Expected filename after <\", \"word\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst endPos = this.parser.previousTokenPosition;\n\t\t\treturn new Redirection(new SourceSpan(startPos, endPos), \"input\", target);\n\t\t}\n\t\tif (token.kind === TokenKind.GREAT) {\n\t\t\tconst startPos = token.span.start;\n\t\t\tthis.parser.advance();\n\t\t\tconst target = this.wordParser.parseWord();\n\t\t\tif (!target) {\n\t\t\t\tthis.parser.syntacticError(\"Expected filename after >\", \"word\");\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst endPos = this.parser.previousTokenPosition;\n\t\t\treturn new Redirection(new SourceSpan(startPos, endPos), \"output\", target);\n\t\t}\n\t\treturn null;\n\t}\n\t/**\n\t* Check if current token terminates a command.\n\t*/\n\tisCommandTerminator() {\n\t\tconst kind = this.parser.currentToken.kind;\n\t\treturn kind === TokenKind.PIPE || kind === TokenKind.NEWLINE || kind === TokenKind.EOF;\n\t}\n};\n\n//#endregion\n//#region src/parser/error-reporter.ts\n/**\n* Error reporter for collecting parser diagnostics.\n*\n* Supports both immediate error throwing and error collection modes.\n*/\nvar ErrorReporter = class {\n\tdiagnostics = [];\n\terrorCount = 0;\n\twarningCount = 0;\n\t/**\n\t* Report an error.\n\t*/\n\treportError(message, span, code) {\n\t\tthis.diagnostics.push({\n\t\t\tseverity: \"error\",\n\t\t\tmessage,\n\t\t\tspan,\n\t\t\tcode\n\t\t});\n\t\tthis.errorCount++;\n\t}\n\t/**\n\t* Report a warning.\n\t*/\n\treportWarning(message, span, code) {\n\t\tthis.diagnostics.push({\n\t\t\tseverity: \"warning\",\n\t\t\tmessage,\n\t\t\tspan,\n\t\t\tcode\n\t\t});\n\t\tthis.warningCount++;\n\t}\n\t/**\n\t* Report an informational message.\n\t*/\n\treportInfo(message, span, code) {\n\t\tthis.diagnostics.push({\n\t\t\tseverity: \"info\",\n\t\t\tmessage,\n\t\t\tspan,\n\t\t\tcode\n\t\t});\n\t}\n\t/**\n\t* Check if any errors have been reported.\n\t*/\n\thasErrors() {\n\t\treturn this.errorCount > 0;\n\t}\n\t/**\n\t* Check if any warnings have been reported.\n\t*/\n\thasWarnings() {\n\t\treturn this.warningCount > 0;\n\t}\n\t/**\n\t* Get the number of errors.\n\t*/\n\tgetErrorCount() {\n\t\treturn this.errorCount;\n\t}\n\t/**\n\t* Get the number of warnings.\n\t*/\n\tgetWarningCount() {\n\t\treturn this.warningCount;\n\t}\n\t/**\n\t* Get all diagnostics.\n\t*/\n\tgetDiagnostics() {\n\t\treturn this.diagnostics;\n\t}\n\t/**\n\t* Get only error diagnostics.\n\t*/\n\tgetErrors() {\n\t\treturn this.diagnostics.filter((d) => d.severity === \"error\");\n\t}\n\t/**\n\t* Get only warning diagnostics.\n\t*/\n\tgetWarnings() {\n\t\treturn this.diagnostics.filter((d) => d.severity === \"warning\");\n\t}\n\t/**\n\t* Clear all diagnostics.\n\t*/\n\tclear() {\n\t\tthis.diagnostics.length = 0;\n\t\tthis.errorCount = 0;\n\t\tthis.warningCount = 0;\n\t}\n\t/**\n\t* Format all diagnostics as a string for display.\n\t*/\n\tformat() {\n\t\treturn this.diagnostics.map((d) => {\n\t\t\tconst loc = `${d.span.start.line}:${d.span.start.column}`;\n\t\t\tlet prefix;\n\t\t\tif (d.severity === \"error\") prefix = \"Error\";\n\t\t\telse if (d.severity === \"warning\") prefix = \"Warning\";\n\t\t\telse prefix = \"Info\";\n\t\t\tconst code = d.code ? ` [${d.code}]` : \"\";\n\t\t\treturn `${prefix}${code} at ${loc}: ${d.message}`;\n\t\t}).join(\"\\n\");\n\t}\n};\n\n//#endregion\n//#region src/parser/statement.ts\n/**\n* Statement parser for the Fish subset parser.\n*\n* Handles parsing of:\n* - Pipelines (command | command | ...)\n*\n* Fish subset does NOT support:\n* - Multiple statements (no ; or newline-separated statements)\n* - Control flow (if, for, while, etc.)\n*/\n/**\n* Parser for statements and pipelines.\n*\n* In the Fish subset, a program is a single pipeline.\n*/\nvar StatementParser = class {\n\tparser;\n\tcommandParser;\n\tconstructor(parser, commandParser) {\n\t\tthis.parser = parser;\n\t\tthis.commandParser = commandParser;\n\t}\n\t/**\n\t* Parse a pipeline.\n\t*\n\t* Grammar:\n\t* pipeline ::= command ('|' command)*\n\t*/\n\tparsePipeline() {\n\t\tconst startPos = this.parser.currentToken.span.start;\n\t\tconst firstCommand = this.commandParser.parseCommand();\n\t\tif (!firstCommand) return null;\n\t\tconst commands = [firstCommand];\n\t\twhile (this.parser.currentToken.kind === TokenKind.PIPE) {\n\t\t\tthis.parser.advance();\n\t\t\tthis.skipNewlines();\n\t\t\tconst command = this.commandParser.parseCommand();\n\t\t\tif (!command) {\n\t\t\t\tthis.parser.syntacticError(\"Expected command after |\", \"command\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcommands.push(command);\n\t\t}\n\t\tconst endPos = this.parser.previousTokenPosition;\n\t\treturn new Pipeline(new SourceSpan(startPos, endPos), commands);\n\t}\n\t/**\n\t* Skip newline tokens (for line continuation after pipe).\n\t*/\n\tskipNewlines() {\n\t\twhile (this.parser.currentToken.kind === TokenKind.NEWLINE) this.parser.advance();\n\t}\n};\n\n//#endregion\n//#region src/parser/syntax-error.ts\n/**\n* Exception thrown when a syntax error is encountered during parsing.\n*/\nvar ParseSyntaxError = class ParseSyntaxError extends Error {\n\t/** The source span where the error occurred */\n\tspan;\n\t/** Additional context about the error */\n\tcontext;\n\tconstructor(message, span, context) {\n\t\tsuper(ParseSyntaxError.formatMessage(message, span, context));\n\t\tthis.name = \"ParseSyntaxError\";\n\t\tthis.span = span;\n\t\tthis.context = context;\n\t\tif (Error.captureStackTrace) Error.captureStackTrace(this, ParseSyntaxError);\n\t}\n\t/**\n\t* Format an error message with position information.\n\t*/\n\tstatic formatMessage(message, span, context) {\n\t\tconst base = `Syntax error at ${`${span.start.line}:${span.start.column}`}: ${message}`;\n\t\treturn context ? `${base} (${context})` : base;\n\t}\n\t/**\n\t* Get the line number where the error occurred.\n\t*/\n\tget line() {\n\t\treturn this.span.start.line;\n\t}\n\t/**\n\t* Get the column number where the error occurred.\n\t*/\n\tget column() {\n\t\treturn this.span.start.column;\n\t}\n};\n/**\n* Exception thrown when the parser encounters an unexpected end of input.\n*/\nvar UnexpectedEOFError = class extends ParseSyntaxError {\n\tconstructor(expected, span) {\n\t\tsuper(`Unexpected end of input, expected ${expected}`, span);\n\t\tthis.name = \"UnexpectedEOFError\";\n\t}\n};\n/**\n* Exception thrown when the parser encounters an unexpected token.\n*/\nvar UnexpectedTokenError = class extends ParseSyntaxError {\n\tfound;\n\texpected;\n\tconstructor(found, expected, span) {\n\t\tsuper(`Unexpected token '${found}', expected ${expected}`, span);\n\t\tthis.name = \"UnexpectedTokenError\";\n\t\tthis.found = found;\n\t\tthis.expected = expected;\n\t}\n};\n\n//#endregion\n//#region src/parser/word.ts\n/**\n* Word parser for the Fish subset parser.\n*\n* Handles parsing of words and their components:\n* - Literal text\n* - Glob patterns (* ? [...])\n* - Command substitution (...)\n* - Quoted strings\n*/\n/**\n* Parser for words and word parts.\n*\n* A word can consist of:\n* - Literal parts (plain text)\n* - Glob parts (* ? [...])\n* - Command substitution parts (...)\n*/\nvar WordParser = class {\n\tparser;\n\tconstructor(parser) {\n\t\tthis.parser = parser;\n\t}\n\t/**\n\t* Parse a single word from the current position.\n\t* Returns null if no word is present.\n\t*\n\t* A word consists of a single token from the scanner.\n\t* The token may contain multiple parts (literal, glob, command substitution)\n\t* which are parsed and combined into a single Word AST node.\n\t*/\n\tparseWord() {\n\t\tconst token = this.parser.currentToken;\n\t\tif (!this.isWordToken(token)) return null;\n\t\tconst startPos = token.span.start;\n\t\tconst part = this.parseWordPart(token);\n\t\tconst parts = part ? [part] : [];\n\t\tif (parts.length === 0) return null;\n\t\tthis.parser.advance();\n\t\tconst endPos = token.span.end;\n\t\tconst span = new SourceSpan(startPos, endPos);\n\t\tconst quoted = token.isQuoted;\n\t\treturn new Word(span, parts, quoted);\n\t}\n\t/**\n\t* Parse a single word part from a token.\n\t*/\n\tparseWordPart(token) {\n\t\tif (token.hasExpansions) return this.parseCommandSubstitution(token);\n\t\tif (token.hasGlob) return this.parseGlobPart(token);\n\t\treturn new LiteralPart(token.span, token.spelling);\n\t}\n\t/**\n\t* Parse a command substitution from a token.\n\t* The token spelling contains the full (...) content.\n\t*/\n\tparseCommandSubstitution(token) {\n\t\tlet inner = token.spelling;\n\t\tif (inner.startsWith(\"(\") && inner.endsWith(\")\")) inner = inner.slice(1, -1);\n\t\tconst innerProgram = this.parser.parseSubstitution(inner);\n\t\treturn new CommandSubPart(token.span, innerProgram);\n\t}\n\t/**\n\t* Parse a glob pattern from a token.\n\t*/\n\tparseGlobPart(token) {\n\t\treturn new GlobPart(token.span, token.spelling);\n\t}\n\t/**\n\t* Check if a token can be part of a word.\n\t*/\n\tisWordToken(token) {\n\t\tconst kind = token.kind;\n\t\treturn kind === TokenKind.WORD || kind === TokenKind.NAME || kind === TokenKind.NUMBER || kind === TokenKind.GLOB || kind === TokenKind.COMMAND_SUB;\n\t}\n};\n\n//#endregion\n//#region src/parser/parser.ts\n/**\n* Main parser for the Fish subset language.\n*\n* This is a modular, recursive descent (LL-style) parser inspired by\n* the VC Parser architecture. It uses single-token lookahead (LL(1))\n* and streams tokens from the lexer.\n*\n* The parser delegates to sub-parsers:\n* - StatementParser: pipelines\n* - CommandParser: simple commands\n* - WordParser: words and expansions\n*\n* Fish subset features supported:\n* - Pipelines (|)\n* - Command substitution (...)\n* - Globbing (* ? [...])\n* - Redirections (< >) - Phase 2\n* - Comments (#)\n*\n* NOT supported:\n* - Variables ($var)\n* - Control flow (if, for, while, etc.)\n* - Functions\n* - Brace expansion\n* - Semicolons\n* - Background jobs (&)\n*/\n/**\n* Main parser class for the Fish subset language.\n*\n* Usage:\n* ```typescript\n* const parser = new Parser('ls | grep foo');\n* const ast = parser.parse();\n* ```\n*/\nvar Parser = class Parser {\n\t/** The scanner/lexer for tokenization */\n\tscanner;\n\t/** Error reporter for collecting diagnostics */\n\terrorReporter;\n\t/** Current token being examined */\n\t_currentToken;\n\t/** Position of the previous token (for span tracking) */\n\t_previousTokenPosition;\n\t/** Sub-parsers */\n\twordParser;\n\tcommandParser;\n\tstatementParser;\n\t/** Recursion depth for command substitution */\n\tsubstitutionDepth;\n\t/** Maximum recursion depth */\n\tstatic MAX_SUBSTITUTION_DEPTH = 10;\n\tconstructor(input, errorReporter, depth = 0) {\n\t\tthis.scanner = typeof input === \"string\" ? new Scanner(input) : input;\n\t\tthis.errorReporter = errorReporter ?? new ErrorReporter();\n\t\tthis.substitutionDepth = depth;\n\t\tthis._currentToken = this.scanner.getToken();\n\t\tthis._previousTokenPosition = this._currentToken.span.start;\n\t\tthis.wordParser = new WordParser(this);\n\t\tthis.commandParser = new CommandParser(this, this.wordParser);\n\t\tthis.statementParser = new StatementParser(this, this.commandParser);\n\t}\n\t/**\n\t* Parse the input and return a Program AST.\n\t* @throws SyntaxError if the input is invalid\n\t*/\n\tparse() {\n\t\treturn this.parseProgram();\n\t}\n\t/**\n\t* Get the error reporter for accessing diagnostics.\n\t*/\n\tgetErrorReporter() {\n\t\treturn this.errorReporter;\n\t}\n\t/**\n\t* Get the current token.\n\t*/\n\tget currentToken() {\n\t\treturn this._currentToken;\n\t}\n\t/**\n\t* Get the position of the previous token.\n\t*/\n\tget previousTokenPosition() {\n\t\treturn this._previousTokenPosition;\n\t}\n\t/**\n\t* Advance to the next token.\n\t*/\n\tadvance() {\n\t\tthis._previousTokenPosition = this._currentToken.span.end;\n\t\tthis._currentToken = this.scanner.getToken();\n\t}\n\t/**\n\t* Match the current token against an expected kind.\n\t* Advances if matched, throws error if not.\n\t*\n\t* @param expected The expected token kind\n\t* @throws SyntaxError if the current token doesn't match\n\t*/\n\tmatch(expected) {\n\t\tif (this._currentToken.kind === expected) {\n\t\t\tthis._previousTokenPosition = this._currentToken.span.end;\n\t\t\tthis._currentToken = this.scanner.getToken();\n\t\t} else this.syntacticError(`Expected ${Token.kindName(expected)}`, Token.kindName(expected));\n\t}\n\t/**\n\t* Accept a token if it matches the expected kind.\n\t* Returns true and advances if matched, false otherwise.\n\t*\n\t* @param expected The expected token kind\n\t* @returns true if the token was accepted\n\t*/\n\taccept(expected) {\n\t\tif (this._currentToken.kind === expected) {\n\t\t\tthis._previousTokenPosition = this._currentToken.span.end;\n\t\t\tthis._currentToken = this.scanner.getToken();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t* Check if the current token matches the expected kind.\n\t* Does not advance.\n\t*\n\t* @param expected The expected token kind\n\t* @returns true if the current token matches\n\t*/\n\tcheck(expected) {\n\t\treturn this._currentToken.kind === expected;\n\t}\n\t/**\n\t* Start tracking a span from the current token position.\n\t*/\n\tstartSpan() {\n\t\treturn this._currentToken.span.start;\n\t}\n\t/**\n\t* Finish a span at the previous token position.\n\t*/\n\tfinishSpan(start) {\n\t\treturn new SourceSpan(start, this._previousTokenPosition);\n\t}\n\t/**\n\t* Report a syntactic error and throw an exception.\n\t*\n\t* @param message Error message\n\t* @param expected What was expected (for error context)\n\t* @throws SyntaxError always\n\t*/\n\tsyntacticError(message, expected) {\n\t\tconst span = this._currentToken.span;\n\t\tthis.errorReporter.reportError(message, span);\n\t\tif (this._currentToken.kind === TokenKind.EOF) throw new UnexpectedEOFError(expected, span);\n\t\tthrow new UnexpectedTokenError(this._currentToken.spelling || Token.kindName(this._currentToken.kind), expected, span);\n\t}\n\t/**\n\t* Parse a complete program.\n\t*\n\t* Grammar:\n\t* program ::= pipeline\n\t*/\n\tparseProgram() {\n\t\tconst startPos = this.startSpan();\n\t\tthis.skipIgnorable();\n\t\tconst pipeline = this.statementParser.parsePipeline();\n\t\tif (!pipeline) this.syntacticError(\"Expected command\", \"command\");\n\t\tthis.skipIgnorable();\n\t\tif (this._currentToken.kind !== TokenKind.EOF) this.syntacticError(\"Unexpected token after pipeline\", \"end of input\");\n\t\treturn new Program(this.finishSpan(startPos), pipeline);\n\t}\n\t/**\n\t* Parse a command substitution (inner program).\n\t* Called recursively when parsing (...) content.\n\t*\n\t* @param input The inner content of the command substitution\n\t* @returns The parsed program\n\t*/\n\tparseSubstitution(input) {\n\t\tif (this.substitutionDepth >= Parser.MAX_SUBSTITUTION_DEPTH) throw new ParseSyntaxError(\"Maximum command substitution depth exceeded\", this._currentToken.span);\n\t\treturn new Parser(input, this.errorReporter, this.substitutionDepth + 1).parse();\n\t}\n\t/**\n\t* Skip comments and newlines.\n\t*/\n\tskipIgnorable() {\n\t\twhile (this._currentToken.kind === TokenKind.COMMENT || this._currentToken.kind === TokenKind.NEWLINE) this.advance();\n\t}\n};\n/**\n* Parse a Fish subset input string and return the AST.\n*\n* @param input The input string to parse\n* @returns The parsed Program AST\n* @throws SyntaxError if the input is invalid\n*/\nfunction parse(input) {\n\treturn new Parser(input).parse();\n}\n\n//#endregion\nexport { Parser, cmd, commandSub, compile, expandedWordToString, extractPathsFromExpandedWords, glob, literal, parse };","import type { Record } from '../record';\nimport type { Stream } from '../stream';\n\n/**\n * A Consumer terminates a stream.\n * It pulls values and produces a final result or side-effect.\n */\nexport type Consumer<T, R = void> = (input: Stream<T>) => Promise<R>;\n\n/**\n * Collects the entire stream into memory.\n * Pure from an API perspective.\n */\nexport function collect<T>(): Consumer<T, T[]> {\n\treturn async (input) => {\n\t\tconst out: T[] = [];\n\t\tfor await (const item of input) {\n\t\t\tout.push(item);\n\t\t}\n\t\treturn out;\n\t};\n}\n\n/**\n * Streams records directly to stdout.\n * Side-effecting, non-buffering.\n */\nexport function stdout(): Consumer<Record> {\n\treturn async (input) => {\n\t\tfor await (const record of input) {\n\t\t\tprocess.stdout.write(`${format(record)}\\n`);\n\t\t}\n\t};\n}\n\nfunction format(record: Record): string {\n\tswitch (record.kind) {\n\t\tcase 'line':\n\t\t\treturn record.text;\n\t\tcase 'json':\n\t\t\treturn JSON.stringify(record.value);\n\t\tcase 'file':\n\t\t\treturn record.path;\n\t\tdefault:\n\t\t\tthrow new Error('Unknown record kind');\n\t}\n}\n","import type { FS } from '../../fs/fs';\nimport type { LineRecord, Record } from '../../record';\nimport type { Transducer } from '../types';\n\nexport interface CatOptions {\n\tnumberLines?: boolean;\n\tnumberNonBlank?: boolean;\n\tshowAll?: boolean;\n\tshowEnds?: boolean;\n\tshowNonprinting?: boolean;\n\tshowTabs?: boolean;\n\tsqueezeBlank?: boolean;\n}\n\nfunction isLineRecord(record: Record): record is LineRecord {\n\treturn record.kind === 'line';\n}\n\nfunction formatNonPrinting(text: string): string {\n\tlet formatted = '';\n\tfor (const char of text) {\n\t\tconst code = char.charCodeAt(0);\n\t\tif (code === 9) {\n\t\t\tformatted += '\\t';\n\t\t\tcontinue;\n\t\t}\n\t\tif (code < 32) {\n\t\t\tformatted += `^${String.fromCharCode(code + 64)}`;\n\t\t\tcontinue;\n\t\t}\n\t\tif (code === 127) {\n\t\t\tformatted += '^?';\n\t\t\tcontinue;\n\t\t}\n\t\tformatted += char;\n\t}\n\treturn formatted;\n}\n\nfunction renderLineText(\n\ttext: string,\n\tlineNumber: number | null,\n\toptions: Required<CatOptions>\n): string {\n\tlet rendered = text;\n\tconst showNonprinting = options.showAll || options.showNonprinting;\n\tconst showTabs = options.showAll || options.showTabs;\n\tconst showEnds = options.showAll || options.showEnds;\n\n\tif (showNonprinting) {\n\t\trendered = formatNonPrinting(rendered);\n\t}\n\tif (showTabs) {\n\t\trendered = rendered.replaceAll('\\t', '^I');\n\t}\n\tif (showEnds) {\n\t\trendered = `${rendered}$`;\n\t}\n\tif (lineNumber !== null) {\n\t\trendered = `${lineNumber.toString().padStart(6, ' ')}\\t${rendered}`;\n\t}\n\n\treturn rendered;\n}\n\nfunction normalizeOptions(options?: CatOptions): Required<CatOptions> {\n\treturn {\n\t\tnumberLines: options?.numberLines ?? false,\n\t\tnumberNonBlank: options?.numberNonBlank ?? false,\n\t\tshowAll: options?.showAll ?? false,\n\t\tshowEnds: options?.showEnds ?? false,\n\t\tshowNonprinting: options?.showNonprinting ?? false,\n\t\tshowTabs: options?.showTabs ?? false,\n\t\tsqueezeBlank: options?.squeezeBlank ?? false,\n\t};\n}\n\ninterface CatState {\n\tpreviousWasBlank: boolean;\n\trenderedLineNumber: number;\n}\n\nfunction nextRenderedLine(\n\ttext: string,\n\tstate: CatState,\n\toptions: Required<CatOptions>\n): { isSkipped: boolean; lineNumber: number | null; text: string } {\n\tconst isBlank = text.length === 0;\n\tif (options.squeezeBlank && isBlank && state.previousWasBlank) {\n\t\treturn { isSkipped: true, lineNumber: null, text };\n\t}\n\tstate.previousWasBlank = isBlank;\n\n\tconst shouldNumber = options.numberNonBlank\n\t\t? !isBlank\n\t\t: options.numberLines;\n\tconst lineNumber = shouldNumber ? state.renderedLineNumber++ : null;\n\treturn { isSkipped: false, lineNumber, text };\n}\n\nasync function* emitLineRecord(\n\trecord: LineRecord,\n\tstate: CatState,\n\toptions: Required<CatOptions>\n): AsyncIterable<LineRecord> {\n\tconst rendered = nextRenderedLine(record.text, state, options);\n\tif (rendered.isSkipped) {\n\t\treturn;\n\t}\n\n\tyield {\n\t\t...record,\n\t\ttext: renderLineText(rendered.text, rendered.lineNumber, options),\n\t};\n}\n\nasync function* emitJsonRecord(\n\tvalue: unknown,\n\tstate: CatState,\n\toptions: Required<CatOptions>\n): AsyncIterable<LineRecord> {\n\tconst rendered = nextRenderedLine(JSON.stringify(value), state, options);\n\tif (rendered.isSkipped) {\n\t\treturn;\n\t}\n\n\tyield {\n\t\tkind: 'line',\n\t\ttext: renderLineText(rendered.text, rendered.lineNumber, options),\n\t};\n}\n\nasync function* emitFileLines(\n\tfs: FS,\n\tpath: string,\n\tstate: CatState,\n\toptions: Required<CatOptions>\n): AsyncIterable<LineRecord> {\n\tlet sourceLineNum = 1;\n\tfor await (const rawText of fs.readLines(path)) {\n\t\tconst rendered = nextRenderedLine(rawText, state, options);\n\t\tif (rendered.isSkipped) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tyield {\n\t\t\tfile: path,\n\t\t\tkind: 'line',\n\t\t\tlineNum: sourceLineNum++,\n\t\t\ttext: renderLineText(rendered.text, rendered.lineNumber, options),\n\t\t};\n\t}\n}\n\nexport function cat(\n\tfs: FS,\n\toptions?: CatOptions\n): Transducer<Record, LineRecord> {\n\tconst normalized = normalizeOptions(options);\n\tconst state: CatState = {\n\t\tpreviousWasBlank: false,\n\t\trenderedLineNumber: 1,\n\t};\n\n\treturn async function* (input) {\n\t\tfor await (const record of input) {\n\t\t\tif (isLineRecord(record)) {\n\t\t\t\tyield* emitLineRecord(record, state, normalized);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (record.kind === 'json') {\n\t\t\t\tyield* emitJsonRecord(record.value, state, normalized);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tyield* emitFileLines(fs, record.path, state, normalized);\n\t\t}\n\t};\n}\n","import type { FS } from '../../fs/fs';\nimport type { Effect } from '../types';\n\nconst TRAILING_SLASH_REGEX = /\\/+$/;\nconst MULTIPLE_SLASH_REGEX = /\\/+/g;\n\nexport interface CpArgs {\n\tsrcs: string[];\n\tdest: string;\n\trecursive: boolean;\n\tforce?: boolean;\n\tinteractive?: boolean;\n}\n\nfunction trimTrailingSlash(path: string): string {\n\treturn path.replace(TRAILING_SLASH_REGEX, '');\n}\n\nfunction joinPath(base: string, suffix: string): string {\n\treturn `${trimTrailingSlash(base)}/${suffix}`.replace(\n\t\tMULTIPLE_SLASH_REGEX,\n\t\t'/'\n\t);\n}\n\nfunction basename(path: string): string {\n\tconst normalized = trimTrailingSlash(path);\n\tconst slashIndex = normalized.lastIndexOf('/');\n\tif (slashIndex === -1) {\n\t\treturn normalized;\n\t}\n\treturn normalized.slice(slashIndex + 1);\n}\n\nasync function isDirectory(fs: FS, path: string): Promise<boolean> {\n\ttry {\n\t\tconst stat = await fs.stat(path);\n\t\treturn stat.isDirectory;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function assertCanWriteDestination(\n\tfs: FS,\n\tpath: string,\n\tforce: boolean,\n\tinteractive: boolean\n): Promise<void> {\n\tconst exists = await fs.exists(path);\n\tif (!exists) {\n\t\treturn;\n\t}\n\tif (interactive) {\n\t\tthrow new Error(`cp: destination exists (interactive): ${path}`);\n\t}\n\tif (!force) {\n\t\tthrow new Error(\n\t\t\t`cp: destination exists (use -f to overwrite): ${path}`\n\t\t);\n\t}\n}\n\nasync function copyFileWithPolicy(\n\tfs: FS,\n\tsrc: string,\n\tdest: string,\n\tforce: boolean,\n\tinteractive: boolean\n): Promise<void> {\n\tawait assertCanWriteDestination(fs, dest, force, interactive);\n\tconst content = await fs.readFile(src);\n\tawait fs.writeFile(dest, content);\n}\n\nasync function copyDirectoryRecursive(\n\tfs: FS,\n\tsrcDir: string,\n\tdestDir: string,\n\tforce: boolean,\n\tinteractive: boolean\n): Promise<void> {\n\tconst normalizedSrc = trimTrailingSlash(srcDir);\n\tconst glob = `${normalizedSrc}/**/*`;\n\tfor await (const srcPath of fs.readdir(glob)) {\n\t\tconst relativePath = srcPath.slice(normalizedSrc.length + 1);\n\t\tconst targetPath = joinPath(destDir, relativePath);\n\t\tconst sourceStat = await fs.stat(srcPath);\n\t\tif (sourceStat.isDirectory) {\n\t\t\tcontinue;\n\t\t}\n\t\tawait copyFileWithPolicy(fs, srcPath, targetPath, force, interactive);\n\t}\n}\n\nexport function cp(fs: FS): Effect<CpArgs> {\n\treturn async ({\n\t\tsrcs,\n\t\tdest,\n\t\tforce = false,\n\t\tinteractive = false,\n\t\trecursive,\n\t}) => {\n\t\tif (srcs.length === 0) {\n\t\t\tthrow new Error('cp requires at least one source');\n\t\t}\n\n\t\tconst destinationIsDirectory = await isDirectory(fs, dest);\n\t\tif (srcs.length > 1 && !destinationIsDirectory) {\n\t\t\tthrow new Error(\n\t\t\t\t'cp destination must be a directory for multiple sources'\n\t\t\t);\n\t\t}\n\n\t\tfor (const src of srcs) {\n\t\t\tconst srcStat = await fs.stat(src);\n\t\t\tconst targetPath =\n\t\t\t\tdestinationIsDirectory || srcs.length > 1\n\t\t\t\t\t? joinPath(dest, basename(src))\n\t\t\t\t\t: dest;\n\n\t\t\tif (srcStat.isDirectory) {\n\t\t\t\tif (!recursive) {\n\t\t\t\t\tthrow new Error(`cp: omitting directory \"${src}\" (use -r)`);\n\t\t\t\t}\n\t\t\t\tawait copyDirectoryRecursive(\n\t\t\t\t\tfs,\n\t\t\t\t\tsrc,\n\t\t\t\t\ttargetPath,\n\t\t\t\t\tforce,\n\t\t\t\t\tinteractive\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tawait copyFileWithPolicy(fs, src, targetPath, force, interactive);\n\t\t}\n\t};\n}\n","import type { FS } from '../../fs/fs';\nimport type { FileRecord, LineRecord } from '../../record';\nimport type { Transducer } from '../types';\n\nexport function headLines(n: number): Transducer<LineRecord, LineRecord> {\n\treturn async function* (input) {\n\t\tlet emitted = 0;\n\t\tfor await (const line of input) {\n\t\t\tif (emitted >= n) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\temitted++;\n\t\t\tyield line;\n\t\t}\n\t};\n}\n\nexport function head(fs: FS): Transducer<FileRecord, LineRecord> {\n\treturn async function* (input) {\n\t\tfor await (const file of input) {\n\t\t\tlet lineNum = 0;\n\t\t\tfor await (const text of fs.readLines(file.path)) {\n\t\t\t\tif (lineNum >= 10) {\n\t\t\t\t\tbreak; // Default to 10 lines\n\t\t\t\t}\n\t\t\t\tyield {\n\t\t\t\t\tfile: file.path,\n\t\t\t\t\tkind: 'line',\n\t\t\t\t\tlineNum: ++lineNum,\n\t\t\t\t\ttext,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t};\n}\n\nexport function headWithN(\n\tfs: FS,\n\tn: number\n): Transducer<FileRecord, LineRecord> {\n\treturn async function* (input) {\n\t\tfor await (const file of input) {\n\t\t\tlet lineNum = 0;\n\t\t\tfor await (const text of fs.readLines(file.path)) {\n\t\t\t\tif (lineNum >= n) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tyield {\n\t\t\t\t\tfile: file.path,\n\t\t\t\t\tkind: 'line',\n\t\t\t\t\tlineNum: ++lineNum,\n\t\t\t\t\ttext,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t};\n}\n","import type { FS } from '../../fs/fs';\nimport type { FileRecord } from '../../record';\nimport type { Stream } from '../../stream';\n\nexport interface LsOptions {\n\tshowAll?: boolean;\n}\n\nfunction basename(path: string): string {\n\tconst normalized = path.replace(/\\/+$/g, '');\n\tconst slashIndex = normalized.lastIndexOf('/');\n\tif (slashIndex === -1) {\n\t\treturn normalized;\n\t}\n\treturn normalized.slice(slashIndex + 1);\n}\n\nexport async function* ls(\n\tfs: FS,\n\tpath: string,\n\toptions?: LsOptions\n): Stream<FileRecord> {\n\tconst showAll = options?.showAll ?? false;\n\tfor await (const listedPath of fs.readdir(path)) {\n\t\tif (!showAll && basename(listedPath).startsWith('.')) {\n\t\t\tcontinue;\n\t\t}\n\t\tyield { kind: 'file', path: listedPath };\n\t}\n}\n","import type { FS } from '../../fs/fs';\nimport type { Effect } from '../types';\n\nexport function mkdir(fs: FS): Effect<{\n\tpath: string;\n\trecursive: boolean;\n}> {\n\treturn async ({ path, recursive }) => {\n\t\tawait fs.mkdir(path, recursive);\n\t};\n}\n","import type { FS } from '../../fs/fs';\nimport type { Effect } from '../types';\n\nconst TRAILING_SLASH_REGEX = /\\/+$/;\nconst MULTIPLE_SLASH_REGEX = /\\/+/g;\n\nexport interface MvArgs {\n\tsrcs: string[];\n\tdest: string;\n\tforce?: boolean;\n\tinteractive?: boolean;\n}\n\nfunction trimTrailingSlash(path: string): string {\n\treturn path.replace(TRAILING_SLASH_REGEX, '');\n}\n\nfunction extractFileName(path: string): string {\n\tconst normalized = trimTrailingSlash(path);\n\tconst lastSlashIndex = normalized.lastIndexOf('/');\n\tif (lastSlashIndex === -1) {\n\t\treturn normalized;\n\t}\n\treturn normalized.slice(lastSlashIndex + 1);\n}\n\nfunction joinPath(base: string, suffix: string): string {\n\treturn `${trimTrailingSlash(base)}/${suffix}`.replace(\n\t\tMULTIPLE_SLASH_REGEX,\n\t\t'/'\n\t);\n}\n\nasync function isDirectory(fs: FS, path: string): Promise<boolean> {\n\ttry {\n\t\tconst stat = await fs.stat(path);\n\t\treturn stat.isDirectory;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function assertCanMoveToDestination(\n\tfs: FS,\n\tdest: string,\n\tforce: boolean,\n\tinteractive: boolean\n): Promise<void> {\n\tconst exists = await fs.exists(dest);\n\tif (!exists) {\n\t\treturn;\n\t}\n\tif (interactive) {\n\t\tthrow new Error(`mv: destination exists (interactive): ${dest}`);\n\t}\n\tif (!force) {\n\t\tthrow new Error(\n\t\t\t`mv: destination exists (use -f to overwrite): ${dest}`\n\t\t);\n\t}\n}\n\nexport function mv(fs: FS): Effect<MvArgs> {\n\treturn async ({ srcs, dest, force = false, interactive = false }) => {\n\t\tif (srcs.length === 0) {\n\t\t\tthrow new Error('mv requires at least one source');\n\t\t}\n\n\t\tconst destinationIsDirectory = await isDirectory(fs, dest);\n\t\tif (srcs.length > 1 && !destinationIsDirectory) {\n\t\t\tthrow new Error(\n\t\t\t\t'mv destination must be a directory for multiple sources'\n\t\t\t);\n\t\t}\n\n\t\tfor (const src of srcs) {\n\t\t\tconst sourceStat = await fs.stat(src);\n\t\t\tif (sourceStat.isDirectory) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`mv: directory moves are not supported: ${src}`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst targetPath =\n\t\t\t\tdestinationIsDirectory || srcs.length > 1\n\t\t\t\t\t? joinPath(dest, extractFileName(src))\n\t\t\t\t\t: dest;\n\n\t\t\tawait assertCanMoveToDestination(\n\t\t\t\tfs,\n\t\t\t\ttargetPath,\n\t\t\t\tforce,\n\t\t\t\tinteractive\n\t\t\t);\n\t\t\tawait moveFile(fs, src, targetPath);\n\t\t}\n\t};\n}\n\nasync function moveFile(fs: FS, src: string, dest: string): Promise<void> {\n\tconst content = await fs.readFile(src);\n\tawait fs.writeFile(dest, content);\n\tawait fs.deleteFile(src);\n}\n","import type { LineRecord } from '../../record';\nimport type { Stream } from '../../stream';\n\nconst ROOT_DIRECTORY = '/';\n\nexport async function* pwd(cwd = ROOT_DIRECTORY): Stream<LineRecord> {\n\tyield { kind: 'line', text: cwd };\n}\n","import type { FS } from '../../fs/fs';\nimport type { Effect } from '../types';\n\nexport interface RmArgs {\n\tpath: string;\n\trecursive: boolean;\n\tforce?: boolean;\n\tinteractive?: boolean;\n}\n\nexport function rm(fs: FS): Effect<RmArgs> {\n\treturn async ({ path, recursive, force = false, interactive = false }) => {\n\t\tif (interactive) {\n\t\t\tthrow new Error(`rm: interactive mode is not supported: ${path}`);\n\t\t}\n\n\t\tlet stat: Awaited<ReturnType<FS['stat']>> | null = null;\n\t\ttry {\n\t\t\tstat = await fs.stat(path);\n\t\t} catch {\n\t\t\tif (force) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthrow new Error(`File not found: ${path}`);\n\t\t}\n\n\t\tif (!stat.isDirectory) {\n\t\t\tawait fs.deleteFile(path);\n\t\t\treturn;\n\t\t}\n\n\t\tif (!recursive) {\n\t\t\tthrow new Error(`rm: cannot remove '${path}': Is a directory`);\n\t\t}\n\t\tawait fs.deleteDirectory(path, true);\n\t};\n}\n","import type { LineRecord } from '../../record';\nimport type { Transducer } from '../types';\n\nexport function tail(n: number): Transducer<LineRecord, LineRecord> {\n\treturn async function* (input) {\n\t\tconst buf: LineRecord[] = [];\n\t\tfor await (const x of input) {\n\t\t\tbuf.push(x);\n\t\t\tif (buf.length > n) {\n\t\t\t\tbuf.shift();\n\t\t\t}\n\t\t}\n\t\tyield* buf;\n\t};\n}\n","import type { FS } from '../../fs/fs';\nimport type { Effect } from '../types';\n\nexport interface TouchArgs {\n\tfiles: string[];\n\taccessTimeOnly?: boolean;\n\tmodificationTimeOnly?: boolean;\n}\n\nexport function touch(fs: FS): Effect<TouchArgs> {\n\treturn async ({\n\t\tfiles,\n\t\taccessTimeOnly = false,\n\t\tmodificationTimeOnly = false,\n\t}) => {\n\t\tconst shouldUpdateMtime = !accessTimeOnly || modificationTimeOnly;\n\n\t\tfor (const file of files) {\n\t\t\tif (!(await fs.exists(file))) {\n\t\t\t\tawait fs.writeFile(file, new Uint8Array());\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (shouldUpdateMtime) {\n\t\t\t\tconst content = await fs.readFile(file);\n\t\t\t\tawait fs.writeFile(file, content);\n\t\t\t}\n\t\t}\n\t};\n}\n","import type { FS } from '../fs/fs';\nimport type { Transducer } from '../operator/types';\nimport type { FileRecord, LineRecord } from '../record';\nimport type { Stream } from '../stream';\n\nexport function lines(fs: FS): Transducer<FileRecord, LineRecord> {\n\treturn async function* (input) {\n\t\tfor await (const f of input) {\n\t\t\tlet lineNum = 1;\n\t\t\tfor await (const line of fs.readLines(f.path)) {\n\t\t\t\tyield {\n\t\t\t\t\tfile: f.path,\n\t\t\t\t\tkind: 'line',\n\t\t\t\t\tlineNum: lineNum++,\n\t\t\t\t\ttext: line,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t};\n}\n\nexport async function* files(...paths: string[]): Stream<FileRecord> {\n\tfor (const path of paths) {\n\t\tyield { kind: 'file', path };\n\t}\n}\n","import {\n\texpandedWordToString,\n\textractPathsFromExpandedWords,\n\ttype PipelineIR,\n\ttype RedirectionIR,\n\ttype StepIR,\n} from '@shfs/compiler';\nimport type { FS } from '../fs/fs';\nimport { cat } from '../operator/cat/cat';\nimport { cp } from '../operator/cp/cp';\nimport { headLines, headWithN } from '../operator/head/head';\nimport { ls } from '../operator/ls/ls';\nimport { mkdir } from '../operator/mkdir/mkdir';\nimport { mv } from '../operator/mv/mv';\nimport { pwd } from '../operator/pwd/pwd';\nimport { rm } from '../operator/rm/rm';\nimport { tail } from '../operator/tail/tail';\nimport { touch } from '../operator/touch/touch';\nimport type { LineRecord, Record } from '../record';\nimport type { Stream } from '../stream';\nimport { files } from './producers';\n\nexport type ExecuteResult =\n\t| { kind: 'stream'; value: Stream<Record> }\n\t| { kind: 'sink'; value: Promise<void> };\n\nexport interface ExecuteContext {\n\tcwd: string;\n}\n\nconst textEncoder = new TextEncoder();\nconst EFFECT_COMMANDS = new Set(['cd', 'cp', 'mkdir', 'mv', 'rm', 'touch']);\nconst LS_GLOB_PATTERN_REGEX = /[*?]/;\nconst MULTIPLE_SLASH_REGEX = /\\/+/g;\nconst TRAILING_SLASH_REGEX = /\\/+$/;\nconst ROOT_DIRECTORY = '/';\n\ntype EffectStep = Extract<\n\tStepIR,\n\t{ cmd: 'cd' | 'cp' | 'mkdir' | 'mv' | 'rm' | 'touch' }\n>;\ntype StreamStep = Exclude<StepIR, EffectStep>;\n\nfunction isEffectStep(step: StepIR): step is EffectStep {\n\treturn EFFECT_COMMANDS.has(step.cmd);\n}\n\nasync function* emptyStream<T>(): Stream<T> {\n\t// no records\n}\n\n/**\n * Execute compiles a PipelineIR into an executable result.\n * Returns either a stream (for producers/transducers) or a promise (for sinks).\n */\nexport function execute(\n\tir: PipelineIR,\n\tfs: FS,\n\tcontext: ExecuteContext = { cwd: ROOT_DIRECTORY }\n): ExecuteResult {\n\tconst normalizedContext = normalizeContext(context);\n\n\tif (ir.steps.length === 0) {\n\t\treturn {\n\t\t\tkind: 'stream',\n\t\t\tvalue: emptyStream<Record>(),\n\t\t};\n\t}\n\n\tconst lastStep = ir.steps.at(-1);\n\tif (!lastStep) {\n\t\treturn {\n\t\t\tkind: 'stream',\n\t\t\tvalue: emptyStream<Record>(),\n\t\t};\n\t}\n\n\tif (isEffectStep(lastStep)) {\n\t\tfor (const [index, step] of ir.steps.entries()) {\n\t\t\tif (isEffectStep(step) && index !== ir.steps.length - 1) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Unsupported pipeline: \"${step.cmd}\" must be the final command`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tconst sink = executePipelineToSink(ir.steps, fs, normalizedContext);\n\t\treturn applyOutputRedirect(\n\t\t\t{\n\t\t\t\tkind: 'sink',\n\t\t\t\tvalue: sink,\n\t\t\t},\n\t\t\tlastStep,\n\t\t\tfs\n\t\t);\n\t}\n\n\tconst stream = executePipelineToStream(ir.steps, fs, normalizedContext);\n\treturn applyOutputRedirect(\n\t\t{\n\t\t\tkind: 'stream',\n\t\t\tvalue: stream,\n\t\t},\n\t\tlastStep,\n\t\tfs\n\t);\n}\n\nfunction executePipelineToStream(\n\tsteps: StepIR[],\n\tfs: FS,\n\tcontext: ExecuteContext\n): Stream<Record> {\n\treturn (async function* () {\n\t\tlet stream: Stream<Record> | null = null;\n\t\tfor (const step of steps) {\n\t\t\tif (isEffectStep(step)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Unsupported pipeline: \"${step.cmd}\" requires being the final command`\n\t\t\t\t);\n\t\t\t}\n\t\t\tstream = executeStreamStep(step, fs, stream, context);\n\t\t}\n\n\t\tif (!stream) {\n\t\t\treturn;\n\t\t}\n\t\tyield* stream;\n\t})();\n}\n\nasync function executePipelineToSink(\n\tsteps: StepIR[],\n\tfs: FS,\n\tcontext: ExecuteContext\n): Promise<void> {\n\tconst finalStep = steps.at(-1);\n\tif (!(finalStep && isEffectStep(finalStep))) {\n\t\treturn;\n\t}\n\n\tif (steps.length > 1) {\n\t\tconst stream = executePipelineToStream(steps.slice(0, -1), fs, context);\n\t\tfor await (const _record of stream) {\n\t\t\t// drain\n\t\t}\n\t}\n\n\tawait executeEffectStep(finalStep, fs, context);\n}\n\nfunction executeStreamStep(\n\tstep: StreamStep,\n\tfs: FS,\n\tinput: Stream<Record> | null,\n\tcontext: ExecuteContext\n): Stream<Record> {\n\tswitch (step.cmd) {\n\t\tcase 'cat': {\n\t\t\tconst options = {\n\t\t\t\tnumberLines: step.args.numberLines,\n\t\t\t\tnumberNonBlank: step.args.numberNonBlank,\n\t\t\t\tshowAll: step.args.showAll,\n\t\t\t\tshowEnds: step.args.showEnds,\n\t\t\t\tshowNonprinting: step.args.showNonprinting,\n\t\t\t\tshowTabs: step.args.showTabs,\n\t\t\t\tsqueezeBlank: step.args.squeezeBlank,\n\t\t\t};\n\t\t\tconst inputPath = getRedirectPath(step.redirections, 'input');\n\t\t\tconst filePaths = withInputRedirect(\n\t\t\t\textractPathsFromExpandedWords(step.args.files),\n\t\t\t\tinputPath\n\t\t\t);\n\t\t\tif (filePaths.length > 0) {\n\t\t\t\treturn cat(fs, options)(files(...filePaths));\n\t\t\t}\n\t\t\tif (input) {\n\t\t\t\treturn cat(fs, options)(input);\n\t\t\t}\n\t\t\treturn emptyStream<Record>();\n\t\t}\n\t\tcase 'head': {\n\t\t\tconst inputPath = getRedirectPath(step.redirections, 'input');\n\t\t\tconst filePaths = withInputRedirect(\n\t\t\t\textractPathsFromExpandedWords(step.args.files),\n\t\t\t\tinputPath\n\t\t\t);\n\t\t\tif (filePaths.length > 0) {\n\t\t\t\treturn headWithN(fs, step.args.n)(files(...filePaths));\n\t\t\t}\n\t\t\tif (!input) {\n\t\t\t\treturn emptyStream<Record>();\n\t\t\t}\n\t\t\treturn headLines(step.args.n)(toLineStream(fs, input));\n\t\t}\n\t\tcase 'ls': {\n\t\t\tconst paths = extractPathsFromExpandedWords(step.args.paths);\n\t\t\treturn (async function* () {\n\t\t\t\tfor (const inputPath of paths) {\n\t\t\t\t\tconst resolvedPath = await resolveLsPath(fs, inputPath);\n\t\t\t\t\tfor await (const fileRecord of ls(fs, resolvedPath, {\n\t\t\t\t\t\tshowAll: step.args.showAll,\n\t\t\t\t\t})) {\n\t\t\t\t\t\tif (step.args.longFormat) {\n\t\t\t\t\t\t\tconst stat = await fs.stat(fileRecord.path);\n\t\t\t\t\t\t\tyield {\n\t\t\t\t\t\t\t\tkind: 'line',\n\t\t\t\t\t\t\t\ttext: formatLongListing(fileRecord.path, stat),\n\t\t\t\t\t\t\t} as const;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tyield fileRecord;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})();\n\t\t}\n\t\tcase 'tail': {\n\t\t\tconst inputPath = getRedirectPath(step.redirections, 'input');\n\t\t\tconst filePaths = withInputRedirect(\n\t\t\t\textractPathsFromExpandedWords(step.args.files),\n\t\t\t\tinputPath\n\t\t\t);\n\t\t\tif (filePaths.length > 0) {\n\t\t\t\treturn (async function* () {\n\t\t\t\t\tfor (const filePath of filePaths) {\n\t\t\t\t\t\tyield* tail(step.args.n)(cat(fs)(files(filePath)));\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t}\n\t\t\tif (!input) {\n\t\t\t\treturn emptyStream<Record>();\n\t\t\t}\n\t\t\treturn tail(step.args.n)(toLineStream(fs, input));\n\t\t}\n\t\tcase 'pwd': {\n\t\t\treturn pwd(context.cwd);\n\t\t}\n\t\tdefault: {\n\t\t\tconst _exhaustive: never = step;\n\t\t\tthrow new Error(\n\t\t\t\t`Unknown command: ${String((_exhaustive as { cmd: string }).cmd)}`\n\t\t\t);\n\t\t}\n\t}\n}\n\nfunction normalizeAbsolutePath(path: string): string {\n\tconst withLeadingSlash = path.startsWith(ROOT_DIRECTORY)\n\t\t? path\n\t\t: `${ROOT_DIRECTORY}${path}`;\n\tconst singleSlashes = withLeadingSlash.replace(MULTIPLE_SLASH_REGEX, '/');\n\tconst segments = singleSlashes.split(ROOT_DIRECTORY);\n\tconst normalizedSegments: string[] = [];\n\tfor (const segment of segments) {\n\t\tif (segment === '' || segment === '.') {\n\t\t\tcontinue;\n\t\t}\n\t\tif (segment === '..') {\n\t\t\tnormalizedSegments.pop();\n\t\t\tcontinue;\n\t\t}\n\t\tnormalizedSegments.push(segment);\n\t}\n\tconst normalizedPath = `${ROOT_DIRECTORY}${normalizedSegments.join(ROOT_DIRECTORY)}`;\n\treturn normalizedPath === '' ? ROOT_DIRECTORY : normalizedPath;\n}\n\nfunction normalizeCwd(cwd: string): string {\n\tif (cwd === '') {\n\t\treturn ROOT_DIRECTORY;\n\t}\n\tconst normalized = normalizeAbsolutePath(cwd);\n\tconst trimmed = normalized.replace(TRAILING_SLASH_REGEX, '');\n\treturn trimmed === '' ? ROOT_DIRECTORY : trimmed;\n}\n\nfunction normalizeContext(context: ExecuteContext): ExecuteContext {\n\tcontext.cwd = normalizeCwd(context.cwd);\n\treturn context;\n}\n\nfunction resolvePathFromCwd(cwd: string, path: string): string {\n\tif (path === '') {\n\t\treturn cwd;\n\t}\n\tif (path.startsWith(ROOT_DIRECTORY)) {\n\t\treturn normalizeAbsolutePath(path);\n\t}\n\treturn normalizeAbsolutePath(`${cwd}/${path}`);\n}\n\nasync function executeEffectStep(\n\tstep: EffectStep,\n\tfs: FS,\n\tcontext: ExecuteContext\n): Promise<void> {\n\tswitch (step.cmd) {\n\t\tcase 'cd': {\n\t\t\tconst requestedPath = expandedWordToString(step.args.path);\n\t\t\tconst resolvedPath = resolvePathFromCwd(context.cwd, requestedPath);\n\t\t\tlet stat: Awaited<ReturnType<FS['stat']>>;\n\t\t\ttry {\n\t\t\t\tstat = await fs.stat(resolvedPath);\n\t\t\t} catch {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`cd: no such file or directory: ${requestedPath}`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!stat.isDirectory) {\n\t\t\t\tthrow new Error(`cd: not a directory: ${requestedPath}`);\n\t\t\t}\n\n\t\t\tcontext.cwd = resolvedPath;\n\t\t\tbreak;\n\t\t}\n\t\tcase 'cp': {\n\t\t\tconst srcPaths = extractPathsFromExpandedWords(step.args.srcs);\n\t\t\tconst destPath = expandedWordToString(step.args.dest);\n\t\t\tawait cp(fs)({\n\t\t\t\tsrcs: srcPaths,\n\t\t\t\tdest: destPath,\n\t\t\t\tforce: step.args.force,\n\t\t\t\tinteractive: step.args.interactive,\n\t\t\t\trecursive: step.args.recursive,\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tcase 'mkdir': {\n\t\t\tconst paths = extractPathsFromExpandedWords(step.args.paths);\n\t\t\tfor (const path of paths) {\n\t\t\t\tawait mkdir(fs)({ path, recursive: step.args.recursive });\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'mv': {\n\t\t\tconst srcPaths = extractPathsFromExpandedWords(step.args.srcs);\n\t\t\tconst destPath = expandedWordToString(step.args.dest);\n\t\t\tawait mv(fs)({\n\t\t\t\tsrcs: srcPaths,\n\t\t\t\tdest: destPath,\n\t\t\t\tforce: step.args.force,\n\t\t\t\tinteractive: step.args.interactive,\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tcase 'rm': {\n\t\t\tconst paths = extractPathsFromExpandedWords(step.args.paths);\n\t\t\tfor (const path of paths) {\n\t\t\t\tawait rm(fs)({\n\t\t\t\t\tpath,\n\t\t\t\t\tforce: step.args.force,\n\t\t\t\t\tinteractive: step.args.interactive,\n\t\t\t\t\trecursive: step.args.recursive,\n\t\t\t\t});\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'touch': {\n\t\t\tconst filePaths = extractPathsFromExpandedWords(step.args.files);\n\t\t\tawait touch(fs)({\n\t\t\t\tfiles: filePaths,\n\t\t\t\taccessTimeOnly: step.args.accessTimeOnly,\n\t\t\t\tmodificationTimeOnly: step.args.modificationTimeOnly,\n\t\t\t});\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tconst _exhaustive: never = step;\n\t\t\tthrow new Error(\n\t\t\t\t`Unknown command: ${String((_exhaustive as { cmd: string }).cmd)}`\n\t\t\t);\n\t\t}\n\t}\n}\n\nasync function* toLineStream(\n\tfs: FS,\n\tinput: Stream<Record>\n): Stream<LineRecord> {\n\tfor await (const record of input) {\n\t\tif (record.kind === 'line') {\n\t\t\tyield record;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (record.kind === 'file') {\n\t\t\tlet lineNum = 1;\n\t\t\tfor await (const text of fs.readLines(record.path)) {\n\t\t\t\tyield {\n\t\t\t\t\tkind: 'line',\n\t\t\t\t\ttext,\n\t\t\t\t\tfile: record.path,\n\t\t\t\t\tlineNum: lineNum++,\n\t\t\t\t};\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tyield {\n\t\t\tkind: 'line',\n\t\t\ttext: JSON.stringify(record.value),\n\t\t};\n\t}\n}\n\nfunction formatLongListing(\n\tpath: string,\n\tstat: Awaited<ReturnType<FS['stat']>>\n): string {\n\tconst mode = stat.isDirectory ? 'd' : '-';\n\tconst size = String(stat.size).padStart(8, ' ');\n\treturn `${mode} ${size} ${stat.mtime.toISOString()} ${path}`;\n}\n\nfunction normalizeLsPath(path: string): string {\n\tif (path === '.' || path === './') {\n\t\treturn '/';\n\t}\n\tif (path.startsWith('./')) {\n\t\treturn `/${path.slice(2)}`;\n\t}\n\tif (path.startsWith('/')) {\n\t\treturn path;\n\t}\n\treturn `/${path}`;\n}\n\nfunction trimTrailingSlash(path: string): string {\n\tif (path === '/') {\n\t\treturn path;\n\t}\n\treturn path.replace(TRAILING_SLASH_REGEX, '');\n}\n\nasync function resolveLsPath(fs: FS, path: string): Promise<string> {\n\tconst normalizedPath = normalizeLsPath(path);\n\tif (LS_GLOB_PATTERN_REGEX.test(normalizedPath)) {\n\t\treturn normalizedPath;\n\t}\n\n\ttry {\n\t\tconst stat = await fs.stat(normalizedPath);\n\t\tif (!stat.isDirectory) {\n\t\t\treturn normalizedPath;\n\t\t}\n\t} catch {\n\t\treturn normalizedPath;\n\t}\n\n\tconst directoryPath = trimTrailingSlash(normalizedPath);\n\tif (directoryPath === '/') {\n\t\treturn '/*';\n\t}\n\treturn `${directoryPath}/*`;\n}\n\nfunction getRedirectPath(\n\tredirections: RedirectionIR[] | undefined,\n\tkind: RedirectionIR['kind']\n): string | null {\n\tif (!redirections) {\n\t\treturn null;\n\t}\n\n\tlet redirectedPath: string | null = null;\n\tfor (const redirection of redirections) {\n\t\tif (redirection.kind === kind) {\n\t\t\tredirectedPath = expandedWordToString(redirection.target);\n\t\t}\n\t}\n\treturn redirectedPath;\n}\n\nfunction withInputRedirect(\n\tpaths: string[],\n\tinputPath: string | null\n): string[] {\n\tif (paths.length > 0 || !inputPath) {\n\t\treturn paths;\n\t}\n\treturn [inputPath];\n}\n\nfunction applyOutputRedirect(\n\tresult: ExecuteResult,\n\tstep: StepIR,\n\tfs: FS\n): ExecuteResult {\n\tconst outputPath = getRedirectPath(step.redirections, 'output');\n\tif (!outputPath) {\n\t\treturn result;\n\t}\n\n\tif (result.kind === 'stream') {\n\t\treturn {\n\t\t\tkind: 'sink',\n\t\t\tvalue: writeStreamToFile(result.value, outputPath, fs),\n\t\t};\n\t}\n\n\treturn {\n\t\tkind: 'sink',\n\t\tvalue: result.value.then(async () => {\n\t\t\tawait fs.writeFile(outputPath, textEncoder.encode(''));\n\t\t}),\n\t};\n}\n\nasync function writeStreamToFile(\n\tstream: Stream<Record>,\n\tpath: string,\n\tfs: FS\n): Promise<void> {\n\tconst outputChunks: string[] = [];\n\tfor await (const record of stream) {\n\t\toutputChunks.push(formatRecord(record));\n\t}\n\tawait fs.writeFile(path, textEncoder.encode(outputChunks.join('\\n')));\n}\n\nfunction formatRecord(record: Record): string {\n\tswitch (record.kind) {\n\t\tcase 'line':\n\t\t\treturn record.text;\n\t\tcase 'file':\n\t\t\treturn record.path;\n\t\tcase 'json':\n\t\t\treturn JSON.stringify(record.value);\n\t\tdefault:\n\t\t\tthrow new Error('Unknown record kind');\n\t}\n}\n","export function lazy<T>(fn: () => T) {\n\tlet value: T | undefined;\n\tlet loaded = false;\n\n\treturn (): T => {\n\t\tif (loaded) {\n\t\t\treturn value as T;\n\t\t}\n\n\t\tloaded = true;\n\t\tvalue = fn();\n\t\treturn value as T;\n\t};\n}\n","import { compile, type PipelineIR, parse } from '@shfs/compiler';\n\nimport { collect } from '../consumer/consumer';\nimport { type ExecuteResult, execute } from '../execute/execute';\nimport type { FS } from '../fs/fs';\nimport type { Record } from '../record';\nimport { lazy } from '../util/lazy';\n\nconst ROOT_DIRECTORY = '/';\nconst MULTIPLE_SLASH_REGEX = /\\/+/g;\nconst TRAILING_SLASH_REGEX = /\\/+$/;\n\nexport interface ShellOptions {\n\tcwd?: string;\n}\n\nexport interface ShellCommand {\n\tcwd(path: string): ShellCommand;\n\tjson(): Promise<unknown[]>;\n\tlines(): Promise<string[]>;\n\traw(): Promise<Record[]>;\n\tstdout(): Promise<void>;\n\ttext(): Promise<string>;\n}\n\nfunction normalizeAbsolutePath(path: string): string {\n\tconst withLeadingSlash = path.startsWith(ROOT_DIRECTORY)\n\t\t? path\n\t\t: `${ROOT_DIRECTORY}${path}`;\n\tconst singleSlashes = withLeadingSlash.replace(MULTIPLE_SLASH_REGEX, '/');\n\tconst segments = singleSlashes.split(ROOT_DIRECTORY);\n\tconst normalizedSegments: string[] = [];\n\tfor (const segment of segments) {\n\t\tif (segment === '' || segment === '.') {\n\t\t\tcontinue;\n\t\t}\n\t\tif (segment === '..') {\n\t\t\tnormalizedSegments.pop();\n\t\t\tcontinue;\n\t\t}\n\t\tnormalizedSegments.push(segment);\n\t}\n\treturn `${ROOT_DIRECTORY}${normalizedSegments.join(ROOT_DIRECTORY)}`;\n}\n\nfunction normalizeCwd(cwd: string): string {\n\tif (cwd === '') {\n\t\treturn ROOT_DIRECTORY;\n\t}\n\tconst normalized = normalizeAbsolutePath(cwd);\n\tconst trimmed = normalized.replace(TRAILING_SLASH_REGEX, '');\n\treturn trimmed === '' ? ROOT_DIRECTORY : trimmed;\n}\n\nasync function collectRecords(result: ExecuteResult): Promise<Record[]> {\n\tif (result.kind === 'sink') {\n\t\tawait result.value;\n\t\treturn [];\n\t}\n\treturn collect<Record>()(result.value);\n}\n\nexport class Shell {\n\tprivate readonly fs: FS;\n\tprivate currentCwd: string;\n\n\tconstructor(fs: FS, options: ShellOptions = {}) {\n\t\tthis.fs = fs;\n\t\tthis.currentCwd = normalizeCwd(options.cwd ?? ROOT_DIRECTORY);\n\t}\n\n\t$ = (strings: TemplateStringsArray, ...exprs: unknown[]) => {\n\t\treturn this._exec(strings, ...exprs);\n\t};\n\n\texec(strings: TemplateStringsArray, ...exprs: unknown[]) {\n\t\treturn this._exec(strings, ...exprs);\n\t}\n\n\tcwd(newCwd: string): void {\n\t\tthis.currentCwd = normalizeCwd(newCwd);\n\t}\n\n\tprivate _exec(strings: TemplateStringsArray, ...exprs: unknown[]) {\n\t\tconst source = String.raw(strings, ...exprs);\n\t\tconst fs = this.fs;\n\t\tlet cwdOverride: string | undefined;\n\t\tconst runWithContext = async (): Promise<Record[]> => {\n\t\t\tconst commandStartCwd = normalizeCwd(\n\t\t\t\tcwdOverride ?? this.currentCwd\n\t\t\t);\n\t\t\tconst context = { cwd: commandStartCwd };\n\t\t\ttry {\n\t\t\t\treturn await collectRecords(execute(ir(), fs, context));\n\t\t\t} finally {\n\t\t\t\tif (\n\t\t\t\t\tcwdOverride === undefined ||\n\t\t\t\t\tcontext.cwd !== commandStartCwd\n\t\t\t\t) {\n\t\t\t\t\tthis.currentCwd = context.cwd;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tconst runStdoutWithContext = async (): Promise<void> => {\n\t\t\tconst commandStartCwd = normalizeCwd(\n\t\t\t\tcwdOverride ?? this.currentCwd\n\t\t\t);\n\t\t\tconst context = { cwd: commandStartCwd };\n\t\t\ttry {\n\t\t\t\tconst result = execute(ir(), fs, context);\n\t\t\t\tif (result.kind === 'sink') {\n\t\t\t\t\tawait result.value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfor await (const r of result.value) {\n\t\t\t\t\tif (r.kind === 'line') {\n\t\t\t\t\t\tprocess.stdout.write(`${r.text}\\n`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tif (\n\t\t\t\t\tcwdOverride === undefined ||\n\t\t\t\t\tcontext.cwd !== commandStartCwd\n\t\t\t\t) {\n\t\t\t\t\tthis.currentCwd = context.cwd;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tconst ir = lazy<PipelineIR>(() => {\n\t\t\tconst ast = parse(source);\n\t\t\treturn compile(ast);\n\t\t});\n\n\t\tconst command: ShellCommand = {\n\t\t\tcwd(path: string): ShellCommand {\n\t\t\t\tcwdOverride = normalizeCwd(path);\n\t\t\t\treturn command;\n\t\t\t},\n\n\t\t\tasync json(): Promise<unknown[]> {\n\t\t\t\tconst records = await runWithContext();\n\t\t\t\treturn records\n\t\t\t\t\t.filter((r) => r.kind === 'json')\n\t\t\t\t\t.map((r) => r.value);\n\t\t\t},\n\n\t\t\tasync lines(): Promise<string[]> {\n\t\t\t\tconst records = await runWithContext();\n\t\t\t\treturn records\n\t\t\t\t\t.filter((r) => r.kind === 'line')\n\t\t\t\t\t.map((r) => r.text);\n\t\t\t},\n\n\t\t\tasync raw(): Promise<Record[]> {\n\t\t\t\treturn await runWithContext();\n\t\t\t},\n\n\t\t\tasync stdout(): Promise<void> {\n\t\t\t\tawait runStdoutWithContext();\n\t\t\t},\n\n\t\t\tasync text(): Promise<string> {\n\t\t\t\tconst records = await runWithContext();\n\t\t\t\treturn records\n\t\t\t\t\t.map((r) => {\n\t\t\t\t\t\tif (r.kind === 'line') {\n\t\t\t\t\t\t\treturn r.text;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (r.kind === 'file') {\n\t\t\t\t\t\t\treturn r.path;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (r.kind === 'json') {\n\t\t\t\t\t\t\treturn JSON.stringify(r.value);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn '';\n\t\t\t\t\t})\n\t\t\t\t\t.join('\\n');\n\t\t\t},\n\t\t};\n\n\t\treturn command;\n\t}\n}\n"],"mappings":";;;;AAIA,SAAS,QAAQ,OAAO;AACvB,QAAO;EACN,MAAM;EACN;EACA;;;;;AAgBF,SAAS,KAAK,SAAS,WAAW,EAAE,EAAE;AACrC,QAAO;EACN,MAAM;EACN;EACA;EACA;;;;;AAKF,SAAS,WAAW,SAAS,SAAS,EAAE,EAAE;AACzC,QAAO;EACN,MAAM;EAC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