mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
fix: clarify tool names for hooks matchers
Update Hooks UI to explicitly document that matchers use Roo Code internal tool IDs (e.g. write_to_file, execute_command) rather than display labels. Add regression test ensuring display labels do not unintentionally match internal IDs.
This commit is contained in:
parent
22eda99812
commit
85f2bd64dc
3 changed files with 29 additions and 1 deletions
|
|
@ -189,6 +189,14 @@ describe("HookMatcher", () => {
|
|||
const matching = filterMatchingHooks(hooks, "Write")
|
||||
expect(matching).toHaveLength(0)
|
||||
})
|
||||
|
||||
it("should NOT treat Claude Code-style tool labels as Roo Code internal tool ids", () => {
|
||||
// Roo Code hook matching is against tool ids like write_to_file/apply_diff.
|
||||
// A Claude Code-style matcher like Write|Edit should not match apply_diff.
|
||||
const hooks = [createMockHook("hook1", "Write|Edit")]
|
||||
const matching = filterMatchingHooks(hooks, "apply_diff")
|
||||
expect(matching).toHaveLength(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe("hookMatchesTool", () => {
|
||||
|
|
|
|||
|
|
@ -127,7 +127,21 @@ export const HooksSettings: React.FC = () => {
|
|||
)}
|
||||
|
||||
{/* Note about edits requiring reload */}
|
||||
<div className="text-sm text-vscode-descriptionForeground mb-4">{t("settings:hooks.reloadNote")}</div>
|
||||
<div className="text-sm text-vscode-descriptionForeground mb-4">
|
||||
{t("settings:hooks.reloadNote")}
|
||||
<br />
|
||||
{t("settings:hooks.matcherNote")}
|
||||
<br />
|
||||
<span className="font-medium">{t("settings:hooks.matcherExamplesLabel")}</span>
|
||||
<ul className="list-disc list-inside mt-1">
|
||||
<li>
|
||||
<code className="font-mono">{t("settings:hooks.matcherExamples.writeOrEdit")}</code>
|
||||
</li>
|
||||
<li>
|
||||
<code className="font-mono">{t("settings:hooks.matcherExamples.readOnly")}</code>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{/* Hooks list */}
|
||||
{enabledHooks.length === 0 ? (
|
||||
|
|
|
|||
|
|
@ -55,6 +55,12 @@
|
|||
"projectHooksWarningTitle": "Project-level hooks detected",
|
||||
"projectHooksWarningMessage": "This project includes hook configurations that will execute shell commands. Only enable hooks from sources you trust.",
|
||||
"reloadNote": "Changes to hook configuration files require clicking Reload to take effect.",
|
||||
"matcherNote": "Matchers are evaluated against Roo Code's internal tool IDs (e.g. write_to_file, edit_file, apply_diff, apply_patch), not UI labels like Write/Edit.",
|
||||
"matcherExamplesLabel": "Examples:",
|
||||
"matcherExamples": {
|
||||
"writeOrEdit": "write_to_file|edit_file|apply_diff|apply_patch",
|
||||
"readOnly": "read_file|list_files"
|
||||
},
|
||||
"noHooksConfigured": "No hooks configured",
|
||||
"noHooksHint": "Create hook configuration files to automate actions on tool execution events.",
|
||||
"enabled": "Enabled",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue