mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-13 20:28:36 +08:00
fix: gate MultiEdit tool alongside Edit/Write
MultiEdit was bypassing the fact-forcing gate because only Edit and Write were checked. Now MultiEdit triggers the same edit gate (list importers, public API, data schemas) before allowing file modifications. Updated both the hook logic and hooks.json matcher pattern. Addresses coderabbit/greptile/cubic-dev: "MultiEdit bypasses gate" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b6a290d061
commit
9a64e0d271
@ -128,7 +128,7 @@
|
||||
"id": "pre:mcp-health-check"
|
||||
},
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"matcher": "Edit|Write|MultiEdit",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
@ -136,7 +136,7 @@
|
||||
"timeout": 5
|
||||
}
|
||||
],
|
||||
"description": "Fact-forcing gate: block first Edit/Write per file and demand investigation (importers, data schemas, user instruction) before allowing",
|
||||
"description": "Fact-forcing gate: block first Edit/Write/MultiEdit per file and demand investigation (importers, data schemas, user instruction) before allowing",
|
||||
"id": "pre:edit-write:gateguard-fact-force"
|
||||
},
|
||||
{
|
||||
|
||||
@ -165,7 +165,7 @@ function run(rawInput) {
|
||||
const toolName = data.tool_name || '';
|
||||
const toolInput = data.tool_input || {};
|
||||
|
||||
if (toolName === 'Edit' || toolName === 'Write') {
|
||||
if (toolName === 'Edit' || toolName === 'MultiEdit' || toolName === 'Write') {
|
||||
const filePath = toolInput.file_path || '';
|
||||
if (!filePath) {
|
||||
return rawInput; // allow
|
||||
@ -173,7 +173,8 @@ function run(rawInput) {
|
||||
|
||||
if (!isChecked(filePath)) {
|
||||
markChecked(filePath);
|
||||
const msg = toolName === 'Edit' ? editGateMsg(filePath) : writeGateMsg(filePath);
|
||||
const msg = (toolName === 'Edit' || toolName === 'MultiEdit')
|
||||
? editGateMsg(filePath) : writeGateMsg(filePath);
|
||||
return denyResult(msg);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user