Skip to content

The design language that makes your AI harness better at design.

JavaScript

Preserve advisory detector settings

Paul Bakaus3125864d1a98
diff --git a/skill/scripts/hook-admin.mjs b/skill/scripts/hook-admin.mjs
index 43ad0b878..8e1230d9f 100644
--- a/skill/scripts/hook-admin.mjs
+++ b/skill/scripts/hook-admin.mjs
@@ -166,7 +166,7 @@ function readRawConfigFile(filePath) {
}
}
-const DETECTOR_CONFIG_KEYS = new Set(['ignoreRules', 'ignoreFiles', 'ignoreValues', 'designSystem']);
+const DETECTOR_CONFIG_KEYS = new Set(['ignoreRules', 'ignoreFiles', 'ignoreValues', 'designSystem', 'advisoryRules']);
function hookSection(unified) {
return unified && typeof unified === 'object' && !Array.isArray(unified) && unified.hook && typeof unified.hook === 'object' && !Array.isArray(unified.hook)
@@ -259,12 +259,18 @@ function mergeDetectorConfig(existing, seed = null) {
if (seed?.designSystem && typeof seed.designSystem === 'object' && !Array.isArray(seed.designSystem)) {
out.designSystem = { ...seed.designSystem };
}
+ if (seed?.advisoryRules === 'include' || seed?.advisoryRules === 'exclude') {
+ out.advisoryRules = seed.advisoryRules;
+ }
if (base.designSystem && typeof base.designSystem === 'object' && !Array.isArray(base.designSystem)) {
out.designSystem = {
...(out.designSystem || {}),
enabled: base.designSystem.enabled === false ? false : true,
};
}
+ if (base.advisoryRules === 'include' || base.advisoryRules === 'exclude') {
+ out.advisoryRules = base.advisoryRules;
+ }
if (Array.isArray(base.ignoreRules)) {
out.ignoreRules = Array.from(new Set([...out.ignoreRules, ...base.ignoreRules.map(String)]));
}
diff --git a/tests/hook.test.mjs b/tests/hook.test.mjs
index 89b40ac01..f7b39d2d7 100644
--- a/tests/hook.test.mjs
+++ b/tests/hook.test.mjs
@@ -994,6 +994,19 @@ describe('hook-admin.mjs', () => {
assert.match(out, /local detector\.ignoreFiles/);
});
+ it('ignore-file --local preserves the local advisory-rule preference', () => {
+ fs.mkdirSync(path.dirname(getLocalConfigPath(cwd)), { recursive: true });
+ fs.writeFileSync(getLocalConfigPath(cwd), JSON.stringify({
+ detector: { advisoryRules: 'include' },
+ }));
+
+ runAdmin(['ignore-file', '/abs/path/personal.html', '--local']);
+
+ const local = JSON.parse(fs.readFileSync(getLocalConfigPath(cwd), 'utf-8')).detector;
+ assert.equal(local.advisoryRules, 'include');
+ assert.deepEqual(local.ignoreFiles, ['/abs/path/personal.html']);
+ });
+
it('ignore-file refuses unsupported reasons and unknown flags', () => {
assert.throws(
() => runAdmin(['ignore-file', 'src/legacy/**', '--reason', 'machine-local path']),