feat(write-existing-file-guard): add hook to prevent write tool from overwriting existing files

Adds a PreToolUse hook that intercepts write operations and throws an error
if the target file already exists, guiding users to use the edit tool instead.

- Throws error: 'File already exists. Use edit tool instead.'
- Hook is enabled by default, can be disabled via disabled_hooks
- Includes comprehensive test suite with BDD-style comments
This commit is contained in:
YeonGyu-Kim
2026-02-04 16:05:00 +09:00
parent 8049ceb947
commit ddf878e53c
5 changed files with 246 additions and 0 deletions
+1
View File
@@ -38,3 +38,4 @@ export { createCompactionContextInjector, type SummarizeContext } from "./compac
export { createUnstableAgentBabysitterHook } from "./unstable-agent-babysitter";
export { createPreemptiveCompactionHook } from "./preemptive-compaction";
export { createTasksTodowriteDisablerHook } from "./tasks-todowrite-disabler";
export { createWriteExistingFileGuardHook } from "./write-existing-file-guard";