feat(tools): use installed ripgrep for native file search (#5948)
* feat(tools): expose installed ripgrep through exec * refactor(tools): launch ripgrep with native argument vectors * refactor(tools): reuse the fresh exec parameter schema * fix(tools): select search backend in loader and display rg arguments * fix(ui): simplify rg previews and localize search completion * docs: simplify ripgrep configuration note * docs: keep ripgrep note on one line
This commit is contained in:
1 parent
b8893aba56
commit
e0b8efa0be
33 files changed
+514
-204
No files matched your search
@@ -8,6 +8,7 @@ export type ToolFamily = "content-search" | "file-search" | "list" | "read" | "m
|
||||
interface ToolField {
|
||||
key:
|
||||
| "query"
|
||||
| "args"
|
||||
| "pattern"
|
||||
| "glob"
|
||||
| "path"
|
||||
@@ -88,6 +89,14 @@ export function parseGenericToolTrace(line: string): GenericToolTrace | null {
|
||||
if (!call || isExcludedTool(call.name)) return null;
|
||||
const family = toolFamily(call.name);
|
||||
const fields = safeFields(call.args);
|
||||
if (call.name === "rg" && call.args && typeof call.args === "object") {
|
||||
const argv = (call.args as Record<string, unknown>).args;
|
||||
if (Array.isArray(argv) && argv.every((arg) => typeof arg === "string")) {
|
||||
fields.push({ key: "args", value: argv.map((arg) =>
|
||||
arg && !/[\s"']/u.test(arg) ? arg : JSON.stringify(arg),
|
||||
).join(" ") });
|
||||
}
|
||||
}
|
||||
const collectedSource = fields.some((field) => isCollectedSourcePath(field.value));
|
||||
return {
|
||||
name: call.name,
|
||||
@@ -283,6 +292,7 @@ function activityLabel(
|
||||
function activityDetail(items: GenericToolRunItem[], family: ToolFamily, name: string): string {
|
||||
if (items.length !== 1) return "";
|
||||
const trace = items[0].trace;
|
||||
if (name === "rg") return safeText(fieldValue(trace, "args"));
|
||||
if (family === "content-search") {
|
||||
return quote(fieldValue(trace, "query") || fieldValue(trace, "pattern"));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user