diff --git a/tools/l1-watcher.mjs b/tools/l1-watcher.mjs index 76891a4f..507019b8 100644 --- a/tools/l1-watcher.mjs +++ b/tools/l1-watcher.mjs @@ -20,6 +20,11 @@ export function parseAliases(raw) { return out; } +// Detects the L1 pattern (ADR-011 §6.1): a plugin enabled in settings.json +// that has no formalization in Tooling Прил. Н. Only the settings→Tooling +// direction is checked — the reverse ("documented but disabled") cannot be +// computed reliably because Tooling lists tools by human/group name while +// settings.json keys are machine IDs (`name@marketplace`). export function detectDrift(settings, toolingText, aliases = {}) { const enabled = Object.entries(settings.enabledPlugins || {}) .filter(([, v]) => v === true) @@ -32,13 +37,7 @@ export function detectDrift(settings, toolingText, aliases = {}) { if (alias && toolingText.includes(alias)) return false; return true; }); - const inToolingButNotSettings = []; - const toolingNumbered = toolingText.match(/#\d+\s+([\w-]+(?:@[\w-]+)?)/g) || []; - const toolingPluginNames = toolingNumbered.map((s) => s.split(/\s+/)[1]); - for (const p of toolingPluginNames) { - if (!enabled.includes(p)) inToolingButNotSettings.push(p); - } - return { missingInTooling, missingInSettings: inToolingButNotSettings }; + return { missingInTooling }; } function loadFileMaybe(path) { @@ -71,10 +70,6 @@ if (process.argv[1] && process.argv[1].replace(/\\/g, '/').endsWith('/l1-watcher console.error(`If the plugin is referenced in Tooling under a group/human name, add an alias to tools/.l1-watcher-aliases.txt.`); process.exit(1); } - if (drift.missingInSettings.length > 0) { - console.warn(`[l1-watcher] WARN — plugins in Tooling but disabled in settings:`); - drift.missingInSettings.forEach((p) => console.warn(` - ${p}`)); - } console.log(`[l1-watcher] OK — 0 drift`); process.exit(0); } diff --git a/tools/l1-watcher.test.mjs b/tools/l1-watcher.test.mjs index 9150bd89..9ef2b819 100644 --- a/tools/l1-watcher.test.mjs +++ b/tools/l1-watcher.test.mjs @@ -7,22 +7,20 @@ describe('detectDrift', () => { const tooling = 'Описание #56 foo@org интегрирован.'; const drift = detectDrift(settings, tooling); expect(drift.missingInTooling).toEqual(['bar@org']); - expect(drift.missingInSettings).toEqual([]); }); - it('finds plugins in tooling but not in settings', () => { + it('reports only the settings→Tooling direction (no reverse check)', () => { const settings = { enabledPlugins: { 'foo@org': true } }; const tooling = '#56 foo@org. #57 baz@org включён.'; const drift = detectDrift(settings, tooling); - expect(drift.missingInSettings).toEqual(['baz@org']); + expect(drift).not.toHaveProperty('missingInSettings'); }); - it('returns empty arrays when in sync', () => { + it('returns empty missingInTooling when in sync', () => { const settings = { enabledPlugins: { 'foo@org': true } }; const tooling = '#56 foo@org описан.'; const drift = detectDrift(settings, tooling); expect(drift.missingInTooling).toEqual([]); - expect(drift.missingInSettings).toEqual([]); }); it('handles disabled plugins (value false)', () => {