fix(websearch): restore hook recovery and force register

This commit is contained in:
Tam Nhu Tran committed 2026-03-28 10:37:20 -04:00
1 parent ed37a2a513
commit 0821c68559
4 files changed
+61 -3

No files matched your search

@@ -216,7 +216,9 @@ export function registerApiProfileOrphans(options?: {
}
try {
ensureProfileHooksOrThrow(orphan.name);
if (orphan.validation.valid) {
ensureProfileHooksOrThrow(orphan.name);
}
registerApiProfileInConfig(orphan.name, options?.target || 'claude', options?.force || false);
result.registered.push(orphan.name);
} catch (error) {
+11 -2
View File
@@ -25,8 +25,17 @@ function hasMatchingHookContents(sourcePath: string, destinationPath: string): b
}
const source = fs.readFileSync(sourcePath);
const destination = fs.readFileSync(destinationPath);
return source.equals(destination);
try {
const destination = fs.readFileSync(destinationPath);
return source.equals(destination);
} catch (error) {
if (process.env.CCS_DEBUG) {
console.error(
warn(`Existing WebSearch hook is unreadable; reinstalling: ${(error as Error).message}`)
);
}
return false;
}
}
function getTempHookPath(hookPath: string): string {