mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-21 02:26:31 +03:00
Remove detection engine files, now in @impeccable/detect package
Remove all detection engine source, tests, fixtures, and build scripts that have been extracted to the @impeccable/detect package (BSL-1.1). - Delete source/skills/critique/scripts/ (detect-antipatterns.mjs, browser.js) - Delete scripts/build-browser-detector.js - Delete tests/detect-antipatterns*.test.* and tests/fixtures/antipatterns/ - Delete .claude/skills/critique/scripts/detect-antipatterns-browser.js - Update scripts/build.js to read detection count from npm package - Update server/index.js to serve browser script from npm package - Update CLAUDE.md to reference @impeccable/detect - Update package.json test script (detection tests removed) - Update .gitignore (remove obsolete browser script entry) - Rebuild all provider skill distributions with updated critique skill Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
1a28702d24
commit
3974789903
@@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Generates .claude/skills/critique/scripts/detect-antipatterns-browser.js
|
||||
* by stripping Node-specific sections from the universal source and wrapping in an IIFE.
|
||||
*
|
||||
* Run: node scripts/build-browser-detector.js
|
||||
*/
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const ROOT = path.resolve(__dirname, '..');
|
||||
|
||||
const SOURCE = path.join(ROOT, 'source/skills/critique/scripts/detect-antipatterns.mjs');
|
||||
const OUTPUT = path.join(ROOT, '.claude/skills/critique/scripts/detect-antipatterns-browser.js');
|
||||
// Also output next to source so the CLI's URL scanner can find it
|
||||
const OUTPUT_CLI = path.join(ROOT, 'source/skills/critique/scripts/detect-antipatterns-browser.js');
|
||||
|
||||
let code = fs.readFileSync(SOURCE, 'utf-8');
|
||||
|
||||
// Strip shebang
|
||||
code = code.replace(/^#!.*\n/, '');
|
||||
// Strip sections between @browser-strip-start / @browser-strip-end markers
|
||||
code = code.replace(/^\/\/ @browser-strip-start\n[\s\S]*?^\/\/ @browser-strip-end\n?/gm, '');
|
||||
// Set IS_BROWSER = true (dead-code eliminates Node paths)
|
||||
code = code.replace(/^const IS_BROWSER = .*$/m, 'const IS_BROWSER = true;');
|
||||
|
||||
const output = `/**
|
||||
* Anti-Pattern Browser Detector for Impeccable
|
||||
* GENERATED — do not edit. Source: detect-antipatterns.mjs
|
||||
* Rebuild: node scripts/build-browser-detector.js
|
||||
*
|
||||
* Usage: <script src="detect-antipatterns-browser.js"></script>
|
||||
* Re-scan: window.impeccableScan()
|
||||
*/
|
||||
(function () {
|
||||
if (typeof window === 'undefined') return;
|
||||
${code}
|
||||
})();
|
||||
`;
|
||||
|
||||
fs.mkdirSync(path.dirname(OUTPUT), { recursive: true });
|
||||
fs.writeFileSync(OUTPUT, output);
|
||||
fs.writeFileSync(OUTPUT_CLI, output);
|
||||
console.log(`\u2713 Generated ${path.relative(ROOT, OUTPUT)} (${(output.length / 1024).toFixed(1)} KB)`);
|
||||
+3
-11
@@ -35,10 +35,9 @@ function generateCounts(rootDir, skills, buildDir) {
|
||||
});
|
||||
const commandCount = activeCommands.length;
|
||||
|
||||
// Count detection rules from source
|
||||
const detectorSrc = fs.readFileSync(
|
||||
path.join(rootDir, 'source/skills/critique/scripts/detect-antipatterns.mjs'), 'utf-8'
|
||||
);
|
||||
// Count detection rules from @impeccable/detect package
|
||||
const detectPkgPath = path.join(rootDir, 'node_modules/@impeccable/detect/src/detect-antipatterns.mjs');
|
||||
const detectorSrc = fs.readFileSync(detectPkgPath, 'utf-8');
|
||||
const ruleIds = new Set();
|
||||
for (const match of detectorSrc.matchAll(/^\s+id: '([^']+)'/gm)) {
|
||||
ruleIds.add(match[1]);
|
||||
@@ -444,13 +443,6 @@ async function build() {
|
||||
// Generate authoritative counts and validate references
|
||||
generateCounts(ROOT_DIR, skills, buildDir);
|
||||
|
||||
// Generate browser anti-pattern detector (after skill sync so it doesn't get overwritten)
|
||||
try {
|
||||
execSync('node scripts/build-browser-detector.js', { cwd: ROOT_DIR, stdio: 'inherit' });
|
||||
} catch (error) {
|
||||
console.error('Failed to build browser detector:', error.message);
|
||||
}
|
||||
|
||||
console.log('\n✨ Build complete!');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user