@xenos1996/usat 1.0.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/LICENSE +21 -0
- package/README.md +335 -0
- package/USAT.md +596 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +438 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +72 -0
- package/dist/config.js.map +1 -0
- package/dist/detect/index.d.ts +58 -0
- package/dist/detect/index.d.ts.map +1 -0
- package/dist/detect/index.js +329 -0
- package/dist/detect/index.js.map +1 -0
- package/dist/engine/audit.d.ts +21 -0
- package/dist/engine/audit.d.ts.map +1 -0
- package/dist/engine/audit.js +295 -0
- package/dist/engine/audit.js.map +1 -0
- package/dist/engine/diff.d.ts +24 -0
- package/dist/engine/diff.d.ts.map +1 -0
- package/dist/engine/diff.js +136 -0
- package/dist/engine/diff.js.map +1 -0
- package/dist/engine/evaluate.d.ts +19 -0
- package/dist/engine/evaluate.d.ts.map +1 -0
- package/dist/engine/evaluate.js +377 -0
- package/dist/engine/evaluate.js.map +1 -0
- package/dist/engine/gate.d.ts +19 -0
- package/dist/engine/gate.d.ts.map +1 -0
- package/dist/engine/gate.js +47 -0
- package/dist/engine/gate.js.map +1 -0
- package/dist/engine/loader.d.ts +22 -0
- package/dist/engine/loader.d.ts.map +1 -0
- package/dist/engine/loader.js +360 -0
- package/dist/engine/loader.js.map +1 -0
- package/dist/engine/maturity.d.ts +20 -0
- package/dist/engine/maturity.d.ts.map +1 -0
- package/dist/engine/maturity.js +157 -0
- package/dist/engine/maturity.js.map +1 -0
- package/dist/engine/score.d.ts +19 -0
- package/dist/engine/score.d.ts.map +1 -0
- package/dist/engine/score.js +141 -0
- package/dist/engine/score.js.map +1 -0
- package/dist/engine/sections.d.ts +14 -0
- package/dist/engine/sections.d.ts.map +1 -0
- package/dist/engine/sections.js +50 -0
- package/dist/engine/sections.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/report/markdown.d.ts +16 -0
- package/dist/report/markdown.d.ts.map +1 -0
- package/dist/report/markdown.js +488 -0
- package/dist/report/markdown.js.map +1 -0
- package/dist/types.d.ts +282 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/dist/util/glob.d.ts +11 -0
- package/dist/util/glob.d.ts.map +1 -0
- package/dist/util/glob.js +86 -0
- package/dist/util/glob.js.map +1 -0
- package/dist/util/project.d.ts +72 -0
- package/dist/util/project.d.ts.map +1 -0
- package/dist/util/project.js +586 -0
- package/dist/util/project.js.map +1 -0
- package/dist/util/yaml.d.ts +28 -0
- package/dist/util/yaml.d.ts.map +1 -0
- package/dist/util/yaml.js +48 -0
- package/dist/util/yaml.js.map +1 -0
- package/docs/ARCHITECTURE.md +119 -0
- package/docs/README.md +27 -0
- package/docs/adr/0001-record-architecture-decisions.md +35 -0
- package/docs/adr/0002-typescript-engine-over-python.md +49 -0
- package/docs/adr/0003-rules-are-data-not-code.md +50 -0
- package/docs/adr/0004-markdown-only-output.md +41 -0
- package/docs/adr/0005-maturity-dampens-severity.md +56 -0
- package/docs/adr/0006-severity-status-two-axes.md +48 -0
- package/docs/adr/0007-suppressions-are-visible-and-expiring.md +46 -0
- package/docs/adr/0008-report-trailer-and-diff.md +48 -0
- package/docs/adr/0009-fail-closed-on-malformed-input.md +56 -0
- package/docs/adr/0010-detector-design.md +54 -0
- package/docs/adr/0011-coexist-with-deep-scanners.md +52 -0
- package/docs/adr/README.md +32 -0
- package/docs/agent-integration.md +129 -0
- package/docs/ci-integration.md +163 -0
- package/docs/concepts.md +196 -0
- package/docs/configuration.md +105 -0
- package/docs/detectors.md +186 -0
- package/docs/getting-started.md +99 -0
- package/docs/maturity-profiles.md +156 -0
- package/docs/reference/api.md +193 -0
- package/docs/reference/cli.md +412 -0
- package/docs/rule-packs.md +278 -0
- package/docs/standards-mapping.md +171 -0
- package/package.json +96 -0
- package/rules/core/architecture.yaml +190 -0
- package/rules/core/cicd.yaml +212 -0
- package/rules/core/code-quality.yaml +261 -0
- package/rules/core/dependencies.yaml +132 -0
- package/rules/core/documentation.yaml +119 -0
- package/rules/core/future-readiness.yaml +91 -0
- package/rules/core/release.yaml +131 -0
- package/rules/core/repo.yaml +303 -0
- package/rules/core/security.yaml +494 -0
- package/rules/core/supply-chain.yaml +357 -0
- package/rules/core/testing.yaml +260 -0
- package/rules/detectors.yaml +2255 -0
- package/rules/index.yaml +41 -0
- package/rules/profiles/maturity.yaml +135 -0
- package/rules/stacks/ai-era.yaml +193 -0
- package/rules/stacks/api-backend.yaml +121 -0
- package/rules/stacks/cli.yaml +105 -0
- package/rules/stacks/compliance.yaml +157 -0
- package/rules/stacks/containers.yaml +124 -0
- package/rules/stacks/data.yaml +165 -0
- package/rules/stacks/go.yaml +134 -0
- package/rules/stacks/iac.yaml +128 -0
- package/rules/stacks/jvm.yaml +150 -0
- package/rules/stacks/ml-ai.yaml +140 -0
- package/rules/stacks/mobile.yaml +121 -0
- package/rules/stacks/node-typescript.yaml +166 -0
- package/rules/stacks/python.yaml +175 -0
- package/rules/stacks/rust.yaml +129 -0
- package/rules/stacks/solidity.yaml +139 -0
- package/rules/stacks/web-frontend.yaml +159 -0
- package/templates/AGENTS.audit.md +135 -0
- package/templates/AUDIT_REPORT.md +155 -0
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { matchesAny, matchesGlob, isLiteralPath } from './glob.js';
|
|
5
|
+
/**
|
|
6
|
+
* Files that ARE part of the project index but should never be grepped or read:
|
|
7
|
+
* lockfiles, minified bundles, source maps. They must stay in the index (a rule
|
|
8
|
+
* asking "is a lockfile committed?" has to see them) but scanning them produces
|
|
9
|
+
* noise, false positives, and a lot of wasted I/O.
|
|
10
|
+
*/
|
|
11
|
+
export const GREP_SKIP = [
|
|
12
|
+
'package-lock.json',
|
|
13
|
+
'yarn.lock',
|
|
14
|
+
'pnpm-lock.yaml',
|
|
15
|
+
'bun.lockb',
|
|
16
|
+
'bun.lock',
|
|
17
|
+
'poetry.lock',
|
|
18
|
+
'uv.lock',
|
|
19
|
+
'pdm.lock',
|
|
20
|
+
'Pipfile.lock',
|
|
21
|
+
'Cargo.lock',
|
|
22
|
+
'go.sum',
|
|
23
|
+
'composer.lock',
|
|
24
|
+
'Gemfile.lock',
|
|
25
|
+
'flake.lock',
|
|
26
|
+
'**/*.lock',
|
|
27
|
+
'**/*.min.js',
|
|
28
|
+
'**/*.min.css',
|
|
29
|
+
'**/*.map',
|
|
30
|
+
'**/*.bundle.js',
|
|
31
|
+
'**/*.generated.*',
|
|
32
|
+
];
|
|
33
|
+
/** Directories and files never worth auditing. */
|
|
34
|
+
export const DEFAULT_IGNORES = [
|
|
35
|
+
'.git/**',
|
|
36
|
+
'node_modules/**',
|
|
37
|
+
'**/node_modules/**',
|
|
38
|
+
'dist/**',
|
|
39
|
+
'**/dist/**',
|
|
40
|
+
'build/**',
|
|
41
|
+
'**/build/**',
|
|
42
|
+
'out/**',
|
|
43
|
+
'coverage/**',
|
|
44
|
+
'.next/**',
|
|
45
|
+
'.nuxt/**',
|
|
46
|
+
'.svelte-kit/**',
|
|
47
|
+
'.turbo/**',
|
|
48
|
+
'.venv/**',
|
|
49
|
+
'venv/**',
|
|
50
|
+
'__pycache__/**',
|
|
51
|
+
'**/__pycache__/**',
|
|
52
|
+
'.mypy_cache/**',
|
|
53
|
+
'.pytest_cache/**',
|
|
54
|
+
'.ruff_cache/**',
|
|
55
|
+
'target/**',
|
|
56
|
+
'vendor/**',
|
|
57
|
+
'**/*.png',
|
|
58
|
+
'**/*.jpg',
|
|
59
|
+
'**/*.jpeg',
|
|
60
|
+
'**/*.gif',
|
|
61
|
+
'**/*.ico',
|
|
62
|
+
'**/*.webp',
|
|
63
|
+
'**/*.woff',
|
|
64
|
+
'**/*.woff2',
|
|
65
|
+
'**/*.ttf',
|
|
66
|
+
'**/*.pdf',
|
|
67
|
+
'**/*.zip',
|
|
68
|
+
'**/*.gz',
|
|
69
|
+
'**/*.wasm',
|
|
70
|
+
'**/*.pyc',
|
|
71
|
+
'**/*.class',
|
|
72
|
+
'**/*.jar',
|
|
73
|
+
];
|
|
74
|
+
/** Files whose contents we are willing to read as text. */
|
|
75
|
+
const TEXT_EXT = new Set([
|
|
76
|
+
'.ts',
|
|
77
|
+
'.tsx',
|
|
78
|
+
'.js',
|
|
79
|
+
'.jsx',
|
|
80
|
+
'.mjs',
|
|
81
|
+
'.cjs',
|
|
82
|
+
'.mts',
|
|
83
|
+
'.cts',
|
|
84
|
+
'.py',
|
|
85
|
+
'.go',
|
|
86
|
+
'.rs',
|
|
87
|
+
'.java',
|
|
88
|
+
'.kt',
|
|
89
|
+
'.kts',
|
|
90
|
+
'.swift',
|
|
91
|
+
'.rb',
|
|
92
|
+
'.php',
|
|
93
|
+
'.c',
|
|
94
|
+
'.h',
|
|
95
|
+
'.cc',
|
|
96
|
+
'.cpp',
|
|
97
|
+
'.hpp',
|
|
98
|
+
'.cs',
|
|
99
|
+
'.scala',
|
|
100
|
+
'.clj',
|
|
101
|
+
'.ex',
|
|
102
|
+
'.exs',
|
|
103
|
+
'.sh',
|
|
104
|
+
'.bash',
|
|
105
|
+
'.zsh',
|
|
106
|
+
'.ps1',
|
|
107
|
+
'.fish',
|
|
108
|
+
'.json',
|
|
109
|
+
'.jsonc',
|
|
110
|
+
'.json5',
|
|
111
|
+
'.yaml',
|
|
112
|
+
'.yml',
|
|
113
|
+
'.toml',
|
|
114
|
+
'.ini',
|
|
115
|
+
'.cfg',
|
|
116
|
+
'.conf',
|
|
117
|
+
'.env',
|
|
118
|
+
'.properties',
|
|
119
|
+
'.gradle',
|
|
120
|
+
'.mk',
|
|
121
|
+
'.make',
|
|
122
|
+
'.md',
|
|
123
|
+
'.mdx',
|
|
124
|
+
'.txt',
|
|
125
|
+
'.rst',
|
|
126
|
+
'.adoc',
|
|
127
|
+
'.html',
|
|
128
|
+
'.htm',
|
|
129
|
+
'.css',
|
|
130
|
+
'.scss',
|
|
131
|
+
'.sass',
|
|
132
|
+
'.less',
|
|
133
|
+
'.vue',
|
|
134
|
+
'.svelte',
|
|
135
|
+
'.astro',
|
|
136
|
+
'.sql',
|
|
137
|
+
'.graphql',
|
|
138
|
+
'.gql',
|
|
139
|
+
'.proto',
|
|
140
|
+
'.tf',
|
|
141
|
+
'.hcl',
|
|
142
|
+
'.sol',
|
|
143
|
+
'.zig',
|
|
144
|
+
'.lua',
|
|
145
|
+
'.r',
|
|
146
|
+
'.dockerfile',
|
|
147
|
+
'.editorconfig',
|
|
148
|
+
'.gitignore',
|
|
149
|
+
'.gitattributes',
|
|
150
|
+
// Manifests and templates that carry no language-extension hint.
|
|
151
|
+
'.mod',
|
|
152
|
+
'.sum',
|
|
153
|
+
'.gemspec',
|
|
154
|
+
'.podspec',
|
|
155
|
+
'.sbt',
|
|
156
|
+
'.groovy',
|
|
157
|
+
'.gradle',
|
|
158
|
+
'.cmake',
|
|
159
|
+
'.erb',
|
|
160
|
+
'.haml',
|
|
161
|
+
'.twig',
|
|
162
|
+
'.mustache',
|
|
163
|
+
'.handlebars',
|
|
164
|
+
'.hbs',
|
|
165
|
+
'.pug',
|
|
166
|
+
'.tfvars',
|
|
167
|
+
'.nix',
|
|
168
|
+
'.bazel',
|
|
169
|
+
'.bzl',
|
|
170
|
+
'.ninja',
|
|
171
|
+
'.pl',
|
|
172
|
+
'.pm',
|
|
173
|
+
'.tcl',
|
|
174
|
+
'.awk',
|
|
175
|
+
'.vim',
|
|
176
|
+
'.el',
|
|
177
|
+
'.ml',
|
|
178
|
+
'.fs',
|
|
179
|
+
'.fsx',
|
|
180
|
+
'.v',
|
|
181
|
+
'.sv',
|
|
182
|
+
'.vhd',
|
|
183
|
+
'.asm',
|
|
184
|
+
'.s',
|
|
185
|
+
'.nim',
|
|
186
|
+
'.cr',
|
|
187
|
+
'.jl',
|
|
188
|
+
'.ipynb',
|
|
189
|
+
'.gemfile',
|
|
190
|
+
]);
|
|
191
|
+
const MAX_FILE_BYTES = 2 * 1024 * 1024; // 2 MB — skip anything bigger
|
|
192
|
+
const MAX_FILES = 60_000; // hard safety valve for pathological trees
|
|
193
|
+
/**
|
|
194
|
+
* A snapshot of the audited tree. Built once, reused by every rule evaluation —
|
|
195
|
+
* the whole audit is O(files) on disk and O(patterns × files) in memory.
|
|
196
|
+
*/
|
|
197
|
+
export class Project {
|
|
198
|
+
root;
|
|
199
|
+
files = [];
|
|
200
|
+
ignores;
|
|
201
|
+
contentCache = new Map();
|
|
202
|
+
dirCache = new Set();
|
|
203
|
+
tracked = null;
|
|
204
|
+
constructor(root, extraIgnores = []) {
|
|
205
|
+
this.root = path.resolve(root);
|
|
206
|
+
this.ignores = [...DEFAULT_IGNORES, ...extraIgnores.map(normalizeIgnore)];
|
|
207
|
+
this.walk();
|
|
208
|
+
}
|
|
209
|
+
/* ------------------------------------------------------------- indexing -- */
|
|
210
|
+
walk() {
|
|
211
|
+
const root = this.root;
|
|
212
|
+
if (!isDir(root))
|
|
213
|
+
return;
|
|
214
|
+
const gitignore = readGitignore(path.join(root, '.gitignore'));
|
|
215
|
+
const stack = [''];
|
|
216
|
+
while (stack.length > 0) {
|
|
217
|
+
const relDir = stack.pop();
|
|
218
|
+
if (this.files.length >= MAX_FILES)
|
|
219
|
+
return;
|
|
220
|
+
const absDir = path.join(root, relDir);
|
|
221
|
+
let entries;
|
|
222
|
+
try {
|
|
223
|
+
entries = fs.readdirSync(absDir, { withFileTypes: true });
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
continue;
|
|
227
|
+
}
|
|
228
|
+
for (const entry of entries) {
|
|
229
|
+
this.visitEntry(entry, relDir, gitignore, stack);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
this.files.sort();
|
|
233
|
+
}
|
|
234
|
+
visitEntry(entry, relDir, gitignore, stack) {
|
|
235
|
+
const rel = relDir ? `${relDir}/${entry.name}` : entry.name;
|
|
236
|
+
const isDirectory = entry.isDirectory();
|
|
237
|
+
const relWithSlash = isDirectory ? `${rel}/` : rel;
|
|
238
|
+
if (rel === '.git')
|
|
239
|
+
return;
|
|
240
|
+
if (matchesAny(relWithSlash, this.ignores) || matchesAny(rel, this.ignores))
|
|
241
|
+
return;
|
|
242
|
+
if (gitignore.some((g) => matchGitignore(g, rel, isDirectory)))
|
|
243
|
+
return;
|
|
244
|
+
if (isDirectory) {
|
|
245
|
+
this.dirCache.add(rel);
|
|
246
|
+
stack.push(rel);
|
|
247
|
+
}
|
|
248
|
+
else if (entry.isFile()) {
|
|
249
|
+
this.dirCache.add(relDir);
|
|
250
|
+
this.files.push(rel);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
/* -------------------------------------------------------------- queries -- */
|
|
254
|
+
/** All files matching at least one of `globs`. */
|
|
255
|
+
glob(globs) {
|
|
256
|
+
const literal = globs.filter(isLiteralPath);
|
|
257
|
+
const patterns = globs.filter((g) => !isLiteralPath(g));
|
|
258
|
+
return this.files.filter((f) => {
|
|
259
|
+
if (literal.includes(f))
|
|
260
|
+
return true;
|
|
261
|
+
return patterns.some((p) => matchesGlob(f, p));
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
has(glob) {
|
|
265
|
+
return this.glob([glob]).length > 0;
|
|
266
|
+
}
|
|
267
|
+
dirExists(dir) {
|
|
268
|
+
// Trailing slashes are trimmed by index rather than /\/+$/: a run of
|
|
269
|
+
// slashes makes that pattern backtrack quadratically.
|
|
270
|
+
let end = dir.length;
|
|
271
|
+
while (end > 0 && dir[end - 1] === '/')
|
|
272
|
+
end--;
|
|
273
|
+
const d = dir.slice(0, end);
|
|
274
|
+
return d === '' || this.dirCache.has(d) || isDir(path.join(this.root, d));
|
|
275
|
+
}
|
|
276
|
+
/** Directories present directly under root, one level deep. */
|
|
277
|
+
topLevelDirs() {
|
|
278
|
+
return [...this.dirCache].filter((d) => d && !d.includes('/')).sort();
|
|
279
|
+
}
|
|
280
|
+
/** True when at least one file matches `patterns`. */
|
|
281
|
+
anyFile(patterns) {
|
|
282
|
+
return this.glob(patterns).length > 0;
|
|
283
|
+
}
|
|
284
|
+
/** Number of distinct files matching `patterns`. */
|
|
285
|
+
count(patterns) {
|
|
286
|
+
return this.glob(patterns).length;
|
|
287
|
+
}
|
|
288
|
+
/** File contents, or null when unreadable / binary / too large. */
|
|
289
|
+
read(rel) {
|
|
290
|
+
if (this.contentCache.has(rel))
|
|
291
|
+
return this.contentCache.get(rel) ?? null;
|
|
292
|
+
let text = null;
|
|
293
|
+
try {
|
|
294
|
+
const abs = path.join(this.root, rel);
|
|
295
|
+
const st = fs.statSync(abs);
|
|
296
|
+
if (st.isFile() && st.size <= MAX_FILE_BYTES && looksLikeText(rel)) {
|
|
297
|
+
const buf = fs.readFileSync(abs);
|
|
298
|
+
// Cheap binary sniff: NUL byte in the first 8 KB.
|
|
299
|
+
const head = buf.subarray(0, Math.min(buf.length, 8192));
|
|
300
|
+
if (!head.includes(0))
|
|
301
|
+
text = buf.toString('utf8');
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
catch {
|
|
305
|
+
text = null;
|
|
306
|
+
}
|
|
307
|
+
this.contentCache.set(rel, text);
|
|
308
|
+
return text;
|
|
309
|
+
}
|
|
310
|
+
readJson(rel) {
|
|
311
|
+
const raw = this.read(rel);
|
|
312
|
+
if (raw === null)
|
|
313
|
+
return null;
|
|
314
|
+
try {
|
|
315
|
+
return JSON.parse(stripJsonComments(raw));
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Grep across the project. `include`/`exclude` are globs; when `include` is
|
|
323
|
+
* empty every indexed file is scanned.
|
|
324
|
+
*/
|
|
325
|
+
grep(pattern, include, exclude = [], flags = '') {
|
|
326
|
+
const re = compileGrepPattern(pattern, flags);
|
|
327
|
+
if (!re)
|
|
328
|
+
return [];
|
|
329
|
+
const targets = include.length > 0 ? this.glob(include) : this.files;
|
|
330
|
+
const hits = [];
|
|
331
|
+
for (const file of targets) {
|
|
332
|
+
this.grepFile(re, file, exclude, flags, hits);
|
|
333
|
+
if (hits.length >= 500)
|
|
334
|
+
return hits; // bounded output
|
|
335
|
+
}
|
|
336
|
+
return hits;
|
|
337
|
+
}
|
|
338
|
+
grepFile(re, file, exclude, flags, hits) {
|
|
339
|
+
if (exclude.length > 0 && matchesAny(file, exclude))
|
|
340
|
+
return;
|
|
341
|
+
if (matchesAny(file, GREP_SKIP))
|
|
342
|
+
return;
|
|
343
|
+
const text = this.read(file);
|
|
344
|
+
if (text === null)
|
|
345
|
+
return;
|
|
346
|
+
const lines = text.split(/\r?\n/);
|
|
347
|
+
for (let i = 0; i < lines.length; i++) {
|
|
348
|
+
const line = lines[i];
|
|
349
|
+
if (re.test(line)) {
|
|
350
|
+
hits.push({ file, line: i + 1, excerpt: truncate(line.trim(), 220) });
|
|
351
|
+
if (hits.length >= 500)
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
if (!flags.includes('m'))
|
|
355
|
+
re.lastIndex = 0;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/* ------------------------------------------------------------------ git -- */
|
|
359
|
+
/**
|
|
360
|
+
* Files tracked by git. The tree index skips build output and vendored code
|
|
361
|
+
* for speed and signal quality, but some checks ("is `.env` committed?",
|
|
362
|
+
* "are build artifacts in the repo?") can only be answered from git.
|
|
363
|
+
*/
|
|
364
|
+
trackedFiles() {
|
|
365
|
+
if (this.tracked !== null)
|
|
366
|
+
return this.tracked;
|
|
367
|
+
const out = [];
|
|
368
|
+
try {
|
|
369
|
+
const raw = execFileSync('git', ['ls-files', '-z'], {
|
|
370
|
+
cwd: this.root,
|
|
371
|
+
encoding: 'utf8',
|
|
372
|
+
timeout: 20_000,
|
|
373
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
374
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
375
|
+
});
|
|
376
|
+
for (const entry of raw.split('\0')) {
|
|
377
|
+
if (entry)
|
|
378
|
+
out.push(entry);
|
|
379
|
+
if (out.length >= 200_000)
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
catch {
|
|
384
|
+
out.length = 0;
|
|
385
|
+
}
|
|
386
|
+
this.tracked = out;
|
|
387
|
+
return out;
|
|
388
|
+
}
|
|
389
|
+
trackedGlob(globs) {
|
|
390
|
+
return this.trackedFiles().filter((f) => matchesAny(f, globs));
|
|
391
|
+
}
|
|
392
|
+
gitInfo() {
|
|
393
|
+
const isRepo = isDir(path.join(this.root, '.git'));
|
|
394
|
+
if (!isRepo) {
|
|
395
|
+
return { commits: 0, contributors: 0, tags: 0, branches: 0, isRepo: false };
|
|
396
|
+
}
|
|
397
|
+
return { ...this.gitIdentity(), ...this.gitStats(), isRepo: true };
|
|
398
|
+
}
|
|
399
|
+
gitRun(args) {
|
|
400
|
+
try {
|
|
401
|
+
return execFileSync('git', args, {
|
|
402
|
+
cwd: this.root,
|
|
403
|
+
encoding: 'utf8',
|
|
404
|
+
timeout: 10_000,
|
|
405
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
406
|
+
}).trim();
|
|
407
|
+
}
|
|
408
|
+
catch {
|
|
409
|
+
return null;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
gitIdentity() {
|
|
413
|
+
const commit = this.gitRun(['rev-parse', 'HEAD'])?.slice(0, 40) || undefined;
|
|
414
|
+
const ref = this.gitRun(['rev-parse', '--abbrev-ref', 'HEAD']) || undefined;
|
|
415
|
+
const repoUrl = this.gitRun(['remote', 'get-url', 'origin']) || undefined;
|
|
416
|
+
return { commit, ref, repoUrl };
|
|
417
|
+
}
|
|
418
|
+
gitStats() {
|
|
419
|
+
const contributors = this.gitRun(['shortlog', '-sn', '--all', 'HEAD'])
|
|
420
|
+
?.split('\n')
|
|
421
|
+
.filter(Boolean).length;
|
|
422
|
+
const tags = this.gitRun(['tag', '--list'])?.split('\n').filter(Boolean).length ?? 0;
|
|
423
|
+
const branches = this.gitRun(['branch', '--list'])?.split('\n').filter(Boolean).length ?? 0;
|
|
424
|
+
const lastTs = this.gitRun(['log', '-1', '--format=%ct']);
|
|
425
|
+
const daysSinceLastCommit = lastTs && /^\d+$/.test(lastTs)
|
|
426
|
+
? Math.floor((Date.now() / 1000 - Number(lastTs)) / 86400)
|
|
427
|
+
: undefined;
|
|
428
|
+
return {
|
|
429
|
+
commits: toInt(this.gitRun(['rev-list', '--count', 'HEAD'])),
|
|
430
|
+
contributors: contributors ?? 0,
|
|
431
|
+
tags,
|
|
432
|
+
branches,
|
|
433
|
+
daysSinceLastCommit,
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
function compileGrepPattern(pattern, flags) {
|
|
438
|
+
try {
|
|
439
|
+
return new RegExp(pattern, flags.includes('i') ? 'i' : '');
|
|
440
|
+
}
|
|
441
|
+
catch {
|
|
442
|
+
return null; // invalid pattern in a rule pack — degrade, never crash
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
/* ---------------------------------------------------------------- helpers -- */
|
|
446
|
+
function isDir(p) {
|
|
447
|
+
try {
|
|
448
|
+
return fs.statSync(p).isDirectory();
|
|
449
|
+
}
|
|
450
|
+
catch {
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
function normalizeIgnore(g) {
|
|
455
|
+
return g.endsWith('/') ? `${g}**` : g;
|
|
456
|
+
}
|
|
457
|
+
function truncate(s, n) {
|
|
458
|
+
return s.length <= n ? s : `${s.slice(0, n - 1)}…`;
|
|
459
|
+
}
|
|
460
|
+
function toInt(s) {
|
|
461
|
+
if (!s)
|
|
462
|
+
return 0;
|
|
463
|
+
const n = Number.parseInt(s.trim(), 10);
|
|
464
|
+
return Number.isFinite(n) ? n : 0;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Translates a single .gitignore line into our matcher. Handles the common
|
|
468
|
+
* cases (negation, directory-only, anchored, wildcard); exotic gitignore
|
|
469
|
+
* semantics are intentionally out of scope for an audit index.
|
|
470
|
+
*/
|
|
471
|
+
function matchGitignore(pattern, rel, isDirectory) {
|
|
472
|
+
const n = normalizeGitignorePattern(pattern);
|
|
473
|
+
if (!n)
|
|
474
|
+
return false;
|
|
475
|
+
if (n.dirOnly && !isDirectory)
|
|
476
|
+
return false;
|
|
477
|
+
const hit = matchesGlob(rel, n.glob) ||
|
|
478
|
+
matchesGlob(`${rel}/**`, n.glob) ||
|
|
479
|
+
matchesGlob(rel, `${n.glob}/**`);
|
|
480
|
+
return n.negated ? false : hit;
|
|
481
|
+
}
|
|
482
|
+
function normalizeGitignorePattern(pattern) {
|
|
483
|
+
let p = pattern.trim();
|
|
484
|
+
if (!p || p.startsWith('#'))
|
|
485
|
+
return null;
|
|
486
|
+
let negated = false;
|
|
487
|
+
if (p.startsWith('!')) {
|
|
488
|
+
negated = true;
|
|
489
|
+
p = p.slice(1);
|
|
490
|
+
}
|
|
491
|
+
const dirOnly = p.endsWith('/');
|
|
492
|
+
if (dirOnly)
|
|
493
|
+
p = p.slice(0, -1);
|
|
494
|
+
const anchored = p.includes('/');
|
|
495
|
+
let glob = p;
|
|
496
|
+
if (glob.startsWith('/'))
|
|
497
|
+
glob = glob.slice(1);
|
|
498
|
+
if (!anchored)
|
|
499
|
+
glob = `**/${glob}`;
|
|
500
|
+
return { glob, negated, dirOnly };
|
|
501
|
+
}
|
|
502
|
+
function readGitignore(file) {
|
|
503
|
+
try {
|
|
504
|
+
return fs
|
|
505
|
+
.readFileSync(file, 'utf8')
|
|
506
|
+
.split(/\r?\n/)
|
|
507
|
+
.filter((l) => l.trim() && !l.trim().startsWith('#'));
|
|
508
|
+
}
|
|
509
|
+
catch {
|
|
510
|
+
return [];
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
/** Extension allow-list for content reads; extensionless files are allowed. */
|
|
514
|
+
function looksLikeText(rel) {
|
|
515
|
+
const base = rel.split('/').pop() ?? rel;
|
|
516
|
+
const dot = base.lastIndexOf('.');
|
|
517
|
+
if (dot <= 0)
|
|
518
|
+
return true; // Dockerfile, LICENSE, Makefile, .gitignore
|
|
519
|
+
return TEXT_EXT.has(base.slice(dot).toLowerCase());
|
|
520
|
+
}
|
|
521
|
+
/** package.json / tsconfig.json style comments + trailing commas. */
|
|
522
|
+
export function stripJsonComments(text) {
|
|
523
|
+
const st = {
|
|
524
|
+
out: '',
|
|
525
|
+
inString: false,
|
|
526
|
+
inLineComment: false,
|
|
527
|
+
inBlockComment: false,
|
|
528
|
+
};
|
|
529
|
+
for (let i = 0; i < text.length; i++) {
|
|
530
|
+
i = stripJsonChar(text, i, st);
|
|
531
|
+
}
|
|
532
|
+
return st.out.replace(/,(\s*[}\]])/g, '$1');
|
|
533
|
+
}
|
|
534
|
+
function stripJsonChar(text, i, st) {
|
|
535
|
+
const c = text[i];
|
|
536
|
+
const n = text[i + 1];
|
|
537
|
+
if (st.inLineComment)
|
|
538
|
+
return endLineComment(c, i, st);
|
|
539
|
+
if (st.inBlockComment)
|
|
540
|
+
return endBlockComment(c, n, i, st);
|
|
541
|
+
if (st.inString)
|
|
542
|
+
return copyStringChar(c, n, i, st);
|
|
543
|
+
return startJsonToken(c, n, i, st);
|
|
544
|
+
}
|
|
545
|
+
function endLineComment(c, i, st) {
|
|
546
|
+
if (c === '\n') {
|
|
547
|
+
st.inLineComment = false;
|
|
548
|
+
st.out += c;
|
|
549
|
+
}
|
|
550
|
+
return i;
|
|
551
|
+
}
|
|
552
|
+
function endBlockComment(c, n, i, st) {
|
|
553
|
+
if (c === '*' && n === '/') {
|
|
554
|
+
st.inBlockComment = false;
|
|
555
|
+
return i + 1;
|
|
556
|
+
}
|
|
557
|
+
return i;
|
|
558
|
+
}
|
|
559
|
+
function copyStringChar(c, n, i, st) {
|
|
560
|
+
st.out += c;
|
|
561
|
+
if (c === '\\') {
|
|
562
|
+
st.out += n ?? '';
|
|
563
|
+
return i + 1;
|
|
564
|
+
}
|
|
565
|
+
if (c === '"')
|
|
566
|
+
st.inString = false;
|
|
567
|
+
return i;
|
|
568
|
+
}
|
|
569
|
+
function startJsonToken(c, n, i, st) {
|
|
570
|
+
if (c === '"') {
|
|
571
|
+
st.inString = true;
|
|
572
|
+
st.out += c;
|
|
573
|
+
return i;
|
|
574
|
+
}
|
|
575
|
+
if (c === '/' && n === '/') {
|
|
576
|
+
st.inLineComment = true;
|
|
577
|
+
return i + 1;
|
|
578
|
+
}
|
|
579
|
+
if (c === '/' && n === '*') {
|
|
580
|
+
st.inBlockComment = true;
|
|
581
|
+
return i + 1;
|
|
582
|
+
}
|
|
583
|
+
st.out += c;
|
|
584
|
+
return i;
|
|
585
|
+
}
|
|
586
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/util/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,mBAAmB;IACnB,WAAW;IACX,gBAAgB;IAChB,WAAW;IACX,UAAU;IACV,aAAa;IACb,SAAS;IACT,UAAU;IACV,cAAc;IACd,YAAY;IACZ,QAAQ;IACR,eAAe;IACf,cAAc;IACd,YAAY;IACZ,WAAW;IACX,aAAa;IACb,cAAc;IACd,UAAU;IACV,gBAAgB;IAChB,kBAAkB;CACnB,CAAC;AAEF,kDAA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ACf,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,cAAc,CAAC,CAAS,EAAE,CAAqB,EAAE,CAAS,EAAE,EAAkB;IACrF,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACZ,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QACf,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IACD,IAAI,CAAC,KAAK,GAAG;QAAE,EAAE,CAAC,QAAQ,GAAG,KAAK,CAAC;IACnC,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,cAAc,CAAC,CAAS,EAAE,CAAqB,EAAE,CAAS,EAAE,EAAkB;IACrF,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QACd,EAAE,CAAC,QAAQ,GAAG,IAAI,CAAC;QACnB,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QACZ,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAC3B,EAAE,CAAC,aAAa,GAAG,IAAI,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAC3B,EAAE,CAAC,cAAc,GAAG,IAAI,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IACD,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACZ,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shape helpers for decoded YAML.
|
|
3
|
+
*
|
|
4
|
+
* `yaml.parse` hands back plain JS objects, which is exactly the *wrong* thing
|
|
5
|
+
* to sprinkle through the engine: every downstream field access would be `any`
|
|
6
|
+
* and a typo in a rule pack would surface as `undefined` three modules later.
|
|
7
|
+
* These helpers force the parse boundary to state up front what shape it
|
|
8
|
+
* expects, and make the "absent" case explicit rather than implicit.
|
|
9
|
+
*/
|
|
10
|
+
/** A decoded YAML mapping. Keys are strings; values are whatever the author wrote. */
|
|
11
|
+
export type YamlMap = Record<string, unknown>;
|
|
12
|
+
export declare function isMap(v: unknown): v is YamlMap;
|
|
13
|
+
export declare function asMap(v: unknown): YamlMap;
|
|
14
|
+
/** Present and a string. */
|
|
15
|
+
export declare function str(v: unknown): string | undefined;
|
|
16
|
+
/** Present and a number. */
|
|
17
|
+
export declare function num(v: unknown): number | undefined;
|
|
18
|
+
/** Present and a boolean. */
|
|
19
|
+
export declare function bool(v: unknown): boolean | undefined;
|
|
20
|
+
/** Present and an array. */
|
|
21
|
+
export declare function list(v: unknown): unknown[] | undefined;
|
|
22
|
+
/** Present and an array — every element stringified. */
|
|
23
|
+
export declare function strList(v: unknown): string[] | undefined;
|
|
24
|
+
/** A scalar suitable for `json_path.equals` comparisons. */
|
|
25
|
+
export declare function scalar(v: unknown): string | number | boolean | null | undefined;
|
|
26
|
+
/** One entry of an array, as a mapping. */
|
|
27
|
+
export declare function maps(v: unknown): YamlMap[];
|
|
28
|
+
//# sourceMappingURL=yaml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../../src/util/yaml.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,sFAAsF;AACtF,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C,wBAAgB,KAAK,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,OAAO,CAE9C;AAED,wBAAgB,KAAK,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAEzC;AAED,4BAA4B;AAC5B,wBAAgB,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAElD;AAED,4BAA4B;AAC5B,wBAAgB,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAElD;AAED,6BAA6B;AAC7B,wBAAgB,IAAI,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAEpD;AAED,4BAA4B;AAC5B,wBAAgB,IAAI,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,GAAG,SAAS,CAEtD;AAED,wDAAwD;AACxD,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAExD;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAI/E;AAED,2CAA2C;AAC3C,wBAAgB,IAAI,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAE1C"}
|