Skip to content

Commit 7aa06d5

Browse files
committed
fix: use camelCase for runSlashCommand tool to enable auto-approval
- Changed tool name from 'run_slash_command' to 'runSlashCommand' in backend - Added proper TypeScript types for runSlashCommand properties - Updated frontend components to handle camelCase tool name - Fixed tests to expect camelCase format - Ensures runSlashCommand is auto-approved when read auto-approve is enabled
1 parent 33d4549 commit 7aa06d5

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

src/core/tools/__tests__/runSlashCommandTool.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ describe("runSlashCommandTool", () => {
160160
expect(mockAskApproval).toHaveBeenCalledWith(
161161
"tool",
162162
JSON.stringify({
163-
tool: "run_slash_command",
163+
tool: "runSlashCommand",
164164
command: "init",
165165
args: undefined,
166166
source: "built-in",
@@ -283,7 +283,7 @@ Deploy application to production`,
283283
expect(mockTask.ask).toHaveBeenCalledWith(
284284
"tool",
285285
JSON.stringify({
286-
tool: "run_slash_command",
286+
tool: "runSlashCommand",
287287
command: "init",
288288
args: "",
289289
}),

src/core/tools/runSlashCommandTool.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function runSlashCommandTool(
3232
try {
3333
if (block.partial) {
3434
const partialMessage = JSON.stringify({
35-
tool: "run_slash_command",
35+
tool: "runSlashCommand",
3636
command: removeClosingTag("command", commandName),
3737
args: removeClosingTag("args", args),
3838
})
@@ -65,7 +65,7 @@ export async function runSlashCommandTool(
6565
}
6666

6767
const toolMessage = JSON.stringify({
68-
tool: "run_slash_command",
68+
tool: "runSlashCommand",
6969
command: commandName,
7070
args: args,
7171
source: command.source,

src/shared/ExtensionMessage.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ export interface ClineSayTool {
349349
| "insertContent"
350350
| "generateImage"
351351
| "imageGenerated"
352+
| "runSlashCommand"
352353
path?: string
353354
diff?: string
354355
content?: string
@@ -386,6 +387,11 @@ export interface ClineSayTool {
386387
}>
387388
question?: string
388389
imageData?: string // Base64 encoded image data for generated images
390+
// Properties for runSlashCommand tool
391+
command?: string
392+
args?: string
393+
source?: string
394+
description?: string
389395
}
390396

391397
// Must keep in sync with system prompt.

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,8 @@ export const ChatRowContent = ({
791791
</div>
792792
</>
793793
)
794-
case "run_slash_command" as any: {
795-
const slashCommandInfo = tool as any
794+
case "runSlashCommand": {
795+
const slashCommandInfo = tool
796796
return (
797797
<>
798798
<div style={headerStyle}>
@@ -1234,8 +1234,8 @@ export const ChatRowContent = ({
12341234
if (!sayTool) return null
12351235

12361236
switch (sayTool.tool) {
1237-
case "run_slash_command" as any: {
1238-
const slashCommandInfo = sayTool as any
1237+
case "runSlashCommand": {
1238+
const slashCommandInfo = sayTool
12391239
return (
12401240
<>
12411241
<div style={headerStyle}>

0 commit comments

Comments
 (0)