From 9a8f03462f53f5a1303d887444d5f8cd2e8959f0 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 7 Feb 2026 19:01:28 +0900 Subject: [PATCH] fix: normalize resolvedPath before startsWith check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Addresses cubic review feedback — resolvedPath may contain non-canonical segments when filePath is absolute, causing the startsWith check against sisyphusRoot to fail. --- src/hooks/write-existing-file-guard/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hooks/write-existing-file-guard/index.ts b/src/hooks/write-existing-file-guard/index.ts index 1256b241..1e8ca751 100644 --- a/src/hooks/write-existing-file-guard/index.ts +++ b/src/hooks/write-existing-file-guard/index.ts @@ -1,6 +1,6 @@ import type { Hooks, PluginInput } from "@opencode-ai/plugin" import { existsSync } from "fs" -import { resolve, isAbsolute, join, sep } from "path" +import { resolve, isAbsolute, join, normalize, sep } from "path" import { log } from "../../shared" export function createWriteExistingFileGuardHook(ctx: PluginInput): Hooks { @@ -17,7 +17,7 @@ export function createWriteExistingFileGuardHook(ctx: PluginInput): Hooks { return } - const resolvedPath = isAbsolute(filePath) ? filePath : resolve(ctx.directory, filePath) + const resolvedPath = normalize(isAbsolute(filePath) ? filePath : resolve(ctx.directory, filePath)) if (existsSync(resolvedPath)) { const sisyphusRoot = join(ctx.directory, ".sisyphus") + sep