self-evolve-framework 1.5.0 → 1.6.1

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.
Files changed (154) hide show
  1. package/README.md +33 -23
  2. package/bin/cli.js +24 -67
  3. package/package.json +1 -1
  4. package/template/rules/knowledge/README.md +56 -0
  5. package/template/rules/knowledge/ant-design-vue.mdc +54 -0
  6. package/template/rules/knowledge/general.mdc +56 -0
  7. package/template/rules/knowledge/rust.mdc +55 -0
  8. package/template/rules/knowledge/shadcn-svelte.mdc +64 -0
  9. package/template/rules/knowledge/svelte.mdc +135 -0
  10. package/template/rules/knowledge/tailwind.mdc +66 -0
  11. package/template/rules/knowledge/tauri.mdc +65 -0
  12. package/template/rules/knowledge/typescript.mdc +41 -0
  13. package/template/rules/knowledge/vue.mdc +48 -0
  14. package/template/rules/ponytail.mdc +23 -98
  15. package/template/rules/self-evolve.mdc +24 -0
  16. package/template/skills/impeccable/SKILL.md +47 -174
  17. package/template/skills/skillopt-sleep/SKILL.md +34 -48
  18. package/template/skills/impeccable/agents/impeccable_asset_producer.toml +0 -92
  19. package/template/skills/impeccable/agents/impeccable_manual_edit_applier.toml +0 -95
  20. package/template/skills/impeccable/agents/openai.yaml +0 -4
  21. package/template/skills/impeccable/reference/adapt.md +0 -311
  22. package/template/skills/impeccable/reference/animate.md +0 -201
  23. package/template/skills/impeccable/reference/audit.md +0 -133
  24. package/template/skills/impeccable/reference/bolder.md +0 -113
  25. package/template/skills/impeccable/reference/brand.md +0 -108
  26. package/template/skills/impeccable/reference/clarify.md +0 -288
  27. package/template/skills/impeccable/reference/codex.md +0 -105
  28. package/template/skills/impeccable/reference/colorize.md +0 -257
  29. package/template/skills/impeccable/reference/craft.md +0 -123
  30. package/template/skills/impeccable/reference/critique.md +0 -790
  31. package/template/skills/impeccable/reference/delight.md +0 -302
  32. package/template/skills/impeccable/reference/distill.md +0 -111
  33. package/template/skills/impeccable/reference/document.md +0 -429
  34. package/template/skills/impeccable/reference/extract.md +0 -69
  35. package/template/skills/impeccable/reference/harden.md +0 -347
  36. package/template/skills/impeccable/reference/hooks.md +0 -90
  37. package/template/skills/impeccable/reference/init.md +0 -172
  38. package/template/skills/impeccable/reference/interaction-design.md +0 -189
  39. package/template/skills/impeccable/reference/layout.md +0 -161
  40. package/template/skills/impeccable/reference/live.md +0 -720
  41. package/template/skills/impeccable/reference/onboard.md +0 -234
  42. package/template/skills/impeccable/reference/optimize.md +0 -258
  43. package/template/skills/impeccable/reference/overdrive.md +0 -130
  44. package/template/skills/impeccable/reference/polish.md +0 -241
  45. package/template/skills/impeccable/reference/product.md +0 -60
  46. package/template/skills/impeccable/reference/quieter.md +0 -99
  47. package/template/skills/impeccable/reference/shape.md +0 -165
  48. package/template/skills/impeccable/reference/typeset.md +0 -279
  49. package/template/skills/impeccable/scripts/command-metadata.json +0 -94
  50. package/template/skills/impeccable/scripts/context-signals.mjs +0 -225
  51. package/template/skills/impeccable/scripts/context.mjs +0 -961
  52. package/template/skills/impeccable/scripts/critique-storage.mjs +0 -242
  53. package/template/skills/impeccable/scripts/detect-csp.mjs +0 -198
  54. package/template/skills/impeccable/scripts/detect.mjs +0 -21
  55. package/template/skills/impeccable/scripts/detector/browser/injected/index.mjs +0 -1937
  56. package/template/skills/impeccable/scripts/detector/cli/main.mjs +0 -290
  57. package/template/skills/impeccable/scripts/detector/design-system.mjs +0 -750
  58. package/template/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +0 -5138
  59. package/template/skills/impeccable/scripts/detector/detect-antipatterns.mjs +0 -50
  60. package/template/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +0 -277
  61. package/template/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +0 -568
  62. package/template/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +0 -1015
  63. package/template/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +0 -234
  64. package/template/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -189
  65. package/template/skills/impeccable/scripts/detector/findings.mjs +0 -12
  66. package/template/skills/impeccable/scripts/detector/node/file-system.mjs +0 -198
  67. package/template/skills/impeccable/scripts/detector/profile/profiler.mjs +0 -166
  68. package/template/skills/impeccable/scripts/detector/registry/antipatterns.mjs +0 -448
  69. package/template/skills/impeccable/scripts/detector/rules/checks.mjs +0 -2671
  70. package/template/skills/impeccable/scripts/detector/shared/color.mjs +0 -124
  71. package/template/skills/impeccable/scripts/detector/shared/constants.mjs +0 -101
  72. package/template/skills/impeccable/scripts/detector/shared/inline-ignores.mjs +0 -148
  73. package/template/skills/impeccable/scripts/detector/shared/page.mjs +0 -7
  74. package/template/skills/impeccable/scripts/hook-admin.mjs +0 -661
  75. package/template/skills/impeccable/scripts/hook-before-edit.mjs +0 -476
  76. package/template/skills/impeccable/scripts/hook-lib.mjs +0 -1632
  77. package/template/skills/impeccable/scripts/hook.mjs +0 -61
  78. package/template/skills/impeccable/scripts/lib/design-parser.mjs +0 -842
  79. package/template/skills/impeccable/scripts/lib/impeccable-config.mjs +0 -638
  80. package/template/skills/impeccable/scripts/lib/impeccable-paths.mjs +0 -128
  81. package/template/skills/impeccable/scripts/lib/is-generated.mjs +0 -69
  82. package/template/skills/impeccable/scripts/lib/target-args.mjs +0 -42
  83. package/template/skills/impeccable/scripts/live/browser-script-parts.mjs +0 -49
  84. package/template/skills/impeccable/scripts/live/completion.mjs +0 -19
  85. package/template/skills/impeccable/scripts/live/event-validation.mjs +0 -137
  86. package/template/skills/impeccable/scripts/live/insert-ui.mjs +0 -458
  87. package/template/skills/impeccable/scripts/live/manual-apply.mjs +0 -939
  88. package/template/skills/impeccable/scripts/live/manual-edit-routes.mjs +0 -357
  89. package/template/skills/impeccable/scripts/live/manual-edits-buffer.mjs +0 -152
  90. package/template/skills/impeccable/scripts/live/session-store.mjs +0 -289
  91. package/template/skills/impeccable/scripts/live/svelte-component.mjs +0 -826
  92. package/template/skills/impeccable/scripts/live/sveltekit-adapter.mjs +0 -274
  93. package/template/skills/impeccable/scripts/live/ui-core.mjs +0 -180
  94. package/template/skills/impeccable/scripts/live/vocabulary.mjs +0 -36
  95. package/template/skills/impeccable/scripts/live-accept.mjs +0 -812
  96. package/template/skills/impeccable/scripts/live-browser-dom.js +0 -146
  97. package/template/skills/impeccable/scripts/live-browser-session.js +0 -123
  98. package/template/skills/impeccable/scripts/live-browser.js +0 -11173
  99. package/template/skills/impeccable/scripts/live-commit-manual-edits.mjs +0 -1241
  100. package/template/skills/impeccable/scripts/live-complete.mjs +0 -75
  101. package/template/skills/impeccable/scripts/live-copy-edit-agent.mjs +0 -683
  102. package/template/skills/impeccable/scripts/live-discard-manual-edits.mjs +0 -51
  103. package/template/skills/impeccable/scripts/live-inject.mjs +0 -583
  104. package/template/skills/impeccable/scripts/live-insert.mjs +0 -272
  105. package/template/skills/impeccable/scripts/live-manual-edit-evidence.mjs +0 -363
  106. package/template/skills/impeccable/scripts/live-poll.mjs +0 -384
  107. package/template/skills/impeccable/scripts/live-resume.mjs +0 -94
  108. package/template/skills/impeccable/scripts/live-server.mjs +0 -1135
  109. package/template/skills/impeccable/scripts/live-status.mjs +0 -61
  110. package/template/skills/impeccable/scripts/live-target.mjs +0 -30
  111. package/template/skills/impeccable/scripts/live-wrap.mjs +0 -894
  112. package/template/skills/impeccable/scripts/live.mjs +0 -297
  113. package/template/skills/impeccable/scripts/modern-screenshot.umd.js +0 -14
  114. package/template/skills/impeccable/scripts/palette.mjs +0 -633
  115. package/template/skills/impeccable/scripts/pin.mjs +0 -214
  116. package/template/skills/skillopt-sleep/scripts/python/__init__.py +0 -20
  117. package/template/skills/skillopt-sleep/scripts/python/__main__.py +0 -343
  118. package/template/skills/skillopt-sleep/scripts/python/backend.py +0 -1371
  119. package/template/skills/skillopt-sleep/scripts/python/budget.py +0 -75
  120. package/template/skills/skillopt-sleep/scripts/python/config.py +0 -162
  121. package/template/skills/skillopt-sleep/scripts/python/consolidate.py +0 -238
  122. package/template/skills/skillopt-sleep/scripts/python/cycle.py +0 -291
  123. package/template/skills/skillopt-sleep/scripts/python/dream.py +0 -138
  124. package/template/skills/skillopt-sleep/scripts/python/experiments/__init__.py +0 -1
  125. package/template/skills/skillopt-sleep/scripts/python/experiments/gbrain_bench.py +0 -119
  126. package/template/skills/skillopt-sleep/scripts/python/experiments/personas.py +0 -86
  127. package/template/skills/skillopt-sleep/scripts/python/experiments/report.py +0 -132
  128. package/template/skills/skillopt-sleep/scripts/python/experiments/run_experiment.py +0 -178
  129. package/template/skills/skillopt-sleep/scripts/python/experiments/run_gbrain.py +0 -209
  130. package/template/skills/skillopt-sleep/scripts/python/experiments/run_transfer.py +0 -155
  131. package/template/skills/skillopt-sleep/scripts/python/experiments/sweep.py +0 -164
  132. package/template/skills/skillopt-sleep/scripts/python/gate.py +0 -50
  133. package/template/skills/skillopt-sleep/scripts/python/harvest.py +0 -304
  134. package/template/skills/skillopt-sleep/scripts/python/harvest_codex.py +0 -253
  135. package/template/skills/skillopt-sleep/scripts/python/harvest_sources.py +0 -41
  136. package/template/skills/skillopt-sleep/scripts/python/judges.py +0 -84
  137. package/template/skills/skillopt-sleep/scripts/python/llm_miner.py +0 -134
  138. package/template/skills/skillopt-sleep/scripts/python/memory.py +0 -129
  139. package/template/skills/skillopt-sleep/scripts/python/mine.py +0 -312
  140. package/template/skills/skillopt-sleep/scripts/python/replay.py +0 -146
  141. package/template/skills/skillopt-sleep/scripts/python/rollout.py +0 -153
  142. package/template/skills/skillopt-sleep/scripts/python/scheduler.py +0 -138
  143. package/template/skills/skillopt-sleep/scripts/python/slow_update.py +0 -142
  144. package/template/skills/skillopt-sleep/scripts/python/staging.py +0 -103
  145. package/template/skills/skillopt-sleep/scripts/python/state.py +0 -96
  146. package/template/skills/skillopt-sleep/scripts/python/tasks_file.py +0 -81
  147. package/template/skills/skillopt-sleep/scripts/python/types.py +0 -146
  148. package/template/skills/skillopt-sleep/scripts/shell/__init__.py +0 -0
  149. package/template/skills/skillopt-sleep/scripts/shell/eval_only.py +0 -466
  150. package/template/skills/skillopt-sleep/scripts/shell/materialize_searchqa.py +0 -148
  151. package/template/skills/skillopt-sleep/scripts/shell/run_alfworld.sh +0 -60
  152. package/template/skills/skillopt-sleep/scripts/shell/run_searchqa.sh +0 -40
  153. package/template/skills/skillopt-sleep/scripts/shell/run_spreadsheetbench.sh +0 -39
  154. package/template/skills/skillopt-sleep/scripts/shell/train.py +0 -556
@@ -1,290 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
-
4
- import { loadDesignSystemForCwd } from '../design-system.mjs';
5
- import { createBrowserDetector, detectUrl } from '../engines/browser/detect-url.mjs';
6
- import { detectHtml } from '../engines/static-html/detect-html.mjs';
7
- import { detectText } from '../engines/regex/detect-text.mjs';
8
- import {
9
- filterDetectionFindings,
10
- readDetectionConfig,
11
- shouldIgnoreDetectionFile,
12
- } from '../../lib/impeccable-config.mjs';
13
- import {
14
- HTML_EXTENSIONS,
15
- buildImportGraph,
16
- detectFrameworkConfig,
17
- isPortListening,
18
- walkDir,
19
- } from '../node/file-system.mjs';
20
-
21
- // ---------------------------------------------------------------------------
22
- // Output formatting
23
- // ---------------------------------------------------------------------------
24
-
25
- function formatFindingSummary(count) {
26
- return `${count} anti-pattern${count === 1 ? '' : 's'} found.`;
27
- }
28
-
29
- function formatFindings(findings, jsonMode) {
30
- if (jsonMode) return JSON.stringify(findings, null, 2);
31
-
32
- const grouped = {};
33
- for (const f of findings) {
34
- if (!grouped[f.file]) grouped[f.file] = [];
35
- grouped[f.file].push(f);
36
- }
37
- const out = [];
38
- for (const [file, items] of Object.entries(grouped)) {
39
- const importNote = items[0]?.importedBy?.length ? ` (imported by ${items[0].importedBy.join(', ')})` : '';
40
- out.push(`\n${file}${importNote}`);
41
- for (const item of items) {
42
- out.push(` ${item.line ? `line ${item.line}: ` : ''}[${item.antipattern}] ${item.snippet}`);
43
- out.push(` → ${item.description}`);
44
- }
45
- }
46
- out.push(`\n${formatFindingSummary(findings.length)}`);
47
- return out.join('\n');
48
- }
49
-
50
- // ---------------------------------------------------------------------------
51
- // Stdin handling
52
- // ---------------------------------------------------------------------------
53
-
54
- async function handleStdin(options = {}) {
55
- const chunks = [];
56
- for await (const chunk of process.stdin) chunks.push(chunk);
57
- const input = Buffer.concat(chunks).toString('utf-8');
58
- try {
59
- const parsed = JSON.parse(input);
60
- const fp = parsed?.tool_input?.file_path;
61
- if (fp && fs.existsSync(fp)) {
62
- return HTML_EXTENSIONS.has(path.extname(fp).toLowerCase())
63
- ? detectHtml(fp, options) : detectText(fs.readFileSync(fp, 'utf-8'), fp, options);
64
- }
65
- } catch { /* not JSON */ }
66
- return detectText(input, '<stdin>', options);
67
- }
68
-
69
-
70
- // ---------------------------------------------------------------------------
71
- // CLI
72
- // ---------------------------------------------------------------------------
73
-
74
- async function confirm(question) {
75
- const rl = (await import('node:readline')).default.createInterface({
76
- input: process.stdin, output: process.stderr,
77
- });
78
- return new Promise((resolve) => {
79
- rl.question(`${question} [Y/n] `, (answer) => {
80
- rl.close();
81
- resolve(!answer || /^y(es)?$/i.test(answer.trim()));
82
- });
83
- });
84
- }
85
-
86
- function printUsage() {
87
- console.log(`Usage: impeccable detect [options] [file-or-dir-or-url...]
88
-
89
- Scan files or URLs for UI anti-patterns and design quality issues.
90
-
91
- Options:
92
- --json Output results as JSON
93
- --quiet In text mode, only print the final findings count
94
- --gpt Also report GPT-specific provider tells (off by default)
95
- --gemini Also report Gemini-specific provider tells (off by default)
96
- --no-config Do not apply project config, detector ignores, inline
97
- ignore comments, or DESIGN.md
98
- --no-inline-ignores Do not honor in-file impeccable-disable* ignore comments
99
- --no-design-system Do not load local DESIGN.md / .impeccable/design.json context
100
- --help Show this help message
101
-
102
- Project config:
103
- Respects .impeccable/config.json and .impeccable/config.local.json detector
104
- settings: detector.ignoreRules, detector.ignoreFiles, detector.ignoreValues,
105
- and detector.designSystem.enabled.
106
-
107
- Inline ignores:
108
- In-file comments waive a finding where it lives and travel with the file:
109
- <!-- impeccable-disable overused-font -- exported brand doc -->
110
- .brand { font-family: Inter } /* impeccable-disable-line overused-font */
111
- // impeccable-disable-next-line bounce-easing: intentional bounce
112
- impeccable-disable applies to the whole file; -line / -next-line are scoped.
113
- List one or more rule ids (comma-separated), or omit them / use * for all.
114
-
115
- Detection modes:
116
- HTML files Static HTML/CSS analysis (default, catches linked CSS)
117
- Non-HTML files Regex pattern matching (CSS, JSX, TSX, etc.)
118
- URLs Puppeteer full browser rendering (auto-detected)
119
-
120
- Examples:
121
- impeccable detect src/
122
- impeccable detect index.html
123
- impeccable detect https://example.com
124
- impeccable detect --json .
125
- impeccable detect --no-config src/`);
126
- }
127
-
128
- async function detectCli() {
129
- let args = process.argv.slice(2).map(arg => {
130
- if (arg === '-json') return '--json';
131
- if (arg === '-fast') return '--fast';
132
- return arg;
133
- });
134
- if (args[0] === 'detect') args = args.slice(1);
135
- const jsonMode = args.includes('--json');
136
- const quietMode = args.includes('--quiet');
137
- const helpMode = args.includes('--help');
138
- // --fast (regex-only) is deprecated: since the jsdom removal, the static
139
- // HTML/CSS analysis is fast and covers every rule, so the regex-only path
140
- // only loses coverage for no real speed win. Accept the flag for back-compat
141
- // but ignore it and run the full scan.
142
- if (args.includes('--fast')) {
143
- process.stderr.write(
144
- 'Note: --fast is deprecated and ignored. The full scan is fast now and runs every rule.\n',
145
- );
146
- }
147
- const configEnabled = !args.includes('--no-config');
148
- const detectionConfig = configEnabled
149
- ? readDetectionConfig(process.cwd())
150
- : { ignoreRules: [], ignoreFiles: [], ignoreValues: [] };
151
- const providers = [];
152
- if (args.includes('--gpt')) providers.push('gpt');
153
- if (args.includes('--gemini')) providers.push('gemini');
154
- const designSystemEnabled = configEnabled && !args.includes('--no-design-system') && detectionConfig.designSystem?.enabled !== false;
155
- const designSystem = designSystemEnabled ? loadDesignSystemForCwd(process.cwd()) : null;
156
- // Inline `impeccable-disable*` waivers are part of the scanned file, so they
157
- // apply by default. `--no-config` (raw scan) and the dedicated
158
- // `--no-inline-ignores` both turn them off.
159
- const inlineIgnoresEnabled = configEnabled && !args.includes('--no-inline-ignores');
160
- const scanOptions = { providers, inlineIgnores: inlineIgnoresEnabled };
161
- if (designSystem) scanOptions.designSystem = designSystem;
162
- const targets = args.filter(a => !a.startsWith('--'));
163
-
164
- if (helpMode) { printUsage(); process.exit(0); }
165
-
166
- let allFindings = [];
167
-
168
- if (!process.stdin.isTTY && targets.length === 0) {
169
- allFindings = await handleStdin(scanOptions);
170
- } else {
171
- const paths = targets.length > 0 ? targets : [process.cwd()];
172
- const urlTargetCount = paths.filter(target => /^https?:\/\//i.test(target)).length;
173
- const browserDetector = urlTargetCount > 1 ? await createBrowserDetector() : null;
174
-
175
- try {
176
- for (const target of paths) {
177
- if (/^https?:\/\//i.test(target)) {
178
- try {
179
- const scanner = browserDetector
180
- ? (url) => browserDetector.detectUrl(url, scanOptions)
181
- : (url) => detectUrl(url, scanOptions);
182
- allFindings.push(...await scanner(target));
183
- } catch (e) { process.stderr.write(`Error: ${e.message}\n`); }
184
- continue;
185
- }
186
-
187
- const resolved = path.resolve(target);
188
- let stat;
189
- try { stat = fs.statSync(resolved); }
190
- catch { process.stderr.write(`Warning: cannot access ${target}\n`); continue; }
191
-
192
- if (stat.isDirectory()) {
193
- // Check for framework dev server config (skip in JSON/quiet modes to avoid polluting output)
194
- if (!jsonMode && !quietMode) {
195
- const fwConfig = detectFrameworkConfig(resolved);
196
- if (fwConfig) {
197
- const probe = await isPortListening(fwConfig.port, fwConfig.fingerprint);
198
- if (probe.listening && probe.matched) {
199
- process.stderr.write(
200
- `\n${fwConfig.name} dev server detected on localhost:${fwConfig.port}.\n` +
201
- `For more accurate results, scan the running site:\n` +
202
- ` npx impeccable detect http://localhost:${fwConfig.port}\n\n`
203
- );
204
- } else if (probe.listening && !probe.matched) {
205
- process.stderr.write(
206
- `\n${fwConfig.name} project detected (${path.basename(fwConfig.configPath)}).\n` +
207
- `Port ${fwConfig.port} is in use by another service. Start the ${fwConfig.name} dev server and scan via URL for best results.\n\n`
208
- );
209
- } else {
210
- process.stderr.write(
211
- `\n${fwConfig.name} project detected (${path.basename(fwConfig.configPath)}).\n` +
212
- `Start the dev server and scan via URL for best results:\n` +
213
- ` npx impeccable detect http://localhost:${fwConfig.port}\n\n`
214
- );
215
- }
216
- }
217
- }
218
-
219
- const files = walkDir(resolved)
220
- .filter(file => !shouldIgnoreDetectionFile(file, process.cwd(), detectionConfig));
221
- const htmlCount = files.filter(f => HTML_EXTENSIONS.has(path.extname(f).toLowerCase())).length;
222
-
223
- // Warn and confirm if scanning many files (static HTML/CSS processes each HTML file)
224
- if (files.length > 50 && process.stdin.isTTY && !jsonMode && !quietMode) {
225
- process.stderr.write(
226
- `\nFound ${files.length} files (${htmlCount} HTML) in ${target}.\n` +
227
- `Scanning may take a while${htmlCount > 10 ? ' (static HTML/CSS processes each HTML file individually)' : ''}.\n` +
228
- `Target a specific subdirectory to narrow scope.\n`
229
- );
230
- const ok = await confirm('Continue?');
231
- if (!ok) { process.stderr.write('Aborted.\n'); process.exit(0); }
232
- }
233
-
234
- // Build import graph for multi-file awareness
235
- const graph = buildImportGraph(files);
236
- // Build reverse map: file -> set of files that import it
237
- const importedByMap = new Map();
238
- for (const [importer, imports] of graph) {
239
- for (const imported of imports) {
240
- if (!importedByMap.has(imported)) importedByMap.set(imported, new Set());
241
- importedByMap.get(imported).add(importer);
242
- }
243
- }
244
-
245
- for (const file of files) {
246
- const ext = path.extname(file).toLowerCase();
247
- let fileFindings;
248
- if (HTML_EXTENSIONS.has(ext)) {
249
- fileFindings = await detectHtml(file, scanOptions);
250
- } else {
251
- fileFindings = detectText(fs.readFileSync(file, 'utf-8'), file, scanOptions);
252
- }
253
- // Annotate findings with import context
254
- const importers = importedByMap.get(file);
255
- if (importers && importers.size > 0) {
256
- const importerNames = [...importers].map(f => path.basename(f));
257
- for (const f of fileFindings) {
258
- f.importedBy = importerNames;
259
- }
260
- }
261
- allFindings.push(...fileFindings);
262
- }
263
- } else if (stat.isFile()) {
264
- if (shouldIgnoreDetectionFile(resolved, process.cwd(), detectionConfig)) continue;
265
- const ext = path.extname(resolved).toLowerCase();
266
- if (HTML_EXTENSIONS.has(ext)) {
267
- allFindings.push(...await detectHtml(resolved, scanOptions));
268
- } else {
269
- allFindings.push(...detectText(fs.readFileSync(resolved, 'utf-8'), resolved, scanOptions));
270
- }
271
- }
272
- }
273
- } finally {
274
- if (browserDetector) await browserDetector.close();
275
- }
276
- }
277
-
278
- allFindings = filterDetectionFindings(allFindings, detectionConfig);
279
-
280
- if (allFindings.length > 0) {
281
- if (jsonMode) process.stdout.write(formatFindings(allFindings, true) + '\n');
282
- else if (quietMode) process.stderr.write(formatFindingSummary(allFindings.length) + '\n');
283
- else process.stderr.write(formatFindings(allFindings, false) + '\n');
284
- process.exit(2);
285
- }
286
- if (jsonMode) process.stdout.write('[]\n');
287
- process.exit(0);
288
- }
289
-
290
- export { formatFindings, handleStdin, confirm, printUsage, detectCli };