Preserve detector extensions

AI assistance: Codex addressed review feedback and validated this follow-up under maintainer authorization.
This commit is contained in:
Paul Bakaus
2026-08-03 10:23:13 -07:00
parent ae118ebf57
commit 57ce11288f
2 changed files with 10 additions and 2 deletions
+5 -1
View File
@@ -223,7 +223,11 @@ function writeHookConfig(cwd, hookConfig, opts = {}) {
// (consent, quiet, auditLog) survive an Impeccable hooks edit.
const next = { ...existing, hook: { ...existingHook, ...hookConfig } };
if (Object.keys(legacyDetector).length > 0) {
next.detector = mergeDetectorConfig(detectorSection(existing), mergeDetectorConfig(legacyDetector));
const existingDetector = detectorSection(existing) || {};
next.detector = {
...existingDetector,
...mergeDetectorConfig(existingDetector, mergeDetectorConfig(legacyDetector)),
};
}
fs.mkdirSync(path.dirname(filePath), { recursive: true });
fs.writeFileSync(filePath, JSON.stringify(next, null, 2) + '\n');