@aria-cli/tools 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.aria-build-stamp.json +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/definitions/code-intelligence.d.ts +9 -0
- package/dist/definitions/code-intelligence.d.ts.map +1 -0
- package/dist/definitions/code-intelligence.js +471 -0
- package/dist/definitions/code-intelligence.js.map +1 -0
- package/dist/definitions/core.d.ts +3 -0
- package/dist/definitions/core.d.ts.map +1 -1
- package/dist/definitions/core.js +13 -1
- package/dist/definitions/core.js.map +1 -1
- package/dist/definitions/filesystem.d.ts +3 -2
- package/dist/definitions/filesystem.d.ts.map +1 -1
- package/dist/definitions/filesystem.js +4 -38
- package/dist/definitions/filesystem.js.map +1 -1
- package/dist/definitions/frg.d.ts +4 -0
- package/dist/definitions/frg.d.ts.map +1 -0
- package/dist/definitions/frg.js +64 -0
- package/dist/definitions/frg.js.map +1 -0
- package/dist/definitions/index.d.ts +3 -0
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/index.js +3 -0
- package/dist/definitions/index.js.map +1 -1
- package/dist/definitions/search.d.ts +10 -0
- package/dist/definitions/search.d.ts.map +1 -0
- package/dist/definitions/search.js +61 -0
- package/dist/definitions/search.js.map +1 -0
- package/dist/executors/apply-patch.d.ts.map +1 -1
- package/dist/executors/apply-patch.js +18 -0
- package/dist/executors/apply-patch.js.map +1 -1
- package/dist/executors/code-intelligence.d.ts +139 -0
- package/dist/executors/code-intelligence.d.ts.map +1 -0
- package/dist/executors/code-intelligence.js +883 -0
- package/dist/executors/code-intelligence.js.map +1 -0
- package/dist/executors/filesystem.d.ts.map +1 -1
- package/dist/executors/filesystem.js +14 -8
- package/dist/executors/filesystem.js.map +1 -1
- package/dist/executors/frg-freshness.d.ts +94 -0
- package/dist/executors/frg-freshness.d.ts.map +1 -0
- package/dist/executors/frg-freshness.js +577 -0
- package/dist/executors/frg-freshness.js.map +1 -0
- package/dist/executors/frg.d.ts +28 -0
- package/dist/executors/frg.d.ts.map +1 -0
- package/dist/executors/frg.js +299 -0
- package/dist/executors/frg.js.map +1 -0
- package/dist/executors/index.d.ts +6 -0
- package/dist/executors/index.d.ts.map +1 -1
- package/dist/executors/index.js +5 -0
- package/dist/executors/index.js.map +1 -1
- package/dist/executors/lsp-client.d.ts +39 -0
- package/dist/executors/lsp-client.d.ts.map +1 -0
- package/dist/executors/lsp-client.js +297 -0
- package/dist/executors/lsp-client.js.map +1 -0
- package/dist/executors/restart.d.ts +4 -9
- package/dist/executors/restart.d.ts.map +1 -1
- package/dist/executors/restart.js +20 -51
- package/dist/executors/restart.js.map +1 -1
- package/dist/executors/search-freshness.d.ts +51 -0
- package/dist/executors/search-freshness.d.ts.map +1 -0
- package/dist/executors/search-freshness.js +196 -0
- package/dist/executors/search-freshness.js.map +1 -0
- package/dist/executors/search.d.ts +12 -0
- package/dist/executors/search.d.ts.map +1 -0
- package/dist/executors/search.js +67 -0
- package/dist/executors/search.js.map +1 -0
- package/dist/headless-control-contract.d.ts +4 -0
- package/dist/headless-control-contract.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/network-runtime/local-control-contract.d.ts +2 -0
- package/dist/network-runtime/local-control-contract.d.ts.map +1 -1
- package/dist/network-runtime/local-control-contract.js +2 -0
- package/dist/network-runtime/local-control-contract.js.map +1 -1
- package/dist-cjs/.tsbuildinfo +1 -1
- package/dist-cjs/definitions/code-intelligence.d.ts +8 -0
- package/dist-cjs/definitions/code-intelligence.js +474 -0
- package/dist-cjs/definitions/code-intelligence.js.map +1 -0
- package/dist-cjs/definitions/core.d.ts +3 -0
- package/dist-cjs/definitions/core.js +17 -2
- package/dist-cjs/definitions/core.js.map +1 -1
- package/dist-cjs/definitions/filesystem.d.ts +3 -2
- package/dist-cjs/definitions/filesystem.js +3 -37
- package/dist-cjs/definitions/filesystem.js.map +1 -1
- package/dist-cjs/definitions/frg.d.ts +3 -0
- package/dist-cjs/definitions/frg.js +67 -0
- package/dist-cjs/definitions/frg.js.map +1 -0
- package/dist-cjs/definitions/index.d.ts +3 -0
- package/dist-cjs/definitions/index.js +7 -1
- package/dist-cjs/definitions/index.js.map +1 -1
- package/dist-cjs/definitions/search.d.ts +9 -0
- package/dist-cjs/definitions/search.js +64 -0
- package/dist-cjs/definitions/search.js.map +1 -0
- package/dist-cjs/executors/apply-patch.js +18 -0
- package/dist-cjs/executors/apply-patch.js.map +1 -1
- package/dist-cjs/executors/code-intelligence.d.ts +138 -0
- package/dist-cjs/executors/code-intelligence.js +926 -0
- package/dist-cjs/executors/code-intelligence.js.map +1 -0
- package/dist-cjs/executors/filesystem.js +17 -8
- package/dist-cjs/executors/filesystem.js.map +1 -1
- package/dist-cjs/executors/frg-freshness.d.ts +93 -0
- package/dist-cjs/executors/frg-freshness.js +628 -0
- package/dist-cjs/executors/frg-freshness.js.map +1 -0
- package/dist-cjs/executors/frg.d.ts +27 -0
- package/dist-cjs/executors/frg.js +335 -0
- package/dist-cjs/executors/frg.js.map +1 -0
- package/dist-cjs/executors/index.d.ts +6 -0
- package/dist-cjs/executors/index.js +34 -2
- package/dist-cjs/executors/index.js.map +1 -1
- package/dist-cjs/executors/lsp-client.d.ts +38 -0
- package/dist-cjs/executors/lsp-client.js +311 -0
- package/dist-cjs/executors/lsp-client.js.map +1 -0
- package/dist-cjs/executors/restart.d.ts +4 -9
- package/dist-cjs/executors/restart.js +19 -50
- package/dist-cjs/executors/restart.js.map +1 -1
- package/dist-cjs/executors/search-freshness.d.ts +50 -0
- package/dist-cjs/executors/search-freshness.js +235 -0
- package/dist-cjs/executors/search-freshness.js.map +1 -0
- package/dist-cjs/executors/search.d.ts +11 -0
- package/dist-cjs/executors/search.js +103 -0
- package/dist-cjs/executors/search.js.map +1 -0
- package/dist-cjs/headless-control-contract.d.ts +15 -11
- package/dist-cjs/index.d.ts +2 -2
- package/dist-cjs/index.js +22 -2
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/network-runtime/local-control-contract.d.ts +2 -0
- package/dist-cjs/network-runtime/local-control-contract.js +2 -0
- package/dist-cjs/network-runtime/local-control-contract.js.map +1 -1
- package/package.json +22 -18
- package/src/definitions/code-intelligence.ts +526 -0
- package/src/definitions/core.ts +13 -1
- package/src/definitions/filesystem.ts +3 -39
- package/src/definitions/frg.ts +67 -0
- package/src/definitions/index.ts +3 -0
- package/src/definitions/search.ts +67 -0
- package/src/executors/apply-patch.ts +20 -0
- package/src/executors/code-intelligence.ts +1179 -0
- package/src/executors/filesystem.ts +15 -8
- package/src/executors/frg-freshness.ts +743 -0
- package/src/executors/frg.ts +394 -0
- package/src/executors/index.ts +58 -0
- package/src/executors/lsp-client.ts +355 -0
- package/src/executors/restart.ts +21 -56
- package/src/executors/search-freshness.ts +249 -0
- package/src/executors/search.ts +89 -0
- package/src/index.ts +25 -0
- package/src/network-runtime/local-control-contract.ts +2 -0
- package/tests/definitions/tool-inventory.test.ts +17 -6
- package/tests/executors/frg-freshness.test.ts +136 -0
- package/tests/executors/frg-merge.test.ts +70 -0
- package/tests/executors/frg-session-content.test.ts +40 -0
- package/tests/executors/frg.test.ts +56 -0
- package/tests/integration/headless-control-contract.integration.test.ts +2 -0
- package/tests/loading-tier.test.ts +6 -6
- package/tests/test-lane-manifest.ts +4 -0
- package/tsconfig.cjs.json +9 -1
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { Tool } from "../types.js";
|
|
3
|
+
import { tool } from "../tool-factory.js";
|
|
4
|
+
import { executeFrg } from "../executors/frg.js";
|
|
5
|
+
|
|
6
|
+
export const frgTool = tool({
|
|
7
|
+
name: "frg",
|
|
8
|
+
description:
|
|
9
|
+
"Native fastripgrep tool via napi-rs. Wraps the original frg commands in one tool: init, index, search, update, status, replace, man, completions, watch, and upgrade-safe metadata.",
|
|
10
|
+
category: "code",
|
|
11
|
+
riskLevel: "safe",
|
|
12
|
+
isReadOnly: false,
|
|
13
|
+
loadingTier: "always",
|
|
14
|
+
parameters: z.object({
|
|
15
|
+
command: z
|
|
16
|
+
.enum([
|
|
17
|
+
"init",
|
|
18
|
+
"index",
|
|
19
|
+
"search",
|
|
20
|
+
"update",
|
|
21
|
+
"status",
|
|
22
|
+
"replace",
|
|
23
|
+
"man",
|
|
24
|
+
"completions",
|
|
25
|
+
"watch",
|
|
26
|
+
"upgrade",
|
|
27
|
+
])
|
|
28
|
+
.describe("Original frg command to run"),
|
|
29
|
+
pattern: z.string().optional().describe("Regex pattern for search/replace"),
|
|
30
|
+
replacement: z.string().optional().describe("Replacement string for replace"),
|
|
31
|
+
path: z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe("Repository or directory to operate on (defaults to current working directory)"),
|
|
35
|
+
noIndex: z.boolean().optional().describe("Skip the index and do a brute-force scan for search"),
|
|
36
|
+
literal: z.boolean().optional().describe("Treat pattern as a fixed string"),
|
|
37
|
+
caseInsensitive: z.boolean().optional().describe("Enable case-insensitive matching"),
|
|
38
|
+
smartCase: z.boolean().optional().describe("Use smart-case matching"),
|
|
39
|
+
filesOnly: z.boolean().optional().describe("Return only file paths with matches"),
|
|
40
|
+
count: z.boolean().optional().describe("Return match counts per file"),
|
|
41
|
+
maxCount: z.number().optional().describe("Maximum matches per file"),
|
|
42
|
+
quiet: z.boolean().optional().describe("Only report whether a match exists"),
|
|
43
|
+
context: z.number().optional().describe("Context lines for search matches"),
|
|
44
|
+
json: z.boolean().optional().describe("Compatibility flag matching upstream JSON mode"),
|
|
45
|
+
glob: z.string().optional().describe("Glob filter for candidate files"),
|
|
46
|
+
fileType: z.string().optional().describe("File extension/type filter"),
|
|
47
|
+
follow: z.boolean().optional().describe("Follow symbolic links"),
|
|
48
|
+
extraPatterns: z
|
|
49
|
+
.array(z.string())
|
|
50
|
+
.optional()
|
|
51
|
+
.describe("Additional regex patterns combined with OR"),
|
|
52
|
+
maxFilesize: z
|
|
53
|
+
.number()
|
|
54
|
+
.optional()
|
|
55
|
+
.describe("Maximum file size in bytes while indexing/updating/init"),
|
|
56
|
+
force: z.boolean().optional().describe("Compatibility flag for forced rebuilds"),
|
|
57
|
+
write: z.boolean().optional().describe("Actually apply replace changes instead of previewing"),
|
|
58
|
+
hook: z.boolean().optional().describe("Install a post-commit git hook when using init"),
|
|
59
|
+
shell: z
|
|
60
|
+
.enum(["bash", "elvish", "fish", "powershell", "zsh"])
|
|
61
|
+
.optional()
|
|
62
|
+
.describe("Shell target when using completions"),
|
|
63
|
+
}),
|
|
64
|
+
execute: executeFrg,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const FRG_TOOL_DEFINITIONS: Tool[] = [frgTool];
|
package/src/definitions/index.ts
CHANGED
|
@@ -23,3 +23,6 @@ export { QUIP_TOOL_DEFINITIONS } from "./quip.js";
|
|
|
23
23
|
export { NETWORK_TOOL_DEFINITIONS } from "./network.js";
|
|
24
24
|
export { META_TOOL_DEFINITIONS } from "./meta.js";
|
|
25
25
|
export { SESSION_HISTORY_TOOL_DEFINITIONS } from "./session-history.js";
|
|
26
|
+
export { FRG_TOOL_DEFINITIONS } from "./frg.js";
|
|
27
|
+
export { CODE_INTELLIGENCE_TOOL_DEFINITIONS } from "./code-intelligence.js";
|
|
28
|
+
export { SEARCH_TOOL_DEFINITIONS } from "./search.js";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native indexed regex search tool definition.
|
|
3
|
+
*
|
|
4
|
+
* Uses @aria-cli/search (Rust napi-rs addon) for sub-millisecond indexed search.
|
|
5
|
+
* Registered alongside (not replacing) the existing grep tool.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { JSONSchema7 } from "json-schema";
|
|
9
|
+
import type { Tool } from "../types.js";
|
|
10
|
+
import { executeSearch } from "../executors/search.js";
|
|
11
|
+
|
|
12
|
+
export const searchTool: Tool = {
|
|
13
|
+
name: "grep",
|
|
14
|
+
description:
|
|
15
|
+
"Search for patterns in files using regular expressions. Indexed for sub-millisecond speed. Builds index automatically on first use. Supports regex, literal strings, file type filters, and glob patterns.",
|
|
16
|
+
category: "filesystem",
|
|
17
|
+
parameters: {
|
|
18
|
+
type: "object",
|
|
19
|
+
properties: {
|
|
20
|
+
pattern: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "Regex pattern to search for. Use literal: true for exact string matching.",
|
|
23
|
+
},
|
|
24
|
+
directory: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "Directory to search in (default: current working directory)",
|
|
27
|
+
default: ".",
|
|
28
|
+
},
|
|
29
|
+
fileGlob: {
|
|
30
|
+
type: "string",
|
|
31
|
+
description: "Glob pattern to filter files (e.g. '*.ts', 'src/**/*.rs')",
|
|
32
|
+
},
|
|
33
|
+
fileType: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description:
|
|
36
|
+
"File extension filter (e.g. 'ts', 'rs', 'py'). Simpler than glob for single types.",
|
|
37
|
+
},
|
|
38
|
+
caseSensitive: {
|
|
39
|
+
type: "boolean",
|
|
40
|
+
description: "Case-sensitive matching (default: true)",
|
|
41
|
+
default: true,
|
|
42
|
+
},
|
|
43
|
+
literal: {
|
|
44
|
+
type: "boolean",
|
|
45
|
+
description: "Treat pattern as a literal string, not regex (default: false)",
|
|
46
|
+
default: false,
|
|
47
|
+
},
|
|
48
|
+
maxResults: {
|
|
49
|
+
type: "number",
|
|
50
|
+
description: "Maximum number of matches to return (default: 1000)",
|
|
51
|
+
default: 1000,
|
|
52
|
+
},
|
|
53
|
+
context: {
|
|
54
|
+
type: "number",
|
|
55
|
+
description: "Number of context lines before and after each match (default: 0)",
|
|
56
|
+
default: 0,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
required: ["pattern"],
|
|
60
|
+
} as JSONSchema7,
|
|
61
|
+
riskLevel: "safe",
|
|
62
|
+
isReadOnly: true,
|
|
63
|
+
loadingTier: "always",
|
|
64
|
+
execute: executeSearch,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const SEARCH_TOOL_DEFINITIONS: Tool[] = [searchTool];
|
|
@@ -14,6 +14,8 @@ import * as fsSync from "node:fs";
|
|
|
14
14
|
import * as nodePath from "node:path";
|
|
15
15
|
import type { ToolContext, ToolResult } from "../types.js";
|
|
16
16
|
import { success, fail, getErrorMessage, isPathWithinBase } from "./utils.js";
|
|
17
|
+
import { recordFrgMutation } from "./frg-freshness.js";
|
|
18
|
+
import { recordSearchMutation } from "./search-freshness.js";
|
|
17
19
|
|
|
18
20
|
// ============================================================================
|
|
19
21
|
// Types
|
|
@@ -897,6 +899,24 @@ async function applyPatchAtomic(
|
|
|
897
899
|
`Patch applied: ${filesChanged} file${filesChanged !== 1 ? "s" : ""} ` +
|
|
898
900
|
`(${parts.join(", ")}), +${totalAdded}/-${totalRemoved} lines`;
|
|
899
901
|
|
|
902
|
+
for (const action of actions) {
|
|
903
|
+
if (action.type === "delete") {
|
|
904
|
+
recordFrgMutation(action.resolvedPath, "delete");
|
|
905
|
+
recordSearchMutation(action.resolvedPath, "delete");
|
|
906
|
+
} else {
|
|
907
|
+
recordFrgMutation(action.resolvedPath, "write", action.content);
|
|
908
|
+
recordSearchMutation(action.resolvedPath, "write", action.content);
|
|
909
|
+
if (
|
|
910
|
+
action.type === "move" &&
|
|
911
|
+
action.sourcePath &&
|
|
912
|
+
action.sourcePath !== action.resolvedPath
|
|
913
|
+
) {
|
|
914
|
+
recordFrgMutation(action.sourcePath, "delete");
|
|
915
|
+
recordSearchMutation(action.sourcePath, "delete");
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
|
|
900
920
|
return success(summary, {
|
|
901
921
|
filesChanged,
|
|
902
922
|
created,
|