Skip to content

Commit 5f3ff25

Browse files
committed
Disable writing in ask mode
1 parent 4a55e14 commit 5f3ff25

File tree

4 files changed

+18
-50
lines changed

4 files changed

+18
-50
lines changed

.changeset/clever-news-arrive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"roo-cline": patch
3+
---
4+
5+
Disable writing in ask mode

src/core/prompts/__tests__/__snapshots__/system.test.ts.snap

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4004,43 +4004,6 @@ Example: Requesting to list all top level source code definitions in the current
40044004
<path>.</path>
40054005
</list_code_definition_names>
40064006
4007-
## write_to_file
4008-
Description: Request to write full content to a file at the specified path. If the file exists, it will be overwritten with the provided content. If the file doesn't exist, it will be created. This tool will automatically create any directories needed to write the file.
4009-
Parameters:
4010-
- path: (required) The path of the file to write to (relative to the current working directory /test/path)
4011-
- content: (required) The content to write to the file. ALWAYS provide the COMPLETE intended content of the file, without any truncation or omissions. You MUST include ALL parts of the file, even if they haven't been modified. Do NOT include the line numbers in the content though, just the actual content of the file.
4012-
- line_count: (required) The number of lines in the file. Make sure to compute this based on the actual content of the file, not the number of lines in the content you're providing.
4013-
Usage:
4014-
<write_to_file>
4015-
<path>File path here</path>
4016-
<content>
4017-
Your file content here
4018-
</content>
4019-
<line_count>total number of lines in the file, including empty lines</line_count>
4020-
</write_to_file>
4021-
4022-
Example: Requesting to write to frontend-config.json
4023-
<write_to_file>
4024-
<path>frontend-config.json</path>
4025-
<content>
4026-
{
4027-
"apiEndpoint": "https://api.example.com",
4028-
"theme": {
4029-
"primaryColor": "#007bff",
4030-
"secondaryColor": "#6c757d",
4031-
"fontFamily": "Arial, sans-serif"
4032-
},
4033-
"features": {
4034-
"darkMode": true,
4035-
"notifications": true,
4036-
"analytics": false
4037-
},
4038-
"version": "1.0.0"
4039-
}
4040-
</content>
4041-
<line_count>14</line_count>
4042-
</write_to_file>
4043-
40444007
## ask_followup_question
40454008
Description: Ask the user a question to gather additional information needed to complete the task. This tool should be used when you encounter ambiguities, need clarification, or require more details to proceed effectively. It allows for interactive problem-solving by enabling direct communication with the user. Use this tool judiciously to maintain a balance between gathering necessary information and avoiding excessive back-and-forth.
40464009
Parameters:
@@ -4213,7 +4176,7 @@ USER'S CUSTOM INSTRUCTIONS
42134176
The following additional instructions are provided by the user, and should be followed to the best of your ability without interfering with the TOOL USE guidelines.
42144177
42154178
Mode-specific Instructions:
4216-
You can analyze code, explain concepts, and access external resources. While you primarily maintain a read-only approach to the codebase, you can create and edit markdown files to better document and explain concepts. Make sure to answer the user's questions and don't rush to switch to implementing code.
4179+
You can analyze code, explain concepts, and access external resources. Make sure to answer the user's questions and don't rush to switch to implementing code.
42174180
42184181
Rules:
42194182
# Rules from .clinerules-ask:

src/shared/__tests__/modes.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ describe("isToolAllowedForMode", () => {
9393
}),
9494
).toBe(true)
9595

96-
// Should allow path-only for ask mode too
96+
// Should allow path-only for architect mode too
9797
expect(
98-
isToolAllowedForMode("write_to_file", "ask", [], undefined, {
98+
isToolAllowedForMode("write_to_file", "architect", [], undefined, {
9999
path: "test.js",
100100
}),
101101
).toBe(true)
@@ -197,41 +197,41 @@ describe("isToolAllowedForMode", () => {
197197
).toBe(true)
198198
})
199199

200-
it("allows ask mode to edit markdown files only", () => {
200+
it("allows architect mode to edit markdown files only", () => {
201201
// Should allow editing markdown files
202202
expect(
203-
isToolAllowedForMode("write_to_file", "ask", [], undefined, {
203+
isToolAllowedForMode("write_to_file", "architect", [], undefined, {
204204
path: "test.md",
205205
content: "# Test",
206206
}),
207207
).toBe(true)
208208

209209
// Should allow applying diffs to markdown files
210210
expect(
211-
isToolAllowedForMode("apply_diff", "ask", [], undefined, {
211+
isToolAllowedForMode("apply_diff", "architect", [], undefined, {
212212
path: "readme.md",
213213
diff: "- old\n+ new",
214214
}),
215215
).toBe(true)
216216

217217
// Should reject non-markdown files
218218
expect(() =>
219-
isToolAllowedForMode("write_to_file", "ask", [], undefined, {
219+
isToolAllowedForMode("write_to_file", "architect", [], undefined, {
220220
path: "test.js",
221221
content: "console.log('test')",
222222
}),
223223
).toThrow(FileRestrictionError)
224224
expect(() =>
225-
isToolAllowedForMode("write_to_file", "ask", [], undefined, {
225+
isToolAllowedForMode("write_to_file", "architect", [], undefined, {
226226
path: "test.js",
227227
content: "console.log('test')",
228228
}),
229229
).toThrow(/Markdown files only/)
230230

231231
// Should maintain read capabilities
232-
expect(isToolAllowedForMode("read_file", "ask", [])).toBe(true)
233-
expect(isToolAllowedForMode("browser_action", "ask", [])).toBe(true)
234-
expect(isToolAllowedForMode("use_mcp_tool", "ask", [])).toBe(true)
232+
expect(isToolAllowedForMode("read_file", "architect", [])).toBe(true)
233+
expect(isToolAllowedForMode("browser_action", "architect", [])).toBe(true)
234+
expect(isToolAllowedForMode("use_mcp_tool", "architect", [])).toBe(true)
235235
})
236236
})
237237

src/shared/modes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ export const modes: readonly ModeConfig[] = [
9292
name: "Ask",
9393
roleDefinition:
9494
"You are Roo, a knowledgeable technical assistant focused on answering questions and providing information about software development, technology, and related topics.",
95-
groups: ["read", ["edit", { fileRegex: "\\.md$", description: "Markdown files only" }], "browser", "mcp"],
95+
groups: ["read", "browser", "mcp"],
9696
customInstructions:
97-
"You can analyze code, explain concepts, and access external resources. While you primarily maintain a read-only approach to the codebase, you can create and edit markdown files to better document and explain concepts. Make sure to answer the user's questions and don't rush to switch to implementing code.",
97+
"You can analyze code, explain concepts, and access external resources. Make sure to answer the user's questions and don't rush to switch to implementing code.",
9898
},
9999
] as const
100100

0 commit comments

Comments
 (0)