fix: allow Prometheus to overwrite .sisyphus/*.md plan files
Add exception in write-existing-file-guard for .sisyphus/*.md files so Prometheus can rewrite plan files without being blocked by the guard. The prometheus-md-only hook (which runs later) still validates that only Prometheus can write to these paths, preserving security. Fixes #1576
This commit is contained in:
@@ -20,6 +20,15 @@ export function createWriteExistingFileGuardHook(ctx: PluginInput): Hooks {
|
||||
const resolvedPath = isAbsolute(filePath) ? filePath : resolve(ctx.directory, filePath)
|
||||
|
||||
if (existsSync(resolvedPath)) {
|
||||
const isSisyphusMarkdown = resolvedPath.replace(/\\/g, "/").includes("/.sisyphus/") && filePath.endsWith(".md")
|
||||
if (isSisyphusMarkdown) {
|
||||
log("[write-existing-file-guard] Allowing .sisyphus/*.md overwrite", {
|
||||
sessionID: input.sessionID,
|
||||
filePath,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
log("[write-existing-file-guard] Blocking write to existing file", {
|
||||
sessionID: input.sessionID,
|
||||
filePath,
|
||||
|
||||
Reference in New Issue
Block a user