The design language that makes your AI harness better at design.
JavaScript
Preserve detector extension mappings
Paul Bakaus2345868c7bc6
diff --git a/skill/scripts/hook-admin.mjs b/skill/scripts/hook-admin.mjsindex 5a0c29abd..e8d9e2ada 100644--- a/skill/scripts/hook-admin.mjs+++ b/skill/scripts/hook-admin.mjs@@ -240,10 +240,14 @@ function writeDetectorConfig(cwd, detectorConfig, opts = {}) {const existingRaw = readRawConfigFile(filePath).raw;const existing = existingRaw && typeof existingRaw === 'object' && !Array.isArray(existingRaw) ? existingRaw : {};const nextHook = stripDetectorKeys(hookSection(existing));- const existingDetector = mergeDetectorConfig(detectorSection(existing));+ const existingDetectorSection = detectorSection(existing) || {};+ const existingDetector = mergeDetectorConfig(existingDetectorSection);const next = {...existing,- detector: mergeDetectorConfig(detectorConfig, existingDetector),+ detector: {+ ...existingDetectorSection,+ ...mergeDetectorConfig(detectorConfig, existingDetector),+ },};if (Object.keys(nextHook).length > 0) next.hook = nextHook;else delete next.hook;diff --git a/tests/hook.test.mjs b/tests/hook.test.mjsindex 18012f5c7..631fc245d 100644--- a/tests/hook.test.mjs+++ b/tests/hook.test.mjs@@ -1058,9 +1058,15 @@ describe('hook-admin.mjs', () => {fs.mkdirSync(path.dirname(file), { recursive: true });fs.writeFileSync(file, '<div style="border-left: 4px solid #7c3aed; border-radius: 16px; padding: 16px;">Card</div>');+ fs.mkdirSync(path.dirname(getConfigPath(cwd)), { recursive: true });+ fs.writeFileSync(getConfigPath(cwd), JSON.stringify({+ detector: { extensions: [{ ext: '.blade.php', engine: 'html' }] },+ }));+runAdmin(['ignore-file', 'src/ConfirmedCard.html']);const shared = JSON.parse(fs.readFileSync(getConfigPath(cwd), 'utf-8')).detector;+ assert.deepEqual(shared.extensions, [{ ext: '.blade.php', engine: 'html' }]);assert.deepEqual(shared.ignoreFiles, ['src/ConfirmedCard.html']);const r = await runHook({