@iaforged/context-code 1.2.8 → 1.2.10
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/README.md +119 -119
- package/context-bootstrap.js +26 -26
- package/dist/src/QueryEngine.js +394 -327
- package/dist/src/bridge/bridgeUI.js +1 -1
- package/dist/src/buddy/prompt.js +4 -4
- package/dist/src/cli/handlers/auth.js +126 -9
- package/dist/src/cli/print.js +35 -1
- package/dist/src/commands/agent/agent.js +28 -2
- package/dist/src/commands/agent/agentStore.js +8 -1
- package/dist/src/commands/agent/index.js +1 -1
- package/dist/src/commands/bridge-kick.js +9 -9
- package/dist/src/commands/commit.js +34 -34
- package/dist/src/commands/init-verifiers.js +3 -3
- package/dist/src/commands/init.js +88 -88
- package/dist/src/commands/insights.js +787 -787
- package/dist/src/commands/install.js +19 -19
- package/dist/src/commands/login/login.js +21 -12
- package/dist/src/commands/logout/logout.js +9 -0
- package/dist/src/commands/model/model.js +9 -4
- package/dist/src/commands/orchestrate/SwarmUI.js +50 -0
- package/dist/src/commands/orchestrate/index.js +2 -2
- package/dist/src/commands/orchestrate/orchestrate.js +708 -12
- package/dist/src/commands/pr_comments/index.js +33 -33
- package/dist/src/commands/profile/index.js +1 -1
- package/dist/src/commands/profile/profile.js +52 -3
- package/dist/src/commands/provider/index.js +1 -1
- package/dist/src/commands/provider/provider.js +117 -45
- package/dist/src/commands/resumen/index.js +9 -0
- package/dist/src/commands/resumen/resumen.js +29 -0
- package/dist/src/commands/security-review.js +190 -190
- package/dist/src/commands/swarm-auto/index.js +9 -0
- package/dist/src/commands/swarm-auto/swarmAuto.js +111 -0
- package/dist/src/commands/swarm-init/index.js +9 -0
- package/dist/src/commands/swarm-init/swarmInit.js +72 -0
- package/dist/src/commands/team/team.js +39 -6
- package/dist/src/commands.js +14 -0
- package/dist/src/components/LogoV2/CondensedLogo.js +2 -2
- package/dist/src/components/PromptInput/PromptInputQueuedCommands.js +3 -3
- package/dist/src/components/agents/agentFileUtils.js +6 -6
- package/dist/src/components/permissions/hooks.js +5 -5
- package/dist/src/constants/outputStyles.js +83 -83
- package/dist/src/core/agents/blueprints.js +58 -0
- package/dist/src/core/agents/cliAdapter.js +61 -0
- package/dist/src/core/agents/registry.js +93 -0
- package/dist/src/core/agents/runtime.js +4 -0
- package/dist/src/core/agents/runtime.smoke.js +42 -0
- package/dist/src/core/agents/swarm.smoke.js +48 -0
- package/dist/src/core/agents/swarmTools.js +38 -0
- package/dist/src/core/auth/index.js +2 -0
- package/dist/src/core/auth/loginCliAdapter.js +24 -0
- package/dist/src/core/auth/loginCore.js +67 -0
- package/dist/src/core/auth/logoutCliAdapter.js +34 -0
- package/dist/src/core/auth/logoutCore.js +52 -0
- package/dist/src/core/auth/preflight.smoke.js +151 -0
- package/dist/src/core/index.js +21 -0
- package/dist/src/core/mcp/blueprints.js +27 -0
- package/dist/src/core/mcp/common.js +14 -0
- package/dist/src/core/mcp/runtime.js +67 -0
- package/dist/src/core/mcp/runtime.smoke.js +50 -0
- package/dist/src/core/mcp/swarmClient.js +40 -0
- package/dist/src/core/mcp/swarmSetup.js +43 -0
- package/dist/src/core/providers/cliAdapter.js +39 -0
- package/dist/src/core/providers/contracts.js +1 -0
- package/dist/src/core/providers/index.js +3 -0
- package/dist/src/core/providers/llmCore.js +123 -0
- package/dist/src/core/providers/providerCore.js +141 -0
- package/dist/src/core/providers/providerModelCompatibility.js +98 -0
- package/dist/src/core/providers/providerParitySmoke.js +83 -0
- package/dist/src/core/providers/providerProfileModelSmoke.js +80 -0
- package/dist/src/core/query/contracts.js +1 -0
- package/dist/src/core/query/runtime.js +117 -0
- package/dist/src/core/query/runtime.smoke.js +39 -0
- package/dist/src/core/query/timelineThinking.smoke.js +25 -0
- package/dist/src/core/query/wiring.smoke.js +76 -0
- package/dist/src/core/skills/cliAdapter.js +38 -0
- package/dist/src/core/skills/index.js +52 -0
- package/dist/src/core/skills/runtime.smoke.js +53 -0
- package/dist/src/core/tasks/runtime.js +205 -0
- package/dist/src/core/tasks/runtime.smoke.js +63 -0
- package/dist/src/core/tasks/sdkAdapter.js +4 -0
- package/dist/src/core/tools/contracts.js +3 -0
- package/dist/src/core/tools/fileResolution.js +112 -0
- package/dist/src/core/tools/fileResolution.smoke.js +33 -0
- package/dist/src/core/tools/filesCore.js +51 -0
- package/dist/src/core/tools/filesCore.smoke.js +108 -0
- package/dist/src/core/tools/gitCore.js +20 -0
- package/dist/src/core/tools/imageParity.smoke.js +36 -0
- package/dist/src/core/tools/notebookParity.smoke.js +68 -0
- package/dist/src/core/tools/registry.js +22 -0
- package/dist/src/core/tools/runtime.smoke.js +32 -0
- package/dist/src/core/tools/shellCore.js +60 -0
- package/dist/src/core/types/agentContext.js +9 -0
- package/dist/src/core/types/auth.js +3 -0
- package/dist/src/core/types/command.js +13 -0
- package/dist/src/core/types/provider.js +3 -0
- package/dist/src/core/types/sdkEvent.js +10 -0
- package/dist/src/core/types/swarm.js +1 -0
- package/dist/src/cost-tracker.js +3 -3
- package/dist/src/hooks/useAwaySummary.js +22 -9
- package/dist/src/main.js +32 -2
- package/dist/src/screens/REPL.js +9 -0
- package/dist/src/services/AgentSummary/agentSummary.js +10 -10
- package/dist/src/services/autoDream/autoDream.js +5 -5
- package/dist/src/services/autoDream/consolidationPrompt.js +49 -49
- package/dist/src/services/compact/prompt.js +238 -238
- package/dist/src/services/limits/sessionCounter.js +17 -17
- package/dist/src/services/mcp/client.js +27 -1
- package/dist/src/services/orchestration/execution/AgentTaskExecutor.js +39 -20
- package/dist/src/services/orchestration/execution/OrchestrationExecutionRuntime.js +65 -58
- package/dist/src/skills/bundled/loop.js +57 -57
- package/dist/src/skills/bundled/remember.js +53 -53
- package/dist/src/skills/bundled/simplify.js +49 -49
- package/dist/src/skills/bundled/skillify.js +2 -2
- package/dist/src/state/onChangeAppState.js +6 -0
- package/dist/src/tasks/LocalAgentTask/LocalAgentTask.js +5 -5
- package/dist/src/tasks/LocalMainSessionTask.js +5 -5
- package/dist/src/tasks/LocalShellTask/LocalShellTask.js +13 -13
- package/dist/src/tools/AgentTool/forkSubagent.js +25 -25
- package/dist/src/tools/AskUserQuestionTool/prompt.js +29 -29
- package/dist/src/tools/BashTool/BashTool.js +27 -2
- package/dist/src/tools/BriefTool/prompt.js +14 -14
- package/dist/src/tools/EnterPlanModeTool/EnterPlanModeTool.js +12 -12
- package/dist/src/tools/EnterPlanModeTool/prompt.js +140 -140
- package/dist/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.js +18 -18
- package/dist/src/tools/ExitPlanModeTool/prompt.js +23 -23
- package/dist/src/tools/ExitWorktreeTool/prompt.js +29 -29
- package/dist/src/tools/FileEditTool/prompt.js +7 -7
- package/dist/src/tools/FileReadTool/FileReadTool.js +18 -1
- package/dist/src/tools/FileWriteTool/prompt.js +6 -6
- package/dist/src/tools/GlobTool/prompt.js +4 -4
- package/dist/src/tools/GrepTool/prompt.js +10 -10
- package/dist/src/tools/LSPTool/prompt.js +18 -18
- package/dist/src/tools/ListMcpResourcesTool/prompt.js +15 -15
- package/dist/src/tools/PowerShellTool/PowerShellTool.js +25 -2
- package/dist/src/tools/ReadMcpResourceTool/prompt.js +13 -13
- package/dist/src/tools/SendMessageTool/prompt.js +36 -36
- package/dist/src/tools/SkillTool/prompt.js +21 -21
- package/dist/src/tools/SleepTool/prompt.js +10 -10
- package/dist/src/tools/TaskCreateTool/prompt.js +41 -41
- package/dist/src/tools/TaskGetTool/prompt.js +21 -21
- package/dist/src/tools/TaskListTool/prompt.js +30 -30
- package/dist/src/tools/TaskOutputTool/TaskOutputTool.js +8 -8
- package/dist/src/tools/TaskStopTool/prompt.js +5 -5
- package/dist/src/tools/TaskUpdateTool/prompt.js +74 -74
- package/dist/src/tools/TodoWriteTool/prompt.js +178 -178
- package/dist/src/tools/ToolSearchTool/prompt.js +9 -9
- package/dist/src/tools/WebFetchTool/WebFetchTool.js +9 -9
- package/dist/src/tools/WebFetchTool/prompt.js +31 -31
- package/dist/src/tools/WebSearchTool/prompt.js +26 -26
- package/dist/src/utils/agentContext.js +2 -0
- package/dist/src/utils/agenticSessionSearch.js +38 -38
- package/dist/src/utils/config.js +2 -0
- package/dist/src/utils/genericProcessUtils.js +21 -21
- package/dist/src/utils/heapDumpService.js +4 -4
- package/dist/src/utils/mcpValidation.js +2 -2
- package/dist/src/utils/model/modelStrings.js +1 -1
- package/dist/src/utils/model/providers.js +5 -0
- package/dist/src/utils/orchestration/store/providerAgentStore.js +22 -22
- package/dist/src/utils/orchestration/store/providerWorkspaceStore.js +10 -10
- package/dist/src/utils/orchestration/store/runStore.js +68 -68
- package/dist/src/utils/orchestration/store/teamStore.js +28 -28
- package/dist/src/utils/permissions/permissionExplainer.js +6 -6
- package/dist/src/utils/permissions/permissionsDb.js +43 -43
- package/dist/src/utils/sdkEventQueue.js +2 -0
- package/dist/src/utils/secureStorage/sqliteStorage.js +12 -12
- package/dist/src/utils/standardMcp/common.js +15 -0
- package/dist/src/utils/standardMcp/setup.js +52 -0
- package/dist/src/utils/swarm/teammatePromptAddendum.js +10 -10
- package/dist/src/utils/task/framework.js +6 -6
- package/package.json +1 -1
- package/dist/src/commands/usage/index.js +0 -7
- package/dist/src/commands/usage/usage.js +0 -5
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { isPlanModeInterviewPhaseEnabled } from '../../utils/planModeV2.js';
|
|
2
2
|
import { ASK_USER_QUESTION_TOOL_NAME } from '../AskUserQuestionTool/prompt.js';
|
|
3
|
-
const WHAT_HAPPENS_SECTION = `## What Happens in Plan Mode
|
|
4
|
-
|
|
5
|
-
In plan mode, you'll:
|
|
6
|
-
1. Thoroughly explore the codebase using Glob, Grep, and Read tools
|
|
7
|
-
2. Understand existing patterns and architecture
|
|
8
|
-
3. Design an implementation approach
|
|
9
|
-
4. Present your plan to the user for approval
|
|
10
|
-
5. Use ${ASK_USER_QUESTION_TOOL_NAME} if you need to clarify approaches
|
|
11
|
-
6. Exit plan mode with ExitPlanMode when ready to implement
|
|
12
|
-
|
|
3
|
+
const WHAT_HAPPENS_SECTION = `## What Happens in Plan Mode
|
|
4
|
+
|
|
5
|
+
In plan mode, you'll:
|
|
6
|
+
1. Thoroughly explore the codebase using Glob, Grep, and Read tools
|
|
7
|
+
2. Understand existing patterns and architecture
|
|
8
|
+
3. Design an implementation approach
|
|
9
|
+
4. Present your plan to the user for approval
|
|
10
|
+
5. Use ${ASK_USER_QUESTION_TOOL_NAME} if you need to clarify approaches
|
|
11
|
+
6. Exit plan mode with ExitPlanMode when ready to implement
|
|
12
|
+
|
|
13
13
|
`;
|
|
14
14
|
function getEnterPlanModeToolPromptExternal() {
|
|
15
15
|
// When interview phase is enabled, omit the "What Happens" section —
|
|
@@ -17,81 +17,81 @@ function getEnterPlanModeToolPromptExternal() {
|
|
|
17
17
|
const whatHappens = isPlanModeInterviewPhaseEnabled()
|
|
18
18
|
? ''
|
|
19
19
|
: WHAT_HAPPENS_SECTION;
|
|
20
|
-
return `Use this tool proactively when you're about to start a non-trivial implementation task. Getting user sign-off on your approach before writing code prevents wasted effort and ensures alignment. This tool transitions you into plan mode where you can explore the codebase and design an implementation approach for user approval.
|
|
21
|
-
|
|
22
|
-
## When to Use This Tool
|
|
23
|
-
|
|
24
|
-
**Prefer using EnterPlanMode** for implementation tasks unless they're simple. Use it when ANY of these conditions apply:
|
|
25
|
-
|
|
26
|
-
1. **New Feature Implementation**: Adding meaningful new functionality
|
|
27
|
-
- Example: "Add a logout button" - where should it go? What should happen on click?
|
|
28
|
-
- Example: "Add form validation" - what rules? What error messages?
|
|
29
|
-
|
|
30
|
-
2. **Multiple Valid Approaches**: The task can be solved in several different ways
|
|
31
|
-
- Example: "Add caching to the API" - could use Redis, in-memory, file-based, etc.
|
|
32
|
-
- Example: "Improve performance" - many optimization strategies possible
|
|
33
|
-
|
|
34
|
-
3. **Code Modifications**: Changes that affect existing behavior or structure
|
|
35
|
-
- Example: "Update the login flow" - what exactly should change?
|
|
36
|
-
- Example: "Refactor this component" - what's the target architecture?
|
|
37
|
-
|
|
38
|
-
4. **Architectural Decisions**: The task requires choosing between patterns or technologies
|
|
39
|
-
- Example: "Add real-time updates" - WebSockets vs SSE vs polling
|
|
40
|
-
- Example: "Implement state management" - Redux vs Context vs custom solution
|
|
41
|
-
|
|
42
|
-
5. **Multi-File Changes**: The task will likely touch more than 2-3 files
|
|
43
|
-
- Example: "Refactor the authentication system"
|
|
44
|
-
- Example: "Add a new API endpoint with tests"
|
|
45
|
-
|
|
46
|
-
6. **Unclear Requirements**: You need to explore before understanding the full scope
|
|
47
|
-
- Example: "Make the app faster" - need to profile and identify bottlenecks
|
|
48
|
-
- Example: "Fix the bug in checkout" - need to investigate root cause
|
|
49
|
-
|
|
50
|
-
7. **User Preferences Matter**: The implementation could reasonably go multiple ways
|
|
51
|
-
- If you would use ${ASK_USER_QUESTION_TOOL_NAME} to clarify the approach, use EnterPlanMode instead
|
|
52
|
-
- Plan mode lets you explore first, then present options with context
|
|
53
|
-
|
|
54
|
-
## When NOT to Use This Tool
|
|
55
|
-
|
|
56
|
-
Only skip EnterPlanMode for simple tasks:
|
|
57
|
-
- Single-line or few-line fixes (typos, obvious bugs, small tweaks)
|
|
58
|
-
- Adding a single function with clear requirements
|
|
59
|
-
- Tasks where the user has given very specific, detailed instructions
|
|
60
|
-
- Pure research/exploration tasks (use the Agent tool with explore agent instead)
|
|
61
|
-
|
|
62
|
-
${whatHappens}## Examples
|
|
63
|
-
|
|
64
|
-
### GOOD - Use EnterPlanMode:
|
|
65
|
-
User: "Add user authentication to the app"
|
|
66
|
-
- Requires architectural decisions (session vs JWT, where to store tokens, middleware structure)
|
|
67
|
-
|
|
68
|
-
User: "Optimize the database queries"
|
|
69
|
-
- Multiple approaches possible, need to profile first, significant impact
|
|
70
|
-
|
|
71
|
-
User: "Implement dark mode"
|
|
72
|
-
- Architectural decision on theme system, affects many components
|
|
73
|
-
|
|
74
|
-
User: "Add a delete button to the user profile"
|
|
75
|
-
- Seems simple but involves: where to place it, confirmation dialog, API call, error handling, state updates
|
|
76
|
-
|
|
77
|
-
User: "Update the error handling in the API"
|
|
78
|
-
- Affects multiple files, user should approve the approach
|
|
79
|
-
|
|
80
|
-
### BAD - Don't use EnterPlanMode:
|
|
81
|
-
User: "Fix the typo in the README"
|
|
82
|
-
- Straightforward, no planning needed
|
|
83
|
-
|
|
84
|
-
User: "Add a console.log to debug this function"
|
|
85
|
-
- Simple, obvious implementation
|
|
86
|
-
|
|
87
|
-
User: "What files handle routing?"
|
|
88
|
-
- Research task, not implementation planning
|
|
89
|
-
|
|
90
|
-
## Important Notes
|
|
91
|
-
|
|
92
|
-
- This tool REQUIRES user approval - they must consent to entering plan mode
|
|
93
|
-
- If unsure whether to use it, err on the side of planning - it's better to get alignment upfront than to redo work
|
|
94
|
-
- Users appreciate being consulted before significant changes are made to their codebase
|
|
20
|
+
return `Use this tool proactively when you're about to start a non-trivial implementation task. Getting user sign-off on your approach before writing code prevents wasted effort and ensures alignment. This tool transitions you into plan mode where you can explore the codebase and design an implementation approach for user approval.
|
|
21
|
+
|
|
22
|
+
## When to Use This Tool
|
|
23
|
+
|
|
24
|
+
**Prefer using EnterPlanMode** for implementation tasks unless they're simple. Use it when ANY of these conditions apply:
|
|
25
|
+
|
|
26
|
+
1. **New Feature Implementation**: Adding meaningful new functionality
|
|
27
|
+
- Example: "Add a logout button" - where should it go? What should happen on click?
|
|
28
|
+
- Example: "Add form validation" - what rules? What error messages?
|
|
29
|
+
|
|
30
|
+
2. **Multiple Valid Approaches**: The task can be solved in several different ways
|
|
31
|
+
- Example: "Add caching to the API" - could use Redis, in-memory, file-based, etc.
|
|
32
|
+
- Example: "Improve performance" - many optimization strategies possible
|
|
33
|
+
|
|
34
|
+
3. **Code Modifications**: Changes that affect existing behavior or structure
|
|
35
|
+
- Example: "Update the login flow" - what exactly should change?
|
|
36
|
+
- Example: "Refactor this component" - what's the target architecture?
|
|
37
|
+
|
|
38
|
+
4. **Architectural Decisions**: The task requires choosing between patterns or technologies
|
|
39
|
+
- Example: "Add real-time updates" - WebSockets vs SSE vs polling
|
|
40
|
+
- Example: "Implement state management" - Redux vs Context vs custom solution
|
|
41
|
+
|
|
42
|
+
5. **Multi-File Changes**: The task will likely touch more than 2-3 files
|
|
43
|
+
- Example: "Refactor the authentication system"
|
|
44
|
+
- Example: "Add a new API endpoint with tests"
|
|
45
|
+
|
|
46
|
+
6. **Unclear Requirements**: You need to explore before understanding the full scope
|
|
47
|
+
- Example: "Make the app faster" - need to profile and identify bottlenecks
|
|
48
|
+
- Example: "Fix the bug in checkout" - need to investigate root cause
|
|
49
|
+
|
|
50
|
+
7. **User Preferences Matter**: The implementation could reasonably go multiple ways
|
|
51
|
+
- If you would use ${ASK_USER_QUESTION_TOOL_NAME} to clarify the approach, use EnterPlanMode instead
|
|
52
|
+
- Plan mode lets you explore first, then present options with context
|
|
53
|
+
|
|
54
|
+
## When NOT to Use This Tool
|
|
55
|
+
|
|
56
|
+
Only skip EnterPlanMode for simple tasks:
|
|
57
|
+
- Single-line or few-line fixes (typos, obvious bugs, small tweaks)
|
|
58
|
+
- Adding a single function with clear requirements
|
|
59
|
+
- Tasks where the user has given very specific, detailed instructions
|
|
60
|
+
- Pure research/exploration tasks (use the Agent tool with explore agent instead)
|
|
61
|
+
|
|
62
|
+
${whatHappens}## Examples
|
|
63
|
+
|
|
64
|
+
### GOOD - Use EnterPlanMode:
|
|
65
|
+
User: "Add user authentication to the app"
|
|
66
|
+
- Requires architectural decisions (session vs JWT, where to store tokens, middleware structure)
|
|
67
|
+
|
|
68
|
+
User: "Optimize the database queries"
|
|
69
|
+
- Multiple approaches possible, need to profile first, significant impact
|
|
70
|
+
|
|
71
|
+
User: "Implement dark mode"
|
|
72
|
+
- Architectural decision on theme system, affects many components
|
|
73
|
+
|
|
74
|
+
User: "Add a delete button to the user profile"
|
|
75
|
+
- Seems simple but involves: where to place it, confirmation dialog, API call, error handling, state updates
|
|
76
|
+
|
|
77
|
+
User: "Update the error handling in the API"
|
|
78
|
+
- Affects multiple files, user should approve the approach
|
|
79
|
+
|
|
80
|
+
### BAD - Don't use EnterPlanMode:
|
|
81
|
+
User: "Fix the typo in the README"
|
|
82
|
+
- Straightforward, no planning needed
|
|
83
|
+
|
|
84
|
+
User: "Add a console.log to debug this function"
|
|
85
|
+
- Simple, obvious implementation
|
|
86
|
+
|
|
87
|
+
User: "What files handle routing?"
|
|
88
|
+
- Research task, not implementation planning
|
|
89
|
+
|
|
90
|
+
## Important Notes
|
|
91
|
+
|
|
92
|
+
- This tool REQUIRES user approval - they must consent to entering plan mode
|
|
93
|
+
- If unsure whether to use it, err on the side of planning - it's better to get alignment upfront than to redo work
|
|
94
|
+
- Users appreciate being consulted before significant changes are made to their codebase
|
|
95
95
|
`;
|
|
96
96
|
}
|
|
97
97
|
function getEnterPlanModeToolPromptAnt() {
|
|
@@ -100,61 +100,61 @@ function getEnterPlanModeToolPromptAnt() {
|
|
|
100
100
|
const whatHappens = isPlanModeInterviewPhaseEnabled()
|
|
101
101
|
? ''
|
|
102
102
|
: WHAT_HAPPENS_SECTION;
|
|
103
|
-
return `Use this tool when a task has genuine ambiguity about the right approach and getting user input before coding would prevent significant rework. This tool transitions you into plan mode where you can explore the codebase and design an implementation approach for user approval.
|
|
104
|
-
|
|
105
|
-
## When to Use This Tool
|
|
106
|
-
|
|
107
|
-
Plan mode is valuable when the implementation approach is genuinely unclear. Use it when:
|
|
108
|
-
|
|
109
|
-
1. **Significant Architectural Ambiguity**: Multiple reasonable approaches exist and the choice meaningfully affects the codebase
|
|
110
|
-
- Example: "Add caching to the API" - Redis vs in-memory vs file-based
|
|
111
|
-
- Example: "Add real-time updates" - WebSockets vs SSE vs polling
|
|
112
|
-
|
|
113
|
-
2. **Unclear Requirements**: You need to explore and clarify before you can make progress
|
|
114
|
-
- Example: "Make the app faster" - need to profile and identify bottlenecks
|
|
115
|
-
- Example: "Refactor this module" - need to understand what the target architecture should be
|
|
116
|
-
|
|
117
|
-
3. **High-Impact Restructuring**: The task will significantly restructure existing code and getting buy-in first reduces risk
|
|
118
|
-
- Example: "Redesign the authentication system"
|
|
119
|
-
- Example: "Migrate from one state management approach to another"
|
|
120
|
-
|
|
121
|
-
## When NOT to Use This Tool
|
|
122
|
-
|
|
123
|
-
Skip plan mode when you can reasonably infer the right approach:
|
|
124
|
-
- The task is straightforward even if it touches multiple files
|
|
125
|
-
- The user's request is specific enough that the implementation path is clear
|
|
126
|
-
- You're adding a feature with an obvious implementation pattern (e.g., adding a button, a new endpoint following existing conventions)
|
|
127
|
-
- Bug fixes where the fix is clear once you understand the bug
|
|
128
|
-
- Research/exploration tasks (use the Agent tool instead)
|
|
129
|
-
- The user says something like "can we work on X" or "let's do X" — just get started
|
|
130
|
-
|
|
131
|
-
When in doubt, prefer starting work and using ${ASK_USER_QUESTION_TOOL_NAME} for specific questions over entering a full planning phase.
|
|
132
|
-
|
|
133
|
-
${whatHappens}## Examples
|
|
134
|
-
|
|
135
|
-
### GOOD - Use EnterPlanMode:
|
|
136
|
-
User: "Add user authentication to the app"
|
|
137
|
-
- Genuinely ambiguous: session vs JWT, where to store tokens, middleware structure
|
|
138
|
-
|
|
139
|
-
User: "Redesign the data pipeline"
|
|
140
|
-
- Major restructuring where the wrong approach wastes significant effort
|
|
141
|
-
|
|
142
|
-
### BAD - Don't use EnterPlanMode:
|
|
143
|
-
User: "Add a delete button to the user profile"
|
|
144
|
-
- Implementation path is clear; just do it
|
|
145
|
-
|
|
146
|
-
User: "Can we work on the search feature?"
|
|
147
|
-
- User wants to get started, not plan
|
|
148
|
-
|
|
149
|
-
User: "Update the error handling in the API"
|
|
150
|
-
- Start working; ask specific questions if needed
|
|
151
|
-
|
|
152
|
-
User: "Fix the typo in the README"
|
|
153
|
-
- Straightforward, no planning needed
|
|
154
|
-
|
|
155
|
-
## Important Notes
|
|
156
|
-
|
|
157
|
-
- This tool REQUIRES user approval - they must consent to entering plan mode
|
|
103
|
+
return `Use this tool when a task has genuine ambiguity about the right approach and getting user input before coding would prevent significant rework. This tool transitions you into plan mode where you can explore the codebase and design an implementation approach for user approval.
|
|
104
|
+
|
|
105
|
+
## When to Use This Tool
|
|
106
|
+
|
|
107
|
+
Plan mode is valuable when the implementation approach is genuinely unclear. Use it when:
|
|
108
|
+
|
|
109
|
+
1. **Significant Architectural Ambiguity**: Multiple reasonable approaches exist and the choice meaningfully affects the codebase
|
|
110
|
+
- Example: "Add caching to the API" - Redis vs in-memory vs file-based
|
|
111
|
+
- Example: "Add real-time updates" - WebSockets vs SSE vs polling
|
|
112
|
+
|
|
113
|
+
2. **Unclear Requirements**: You need to explore and clarify before you can make progress
|
|
114
|
+
- Example: "Make the app faster" - need to profile and identify bottlenecks
|
|
115
|
+
- Example: "Refactor this module" - need to understand what the target architecture should be
|
|
116
|
+
|
|
117
|
+
3. **High-Impact Restructuring**: The task will significantly restructure existing code and getting buy-in first reduces risk
|
|
118
|
+
- Example: "Redesign the authentication system"
|
|
119
|
+
- Example: "Migrate from one state management approach to another"
|
|
120
|
+
|
|
121
|
+
## When NOT to Use This Tool
|
|
122
|
+
|
|
123
|
+
Skip plan mode when you can reasonably infer the right approach:
|
|
124
|
+
- The task is straightforward even if it touches multiple files
|
|
125
|
+
- The user's request is specific enough that the implementation path is clear
|
|
126
|
+
- You're adding a feature with an obvious implementation pattern (e.g., adding a button, a new endpoint following existing conventions)
|
|
127
|
+
- Bug fixes where the fix is clear once you understand the bug
|
|
128
|
+
- Research/exploration tasks (use the Agent tool instead)
|
|
129
|
+
- The user says something like "can we work on X" or "let's do X" — just get started
|
|
130
|
+
|
|
131
|
+
When in doubt, prefer starting work and using ${ASK_USER_QUESTION_TOOL_NAME} for specific questions over entering a full planning phase.
|
|
132
|
+
|
|
133
|
+
${whatHappens}## Examples
|
|
134
|
+
|
|
135
|
+
### GOOD - Use EnterPlanMode:
|
|
136
|
+
User: "Add user authentication to the app"
|
|
137
|
+
- Genuinely ambiguous: session vs JWT, where to store tokens, middleware structure
|
|
138
|
+
|
|
139
|
+
User: "Redesign the data pipeline"
|
|
140
|
+
- Major restructuring where the wrong approach wastes significant effort
|
|
141
|
+
|
|
142
|
+
### BAD - Don't use EnterPlanMode:
|
|
143
|
+
User: "Add a delete button to the user profile"
|
|
144
|
+
- Implementation path is clear; just do it
|
|
145
|
+
|
|
146
|
+
User: "Can we work on the search feature?"
|
|
147
|
+
- User wants to get started, not plan
|
|
148
|
+
|
|
149
|
+
User: "Update the error handling in the API"
|
|
150
|
+
- Start working; ask specific questions if needed
|
|
151
|
+
|
|
152
|
+
User: "Fix the typo in the README"
|
|
153
|
+
- Straightforward, no planning needed
|
|
154
|
+
|
|
155
|
+
## Important Notes
|
|
156
|
+
|
|
157
|
+
- This tool REQUIRES user approval - they must consent to entering plan mode
|
|
158
158
|
`;
|
|
159
159
|
}
|
|
160
160
|
export function getEnterPlanModeToolPrompt() {
|
|
@@ -330,18 +330,18 @@ export const ExitPlanModeV2Tool = buildTool({
|
|
|
330
330
|
if (awaitingLeaderApproval) {
|
|
331
331
|
return {
|
|
332
332
|
type: 'tool_result',
|
|
333
|
-
content: `Your plan has been submitted to the team lead for approval.
|
|
334
|
-
|
|
335
|
-
Plan file: ${filePath}
|
|
336
|
-
|
|
337
|
-
**What happens next:**
|
|
338
|
-
1. Wait for the team lead to review your plan
|
|
339
|
-
2. You will receive a message in your inbox with approval/rejection
|
|
340
|
-
3. If approved, you can proceed with implementation
|
|
341
|
-
4. If rejected, refine your plan based on the feedback
|
|
342
|
-
|
|
343
|
-
**Important:** Do NOT proceed until you receive approval. Check your inbox for response.
|
|
344
|
-
|
|
333
|
+
content: `Your plan has been submitted to the team lead for approval.
|
|
334
|
+
|
|
335
|
+
Plan file: ${filePath}
|
|
336
|
+
|
|
337
|
+
**What happens next:**
|
|
338
|
+
1. Wait for the team lead to review your plan
|
|
339
|
+
2. You will receive a message in your inbox with approval/rejection
|
|
340
|
+
3. If approved, you can proceed with implementation
|
|
341
|
+
4. If rejected, refine your plan based on the feedback
|
|
342
|
+
|
|
343
|
+
**Important:** Do NOT proceed until you receive approval. Check your inbox for response.
|
|
344
|
+
|
|
345
345
|
Request ID: ${requestId}`,
|
|
346
346
|
tool_use_id: toolUseID,
|
|
347
347
|
};
|
|
@@ -372,12 +372,12 @@ Request ID: ${requestId}`,
|
|
|
372
372
|
: 'Approved Plan';
|
|
373
373
|
return {
|
|
374
374
|
type: 'tool_result',
|
|
375
|
-
content: `User has approved your plan. You can now start coding. Start with updating your todo list if applicable
|
|
376
|
-
|
|
377
|
-
Your plan has been saved to: ${filePath}
|
|
378
|
-
You can refer back to it if needed during implementation.${teamHint}
|
|
379
|
-
|
|
380
|
-
## ${planLabel}:
|
|
375
|
+
content: `User has approved your plan. You can now start coding. Start with updating your todo list if applicable
|
|
376
|
+
|
|
377
|
+
Your plan has been saved to: ${filePath}
|
|
378
|
+
You can refer back to it if needed during implementation.${teamHint}
|
|
379
|
+
|
|
380
|
+
## ${planLabel}:
|
|
381
381
|
${plan}`,
|
|
382
382
|
tool_use_id: toolUseID,
|
|
383
383
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
// External stub for ExitPlanModeTool prompt - excludes Ant-only allowedPrompts section
|
|
2
2
|
// Hardcoded to avoid relative import issues in stub
|
|
3
3
|
const ASK_USER_QUESTION_TOOL_NAME = 'AskUserQuestion';
|
|
4
|
-
export const EXIT_PLAN_MODE_V2_TOOL_PROMPT = `Use this tool when you are in plan mode and have finished writing your plan to the plan file and are ready for user approval.
|
|
5
|
-
|
|
6
|
-
## How This Tool Works
|
|
7
|
-
- You should have already written your plan to the plan file specified in the plan mode system message
|
|
8
|
-
- This tool does NOT take the plan content as a parameter - it will read the plan from the file you wrote
|
|
9
|
-
- This tool simply signals that you're done planning and ready for the user to review and approve
|
|
10
|
-
- The user will see the contents of your plan file when they review it
|
|
11
|
-
|
|
12
|
-
## When to Use This Tool
|
|
13
|
-
IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool.
|
|
14
|
-
|
|
15
|
-
## Before Using This Tool
|
|
16
|
-
Ensure your plan is complete and unambiguous:
|
|
17
|
-
- If you have unresolved questions about requirements or approach, use ${ASK_USER_QUESTION_TOOL_NAME} first (in earlier phases)
|
|
18
|
-
- Once your plan is finalized, use THIS tool to request approval
|
|
19
|
-
|
|
20
|
-
**Important:** Do NOT use ${ASK_USER_QUESTION_TOOL_NAME} to ask "Is this plan okay?" or "Should I proceed?" - that's exactly what THIS tool does. ExitPlanMode inherently requests user approval of your plan.
|
|
21
|
-
|
|
22
|
-
## Examples
|
|
23
|
-
|
|
24
|
-
1. Initial task: "Search for and understand the implementation of vim mode in the codebase" - Do not use the exit plan mode tool because you are not planning the implementation steps of a task.
|
|
25
|
-
2. Initial task: "Help me implement yank mode for vim" - Use the exit plan mode tool after you have finished planning the implementation steps of the task.
|
|
26
|
-
3. Initial task: "Add a new feature to handle user authentication" - If unsure about auth method (OAuth, JWT, etc.), use ${ASK_USER_QUESTION_TOOL_NAME} first, then use exit plan mode tool after clarifying the approach.
|
|
4
|
+
export const EXIT_PLAN_MODE_V2_TOOL_PROMPT = `Use this tool when you are in plan mode and have finished writing your plan to the plan file and are ready for user approval.
|
|
5
|
+
|
|
6
|
+
## How This Tool Works
|
|
7
|
+
- You should have already written your plan to the plan file specified in the plan mode system message
|
|
8
|
+
- This tool does NOT take the plan content as a parameter - it will read the plan from the file you wrote
|
|
9
|
+
- This tool simply signals that you're done planning and ready for the user to review and approve
|
|
10
|
+
- The user will see the contents of your plan file when they review it
|
|
11
|
+
|
|
12
|
+
## When to Use This Tool
|
|
13
|
+
IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool.
|
|
14
|
+
|
|
15
|
+
## Before Using This Tool
|
|
16
|
+
Ensure your plan is complete and unambiguous:
|
|
17
|
+
- If you have unresolved questions about requirements or approach, use ${ASK_USER_QUESTION_TOOL_NAME} first (in earlier phases)
|
|
18
|
+
- Once your plan is finalized, use THIS tool to request approval
|
|
19
|
+
|
|
20
|
+
**Important:** Do NOT use ${ASK_USER_QUESTION_TOOL_NAME} to ask "Is this plan okay?" or "Should I proceed?" - that's exactly what THIS tool does. ExitPlanMode inherently requests user approval of your plan.
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
1. Initial task: "Search for and understand the implementation of vim mode in the codebase" - Do not use the exit plan mode tool because you are not planning the implementation steps of a task.
|
|
25
|
+
2. Initial task: "Help me implement yank mode for vim" - Use the exit plan mode tool after you have finished planning the implementation steps of the task.
|
|
26
|
+
3. Initial task: "Add a new feature to handle user authentication" - If unsure about auth method (OAuth, JWT, etc.), use ${ASK_USER_QUESTION_TOOL_NAME} first, then use exit plan mode tool after clarifying the approach.
|
|
27
27
|
`;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
export function getExitWorktreeToolPrompt() {
|
|
2
|
-
return `Exit a worktree session created by EnterWorktree and return the session to the original working directory.
|
|
3
|
-
|
|
4
|
-
## Scope
|
|
5
|
-
|
|
6
|
-
This tool ONLY operates on worktrees created by EnterWorktree in this session. It will NOT touch:
|
|
7
|
-
- Worktrees you created manually with \`git worktree add\`
|
|
8
|
-
- Worktrees from a previous session (even if created by EnterWorktree then)
|
|
9
|
-
- The directory you're in if EnterWorktree was never called
|
|
10
|
-
|
|
11
|
-
If called outside an EnterWorktree session, the tool is a **no-op**: it reports that no worktree session is active and takes no action. Filesystem state is unchanged.
|
|
12
|
-
|
|
13
|
-
## When to Use
|
|
14
|
-
|
|
15
|
-
- The user explicitly asks to "exit the worktree", "leave the worktree", "go back", or otherwise end the worktree session
|
|
16
|
-
- Do NOT call this proactively — only when the user asks
|
|
17
|
-
|
|
18
|
-
## Parameters
|
|
19
|
-
|
|
20
|
-
- \`action\` (required): \`"keep"\` or \`"remove"\`
|
|
21
|
-
- \`"keep"\` — leave the worktree directory and branch intact on disk. Use this if the user wants to come back to the work later, or if there are changes to preserve.
|
|
22
|
-
- \`"remove"\` — delete the worktree directory and its branch. Use this for a clean exit when the work is done or abandoned.
|
|
23
|
-
- \`discard_changes\` (optional, default false): only meaningful with \`action: "remove"\`. If the worktree has uncommitted files or commits not on the original branch, the tool will REFUSE to remove it unless this is set to \`true\`. If the tool returns an error listing changes, confirm with the user before re-invoking with \`discard_changes: true\`.
|
|
24
|
-
|
|
25
|
-
## Behavior
|
|
26
|
-
|
|
27
|
-
- Restores the session's working directory to where it was before EnterWorktree
|
|
28
|
-
- Clears CWD-dependent caches (system prompt sections, memory files, plans directory) so the session state reflects the original directory
|
|
29
|
-
- If a tmux session was attached to the worktree: killed on \`remove\`, left running on \`keep\` (its name is returned so the user can reattach)
|
|
30
|
-
- Once exited, EnterWorktree can be called again to create a fresh worktree
|
|
2
|
+
return `Exit a worktree session created by EnterWorktree and return the session to the original working directory.
|
|
3
|
+
|
|
4
|
+
## Scope
|
|
5
|
+
|
|
6
|
+
This tool ONLY operates on worktrees created by EnterWorktree in this session. It will NOT touch:
|
|
7
|
+
- Worktrees you created manually with \`git worktree add\`
|
|
8
|
+
- Worktrees from a previous session (even if created by EnterWorktree then)
|
|
9
|
+
- The directory you're in if EnterWorktree was never called
|
|
10
|
+
|
|
11
|
+
If called outside an EnterWorktree session, the tool is a **no-op**: it reports that no worktree session is active and takes no action. Filesystem state is unchanged.
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- The user explicitly asks to "exit the worktree", "leave the worktree", "go back", or otherwise end the worktree session
|
|
16
|
+
- Do NOT call this proactively — only when the user asks
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
- \`action\` (required): \`"keep"\` or \`"remove"\`
|
|
21
|
+
- \`"keep"\` — leave the worktree directory and branch intact on disk. Use this if the user wants to come back to the work later, or if there are changes to preserve.
|
|
22
|
+
- \`"remove"\` — delete the worktree directory and its branch. Use this for a clean exit when the work is done or abandoned.
|
|
23
|
+
- \`discard_changes\` (optional, default false): only meaningful with \`action: "remove"\`. If the worktree has uncommitted files or commits not on the original branch, the tool will REFUSE to remove it unless this is set to \`true\`. If the tool returns an error listing changes, confirm with the user before re-invoking with \`discard_changes: true\`.
|
|
24
|
+
|
|
25
|
+
## Behavior
|
|
26
|
+
|
|
27
|
+
- Restores the session's working directory to where it was before EnterWorktree
|
|
28
|
+
- Clears CWD-dependent caches (system prompt sections, memory files, plans directory) so the session state reflects the original directory
|
|
29
|
+
- If a tmux session was attached to the worktree: killed on \`remove\`, left running on \`keep\` (its name is returned so the user can reattach)
|
|
30
|
+
- Once exited, EnterWorktree can be called again to create a fresh worktree
|
|
31
31
|
`;
|
|
32
32
|
}
|
|
@@ -13,12 +13,12 @@ function getDefaultEditDescription() {
|
|
|
13
13
|
const minimalUniquenessHint = process.env.USER_TYPE === 'ant'
|
|
14
14
|
? `\n- Use the smallest old_string that's clearly unique — usually 2-4 adjacent lines is sufficient. Avoid including 10+ lines of context when less uniquely identifies the target.`
|
|
15
15
|
: '';
|
|
16
|
-
return `Performs exact string replacements in files.
|
|
17
|
-
|
|
18
|
-
Usage:${getPreReadInstruction()}
|
|
19
|
-
- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: ${prefixFormat}. Everything after that is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.
|
|
20
|
-
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
21
|
-
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
|
|
22
|
-
- The edit will FAIL if \`old_string\` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use \`replace_all\` to change every instance of \`old_string\`.${minimalUniquenessHint}
|
|
16
|
+
return `Performs exact string replacements in files.
|
|
17
|
+
|
|
18
|
+
Usage:${getPreReadInstruction()}
|
|
19
|
+
- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: ${prefixFormat}. Everything after that is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.
|
|
20
|
+
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
21
|
+
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
|
|
22
|
+
- The edit will FAIL if \`old_string\` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use \`replace_all\` to change every instance of \`old_string\`.${minimalUniquenessHint}
|
|
23
23
|
- Use \`replace_all\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.`;
|
|
24
24
|
}
|
|
@@ -10,6 +10,8 @@ import { logEvent } from '../../services/analytics/index.js';
|
|
|
10
10
|
import { getFileExtensionForAnalytics, } from '../../services/analytics/metadata.js';
|
|
11
11
|
import { countTokensWithAPI, roughTokenCountEstimationForFileType, } from '../../services/tokenEstimation.js';
|
|
12
12
|
import { activateConditionalSkillsForPaths, addSkillDirectories, discoverSkillDirsForPaths, } from '../../skills/loadSkillsDir.js';
|
|
13
|
+
import { isCoreToolsEnabled } from '../../core/tools/contracts.js';
|
|
14
|
+
import { executeCoreFileRead } from '../../core/tools/filesCore.js';
|
|
13
15
|
import { buildTool } from '../../Tool.js';
|
|
14
16
|
import { getCwd } from '../../utils/cwd.js';
|
|
15
17
|
import { getClaudeConfigHomeDir, isEnvTruthy } from '../../utils/envUtils.js';
|
|
@@ -768,7 +770,22 @@ async function callInner(file_path, fullFilePath, resolvedFilePath, ext, offset,
|
|
|
768
770
|
}
|
|
769
771
|
// --- Text file (single async read via readFileInRange) ---
|
|
770
772
|
const lineOffset = offset === 0 ? 0 : offset - 1;
|
|
771
|
-
const
|
|
773
|
+
const coreReadResult = isCoreToolsEnabled()
|
|
774
|
+
? await executeCoreFileRead({
|
|
775
|
+
absolute_path: resolvedFilePath,
|
|
776
|
+
offset,
|
|
777
|
+
limit,
|
|
778
|
+
max_bytes: limit === undefined ? maxSizeBytes : undefined,
|
|
779
|
+
}, {
|
|
780
|
+
abortSignal: context.abortController.signal,
|
|
781
|
+
})
|
|
782
|
+
: null;
|
|
783
|
+
if (coreReadResult && (!coreReadResult.success || !coreReadResult.data)) {
|
|
784
|
+
throw new Error(coreReadResult.error ?? 'Core file read failed');
|
|
785
|
+
}
|
|
786
|
+
const { content, lineCount, totalLines, totalBytes, readBytes, mtimeMs, } = coreReadResult
|
|
787
|
+
? coreReadResult.data
|
|
788
|
+
: await readFileInRange(resolvedFilePath, lineOffset, limit, limit === undefined ? maxSizeBytes : undefined, context.abortController.signal);
|
|
772
789
|
await validateContentTokens(content, ext, maxTokens);
|
|
773
790
|
readFileState.set(fullFilePath, {
|
|
774
791
|
content,
|
|
@@ -5,11 +5,11 @@ function getPreReadInstruction() {
|
|
|
5
5
|
return `\n- If this is an existing file, you MUST use the ${FILE_READ_TOOL_NAME} tool first to read the file's contents. This tool will fail if you did not read the file first.`;
|
|
6
6
|
}
|
|
7
7
|
export function getWriteToolDescription() {
|
|
8
|
-
return `Writes a file to the local filesystem.
|
|
9
|
-
|
|
10
|
-
Usage:
|
|
11
|
-
- This tool will overwrite the existing file if there is one at the provided path.${getPreReadInstruction()}
|
|
12
|
-
- Prefer the Edit tool for modifying existing files \u2014 it only sends the diff. Only use this tool to create new files or for complete rewrites.
|
|
13
|
-
- NEVER create documentation files (*.md) or README files unless explicitly requested by the User.
|
|
8
|
+
return `Writes a file to the local filesystem.
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
- This tool will overwrite the existing file if there is one at the provided path.${getPreReadInstruction()}
|
|
12
|
+
- Prefer the Edit tool for modifying existing files \u2014 it only sends the diff. Only use this tool to create new files or for complete rewrites.
|
|
13
|
+
- NEVER create documentation files (*.md) or README files unless explicitly requested by the User.
|
|
14
14
|
- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.`;
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const GLOB_TOOL_NAME = 'Glob';
|
|
2
|
-
export const DESCRIPTION = `- Fast file pattern matching tool that works with any codebase size
|
|
3
|
-
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
|
|
4
|
-
- Returns matching file paths sorted by modification time
|
|
5
|
-
- Use this tool when you need to find files by name patterns
|
|
2
|
+
export const DESCRIPTION = `- Fast file pattern matching tool that works with any codebase size
|
|
3
|
+
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
|
|
4
|
+
- Returns matching file paths sorted by modification time
|
|
5
|
+
- Use this tool when you need to find files by name patterns
|
|
6
6
|
- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead`;
|
|
@@ -2,15 +2,15 @@ import { AGENT_TOOL_NAME } from '../AgentTool/constants.js';
|
|
|
2
2
|
import { BASH_TOOL_NAME } from '../BashTool/toolName.js';
|
|
3
3
|
export const GREP_TOOL_NAME = 'Grep';
|
|
4
4
|
export function getDescription() {
|
|
5
|
-
return `A powerful search tool built on ripgrep
|
|
6
|
-
|
|
7
|
-
Usage:
|
|
8
|
-
- ALWAYS use ${GREP_TOOL_NAME} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${BASH_TOOL_NAME} command. The ${GREP_TOOL_NAME} tool has been optimized for correct permissions and access.
|
|
9
|
-
- Supports full regex syntax (e.g., "log.*Error", "function\\s+\\w+")
|
|
10
|
-
- Filter files with glob parameter (e.g., "*.js", "**/*.tsx") or type parameter (e.g., "js", "py", "rust")
|
|
11
|
-
- Output modes: "content" shows matching lines, "files_with_matches" shows only file paths (default), "count" shows match counts
|
|
12
|
-
- Use ${AGENT_TOOL_NAME} tool for open-ended searches requiring multiple rounds
|
|
13
|
-
- Pattern syntax: Uses ripgrep (not grep) - literal braces need escaping (use \`interface\\{\\}\` to find \`interface{}\` in Go code)
|
|
14
|
-
- Multiline matching: By default patterns match within single lines only. For cross-line patterns like \`struct \\{[\\s\\S]*?field\`, use \`multiline: true\`
|
|
5
|
+
return `A powerful search tool built on ripgrep
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
- ALWAYS use ${GREP_TOOL_NAME} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${BASH_TOOL_NAME} command. The ${GREP_TOOL_NAME} tool has been optimized for correct permissions and access.
|
|
9
|
+
- Supports full regex syntax (e.g., "log.*Error", "function\\s+\\w+")
|
|
10
|
+
- Filter files with glob parameter (e.g., "*.js", "**/*.tsx") or type parameter (e.g., "js", "py", "rust")
|
|
11
|
+
- Output modes: "content" shows matching lines, "files_with_matches" shows only file paths (default), "count" shows match counts
|
|
12
|
+
- Use ${AGENT_TOOL_NAME} tool for open-ended searches requiring multiple rounds
|
|
13
|
+
- Pattern syntax: Uses ripgrep (not grep) - literal braces need escaping (use \`interface\\{\\}\` to find \`interface{}\` in Go code)
|
|
14
|
+
- Multiline matching: By default patterns match within single lines only. For cross-line patterns like \`struct \\{[\\s\\S]*?field\`, use \`multiline: true\`
|
|
15
15
|
`;
|
|
16
16
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
export const LSP_TOOL_NAME = 'LSP';
|
|
2
|
-
export const DESCRIPTION = `Interact with Language Server Protocol (LSP) servers to get code intelligence features.
|
|
3
|
-
|
|
4
|
-
Supported operations:
|
|
5
|
-
- goToDefinition: Find where a symbol is defined
|
|
6
|
-
- findReferences: Find all references to a symbol
|
|
7
|
-
- hover: Get hover information (documentation, type info) for a symbol
|
|
8
|
-
- documentSymbol: Get all symbols (functions, classes, variables) in a document
|
|
9
|
-
- workspaceSymbol: Search for symbols across the entire workspace
|
|
10
|
-
- goToImplementation: Find implementations of an interface or abstract method
|
|
11
|
-
- prepareCallHierarchy: Get call hierarchy item at a position (functions/methods)
|
|
12
|
-
- incomingCalls: Find all functions/methods that call the function at a position
|
|
13
|
-
- outgoingCalls: Find all functions/methods called by the function at a position
|
|
14
|
-
|
|
15
|
-
All operations require:
|
|
16
|
-
- filePath: The file to operate on
|
|
17
|
-
- line: The line number (1-based, as shown in editors)
|
|
18
|
-
- character: The character offset (1-based, as shown in editors)
|
|
19
|
-
|
|
2
|
+
export const DESCRIPTION = `Interact with Language Server Protocol (LSP) servers to get code intelligence features.
|
|
3
|
+
|
|
4
|
+
Supported operations:
|
|
5
|
+
- goToDefinition: Find where a symbol is defined
|
|
6
|
+
- findReferences: Find all references to a symbol
|
|
7
|
+
- hover: Get hover information (documentation, type info) for a symbol
|
|
8
|
+
- documentSymbol: Get all symbols (functions, classes, variables) in a document
|
|
9
|
+
- workspaceSymbol: Search for symbols across the entire workspace
|
|
10
|
+
- goToImplementation: Find implementations of an interface or abstract method
|
|
11
|
+
- prepareCallHierarchy: Get call hierarchy item at a position (functions/methods)
|
|
12
|
+
- incomingCalls: Find all functions/methods that call the function at a position
|
|
13
|
+
- outgoingCalls: Find all functions/methods called by the function at a position
|
|
14
|
+
|
|
15
|
+
All operations require:
|
|
16
|
+
- filePath: The file to operate on
|
|
17
|
+
- line: The line number (1-based, as shown in editors)
|
|
18
|
+
- character: The character offset (1-based, as shown in editors)
|
|
19
|
+
|
|
20
20
|
Note: LSP servers must be configured for the file type. If no server is available, an error will be returned.`;
|