@evalops/maestro 0.10.42 → 0.10.44
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/cli/commands/operating-plane.d.ts.map +1 -1
- package/dist/cli/commands/operating-plane.js +3 -2
- package/dist/cli/commands/operating-plane.js.map +1 -1
- package/dist/cli/help.js +8 -6
- package/dist/cli/help.js.map +1 -1
- package/dist/cli.js +247 -97
- package/dist/codex/subagent-dispatch-table.d.ts +1 -1
- package/dist/codex/subagent-dispatch-table.js +1 -1
- package/dist/codex/subagent-dispatch-table.js.map +1 -1
- package/dist/node_modules/@evalops/contracts/package.json +1 -1
- package/dist/node_modules/@evalops/tui/package.json +1 -1
- package/dist/platform/a2a-completion-audit.d.ts +12 -6
- package/dist/platform/a2a-completion-audit.d.ts.map +1 -1
- package/dist/platform/a2a-completion-audit.js +28 -20
- package/dist/platform/a2a-completion-audit.js.map +1 -1
- package/dist/platform/a2a-maestro-peer.js +8 -7
- package/dist/platform/a2a-maestro-peer.js.map +1 -1
- package/dist/platform/a2a-telemetry-inspect.d.ts +2 -2
- package/dist/platform/a2a-telemetry-inspect.d.ts.map +1 -1
- package/dist/platform/a2a-telemetry-inspect.js +3 -3
- package/dist/platform/a2a-telemetry-inspect.js.map +1 -1
- package/dist/platform/operating-plane-client.d.ts +2 -2
- package/dist/platform/operating-plane-client.d.ts.map +1 -1
- package/dist/platform/operating-plane-client.js.map +1 -1
- package/dist/platform/operating-plane-summary.d.ts +4 -4
- package/dist/platform/operating-plane-summary.d.ts.map +1 -1
- package/dist/platform/operating-plane-summary.js +39 -27
- package/dist/platform/operating-plane-summary.js.map +1 -1
- package/dist/server/handlers/hosted-runner-drain.d.ts +28 -0
- package/dist/server/handlers/hosted-runner-drain.d.ts.map +1 -1
- package/dist/server/handlers/hosted-runner-drain.js +55 -2
- package/dist/server/handlers/hosted-runner-drain.js.map +1 -1
- package/dist/server/session-timeline.d.ts.map +1 -1
- package/dist/server/session-timeline.js +112 -2
- package/dist/server/session-timeline.js.map +1 -1
- package/dist/tools/background/resource-monitor.d.ts.map +1 -1
- package/dist/tools/background/resource-monitor.js +8 -6
- package/dist/tools/background/resource-monitor.js.map +1 -1
- package/dist/tools/parallel-ripgrep.d.ts.map +1 -1
- package/dist/tools/parallel-ripgrep.js +2 -2
- package/dist/tools/parallel-ripgrep.js.map +1 -1
- package/dist/tools/ripgrep-utils.d.ts +1 -0
- package/dist/tools/ripgrep-utils.d.ts.map +1 -1
- package/dist/tools/ripgrep-utils.js +4 -0
- package/dist/tools/ripgrep-utils.js.map +1 -1
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +2 -2
- package/dist/tools/search.js.map +1 -1
- package/dist/version.json +2 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAIH,OAAO,EACN,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAIH,OAAO,EACN,KAAK,YAAY,EASjB,MAAM,oBAAoB,CAAC;AAkI5B,KAAK,iBAAiB,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAC7C,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4UrB,CAAC"}
|
package/dist/tools/search.js
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
*/
|
|
52
52
|
import { resolve as resolvePath } from "node:path";
|
|
53
53
|
import { Type } from "@sinclair/typebox";
|
|
54
|
-
import { formatRipgrepCommand, globSchema, isRipgrepPathError, parseRipgrepJson, pathSchema, runRipgrep, toArray, } from "./ripgrep-utils.js";
|
|
54
|
+
import { formatRipgrepCommand, globSchema, isRipgrepPathError, normalizeRipgrepPathArgs, parseRipgrepJson, pathSchema, runRipgrep, toArray, } from "./ripgrep-utils.js";
|
|
55
55
|
import { createTool, expandUserPath } from "./tool-dsl.js";
|
|
56
56
|
const searchSchema = Type.Object({
|
|
57
57
|
pattern: Type.String({
|
|
@@ -173,7 +173,7 @@ Examples:
|
|
|
173
173
|
if (format === "json" && outputMode !== "content") {
|
|
174
174
|
throw new Error("JSON format is not supported with outputMode: 'files' or 'count'. Use format: 'text' or omit the format parameter.");
|
|
175
175
|
}
|
|
176
|
-
const pathArgs = toArray(paths);
|
|
176
|
+
const pathArgs = normalizeRipgrepPathArgs(toArray(paths));
|
|
177
177
|
const globArgs = toArray(glob);
|
|
178
178
|
const commandCwd = cwd ? resolvePath(expandUserPath(cwd)) : process.cwd();
|
|
179
179
|
const args = ["--color=never"];
|
package/dist/tools/search.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,EAAE,OAAO,IAAI,WAAW,EA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,CAAC,CAAC,MAAM,CAAC;gBAChC,OAAO;gBACP,GAAG,EAAE,UAAU;gBACf,MAAM;gBACN,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC;gBAC5C,SAAS;aACT,CAAC,CAAC;QACJ,CAAC;QAED,oCAAoC;QACpC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClD,MAAM,WAAW,GAChB,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7D,MAAM,SAAS,GAAG,SAAS,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;QACtE,MAAM,aAAa,GAAG,SAAS;YAC9B,CAAC,CAAC,oBAAoB,WAAW,CAAC,MAAM,OAAO,KAAK,CAAC,MAAM,SAAS;YACpE,CAAC,CAAC,gBAAgB;gBACjB,CAAC,CAAC,8CAA8C;gBAChD,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,MAAM,CAAC;YAClE,OAAO;YACP,GAAG,EAAE,UAAU;YACf,MAAM;YACN,SAAS,EAAE,SAAS,IAAI,gBAAgB;SACxC,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC","sourcesContent":["/**\n * Search Tool - Ripgrep-Powered Code Search\n *\n * This module provides a powerful search tool that wraps ripgrep (rg) for\n * fast, regex-capable searching across codebases. It supports multiple\n * output modes, context controls, and filtering options.\n *\n * ## Output Modes\n *\n * | Mode | Description | Use Case |\n * |-----------|------------------------------------|-----------------------------|\n * | content | Show matching lines with context | Reading code matches |\n * | files | List only file paths | Finding which files match |\n * | count | Show match counts per file | Gauging search scope |\n *\n * ## Features\n *\n * - **Regex support**: Full regex patterns or literal string matching\n * - **Case handling**: Case-sensitive or insensitive searches\n * - **Context lines**: Show surrounding lines for context (-B, -A, -C)\n * - **Glob filtering**: Target specific file patterns\n * - **Git-aware**: Respects .gitignore by default\n * - **Multiline**: Optional multiline pattern matching\n * - **JSON output**: Structured results for programmatic use\n *\n * ## Example\n *\n * ```typescript\n * // Find all TODO comments in TypeScript files\n * searchTool.execute('call-id', {\n * pattern: 'TODO',\n * glob: '*.ts',\n * outputMode: 'files',\n * });\n *\n * // Search with context\n * searchTool.execute('call-id', {\n * pattern: 'function\\\\s+\\\\w+',\n * context: 3,\n * ignoreCase: true,\n * });\n * ```\n *\n * ## Performance\n *\n * - Default max results: 500 (configurable up to 1000)\n * - Head limit for sampling large result sets\n * - Truncation indicators when limits are hit\n *\n * @module tools/search\n */\n\nimport { resolve as resolvePath } from \"node:path\";\nimport { Type } from \"@sinclair/typebox\";\nimport {\n\ttype RipgrepMatch,\n\tformatRipgrepCommand,\n\tglobSchema,\n\tisRipgrepPathError,\n\tparseRipgrepJson,\n\tpathSchema,\n\trunRipgrep,\n\ttoArray,\n} from \"./ripgrep-utils.js\";\nimport { createTool, expandUserPath } from \"./tool-dsl.js\";\n\nconst searchSchema = Type.Object(\n\t{\n\t\tpattern: Type.String({\n\t\t\tdescription: \"Regex pattern (or literal when literal=true)\",\n\t\t\tminLength: 1,\n\t\t}),\n\t\tpaths: pathSchema,\n\t\tglob: globSchema,\n\t\tignoreCase: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Perform case-insensitive search (-i).\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tliteral: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Treat the pattern as a literal string (--fixed-strings).\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tword: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Match only whole words (-w).\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tmultiline: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Enable multiline matching (--multiline).\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tmaxResults: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription: \"Stop after this many matches (-m).\",\n\t\t\t\tminimum: 1,\n\t\t\t\tmaximum: 1000,\n\t\t\t}),\n\t\t),\n\t\tcontext: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription: \"Show this many lines of context before and after (-C).\",\n\t\t\t\tminimum: 0,\n\t\t\t\tmaximum: 20,\n\t\t\t}),\n\t\t),\n\t\tbeforeContext: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription: \"Show this many lines of context before each match (-B).\",\n\t\t\t\tminimum: 0,\n\t\t\t\tmaximum: 20,\n\t\t\t}),\n\t\t),\n\t\tafterContext: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription: \"Show this many lines of context after each match (-A).\",\n\t\t\t\tminimum: 0,\n\t\t\t\tmaximum: 20,\n\t\t\t}),\n\t\t),\n\t\tcwd: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Working directory to run ripgrep from\",\n\t\t\t\tminLength: 1,\n\t\t\t}),\n\t\t),\n\t\tincludeHidden: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Include hidden files (--hidden)\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tuseGitIgnore: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Respect .gitignore (set false to pass --no-ignore)\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t\toutputMode: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[Type.Literal(\"content\"), Type.Literal(\"files\"), Type.Literal(\"count\")],\n\t\t\t\t{\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Output mode: 'content' shows matching lines (default), 'files' lists only file paths, 'count' shows match counts per file.\",\n\t\t\t\t\tdefault: \"content\",\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t\tformat: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"text\"), Type.Literal(\"json\")], {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Output format for content mode. JSON not supported with files/count modes.\",\n\t\t\t\tdefault: \"text\",\n\t\t\t}),\n\t\t),\n\t\tinvertMatch: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Show lines that do NOT match the pattern (--invert-match).\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tonlyMatching: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Only show the matched text, not the entire line (--only-matching). Only works with content mode.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\theadLimit: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Limit output to first N lines/entries. Useful for sampling large result sets.\",\n\t\t\t\tminimum: 1,\n\t\t\t\tmaximum: 10000,\n\t\t\t}),\n\t\t),\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use either context or before/after context options, not both.\",\n\t},\n);\n\nconst JSON_DETAIL_LIMIT = 200;\nconst DEFAULT_MAX_RESULTS = 500;\n\ntype SearchToolDetails = {\n\tcommand: string;\n\tcwd: string;\n\tformat?: \"text\" | \"json\" | \"files\" | \"count\";\n\tmatches?: RipgrepMatch[];\n\tfileCount?: number;\n\tfiles?: string[];\n\ttotalMatches?: number;\n\tcounts?: Array<{ file: string; count: number }>;\n\ttruncated?: boolean;\n};\n\nexport const searchTool = createTool<typeof searchSchema, SearchToolDetails>({\n\tname: \"search\",\n\tlabel: \"search\",\n\tdescription: `Find text across files using ripgrep with optional globbing and context controls.\n\nOutput modes (outputMode parameter):\n- \"content\": Show matching lines with file:line:content format (default)\n- \"files\": List only file paths containing matches (fast for finding files)\n- \"count\": Show match counts per file (useful for gauging scope)\n\nModifiers:\n- invertMatch: Show lines that do NOT match\n- onlyMatching: Show only the matched text (content mode only)\n- headLimit: Limit output to first N entries (useful for sampling)\n\nExamples:\n {pattern: \"TODO\", outputMode: \"files\"} → list files containing TODO\n {pattern: \"function\", outputMode: \"count\"} → count functions per file\n {pattern: \"^#\", invertMatch: true} → lines not starting with #`,\n\tschema: searchSchema,\n\tasync run(params, { signal, respond }) {\n\t\tconst {\n\t\t\tpattern,\n\t\t\tpaths,\n\t\t\tglob,\n\t\t\tignoreCase,\n\t\t\tliteral,\n\t\t\tword,\n\t\t\tmultiline,\n\t\t\tmaxResults,\n\t\t\tcontext,\n\t\t\tbeforeContext,\n\t\t\tafterContext,\n\t\t\tcwd,\n\t\t\tincludeHidden,\n\t\t\tuseGitIgnore = true,\n\t\t\toutputMode = \"content\",\n\t\t\tformat = \"text\",\n\t\t\tinvertMatch = false,\n\t\t\tonlyMatching = false,\n\t\t\theadLimit,\n\t\t} = params;\n\n\t\tif (\n\t\t\tcontext !== undefined &&\n\t\t\t(beforeContext !== undefined || afterContext !== undefined)\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Use either context or before/after context options, not both.\",\n\t\t\t);\n\t\t}\n\n\t\t// Validate options incompatible with files/count modes\n\t\tif (outputMode !== \"content\" && onlyMatching) {\n\t\t\tthrow new Error(\n\t\t\t\t\"onlyMatching can only be used with outputMode: 'content'.\",\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\toutputMode !== \"content\" &&\n\t\t\t(context !== undefined ||\n\t\t\t\tbeforeContext !== undefined ||\n\t\t\t\tafterContext !== undefined)\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Context options can only be used with outputMode: 'content'.\",\n\t\t\t);\n\t\t}\n\n\t\tif (format === \"json\" && outputMode !== \"content\") {\n\t\t\tthrow new Error(\n\t\t\t\t\"JSON format is not supported with outputMode: 'files' or 'count'. Use format: 'text' or omit the format parameter.\",\n\t\t\t);\n\t\t}\n\n\t\tconst pathArgs = toArray(paths);\n\t\tconst globArgs = toArray(glob);\n\t\tconst commandCwd = cwd ? resolvePath(expandUserPath(cwd)) : process.cwd();\n\n\t\tconst args: string[] = [\"--color=never\"];\n\n\t\t// Output mode flags\n\t\tif (outputMode === \"files\") {\n\t\t\targs.push(\"--files-with-matches\");\n\t\t} else if (outputMode === \"count\") {\n\t\t\t// Use --count-matches for actual match counts, -H to always show filename\n\t\t\targs.push(\"--count-matches\", \"-H\");\n\t\t} else {\n\t\t\t// content mode: show line numbers and filenames\n\t\t\targs.push(\"-n\", \"--with-filename\");\n\t\t}\n\n\t\tif (ignoreCase) {\n\t\t\targs.push(\"-i\");\n\t\t}\n\n\t\tif (literal) {\n\t\t\targs.push(\"--fixed-strings\");\n\t\t}\n\n\t\tif (word) {\n\t\t\targs.push(\"-w\");\n\t\t}\n\n\t\tif (multiline) {\n\t\t\targs.push(\"--multiline\");\n\t\t}\n\n\t\tif (includeHidden) {\n\t\t\targs.push(\"--hidden\");\n\t\t}\n\n\t\tif (!useGitIgnore) {\n\t\t\targs.push(\"--no-ignore\");\n\t\t}\n\n\t\tif (invertMatch) {\n\t\t\targs.push(\"--invert-match\");\n\t\t}\n\n\t\tif (onlyMatching) {\n\t\t\targs.push(\"--only-matching\");\n\t\t}\n\n\t\tconst shouldApplyMaxResults =\n\t\t\toutputMode === \"content\" || maxResults !== undefined;\n\t\tif (shouldApplyMaxResults) {\n\t\t\tconst effectiveMaxResults = maxResults ?? DEFAULT_MAX_RESULTS;\n\t\t\targs.push(\"-m\", String(effectiveMaxResults));\n\t\t}\n\n\t\tif (context !== undefined) {\n\t\t\targs.push(`-C${context}`);\n\t\t}\n\n\t\tif (beforeContext !== undefined) {\n\t\t\targs.push(`-B${beforeContext}`);\n\t\t}\n\n\t\tif (afterContext !== undefined) {\n\t\t\targs.push(`-A${afterContext}`);\n\t\t}\n\n\t\tfor (const globPattern of globArgs) {\n\t\t\targs.push(\"--glob\", globPattern);\n\t\t}\n\n\t\tif (format === \"json\" && outputMode === \"content\") {\n\t\t\targs.push(\"--json\");\n\t\t}\n\n\t\targs.push(\"--\", pattern);\n\n\t\tif (pathArgs.length > 0) {\n\t\t\targs.push(...pathArgs);\n\t\t} else {\n\t\t\targs.push(\".\");\n\t\t}\n\n\t\tconst command = formatRipgrepCommand(args);\n\t\tlet result: {\n\t\t\tstdout: string;\n\t\t\tstderr: string;\n\t\t\texitCode: number;\n\t\t\ttruncated: boolean;\n\t\t};\n\t\ttry {\n\t\t\tresult = await runRipgrep(args, signal, commandCwd);\n\t\t} catch (error) {\n\t\t\tconst reason =\n\t\t\t\terror instanceof Error\n\t\t\t\t\t? error.message\n\t\t\t\t\t: `Unknown error: ${String(error)}`;\n\t\t\treturn respond\n\t\t\t\t.error(`ripgrep failed\\n\\n${reason}`)\n\t\t\t\t.detail({ command, cwd: commandCwd });\n\t\t}\n\n\t\tif (result.exitCode === 2) {\n\t\t\tconst message = result.stderr.trim() || result.stdout.trim();\n\t\t\tif (isRipgrepPathError(message)) {\n\t\t\t\treturn respond\n\t\t\t\t\t.error(\n\t\t\t\t\t\t`ripgrep failed\\n\\n${message.length > 0 ? message : \"ripgrep path lookup failed\"}`,\n\t\t\t\t\t)\n\t\t\t\t\t.detail({ command, cwd: commandCwd });\n\t\t\t}\n\t\t\tthrow new Error(\n\t\t\t\tmessage.length > 0 ? message : \"ripgrep exited with an error\",\n\t\t\t);\n\t\t}\n\n\t\tif (result.exitCode === 1 || result.stdout.trim().length === 0) {\n\t\t\t// Use correct format in detail based on mode\n\t\t\tconst detailFormat =\n\t\t\t\toutputMode === \"files\"\n\t\t\t\t\t? \"files\"\n\t\t\t\t\t: outputMode === \"count\"\n\t\t\t\t\t\t? \"count\"\n\t\t\t\t\t\t: format;\n\t\t\treturn respond\n\t\t\t\t.text(\"No matches found.\")\n\t\t\t\t.detail({ command, cwd: commandCwd, format: detailFormat });\n\t\t}\n\n\t\tconst truncatedByBytes = result.truncated ?? false;\n\n\t\t// Handle files mode output\n\t\tif (outputMode === \"files\") {\n\t\t\tconst allFiles = result.stdout\n\t\t\t\t.trim()\n\t\t\t\t.split(\"\\n\")\n\t\t\t\t.filter((f) => f.length > 0);\n\t\t\tconst files =\n\t\t\t\theadLimit !== undefined ? allFiles.slice(0, headLimit) : allFiles;\n\t\t\tconst truncated = headLimit !== undefined && allFiles.length > headLimit;\n\t\t\tconst fileList = files.join(\"\\n\");\n\t\t\tconst truncatedNote = truncated\n\t\t\t\t? `\\n\\n... (showing ${files.length} of ${allFiles.length} files)`\n\t\t\t\t: truncatedByBytes\n\t\t\t\t\t? \"\\n\\n... (output truncated due to size limit)\"\n\t\t\t\t\t: \"\";\n\t\t\treturn respond\n\t\t\t\t.text(\n\t\t\t\t\t`Found ${allFiles.length} file(s) matching \"${pattern}\":\\n\\n${fileList}${truncatedNote}`,\n\t\t\t\t)\n\t\t\t\t.detail({\n\t\t\t\t\tcommand,\n\t\t\t\t\tcwd: commandCwd,\n\t\t\t\t\tformat: \"files\",\n\t\t\t\t\tfileCount: allFiles.length,\n\t\t\t\t\tfiles,\n\t\t\t\t\ttruncated: truncated || truncatedByBytes,\n\t\t\t\t});\n\t\t}\n\n\t\t// Handle count mode output\n\t\tif (outputMode === \"count\") {\n\t\t\tconst lines = result.stdout\n\t\t\t\t.trim()\n\t\t\t\t.split(\"\\n\")\n\t\t\t\t.filter((l) => l.length > 0);\n\t\t\tconst allCounts: Array<{ file: string; count: number }> = [];\n\t\t\tlet totalMatches = 0;\n\t\t\t// Use regex to parse \"filename:count\" format robustly\n\t\t\t// This handles Windows paths (C:\\path\\file.txt:5) and colons in filenames\n\t\t\tconst countLineRegex = /^(.+):(\\d+)$/;\n\t\t\tfor (const line of lines) {\n\t\t\t\tconst match = line.match(countLineRegex);\n\t\t\t\tif (match) {\n\t\t\t\t\tconst file = match[1]!;\n\t\t\t\t\tconst matchCount = Number.parseInt(match[2]!, 10);\n\t\t\t\t\tallCounts.push({ file, count: matchCount });\n\t\t\t\t\ttotalMatches += matchCount;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst counts =\n\t\t\t\theadLimit !== undefined ? allCounts.slice(0, headLimit) : allCounts;\n\t\t\tconst truncated = headLimit !== undefined && allCounts.length > headLimit;\n\t\t\tconst summary = counts.map((c) => `${c.file}: ${c.count}`).join(\"\\n\");\n\t\t\tconst truncatedNote = truncated\n\t\t\t\t? `\\n\\n... (showing ${counts.length} of ${allCounts.length} files)`\n\t\t\t\t: truncatedByBytes\n\t\t\t\t\t? \"\\n\\n... (output truncated due to size limit)\"\n\t\t\t\t\t: \"\";\n\t\t\treturn respond\n\t\t\t\t.text(\n\t\t\t\t\t`Found ${totalMatches} match(es) across ${allCounts.length} file(s):\\n\\n${summary}${truncatedNote}`,\n\t\t\t\t)\n\t\t\t\t.detail({\n\t\t\t\t\tcommand,\n\t\t\t\t\tcwd: commandCwd,\n\t\t\t\t\tformat: \"count\",\n\t\t\t\t\ttotalMatches,\n\t\t\t\t\tfileCount: allCounts.length,\n\t\t\t\t\tcounts,\n\t\t\t\t\ttruncated: truncated || truncatedByBytes,\n\t\t\t\t});\n\t\t}\n\n\t\t// Handle JSON format\n\t\tif (format === \"json\") {\n\t\t\tconst allMatches = parseRipgrepJson(result.stdout);\n\t\t\tconst matches =\n\t\t\t\theadLimit !== undefined ? allMatches.slice(0, headLimit) : allMatches;\n\t\t\tconst headLimitTruncated =\n\t\t\t\theadLimit !== undefined && allMatches.length > headLimit;\n\t\t\tconst detailLimitTruncated = matches.length > JSON_DETAIL_LIMIT;\n\t\t\tconst truncated =\n\t\t\t\theadLimitTruncated || detailLimitTruncated || truncatedByBytes;\n\t\t\tconst preview = matches\n\t\t\t\t.slice(0, 5)\n\t\t\t\t.map(\n\t\t\t\t\t(match) =>\n\t\t\t\t\t\t`${match.file}:${match.line}:${match.column} ${match.match.trim()}`,\n\t\t\t\t)\n\t\t\t\t.join(\"\\n\");\n\t\t\tconst suffix =\n\t\t\t\tmatches.length > 5 ? `\\n... (${matches.length - 5} more matches)` : \"\";\n\t\t\tconst truncatedNote = headLimitTruncated\n\t\t\t\t? `\\n(showing ${matches.length} of ${allMatches.length} total matches)`\n\t\t\t\t: \"\";\n\t\t\tconst text = matches.length\n\t\t\t\t? `Found ${allMatches.length} match(es).${truncatedNote}\\n\\n${preview}${suffix}`\n\t\t\t\t: \"No matches found.\";\n\t\t\treturn respond.text(text).detail({\n\t\t\t\tcommand,\n\t\t\t\tcwd: commandCwd,\n\t\t\t\tformat,\n\t\t\t\tmatches: matches.slice(0, JSON_DETAIL_LIMIT),\n\t\t\t\ttruncated,\n\t\t\t});\n\t\t}\n\n\t\t// Handle text format (content mode)\n\t\tconst lines = result.stdout.trimEnd().split(\"\\n\");\n\t\tconst outputLines =\n\t\t\theadLimit !== undefined ? lines.slice(0, headLimit) : lines;\n\t\tconst truncated = headLimit !== undefined && lines.length > headLimit;\n\t\tconst truncatedNote = truncated\n\t\t\t? `\\n\\n... (showing ${outputLines.length} of ${lines.length} lines)`\n\t\t\t: truncatedByBytes\n\t\t\t\t? \"\\n\\n... (output truncated due to size limit)\"\n\t\t\t\t: \"\";\n\t\treturn respond.text(outputLines.join(\"\\n\") + truncatedNote).detail({\n\t\t\tcommand,\n\t\t\tcwd: commandCwd,\n\t\t\tformat,\n\t\t\ttruncated: truncated || truncatedByBytes,\n\t\t});\n\t},\n});\n"]}
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAEN,oBAAoB,EACpB,UAAU,EACV,kBAAkB,EAClB,wBAAwB,EACxB,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,OAAO,GACP,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S;aACT,CAAC,CAAC;QACJ,CAAC;QAED,oCAAoC;QACpC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClD,MAAM,WAAW,GAChB,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC7D,MAAM,SAAS,GAAG,SAAS,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;QACtE,MAAM,aAAa,GAAG,SAAS;YAC9B,CAAC,CAAC,oBAAoB,WAAW,CAAC,MAAM,OAAO,KAAK,CAAC,MAAM,SAAS;YACpE,CAAC,CAAC,gBAAgB;gBACjB,CAAC,CAAC,8CAA8C;gBAChD,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC,MAAM,CAAC;YAClE,OAAO;YACP,GAAG,EAAE,UAAU;YACf,MAAM;YACN,SAAS,EAAE,SAAS,IAAI,gBAAgB;SACxC,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC","sourcesContent":["/**\n * Search Tool - Ripgrep-Powered Code Search\n *\n * This module provides a powerful search tool that wraps ripgrep (rg) for\n * fast, regex-capable searching across codebases. It supports multiple\n * output modes, context controls, and filtering options.\n *\n * ## Output Modes\n *\n * | Mode | Description | Use Case |\n * |-----------|------------------------------------|-----------------------------|\n * | content | Show matching lines with context | Reading code matches |\n * | files | List only file paths | Finding which files match |\n * | count | Show match counts per file | Gauging search scope |\n *\n * ## Features\n *\n * - **Regex support**: Full regex patterns or literal string matching\n * - **Case handling**: Case-sensitive or insensitive searches\n * - **Context lines**: Show surrounding lines for context (-B, -A, -C)\n * - **Glob filtering**: Target specific file patterns\n * - **Git-aware**: Respects .gitignore by default\n * - **Multiline**: Optional multiline pattern matching\n * - **JSON output**: Structured results for programmatic use\n *\n * ## Example\n *\n * ```typescript\n * // Find all TODO comments in TypeScript files\n * searchTool.execute('call-id', {\n * pattern: 'TODO',\n * glob: '*.ts',\n * outputMode: 'files',\n * });\n *\n * // Search with context\n * searchTool.execute('call-id', {\n * pattern: 'function\\\\s+\\\\w+',\n * context: 3,\n * ignoreCase: true,\n * });\n * ```\n *\n * ## Performance\n *\n * - Default max results: 500 (configurable up to 1000)\n * - Head limit for sampling large result sets\n * - Truncation indicators when limits are hit\n *\n * @module tools/search\n */\n\nimport { resolve as resolvePath } from \"node:path\";\nimport { Type } from \"@sinclair/typebox\";\nimport {\n\ttype RipgrepMatch,\n\tformatRipgrepCommand,\n\tglobSchema,\n\tisRipgrepPathError,\n\tnormalizeRipgrepPathArgs,\n\tparseRipgrepJson,\n\tpathSchema,\n\trunRipgrep,\n\ttoArray,\n} from \"./ripgrep-utils.js\";\nimport { createTool, expandUserPath } from \"./tool-dsl.js\";\n\nconst searchSchema = Type.Object(\n\t{\n\t\tpattern: Type.String({\n\t\t\tdescription: \"Regex pattern (or literal when literal=true)\",\n\t\t\tminLength: 1,\n\t\t}),\n\t\tpaths: pathSchema,\n\t\tglob: globSchema,\n\t\tignoreCase: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Perform case-insensitive search (-i).\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tliteral: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Treat the pattern as a literal string (--fixed-strings).\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tword: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Match only whole words (-w).\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tmultiline: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Enable multiline matching (--multiline).\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tmaxResults: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription: \"Stop after this many matches (-m).\",\n\t\t\t\tminimum: 1,\n\t\t\t\tmaximum: 1000,\n\t\t\t}),\n\t\t),\n\t\tcontext: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription: \"Show this many lines of context before and after (-C).\",\n\t\t\t\tminimum: 0,\n\t\t\t\tmaximum: 20,\n\t\t\t}),\n\t\t),\n\t\tbeforeContext: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription: \"Show this many lines of context before each match (-B).\",\n\t\t\t\tminimum: 0,\n\t\t\t\tmaximum: 20,\n\t\t\t}),\n\t\t),\n\t\tafterContext: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription: \"Show this many lines of context after each match (-A).\",\n\t\t\t\tminimum: 0,\n\t\t\t\tmaximum: 20,\n\t\t\t}),\n\t\t),\n\t\tcwd: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription: \"Working directory to run ripgrep from\",\n\t\t\t\tminLength: 1,\n\t\t\t}),\n\t\t),\n\t\tincludeHidden: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Include hidden files (--hidden)\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tuseGitIgnore: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"Respect .gitignore (set false to pass --no-ignore)\",\n\t\t\t\tdefault: true,\n\t\t\t}),\n\t\t),\n\t\toutputMode: Type.Optional(\n\t\t\tType.Union(\n\t\t\t\t[Type.Literal(\"content\"), Type.Literal(\"files\"), Type.Literal(\"count\")],\n\t\t\t\t{\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Output mode: 'content' shows matching lines (default), 'files' lists only file paths, 'count' shows match counts per file.\",\n\t\t\t\t\tdefault: \"content\",\n\t\t\t\t},\n\t\t\t),\n\t\t),\n\t\tformat: Type.Optional(\n\t\t\tType.Union([Type.Literal(\"text\"), Type.Literal(\"json\")], {\n\t\t\t\tdescription:\n\t\t\t\t\t\"Output format for content mode. JSON not supported with files/count modes.\",\n\t\t\t\tdefault: \"text\",\n\t\t\t}),\n\t\t),\n\t\tinvertMatch: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Show lines that do NOT match the pattern (--invert-match).\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\tonlyMatching: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Only show the matched text, not the entire line (--only-matching). Only works with content mode.\",\n\t\t\t\tdefault: false,\n\t\t\t}),\n\t\t),\n\t\theadLimit: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Limit output to first N lines/entries. Useful for sampling large result sets.\",\n\t\t\t\tminimum: 1,\n\t\t\t\tmaximum: 10000,\n\t\t\t}),\n\t\t),\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Use either context or before/after context options, not both.\",\n\t},\n);\n\nconst JSON_DETAIL_LIMIT = 200;\nconst DEFAULT_MAX_RESULTS = 500;\n\ntype SearchToolDetails = {\n\tcommand: string;\n\tcwd: string;\n\tformat?: \"text\" | \"json\" | \"files\" | \"count\";\n\tmatches?: RipgrepMatch[];\n\tfileCount?: number;\n\tfiles?: string[];\n\ttotalMatches?: number;\n\tcounts?: Array<{ file: string; count: number }>;\n\ttruncated?: boolean;\n};\n\nexport const searchTool = createTool<typeof searchSchema, SearchToolDetails>({\n\tname: \"search\",\n\tlabel: \"search\",\n\tdescription: `Find text across files using ripgrep with optional globbing and context controls.\n\nOutput modes (outputMode parameter):\n- \"content\": Show matching lines with file:line:content format (default)\n- \"files\": List only file paths containing matches (fast for finding files)\n- \"count\": Show match counts per file (useful for gauging scope)\n\nModifiers:\n- invertMatch: Show lines that do NOT match\n- onlyMatching: Show only the matched text (content mode only)\n- headLimit: Limit output to first N entries (useful for sampling)\n\nExamples:\n {pattern: \"TODO\", outputMode: \"files\"} → list files containing TODO\n {pattern: \"function\", outputMode: \"count\"} → count functions per file\n {pattern: \"^#\", invertMatch: true} → lines not starting with #`,\n\tschema: searchSchema,\n\tasync run(params, { signal, respond }) {\n\t\tconst {\n\t\t\tpattern,\n\t\t\tpaths,\n\t\t\tglob,\n\t\t\tignoreCase,\n\t\t\tliteral,\n\t\t\tword,\n\t\t\tmultiline,\n\t\t\tmaxResults,\n\t\t\tcontext,\n\t\t\tbeforeContext,\n\t\t\tafterContext,\n\t\t\tcwd,\n\t\t\tincludeHidden,\n\t\t\tuseGitIgnore = true,\n\t\t\toutputMode = \"content\",\n\t\t\tformat = \"text\",\n\t\t\tinvertMatch = false,\n\t\t\tonlyMatching = false,\n\t\t\theadLimit,\n\t\t} = params;\n\n\t\tif (\n\t\t\tcontext !== undefined &&\n\t\t\t(beforeContext !== undefined || afterContext !== undefined)\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Use either context or before/after context options, not both.\",\n\t\t\t);\n\t\t}\n\n\t\t// Validate options incompatible with files/count modes\n\t\tif (outputMode !== \"content\" && onlyMatching) {\n\t\t\tthrow new Error(\n\t\t\t\t\"onlyMatching can only be used with outputMode: 'content'.\",\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\toutputMode !== \"content\" &&\n\t\t\t(context !== undefined ||\n\t\t\t\tbeforeContext !== undefined ||\n\t\t\t\tafterContext !== undefined)\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Context options can only be used with outputMode: 'content'.\",\n\t\t\t);\n\t\t}\n\n\t\tif (format === \"json\" && outputMode !== \"content\") {\n\t\t\tthrow new Error(\n\t\t\t\t\"JSON format is not supported with outputMode: 'files' or 'count'. Use format: 'text' or omit the format parameter.\",\n\t\t\t);\n\t\t}\n\n\t\tconst pathArgs = normalizeRipgrepPathArgs(toArray(paths));\n\t\tconst globArgs = toArray(glob);\n\t\tconst commandCwd = cwd ? resolvePath(expandUserPath(cwd)) : process.cwd();\n\n\t\tconst args: string[] = [\"--color=never\"];\n\n\t\t// Output mode flags\n\t\tif (outputMode === \"files\") {\n\t\t\targs.push(\"--files-with-matches\");\n\t\t} else if (outputMode === \"count\") {\n\t\t\t// Use --count-matches for actual match counts, -H to always show filename\n\t\t\targs.push(\"--count-matches\", \"-H\");\n\t\t} else {\n\t\t\t// content mode: show line numbers and filenames\n\t\t\targs.push(\"-n\", \"--with-filename\");\n\t\t}\n\n\t\tif (ignoreCase) {\n\t\t\targs.push(\"-i\");\n\t\t}\n\n\t\tif (literal) {\n\t\t\targs.push(\"--fixed-strings\");\n\t\t}\n\n\t\tif (word) {\n\t\t\targs.push(\"-w\");\n\t\t}\n\n\t\tif (multiline) {\n\t\t\targs.push(\"--multiline\");\n\t\t}\n\n\t\tif (includeHidden) {\n\t\t\targs.push(\"--hidden\");\n\t\t}\n\n\t\tif (!useGitIgnore) {\n\t\t\targs.push(\"--no-ignore\");\n\t\t}\n\n\t\tif (invertMatch) {\n\t\t\targs.push(\"--invert-match\");\n\t\t}\n\n\t\tif (onlyMatching) {\n\t\t\targs.push(\"--only-matching\");\n\t\t}\n\n\t\tconst shouldApplyMaxResults =\n\t\t\toutputMode === \"content\" || maxResults !== undefined;\n\t\tif (shouldApplyMaxResults) {\n\t\t\tconst effectiveMaxResults = maxResults ?? DEFAULT_MAX_RESULTS;\n\t\t\targs.push(\"-m\", String(effectiveMaxResults));\n\t\t}\n\n\t\tif (context !== undefined) {\n\t\t\targs.push(`-C${context}`);\n\t\t}\n\n\t\tif (beforeContext !== undefined) {\n\t\t\targs.push(`-B${beforeContext}`);\n\t\t}\n\n\t\tif (afterContext !== undefined) {\n\t\t\targs.push(`-A${afterContext}`);\n\t\t}\n\n\t\tfor (const globPattern of globArgs) {\n\t\t\targs.push(\"--glob\", globPattern);\n\t\t}\n\n\t\tif (format === \"json\" && outputMode === \"content\") {\n\t\t\targs.push(\"--json\");\n\t\t}\n\n\t\targs.push(\"--\", pattern);\n\n\t\tif (pathArgs.length > 0) {\n\t\t\targs.push(...pathArgs);\n\t\t} else {\n\t\t\targs.push(\".\");\n\t\t}\n\n\t\tconst command = formatRipgrepCommand(args);\n\t\tlet result: {\n\t\t\tstdout: string;\n\t\t\tstderr: string;\n\t\t\texitCode: number;\n\t\t\ttruncated: boolean;\n\t\t};\n\t\ttry {\n\t\t\tresult = await runRipgrep(args, signal, commandCwd);\n\t\t} catch (error) {\n\t\t\tconst reason =\n\t\t\t\terror instanceof Error\n\t\t\t\t\t? error.message\n\t\t\t\t\t: `Unknown error: ${String(error)}`;\n\t\t\treturn respond\n\t\t\t\t.error(`ripgrep failed\\n\\n${reason}`)\n\t\t\t\t.detail({ command, cwd: commandCwd });\n\t\t}\n\n\t\tif (result.exitCode === 2) {\n\t\t\tconst message = result.stderr.trim() || result.stdout.trim();\n\t\t\tif (isRipgrepPathError(message)) {\n\t\t\t\treturn respond\n\t\t\t\t\t.error(\n\t\t\t\t\t\t`ripgrep failed\\n\\n${message.length > 0 ? message : \"ripgrep path lookup failed\"}`,\n\t\t\t\t\t)\n\t\t\t\t\t.detail({ command, cwd: commandCwd });\n\t\t\t}\n\t\t\tthrow new Error(\n\t\t\t\tmessage.length > 0 ? message : \"ripgrep exited with an error\",\n\t\t\t);\n\t\t}\n\n\t\tif (result.exitCode === 1 || result.stdout.trim().length === 0) {\n\t\t\t// Use correct format in detail based on mode\n\t\t\tconst detailFormat =\n\t\t\t\toutputMode === \"files\"\n\t\t\t\t\t? \"files\"\n\t\t\t\t\t: outputMode === \"count\"\n\t\t\t\t\t\t? \"count\"\n\t\t\t\t\t\t: format;\n\t\t\treturn respond\n\t\t\t\t.text(\"No matches found.\")\n\t\t\t\t.detail({ command, cwd: commandCwd, format: detailFormat });\n\t\t}\n\n\t\tconst truncatedByBytes = result.truncated ?? false;\n\n\t\t// Handle files mode output\n\t\tif (outputMode === \"files\") {\n\t\t\tconst allFiles = result.stdout\n\t\t\t\t.trim()\n\t\t\t\t.split(\"\\n\")\n\t\t\t\t.filter((f) => f.length > 0);\n\t\t\tconst files =\n\t\t\t\theadLimit !== undefined ? allFiles.slice(0, headLimit) : allFiles;\n\t\t\tconst truncated = headLimit !== undefined && allFiles.length > headLimit;\n\t\t\tconst fileList = files.join(\"\\n\");\n\t\t\tconst truncatedNote = truncated\n\t\t\t\t? `\\n\\n... (showing ${files.length} of ${allFiles.length} files)`\n\t\t\t\t: truncatedByBytes\n\t\t\t\t\t? \"\\n\\n... (output truncated due to size limit)\"\n\t\t\t\t\t: \"\";\n\t\t\treturn respond\n\t\t\t\t.text(\n\t\t\t\t\t`Found ${allFiles.length} file(s) matching \"${pattern}\":\\n\\n${fileList}${truncatedNote}`,\n\t\t\t\t)\n\t\t\t\t.detail({\n\t\t\t\t\tcommand,\n\t\t\t\t\tcwd: commandCwd,\n\t\t\t\t\tformat: \"files\",\n\t\t\t\t\tfileCount: allFiles.length,\n\t\t\t\t\tfiles,\n\t\t\t\t\ttruncated: truncated || truncatedByBytes,\n\t\t\t\t});\n\t\t}\n\n\t\t// Handle count mode output\n\t\tif (outputMode === \"count\") {\n\t\t\tconst lines = result.stdout\n\t\t\t\t.trim()\n\t\t\t\t.split(\"\\n\")\n\t\t\t\t.filter((l) => l.length > 0);\n\t\t\tconst allCounts: Array<{ file: string; count: number }> = [];\n\t\t\tlet totalMatches = 0;\n\t\t\t// Use regex to parse \"filename:count\" format robustly\n\t\t\t// This handles Windows paths (C:\\path\\file.txt:5) and colons in filenames\n\t\t\tconst countLineRegex = /^(.+):(\\d+)$/;\n\t\t\tfor (const line of lines) {\n\t\t\t\tconst match = line.match(countLineRegex);\n\t\t\t\tif (match) {\n\t\t\t\t\tconst file = match[1]!;\n\t\t\t\t\tconst matchCount = Number.parseInt(match[2]!, 10);\n\t\t\t\t\tallCounts.push({ file, count: matchCount });\n\t\t\t\t\ttotalMatches += matchCount;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst counts =\n\t\t\t\theadLimit !== undefined ? allCounts.slice(0, headLimit) : allCounts;\n\t\t\tconst truncated = headLimit !== undefined && allCounts.length > headLimit;\n\t\t\tconst summary = counts.map((c) => `${c.file}: ${c.count}`).join(\"\\n\");\n\t\t\tconst truncatedNote = truncated\n\t\t\t\t? `\\n\\n... (showing ${counts.length} of ${allCounts.length} files)`\n\t\t\t\t: truncatedByBytes\n\t\t\t\t\t? \"\\n\\n... (output truncated due to size limit)\"\n\t\t\t\t\t: \"\";\n\t\t\treturn respond\n\t\t\t\t.text(\n\t\t\t\t\t`Found ${totalMatches} match(es) across ${allCounts.length} file(s):\\n\\n${summary}${truncatedNote}`,\n\t\t\t\t)\n\t\t\t\t.detail({\n\t\t\t\t\tcommand,\n\t\t\t\t\tcwd: commandCwd,\n\t\t\t\t\tformat: \"count\",\n\t\t\t\t\ttotalMatches,\n\t\t\t\t\tfileCount: allCounts.length,\n\t\t\t\t\tcounts,\n\t\t\t\t\ttruncated: truncated || truncatedByBytes,\n\t\t\t\t});\n\t\t}\n\n\t\t// Handle JSON format\n\t\tif (format === \"json\") {\n\t\t\tconst allMatches = parseRipgrepJson(result.stdout);\n\t\t\tconst matches =\n\t\t\t\theadLimit !== undefined ? allMatches.slice(0, headLimit) : allMatches;\n\t\t\tconst headLimitTruncated =\n\t\t\t\theadLimit !== undefined && allMatches.length > headLimit;\n\t\t\tconst detailLimitTruncated = matches.length > JSON_DETAIL_LIMIT;\n\t\t\tconst truncated =\n\t\t\t\theadLimitTruncated || detailLimitTruncated || truncatedByBytes;\n\t\t\tconst preview = matches\n\t\t\t\t.slice(0, 5)\n\t\t\t\t.map(\n\t\t\t\t\t(match) =>\n\t\t\t\t\t\t`${match.file}:${match.line}:${match.column} ${match.match.trim()}`,\n\t\t\t\t)\n\t\t\t\t.join(\"\\n\");\n\t\t\tconst suffix =\n\t\t\t\tmatches.length > 5 ? `\\n... (${matches.length - 5} more matches)` : \"\";\n\t\t\tconst truncatedNote = headLimitTruncated\n\t\t\t\t? `\\n(showing ${matches.length} of ${allMatches.length} total matches)`\n\t\t\t\t: \"\";\n\t\t\tconst text = matches.length\n\t\t\t\t? `Found ${allMatches.length} match(es).${truncatedNote}\\n\\n${preview}${suffix}`\n\t\t\t\t: \"No matches found.\";\n\t\t\treturn respond.text(text).detail({\n\t\t\t\tcommand,\n\t\t\t\tcwd: commandCwd,\n\t\t\t\tformat,\n\t\t\t\tmatches: matches.slice(0, JSON_DETAIL_LIMIT),\n\t\t\t\ttruncated,\n\t\t\t});\n\t\t}\n\n\t\t// Handle text format (content mode)\n\t\tconst lines = result.stdout.trimEnd().split(\"\\n\");\n\t\tconst outputLines =\n\t\t\theadLimit !== undefined ? lines.slice(0, headLimit) : lines;\n\t\tconst truncated = headLimit !== undefined && lines.length > headLimit;\n\t\tconst truncatedNote = truncated\n\t\t\t? `\\n\\n... (showing ${outputLines.length} of ${lines.length} lines)`\n\t\t\t: truncatedByBytes\n\t\t\t\t? \"\\n\\n... (output truncated due to size limit)\"\n\t\t\t\t: \"\";\n\t\treturn respond.text(outputLines.join(\"\\n\") + truncatedNote).detail({\n\t\t\tcommand,\n\t\t\tcwd: commandCwd,\n\t\t\tformat,\n\t\t\ttruncated: truncated || truncatedByBytes,\n\t\t});\n\t},\n});\n"]}
|
package/dist/version.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.10.
|
|
3
|
-
"notes": "Maestro by EvalOps - Deterministic coding agent with TUI/CLI and Web UI for AI-assisted development v0.10.
|
|
2
|
+
"version": "0.10.44",
|
|
3
|
+
"notes": "Maestro by EvalOps - Deterministic coding agent with TUI/CLI and Web UI for AI-assisted development v0.10.44 is now available."
|
|
4
4
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evalops/maestro",
|
|
3
3
|
"description": "Maestro by EvalOps - Deterministic coding agent with TUI/CLI and Web UI for AI-assisted development",
|
|
4
|
-
"version": "0.10.
|
|
4
|
+
"version": "0.10.44",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"workspaces": [
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"bun:lint": "bunx biome check . && bun run lint:evals",
|
|
99
99
|
"bun:test": "node ./scripts/run-vitest.js --run",
|
|
100
100
|
"bun:test:fast": "VITEST_FAST=1 node ./scripts/run-vitest.js --run",
|
|
101
|
-
"bun:check": "bun run bun:lint && bunx tsc --noEmit",
|
|
101
|
+
"bun:check": "bun run bun:lint && bunx tsc -p tsconfig.build.json --noEmit",
|
|
102
102
|
"bun:compile": "npm run build && bun build ./dist/cli.js --compile --external tree-sitter --external tree-sitter-bash --outfile dist/maestro-bun",
|
|
103
103
|
"bun:compile:bytecode": "npm run build && bun build ./dist/cli.js --compile --bytecode --external tree-sitter --external tree-sitter-bash --outfile dist/maestro-bun-bytecode",
|
|
104
104
|
"bun:evals": "bun run build && bun run ./scripts/run-evals.js",
|