Skip to content

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

JavaScript

Add large-scan confirmation prompt, fix bun-jsdom docs

Paul Bakaus740f2a197531
diff --git a/CLAUDE.md b/CLAUDE.md
index f78b31810..d6137ad04 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -55,11 +55,13 @@ Unit tests (build, detector logic) run via `bun test`. Fixture tests (jsdom-base
Impeccable includes a CLI for running anti-pattern detection outside of AI harnesses:
```bash
-bun bin/impeccable detect [file-or-dir-or-url...] # detect anti-patterns
-bun bin/impeccable detect --fast --json src/ # regex-only, JSON output
-bun bin/impeccable --help # show help
+node bin/impeccable detect [file-or-dir-or-url...] # detect anti-patterns
+node bin/impeccable detect --fast --json src/ # regex-only, JSON output
+node bin/impeccable --help # show help
```
+**IMPORTANT**: Always use `node` (not `bun`) to run the detect CLI. Bun's jsdom implementation is extremely slow and will cause scans with HTML files to hang for minutes.
+
The detection script is at `source/skills/critique/scripts/detect-antipatterns.mjs`. It auto-detects browser vs Node and works as both:
- **CLI/Node**: jsdom for HTML, regex for CSS/JSX/TSX, Puppeteer for URLs
- **Browser**: visual overlays injected via `<script src="/js/detect-antipatterns-browser.js">`
diff --git a/README.md b/README.md
index 0a5089e90..acc200ef9 100644
--- a/README.md
+++ b/README.md
@@ -211,10 +211,10 @@ Most commands accept an optional argument to focus on a specific area:
Impeccable includes a standalone CLI for detecting anti-patterns without an AI harness:
```bash
-bun bin/impeccable detect src/ # scan a directory
-bun bin/impeccable detect index.html # scan an HTML file
-bun bin/impeccable detect https://example.com # scan a URL (Puppeteer)
-bun bin/impeccable detect --fast --json . # regex-only, JSON output
+npx impeccable detect src/ # scan a directory
+npx impeccable detect index.html # scan an HTML file
+npx impeccable detect https://example.com # scan a URL (Puppeteer)
+npx impeccable detect --fast --json . # regex-only, JSON output
```
The detector catches 24 issues across AI slop (side-tab borders, purple gradients, bounce easing, dark glows) and general design quality (line length, cramped padding, small touch targets, skipped headings, and more).
diff --git a/source/skills/critique/scripts/detect-antipatterns.mjs b/source/skills/critique/scripts/detect-antipatterns.mjs
index e4e8e0cca..04f08796c 100644
--- a/source/skills/critique/scripts/detect-antipatterns.mjs
+++ b/source/skills/critique/scripts/detect-antipatterns.mjs
@@ -2280,6 +2280,18 @@ async function isPortListening(port, fingerprint = null) {
// CLI
// ---------------------------------------------------------------------------
+async function confirm(question) {
+ const rl = (await import('node:readline')).default.createInterface({
+ input: process.stdin, output: process.stderr,
+ });
+ return new Promise((resolve) => {
+ rl.question(`${question} [Y/n] `, (answer) => {
+ rl.close();
+ resolve(!answer || /^y(es)?$/i.test(answer.trim()));
+ });
+ });
+}
+
function printUsage() {
console.log(`Usage: impeccable detect [options] [file-or-dir-or-url...]
@@ -2359,6 +2371,18 @@ async function main() {
}
const files = walkDir(resolved);
+ const htmlCount = files.filter(f => HTML_EXTENSIONS.has(path.extname(f).toLowerCase())).length;
+
+ // Warn and confirm if scanning many files (jsdom is slow per HTML file)
+ if (files.length > 50 && process.stdin.isTTY && !jsonMode) {
+ process.stderr.write(
+ `\nFound ${files.length} files (${htmlCount} HTML) in ${target}.\n` +
+ `Scanning may take a while${htmlCount > 10 ? ' (jsdom processes each HTML file individually)' : ''}.\n` +
+ `Use --fast to skip jsdom, or target a specific subdirectory.\n`
+ );
+ const ok = await confirm('Continue?');
+ if (!ok) { process.stderr.write('Aborted.\n'); process.exit(0); }
+ }
// Build import graph for multi-file awareness
const graph = buildImportGraph(files);