Canonicalize hook metadata file paths

This commit is contained in:
Tak Hoffman 2026-03-19 00:16:28 -05:00
parent 15fd465a48
commit 9ec1f01b5a
No known key found for this signature in database

View File

@ -81,11 +81,19 @@ function loadHookFromDir(params: {
nameHint?: string;
}): Hook | null {
const hookMdPath = path.join(params.hookDir, "HOOK.md");
const content = readBoundaryFileUtf8({
const safeHookMdPath = resolveBoundaryFilePath({
absolutePath: hookMdPath,
rootPath: params.hookDir,
boundaryLabel: "hook directory",
});
if (!safeHookMdPath) {
return null;
}
const content = readBoundaryFileUtf8({
absolutePath: safeHookMdPath,
rootPath: params.hookDir,
boundaryLabel: "hook directory",
});
if (content === null) {
return null;
}
@ -127,7 +135,7 @@ function loadHookFromDir(params: {
description,
source: params.source,
pluginId: params.pluginId,
filePath: hookMdPath,
filePath: safeHookMdPath,
baseDir,
handlerPath,
};