iosm-cli 0.2.7 → 0.2.9
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/CHANGELOG.md +61 -1
- package/README.md +4 -4
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +12 -4
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-profiles.d.ts.map +1 -1
- package/dist/core/agent-profiles.js +15 -2
- package/dist/core/agent-profiles.js.map +1 -1
- package/dist/core/agent-session.d.ts +3 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +214 -2
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/sdk.d.ts +2 -2
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +7 -4
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +57 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +197 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/shadow-guard.d.ts.map +1 -1
- package/dist/core/shadow-guard.js +12 -1
- package/dist/core/shadow-guard.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +109 -4
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/db-run.d.ts +84 -0
- package/dist/core/tools/db-run.d.ts.map +1 -0
- package/dist/core/tools/db-run.js +690 -0
- package/dist/core/tools/db-run.js.map +1 -0
- package/dist/core/tools/git-common.d.ts +45 -0
- package/dist/core/tools/git-common.d.ts.map +1 -0
- package/dist/core/tools/git-common.js +185 -0
- package/dist/core/tools/git-common.js.map +1 -0
- package/dist/core/tools/git-read.d.ts +15 -13
- package/dist/core/tools/git-read.d.ts.map +1 -1
- package/dist/core/tools/git-read.js +101 -153
- package/dist/core/tools/git-read.js.map +1 -1
- package/dist/core/tools/git-write.d.ts +75 -0
- package/dist/core/tools/git-write.d.ts.map +1 -0
- package/dist/core/tools/git-write.js +298 -0
- package/dist/core/tools/git-write.js.map +1 -0
- package/dist/core/tools/index.d.ts +91 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +26 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/lint-run.d.ts +42 -0
- package/dist/core/tools/lint-run.d.ts.map +1 -0
- package/dist/core/tools/lint-run.js +276 -0
- package/dist/core/tools/lint-run.js.map +1 -0
- package/dist/core/tools/task.js +1 -1
- package/dist/core/tools/task.js.map +1 -1
- package/dist/core/tools/test-run.d.ts +36 -0
- package/dist/core/tools/test-run.d.ts.map +1 -0
- package/dist/core/tools/test-run.js +255 -0
- package/dist/core/tools/test-run.js.map +1 -0
- package/dist/core/tools/typecheck-run.d.ts +44 -0
- package/dist/core/tools/typecheck-run.d.ts.map +1 -0
- package/dist/core/tools/typecheck-run.js +343 -0
- package/dist/core/tools/typecheck-run.js.map +1 -0
- package/dist/core/tools/verification-runner.d.ts +53 -0
- package/dist/core/tools/verification-runner.d.ts.map +1 -0
- package/dist/core/tools/verification-runner.js +235 -0
- package/dist/core/tools/verification-runner.js.map +1 -0
- package/dist/core/tools/web-search.d.ts +72 -0
- package/dist/core/tools/web-search.d.ts.map +1 -0
- package/dist/core/tools/web-search.js +702 -0
- package/dist/core/tools/web-search.js.map +1 -0
- 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/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +2 -1
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +2 -1
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +7 -2
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +2 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/mcp-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/mcp-selector.js +3 -1
- package/dist/modes/interactive/components/mcp-selector.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +12 -2
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +11 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +16 -5
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +4 -2
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +25 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +182 -2
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +7 -2
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +4 -2
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/subagent-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/subagent-message.js +3 -1
- package/dist/modes/interactive/components/subagent-message.js.map +1 -1
- package/dist/modes/interactive/components/task-plan-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-plan-message.js +2 -1
- package/dist/modes/interactive/components/task-plan-message.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +7 -2
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +7 -2
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +25 -7
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +18 -3
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +8 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +2 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +8 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +622 -11
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +39 -38
- package/dist/modes/interactive/theme/light.json +29 -29
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +16 -25
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/interactive/theme/universal.json +85 -0
- package/docs/cli-reference.md +32 -2
- package/docs/configuration.md +86 -2
- package/docs/development-and-testing.md +1 -1
- package/docs/interactive-mode.md +8 -3
- package/docs/rpc-json-sdk.md +1 -1
- package/package.json +1 -1
package/dist/core/tools/index.js
CHANGED
|
@@ -3,13 +3,17 @@ export { bashTool, createBashTool, } from "./bash.js";
|
|
|
3
3
|
export { combyTool, createCombyTool, } from "./comby.js";
|
|
4
4
|
export { createEditTool, editTool, } from "./edit.js";
|
|
5
5
|
export { createFetchTool, DEFAULT_FETCH_TIMEOUT_SECONDS, DEFAULT_FETCH_MAX_BYTES, DEFAULT_FETCH_MAX_REDIRECTS, getAllowedFetchMethodsForProfile, fetchTool, } from "./fetch.js";
|
|
6
|
+
export { createWebSearchTool, DEFAULT_WEB_SEARCH_MAX_RESULTS, DEFAULT_WEB_SEARCH_TIMEOUT_SECONDS, webSearchTool, } from "./web-search.js";
|
|
6
7
|
export { createExternalCliTool, } from "./external-cli.js";
|
|
7
8
|
export { createFdTool, fdTool, } from "./fd.js";
|
|
8
9
|
export { createFindTool, findTool, } from "./find.js";
|
|
9
10
|
export { createFsOpsTool, fsOpsTool, } from "./fs-ops.js";
|
|
10
11
|
export { createGrepTool, grepTool, } from "./grep.js";
|
|
11
12
|
export { createGitReadTool, gitReadTool, } from "./git-read.js";
|
|
13
|
+
export { createGitWriteTool, gitWriteTool, } from "./git-write.js";
|
|
12
14
|
export { createJqTool, jqTool, } from "./jq.js";
|
|
15
|
+
export { createDbRunTool, dbRunTool, DEFAULT_DB_RUN_TIMEOUT_SECONDS, } from "./db-run.js";
|
|
16
|
+
export { createLintRunTool, lintRunTool, DEFAULT_LINT_RUN_TIMEOUT_SECONDS, } from "./lint-run.js";
|
|
13
17
|
export { createLsTool, lsTool, } from "./ls.js";
|
|
14
18
|
export { createReadTool, readTool, } from "./read.js";
|
|
15
19
|
export { createRgTool, rgTool, } from "./rg.js";
|
|
@@ -21,17 +25,23 @@ export { createWriteTool, writeTool, } from "./write.js";
|
|
|
21
25
|
export { createTodoWriteTool, createTodoReadTool, todoWriteTool, todoReadTool, getTaskFilePath, } from "./todo.js";
|
|
22
26
|
export { createYqTool, yqTool, } from "./yq.js";
|
|
23
27
|
export { createTaskTool, } from "./task.js";
|
|
28
|
+
export { createTestRunTool, testRunTool, DEFAULT_TEST_RUN_TIMEOUT_SECONDS, } from "./test-run.js";
|
|
29
|
+
export { createTypecheckRunTool, typecheckRunTool, DEFAULT_TYPECHECK_RUN_TIMEOUT_SECONDS, } from "./typecheck-run.js";
|
|
24
30
|
import { astGrepTool, createAstGrepTool } from "./ast-grep.js";
|
|
25
31
|
import { bashTool, createBashTool } from "./bash.js";
|
|
26
32
|
import { combyTool, createCombyTool } from "./comby.js";
|
|
27
33
|
import { createEditTool, editTool } from "./edit.js";
|
|
28
34
|
import { createFetchTool, fetchTool, getAllowedFetchMethodsForProfile, } from "./fetch.js";
|
|
35
|
+
import { createWebSearchTool, webSearchTool } from "./web-search.js";
|
|
29
36
|
import { createFdTool, fdTool } from "./fd.js";
|
|
30
37
|
import { createFindTool, findTool } from "./find.js";
|
|
31
38
|
import { createFsOpsTool, fsOpsTool } from "./fs-ops.js";
|
|
32
39
|
import { createGrepTool, grepTool } from "./grep.js";
|
|
33
40
|
import { createGitReadTool, gitReadTool } from "./git-read.js";
|
|
41
|
+
import { createGitWriteTool, gitWriteTool } from "./git-write.js";
|
|
34
42
|
import { createJqTool, jqTool } from "./jq.js";
|
|
43
|
+
import { createDbRunTool, dbRunTool } from "./db-run.js";
|
|
44
|
+
import { createLintRunTool, lintRunTool } from "./lint-run.js";
|
|
35
45
|
import { createLsTool, lsTool } from "./ls.js";
|
|
36
46
|
import { createReadTool, readTool } from "./read.js";
|
|
37
47
|
import { createRgTool, rgTool } from "./rg.js";
|
|
@@ -41,6 +51,8 @@ import { createSemanticSearchTool, semanticSearchTool, } from "./semantic-search
|
|
|
41
51
|
import { createWriteTool, writeTool } from "./write.js";
|
|
42
52
|
import { createYqTool, yqTool } from "./yq.js";
|
|
43
53
|
import { todoWriteTool, todoReadTool } from "./todo.js";
|
|
54
|
+
import { createTestRunTool, testRunTool } from "./test-run.js";
|
|
55
|
+
import { createTypecheckRunTool, typecheckRunTool } from "./typecheck-run.js";
|
|
44
56
|
// Default tools for full access mode (using process.cwd())
|
|
45
57
|
export const codingTools = [readTool, bashTool, editTool, writeTool];
|
|
46
58
|
// Read-only tools for exploration without modification (using process.cwd())
|
|
@@ -61,6 +73,7 @@ export const readOnlyTools = [
|
|
|
61
73
|
createFetchTool(process.cwd(), {
|
|
62
74
|
resolveAllowedMethods: () => getAllowedFetchMethodsForProfile("plan"),
|
|
63
75
|
}),
|
|
76
|
+
webSearchTool,
|
|
64
77
|
gitReadTool,
|
|
65
78
|
];
|
|
66
79
|
// All available tools (using process.cwd())
|
|
@@ -82,8 +95,14 @@ export const allTools = {
|
|
|
82
95
|
sed: sedTool,
|
|
83
96
|
semantic_search: semanticSearchTool,
|
|
84
97
|
fetch: fetchTool,
|
|
98
|
+
web_search: webSearchTool,
|
|
85
99
|
git_read: gitReadTool,
|
|
100
|
+
git_write: gitWriteTool,
|
|
86
101
|
fs_ops: fsOpsTool,
|
|
102
|
+
test_run: testRunTool,
|
|
103
|
+
lint_run: lintRunTool,
|
|
104
|
+
typecheck_run: typecheckRunTool,
|
|
105
|
+
db_run: dbRunTool,
|
|
87
106
|
todo_write: todoWriteTool,
|
|
88
107
|
todo_read: todoReadTool,
|
|
89
108
|
};
|
|
@@ -121,6 +140,7 @@ export function createReadOnlyTools(cwd, options) {
|
|
|
121
140
|
createSedTool(cwd),
|
|
122
141
|
createSemanticSearchTool(cwd, options?.semantic),
|
|
123
142
|
createFetchTool(cwd, fetchOptions),
|
|
143
|
+
createWebSearchTool(cwd, options?.webSearch),
|
|
124
144
|
createGitReadTool(cwd),
|
|
125
145
|
];
|
|
126
146
|
}
|
|
@@ -146,8 +166,14 @@ export function createAllTools(cwd, options) {
|
|
|
146
166
|
sed: createSedTool(cwd),
|
|
147
167
|
semantic_search: createSemanticSearchTool(cwd, options?.semantic),
|
|
148
168
|
fetch: createFetchTool(cwd, options?.fetch),
|
|
169
|
+
web_search: createWebSearchTool(cwd, options?.webSearch),
|
|
149
170
|
git_read: createGitReadTool(cwd),
|
|
171
|
+
git_write: createGitWriteTool(cwd, options?.gitWrite),
|
|
150
172
|
fs_ops: createFsOpsTool(cwd, options?.fsOps),
|
|
173
|
+
test_run: createTestRunTool(cwd),
|
|
174
|
+
lint_run: createLintRunTool(cwd),
|
|
175
|
+
typecheck_run: createTypecheckRunTool(cwd),
|
|
176
|
+
db_run: createDbRunTool(cwd, options?.dbRun),
|
|
151
177
|
todo_write: todoWriteTool,
|
|
152
178
|
todo_read: todoReadTool,
|
|
153
179
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EAEjB,WAAW,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAON,QAAQ,EACR,cAAc,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAEN,SAAS,EACT,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,cAAc,EAKd,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,eAAe,EAMf,6BAA6B,EAC7B,uBAAuB,EACvB,2BAA2B,EAC3B,gCAAgC,EAChC,SAAS,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EAIN,qBAAqB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,YAAY,EAEZ,MAAM,GACN,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EAKd,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,eAAe,EAIf,SAAS,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,cAAc,EAKd,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,iBAAiB,EAIjB,WAAW,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,YAAY,EAEZ,MAAM,GACN,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,YAAY,EAKZ,MAAM,GACN,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,cAAc,EAKd,QAAQ,GACR,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AAO,EAAE,QAAQ,CAAC;QACjE,KAAK,EAAE,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC;QAC3C,QAAQ,EAAE,iBAAiB,CAAC,GAAG,CAAC;QAChC,MAAM,EAAE,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC;QAC5C,UAAU,EAAE,aAAa;QACzB,SAAS,EAAE,YAAY;KACvB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW,EAAE,KAAe,EAAE,OAAsB;IACxF,MAAM,GAAG,GAAG,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACzC,OAAO,KAAK;SACV,MAAM,CAAC,CAAC,CAAC,EAAiB,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC;SACtC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC","sourcesContent":["export {\n\tcreateAstGrepTool,\n\ttype AstGrepToolInput,\n\tastGrepTool,\n} from \"./ast-grep.js\";\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tcreateBashTool,\n} from \"./bash.js\";\nexport {\n\ttype CombyToolInput,\n\tcombyTool,\n\tcreateCombyTool,\n} from \"./comby.js\";\nexport {\n\tcreateEditTool,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n} from \"./edit.js\";\nexport {\n\tcreateFetchTool,\n\ttype FetchToolDetails,\n\ttype FetchToolInput,\n\ttype FetchToolOptions,\n\ttype FetchMethod,\n\ttype FetchResponseFormat,\n\tDEFAULT_FETCH_TIMEOUT_SECONDS,\n\tDEFAULT_FETCH_MAX_BYTES,\n\tDEFAULT_FETCH_MAX_REDIRECTS,\n\tgetAllowedFetchMethodsForProfile,\n\tfetchTool,\n} from \"./fetch.js\";\nexport {\n\ttype ExternalCliToolDetails,\n\ttype ExternalCliToolInput,\n\ttype ExternalCliToolOptions,\n\tcreateExternalCliTool,\n} from \"./external-cli.js\";\nexport {\n\tcreateFdTool,\n\ttype FdToolInput,\n\tfdTool,\n} from \"./fd.js\";\nexport {\n\tcreateFindTool,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n} from \"./find.js\";\nexport {\n\tcreateFsOpsTool,\n\ttype FsOpsToolDetails,\n\ttype FsOpsToolInput,\n\ttype FsOpsToolOptions,\n\tfsOpsTool,\n} from \"./fs-ops.js\";\nexport {\n\tcreateGrepTool,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n} from \"./grep.js\";\nexport {\n\tcreateGitReadTool,\n\ttype GitReadToolDetails,\n\ttype GitReadToolInput,\n\ttype GitReadToolOptions,\n\tgitReadTool,\n} from \"./git-read.js\";\nexport {\n\tcreateJqTool,\n\ttype JqToolInput,\n\tjqTool,\n} from \"./jq.js\";\nexport {\n\tcreateLsTool,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n} from \"./ls.js\";\nexport {\n\tcreateReadTool,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n} from \"./read.js\";\nexport {\n\tcreateRgTool,\n\ttype RgToolInput,\n\trgTool,\n} from \"./rg.js\";\nexport {\n\tcreateSedTool,\n\ttype SedToolInput,\n\tsedTool,\n} from \"./sed.js\";\nexport {\n\tcreateSemgrepTool,\n\ttype SemgrepToolInput,\n\tsemgrepTool,\n} from \"./semgrep.js\";\nexport {\n\tcreateSemanticSearchTool,\n\ttype SemanticSearchToolInput,\n\ttype SemanticSearchToolOptions,\n\tsemanticSearchTool,\n} from \"./semantic-search.js\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.js\";\nexport {\n\tcreateWriteTool,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n} from \"./write.js\";\nexport { type ToolPermissionGuard, type ToolPermissionRequest } from \"./permissions.js\";\nexport {\n\tcreateTodoWriteTool,\n\tcreateTodoReadTool,\n\ttodoWriteTool,\n\ttodoReadTool,\n\tgetTaskFilePath,\n\ttype TodoTask,\n\ttype TodoTaskStatus,\n\ttype TodoWriteInput,\n\ttype TodoReadInput,\n} from \"./todo.js\";\nexport {\n\tcreateYqTool,\n\ttype YqToolInput,\n\tyqTool,\n} from \"./yq.js\";\nexport {\n\tcreateTaskTool,\n\ttype SubagentRunner,\n\ttype TaskToolProgress,\n\ttype TaskToolProgressPhase,\n\ttype TaskToolInput,\n\ttype TaskToolDetails,\n} from \"./task.js\";\n\nimport type { AgentTool } from \"@mariozechner/pi-agent-core\";\nimport { astGrepTool, createAstGrepTool } from \"./ast-grep.js\";\nimport { type BashToolOptions, bashTool, createBashTool } from \"./bash.js\";\nimport { combyTool, createCombyTool } from \"./comby.js\";\nimport { createEditTool, type EditToolOptions, editTool } from \"./edit.js\";\nimport {\n\tcreateFetchTool,\n\ttype FetchToolOptions,\n\tfetchTool,\n\tgetAllowedFetchMethodsForProfile,\n} from \"./fetch.js\";\nimport { createFdTool, fdTool } from \"./fd.js\";\nimport { createFindTool, findTool } from \"./find.js\";\nimport { createFsOpsTool, type FsOpsToolOptions, fsOpsTool } from \"./fs-ops.js\";\nimport { createGrepTool, grepTool } from \"./grep.js\";\nimport { createGitReadTool, gitReadTool } from \"./git-read.js\";\nimport { createJqTool, jqTool } from \"./jq.js\";\nimport { createLsTool, lsTool } from \"./ls.js\";\nimport { createReadTool, type ReadToolOptions, readTool } from \"./read.js\";\nimport { createRgTool, rgTool } from \"./rg.js\";\nimport { createSedTool, sedTool } from \"./sed.js\";\nimport { createSemgrepTool, semgrepTool } from \"./semgrep.js\";\nimport {\n\tcreateSemanticSearchTool,\n\ttype SemanticSearchToolOptions,\n\tsemanticSearchTool,\n} from \"./semantic-search.js\";\nimport { createWriteTool, type WriteToolOptions, writeTool } from \"./write.js\";\nimport { createYqTool, yqTool } from \"./yq.js\";\nimport { todoWriteTool, todoReadTool } from \"./todo.js\";\n\n/** Tool type (AgentTool from pi-ai) */\nexport type Tool = AgentTool<any>;\n\n// Default tools for full access mode (using process.cwd())\nexport const codingTools: Tool[] = [readTool, bashTool, editTool, writeTool];\n\n// Read-only tools for exploration without modification (using process.cwd())\nexport const readOnlyTools: Tool[] = [\n\treadTool,\n\tgrepTool,\n\tfindTool,\n\tlsTool,\n\trgTool,\n\tfdTool,\n\tastGrepTool,\n\tcombyTool,\n\tjqTool,\n\tyqTool,\n\tsemgrepTool,\n\tsedTool,\n\tsemanticSearchTool,\n\tcreateFetchTool(process.cwd(), {\n\t\tresolveAllowedMethods: () => getAllowedFetchMethodsForProfile(\"plan\"),\n\t}),\n\tgitReadTool,\n];\n\n// All available tools (using process.cwd())\nexport const allTools = {\n\tread: readTool,\n\tbash: bashTool,\n\tedit: editTool,\n\twrite: writeTool,\n\tgrep: grepTool,\n\tfind: findTool,\n\tls: lsTool,\n\trg: rgTool,\n\tfd: fdTool,\n\tast_grep: astGrepTool,\n\tcomby: combyTool,\n\tjq: jqTool,\n\tyq: yqTool,\n\tsemgrep: semgrepTool,\n\tsed: sedTool,\n\tsemantic_search: semanticSearchTool,\n\tfetch: fetchTool,\n\tgit_read: gitReadTool,\n\tfs_ops: fsOpsTool,\n\ttodo_write: todoWriteTool,\n\ttodo_read: todoReadTool,\n};\n\nexport type ToolName = keyof typeof allTools;\n\nexport interface ToolsOptions {\n\t/** Options for the read tool */\n\tread?: ReadToolOptions;\n\t/** Options for the bash tool */\n\tbash?: BashToolOptions;\n\t/** Options for the edit tool */\n\tedit?: EditToolOptions;\n\t/** Options for the write tool */\n\twrite?: WriteToolOptions;\n\t/** Options for the semantic_search tool */\n\tsemantic?: SemanticSearchToolOptions;\n\t/** Options for the fetch tool */\n\tfetch?: FetchToolOptions;\n\t/** Options for the fs_ops tool */\n\tfsOps?: FsOpsToolOptions;\n}\n\n/**\n * Create coding tools configured for a specific working directory.\n */\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\n\t];\n}\n\n/**\n * Create read-only tools configured for a specific working directory.\n */\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\tconst fetchOptions: FetchToolOptions = {\n\t\t...(options?.fetch ?? {}),\n\t\tresolveAllowedMethods:\n\t\t\toptions?.fetch?.resolveAllowedMethods ?? (() => getAllowedFetchMethodsForProfile(\"plan\")),\n\t};\n\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd),\n\t\tcreateFindTool(cwd),\n\t\tcreateLsTool(cwd),\n\t\tcreateRgTool(cwd),\n\t\tcreateFdTool(cwd),\n\t\tcreateAstGrepTool(cwd),\n\t\tcreateCombyTool(cwd),\n\t\tcreateJqTool(cwd),\n\t\tcreateYqTool(cwd),\n\t\tcreateSemgrepTool(cwd),\n\t\tcreateSedTool(cwd),\n\t\tcreateSemanticSearchTool(cwd, options?.semantic),\n\t\tcreateFetchTool(cwd, fetchOptions),\n\t\tcreateGitReadTool(cwd),\n\t];\n}\n\n/**\n * Create all tools configured for a specific working directory.\n */\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName, Tool> {\n\treturn {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd),\n\t\tfind: createFindTool(cwd),\n\t\tls: createLsTool(cwd),\n\t\trg: createRgTool(cwd),\n\t\tfd: createFdTool(cwd),\n\t\tast_grep: createAstGrepTool(cwd),\n\t\tcomby: createCombyTool(cwd),\n\t\tjq: createJqTool(cwd),\n\t\tyq: createYqTool(cwd),\n\t\tsemgrep: createSemgrepTool(cwd),\n\t\tsed: createSedTool(cwd),\n\t\tsemantic_search: createSemanticSearchTool(cwd, options?.semantic),\n\t\tfetch: createFetchTool(cwd, options?.fetch),\n\t\tgit_read: createGitReadTool(cwd),\n\t\tfs_ops: createFsOpsTool(cwd, options?.fsOps),\n\t\ttodo_write: todoWriteTool,\n\t\ttodo_read: todoReadTool,\n\t};\n}\n\n/**\n * Create a filtered set of tools from a list of tool names.\n * Used by agent profiles and the Task tool to configure subagent capabilities.\n */\nexport function createToolsFromNames(cwd: string, names: string[], options?: ToolsOptions): Tool[] {\n\tconst all = createAllTools(cwd, options);\n\treturn names\n\t\t.filter((n): n is ToolName => n in all)\n\t\t.map((n) => all[n]);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EAEjB,WAAW,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAON,QAAQ,EACR,cAAc,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAEN,SAAS,EACT,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,cAAc,EAKd,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,eAAe,EAMf,6BAA6B,EAC7B,uBAAuB,EACvB,2BAA2B,EAC3B,gCAAgC,EAChC,SAAS,GACT,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,mBAAmB,EAYnB,8BAA8B,EAC9B,kCAAkC,EAClC,aAAa,GACb,M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["export {\n\tcreateAstGrepTool,\n\ttype AstGrepToolInput,\n\tastGrepTool,\n} from \"./ast-grep.js\";\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tcreateBashTool,\n} from \"./bash.js\";\nexport {\n\ttype CombyToolInput,\n\tcombyTool,\n\tcreateCombyTool,\n} from \"./comby.js\";\nexport {\n\tcreateEditTool,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n} from \"./edit.js\";\nexport {\n\tcreateFetchTool,\n\ttype FetchToolDetails,\n\ttype FetchToolInput,\n\ttype FetchToolOptions,\n\ttype FetchMethod,\n\ttype FetchResponseFormat,\n\tDEFAULT_FETCH_TIMEOUT_SECONDS,\n\tDEFAULT_FETCH_MAX_BYTES,\n\tDEFAULT_FETCH_MAX_REDIRECTS,\n\tgetAllowedFetchMethodsForProfile,\n\tfetchTool,\n} from \"./fetch.js\";\nexport {\n\tcreateWebSearchTool,\n\ttype WebSearchAttemptDetail,\n\ttype WebSearchAttemptStatus,\n\ttype WebSearchFallbackMode,\n\ttype WebSearchProvider,\n\ttype WebSearchProviderMode,\n\ttype WebSearchRuntimeConfig,\n\ttype WebSearchSafeSearch,\n\ttype WebSearchSearchDepth,\n\ttype WebSearchToolDetails,\n\ttype WebSearchToolInput,\n\ttype WebSearchToolOptions,\n\tDEFAULT_WEB_SEARCH_MAX_RESULTS,\n\tDEFAULT_WEB_SEARCH_TIMEOUT_SECONDS,\n\twebSearchTool,\n} from \"./web-search.js\";\nexport {\n\ttype ExternalCliToolDetails,\n\ttype ExternalCliToolInput,\n\ttype ExternalCliToolOptions,\n\tcreateExternalCliTool,\n} from \"./external-cli.js\";\nexport {\n\tcreateFdTool,\n\ttype FdToolInput,\n\tfdTool,\n} from \"./fd.js\";\nexport {\n\tcreateFindTool,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n} from \"./find.js\";\nexport {\n\tcreateFsOpsTool,\n\ttype FsOpsToolDetails,\n\ttype FsOpsToolInput,\n\ttype FsOpsToolOptions,\n\tfsOpsTool,\n} from \"./fs-ops.js\";\nexport {\n\tcreateGrepTool,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n} from \"./grep.js\";\nexport {\n\tcreateGitReadTool,\n\ttype GitReadToolDetails,\n\ttype GitReadToolInput,\n\ttype GitReadToolOptions,\n\tgitReadTool,\n} from \"./git-read.js\";\nexport {\n\tcreateGitWriteTool,\n\ttype GitWriteToolDetails,\n\ttype GitWriteToolInput,\n\ttype GitWriteToolOptions,\n\tgitWriteTool,\n} from \"./git-write.js\";\nexport {\n\tcreateJqTool,\n\ttype JqToolInput,\n\tjqTool,\n} from \"./jq.js\";\nexport {\n\tcreateDbRunTool,\n\ttype DbRunAction,\n\ttype DbRunAdapter,\n\ttype DbRunMigrateRunner,\n\ttype DbRunStatus,\n\ttype DbRunToolDetails,\n\ttype DbRunToolInput,\n\ttype DbRunToolOptions,\n\ttype DbToolsConnectionConfig,\n\ttype DbToolsMigrateConfig,\n\ttype DbToolsRuntimeConfig,\n\tdbRunTool,\n\tDEFAULT_DB_RUN_TIMEOUT_SECONDS,\n} from \"./db-run.js\";\nexport {\n\tcreateLintRunTool,\n\ttype LintRunMode,\n\ttype LintRunRunner,\n\ttype LintRunStatus,\n\ttype LintRunToolDetails,\n\ttype LintRunToolInput,\n\tlintRunTool,\n\tDEFAULT_LINT_RUN_TIMEOUT_SECONDS,\n} from \"./lint-run.js\";\nexport {\n\tcreateLsTool,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n} from \"./ls.js\";\nexport {\n\tcreateReadTool,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n} from \"./read.js\";\nexport {\n\tcreateRgTool,\n\ttype RgToolInput,\n\trgTool,\n} from \"./rg.js\";\nexport {\n\tcreateSedTool,\n\ttype SedToolInput,\n\tsedTool,\n} from \"./sed.js\";\nexport {\n\tcreateSemgrepTool,\n\ttype SemgrepToolInput,\n\tsemgrepTool,\n} from \"./semgrep.js\";\nexport {\n\tcreateSemanticSearchTool,\n\ttype SemanticSearchToolInput,\n\ttype SemanticSearchToolOptions,\n\tsemanticSearchTool,\n} from \"./semantic-search.js\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.js\";\nexport {\n\tcreateWriteTool,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n} from \"./write.js\";\nexport { type ToolPermissionGuard, type ToolPermissionRequest } from \"./permissions.js\";\nexport {\n\tcreateTodoWriteTool,\n\tcreateTodoReadTool,\n\ttodoWriteTool,\n\ttodoReadTool,\n\tgetTaskFilePath,\n\ttype TodoTask,\n\ttype TodoTaskStatus,\n\ttype TodoWriteInput,\n\ttype TodoReadInput,\n} from \"./todo.js\";\nexport {\n\tcreateYqTool,\n\ttype YqToolInput,\n\tyqTool,\n} from \"./yq.js\";\nexport {\n\tcreateTaskTool,\n\ttype SubagentRunner,\n\ttype TaskToolProgress,\n\ttype TaskToolProgressPhase,\n\ttype TaskToolInput,\n\ttype TaskToolDetails,\n} from \"./task.js\";\nexport {\n\tcreateTestRunTool,\n\ttype TestRunRunner,\n\ttype TestRunStatus,\n\ttype TestRunToolDetails,\n\ttype TestRunToolInput,\n\ttestRunTool,\n\tDEFAULT_TEST_RUN_TIMEOUT_SECONDS,\n} from \"./test-run.js\";\nexport {\n\tcreateTypecheckRunTool,\n\ttype TypecheckRunItemDetails,\n\ttype TypecheckRunRunner,\n\ttype TypecheckRunStatus,\n\ttype TypecheckRunToolDetails,\n\ttype TypecheckRunToolInput,\n\ttypecheckRunTool,\n\tDEFAULT_TYPECHECK_RUN_TIMEOUT_SECONDS,\n} from \"./typecheck-run.js\";\n\nimport type { AgentTool } from \"@mariozechner/pi-agent-core\";\nimport { astGrepTool, createAstGrepTool } from \"./ast-grep.js\";\nimport { type BashToolOptions, bashTool, createBashTool } from \"./bash.js\";\nimport { combyTool, createCombyTool } from \"./comby.js\";\nimport { createEditTool, type EditToolOptions, editTool } from \"./edit.js\";\nimport {\n\tcreateFetchTool,\n\ttype FetchToolOptions,\n\tfetchTool,\n\tgetAllowedFetchMethodsForProfile,\n} from \"./fetch.js\";\nimport { createWebSearchTool, type WebSearchToolOptions, webSearchTool } from \"./web-search.js\";\nimport { createFdTool, fdTool } from \"./fd.js\";\nimport { createFindTool, findTool } from \"./find.js\";\nimport { createFsOpsTool, type FsOpsToolOptions, fsOpsTool } from \"./fs-ops.js\";\nimport { createGrepTool, grepTool } from \"./grep.js\";\nimport { createGitReadTool, gitReadTool } from \"./git-read.js\";\nimport { createGitWriteTool, type GitWriteToolOptions, gitWriteTool } from \"./git-write.js\";\nimport { createJqTool, jqTool } from \"./jq.js\";\nimport { createDbRunTool, type DbRunToolOptions, dbRunTool } from \"./db-run.js\";\nimport { createLintRunTool, lintRunTool } from \"./lint-run.js\";\nimport { createLsTool, lsTool } from \"./ls.js\";\nimport { createReadTool, type ReadToolOptions, readTool } from \"./read.js\";\nimport { createRgTool, rgTool } from \"./rg.js\";\nimport { createSedTool, sedTool } from \"./sed.js\";\nimport { createSemgrepTool, semgrepTool } from \"./semgrep.js\";\nimport {\n\tcreateSemanticSearchTool,\n\ttype SemanticSearchToolOptions,\n\tsemanticSearchTool,\n} from \"./semantic-search.js\";\nimport { createWriteTool, type WriteToolOptions, writeTool } from \"./write.js\";\nimport { createYqTool, yqTool } from \"./yq.js\";\nimport { todoWriteTool, todoReadTool } from \"./todo.js\";\nimport { createTestRunTool, testRunTool } from \"./test-run.js\";\nimport { createTypecheckRunTool, typecheckRunTool } from \"./typecheck-run.js\";\n\n/** Tool type (AgentTool from pi-ai) */\nexport type Tool = AgentTool<any>;\n\n// Default tools for full access mode (using process.cwd())\nexport const codingTools: Tool[] = [readTool, bashTool, editTool, writeTool];\n\n// Read-only tools for exploration without modification (using process.cwd())\nexport const readOnlyTools: Tool[] = [\n\treadTool,\n\tgrepTool,\n\tfindTool,\n\tlsTool,\n\trgTool,\n\tfdTool,\n\tastGrepTool,\n\tcombyTool,\n\tjqTool,\n\tyqTool,\n\tsemgrepTool,\n\tsedTool,\n\tsemanticSearchTool,\n\tcreateFetchTool(process.cwd(), {\n\t\tresolveAllowedMethods: () => getAllowedFetchMethodsForProfile(\"plan\"),\n\t}),\n\twebSearchTool,\n\tgitReadTool,\n];\n\n// All available tools (using process.cwd())\nexport const allTools = {\n\tread: readTool,\n\tbash: bashTool,\n\tedit: editTool,\n\twrite: writeTool,\n\tgrep: grepTool,\n\tfind: findTool,\n\tls: lsTool,\n\trg: rgTool,\n\tfd: fdTool,\n\tast_grep: astGrepTool,\n\tcomby: combyTool,\n\tjq: jqTool,\n\tyq: yqTool,\n\tsemgrep: semgrepTool,\n\tsed: sedTool,\n\tsemantic_search: semanticSearchTool,\n\tfetch: fetchTool,\n\tweb_search: webSearchTool,\n\tgit_read: gitReadTool,\n\tgit_write: gitWriteTool,\n\tfs_ops: fsOpsTool,\n\ttest_run: testRunTool,\n\tlint_run: lintRunTool,\n\ttypecheck_run: typecheckRunTool,\n\tdb_run: dbRunTool,\n\ttodo_write: todoWriteTool,\n\ttodo_read: todoReadTool,\n};\n\nexport type ToolName = keyof typeof allTools;\n\nexport interface ToolsOptions {\n\t/** Options for the read tool */\n\tread?: ReadToolOptions;\n\t/** Options for the bash tool */\n\tbash?: BashToolOptions;\n\t/** Options for the edit tool */\n\tedit?: EditToolOptions;\n\t/** Options for the write tool */\n\twrite?: WriteToolOptions;\n\t/** Options for the semantic_search tool */\n\tsemantic?: SemanticSearchToolOptions;\n\t/** Options for the fetch tool */\n\tfetch?: FetchToolOptions;\n\t/** Options for the web_search tool */\n\twebSearch?: WebSearchToolOptions;\n\t/** Options for the git_write tool */\n\tgitWrite?: GitWriteToolOptions;\n\t/** Options for the fs_ops tool */\n\tfsOps?: FsOpsToolOptions;\n\t/** Options for the db_run tool */\n\tdbRun?: DbRunToolOptions;\n}\n\n/**\n * Create coding tools configured for a specific working directory.\n */\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd, options?.edit),\n\t\tcreateWriteTool(cwd, options?.write),\n\t];\n}\n\n/**\n * Create read-only tools configured for a specific working directory.\n */\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\tconst fetchOptions: FetchToolOptions = {\n\t\t...(options?.fetch ?? {}),\n\t\tresolveAllowedMethods:\n\t\t\toptions?.fetch?.resolveAllowedMethods ?? (() => getAllowedFetchMethodsForProfile(\"plan\")),\n\t};\n\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateGrepTool(cwd),\n\t\tcreateFindTool(cwd),\n\t\tcreateLsTool(cwd),\n\t\tcreateRgTool(cwd),\n\t\tcreateFdTool(cwd),\n\t\tcreateAstGrepTool(cwd),\n\t\tcreateCombyTool(cwd),\n\t\tcreateJqTool(cwd),\n\t\tcreateYqTool(cwd),\n\t\tcreateSemgrepTool(cwd),\n\t\tcreateSedTool(cwd),\n\t\tcreateSemanticSearchTool(cwd, options?.semantic),\n\t\tcreateFetchTool(cwd, fetchOptions),\n\t\tcreateWebSearchTool(cwd, options?.webSearch),\n\t\tcreateGitReadTool(cwd),\n\t];\n}\n\n/**\n * Create all tools configured for a specific working directory.\n */\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName, Tool> {\n\treturn {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd, options?.edit),\n\t\twrite: createWriteTool(cwd, options?.write),\n\t\tgrep: createGrepTool(cwd),\n\t\tfind: createFindTool(cwd),\n\t\tls: createLsTool(cwd),\n\t\trg: createRgTool(cwd),\n\t\tfd: createFdTool(cwd),\n\t\tast_grep: createAstGrepTool(cwd),\n\t\tcomby: createCombyTool(cwd),\n\t\tjq: createJqTool(cwd),\n\t\tyq: createYqTool(cwd),\n\t\tsemgrep: createSemgrepTool(cwd),\n\t\tsed: createSedTool(cwd),\n\t\tsemantic_search: createSemanticSearchTool(cwd, options?.semantic),\n\t\tfetch: createFetchTool(cwd, options?.fetch),\n\t\tweb_search: createWebSearchTool(cwd, options?.webSearch),\n\t\tgit_read: createGitReadTool(cwd),\n\t\tgit_write: createGitWriteTool(cwd, options?.gitWrite),\n\t\tfs_ops: createFsOpsTool(cwd, options?.fsOps),\n\t\ttest_run: createTestRunTool(cwd),\n\t\tlint_run: createLintRunTool(cwd),\n\t\ttypecheck_run: createTypecheckRunTool(cwd),\n\t\tdb_run: createDbRunTool(cwd, options?.dbRun),\n\t\ttodo_write: todoWriteTool,\n\t\ttodo_read: todoReadTool,\n\t};\n}\n\n/**\n * Create a filtered set of tools from a list of tool names.\n * Used by agent profiles and the Task tool to configure subagent capabilities.\n */\nexport function createToolsFromNames(cwd: string, names: string[], options?: ToolsOptions): Tool[] {\n\tconst all = createAllTools(cwd, options);\n\treturn names\n\t\t.filter((n): n is ToolName => n in all)\n\t\t.map((n) => all[n]);\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
|
2
|
+
import { type Static } from "@sinclair/typebox";
|
|
3
|
+
import type { TruncationResult } from "./truncate.js";
|
|
4
|
+
declare const lintRunSchema: import("@sinclair/typebox").TObject<{
|
|
5
|
+
runner: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"auto">, import("@sinclair/typebox").TLiteral<"npm">, import("@sinclair/typebox").TLiteral<"pnpm">, import("@sinclair/typebox").TLiteral<"yarn">, import("@sinclair/typebox").TLiteral<"bun">, import("@sinclair/typebox").TLiteral<"eslint">, import("@sinclair/typebox").TLiteral<"prettier">, import("@sinclair/typebox").TLiteral<"stylelint">]>>;
|
|
6
|
+
mode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"check">, import("@sinclair/typebox").TLiteral<"fix">]>>;
|
|
7
|
+
script: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
8
|
+
targets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
9
|
+
args: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
10
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
11
|
+
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
12
|
+
}>;
|
|
13
|
+
export type LintRunToolInput = Static<typeof lintRunSchema>;
|
|
14
|
+
export type LintRunRunner = "auto" | "npm" | "pnpm" | "yarn" | "bun" | "eslint" | "prettier" | "stylelint";
|
|
15
|
+
export type LintRunMode = "check" | "fix";
|
|
16
|
+
export type LintRunStatus = "passed" | "failed" | "no_tests" | "error";
|
|
17
|
+
type ResolvedLintRunner = Exclude<LintRunRunner, "auto">;
|
|
18
|
+
export interface LintRunToolDetails {
|
|
19
|
+
resolvedRunner: ResolvedLintRunner;
|
|
20
|
+
resolvedCommand: string;
|
|
21
|
+
resolvedArgs: string[];
|
|
22
|
+
cwd: string;
|
|
23
|
+
mode: LintRunMode;
|
|
24
|
+
exitCode: number;
|
|
25
|
+
status: LintRunStatus;
|
|
26
|
+
durationMs: number;
|
|
27
|
+
captureTruncated?: boolean;
|
|
28
|
+
truncation?: TruncationResult;
|
|
29
|
+
}
|
|
30
|
+
export declare const DEFAULT_LINT_RUN_TIMEOUT_SECONDS = 300;
|
|
31
|
+
export declare function createLintRunTool(cwd: string): AgentTool<typeof lintRunSchema>;
|
|
32
|
+
export declare const lintRunTool: AgentTool<import("@sinclair/typebox").TObject<{
|
|
33
|
+
runner: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"auto">, import("@sinclair/typebox").TLiteral<"npm">, import("@sinclair/typebox").TLiteral<"pnpm">, import("@sinclair/typebox").TLiteral<"yarn">, import("@sinclair/typebox").TLiteral<"bun">, import("@sinclair/typebox").TLiteral<"eslint">, import("@sinclair/typebox").TLiteral<"prettier">, import("@sinclair/typebox").TLiteral<"stylelint">]>>;
|
|
34
|
+
mode: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"check">, import("@sinclair/typebox").TLiteral<"fix">]>>;
|
|
35
|
+
script: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
36
|
+
targets: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
37
|
+
args: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
38
|
+
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
39
|
+
timeout: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
40
|
+
}>, any>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=lint-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-run.d.ts","sourceRoot":"","sources":["../../../src/core/tools/lint-run.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAYtD,QAAA,MAAM,aAAa;;;;;;;;EAwCjB,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAC3G,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,KAAK,CAAC;AAC1C,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AAEvE,KAAK,kBAAkB,GAAG,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAQzD,MAAM,WAAW,kBAAkB;IAClC,cAAc,EAAE,kBAAkB,CAAC;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,WAAW,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED,eAAO,MAAM,gCAAgC,MAAM,CAAC;AA+NpD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,aAAa,CAAC,CAmE9E;AAED,eAAO,MAAM,WAAW;;;;;;;;QAAmC,CAAC"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { Type } from "@sinclair/typebox";
|
|
4
|
+
import { resolveToCwd } from "./path-utils.js";
|
|
5
|
+
import { detectPackageManager, ensureCommandOrThrow, formatVerificationOutput, readPackageJson, resolvePackageManagerExecInvocation, resolvePackageManagerRunInvocation, runVerificationCommand, } from "./verification-runner.js";
|
|
6
|
+
const lintRunSchema = Type.Object({
|
|
7
|
+
runner: Type.Optional(Type.Union([
|
|
8
|
+
Type.Literal("auto"),
|
|
9
|
+
Type.Literal("npm"),
|
|
10
|
+
Type.Literal("pnpm"),
|
|
11
|
+
Type.Literal("yarn"),
|
|
12
|
+
Type.Literal("bun"),
|
|
13
|
+
Type.Literal("eslint"),
|
|
14
|
+
Type.Literal("prettier"),
|
|
15
|
+
Type.Literal("stylelint"),
|
|
16
|
+
], {
|
|
17
|
+
description: "Linter runner: auto | npm | pnpm | yarn | bun | eslint | prettier | stylelint",
|
|
18
|
+
})),
|
|
19
|
+
mode: Type.Optional(Type.Union([Type.Literal("check"), Type.Literal("fix")], {
|
|
20
|
+
description: "Lint mode: check | fix (default: check).",
|
|
21
|
+
})),
|
|
22
|
+
script: Type.Optional(Type.String({
|
|
23
|
+
description: "Package script for npm/pnpm/yarn/bun runners (default: lint or lint:fix by mode).",
|
|
24
|
+
})),
|
|
25
|
+
targets: Type.Optional(Type.Array(Type.String(), {
|
|
26
|
+
description: "Optional explicit lint targets (paths/globs).",
|
|
27
|
+
})),
|
|
28
|
+
args: Type.Optional(Type.Array(Type.String(), {
|
|
29
|
+
description: "Additional CLI args forwarded to the selected linter runner.",
|
|
30
|
+
})),
|
|
31
|
+
path: Type.Optional(Type.String({ description: "Working directory for lint execution (default: current directory)." })),
|
|
32
|
+
timeout: Type.Optional(Type.Number({ description: "Timeout in seconds (default: 300)." })),
|
|
33
|
+
});
|
|
34
|
+
export const DEFAULT_LINT_RUN_TIMEOUT_SECONDS = 300;
|
|
35
|
+
function normalizeTimeoutSeconds(raw) {
|
|
36
|
+
if (raw === undefined)
|
|
37
|
+
return DEFAULT_LINT_RUN_TIMEOUT_SECONDS;
|
|
38
|
+
const value = Math.floor(raw);
|
|
39
|
+
if (!Number.isFinite(value) || value <= 0) {
|
|
40
|
+
throw new Error("timeout must be a positive number.");
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
function normalizeStringArray(raw) {
|
|
45
|
+
return (raw ?? []).map((item) => String(item));
|
|
46
|
+
}
|
|
47
|
+
function normalizeScriptName(raw, mode) {
|
|
48
|
+
const fallback = mode === "fix" ? "lint:fix" : "lint";
|
|
49
|
+
const script = (raw ?? fallback).trim();
|
|
50
|
+
if (script.length === 0) {
|
|
51
|
+
throw new Error("script must not be empty.");
|
|
52
|
+
}
|
|
53
|
+
return script;
|
|
54
|
+
}
|
|
55
|
+
function hasAnyFile(cwd, fileNames) {
|
|
56
|
+
return fileNames.some((name) => existsSync(join(cwd, name)));
|
|
57
|
+
}
|
|
58
|
+
function hasEslintConfig(cwd, packageJsonEslintConfig) {
|
|
59
|
+
if (packageJsonEslintConfig && typeof packageJsonEslintConfig === "object") {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
return hasAnyFile(cwd, [
|
|
63
|
+
"eslint.config.js",
|
|
64
|
+
"eslint.config.cjs",
|
|
65
|
+
"eslint.config.mjs",
|
|
66
|
+
"eslint.config.ts",
|
|
67
|
+
"eslint.config.mts",
|
|
68
|
+
"eslint.config.cts",
|
|
69
|
+
".eslintrc",
|
|
70
|
+
".eslintrc.js",
|
|
71
|
+
".eslintrc.cjs",
|
|
72
|
+
".eslintrc.mjs",
|
|
73
|
+
".eslintrc.yaml",
|
|
74
|
+
".eslintrc.yml",
|
|
75
|
+
".eslintrc.json",
|
|
76
|
+
]);
|
|
77
|
+
}
|
|
78
|
+
function hasStylelintConfig(cwd, packageJsonStylelint) {
|
|
79
|
+
if (packageJsonStylelint && typeof packageJsonStylelint === "object") {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
return hasAnyFile(cwd, [
|
|
83
|
+
"stylelint.config.js",
|
|
84
|
+
"stylelint.config.cjs",
|
|
85
|
+
"stylelint.config.mjs",
|
|
86
|
+
"stylelint.config.ts",
|
|
87
|
+
"stylelint.config.mts",
|
|
88
|
+
"stylelint.config.cts",
|
|
89
|
+
".stylelintrc",
|
|
90
|
+
".stylelintrc.js",
|
|
91
|
+
".stylelintrc.cjs",
|
|
92
|
+
".stylelintrc.mjs",
|
|
93
|
+
".stylelintrc.yaml",
|
|
94
|
+
".stylelintrc.yml",
|
|
95
|
+
".stylelintrc.json",
|
|
96
|
+
]);
|
|
97
|
+
}
|
|
98
|
+
function hasPrettierConfig(cwd, packageJsonPrettier) {
|
|
99
|
+
if (typeof packageJsonPrettier === "string" || (packageJsonPrettier && typeof packageJsonPrettier === "object")) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
return hasAnyFile(cwd, [
|
|
103
|
+
".prettierrc",
|
|
104
|
+
".prettierrc.js",
|
|
105
|
+
".prettierrc.cjs",
|
|
106
|
+
".prettierrc.mjs",
|
|
107
|
+
".prettierrc.json",
|
|
108
|
+
".prettierrc.yaml",
|
|
109
|
+
".prettierrc.yml",
|
|
110
|
+
".prettierrc.toml",
|
|
111
|
+
"prettier.config.js",
|
|
112
|
+
"prettier.config.cjs",
|
|
113
|
+
"prettier.config.mjs",
|
|
114
|
+
]);
|
|
115
|
+
}
|
|
116
|
+
function assertPackageManagerAvailable(packageManager) {
|
|
117
|
+
if (packageManager === "bun") {
|
|
118
|
+
ensureCommandOrThrow("bun", 'Command "bun" is required for bun-based lint execution.');
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
ensureCommandOrThrow(packageManager, `Command "${packageManager}" is required for lint execution.`);
|
|
122
|
+
}
|
|
123
|
+
function resolveScriptBasedCommand(packageManager, script, args) {
|
|
124
|
+
assertPackageManagerAvailable(packageManager);
|
|
125
|
+
const invocation = resolvePackageManagerRunInvocation(packageManager, script, args);
|
|
126
|
+
return {
|
|
127
|
+
resolvedRunner: packageManager,
|
|
128
|
+
command: invocation.command,
|
|
129
|
+
args: invocation.args,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function buildDirectLintArgs(runner, mode, targets, args) {
|
|
133
|
+
const effectiveTargets = targets.length > 0 ? targets : runner === "stylelint" ? ["**/*.{css,scss,sass,less}"] : ["."];
|
|
134
|
+
if (runner === "eslint") {
|
|
135
|
+
const modeArgs = mode === "fix" ? ["--fix"] : [];
|
|
136
|
+
return [...modeArgs, ...args, ...effectiveTargets];
|
|
137
|
+
}
|
|
138
|
+
if (runner === "prettier") {
|
|
139
|
+
const modeArgs = mode === "fix" ? ["--write"] : ["--check"];
|
|
140
|
+
return [...modeArgs, ...args, ...effectiveTargets];
|
|
141
|
+
}
|
|
142
|
+
const modeArgs = mode === "fix" ? ["--fix"] : [];
|
|
143
|
+
return [...modeArgs, ...args, ...effectiveTargets];
|
|
144
|
+
}
|
|
145
|
+
function resolveDirectLintCommand(packageManager, runner, mode, targets, args) {
|
|
146
|
+
assertPackageManagerAvailable(packageManager);
|
|
147
|
+
const directArgs = buildDirectLintArgs(runner, mode, targets, args);
|
|
148
|
+
const invocation = resolvePackageManagerExecInvocation(packageManager, runner, directArgs);
|
|
149
|
+
ensureCommandOrThrow(invocation.command, `Command "${invocation.command}" is required to run ${runner}. Install ${packageManager} tooling first.`);
|
|
150
|
+
return {
|
|
151
|
+
resolvedRunner: runner,
|
|
152
|
+
command: invocation.command,
|
|
153
|
+
args: invocation.args,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function resolveAutoRunner(cwd, script) {
|
|
157
|
+
const packageJson = readPackageJson(cwd);
|
|
158
|
+
if (packageJson?.scripts[script]) {
|
|
159
|
+
return detectPackageManager(cwd);
|
|
160
|
+
}
|
|
161
|
+
if (hasEslintConfig(cwd, packageJson?.raw?.eslintConfig))
|
|
162
|
+
return "eslint";
|
|
163
|
+
if (hasStylelintConfig(cwd, packageJson?.raw?.stylelint))
|
|
164
|
+
return "stylelint";
|
|
165
|
+
if (hasPrettierConfig(cwd, packageJson?.raw?.prettier))
|
|
166
|
+
return "prettier";
|
|
167
|
+
throw new Error('Unable to auto-detect lint runner. Expected package.json lint script or eslint/stylelint/prettier config.');
|
|
168
|
+
}
|
|
169
|
+
function hasCheckModeConflictArgs(args) {
|
|
170
|
+
for (const arg of args) {
|
|
171
|
+
if (arg === "--fix" || arg.startsWith("--fix=") || arg === "--write" || arg.startsWith("--write=")) {
|
|
172
|
+
return arg;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
function resolveLintCommand(input) {
|
|
178
|
+
const packageJson = readPackageJson(input.cwd);
|
|
179
|
+
let resolvedRunner;
|
|
180
|
+
if (input.runner === "auto") {
|
|
181
|
+
resolvedRunner = resolveAutoRunner(input.cwd, input.script);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
resolvedRunner = input.runner;
|
|
185
|
+
}
|
|
186
|
+
if (resolvedRunner === "npm" || resolvedRunner === "pnpm" || resolvedRunner === "yarn" || resolvedRunner === "bun") {
|
|
187
|
+
if (!packageJson) {
|
|
188
|
+
throw new Error(`package.json is required to run ${resolvedRunner} scripts.`);
|
|
189
|
+
}
|
|
190
|
+
if (!packageJson.scripts[input.script]) {
|
|
191
|
+
throw new Error(`Script "${input.script}" is not defined in package.json.`);
|
|
192
|
+
}
|
|
193
|
+
return resolveScriptBasedCommand(resolvedRunner, input.script, input.args);
|
|
194
|
+
}
|
|
195
|
+
const packageManager = detectPackageManager(input.cwd);
|
|
196
|
+
return resolveDirectLintCommand(packageManager, resolvedRunner, input.mode, input.targets, input.args);
|
|
197
|
+
}
|
|
198
|
+
function mapLintStatus(exitCode) {
|
|
199
|
+
if (exitCode === 0)
|
|
200
|
+
return "passed";
|
|
201
|
+
if (exitCode === 1)
|
|
202
|
+
return "failed";
|
|
203
|
+
return "error";
|
|
204
|
+
}
|
|
205
|
+
function renderSummary(details, output) {
|
|
206
|
+
const argsText = details.resolvedArgs.length > 0 ? ` ${details.resolvedArgs.join(" ")}` : "";
|
|
207
|
+
return [
|
|
208
|
+
`lint_run status: ${details.status}`,
|
|
209
|
+
`runner: ${details.resolvedRunner}`,
|
|
210
|
+
`mode: ${details.mode}`,
|
|
211
|
+
`command: ${details.resolvedCommand}${argsText}`,
|
|
212
|
+
`cwd: ${details.cwd}`,
|
|
213
|
+
`exit_code: ${details.exitCode}`,
|
|
214
|
+
`duration_ms: ${details.durationMs}`,
|
|
215
|
+
"",
|
|
216
|
+
output,
|
|
217
|
+
].join("\n");
|
|
218
|
+
}
|
|
219
|
+
export function createLintRunTool(cwd) {
|
|
220
|
+
return {
|
|
221
|
+
name: "lint_run",
|
|
222
|
+
label: "lint_run",
|
|
223
|
+
description: "Structured lint runner with auto detection across npm/pnpm/yarn/bun scripts and eslint/prettier/stylelint direct execution. Returns normalized status without throwing on ordinary lint failures.",
|
|
224
|
+
parameters: lintRunSchema,
|
|
225
|
+
execute: async (_toolCallId, input, signal) => {
|
|
226
|
+
const executionCwd = resolveToCwd(input.path || ".", cwd);
|
|
227
|
+
const timeoutSeconds = normalizeTimeoutSeconds(input.timeout);
|
|
228
|
+
const args = normalizeStringArray(input.args);
|
|
229
|
+
const targets = normalizeStringArray(input.targets);
|
|
230
|
+
const mode = input.mode ?? "check";
|
|
231
|
+
const script = normalizeScriptName(input.script, mode);
|
|
232
|
+
const runner = input.runner ?? "auto";
|
|
233
|
+
if (mode === "check") {
|
|
234
|
+
const conflictArg = hasCheckModeConflictArgs(args);
|
|
235
|
+
if (conflictArg) {
|
|
236
|
+
throw new Error(`Argument "${conflictArg}" is incompatible with mode=check.`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
const command = resolveLintCommand({
|
|
240
|
+
cwd: executionCwd,
|
|
241
|
+
runner,
|
|
242
|
+
mode,
|
|
243
|
+
script,
|
|
244
|
+
args,
|
|
245
|
+
targets,
|
|
246
|
+
});
|
|
247
|
+
const result = await runVerificationCommand({
|
|
248
|
+
command: command.command,
|
|
249
|
+
args: command.args,
|
|
250
|
+
cwd: executionCwd,
|
|
251
|
+
timeoutMs: timeoutSeconds * 1000,
|
|
252
|
+
signal,
|
|
253
|
+
});
|
|
254
|
+
const status = mapLintStatus(result.exitCode);
|
|
255
|
+
const formatted = formatVerificationOutput(result.stdout, result.stderr, result.captureTruncated, "No lint output");
|
|
256
|
+
const details = {
|
|
257
|
+
resolvedRunner: command.resolvedRunner,
|
|
258
|
+
resolvedCommand: command.command,
|
|
259
|
+
resolvedArgs: command.args,
|
|
260
|
+
cwd: executionCwd,
|
|
261
|
+
mode,
|
|
262
|
+
exitCode: result.exitCode,
|
|
263
|
+
status,
|
|
264
|
+
durationMs: result.durationMs,
|
|
265
|
+
captureTruncated: result.captureTruncated || undefined,
|
|
266
|
+
truncation: formatted.truncation,
|
|
267
|
+
};
|
|
268
|
+
return {
|
|
269
|
+
content: [{ type: "text", text: renderSummary(details, formatted.text) }],
|
|
270
|
+
details,
|
|
271
|
+
};
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
export const lintRunTool = createLintRunTool(process.cwd());
|
|
276
|
+
//# sourceMappingURL=lint-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-run.js","sourceRoot":"","sources":["../../../src/core/tools/lint-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAEN,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EACf,mCAAmC,EACnC,kCAAkC,EAClC,sBAAsB,GACtB,MAAM,0BAA0B,CAAC;AAElC,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC;IACjC,MAAM,EAAE,IAAI,CAAC,QAAQ,CACpB,IAAI,C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AAc,EAAE,OAAO,CAAC,cAAc;gBACtC,eAAe,EAAE,OAAO,CAAC,OAAO;gBAChC,YAAY,EAAE,OAAO,CAAC,IAAI;gBAC1B,GAAG,EAAE,YAAY;gBACjB,IAAI;gBACJ,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,MAAM;gBACN,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,SAAS;gBACtD,UAAU,EAAE,SAAS,CAAC,UAAU;aAChC,CAAC;YAEF,OAAO;gBACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzE,OAAO;aACP,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { AgentTool } from \"@mariozechner/pi-agent-core\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport { resolveToCwd } from \"./path-utils.js\";\nimport type { TruncationResult } from \"./truncate.js\";\nimport {\n\ttype PackageManager,\n\tdetectPackageManager,\n\tensureCommandOrThrow,\n\tformatVerificationOutput,\n\treadPackageJson,\n\tresolvePackageManagerExecInvocation,\n\tresolvePackageManagerRunInvocation,\n\trunVerificationCommand,\n} from \"./verification-runner.js\";\n\nconst lintRunSchema = Type.Object({\n\trunner: Type.Optional(\n\t\tType.Union(\n\t\t\t[\n\t\t\t\tType.Literal(\"auto\"),\n\t\t\t\tType.Literal(\"npm\"),\n\t\t\t\tType.Literal(\"pnpm\"),\n\t\t\t\tType.Literal(\"yarn\"),\n\t\t\t\tType.Literal(\"bun\"),\n\t\t\t\tType.Literal(\"eslint\"),\n\t\t\t\tType.Literal(\"prettier\"),\n\t\t\t\tType.Literal(\"stylelint\"),\n\t\t\t],\n\t\t\t{\n\t\t\t\tdescription: \"Linter runner: auto | npm | pnpm | yarn | bun | eslint | prettier | stylelint\",\n\t\t\t},\n\t\t),\n\t),\n\tmode: Type.Optional(\n\t\tType.Union([Type.Literal(\"check\"), Type.Literal(\"fix\")], {\n\t\t\tdescription: \"Lint mode: check | fix (default: check).\",\n\t\t}),\n\t),\n\tscript: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Package script for npm/pnpm/yarn/bun runners (default: lint or lint:fix by mode).\",\n\t\t}),\n\t),\n\ttargets: Type.Optional(\n\t\tType.Array(Type.String(), {\n\t\t\tdescription: \"Optional explicit lint targets (paths/globs).\",\n\t\t}),\n\t),\n\targs: Type.Optional(\n\t\tType.Array(Type.String(), {\n\t\t\tdescription: \"Additional CLI args forwarded to the selected linter runner.\",\n\t\t}),\n\t),\n\tpath: Type.Optional(Type.String({ description: \"Working directory for lint execution (default: current directory).\" })),\n\ttimeout: Type.Optional(Type.Number({ description: \"Timeout in seconds (default: 300).\" })),\n});\n\nexport type LintRunToolInput = Static<typeof lintRunSchema>;\nexport type LintRunRunner = \"auto\" | \"npm\" | \"pnpm\" | \"yarn\" | \"bun\" | \"eslint\" | \"prettier\" | \"stylelint\";\nexport type LintRunMode = \"check\" | \"fix\";\nexport type LintRunStatus = \"passed\" | \"failed\" | \"no_tests\" | \"error\";\n\ntype ResolvedLintRunner = Exclude<LintRunRunner, \"auto\">;\n\ninterface ResolvedLintCommand {\n\tresolvedRunner: ResolvedLintRunner;\n\tcommand: string;\n\targs: string[];\n}\n\nexport interface LintRunToolDetails {\n\tresolvedRunner: ResolvedLintRunner;\n\tresolvedCommand: string;\n\tresolvedArgs: string[];\n\tcwd: string;\n\tmode: LintRunMode;\n\texitCode: number;\n\tstatus: LintRunStatus;\n\tdurationMs: number;\n\tcaptureTruncated?: boolean;\n\ttruncation?: TruncationResult;\n}\n\nexport const DEFAULT_LINT_RUN_TIMEOUT_SECONDS = 300;\n\nfunction normalizeTimeoutSeconds(raw: number | undefined): number {\n\tif (raw === undefined) return DEFAULT_LINT_RUN_TIMEOUT_SECONDS;\n\tconst value = Math.floor(raw);\n\tif (!Number.isFinite(value) || value <= 0) {\n\t\tthrow new Error(\"timeout must be a positive number.\");\n\t}\n\treturn value;\n}\n\nfunction normalizeStringArray(raw: string[] | undefined): string[] {\n\treturn (raw ?? []).map((item) => String(item));\n}\n\nfunction normalizeScriptName(raw: string | undefined, mode: LintRunMode): string {\n\tconst fallback = mode === \"fix\" ? \"lint:fix\" : \"lint\";\n\tconst script = (raw ?? fallback).trim();\n\tif (script.length === 0) {\n\t\tthrow new Error(\"script must not be empty.\");\n\t}\n\treturn script;\n}\n\nfunction hasAnyFile(cwd: string, fileNames: string[]): boolean {\n\treturn fileNames.some((name) => existsSync(join(cwd, name)));\n}\n\nfunction hasEslintConfig(cwd: string, packageJsonEslintConfig: unknown): boolean {\n\tif (packageJsonEslintConfig && typeof packageJsonEslintConfig === \"object\") {\n\t\treturn true;\n\t}\n\treturn hasAnyFile(cwd, [\n\t\t\"eslint.config.js\",\n\t\t\"eslint.config.cjs\",\n\t\t\"eslint.config.mjs\",\n\t\t\"eslint.config.ts\",\n\t\t\"eslint.config.mts\",\n\t\t\"eslint.config.cts\",\n\t\t\".eslintrc\",\n\t\t\".eslintrc.js\",\n\t\t\".eslintrc.cjs\",\n\t\t\".eslintrc.mjs\",\n\t\t\".eslintrc.yaml\",\n\t\t\".eslintrc.yml\",\n\t\t\".eslintrc.json\",\n\t]);\n}\n\nfunction hasStylelintConfig(cwd: string, packageJsonStylelint: unknown): boolean {\n\tif (packageJsonStylelint && typeof packageJsonStylelint === \"object\") {\n\t\treturn true;\n\t}\n\treturn hasAnyFile(cwd, [\n\t\t\"stylelint.config.js\",\n\t\t\"stylelint.config.cjs\",\n\t\t\"stylelint.config.mjs\",\n\t\t\"stylelint.config.ts\",\n\t\t\"stylelint.config.mts\",\n\t\t\"stylelint.config.cts\",\n\t\t\".stylelintrc\",\n\t\t\".stylelintrc.js\",\n\t\t\".stylelintrc.cjs\",\n\t\t\".stylelintrc.mjs\",\n\t\t\".stylelintrc.yaml\",\n\t\t\".stylelintrc.yml\",\n\t\t\".stylelintrc.json\",\n\t]);\n}\n\nfunction hasPrettierConfig(cwd: string, packageJsonPrettier: unknown): boolean {\n\tif (typeof packageJsonPrettier === \"string\" || (packageJsonPrettier && typeof packageJsonPrettier === \"object\")) {\n\t\treturn true;\n\t}\n\treturn hasAnyFile(cwd, [\n\t\t\".prettierrc\",\n\t\t\".prettierrc.js\",\n\t\t\".prettierrc.cjs\",\n\t\t\".prettierrc.mjs\",\n\t\t\".prettierrc.json\",\n\t\t\".prettierrc.yaml\",\n\t\t\".prettierrc.yml\",\n\t\t\".prettierrc.toml\",\n\t\t\"prettier.config.js\",\n\t\t\"prettier.config.cjs\",\n\t\t\"prettier.config.mjs\",\n\t]);\n}\n\nfunction assertPackageManagerAvailable(packageManager: PackageManager): void {\n\tif (packageManager === \"bun\") {\n\t\tensureCommandOrThrow(\"bun\", 'Command \"bun\" is required for bun-based lint execution.');\n\t\treturn;\n\t}\n\tensureCommandOrThrow(packageManager, `Command \"${packageManager}\" is required for lint execution.`);\n}\n\nfunction resolveScriptBasedCommand(packageManager: PackageManager, script: string, args: string[]): ResolvedLintCommand {\n\tassertPackageManagerAvailable(packageManager);\n\tconst invocation = resolvePackageManagerRunInvocation(packageManager, script, args);\n\treturn {\n\t\tresolvedRunner: packageManager,\n\t\tcommand: invocation.command,\n\t\targs: invocation.args,\n\t};\n}\n\nfunction buildDirectLintArgs(\n\trunner: \"eslint\" | \"prettier\" | \"stylelint\",\n\tmode: LintRunMode,\n\ttargets: string[],\n\targs: string[],\n): string[] {\n\tconst effectiveTargets =\n\t\ttargets.length > 0 ? targets : runner === \"stylelint\" ? [\"**/*.{css,scss,sass,less}\"] : [\".\"];\n\n\tif (runner === \"eslint\") {\n\t\tconst modeArgs = mode === \"fix\" ? [\"--fix\"] : [];\n\t\treturn [...modeArgs, ...args, ...effectiveTargets];\n\t}\n\tif (runner === \"prettier\") {\n\t\tconst modeArgs = mode === \"fix\" ? [\"--write\"] : [\"--check\"];\n\t\treturn [...modeArgs, ...args, ...effectiveTargets];\n\t}\n\tconst modeArgs = mode === \"fix\" ? [\"--fix\"] : [];\n\treturn [...modeArgs, ...args, ...effectiveTargets];\n}\n\nfunction resolveDirectLintCommand(\n\tpackageManager: PackageManager,\n\trunner: \"eslint\" | \"prettier\" | \"stylelint\",\n\tmode: LintRunMode,\n\ttargets: string[],\n\targs: string[],\n): ResolvedLintCommand {\n\tassertPackageManagerAvailable(packageManager);\n\tconst directArgs = buildDirectLintArgs(runner, mode, targets, args);\n\tconst invocation = resolvePackageManagerExecInvocation(packageManager, runner, directArgs);\n\tensureCommandOrThrow(\n\t\tinvocation.command,\n\t\t`Command \"${invocation.command}\" is required to run ${runner}. Install ${packageManager} tooling first.`,\n\t);\n\treturn {\n\t\tresolvedRunner: runner,\n\t\tcommand: invocation.command,\n\t\targs: invocation.args,\n\t};\n}\n\nfunction resolveAutoRunner(cwd: string, script: string): ResolvedLintRunner {\n\tconst packageJson = readPackageJson(cwd);\n\tif (packageJson?.scripts[script]) {\n\t\treturn detectPackageManager(cwd);\n\t}\n\tif (hasEslintConfig(cwd, packageJson?.raw?.eslintConfig)) return \"eslint\";\n\tif (hasStylelintConfig(cwd, packageJson?.raw?.stylelint)) return \"stylelint\";\n\tif (hasPrettierConfig(cwd, packageJson?.raw?.prettier)) return \"prettier\";\n\tthrow new Error(\n\t\t'Unable to auto-detect lint runner. Expected package.json lint script or eslint/stylelint/prettier config.',\n\t);\n}\n\nfunction hasCheckModeConflictArgs(args: string[]): string | undefined {\n\tfor (const arg of args) {\n\t\tif (arg === \"--fix\" || arg.startsWith(\"--fix=\") || arg === \"--write\" || arg.startsWith(\"--write=\")) {\n\t\t\treturn arg;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction resolveLintCommand(input: {\n\tcwd: string;\n\trunner: LintRunRunner;\n\tmode: LintRunMode;\n\tscript: string;\n\targs: string[];\n\ttargets: string[];\n}): ResolvedLintCommand {\n\tconst packageJson = readPackageJson(input.cwd);\n\tlet resolvedRunner: ResolvedLintRunner;\n\n\tif (input.runner === \"auto\") {\n\t\tresolvedRunner = resolveAutoRunner(input.cwd, input.script);\n\t} else {\n\t\tresolvedRunner = input.runner;\n\t}\n\n\tif (resolvedRunner === \"npm\" || resolvedRunner === \"pnpm\" || resolvedRunner === \"yarn\" || resolvedRunner === \"bun\") {\n\t\tif (!packageJson) {\n\t\t\tthrow new Error(`package.json is required to run ${resolvedRunner} scripts.`);\n\t\t}\n\t\tif (!packageJson.scripts[input.script]) {\n\t\t\tthrow new Error(`Script \"${input.script}\" is not defined in package.json.`);\n\t\t}\n\t\treturn resolveScriptBasedCommand(resolvedRunner, input.script, input.args);\n\t}\n\n\tconst packageManager = detectPackageManager(input.cwd);\n\treturn resolveDirectLintCommand(packageManager, resolvedRunner, input.mode, input.targets, input.args);\n}\n\nfunction mapLintStatus(exitCode: number): LintRunStatus {\n\tif (exitCode === 0) return \"passed\";\n\tif (exitCode === 1) return \"failed\";\n\treturn \"error\";\n}\n\nfunction renderSummary(details: LintRunToolDetails, output: string): string {\n\tconst argsText = details.resolvedArgs.length > 0 ? ` ${details.resolvedArgs.join(\" \")}` : \"\";\n\treturn [\n\t\t`lint_run status: ${details.status}`,\n\t\t`runner: ${details.resolvedRunner}`,\n\t\t`mode: ${details.mode}`,\n\t\t`command: ${details.resolvedCommand}${argsText}`,\n\t\t`cwd: ${details.cwd}`,\n\t\t`exit_code: ${details.exitCode}`,\n\t\t`duration_ms: ${details.durationMs}`,\n\t\t\"\",\n\t\toutput,\n\t].join(\"\\n\");\n}\n\nexport function createLintRunTool(cwd: string): AgentTool<typeof lintRunSchema> {\n\treturn {\n\t\tname: \"lint_run\",\n\t\tlabel: \"lint_run\",\n\t\tdescription:\n\t\t\t\"Structured lint runner with auto detection across npm/pnpm/yarn/bun scripts and eslint/prettier/stylelint direct execution. Returns normalized status without throwing on ordinary lint failures.\",\n\t\tparameters: lintRunSchema,\n\t\texecute: async (_toolCallId: string, input: LintRunToolInput, signal?: AbortSignal) => {\n\t\t\tconst executionCwd = resolveToCwd(input.path || \".\", cwd);\n\t\t\tconst timeoutSeconds = normalizeTimeoutSeconds(input.timeout);\n\t\t\tconst args = normalizeStringArray(input.args);\n\t\t\tconst targets = normalizeStringArray(input.targets);\n\t\t\tconst mode: LintRunMode = input.mode ?? \"check\";\n\t\t\tconst script = normalizeScriptName(input.script, mode);\n\t\t\tconst runner: LintRunRunner = input.runner ?? \"auto\";\n\n\t\t\tif (mode === \"check\") {\n\t\t\t\tconst conflictArg = hasCheckModeConflictArgs(args);\n\t\t\t\tif (conflictArg) {\n\t\t\t\t\tthrow new Error(`Argument \"${conflictArg}\" is incompatible with mode=check.`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst command = resolveLintCommand({\n\t\t\t\tcwd: executionCwd,\n\t\t\t\trunner,\n\t\t\t\tmode,\n\t\t\t\tscript,\n\t\t\t\targs,\n\t\t\t\ttargets,\n\t\t\t});\n\n\t\t\tconst result = await runVerificationCommand({\n\t\t\t\tcommand: command.command,\n\t\t\t\targs: command.args,\n\t\t\t\tcwd: executionCwd,\n\t\t\t\ttimeoutMs: timeoutSeconds * 1000,\n\t\t\t\tsignal,\n\t\t\t});\n\n\t\t\tconst status = mapLintStatus(result.exitCode);\n\t\t\tconst formatted = formatVerificationOutput(\n\t\t\t\tresult.stdout,\n\t\t\t\tresult.stderr,\n\t\t\t\tresult.captureTruncated,\n\t\t\t\t\"No lint output\",\n\t\t\t);\n\n\t\t\tconst details: LintRunToolDetails = {\n\t\t\t\tresolvedRunner: command.resolvedRunner,\n\t\t\t\tresolvedCommand: command.command,\n\t\t\t\tresolvedArgs: command.args,\n\t\t\t\tcwd: executionCwd,\n\t\t\t\tmode,\n\t\t\t\texitCode: result.exitCode,\n\t\t\t\tstatus,\n\t\t\t\tdurationMs: result.durationMs,\n\t\t\t\tcaptureTruncated: result.captureTruncated || undefined,\n\t\t\t\ttruncation: formatted.truncation,\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tcontent: [{ type: \"text\", text: renderSummary(details, formatted.text) }],\n\t\t\t\tdetails,\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport const lintRunTool = createLintRunTool(process.cwd());\n\n"]}
|
package/dist/core/tools/task.js
CHANGED
|
@@ -69,7 +69,7 @@ const systemPromptByProfile = {
|
|
|
69
69
|
cycle_planner: "You are an IOSM cycle planner. Propose and align cycle goals with measurable outcomes and concrete risks.",
|
|
70
70
|
full: "You are a software engineering agent. Execute the task end-to-end.",
|
|
71
71
|
};
|
|
72
|
-
const writeCapableTools = new Set(["bash", "edit", "write", "fs_ops"]);
|
|
72
|
+
const writeCapableTools = new Set(["bash", "edit", "write", "git_write", "fs_ops"]);
|
|
73
73
|
const backgroundUnsafeTools = new Set(writeCapableTools);
|
|
74
74
|
const writeCapableProfiles = new Set(Object.keys(toolsByProfile).filter((profileName) => toolsByProfile[profileName].some((tool) => writeCapableTools.has(tool))));
|
|
75
75
|
const backgroundSafeProfiles = Object.keys(toolsByProfile).filter((profileName) => toolsByProfile[profileName].every((tool) => !backgroundUnsafeTools.has(tool)));
|