claudecode-omc 5.6.8 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.local/settings/settings.json +8 -0
- package/.local/skills/prompt-optimizer/SKILL.md +262 -19
- package/.omc-curation/ecc-selection.json +80 -0
- package/.omc-curation/governance.json +116 -0
- package/.omc-curation/sources.lock.json +30 -0
- package/README.md +78 -4
- package/bundled/manifest.json +6 -5
- package/bundled/upstream/anthropic-skills/.omc-source/bundle.json +18 -0
- package/bundled/upstream/anthropic-skills/.omc-source/provenance.json +399 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/SKILL.md +18 -17
- package/bundled/upstream/anthropic-skills/skills/claude-api/curl/examples.md +9 -9
- package/bundled/upstream/anthropic-skills/skills/claude-api/curl/managed-agents.md +4 -4
- package/bundled/upstream/anthropic-skills/skills/claude-api/go/managed-agents/README.md +2 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/java/claude-api.md +2 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/java/managed-agents/README.md +2 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/php/claude-api.md +10 -10
- package/bundled/upstream/anthropic-skills/skills/claude-api/php/managed-agents/README.md +2 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/README.md +16 -16
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/batches.md +3 -3
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/files-api.md +3 -3
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/streaming.md +7 -7
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/claude-api/tool-use.md +19 -19
- package/bundled/upstream/anthropic-skills/skills/claude-api/python/managed-agents/README.md +3 -3
- package/bundled/upstream/anthropic-skills/skills/claude-api/ruby/claude-api.md +4 -4
- package/bundled/upstream/anthropic-skills/skills/claude-api/ruby/managed-agents/README.md +2 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/error-codes.md +5 -5
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/live-sources.md +3 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-api-reference.md +10 -4
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-core.md +19 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-environments.md +6 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-multiagent.md +1 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-onboarding.md +3 -3
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-overview.md +3 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-self-hosted-sandboxes.md +173 -0
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/managed-agents-tools.md +10 -4
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/model-migration.md +113 -13
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/models.md +14 -11
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/prompt-caching.md +2 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/shared/tool-use-concepts.md +4 -4
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/README.md +15 -15
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/batches.md +2 -2
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/files-api.md +1 -1
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/streaming.md +5 -5
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/claude-api/tool-use.md +15 -15
- package/bundled/upstream/anthropic-skills/skills/claude-api/typescript/managed-agents/README.md +3 -3
- package/bundled/upstream/ecc/.omc-source/bundle.json +2 -1
- package/bundled/upstream/ecc/.omc-source/last-plan-apply.json +108 -24
- package/bundled/upstream/ecc/.omc-source/manifests/.claude-plugin/marketplace.json +3 -3
- package/bundled/upstream/ecc/.omc-source/provenance.json +563 -0
- package/bundled/upstream/ecc/agents/marketing-agent.md +159 -0
- package/bundled/upstream/ecc/agents/react-build-resolver.md +215 -0
- package/bundled/upstream/ecc/agents/react-reviewer.md +167 -0
- package/bundled/upstream/ecc/agents/typescript-reviewer.md +3 -0
- package/bundled/upstream/ecc/commands/harness-audit.md +17 -10
- package/bundled/upstream/ecc/commands/marketing-campaign.md +129 -0
- package/bundled/upstream/ecc/commands/react-build.md +187 -0
- package/bundled/upstream/ecc/commands/react-review.md +170 -0
- package/bundled/upstream/ecc/commands/react-test.md +265 -0
- package/bundled/upstream/ecc/skills/benchmark-optimization-loop/SKILL.md +69 -0
- package/bundled/upstream/ecc/skills/blender-motion-state-inspection/SKILL.md +164 -0
- package/bundled/upstream/ecc/skills/canary-watch/SKILL.md +9 -1
- package/bundled/upstream/ecc/skills/continuous-learning-v2/hooks/observe.sh +31 -9
- package/bundled/upstream/ecc/skills/continuous-learning-v2/scripts/detect-project.sh +38 -4
- package/bundled/upstream/ecc/skills/continuous-learning-v2/scripts/instinct-cli.py +319 -12
- package/bundled/upstream/ecc/skills/data-throughput-accelerator/SKILL.md +72 -0
- package/bundled/upstream/ecc/skills/dynamic-workflow-mode/SKILL.md +123 -0
- package/bundled/upstream/ecc/skills/frontend-a11y/SKILL.md +446 -0
- package/bundled/upstream/ecc/skills/ito-basket-compare/SKILL.md +63 -0
- package/bundled/upstream/ecc/skills/ito-data-atlas-agent/SKILL.md +63 -0
- package/bundled/upstream/ecc/skills/ito-market-intelligence/SKILL.md +60 -0
- package/bundled/upstream/ecc/skills/ito-trade-planner/SKILL.md +67 -0
- package/bundled/upstream/ecc/skills/latency-critical-systems/SKILL.md +73 -0
- package/bundled/upstream/ecc/skills/marketing-campaign/SKILL.md +113 -0
- package/bundled/upstream/ecc/skills/nextjs-turbopack/SKILL.md +13 -0
- package/bundled/upstream/ecc/skills/parallel-execution-optimizer/SKILL.md +72 -0
- package/bundled/upstream/ecc/skills/prediction-market-oracle-research/SKILL.md +63 -0
- package/bundled/upstream/ecc/skills/prediction-market-risk-review/SKILL.md +60 -0
- package/bundled/upstream/ecc/skills/react-patterns/SKILL.md +341 -0
- package/bundled/upstream/ecc/skills/react-performance/SKILL.md +574 -0
- package/bundled/upstream/ecc/skills/react-testing/SKILL.md +423 -0
- package/bundled/upstream/ecc/skills/recsys-pipeline-architect/SKILL.md +114 -0
- package/bundled/upstream/ecc/skills/recursive-decision-ledger/SKILL.md +79 -0
- package/bundled/upstream/ecc/skills/social-publisher/SKILL.md +115 -0
- package/bundled/upstream/ecc/skills/team-agent-orchestration/SKILL.md +110 -0
- package/bundled/upstream/ecc/skills/uncloud/SKILL.md +343 -0
- package/bundled/upstream/ecc/skills/windows-desktop-e2e/SKILL.md +99 -0
- package/bundled/upstream/impeccable/.omc-source/bundle.json +20 -0
- package/bundled/upstream/impeccable/.omc-source/provenance.json +105 -0
- package/bundled/upstream/impeccable/agents/impeccable-manual-edit-applier.md +97 -0
- package/bundled/upstream/impeccable/skills/impeccable/SKILL.md +168 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/adapt.md +311 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/animate.md +201 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/audit.md +133 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/bolder.md +113 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/brand.md +108 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/clarify.md +288 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/codex.md +105 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/colorize.md +257 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/craft.md +123 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/critique.md +767 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/delight.md +302 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/distill.md +111 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/document.md +429 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/extract.md +69 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/harden.md +347 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/hooks.md +88 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/init.md +172 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/interaction-design.md +189 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/layout.md +161 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/live.md +718 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/onboard.md +234 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/optimize.md +258 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/overdrive.md +130 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/polish.md +241 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/product.md +60 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/quieter.md +99 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/shape.md +165 -0
- package/bundled/upstream/impeccable/skills/impeccable/reference/typeset.md +279 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/command-metadata.json +94 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/context-signals.mjs +225 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/context.mjs +280 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/critique-storage.mjs +242 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detect-csp.mjs +198 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detect.mjs +21 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/browser/injected/index.mjs +1735 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/cli/main.mjs +244 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +4907 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/detect-antipatterns.mjs +43 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +252 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +552 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +1013 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +208 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/findings.mjs +12 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/node/file-system.mjs +198 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/profile/profiler.mjs +166 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/registry/antipatterns.mjs +419 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/rules/checks.mjs +2671 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/shared/color.mjs +124 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/shared/constants.mjs +101 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/detector/shared/page.mjs +7 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/hook-admin.mjs +574 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/hook-before-edit.mjs +473 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/hook-lib.mjs +1286 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/hook.mjs +61 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/lib/design-parser.mjs +835 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/lib/impeccable-paths.mjs +126 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/lib/is-generated.mjs +69 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live/browser-script-parts.mjs +49 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live/completion.mjs +19 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live/event-validation.mjs +137 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live/insert-ui.mjs +458 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live/manual-apply.mjs +939 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live/manual-edit-routes.mjs +357 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live/manual-edits-buffer.mjs +152 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live/session-store.mjs +289 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live/svelte-component.mjs +826 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live/sveltekit-adapter.mjs +274 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live/ui-core.mjs +180 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live/vocabulary.mjs +36 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-accept.mjs +812 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-browser-dom.js +146 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-browser-session.js +123 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-browser.js +11086 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-commit-manual-edits.mjs +1241 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-complete.mjs +75 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-copy-edit-agent.mjs +683 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-discard-manual-edits.mjs +51 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-inject.mjs +583 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-insert.mjs +272 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-manual-edit-evidence.mjs +363 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-poll.mjs +379 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-resume.mjs +94 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-server.mjs +1134 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-status.mjs +61 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live-wrap.mjs +894 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/live.mjs +246 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/modern-screenshot.umd.js +14 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/palette.mjs +633 -0
- package/bundled/upstream/impeccable/skills/impeccable/scripts/pin.mjs +214 -0
- package/bundled/upstream/oh-my-claudecode/.omc-source/bundle.json +2 -1
- package/bundled/upstream/oh-my-claudecode/.omc-source/provenance.json +116 -0
- package/bundled/upstream/oh-my-claudecode/skills/autopilot/SKILL.md +7 -0
- package/bundled/upstream/oh-my-claudecode/skills/cancel/SKILL.md +1 -0
- package/bundled/upstream/oh-my-claudecode/skills/deep-interview/SKILL.md +39 -5
- package/bundled/upstream/oh-my-claudecode/skills/hud/SKILL.md +1 -0
- package/bundled/upstream/oh-my-claudecode/skills/local-build-reminder/SKILL.md +78 -0
- package/bundled/upstream/oh-my-claudecode/skills/omc-doctor/SKILL.md +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/omc-setup/SKILL.md +26 -10
- package/bundled/upstream/oh-my-claudecode/skills/omc-setup/phases/01-install-claude-md.md +3 -3
- package/bundled/upstream/oh-my-claudecode/skills/omc-setup/phases/02-configure.md +6 -4
- package/bundled/upstream/oh-my-claudecode/skills/omc-setup/phases/03-integrations.md +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/omc-setup/phases/04-welcome.md +2 -2
- package/bundled/upstream/oh-my-claudecode/skills/omc-teams/SKILL.md +6 -6
- package/bundled/upstream/oh-my-claudecode/skills/plan/SKILL.md +44 -32
- package/bundled/upstream/oh-my-claudecode/skills/ralph/SKILL.md +45 -21
- package/bundled/upstream/oh-my-claudecode/skills/ralplan/SKILL.md +1 -1
- package/bundled/upstream/oh-my-claudecode/skills/self-improve/SKILL.md +7 -0
- package/bundled/upstream/oh-my-claudecode/skills/self-improve/scripts/resolve-paths.mjs +39 -15
- package/bundled/upstream/oh-my-claudecode/skills/team/SKILL.md +132 -90
- package/bundled/upstream/oh-my-claudecode/skills/ultragoal/SKILL.md +93 -0
- package/bundled/upstream/oh-my-claudecode/skills/ultraqa/SKILL.md +28 -13
- package/bundled/upstream/oh-my-claudecode/skills/ultrawork/SKILL.md +7 -0
- package/bundled/upstream/superpowers/.omc-source/bundle.json +2 -1
- package/bundled/upstream/superpowers/.omc-source/provenance.json +63 -0
- package/package.json +2 -1
- package/src/catalog/source-catalog.js +10 -4
- package/src/cli/index.js +4 -0
- package/src/cli/plan.js +14 -2
- package/src/cli/setup.js +52 -13
- package/src/cli/skill.js +1 -1
- package/src/cli/source.js +271 -14
- package/src/config/sources.js +82 -1
- package/src/merge/content-patch.js +88 -0
- package/templates/merge-config.json +1 -8
- package/bundled/upstream/ecc/skills/strategic-compact/suggest-compact.sh +0 -54
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { createBrowserDetector, detectUrl } from '../engines/browser/detect-url.mjs';
|
|
5
|
+
import { detectHtml } from '../engines/static-html/detect-html.mjs';
|
|
6
|
+
import { detectText } from '../engines/regex/detect-text.mjs';
|
|
7
|
+
import {
|
|
8
|
+
HTML_EXTENSIONS,
|
|
9
|
+
buildImportGraph,
|
|
10
|
+
detectFrameworkConfig,
|
|
11
|
+
isPortListening,
|
|
12
|
+
walkDir,
|
|
13
|
+
} from '../node/file-system.mjs';
|
|
14
|
+
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Output formatting
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
function formatFindings(findings, jsonMode) {
|
|
20
|
+
if (jsonMode) return JSON.stringify(findings, null, 2);
|
|
21
|
+
|
|
22
|
+
const grouped = {};
|
|
23
|
+
for (const f of findings) {
|
|
24
|
+
if (!grouped[f.file]) grouped[f.file] = [];
|
|
25
|
+
grouped[f.file].push(f);
|
|
26
|
+
}
|
|
27
|
+
const out = [];
|
|
28
|
+
for (const [file, items] of Object.entries(grouped)) {
|
|
29
|
+
const importNote = items[0]?.importedBy?.length ? ` (imported by ${items[0].importedBy.join(', ')})` : '';
|
|
30
|
+
out.push(`\n${file}${importNote}`);
|
|
31
|
+
for (const item of items) {
|
|
32
|
+
out.push(` ${item.line ? `line ${item.line}: ` : ''}[${item.antipattern}] ${item.snippet}`);
|
|
33
|
+
out.push(` → ${item.description}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
out.push(`\n${findings.length} anti-pattern${findings.length === 1 ? '' : 's'} found.`);
|
|
37
|
+
return out.join('\n');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// Stdin handling
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
async function handleStdin(options = {}) {
|
|
45
|
+
const chunks = [];
|
|
46
|
+
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
47
|
+
const input = Buffer.concat(chunks).toString('utf-8');
|
|
48
|
+
try {
|
|
49
|
+
const parsed = JSON.parse(input);
|
|
50
|
+
const fp = parsed?.tool_input?.file_path;
|
|
51
|
+
if (fp && fs.existsSync(fp)) {
|
|
52
|
+
return HTML_EXTENSIONS.has(path.extname(fp).toLowerCase())
|
|
53
|
+
? detectHtml(fp, options) : detectText(fs.readFileSync(fp, 'utf-8'), fp, options);
|
|
54
|
+
}
|
|
55
|
+
} catch { /* not JSON */ }
|
|
56
|
+
return detectText(input, '<stdin>', options);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// CLI
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
|
|
64
|
+
async function confirm(question) {
|
|
65
|
+
const rl = (await import('node:readline')).default.createInterface({
|
|
66
|
+
input: process.stdin, output: process.stderr,
|
|
67
|
+
});
|
|
68
|
+
return new Promise((resolve) => {
|
|
69
|
+
rl.question(`${question} [Y/n] `, (answer) => {
|
|
70
|
+
rl.close();
|
|
71
|
+
resolve(!answer || /^y(es)?$/i.test(answer.trim()));
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function printUsage() {
|
|
77
|
+
console.log(`Usage: impeccable detect [options] [file-or-dir-or-url...]
|
|
78
|
+
|
|
79
|
+
Scan files or URLs for UI anti-patterns and design quality issues.
|
|
80
|
+
|
|
81
|
+
Options:
|
|
82
|
+
--json Output results as JSON
|
|
83
|
+
--gpt Also report GPT-specific provider tells (off by default)
|
|
84
|
+
--gemini Also report Gemini-specific provider tells (off by default)
|
|
85
|
+
--help Show this help message
|
|
86
|
+
|
|
87
|
+
Detection modes:
|
|
88
|
+
HTML files Static HTML/CSS analysis (default, catches linked CSS)
|
|
89
|
+
Non-HTML files Regex pattern matching (CSS, JSX, TSX, etc.)
|
|
90
|
+
URLs Puppeteer full browser rendering (auto-detected)
|
|
91
|
+
|
|
92
|
+
Examples:
|
|
93
|
+
impeccable detect src/
|
|
94
|
+
impeccable detect index.html
|
|
95
|
+
impeccable detect https://example.com
|
|
96
|
+
impeccable detect --json .`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
async function detectCli() {
|
|
100
|
+
let args = process.argv.slice(2).map(arg => {
|
|
101
|
+
if (arg === '-json') return '--json';
|
|
102
|
+
if (arg === '-fast') return '--fast';
|
|
103
|
+
return arg;
|
|
104
|
+
});
|
|
105
|
+
if (args[0] === 'detect') args = args.slice(1);
|
|
106
|
+
const jsonMode = args.includes('--json');
|
|
107
|
+
const helpMode = args.includes('--help');
|
|
108
|
+
// --fast (regex-only) is deprecated: since the jsdom removal, the static
|
|
109
|
+
// HTML/CSS analysis is fast and covers every rule, so the regex-only path
|
|
110
|
+
// only loses coverage for no real speed win. Accept the flag for back-compat
|
|
111
|
+
// but ignore it and run the full scan.
|
|
112
|
+
if (args.includes('--fast')) {
|
|
113
|
+
process.stderr.write(
|
|
114
|
+
'Note: --fast is deprecated and ignored. The full scan is fast now and runs every rule.\n',
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
const providers = [];
|
|
118
|
+
if (args.includes('--gpt')) providers.push('gpt');
|
|
119
|
+
if (args.includes('--gemini')) providers.push('gemini');
|
|
120
|
+
const scanOptions = { providers };
|
|
121
|
+
const targets = args.filter(a => !a.startsWith('--'));
|
|
122
|
+
|
|
123
|
+
if (helpMode) { printUsage(); process.exit(0); }
|
|
124
|
+
|
|
125
|
+
let allFindings = [];
|
|
126
|
+
|
|
127
|
+
if (!process.stdin.isTTY && targets.length === 0) {
|
|
128
|
+
allFindings = await handleStdin(scanOptions);
|
|
129
|
+
} else {
|
|
130
|
+
const paths = targets.length > 0 ? targets : [process.cwd()];
|
|
131
|
+
const urlTargetCount = paths.filter(target => /^https?:\/\//i.test(target)).length;
|
|
132
|
+
const browserDetector = urlTargetCount > 1 ? await createBrowserDetector() : null;
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
for (const target of paths) {
|
|
136
|
+
if (/^https?:\/\//i.test(target)) {
|
|
137
|
+
try {
|
|
138
|
+
const scanner = browserDetector
|
|
139
|
+
? (url) => browserDetector.detectUrl(url, scanOptions)
|
|
140
|
+
: (url) => detectUrl(url, scanOptions);
|
|
141
|
+
allFindings.push(...await scanner(target));
|
|
142
|
+
} catch (e) { process.stderr.write(`Error: ${e.message}\n`); }
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const resolved = path.resolve(target);
|
|
147
|
+
let stat;
|
|
148
|
+
try { stat = fs.statSync(resolved); }
|
|
149
|
+
catch { process.stderr.write(`Warning: cannot access ${target}\n`); continue; }
|
|
150
|
+
|
|
151
|
+
if (stat.isDirectory()) {
|
|
152
|
+
// Check for framework dev server config (skip in JSON mode to avoid polluting output)
|
|
153
|
+
if (!jsonMode) {
|
|
154
|
+
const fwConfig = detectFrameworkConfig(resolved);
|
|
155
|
+
if (fwConfig) {
|
|
156
|
+
const probe = await isPortListening(fwConfig.port, fwConfig.fingerprint);
|
|
157
|
+
if (probe.listening && probe.matched) {
|
|
158
|
+
process.stderr.write(
|
|
159
|
+
`\n${fwConfig.name} dev server detected on localhost:${fwConfig.port}.\n` +
|
|
160
|
+
`For more accurate results, scan the running site:\n` +
|
|
161
|
+
` npx impeccable detect http://localhost:${fwConfig.port}\n\n`
|
|
162
|
+
);
|
|
163
|
+
} else if (probe.listening && !probe.matched) {
|
|
164
|
+
process.stderr.write(
|
|
165
|
+
`\n${fwConfig.name} project detected (${path.basename(fwConfig.configPath)}).\n` +
|
|
166
|
+
`Port ${fwConfig.port} is in use by another service. Start the ${fwConfig.name} dev server and scan via URL for best results.\n\n`
|
|
167
|
+
);
|
|
168
|
+
} else {
|
|
169
|
+
process.stderr.write(
|
|
170
|
+
`\n${fwConfig.name} project detected (${path.basename(fwConfig.configPath)}).\n` +
|
|
171
|
+
`Start the dev server and scan via URL for best results:\n` +
|
|
172
|
+
` npx impeccable detect http://localhost:${fwConfig.port}\n\n`
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const files = walkDir(resolved);
|
|
179
|
+
const htmlCount = files.filter(f => HTML_EXTENSIONS.has(path.extname(f).toLowerCase())).length;
|
|
180
|
+
|
|
181
|
+
// Warn and confirm if scanning many files (static HTML/CSS processes each HTML file)
|
|
182
|
+
if (files.length > 50 && process.stdin.isTTY && !jsonMode) {
|
|
183
|
+
process.stderr.write(
|
|
184
|
+
`\nFound ${files.length} files (${htmlCount} HTML) in ${target}.\n` +
|
|
185
|
+
`Scanning may take a while${htmlCount > 10 ? ' (static HTML/CSS processes each HTML file individually)' : ''}.\n` +
|
|
186
|
+
`Target a specific subdirectory to narrow scope.\n`
|
|
187
|
+
);
|
|
188
|
+
const ok = await confirm('Continue?');
|
|
189
|
+
if (!ok) { process.stderr.write('Aborted.\n'); process.exit(0); }
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Build import graph for multi-file awareness
|
|
193
|
+
const graph = buildImportGraph(files);
|
|
194
|
+
// Build reverse map: file -> set of files that import it
|
|
195
|
+
const importedByMap = new Map();
|
|
196
|
+
for (const [importer, imports] of graph) {
|
|
197
|
+
for (const imported of imports) {
|
|
198
|
+
if (!importedByMap.has(imported)) importedByMap.set(imported, new Set());
|
|
199
|
+
importedByMap.get(imported).add(importer);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
for (const file of files) {
|
|
204
|
+
const ext = path.extname(file).toLowerCase();
|
|
205
|
+
let fileFindings;
|
|
206
|
+
if (HTML_EXTENSIONS.has(ext)) {
|
|
207
|
+
fileFindings = await detectHtml(file, scanOptions);
|
|
208
|
+
} else {
|
|
209
|
+
fileFindings = detectText(fs.readFileSync(file, 'utf-8'), file, scanOptions);
|
|
210
|
+
}
|
|
211
|
+
// Annotate findings with import context
|
|
212
|
+
const importers = importedByMap.get(file);
|
|
213
|
+
if (importers && importers.size > 0) {
|
|
214
|
+
const importerNames = [...importers].map(f => path.basename(f));
|
|
215
|
+
for (const f of fileFindings) {
|
|
216
|
+
f.importedBy = importerNames;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
allFindings.push(...fileFindings);
|
|
220
|
+
}
|
|
221
|
+
} else if (stat.isFile()) {
|
|
222
|
+
const ext = path.extname(resolved).toLowerCase();
|
|
223
|
+
if (HTML_EXTENSIONS.has(ext)) {
|
|
224
|
+
allFindings.push(...await detectHtml(resolved, scanOptions));
|
|
225
|
+
} else {
|
|
226
|
+
allFindings.push(...detectText(fs.readFileSync(resolved, 'utf-8'), resolved, scanOptions));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
} finally {
|
|
231
|
+
if (browserDetector) await browserDetector.close();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (allFindings.length > 0) {
|
|
236
|
+
if (jsonMode) process.stdout.write(formatFindings(allFindings, true) + '\n');
|
|
237
|
+
else process.stderr.write(formatFindings(allFindings, false) + '\n');
|
|
238
|
+
process.exit(2);
|
|
239
|
+
}
|
|
240
|
+
if (jsonMode) process.stdout.write('[]\n');
|
|
241
|
+
process.exit(0);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export { formatFindings, handleStdin, confirm, printUsage, detectCli };
|