You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- It is very helpful if you write a clear, concise description of what this command does in 5-10 words.
73
74
- If the output exceeds 30000 characters, output will be truncated before being returned to you.
74
75
- You can use the `run_in_background` parameter to run the command in the background, which allows you to continue working while the command runs. You can monitor the output using the Bash tool as it becomes available. You do not need to use '&' at the end of the command when using this parameter.
75
-
76
76
- Avoid using Bash with the `find`, `grep`, `cat`, `head`, `tail`, `sed`, `awk`, or `echo` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
77
77
- Content search: Use Grep (NOT grep or rg)
78
78
- Read files: Use Read (NOT cat/head/tail)
@@ -91,6 +91,7 @@ class BashTool(
91
91
<bad-example>
92
92
find /src -type f -name "*.kt"
93
93
</bad-example>
94
+
- Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of cd. You may use cd if the User explicitly requests it. pytest /foo/bar/tests cd /foo/bar && pytest tests
94
95
95
96
# Committing changes with git
96
97
@@ -166,7 +167,6 @@ class BashTool(
166
167
</example>
167
168
168
169
Important:
169
-
- DO NOT use the TodoWrite or Task tools
170
170
- Return the PR URL when you're done, so the user can see it
171
171
172
172
# Other common operations
@@ -183,6 +183,8 @@ class BashTool(
183
183
"The command to execute"
184
184
)
185
185
valcommand:String,
186
+
@property:LLMDescription("Optional working directory. If not specified, defaults to the project base directory.")
187
+
valworkingDirectory:String? = null,
186
188
@property:LLMDescription(
187
189
"Optional timeout in milliseconds (max 600000)"
188
190
)
@@ -221,6 +223,7 @@ class BashTool(
221
223
}
222
224
223
225
overridesuspendfundoExecute(args:Args): Result {
226
+
val workingDirectory = args.workingDirectory ?:super.workingDirectory
224
227
val toolId =ToolRunContext.getToolId(sessionId)
225
228
if (project.service<ProxyAISettingsService>()
226
229
.isToolInvocationDenied(this, args.command)
@@ -271,15 +274,15 @@ class BashTool(
271
274
isShellCommandConfirmation.Approved-> {
272
275
try {
273
276
if (args.runInBackground ==true) {
274
-
val bashId = executeBackground(args.command)
277
+
val bashId = executeBackground(workingDirectory, args.command)
275
278
Result(
276
279
args.command,
277
280
null,
278
281
"Background process started with ID: $bashId",
279
282
bashId
280
283
)
281
284
} else {
282
-
val result = runForegroundWithStreaming(resolvedToolId, args)
285
+
val result = runForegroundWithStreaming(resolvedToolId, args, workingDirectory)
283
286
284
287
val postPayload =mapOf(
285
288
"command" to args.command,
@@ -341,7 +344,11 @@ class BashTool(
341
344
)
342
345
}
343
346
344
-
privatesuspendfunrunForegroundWithStreaming(toolId:String, args:Args): Result {
347
+
privatesuspendfunrunForegroundWithStreaming(
348
+
toolId:String,
349
+
args:Args,
350
+
workingDirectory:String
351
+
): Result {
345
352
val publisher =ApplicationManager.getApplication().messageBus
0 commit comments