fix: address PR review feedback

- Remove dead code (meaningless ternary) in ClineProvider.getHooksStateForWebview()
- Remove console spam in HookMatcher.expandGroupPatterns for non-group patterns
- Update test to match new behavior (no warning for unknown patterns)
This commit is contained in:
Roo Code 2026-01-21 14:58:55 +00:00
parent a70ff8de22
commit b1bd21426b
3 changed files with 3 additions and 13 deletions

View file

@ -2374,7 +2374,7 @@ export class ClineProvider
timestamp: exec.timestamp.toISOString(),
hookId: exec.hook.id,
event: exec.event,
toolName: exec.result.hook.matcher ? undefined : undefined, // Tool name is in context, not easily accessible here
toolName: undefined, // Tool name is in context, not easily accessible here
exitCode: exec.result.exitCode,
duration: exec.result.duration,
timedOut: exec.result.timedOut,

View file

@ -43,8 +43,7 @@ function expandGroupPatterns(pattern: string): string {
return tools.join("|")
}
// Not a group, keep as-is, but warn if it looks like it was intended as a group
console.warn(`Unknown tool group "${pattern}". Treating as literal tool name.`)
// Not a group - this is a normal tool name, keep as-is
return pattern
}

View file

@ -205,19 +205,10 @@ describe("HookMatcher", () => {
})
it("should treat unknown groups as literal tool names", () => {
// Mock console.warn to capture warnings
const consoleWarnSpy = vi.spyOn(console, "warn").mockImplementation(() => {})
// Unknown group names are treated as literal tool names (no warning)
const matcher = compileMatcher("unknown_group")
expect(matcher.matches("unknown_group")).toBe(true)
expect(matcher.matches("read_file")).toBe(false)
// Should have warned about unknown group
expect(consoleWarnSpy).toHaveBeenCalledWith(
expect.stringContaining('Unknown tool group "unknown_group"'),
)
consoleWarnSpy.mockRestore()
})
it("should not warn for glob patterns that look like groups", () => {