shell-dsl 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "shell-dsl",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "type": "commonjs"
5
5
  }
@@ -188,7 +188,30 @@ function buildMatcher(options) {
188
188
  if (options.fixedStrings) {
189
189
  patterns = patterns.map(escapeRegex);
190
190
  } else {
191
- patterns = patterns.map((p) => p.replace(/\\\|/g, "|").replace(/\\\(/g, "(").replace(/\\\)/g, ")"));
191
+ patterns = patterns.map((p) => {
192
+ const hasBRE = /\\\||\\\(|\\\)/.test(p);
193
+ if (!hasBRE)
194
+ return p;
195
+ let result = "";
196
+ for (let i = 0;i < p.length; i++) {
197
+ const ch = p[i];
198
+ if (ch === "\\" && i + 1 < p.length) {
199
+ const next = p[i + 1];
200
+ if (next === "|" || next === "(" || next === ")") {
201
+ result += next;
202
+ i++;
203
+ } else {
204
+ result += ch + next;
205
+ i++;
206
+ }
207
+ } else if ("()+?{}".includes(ch)) {
208
+ result += "\\" + ch;
209
+ } else {
210
+ result += ch;
211
+ }
212
+ }
213
+ return result;
214
+ });
192
215
  }
193
216
  let combined = patterns.length > 1 ? patterns.map((p) => `(?:${p})`).join("|") : patterns[0] || "";
194
217
  if (options.wholeWord) {
@@ -536,4 +559,4 @@ var grep = async (ctx) => {
536
559
  return globalFound ? 0 : 1;
537
560
  };
538
561
 
539
- //# debugId=549D8A8ACE2FBD1464756E2164756E21
562
+ //# debugId=0DA7A6C9DEDCF42D64756E2164756E21
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/commands/grep/grep.ts"],
4
4
  "sourcesContent": [
5
- "import type { Command } from \"../../types.cjs\";\nimport { createFlagParser, type FlagDefinition, type FlagError } from \"../../utils/flag-parser.cjs\";\n\ninterface GrepOptions {\n patterns: string[];\n extendedRegex: boolean; // -E (default for JS)\n fixedStrings: boolean; // -F\n ignoreCase: boolean; // -i\n wholeWord: boolean; // -w\n wholeLine: boolean; // -x\n invert: boolean; // -v\n countOnly: boolean; // -c\n filesWithMatches: boolean; // -l\n filesWithoutMatches: boolean; // -L\n showLineNumbers: boolean; // -n\n onlyMatching: boolean; // -o\n quiet: boolean; // -q\n maxMatches: number; // -m (0 = unlimited)\n showFilename: boolean | null; // null=auto, true=-H, false=-h\n beforeContext: number; // -B\n afterContext: number; // -A\n recursive: boolean; // -r/-R\n include: string[]; // --include\n exclude: string[]; // --exclude\n}\n\nconst spec = {\n name: \"grep\",\n flags: [\n { short: \"E\", long: \"extended-regexp\" },\n { short: \"F\", long: \"fixed-strings\" },\n { short: \"i\", long: \"ignore-case\" },\n { short: \"w\", long: \"word-regexp\" },\n { short: \"x\", long: \"line-regexp\" },\n { short: \"v\", long: \"invert-match\" },\n { short: \"c\", long: \"count\" },\n { short: \"l\", long: \"files-with-matches\" },\n { short: \"L\", long: \"files-without-match\" },\n { short: \"n\", long: \"line-number\" },\n { short: \"o\", long: \"only-matching\" },\n { short: \"q\", long: \"quiet\" },\n { short: \"H\", long: \"with-filename\" },\n { short: \"h\", long: \"no-filename\" },\n { short: \"r\", long: \"recursive\" },\n { short: \"R\" },\n { short: \"e\", long: \"regexp\", takesValue: true },\n { short: \"m\", long: \"max-count\", takesValue: true },\n { short: \"A\", long: \"after-context\", takesValue: true },\n { short: \"B\", long: \"before-context\", takesValue: true },\n { short: \"C\", long: \"context\", takesValue: true },\n { long: \"include\", takesValue: true },\n { long: \"exclude\", takesValue: true },\n ] as FlagDefinition[],\n usage: \"grep [-ivnclLqHhEFwxorR] [-e pattern] [-m num] pattern [file ...]\",\n};\n\nfunction createDefaults(): GrepOptions {\n return {\n patterns: [],\n extendedRegex: true, // JS regex is extended by default\n fixedStrings: false,\n ignoreCase: false,\n wholeWord: false,\n wholeLine: false,\n invert: false,\n countOnly: false,\n filesWithMatches: false,\n filesWithoutMatches: false,\n showLineNumbers: false,\n onlyMatching: false,\n quiet: false,\n maxMatches: 0,\n showFilename: null,\n beforeContext: 0,\n afterContext: 0,\n recursive: false,\n include: [],\n exclude: [],\n };\n}\n\nconst handler = (flags: GrepOptions, flag: FlagDefinition, value?: string) => {\n switch (flag.short) {\n case \"E\": flags.extendedRegex = true; break;\n case \"F\": flags.fixedStrings = true; break;\n case \"i\": flags.ignoreCase = true; break;\n case \"w\": flags.wholeWord = true; break;\n case \"x\": flags.wholeLine = true; break;\n case \"v\": flags.invert = true; break;\n case \"c\": flags.countOnly = true; break;\n case \"l\": flags.filesWithMatches = true; break;\n case \"L\": flags.filesWithoutMatches = true; break;\n case \"n\": flags.showLineNumbers = true; break;\n case \"o\": flags.onlyMatching = true; break;\n case \"q\": flags.quiet = true; break;\n case \"H\": flags.showFilename = true; break;\n case \"h\": flags.showFilename = false; break;\n case \"r\":\n case \"R\": flags.recursive = true; break;\n case \"e\": if (value) flags.patterns.push(value); break;\n case \"m\": if (value) flags.maxMatches = parseInt(value, 10); break;\n case \"A\": if (value) flags.afterContext = parseInt(value, 10); break;\n case \"B\": if (value) flags.beforeContext = parseInt(value, 10); break;\n case \"C\":\n if (value) {\n const num = parseInt(value, 10);\n flags.beforeContext = num;\n flags.afterContext = num;\n }\n break;\n default:\n // Handle long-only flags\n if (flag.long === \"include\" && value) flags.include.push(value);\n else if (flag.long === \"exclude\" && value) flags.exclude.push(value);\n break;\n }\n};\n\nfunction matchGlob(str: string, pattern: string): boolean {\n // Convert shell glob to regex: * -> .*, ? -> ., rest escaped\n let re = \"^\";\n for (const ch of pattern) {\n if (ch === \"*\") re += \".*\";\n else if (ch === \"?\") re += \".\";\n else if (/[.+^${}()|[\\]\\\\]/.test(ch)) re += \"\\\\\" + ch;\n else re += ch;\n }\n re += \"$\";\n return new RegExp(re).test(str);\n}\n\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction buildMatcher(options: GrepOptions): RegExp {\n let patterns = options.patterns;\n\n // If fixed strings mode, escape regex metacharacters\n if (options.fixedStrings) {\n patterns = patterns.map(escapeRegex);\n } else {\n // Support BRE-style \\| \\( \\) even in ERE mode for compatibility\n patterns = patterns.map(p => p.replace(/\\\\\\|/g, \"|\").replace(/\\\\\\(/g, \"(\").replace(/\\\\\\)/g, \")\"));\n }\n\n // Combine multiple patterns with OR\n let combined = patterns.length > 1 ? patterns.map(p => `(?:${p})`).join(\"|\") : patterns[0] || \"\";\n\n // Whole word match\n if (options.wholeWord) {\n combined = `\\\\b(?:${combined})\\\\b`;\n }\n\n // Whole line match\n if (options.wholeLine) {\n combined = `^(?:${combined})$`;\n }\n\n const flags = options.ignoreCase ? \"gi\" : \"g\";\n return new RegExp(combined, flags);\n}\n\nexport const grep: Command = async (ctx) => {\n // Create fresh parser with fresh defaults for each invocation\n const parser = createFlagParser(spec, createDefaults(), handler);\n const result = parser.parse(ctx.args);\n\n if (result.error) {\n await parser.writeError(result.error, ctx.stderr);\n return 1;\n }\n\n const options = result.flags;\n const args = result.args;\n\n // First positional arg is pattern if no -e patterns\n let files: string[];\n if (options.patterns.length === 0) {\n if (args.length === 0) {\n await ctx.stderr.writeText(\"grep: missing pattern\\n\");\n return 1;\n }\n options.patterns.push(args[0]!);\n files = args.slice(1);\n } else {\n files = args;\n }\n\n let regex: RegExp;\n try {\n regex = buildMatcher(options);\n } catch (err) {\n await ctx.stderr.writeText(`grep: invalid pattern: ${options.patterns.join(\", \")}\\n`);\n return 1;\n }\n\n let globalFound = false;\n let globalMatchCount = 0;\n let earlyExit = false;\n\n // Determine filename display mode\n let showFilenames = options.showFilename;\n\n // Expand files if recursive\n let expandedFiles = files;\n if (options.recursive && files.length > 0) {\n expandedFiles = [];\n for (const file of files) {\n const path = ctx.fs.resolve(ctx.cwd, file);\n try {\n const stat = await ctx.fs.stat(path);\n if (stat.isDirectory()) {\n // Glob all files in directory\n const globbed = await ctx.fs.glob(\"**/*\", { cwd: path });\n for (const f of globbed) {\n const fullPath = ctx.fs.resolve(path, f);\n try {\n const s = await ctx.fs.stat(fullPath);\n if (s.isFile()) {\n expandedFiles.push(fullPath);\n }\n } catch {\n // Skip if can't stat\n }\n }\n } else {\n expandedFiles.push(path);\n }\n } catch {\n expandedFiles.push(path); // Will error later\n }\n }\n // Filter by include/exclude patterns\n if (options.include.length > 0 || options.exclude.length > 0) {\n expandedFiles = expandedFiles.filter((f) => {\n const basename = ctx.fs.basename(f);\n if (options.include.length > 0) {\n const included = options.include.some((pat) => matchGlob(basename, pat));\n if (!included) return false;\n }\n if (options.exclude.length > 0) {\n const excluded = options.exclude.some((pat) => matchGlob(basename, pat));\n if (excluded) return false;\n }\n return true;\n });\n }\n\n // Default to showing filenames for recursive\n if (showFilenames === null) {\n showFilenames = true;\n }\n }\n\n // Default: show filenames if multiple files\n if (showFilenames === null) {\n showFilenames = expandedFiles.length > 1;\n }\n\n const processContent = async (\n lines: string[],\n filename?: string\n ): Promise<{ found: boolean; count: number }> => {\n let fileFound = false;\n let fileMatchCount = 0;\n\n // For context lines, we need a buffer approach\n const hasContext = options.beforeContext > 0 || options.afterContext > 0;\n\n if (hasContext) {\n return await processWithContext(lines, filename);\n }\n\n for (let lineIdx = 0; lineIdx < lines.length && !earlyExit; lineIdx++) {\n const line = lines[lineIdx]!;\n const lineNum = lineIdx + 1;\n\n // Reset regex lastIndex for each line\n regex.lastIndex = 0;\n const matches = regex.test(line);\n const shouldOutput = options.invert ? !matches : matches;\n\n if (shouldOutput) {\n fileFound = true;\n fileMatchCount++;\n\n // Quiet mode: exit immediately on first match\n if (options.quiet) {\n earlyExit = true;\n return { found: true, count: 1 };\n }\n\n // -l mode: we found a match in this file, stop processing this file\n if (options.filesWithMatches) {\n return { found: true, count: 1 };\n }\n\n // Output the match (unless countOnly or filesWithoutMatches)\n if (!options.countOnly && !options.filesWithoutMatches) {\n if (options.onlyMatching && !options.invert) {\n // Output only the matched parts\n regex.lastIndex = 0;\n let match;\n while ((match = regex.exec(line)) !== null) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += match[0] + \"\\n\";\n await ctx.stdout.writeText(output);\n // Prevent infinite loop for zero-width matches\n if (match[0].length === 0) regex.lastIndex++;\n }\n } else {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += line + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n }\n\n // Check max matches\n if (options.maxMatches > 0 && fileMatchCount >= options.maxMatches) {\n earlyExit = true;\n return { found: true, count: fileMatchCount };\n }\n }\n }\n\n return { found: fileFound, count: fileMatchCount };\n };\n\n const processWithContext = async (\n lines: string[],\n filename?: string\n ): Promise<{ found: boolean; count: number }> => {\n let fileFound = false;\n let fileMatchCount = 0;\n let lastPrintedLine = -1;\n\n // First pass: find all matching lines\n const matchingLines = new Set<number>();\n for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {\n const line = lines[lineIdx]!;\n regex.lastIndex = 0;\n const matches = regex.test(line);\n const shouldOutput = options.invert ? !matches : matches;\n if (shouldOutput) {\n matchingLines.add(lineIdx);\n }\n }\n\n // Determine which lines to print (matches + context)\n const linesToPrint = new Set<number>();\n for (const matchIdx of matchingLines) {\n // Add before context\n for (let i = Math.max(0, matchIdx - options.beforeContext); i < matchIdx; i++) {\n linesToPrint.add(i);\n }\n // Add the match itself\n linesToPrint.add(matchIdx);\n // Add after context\n for (let i = matchIdx + 1; i <= Math.min(lines.length - 1, matchIdx + options.afterContext); i++) {\n linesToPrint.add(i);\n }\n }\n\n // Sort and print\n const sortedLines = Array.from(linesToPrint).sort((a, b) => a - b);\n\n for (let i = 0; i < sortedLines.length && !earlyExit; i++) {\n const lineIdx = sortedLines[i]!;\n const line = lines[lineIdx]!;\n const lineNum = lineIdx + 1;\n const isMatch = matchingLines.has(lineIdx);\n\n // Print separator if there's a gap\n if (lastPrintedLine >= 0 && lineIdx > lastPrintedLine + 1) {\n await ctx.stdout.writeText(\"--\\n\");\n }\n\n if (isMatch) {\n fileFound = true;\n fileMatchCount++;\n\n if (options.quiet) {\n earlyExit = true;\n return { found: true, count: 1 };\n }\n\n if (options.filesWithMatches) {\n return { found: true, count: 1 };\n }\n\n if (!options.countOnly && !options.filesWithoutMatches) {\n if (options.onlyMatching && !options.invert) {\n regex.lastIndex = 0;\n let match;\n while ((match = regex.exec(line)) !== null) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += match[0] + \"\\n\";\n await ctx.stdout.writeText(output);\n if (match[0].length === 0) regex.lastIndex++;\n }\n } else {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += line + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n }\n\n if (options.maxMatches > 0 && fileMatchCount >= options.maxMatches) {\n // Still need to output remaining context lines after this match\n // Continue to output context but mark we should stop looking for more matches\n const remainingContextLines = sortedLines.slice(i + 1).filter(idx => !matchingLines.has(idx));\n for (const contextIdx of remainingContextLines) {\n const contextLine = lines[contextIdx]!;\n const contextLineNum = contextIdx + 1;\n // Check if it's within after-context of current match\n if (contextIdx <= lineIdx + options.afterContext) {\n if (lastPrintedLine >= 0 && contextIdx > lastPrintedLine + 1) {\n await ctx.stdout.writeText(\"--\\n\");\n }\n if (!options.countOnly && !options.filesWithoutMatches) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \"-\";\n if (options.showLineNumbers) output += contextLineNum + \"-\";\n output += contextLine + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n lastPrintedLine = contextIdx;\n }\n }\n earlyExit = true;\n return { found: true, count: fileMatchCount };\n }\n } else {\n // Context line\n if (!options.countOnly && !options.filesWithoutMatches) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \"-\";\n if (options.showLineNumbers) output += lineNum + \"-\";\n output += line + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n }\n\n lastPrintedLine = lineIdx;\n }\n\n return { found: fileFound, count: fileMatchCount };\n };\n\n if (expandedFiles.length === 0) {\n // Read from stdin\n const content = await ctx.stdin.text();\n const lines = content.split(\"\\n\");\n // Remove trailing empty line if content ends with newline\n if (lines.length > 0 && lines[lines.length - 1] === \"\") {\n lines.pop();\n }\n\n const { found, count } = await processContent(lines);\n globalFound = found;\n globalMatchCount = count;\n\n if (options.countOnly && !options.quiet && !options.filesWithMatches && !options.filesWithoutMatches) {\n await ctx.stdout.writeText(globalMatchCount + \"\\n\");\n }\n } else {\n // Read from files\n const perFileResults: Map<string, { found: boolean; count: number }> = new Map();\n\n for (const file of expandedFiles) {\n if (earlyExit && options.quiet) break;\n\n try {\n const path = file.startsWith(\"/\") ? file : ctx.fs.resolve(ctx.cwd, file);\n const stat = await ctx.fs.stat(path);\n\n if (stat.isDirectory()) {\n if (!options.recursive) {\n await ctx.stderr.writeText(`grep: ${file}: Is a directory\\n`);\n }\n continue;\n }\n\n const content = await ctx.fs.readFile(path);\n const lines = content.toString().split(\"\\n\");\n\n // Remove trailing empty line if file ends with newline\n if (lines.length > 0 && lines[lines.length - 1] === \"\") {\n lines.pop();\n }\n\n // Use original filename for display, not resolved path\n const displayName = files.includes(file) ? file :\n (options.recursive ? path : file);\n\n const { found, count } = await processContent(lines, displayName);\n perFileResults.set(displayName, { found, count });\n\n if (found) {\n globalFound = true;\n globalMatchCount += count;\n }\n } catch (err) {\n await ctx.stderr.writeText(`grep: ${file}: No such file or directory\\n`);\n // Continue to other files instead of immediately returning\n if (expandedFiles.length === 1) {\n return 1;\n }\n }\n }\n\n // Handle -l, -L, -c output modes\n let hasFilesWithoutMatches = false;\n if (options.filesWithMatches) {\n for (const [filename, result] of perFileResults) {\n if (result.found && !options.quiet) {\n await ctx.stdout.writeText(filename + \"\\n\");\n }\n }\n } else if (options.filesWithoutMatches) {\n for (const [filename, result] of perFileResults) {\n if (!result.found) {\n hasFilesWithoutMatches = true;\n await ctx.stdout.writeText(filename + \"\\n\");\n }\n }\n } else if (options.countOnly && !options.quiet) {\n for (const [filename, result] of perFileResults) {\n if (showFilenames) {\n await ctx.stdout.writeText(`${filename}:${result.count}\\n`);\n } else {\n await ctx.stdout.writeText(result.count + \"\\n\");\n }\n }\n }\n\n // Determine exit code for file processing\n if (options.filesWithoutMatches) {\n // -L: success if any file had NO matches\n return hasFilesWithoutMatches ? 0 : 1;\n }\n }\n\n // Determine exit code\n return globalFound ? 0 : 1;\n};\n"
5
+ "import type { Command } from \"../../types.cjs\";\nimport { createFlagParser, type FlagDefinition, type FlagError } from \"../../utils/flag-parser.cjs\";\n\ninterface GrepOptions {\n patterns: string[];\n extendedRegex: boolean; // -E (default for JS)\n fixedStrings: boolean; // -F\n ignoreCase: boolean; // -i\n wholeWord: boolean; // -w\n wholeLine: boolean; // -x\n invert: boolean; // -v\n countOnly: boolean; // -c\n filesWithMatches: boolean; // -l\n filesWithoutMatches: boolean; // -L\n showLineNumbers: boolean; // -n\n onlyMatching: boolean; // -o\n quiet: boolean; // -q\n maxMatches: number; // -m (0 = unlimited)\n showFilename: boolean | null; // null=auto, true=-H, false=-h\n beforeContext: number; // -B\n afterContext: number; // -A\n recursive: boolean; // -r/-R\n include: string[]; // --include\n exclude: string[]; // --exclude\n}\n\nconst spec = {\n name: \"grep\",\n flags: [\n { short: \"E\", long: \"extended-regexp\" },\n { short: \"F\", long: \"fixed-strings\" },\n { short: \"i\", long: \"ignore-case\" },\n { short: \"w\", long: \"word-regexp\" },\n { short: \"x\", long: \"line-regexp\" },\n { short: \"v\", long: \"invert-match\" },\n { short: \"c\", long: \"count\" },\n { short: \"l\", long: \"files-with-matches\" },\n { short: \"L\", long: \"files-without-match\" },\n { short: \"n\", long: \"line-number\" },\n { short: \"o\", long: \"only-matching\" },\n { short: \"q\", long: \"quiet\" },\n { short: \"H\", long: \"with-filename\" },\n { short: \"h\", long: \"no-filename\" },\n { short: \"r\", long: \"recursive\" },\n { short: \"R\" },\n { short: \"e\", long: \"regexp\", takesValue: true },\n { short: \"m\", long: \"max-count\", takesValue: true },\n { short: \"A\", long: \"after-context\", takesValue: true },\n { short: \"B\", long: \"before-context\", takesValue: true },\n { short: \"C\", long: \"context\", takesValue: true },\n { long: \"include\", takesValue: true },\n { long: \"exclude\", takesValue: true },\n ] as FlagDefinition[],\n usage: \"grep [-ivnclLqHhEFwxorR] [-e pattern] [-m num] pattern [file ...]\",\n};\n\nfunction createDefaults(): GrepOptions {\n return {\n patterns: [],\n extendedRegex: true, // JS regex is extended by default\n fixedStrings: false,\n ignoreCase: false,\n wholeWord: false,\n wholeLine: false,\n invert: false,\n countOnly: false,\n filesWithMatches: false,\n filesWithoutMatches: false,\n showLineNumbers: false,\n onlyMatching: false,\n quiet: false,\n maxMatches: 0,\n showFilename: null,\n beforeContext: 0,\n afterContext: 0,\n recursive: false,\n include: [],\n exclude: [],\n };\n}\n\nconst handler = (flags: GrepOptions, flag: FlagDefinition, value?: string) => {\n switch (flag.short) {\n case \"E\": flags.extendedRegex = true; break;\n case \"F\": flags.fixedStrings = true; break;\n case \"i\": flags.ignoreCase = true; break;\n case \"w\": flags.wholeWord = true; break;\n case \"x\": flags.wholeLine = true; break;\n case \"v\": flags.invert = true; break;\n case \"c\": flags.countOnly = true; break;\n case \"l\": flags.filesWithMatches = true; break;\n case \"L\": flags.filesWithoutMatches = true; break;\n case \"n\": flags.showLineNumbers = true; break;\n case \"o\": flags.onlyMatching = true; break;\n case \"q\": flags.quiet = true; break;\n case \"H\": flags.showFilename = true; break;\n case \"h\": flags.showFilename = false; break;\n case \"r\":\n case \"R\": flags.recursive = true; break;\n case \"e\": if (value) flags.patterns.push(value); break;\n case \"m\": if (value) flags.maxMatches = parseInt(value, 10); break;\n case \"A\": if (value) flags.afterContext = parseInt(value, 10); break;\n case \"B\": if (value) flags.beforeContext = parseInt(value, 10); break;\n case \"C\":\n if (value) {\n const num = parseInt(value, 10);\n flags.beforeContext = num;\n flags.afterContext = num;\n }\n break;\n default:\n // Handle long-only flags\n if (flag.long === \"include\" && value) flags.include.push(value);\n else if (flag.long === \"exclude\" && value) flags.exclude.push(value);\n break;\n }\n};\n\nfunction matchGlob(str: string, pattern: string): boolean {\n // Convert shell glob to regex: * -> .*, ? -> ., rest escaped\n let re = \"^\";\n for (const ch of pattern) {\n if (ch === \"*\") re += \".*\";\n else if (ch === \"?\") re += \".\";\n else if (/[.+^${}()|[\\]\\\\]/.test(ch)) re += \"\\\\\" + ch;\n else re += ch;\n }\n re += \"$\";\n return new RegExp(re).test(str);\n}\n\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction buildMatcher(options: GrepOptions): RegExp {\n let patterns = options.patterns;\n\n // If fixed strings mode, escape regex metacharacters\n if (options.fixedStrings) {\n patterns = patterns.map(escapeRegex);\n } else {\n // Convert BRE patterns to ERE/JavaScript RegExp\n // In BRE: \\| \\( \\) are special; bare ( ) + ? { } are literal\n // In ERE/JS: | ( ) + ? { } are special; \\| \\( \\) are literal\n patterns = patterns.map(p => {\n const hasBRE = /\\\\\\||\\\\\\(|\\\\\\)/.test(p);\n if (!hasBRE) return p;\n let result = \"\";\n for (let i = 0; i < p.length; i++) {\n const ch = p[i]!;\n if (ch === \"\\\\\" && i + 1 < p.length) {\n const next = p[i + 1]!;\n if (next === \"|\" || next === \"(\" || next === \")\") {\n // BRE special → ERE special (emit unescaped)\n result += next;\n i++;\n } else {\n result += ch + next;\n i++;\n }\n } else if (\"()+?{}\".includes(ch)) {\n // Bare metachar is literal in BRE → escape for ERE\n result += \"\\\\\" + ch;\n } else {\n result += ch;\n }\n }\n return result;\n });\n }\n\n // Combine multiple patterns with OR\n let combined = patterns.length > 1 ? patterns.map(p => `(?:${p})`).join(\"|\") : patterns[0] || \"\";\n\n // Whole word match\n if (options.wholeWord) {\n combined = `\\\\b(?:${combined})\\\\b`;\n }\n\n // Whole line match\n if (options.wholeLine) {\n combined = `^(?:${combined})$`;\n }\n\n const flags = options.ignoreCase ? \"gi\" : \"g\";\n return new RegExp(combined, flags);\n}\n\nexport const grep: Command = async (ctx) => {\n // Create fresh parser with fresh defaults for each invocation\n const parser = createFlagParser(spec, createDefaults(), handler);\n const result = parser.parse(ctx.args);\n\n if (result.error) {\n await parser.writeError(result.error, ctx.stderr);\n return 1;\n }\n\n const options = result.flags;\n const args = result.args;\n\n // First positional arg is pattern if no -e patterns\n let files: string[];\n if (options.patterns.length === 0) {\n if (args.length === 0) {\n await ctx.stderr.writeText(\"grep: missing pattern\\n\");\n return 1;\n }\n options.patterns.push(args[0]!);\n files = args.slice(1);\n } else {\n files = args;\n }\n\n let regex: RegExp;\n try {\n regex = buildMatcher(options);\n } catch (err) {\n await ctx.stderr.writeText(`grep: invalid pattern: ${options.patterns.join(\", \")}\\n`);\n return 1;\n }\n\n let globalFound = false;\n let globalMatchCount = 0;\n let earlyExit = false;\n\n // Determine filename display mode\n let showFilenames = options.showFilename;\n\n // Expand files if recursive\n let expandedFiles = files;\n if (options.recursive && files.length > 0) {\n expandedFiles = [];\n for (const file of files) {\n const path = ctx.fs.resolve(ctx.cwd, file);\n try {\n const stat = await ctx.fs.stat(path);\n if (stat.isDirectory()) {\n // Glob all files in directory\n const globbed = await ctx.fs.glob(\"**/*\", { cwd: path });\n for (const f of globbed) {\n const fullPath = ctx.fs.resolve(path, f);\n try {\n const s = await ctx.fs.stat(fullPath);\n if (s.isFile()) {\n expandedFiles.push(fullPath);\n }\n } catch {\n // Skip if can't stat\n }\n }\n } else {\n expandedFiles.push(path);\n }\n } catch {\n expandedFiles.push(path); // Will error later\n }\n }\n // Filter by include/exclude patterns\n if (options.include.length > 0 || options.exclude.length > 0) {\n expandedFiles = expandedFiles.filter((f) => {\n const basename = ctx.fs.basename(f);\n if (options.include.length > 0) {\n const included = options.include.some((pat) => matchGlob(basename, pat));\n if (!included) return false;\n }\n if (options.exclude.length > 0) {\n const excluded = options.exclude.some((pat) => matchGlob(basename, pat));\n if (excluded) return false;\n }\n return true;\n });\n }\n\n // Default to showing filenames for recursive\n if (showFilenames === null) {\n showFilenames = true;\n }\n }\n\n // Default: show filenames if multiple files\n if (showFilenames === null) {\n showFilenames = expandedFiles.length > 1;\n }\n\n const processContent = async (\n lines: string[],\n filename?: string\n ): Promise<{ found: boolean; count: number }> => {\n let fileFound = false;\n let fileMatchCount = 0;\n\n // For context lines, we need a buffer approach\n const hasContext = options.beforeContext > 0 || options.afterContext > 0;\n\n if (hasContext) {\n return await processWithContext(lines, filename);\n }\n\n for (let lineIdx = 0; lineIdx < lines.length && !earlyExit; lineIdx++) {\n const line = lines[lineIdx]!;\n const lineNum = lineIdx + 1;\n\n // Reset regex lastIndex for each line\n regex.lastIndex = 0;\n const matches = regex.test(line);\n const shouldOutput = options.invert ? !matches : matches;\n\n if (shouldOutput) {\n fileFound = true;\n fileMatchCount++;\n\n // Quiet mode: exit immediately on first match\n if (options.quiet) {\n earlyExit = true;\n return { found: true, count: 1 };\n }\n\n // -l mode: we found a match in this file, stop processing this file\n if (options.filesWithMatches) {\n return { found: true, count: 1 };\n }\n\n // Output the match (unless countOnly or filesWithoutMatches)\n if (!options.countOnly && !options.filesWithoutMatches) {\n if (options.onlyMatching && !options.invert) {\n // Output only the matched parts\n regex.lastIndex = 0;\n let match;\n while ((match = regex.exec(line)) !== null) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += match[0] + \"\\n\";\n await ctx.stdout.writeText(output);\n // Prevent infinite loop for zero-width matches\n if (match[0].length === 0) regex.lastIndex++;\n }\n } else {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += line + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n }\n\n // Check max matches\n if (options.maxMatches > 0 && fileMatchCount >= options.maxMatches) {\n earlyExit = true;\n return { found: true, count: fileMatchCount };\n }\n }\n }\n\n return { found: fileFound, count: fileMatchCount };\n };\n\n const processWithContext = async (\n lines: string[],\n filename?: string\n ): Promise<{ found: boolean; count: number }> => {\n let fileFound = false;\n let fileMatchCount = 0;\n let lastPrintedLine = -1;\n\n // First pass: find all matching lines\n const matchingLines = new Set<number>();\n for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {\n const line = lines[lineIdx]!;\n regex.lastIndex = 0;\n const matches = regex.test(line);\n const shouldOutput = options.invert ? !matches : matches;\n if (shouldOutput) {\n matchingLines.add(lineIdx);\n }\n }\n\n // Determine which lines to print (matches + context)\n const linesToPrint = new Set<number>();\n for (const matchIdx of matchingLines) {\n // Add before context\n for (let i = Math.max(0, matchIdx - options.beforeContext); i < matchIdx; i++) {\n linesToPrint.add(i);\n }\n // Add the match itself\n linesToPrint.add(matchIdx);\n // Add after context\n for (let i = matchIdx + 1; i <= Math.min(lines.length - 1, matchIdx + options.afterContext); i++) {\n linesToPrint.add(i);\n }\n }\n\n // Sort and print\n const sortedLines = Array.from(linesToPrint).sort((a, b) => a - b);\n\n for (let i = 0; i < sortedLines.length && !earlyExit; i++) {\n const lineIdx = sortedLines[i]!;\n const line = lines[lineIdx]!;\n const lineNum = lineIdx + 1;\n const isMatch = matchingLines.has(lineIdx);\n\n // Print separator if there's a gap\n if (lastPrintedLine >= 0 && lineIdx > lastPrintedLine + 1) {\n await ctx.stdout.writeText(\"--\\n\");\n }\n\n if (isMatch) {\n fileFound = true;\n fileMatchCount++;\n\n if (options.quiet) {\n earlyExit = true;\n return { found: true, count: 1 };\n }\n\n if (options.filesWithMatches) {\n return { found: true, count: 1 };\n }\n\n if (!options.countOnly && !options.filesWithoutMatches) {\n if (options.onlyMatching && !options.invert) {\n regex.lastIndex = 0;\n let match;\n while ((match = regex.exec(line)) !== null) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += match[0] + \"\\n\";\n await ctx.stdout.writeText(output);\n if (match[0].length === 0) regex.lastIndex++;\n }\n } else {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += line + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n }\n\n if (options.maxMatches > 0 && fileMatchCount >= options.maxMatches) {\n // Still need to output remaining context lines after this match\n // Continue to output context but mark we should stop looking for more matches\n const remainingContextLines = sortedLines.slice(i + 1).filter(idx => !matchingLines.has(idx));\n for (const contextIdx of remainingContextLines) {\n const contextLine = lines[contextIdx]!;\n const contextLineNum = contextIdx + 1;\n // Check if it's within after-context of current match\n if (contextIdx <= lineIdx + options.afterContext) {\n if (lastPrintedLine >= 0 && contextIdx > lastPrintedLine + 1) {\n await ctx.stdout.writeText(\"--\\n\");\n }\n if (!options.countOnly && !options.filesWithoutMatches) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \"-\";\n if (options.showLineNumbers) output += contextLineNum + \"-\";\n output += contextLine + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n lastPrintedLine = contextIdx;\n }\n }\n earlyExit = true;\n return { found: true, count: fileMatchCount };\n }\n } else {\n // Context line\n if (!options.countOnly && !options.filesWithoutMatches) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \"-\";\n if (options.showLineNumbers) output += lineNum + \"-\";\n output += line + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n }\n\n lastPrintedLine = lineIdx;\n }\n\n return { found: fileFound, count: fileMatchCount };\n };\n\n if (expandedFiles.length === 0) {\n // Read from stdin\n const content = await ctx.stdin.text();\n const lines = content.split(\"\\n\");\n // Remove trailing empty line if content ends with newline\n if (lines.length > 0 && lines[lines.length - 1] === \"\") {\n lines.pop();\n }\n\n const { found, count } = await processContent(lines);\n globalFound = found;\n globalMatchCount = count;\n\n if (options.countOnly && !options.quiet && !options.filesWithMatches && !options.filesWithoutMatches) {\n await ctx.stdout.writeText(globalMatchCount + \"\\n\");\n }\n } else {\n // Read from files\n const perFileResults: Map<string, { found: boolean; count: number }> = new Map();\n\n for (const file of expandedFiles) {\n if (earlyExit && options.quiet) break;\n\n try {\n const path = file.startsWith(\"/\") ? file : ctx.fs.resolve(ctx.cwd, file);\n const stat = await ctx.fs.stat(path);\n\n if (stat.isDirectory()) {\n if (!options.recursive) {\n await ctx.stderr.writeText(`grep: ${file}: Is a directory\\n`);\n }\n continue;\n }\n\n const content = await ctx.fs.readFile(path);\n const lines = content.toString().split(\"\\n\");\n\n // Remove trailing empty line if file ends with newline\n if (lines.length > 0 && lines[lines.length - 1] === \"\") {\n lines.pop();\n }\n\n // Use original filename for display, not resolved path\n const displayName = files.includes(file) ? file :\n (options.recursive ? path : file);\n\n const { found, count } = await processContent(lines, displayName);\n perFileResults.set(displayName, { found, count });\n\n if (found) {\n globalFound = true;\n globalMatchCount += count;\n }\n } catch (err) {\n await ctx.stderr.writeText(`grep: ${file}: No such file or directory\\n`);\n // Continue to other files instead of immediately returning\n if (expandedFiles.length === 1) {\n return 1;\n }\n }\n }\n\n // Handle -l, -L, -c output modes\n let hasFilesWithoutMatches = false;\n if (options.filesWithMatches) {\n for (const [filename, result] of perFileResults) {\n if (result.found && !options.quiet) {\n await ctx.stdout.writeText(filename + \"\\n\");\n }\n }\n } else if (options.filesWithoutMatches) {\n for (const [filename, result] of perFileResults) {\n if (!result.found) {\n hasFilesWithoutMatches = true;\n await ctx.stdout.writeText(filename + \"\\n\");\n }\n }\n } else if (options.countOnly && !options.quiet) {\n for (const [filename, result] of perFileResults) {\n if (showFilenames) {\n await ctx.stdout.writeText(`${filename}:${result.count}\\n`);\n } else {\n await ctx.stdout.writeText(result.count + \"\\n\");\n }\n }\n }\n\n // Determine exit code for file processing\n if (options.filesWithoutMatches) {\n // -L: success if any file had NO matches\n return hasFilesWithoutMatches ? 0 : 1;\n }\n }\n\n // Determine exit code\n return globalFound ? 0 : 1;\n};\n"
6
6
  ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACsE,IAAtE;AAyBA,IAAM,OAAO;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,IACL,EAAE,OAAO,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O,QAAQ;AAAA,CAAI;AAAA;AAAA,MAElD;AAAA,IACF;AAAA,IAGA,IAAI,QAAQ,qBAAqB;AAAA,MAE/B,OAAO,yBAAyB,IAAI;AAAA,IACtC;AAAA;AAAA,EAIF,OAAO,cAAc,IAAI;AAAA;",
8
+ "debugId": "0DA7A6C9DEDCF42D64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "shell-dsl",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "type": "module"
5
5
  }
@@ -155,7 +155,30 @@ function buildMatcher(options) {
155
155
  if (options.fixedStrings) {
156
156
  patterns = patterns.map(escapeRegex);
157
157
  } else {
158
- patterns = patterns.map((p) => p.replace(/\\\|/g, "|").replace(/\\\(/g, "(").replace(/\\\)/g, ")"));
158
+ patterns = patterns.map((p) => {
159
+ const hasBRE = /\\\||\\\(|\\\)/.test(p);
160
+ if (!hasBRE)
161
+ return p;
162
+ let result = "";
163
+ for (let i = 0;i < p.length; i++) {
164
+ const ch = p[i];
165
+ if (ch === "\\" && i + 1 < p.length) {
166
+ const next = p[i + 1];
167
+ if (next === "|" || next === "(" || next === ")") {
168
+ result += next;
169
+ i++;
170
+ } else {
171
+ result += ch + next;
172
+ i++;
173
+ }
174
+ } else if ("()+?{}".includes(ch)) {
175
+ result += "\\" + ch;
176
+ } else {
177
+ result += ch;
178
+ }
179
+ }
180
+ return result;
181
+ });
159
182
  }
160
183
  let combined = patterns.length > 1 ? patterns.map((p) => `(?:${p})`).join("|") : patterns[0] || "";
161
184
  if (options.wholeWord) {
@@ -506,4 +529,4 @@ export {
506
529
  grep
507
530
  };
508
531
 
509
- //# debugId=0E1412C2E9C31AE364756E2164756E21
532
+ //# debugId=AB66DEE3D4E2ECCE64756E2164756E21
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/commands/grep/grep.ts"],
4
4
  "sourcesContent": [
5
- "import type { Command } from \"../../types.mjs\";\nimport { createFlagParser, type FlagDefinition, type FlagError } from \"../../utils/flag-parser.mjs\";\n\ninterface GrepOptions {\n patterns: string[];\n extendedRegex: boolean; // -E (default for JS)\n fixedStrings: boolean; // -F\n ignoreCase: boolean; // -i\n wholeWord: boolean; // -w\n wholeLine: boolean; // -x\n invert: boolean; // -v\n countOnly: boolean; // -c\n filesWithMatches: boolean; // -l\n filesWithoutMatches: boolean; // -L\n showLineNumbers: boolean; // -n\n onlyMatching: boolean; // -o\n quiet: boolean; // -q\n maxMatches: number; // -m (0 = unlimited)\n showFilename: boolean | null; // null=auto, true=-H, false=-h\n beforeContext: number; // -B\n afterContext: number; // -A\n recursive: boolean; // -r/-R\n include: string[]; // --include\n exclude: string[]; // --exclude\n}\n\nconst spec = {\n name: \"grep\",\n flags: [\n { short: \"E\", long: \"extended-regexp\" },\n { short: \"F\", long: \"fixed-strings\" },\n { short: \"i\", long: \"ignore-case\" },\n { short: \"w\", long: \"word-regexp\" },\n { short: \"x\", long: \"line-regexp\" },\n { short: \"v\", long: \"invert-match\" },\n { short: \"c\", long: \"count\" },\n { short: \"l\", long: \"files-with-matches\" },\n { short: \"L\", long: \"files-without-match\" },\n { short: \"n\", long: \"line-number\" },\n { short: \"o\", long: \"only-matching\" },\n { short: \"q\", long: \"quiet\" },\n { short: \"H\", long: \"with-filename\" },\n { short: \"h\", long: \"no-filename\" },\n { short: \"r\", long: \"recursive\" },\n { short: \"R\" },\n { short: \"e\", long: \"regexp\", takesValue: true },\n { short: \"m\", long: \"max-count\", takesValue: true },\n { short: \"A\", long: \"after-context\", takesValue: true },\n { short: \"B\", long: \"before-context\", takesValue: true },\n { short: \"C\", long: \"context\", takesValue: true },\n { long: \"include\", takesValue: true },\n { long: \"exclude\", takesValue: true },\n ] as FlagDefinition[],\n usage: \"grep [-ivnclLqHhEFwxorR] [-e pattern] [-m num] pattern [file ...]\",\n};\n\nfunction createDefaults(): GrepOptions {\n return {\n patterns: [],\n extendedRegex: true, // JS regex is extended by default\n fixedStrings: false,\n ignoreCase: false,\n wholeWord: false,\n wholeLine: false,\n invert: false,\n countOnly: false,\n filesWithMatches: false,\n filesWithoutMatches: false,\n showLineNumbers: false,\n onlyMatching: false,\n quiet: false,\n maxMatches: 0,\n showFilename: null,\n beforeContext: 0,\n afterContext: 0,\n recursive: false,\n include: [],\n exclude: [],\n };\n}\n\nconst handler = (flags: GrepOptions, flag: FlagDefinition, value?: string) => {\n switch (flag.short) {\n case \"E\": flags.extendedRegex = true; break;\n case \"F\": flags.fixedStrings = true; break;\n case \"i\": flags.ignoreCase = true; break;\n case \"w\": flags.wholeWord = true; break;\n case \"x\": flags.wholeLine = true; break;\n case \"v\": flags.invert = true; break;\n case \"c\": flags.countOnly = true; break;\n case \"l\": flags.filesWithMatches = true; break;\n case \"L\": flags.filesWithoutMatches = true; break;\n case \"n\": flags.showLineNumbers = true; break;\n case \"o\": flags.onlyMatching = true; break;\n case \"q\": flags.quiet = true; break;\n case \"H\": flags.showFilename = true; break;\n case \"h\": flags.showFilename = false; break;\n case \"r\":\n case \"R\": flags.recursive = true; break;\n case \"e\": if (value) flags.patterns.push(value); break;\n case \"m\": if (value) flags.maxMatches = parseInt(value, 10); break;\n case \"A\": if (value) flags.afterContext = parseInt(value, 10); break;\n case \"B\": if (value) flags.beforeContext = parseInt(value, 10); break;\n case \"C\":\n if (value) {\n const num = parseInt(value, 10);\n flags.beforeContext = num;\n flags.afterContext = num;\n }\n break;\n default:\n // Handle long-only flags\n if (flag.long === \"include\" && value) flags.include.push(value);\n else if (flag.long === \"exclude\" && value) flags.exclude.push(value);\n break;\n }\n};\n\nfunction matchGlob(str: string, pattern: string): boolean {\n // Convert shell glob to regex: * -> .*, ? -> ., rest escaped\n let re = \"^\";\n for (const ch of pattern) {\n if (ch === \"*\") re += \".*\";\n else if (ch === \"?\") re += \".\";\n else if (/[.+^${}()|[\\]\\\\]/.test(ch)) re += \"\\\\\" + ch;\n else re += ch;\n }\n re += \"$\";\n return new RegExp(re).test(str);\n}\n\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction buildMatcher(options: GrepOptions): RegExp {\n let patterns = options.patterns;\n\n // If fixed strings mode, escape regex metacharacters\n if (options.fixedStrings) {\n patterns = patterns.map(escapeRegex);\n } else {\n // Support BRE-style \\| \\( \\) even in ERE mode for compatibility\n patterns = patterns.map(p => p.replace(/\\\\\\|/g, \"|\").replace(/\\\\\\(/g, \"(\").replace(/\\\\\\)/g, \")\"));\n }\n\n // Combine multiple patterns with OR\n let combined = patterns.length > 1 ? patterns.map(p => `(?:${p})`).join(\"|\") : patterns[0] || \"\";\n\n // Whole word match\n if (options.wholeWord) {\n combined = `\\\\b(?:${combined})\\\\b`;\n }\n\n // Whole line match\n if (options.wholeLine) {\n combined = `^(?:${combined})$`;\n }\n\n const flags = options.ignoreCase ? \"gi\" : \"g\";\n return new RegExp(combined, flags);\n}\n\nexport const grep: Command = async (ctx) => {\n // Create fresh parser with fresh defaults for each invocation\n const parser = createFlagParser(spec, createDefaults(), handler);\n const result = parser.parse(ctx.args);\n\n if (result.error) {\n await parser.writeError(result.error, ctx.stderr);\n return 1;\n }\n\n const options = result.flags;\n const args = result.args;\n\n // First positional arg is pattern if no -e patterns\n let files: string[];\n if (options.patterns.length === 0) {\n if (args.length === 0) {\n await ctx.stderr.writeText(\"grep: missing pattern\\n\");\n return 1;\n }\n options.patterns.push(args[0]!);\n files = args.slice(1);\n } else {\n files = args;\n }\n\n let regex: RegExp;\n try {\n regex = buildMatcher(options);\n } catch (err) {\n await ctx.stderr.writeText(`grep: invalid pattern: ${options.patterns.join(\", \")}\\n`);\n return 1;\n }\n\n let globalFound = false;\n let globalMatchCount = 0;\n let earlyExit = false;\n\n // Determine filename display mode\n let showFilenames = options.showFilename;\n\n // Expand files if recursive\n let expandedFiles = files;\n if (options.recursive && files.length > 0) {\n expandedFiles = [];\n for (const file of files) {\n const path = ctx.fs.resolve(ctx.cwd, file);\n try {\n const stat = await ctx.fs.stat(path);\n if (stat.isDirectory()) {\n // Glob all files in directory\n const globbed = await ctx.fs.glob(\"**/*\", { cwd: path });\n for (const f of globbed) {\n const fullPath = ctx.fs.resolve(path, f);\n try {\n const s = await ctx.fs.stat(fullPath);\n if (s.isFile()) {\n expandedFiles.push(fullPath);\n }\n } catch {\n // Skip if can't stat\n }\n }\n } else {\n expandedFiles.push(path);\n }\n } catch {\n expandedFiles.push(path); // Will error later\n }\n }\n // Filter by include/exclude patterns\n if (options.include.length > 0 || options.exclude.length > 0) {\n expandedFiles = expandedFiles.filter((f) => {\n const basename = ctx.fs.basename(f);\n if (options.include.length > 0) {\n const included = options.include.some((pat) => matchGlob(basename, pat));\n if (!included) return false;\n }\n if (options.exclude.length > 0) {\n const excluded = options.exclude.some((pat) => matchGlob(basename, pat));\n if (excluded) return false;\n }\n return true;\n });\n }\n\n // Default to showing filenames for recursive\n if (showFilenames === null) {\n showFilenames = true;\n }\n }\n\n // Default: show filenames if multiple files\n if (showFilenames === null) {\n showFilenames = expandedFiles.length > 1;\n }\n\n const processContent = async (\n lines: string[],\n filename?: string\n ): Promise<{ found: boolean; count: number }> => {\n let fileFound = false;\n let fileMatchCount = 0;\n\n // For context lines, we need a buffer approach\n const hasContext = options.beforeContext > 0 || options.afterContext > 0;\n\n if (hasContext) {\n return await processWithContext(lines, filename);\n }\n\n for (let lineIdx = 0; lineIdx < lines.length && !earlyExit; lineIdx++) {\n const line = lines[lineIdx]!;\n const lineNum = lineIdx + 1;\n\n // Reset regex lastIndex for each line\n regex.lastIndex = 0;\n const matches = regex.test(line);\n const shouldOutput = options.invert ? !matches : matches;\n\n if (shouldOutput) {\n fileFound = true;\n fileMatchCount++;\n\n // Quiet mode: exit immediately on first match\n if (options.quiet) {\n earlyExit = true;\n return { found: true, count: 1 };\n }\n\n // -l mode: we found a match in this file, stop processing this file\n if (options.filesWithMatches) {\n return { found: true, count: 1 };\n }\n\n // Output the match (unless countOnly or filesWithoutMatches)\n if (!options.countOnly && !options.filesWithoutMatches) {\n if (options.onlyMatching && !options.invert) {\n // Output only the matched parts\n regex.lastIndex = 0;\n let match;\n while ((match = regex.exec(line)) !== null) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += match[0] + \"\\n\";\n await ctx.stdout.writeText(output);\n // Prevent infinite loop for zero-width matches\n if (match[0].length === 0) regex.lastIndex++;\n }\n } else {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += line + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n }\n\n // Check max matches\n if (options.maxMatches > 0 && fileMatchCount >= options.maxMatches) {\n earlyExit = true;\n return { found: true, count: fileMatchCount };\n }\n }\n }\n\n return { found: fileFound, count: fileMatchCount };\n };\n\n const processWithContext = async (\n lines: string[],\n filename?: string\n ): Promise<{ found: boolean; count: number }> => {\n let fileFound = false;\n let fileMatchCount = 0;\n let lastPrintedLine = -1;\n\n // First pass: find all matching lines\n const matchingLines = new Set<number>();\n for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {\n const line = lines[lineIdx]!;\n regex.lastIndex = 0;\n const matches = regex.test(line);\n const shouldOutput = options.invert ? !matches : matches;\n if (shouldOutput) {\n matchingLines.add(lineIdx);\n }\n }\n\n // Determine which lines to print (matches + context)\n const linesToPrint = new Set<number>();\n for (const matchIdx of matchingLines) {\n // Add before context\n for (let i = Math.max(0, matchIdx - options.beforeContext); i < matchIdx; i++) {\n linesToPrint.add(i);\n }\n // Add the match itself\n linesToPrint.add(matchIdx);\n // Add after context\n for (let i = matchIdx + 1; i <= Math.min(lines.length - 1, matchIdx + options.afterContext); i++) {\n linesToPrint.add(i);\n }\n }\n\n // Sort and print\n const sortedLines = Array.from(linesToPrint).sort((a, b) => a - b);\n\n for (let i = 0; i < sortedLines.length && !earlyExit; i++) {\n const lineIdx = sortedLines[i]!;\n const line = lines[lineIdx]!;\n const lineNum = lineIdx + 1;\n const isMatch = matchingLines.has(lineIdx);\n\n // Print separator if there's a gap\n if (lastPrintedLine >= 0 && lineIdx > lastPrintedLine + 1) {\n await ctx.stdout.writeText(\"--\\n\");\n }\n\n if (isMatch) {\n fileFound = true;\n fileMatchCount++;\n\n if (options.quiet) {\n earlyExit = true;\n return { found: true, count: 1 };\n }\n\n if (options.filesWithMatches) {\n return { found: true, count: 1 };\n }\n\n if (!options.countOnly && !options.filesWithoutMatches) {\n if (options.onlyMatching && !options.invert) {\n regex.lastIndex = 0;\n let match;\n while ((match = regex.exec(line)) !== null) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += match[0] + \"\\n\";\n await ctx.stdout.writeText(output);\n if (match[0].length === 0) regex.lastIndex++;\n }\n } else {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += line + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n }\n\n if (options.maxMatches > 0 && fileMatchCount >= options.maxMatches) {\n // Still need to output remaining context lines after this match\n // Continue to output context but mark we should stop looking for more matches\n const remainingContextLines = sortedLines.slice(i + 1).filter(idx => !matchingLines.has(idx));\n for (const contextIdx of remainingContextLines) {\n const contextLine = lines[contextIdx]!;\n const contextLineNum = contextIdx + 1;\n // Check if it's within after-context of current match\n if (contextIdx <= lineIdx + options.afterContext) {\n if (lastPrintedLine >= 0 && contextIdx > lastPrintedLine + 1) {\n await ctx.stdout.writeText(\"--\\n\");\n }\n if (!options.countOnly && !options.filesWithoutMatches) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \"-\";\n if (options.showLineNumbers) output += contextLineNum + \"-\";\n output += contextLine + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n lastPrintedLine = contextIdx;\n }\n }\n earlyExit = true;\n return { found: true, count: fileMatchCount };\n }\n } else {\n // Context line\n if (!options.countOnly && !options.filesWithoutMatches) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \"-\";\n if (options.showLineNumbers) output += lineNum + \"-\";\n output += line + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n }\n\n lastPrintedLine = lineIdx;\n }\n\n return { found: fileFound, count: fileMatchCount };\n };\n\n if (expandedFiles.length === 0) {\n // Read from stdin\n const content = await ctx.stdin.text();\n const lines = content.split(\"\\n\");\n // Remove trailing empty line if content ends with newline\n if (lines.length > 0 && lines[lines.length - 1] === \"\") {\n lines.pop();\n }\n\n const { found, count } = await processContent(lines);\n globalFound = found;\n globalMatchCount = count;\n\n if (options.countOnly && !options.quiet && !options.filesWithMatches && !options.filesWithoutMatches) {\n await ctx.stdout.writeText(globalMatchCount + \"\\n\");\n }\n } else {\n // Read from files\n const perFileResults: Map<string, { found: boolean; count: number }> = new Map();\n\n for (const file of expandedFiles) {\n if (earlyExit && options.quiet) break;\n\n try {\n const path = file.startsWith(\"/\") ? file : ctx.fs.resolve(ctx.cwd, file);\n const stat = await ctx.fs.stat(path);\n\n if (stat.isDirectory()) {\n if (!options.recursive) {\n await ctx.stderr.writeText(`grep: ${file}: Is a directory\\n`);\n }\n continue;\n }\n\n const content = await ctx.fs.readFile(path);\n const lines = content.toString().split(\"\\n\");\n\n // Remove trailing empty line if file ends with newline\n if (lines.length > 0 && lines[lines.length - 1] === \"\") {\n lines.pop();\n }\n\n // Use original filename for display, not resolved path\n const displayName = files.includes(file) ? file :\n (options.recursive ? path : file);\n\n const { found, count } = await processContent(lines, displayName);\n perFileResults.set(displayName, { found, count });\n\n if (found) {\n globalFound = true;\n globalMatchCount += count;\n }\n } catch (err) {\n await ctx.stderr.writeText(`grep: ${file}: No such file or directory\\n`);\n // Continue to other files instead of immediately returning\n if (expandedFiles.length === 1) {\n return 1;\n }\n }\n }\n\n // Handle -l, -L, -c output modes\n let hasFilesWithoutMatches = false;\n if (options.filesWithMatches) {\n for (const [filename, result] of perFileResults) {\n if (result.found && !options.quiet) {\n await ctx.stdout.writeText(filename + \"\\n\");\n }\n }\n } else if (options.filesWithoutMatches) {\n for (const [filename, result] of perFileResults) {\n if (!result.found) {\n hasFilesWithoutMatches = true;\n await ctx.stdout.writeText(filename + \"\\n\");\n }\n }\n } else if (options.countOnly && !options.quiet) {\n for (const [filename, result] of perFileResults) {\n if (showFilenames) {\n await ctx.stdout.writeText(`${filename}:${result.count}\\n`);\n } else {\n await ctx.stdout.writeText(result.count + \"\\n\");\n }\n }\n }\n\n // Determine exit code for file processing\n if (options.filesWithoutMatches) {\n // -L: success if any file had NO matches\n return hasFilesWithoutMatches ? 0 : 1;\n }\n }\n\n // Determine exit code\n return globalFound ? 0 : 1;\n};\n"
5
+ "import type { Command } from \"../../types.mjs\";\nimport { createFlagParser, type FlagDefinition, type FlagError } from \"../../utils/flag-parser.mjs\";\n\ninterface GrepOptions {\n patterns: string[];\n extendedRegex: boolean; // -E (default for JS)\n fixedStrings: boolean; // -F\n ignoreCase: boolean; // -i\n wholeWord: boolean; // -w\n wholeLine: boolean; // -x\n invert: boolean; // -v\n countOnly: boolean; // -c\n filesWithMatches: boolean; // -l\n filesWithoutMatches: boolean; // -L\n showLineNumbers: boolean; // -n\n onlyMatching: boolean; // -o\n quiet: boolean; // -q\n maxMatches: number; // -m (0 = unlimited)\n showFilename: boolean | null; // null=auto, true=-H, false=-h\n beforeContext: number; // -B\n afterContext: number; // -A\n recursive: boolean; // -r/-R\n include: string[]; // --include\n exclude: string[]; // --exclude\n}\n\nconst spec = {\n name: \"grep\",\n flags: [\n { short: \"E\", long: \"extended-regexp\" },\n { short: \"F\", long: \"fixed-strings\" },\n { short: \"i\", long: \"ignore-case\" },\n { short: \"w\", long: \"word-regexp\" },\n { short: \"x\", long: \"line-regexp\" },\n { short: \"v\", long: \"invert-match\" },\n { short: \"c\", long: \"count\" },\n { short: \"l\", long: \"files-with-matches\" },\n { short: \"L\", long: \"files-without-match\" },\n { short: \"n\", long: \"line-number\" },\n { short: \"o\", long: \"only-matching\" },\n { short: \"q\", long: \"quiet\" },\n { short: \"H\", long: \"with-filename\" },\n { short: \"h\", long: \"no-filename\" },\n { short: \"r\", long: \"recursive\" },\n { short: \"R\" },\n { short: \"e\", long: \"regexp\", takesValue: true },\n { short: \"m\", long: \"max-count\", takesValue: true },\n { short: \"A\", long: \"after-context\", takesValue: true },\n { short: \"B\", long: \"before-context\", takesValue: true },\n { short: \"C\", long: \"context\", takesValue: true },\n { long: \"include\", takesValue: true },\n { long: \"exclude\", takesValue: true },\n ] as FlagDefinition[],\n usage: \"grep [-ivnclLqHhEFwxorR] [-e pattern] [-m num] pattern [file ...]\",\n};\n\nfunction createDefaults(): GrepOptions {\n return {\n patterns: [],\n extendedRegex: true, // JS regex is extended by default\n fixedStrings: false,\n ignoreCase: false,\n wholeWord: false,\n wholeLine: false,\n invert: false,\n countOnly: false,\n filesWithMatches: false,\n filesWithoutMatches: false,\n showLineNumbers: false,\n onlyMatching: false,\n quiet: false,\n maxMatches: 0,\n showFilename: null,\n beforeContext: 0,\n afterContext: 0,\n recursive: false,\n include: [],\n exclude: [],\n };\n}\n\nconst handler = (flags: GrepOptions, flag: FlagDefinition, value?: string) => {\n switch (flag.short) {\n case \"E\": flags.extendedRegex = true; break;\n case \"F\": flags.fixedStrings = true; break;\n case \"i\": flags.ignoreCase = true; break;\n case \"w\": flags.wholeWord = true; break;\n case \"x\": flags.wholeLine = true; break;\n case \"v\": flags.invert = true; break;\n case \"c\": flags.countOnly = true; break;\n case \"l\": flags.filesWithMatches = true; break;\n case \"L\": flags.filesWithoutMatches = true; break;\n case \"n\": flags.showLineNumbers = true; break;\n case \"o\": flags.onlyMatching = true; break;\n case \"q\": flags.quiet = true; break;\n case \"H\": flags.showFilename = true; break;\n case \"h\": flags.showFilename = false; break;\n case \"r\":\n case \"R\": flags.recursive = true; break;\n case \"e\": if (value) flags.patterns.push(value); break;\n case \"m\": if (value) flags.maxMatches = parseInt(value, 10); break;\n case \"A\": if (value) flags.afterContext = parseInt(value, 10); break;\n case \"B\": if (value) flags.beforeContext = parseInt(value, 10); break;\n case \"C\":\n if (value) {\n const num = parseInt(value, 10);\n flags.beforeContext = num;\n flags.afterContext = num;\n }\n break;\n default:\n // Handle long-only flags\n if (flag.long === \"include\" && value) flags.include.push(value);\n else if (flag.long === \"exclude\" && value) flags.exclude.push(value);\n break;\n }\n};\n\nfunction matchGlob(str: string, pattern: string): boolean {\n // Convert shell glob to regex: * -> .*, ? -> ., rest escaped\n let re = \"^\";\n for (const ch of pattern) {\n if (ch === \"*\") re += \".*\";\n else if (ch === \"?\") re += \".\";\n else if (/[.+^${}()|[\\]\\\\]/.test(ch)) re += \"\\\\\" + ch;\n else re += ch;\n }\n re += \"$\";\n return new RegExp(re).test(str);\n}\n\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction buildMatcher(options: GrepOptions): RegExp {\n let patterns = options.patterns;\n\n // If fixed strings mode, escape regex metacharacters\n if (options.fixedStrings) {\n patterns = patterns.map(escapeRegex);\n } else {\n // Convert BRE patterns to ERE/JavaScript RegExp\n // In BRE: \\| \\( \\) are special; bare ( ) + ? { } are literal\n // In ERE/JS: | ( ) + ? { } are special; \\| \\( \\) are literal\n patterns = patterns.map(p => {\n const hasBRE = /\\\\\\||\\\\\\(|\\\\\\)/.test(p);\n if (!hasBRE) return p;\n let result = \"\";\n for (let i = 0; i < p.length; i++) {\n const ch = p[i]!;\n if (ch === \"\\\\\" && i + 1 < p.length) {\n const next = p[i + 1]!;\n if (next === \"|\" || next === \"(\" || next === \")\") {\n // BRE special → ERE special (emit unescaped)\n result += next;\n i++;\n } else {\n result += ch + next;\n i++;\n }\n } else if (\"()+?{}\".includes(ch)) {\n // Bare metachar is literal in BRE → escape for ERE\n result += \"\\\\\" + ch;\n } else {\n result += ch;\n }\n }\n return result;\n });\n }\n\n // Combine multiple patterns with OR\n let combined = patterns.length > 1 ? patterns.map(p => `(?:${p})`).join(\"|\") : patterns[0] || \"\";\n\n // Whole word match\n if (options.wholeWord) {\n combined = `\\\\b(?:${combined})\\\\b`;\n }\n\n // Whole line match\n if (options.wholeLine) {\n combined = `^(?:${combined})$`;\n }\n\n const flags = options.ignoreCase ? \"gi\" : \"g\";\n return new RegExp(combined, flags);\n}\n\nexport const grep: Command = async (ctx) => {\n // Create fresh parser with fresh defaults for each invocation\n const parser = createFlagParser(spec, createDefaults(), handler);\n const result = parser.parse(ctx.args);\n\n if (result.error) {\n await parser.writeError(result.error, ctx.stderr);\n return 1;\n }\n\n const options = result.flags;\n const args = result.args;\n\n // First positional arg is pattern if no -e patterns\n let files: string[];\n if (options.patterns.length === 0) {\n if (args.length === 0) {\n await ctx.stderr.writeText(\"grep: missing pattern\\n\");\n return 1;\n }\n options.patterns.push(args[0]!);\n files = args.slice(1);\n } else {\n files = args;\n }\n\n let regex: RegExp;\n try {\n regex = buildMatcher(options);\n } catch (err) {\n await ctx.stderr.writeText(`grep: invalid pattern: ${options.patterns.join(\", \")}\\n`);\n return 1;\n }\n\n let globalFound = false;\n let globalMatchCount = 0;\n let earlyExit = false;\n\n // Determine filename display mode\n let showFilenames = options.showFilename;\n\n // Expand files if recursive\n let expandedFiles = files;\n if (options.recursive && files.length > 0) {\n expandedFiles = [];\n for (const file of files) {\n const path = ctx.fs.resolve(ctx.cwd, file);\n try {\n const stat = await ctx.fs.stat(path);\n if (stat.isDirectory()) {\n // Glob all files in directory\n const globbed = await ctx.fs.glob(\"**/*\", { cwd: path });\n for (const f of globbed) {\n const fullPath = ctx.fs.resolve(path, f);\n try {\n const s = await ctx.fs.stat(fullPath);\n if (s.isFile()) {\n expandedFiles.push(fullPath);\n }\n } catch {\n // Skip if can't stat\n }\n }\n } else {\n expandedFiles.push(path);\n }\n } catch {\n expandedFiles.push(path); // Will error later\n }\n }\n // Filter by include/exclude patterns\n if (options.include.length > 0 || options.exclude.length > 0) {\n expandedFiles = expandedFiles.filter((f) => {\n const basename = ctx.fs.basename(f);\n if (options.include.length > 0) {\n const included = options.include.some((pat) => matchGlob(basename, pat));\n if (!included) return false;\n }\n if (options.exclude.length > 0) {\n const excluded = options.exclude.some((pat) => matchGlob(basename, pat));\n if (excluded) return false;\n }\n return true;\n });\n }\n\n // Default to showing filenames for recursive\n if (showFilenames === null) {\n showFilenames = true;\n }\n }\n\n // Default: show filenames if multiple files\n if (showFilenames === null) {\n showFilenames = expandedFiles.length > 1;\n }\n\n const processContent = async (\n lines: string[],\n filename?: string\n ): Promise<{ found: boolean; count: number }> => {\n let fileFound = false;\n let fileMatchCount = 0;\n\n // For context lines, we need a buffer approach\n const hasContext = options.beforeContext > 0 || options.afterContext > 0;\n\n if (hasContext) {\n return await processWithContext(lines, filename);\n }\n\n for (let lineIdx = 0; lineIdx < lines.length && !earlyExit; lineIdx++) {\n const line = lines[lineIdx]!;\n const lineNum = lineIdx + 1;\n\n // Reset regex lastIndex for each line\n regex.lastIndex = 0;\n const matches = regex.test(line);\n const shouldOutput = options.invert ? !matches : matches;\n\n if (shouldOutput) {\n fileFound = true;\n fileMatchCount++;\n\n // Quiet mode: exit immediately on first match\n if (options.quiet) {\n earlyExit = true;\n return { found: true, count: 1 };\n }\n\n // -l mode: we found a match in this file, stop processing this file\n if (options.filesWithMatches) {\n return { found: true, count: 1 };\n }\n\n // Output the match (unless countOnly or filesWithoutMatches)\n if (!options.countOnly && !options.filesWithoutMatches) {\n if (options.onlyMatching && !options.invert) {\n // Output only the matched parts\n regex.lastIndex = 0;\n let match;\n while ((match = regex.exec(line)) !== null) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += match[0] + \"\\n\";\n await ctx.stdout.writeText(output);\n // Prevent infinite loop for zero-width matches\n if (match[0].length === 0) regex.lastIndex++;\n }\n } else {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += line + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n }\n\n // Check max matches\n if (options.maxMatches > 0 && fileMatchCount >= options.maxMatches) {\n earlyExit = true;\n return { found: true, count: fileMatchCount };\n }\n }\n }\n\n return { found: fileFound, count: fileMatchCount };\n };\n\n const processWithContext = async (\n lines: string[],\n filename?: string\n ): Promise<{ found: boolean; count: number }> => {\n let fileFound = false;\n let fileMatchCount = 0;\n let lastPrintedLine = -1;\n\n // First pass: find all matching lines\n const matchingLines = new Set<number>();\n for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {\n const line = lines[lineIdx]!;\n regex.lastIndex = 0;\n const matches = regex.test(line);\n const shouldOutput = options.invert ? !matches : matches;\n if (shouldOutput) {\n matchingLines.add(lineIdx);\n }\n }\n\n // Determine which lines to print (matches + context)\n const linesToPrint = new Set<number>();\n for (const matchIdx of matchingLines) {\n // Add before context\n for (let i = Math.max(0, matchIdx - options.beforeContext); i < matchIdx; i++) {\n linesToPrint.add(i);\n }\n // Add the match itself\n linesToPrint.add(matchIdx);\n // Add after context\n for (let i = matchIdx + 1; i <= Math.min(lines.length - 1, matchIdx + options.afterContext); i++) {\n linesToPrint.add(i);\n }\n }\n\n // Sort and print\n const sortedLines = Array.from(linesToPrint).sort((a, b) => a - b);\n\n for (let i = 0; i < sortedLines.length && !earlyExit; i++) {\n const lineIdx = sortedLines[i]!;\n const line = lines[lineIdx]!;\n const lineNum = lineIdx + 1;\n const isMatch = matchingLines.has(lineIdx);\n\n // Print separator if there's a gap\n if (lastPrintedLine >= 0 && lineIdx > lastPrintedLine + 1) {\n await ctx.stdout.writeText(\"--\\n\");\n }\n\n if (isMatch) {\n fileFound = true;\n fileMatchCount++;\n\n if (options.quiet) {\n earlyExit = true;\n return { found: true, count: 1 };\n }\n\n if (options.filesWithMatches) {\n return { found: true, count: 1 };\n }\n\n if (!options.countOnly && !options.filesWithoutMatches) {\n if (options.onlyMatching && !options.invert) {\n regex.lastIndex = 0;\n let match;\n while ((match = regex.exec(line)) !== null) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += match[0] + \"\\n\";\n await ctx.stdout.writeText(output);\n if (match[0].length === 0) regex.lastIndex++;\n }\n } else {\n let output = \"\";\n if (filename && showFilenames) output += filename + \":\";\n if (options.showLineNumbers) output += lineNum + \":\";\n output += line + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n }\n\n if (options.maxMatches > 0 && fileMatchCount >= options.maxMatches) {\n // Still need to output remaining context lines after this match\n // Continue to output context but mark we should stop looking for more matches\n const remainingContextLines = sortedLines.slice(i + 1).filter(idx => !matchingLines.has(idx));\n for (const contextIdx of remainingContextLines) {\n const contextLine = lines[contextIdx]!;\n const contextLineNum = contextIdx + 1;\n // Check if it's within after-context of current match\n if (contextIdx <= lineIdx + options.afterContext) {\n if (lastPrintedLine >= 0 && contextIdx > lastPrintedLine + 1) {\n await ctx.stdout.writeText(\"--\\n\");\n }\n if (!options.countOnly && !options.filesWithoutMatches) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \"-\";\n if (options.showLineNumbers) output += contextLineNum + \"-\";\n output += contextLine + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n lastPrintedLine = contextIdx;\n }\n }\n earlyExit = true;\n return { found: true, count: fileMatchCount };\n }\n } else {\n // Context line\n if (!options.countOnly && !options.filesWithoutMatches) {\n let output = \"\";\n if (filename && showFilenames) output += filename + \"-\";\n if (options.showLineNumbers) output += lineNum + \"-\";\n output += line + \"\\n\";\n await ctx.stdout.writeText(output);\n }\n }\n\n lastPrintedLine = lineIdx;\n }\n\n return { found: fileFound, count: fileMatchCount };\n };\n\n if (expandedFiles.length === 0) {\n // Read from stdin\n const content = await ctx.stdin.text();\n const lines = content.split(\"\\n\");\n // Remove trailing empty line if content ends with newline\n if (lines.length > 0 && lines[lines.length - 1] === \"\") {\n lines.pop();\n }\n\n const { found, count } = await processContent(lines);\n globalFound = found;\n globalMatchCount = count;\n\n if (options.countOnly && !options.quiet && !options.filesWithMatches && !options.filesWithoutMatches) {\n await ctx.stdout.writeText(globalMatchCount + \"\\n\");\n }\n } else {\n // Read from files\n const perFileResults: Map<string, { found: boolean; count: number }> = new Map();\n\n for (const file of expandedFiles) {\n if (earlyExit && options.quiet) break;\n\n try {\n const path = file.startsWith(\"/\") ? file : ctx.fs.resolve(ctx.cwd, file);\n const stat = await ctx.fs.stat(path);\n\n if (stat.isDirectory()) {\n if (!options.recursive) {\n await ctx.stderr.writeText(`grep: ${file}: Is a directory\\n`);\n }\n continue;\n }\n\n const content = await ctx.fs.readFile(path);\n const lines = content.toString().split(\"\\n\");\n\n // Remove trailing empty line if file ends with newline\n if (lines.length > 0 && lines[lines.length - 1] === \"\") {\n lines.pop();\n }\n\n // Use original filename for display, not resolved path\n const displayName = files.includes(file) ? file :\n (options.recursive ? path : file);\n\n const { found, count } = await processContent(lines, displayName);\n perFileResults.set(displayName, { found, count });\n\n if (found) {\n globalFound = true;\n globalMatchCount += count;\n }\n } catch (err) {\n await ctx.stderr.writeText(`grep: ${file}: No such file or directory\\n`);\n // Continue to other files instead of immediately returning\n if (expandedFiles.length === 1) {\n return 1;\n }\n }\n }\n\n // Handle -l, -L, -c output modes\n let hasFilesWithoutMatches = false;\n if (options.filesWithMatches) {\n for (const [filename, result] of perFileResults) {\n if (result.found && !options.quiet) {\n await ctx.stdout.writeText(filename + \"\\n\");\n }\n }\n } else if (options.filesWithoutMatches) {\n for (const [filename, result] of perFileResults) {\n if (!result.found) {\n hasFilesWithoutMatches = true;\n await ctx.stdout.writeText(filename + \"\\n\");\n }\n }\n } else if (options.countOnly && !options.quiet) {\n for (const [filename, result] of perFileResults) {\n if (showFilenames) {\n await ctx.stdout.writeText(`${filename}:${result.count}\\n`);\n } else {\n await ctx.stdout.writeText(result.count + \"\\n\");\n }\n }\n }\n\n // Determine exit code for file processing\n if (options.filesWithoutMatches) {\n // -L: success if any file had NO matches\n return hasFilesWithoutMatches ? 0 : 1;\n }\n }\n\n // Determine exit code\n return globalFound ? 0 : 1;\n};\n"
6
6
  ],
7
- "mappings": ";AACA;AAyBA,IAAM,OAAO;AAAA,E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O,QAAQ;AAAA,CAAI;AAAA;AAAA,MAElD;AAAA,IACF;AAAA,IAGA,IAAI,QAAQ,qBAAqB;AAAA,MAE/B,OAAO,yBAAyB,IAAI;AAAA,IACtC;AAAA;AAAA,EAIF,OAAO,cAAc,IAAI;AAAA;",
8
+ "debugId": "AB66DEE3D4E2ECCE64756E2164756E21",
9
9
  "names": []
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shell-dsl",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "description": "A sandboxed shell-style DSL for running scriptable command pipelines in-process without host OS access",
5
5
  "author": "ricsam <oss@ricsam.dev>",
6
6
  "license": "MIT",