effect-analyzer 0.1.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/README.md +202 -0
- package/dist/analyze-a8PswlPG.d.cts +1152 -0
- package/dist/analyze-a8PswlPG.d.ts +1152 -0
- package/dist/cli.js +198 -0
- package/dist/effect-workflow.cjs +5 -0
- package/dist/effect-workflow.cjs.map +1 -0
- package/dist/effect-workflow.d.cts +31 -0
- package/dist/effect-workflow.d.ts +31 -0
- package/dist/effect-workflow.js +5 -0
- package/dist/effect-workflow.js.map +1 -0
- package/dist/index.cjs +548 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1895 -0
- package/dist/index.d.ts +1895 -0
- package/dist/index.js +548 -0
- package/dist/index.js.map +1 -0
- package/dist/lsp/server.js +8827 -0
- package/package.json +76 -0
- package/scripts/analyze-public-repos.ts +130 -0
- package/scripts/audit-ci.ts +213 -0
- package/scripts/audit-public-effect-modules.ts +111 -0
- package/scripts/baselines/effect-audit-baseline.json +14 -0
- package/scripts/benchmark.ts +107 -0
- package/scripts/diff-effect-scans.ts +87 -0
- package/scripts/effect-scan-utils.ts +275 -0
- package/scripts/eslint-rules/no-inline-type-import.js +39 -0
- package/scripts/fetch-effect-repo.ts +52 -0
- package/scripts/openapi-runtime-runner.mjs +66 -0
- package/scripts/scan-effect-internals.ts +53 -0
- package/scripts/scan-effect-top-level.ts +52 -0
- package/scripts/summarize-scan.ts +47 -0
- package/scripts/triage-effect-scan.ts +85 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { basename } from 'path';
|
|
3
|
+
import type { ScanReport, ScanRow } from './effect-scan-utils';
|
|
4
|
+
|
|
5
|
+
function getArgValue(flag: string): string | undefined {
|
|
6
|
+
const idx = process.argv.indexOf(flag);
|
|
7
|
+
if (idx === -1) return undefined;
|
|
8
|
+
const next = process.argv[idx + 1];
|
|
9
|
+
if (!next || next.startsWith('--')) return undefined;
|
|
10
|
+
return next;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getArgInt(flag: string, fallback: number): number {
|
|
14
|
+
const raw = getArgValue(flag);
|
|
15
|
+
if (!raw) return fallback;
|
|
16
|
+
const n = Number.parseInt(raw, 10);
|
|
17
|
+
return Number.isFinite(n) && n > 0 ? n : fallback;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function loadReport(path: string): ScanReport {
|
|
21
|
+
return JSON.parse(readFileSync(path, 'utf8')) as ScanReport;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function matchesTag(row: ScanRow, tagFilter?: string): boolean {
|
|
25
|
+
if (!tagFilter) return true;
|
|
26
|
+
return row.tag === tagFilter || row.tag.startsWith(tagFilter);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function matchesReason(row: ScanRow, reasonFilter?: string): boolean {
|
|
30
|
+
if (!reasonFilter) return true;
|
|
31
|
+
return row.zeroProgramsReason === reasonFilter;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function sourcePreview(file: string, maxLines: number): string {
|
|
35
|
+
try {
|
|
36
|
+
const src = readFileSync(file, 'utf8');
|
|
37
|
+
return src.split('\n').slice(0, maxLines).join('\n');
|
|
38
|
+
} catch (error) {
|
|
39
|
+
return `<failed to read: ${String(error)}>`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function main(): void {
|
|
44
|
+
const reportPath = process.argv[2];
|
|
45
|
+
if (!reportPath) {
|
|
46
|
+
console.error(
|
|
47
|
+
'usage: pnpm exec tsx scripts/triage-effect-scan.ts <scan.json> [--reason <zeroProgramsReason>] [--tag <prefix>] [--limit N] [--preview-lines N]',
|
|
48
|
+
);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const report = loadReport(reportPath);
|
|
53
|
+
const reason = getArgValue('--reason');
|
|
54
|
+
const tag = getArgValue('--tag');
|
|
55
|
+
const limit = getArgInt('--limit', 20);
|
|
56
|
+
const previewLines = getArgInt('--preview-lines', 0);
|
|
57
|
+
|
|
58
|
+
const rows = report.rows
|
|
59
|
+
.filter((row) => matchesTag(row, tag))
|
|
60
|
+
.filter((row) => matchesReason(row, reason));
|
|
61
|
+
|
|
62
|
+
console.log(`report=${basename(reportPath)} total=${report.rows.length} matched=${rows.length}`);
|
|
63
|
+
if (reason) console.log(`reason=${reason}`);
|
|
64
|
+
if (tag) console.log(`tag=${tag}`);
|
|
65
|
+
|
|
66
|
+
for (const row of rows.slice(0, limit)) {
|
|
67
|
+
const reasonText = row.zeroProgramsReason ? ` (${row.zeroProgramsReason})` : '';
|
|
68
|
+
console.log(`\n- ${row.file}`);
|
|
69
|
+
console.log(` ${row.tag}${reasonText}${row.info ? ` :: ${row.info}` : ''}`);
|
|
70
|
+
if (previewLines > 0) {
|
|
71
|
+
const preview = sourcePreview(row.file, previewLines)
|
|
72
|
+
.split('\n')
|
|
73
|
+
.map((line) => ` | ${line}`)
|
|
74
|
+
.join('\n');
|
|
75
|
+
console.log(preview);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (rows.length > limit) {
|
|
80
|
+
console.log(`\n... ${rows.length - limit} more rows (increase --limit)`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
main();
|
|
85
|
+
|