@kernlang/review 3.2.3 → 3.3.5
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/dist/cache.js +140 -3
- package/dist/cache.js.map +1 -1
- package/dist/call-graph.d.ts +4 -1
- package/dist/call-graph.js +290 -25
- package/dist/call-graph.js.map +1 -1
- package/dist/concept-rules/contract-drift.d.ts +21 -0
- package/dist/concept-rules/contract-drift.js +66 -0
- package/dist/concept-rules/contract-drift.js.map +1 -0
- package/dist/concept-rules/cross-stack-utils.d.ts +50 -0
- package/dist/concept-rules/cross-stack-utils.js +98 -0
- package/dist/concept-rules/cross-stack-utils.js.map +1 -0
- package/dist/concept-rules/index.js +12 -1
- package/dist/concept-rules/index.js.map +1 -1
- package/dist/concept-rules/tainted-across-wire.d.ts +33 -0
- package/dist/concept-rules/tainted-across-wire.js +98 -0
- package/dist/concept-rules/tainted-across-wire.js.map +1 -0
- package/dist/concept-rules/untyped-api-response.d.ts +30 -0
- package/dist/concept-rules/untyped-api-response.js +71 -0
- package/dist/concept-rules/untyped-api-response.js.map +1 -0
- package/dist/external-tools.d.ts +36 -4
- package/dist/external-tools.js +79 -12
- package/dist/external-tools.js.map +1 -1
- package/dist/graph.js +149 -39
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +29 -4
- package/dist/index.js +329 -47
- package/dist/index.js.map +1 -1
- package/dist/inferrer.d.ts +5 -0
- package/dist/inferrer.js +1 -1
- package/dist/inferrer.js.map +1 -1
- package/dist/llm-bridge.d.ts +26 -1
- package/dist/llm-bridge.js +42 -6
- package/dist/llm-bridge.js.map +1 -1
- package/dist/llm-review.js +29 -11
- package/dist/llm-review.js.map +1 -1
- package/dist/mappers/ts-concepts.js +278 -7
- package/dist/mappers/ts-concepts.js.map +1 -1
- package/dist/public-api.d.ts +73 -0
- package/dist/public-api.js +351 -0
- package/dist/public-api.js.map +1 -0
- package/dist/reporter.d.ts +5 -0
- package/dist/reporter.js +119 -84
- package/dist/reporter.js.map +1 -1
- package/dist/review-health.d.ts +38 -0
- package/dist/review-health.js +60 -0
- package/dist/review-health.js.map +1 -0
- package/dist/rules/async.js +4 -16
- package/dist/rules/async.js.map +1 -1
- package/dist/rules/base.js +112 -87
- package/dist/rules/base.js.map +1 -1
- package/dist/rules/confidence.d.ts +2 -2
- package/dist/rules/confidence.js +32 -15
- package/dist/rules/confidence.js.map +1 -1
- package/dist/rules/dead-code.d.ts +2 -1
- package/dist/rules/dead-code.js +49 -3
- package/dist/rules/dead-code.js.map +1 -1
- package/dist/rules/index.js +131 -0
- package/dist/rules/index.js.map +1 -1
- package/dist/rules/kern-source-cross-file.d.ts +2 -0
- package/dist/rules/kern-source-cross-file.js +102 -0
- package/dist/rules/kern-source-cross-file.js.map +1 -0
- package/dist/rules/kern-source.js +86 -9
- package/dist/rules/kern-source.js.map +1 -1
- package/dist/rules/nextjs-app-router.js +936 -31
- package/dist/rules/nextjs-app-router.js.map +1 -1
- package/dist/rules/nextjs.js +193 -10
- package/dist/rules/nextjs.js.map +1 -1
- package/dist/rules/react-composition.js +442 -61
- package/dist/rules/react-composition.js.map +1 -1
- package/dist/rules/react-hooks.js +51 -2
- package/dist/rules/react-hooks.js.map +1 -1
- package/dist/rules/react.js +265 -49
- package/dist/rules/react.js.map +1 -1
- package/dist/rules/utils.d.ts +37 -2
- package/dist/rules/utils.js +113 -0
- package/dist/rules/utils.js.map +1 -1
- package/dist/semantic-diff.js +1 -1
- package/dist/semantic-diff.js.map +1 -1
- package/dist/taint-ast.js +228 -4
- package/dist/taint-ast.js.map +1 -1
- package/dist/taint-crossfile.d.ts +30 -2
- package/dist/taint-crossfile.js +280 -59
- package/dist/taint-crossfile.js.map +1 -1
- package/dist/taint-types.d.ts +2 -1
- package/dist/taint-types.js +32 -2
- package/dist/taint-types.js.map +1 -1
- package/dist/taint.d.ts +1 -1
- package/dist/taint.js +1 -1
- package/dist/taint.js.map +1 -1
- package/dist/types.d.ts +80 -0
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
package/dist/external-tools.d.ts
CHANGED
|
@@ -7,24 +7,56 @@
|
|
|
7
7
|
* Phase 3 of the review pipeline.
|
|
8
8
|
*/
|
|
9
9
|
import type { Project } from 'ts-morph';
|
|
10
|
+
import { type ReviewHealthBuilder } from './review-health.js';
|
|
10
11
|
import type { InferResult, ReviewFinding } from './types.js';
|
|
11
12
|
/**
|
|
12
13
|
* Run ESLint on given file paths using the Node API.
|
|
13
14
|
* Returns normalized ReviewFinding[] with source='eslint'.
|
|
14
|
-
*
|
|
15
|
+
*
|
|
16
|
+
* ESLint is an optional peer dep. If it's not installed, we record a `skipped` health
|
|
17
|
+
* note (no findings). If it IS installed but fails at load or lint time — that's a real
|
|
18
|
+
* infrastructure problem: we record an `error` health note so the caller can surface
|
|
19
|
+
* "ran in degraded mode" rather than silently returning an empty findings array that
|
|
20
|
+
* looks identical to a clean run.
|
|
15
21
|
*/
|
|
16
|
-
export declare function runESLint(filePaths: string[], cwd: string): Promise<ReviewFinding[]>;
|
|
22
|
+
export declare function runESLint(filePaths: string[], cwd: string, health?: ReviewHealthBuilder): Promise<ReviewFinding[]>;
|
|
23
|
+
export interface RunTSCDiagnosticsOptions {
|
|
24
|
+
/**
|
|
25
|
+
* When true, suppress TS diagnostics that fire as kern-review infrastructure noise when we inject
|
|
26
|
+
* ad-hoc files into a Project that carries a host tsconfig. Suppressed codes fall into two classes:
|
|
27
|
+
*
|
|
28
|
+
* Project membership (in-memory Project vs host rootDir):
|
|
29
|
+
* - TS6059 — "File is not listed within the file list of project"
|
|
30
|
+
* - TS6307 — "File is not under 'rootDir'"
|
|
31
|
+
*
|
|
32
|
+
* Environmental (in-memory Project doesn't mirror host compilerOptions — moduleResolution, jsx, lib):
|
|
33
|
+
* - TS2792 — "Cannot find module X. Did you mean to set 'moduleResolution' to 'nodenext'?"
|
|
34
|
+
* - TS17004 — "Cannot use JSX unless the '--jsx' flag is provided"
|
|
35
|
+
* - TS2580 / TS2591 — "Cannot find name 'process'/'require'/'module'" (@types/node missing)
|
|
36
|
+
*
|
|
37
|
+
* The dev already sees the environmental class in their IDE / local `tsc --noEmit` when real.
|
|
38
|
+
* Set this only for the standard review path. The --lint path must leave it false so real
|
|
39
|
+
* tsconfig misconfigurations still surface as errors.
|
|
40
|
+
*
|
|
41
|
+
* The name is kept for backward compatibility; scope broadened deliberately.
|
|
42
|
+
*/
|
|
43
|
+
downgradeProjectLoadingErrors?: boolean;
|
|
44
|
+
}
|
|
17
45
|
/**
|
|
18
46
|
* Run TypeScript compiler diagnostics using ts-morph's existing Project.
|
|
19
47
|
* Reuses the Project already created by the inferrer — no extra compilation.
|
|
20
48
|
*/
|
|
21
|
-
export declare function runTSCDiagnostics(project: Project): ReviewFinding[];
|
|
49
|
+
export declare function runTSCDiagnostics(project: Project, options?: RunTSCDiagnosticsOptions, health?: ReviewHealthBuilder): ReviewFinding[];
|
|
22
50
|
/**
|
|
23
51
|
* Run TypeScript compiler diagnostics from file paths (no pre-existing Project).
|
|
24
52
|
* Creates a real-filesystem Project, adds files, runs diagnostics.
|
|
25
53
|
* Used by the CLI --lint path where only file paths are available.
|
|
54
|
+
*
|
|
55
|
+
* If the Project fails to construct (missing tsconfig, bad compilerOptions), we record an
|
|
56
|
+
* `error` health note rather than silently returning []. Per-file addSourceFileAtPath
|
|
57
|
+
* failures are normal for unreadable/unparseable files and are intentionally skipped.
|
|
26
58
|
*/
|
|
27
|
-
export declare function runTSCDiagnosticsFromPaths(filePaths: string[]): ReviewFinding[];
|
|
59
|
+
export declare function runTSCDiagnosticsFromPaths(filePaths: string[], health?: ReviewHealthBuilder): ReviewFinding[];
|
|
28
60
|
/**
|
|
29
61
|
* For each external finding, find the inferred node whose sourceSpan contains it.
|
|
30
62
|
* Attaches nodeId to the finding for cross-referencing.
|
package/dist/external-tools.js
CHANGED
|
@@ -7,21 +7,55 @@
|
|
|
7
7
|
* Phase 3 of the review pipeline.
|
|
8
8
|
*/
|
|
9
9
|
import { createProject } from './inferrer.js';
|
|
10
|
+
import { debugDetail } from './review-health.js';
|
|
10
11
|
import { createFingerprint } from './types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Node-style error check — used to distinguish "optional peer dep missing" (quietly skip)
|
|
14
|
+
* from "the peer dep is installed but failed to load" (surface as degraded-mode health note).
|
|
15
|
+
* Matches both the standard MODULE_NOT_FOUND on require() and the ERR_MODULE_NOT_FOUND
|
|
16
|
+
* emitted by native ESM dynamic import.
|
|
17
|
+
*/
|
|
18
|
+
function isModuleNotFound(err) {
|
|
19
|
+
if (!err || typeof err !== 'object')
|
|
20
|
+
return false;
|
|
21
|
+
const code = err.code;
|
|
22
|
+
return code === 'MODULE_NOT_FOUND' || code === 'ERR_MODULE_NOT_FOUND';
|
|
23
|
+
}
|
|
11
24
|
// ── ESLint via Node API ──────────────────────────────────────────────────
|
|
12
25
|
/**
|
|
13
26
|
* Run ESLint on given file paths using the Node API.
|
|
14
27
|
* Returns normalized ReviewFinding[] with source='eslint'.
|
|
15
|
-
*
|
|
28
|
+
*
|
|
29
|
+
* ESLint is an optional peer dep. If it's not installed, we record a `skipped` health
|
|
30
|
+
* note (no findings). If it IS installed but fails at load or lint time — that's a real
|
|
31
|
+
* infrastructure problem: we record an `error` health note so the caller can surface
|
|
32
|
+
* "ran in degraded mode" rather than silently returning an empty findings array that
|
|
33
|
+
* looks identical to a clean run.
|
|
16
34
|
*/
|
|
17
|
-
export async function runESLint(filePaths, cwd) {
|
|
35
|
+
export async function runESLint(filePaths, cwd, health) {
|
|
36
|
+
// Dynamic import — ESLint is an optional peer dep. MODULE_NOT_FOUND at this step means
|
|
37
|
+
// "not installed" (quiet skip); anything else is a real load failure worth surfacing.
|
|
38
|
+
const eslintModuleName = 'eslint';
|
|
39
|
+
let ESLint;
|
|
18
40
|
try {
|
|
19
|
-
// Dynamic import — ESLint is an optional peer dep
|
|
20
|
-
const eslintModuleName = 'eslint';
|
|
21
41
|
const eslintModule = (await import(eslintModuleName));
|
|
22
|
-
|
|
23
|
-
|
|
42
|
+
ESLint = eslintModule.ESLint || eslintModule.default?.ESLint;
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
if (isModuleNotFound(err)) {
|
|
46
|
+
health?.noteKind('eslint', 'skipped', 'ESLint not installed — skipped');
|
|
24
47
|
return [];
|
|
48
|
+
}
|
|
49
|
+
health?.noteKind('eslint', 'error', 'ESLint failed to load', debugDetail(err));
|
|
50
|
+
if (process.env.KERN_DEBUG)
|
|
51
|
+
console.error('ESLint load error:', err.message);
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
if (!ESLint) {
|
|
55
|
+
health?.noteKind('eslint', 'skipped', 'ESLint package present but missing ESLint export — skipped');
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
25
59
|
const eslint = new ESLint({ cwd });
|
|
26
60
|
const results = await eslint.lintFiles(filePaths);
|
|
27
61
|
const findings = [];
|
|
@@ -49,8 +83,13 @@ export async function runESLint(filePaths, cwd) {
|
|
|
49
83
|
}
|
|
50
84
|
return findings;
|
|
51
85
|
}
|
|
52
|
-
catch {
|
|
53
|
-
// ESLint
|
|
86
|
+
catch (err) {
|
|
87
|
+
// ESLint loaded but lintFiles threw — typically a malformed eslint.config or unreadable
|
|
88
|
+
// files. This is a real failure: surface it on health rather than letting a silent []
|
|
89
|
+
// look like "ESLint ran and found nothing."
|
|
90
|
+
health?.noteKind('eslint', 'error', 'ESLint failed during lint run', debugDetail(err));
|
|
91
|
+
if (process.env.KERN_DEBUG)
|
|
92
|
+
console.error('ESLint lint error:', err.message);
|
|
54
93
|
return [];
|
|
55
94
|
}
|
|
56
95
|
}
|
|
@@ -68,12 +107,11 @@ function categorizeESLintRule(ruleId) {
|
|
|
68
107
|
return 'structure';
|
|
69
108
|
return 'pattern';
|
|
70
109
|
}
|
|
71
|
-
// ── tsc Diagnostics via ts-morph ─────────────────────────────────────────
|
|
72
110
|
/**
|
|
73
111
|
* Run TypeScript compiler diagnostics using ts-morph's existing Project.
|
|
74
112
|
* Reuses the Project already created by the inferrer — no extra compilation.
|
|
75
113
|
*/
|
|
76
|
-
export function runTSCDiagnostics(project) {
|
|
114
|
+
export function runTSCDiagnostics(project, options = {}, health) {
|
|
77
115
|
const findings = [];
|
|
78
116
|
try {
|
|
79
117
|
const diagnostics = project.getPreEmitDiagnostics();
|
|
@@ -107,6 +145,27 @@ export function runTSCDiagnostics(project) {
|
|
|
107
145
|
const code = diag.getCode();
|
|
108
146
|
const message = diag.getMessageText();
|
|
109
147
|
const messageStr = typeof message === 'string' ? message : message.getMessageText();
|
|
148
|
+
// ts6059 / ts6307 fire both for real tsconfig misconfigurations and for kern-review's
|
|
149
|
+
// ad-hoc file injection into a host tsconfig (noise). The caller decides which mode we're in
|
|
150
|
+
// via options.downgradeProjectLoadingErrors. In review mode we drop them entirely; surfacing
|
|
151
|
+
// them as info still pollutes every barrel/re-export report in composite monorepos.
|
|
152
|
+
// ts6059 — "File is not listed within the file list of project"
|
|
153
|
+
// ts6307 — "File is not under 'rootDir'"
|
|
154
|
+
// The following codes are environmental: they reflect ts-morph's in-memory Project not
|
|
155
|
+
// perfectly mirroring the host's compilerOptions (moduleResolution, jsx, lib). The dev
|
|
156
|
+
// already sees them in their IDE / local `tsc --noEmit` if real; the review's value-add
|
|
157
|
+
// is KERN-relevant findings, not duplicating compiler output. A sweep of the agon repo
|
|
158
|
+
// (451 files) emitted 1869 of these as errors — pure noise drowning real findings.
|
|
159
|
+
// ts2792 — "Cannot find module X. Did you mean to set 'moduleResolution' to 'nodenext'?"
|
|
160
|
+
// ts17004 — "Cannot use JSX unless the '--jsx' flag is provided"
|
|
161
|
+
// ts2580 / ts2591 — "Cannot find name 'process'/'require'/'module'. Install @types/node?"
|
|
162
|
+
// (TS emits 2580 when the name resolves via global lib shims, 2591 when it doesn't —
|
|
163
|
+
// both point at the same user-side remedy, both are environmental from review's POV.)
|
|
164
|
+
const isLoadingNoise = code === 6059 || code === 6307;
|
|
165
|
+
const isEnvironmentalNoise = code === 2792 || code === 17004 || code === 2580 || code === 2591;
|
|
166
|
+
if ((isLoadingNoise || isEnvironmentalNoise) && options.downgradeProjectLoadingErrors) {
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
110
169
|
findings.push({
|
|
111
170
|
source: 'tsc',
|
|
112
171
|
ruleId: `ts${code}`,
|
|
@@ -126,6 +185,7 @@ export function runTSCDiagnostics(project) {
|
|
|
126
185
|
}
|
|
127
186
|
catch (err) {
|
|
128
187
|
// ts-morph diagnostics can fail on malformed source — return what we have
|
|
188
|
+
health?.noteKind('tsc', 'error', 'tsc diagnostics failed mid-run', debugDetail(err));
|
|
129
189
|
if (process.env.KERN_DEBUG)
|
|
130
190
|
console.error('tsc diagnostics error:', err.message);
|
|
131
191
|
}
|
|
@@ -136,8 +196,12 @@ export function runTSCDiagnostics(project) {
|
|
|
136
196
|
* Run TypeScript compiler diagnostics from file paths (no pre-existing Project).
|
|
137
197
|
* Creates a real-filesystem Project, adds files, runs diagnostics.
|
|
138
198
|
* Used by the CLI --lint path where only file paths are available.
|
|
199
|
+
*
|
|
200
|
+
* If the Project fails to construct (missing tsconfig, bad compilerOptions), we record an
|
|
201
|
+
* `error` health note rather than silently returning []. Per-file addSourceFileAtPath
|
|
202
|
+
* failures are normal for unreadable/unparseable files and are intentionally skipped.
|
|
139
203
|
*/
|
|
140
|
-
export function runTSCDiagnosticsFromPaths(filePaths) {
|
|
204
|
+
export function runTSCDiagnosticsFromPaths(filePaths, health) {
|
|
141
205
|
if (filePaths.length === 0)
|
|
142
206
|
return [];
|
|
143
207
|
try {
|
|
@@ -152,7 +216,10 @@ export function runTSCDiagnosticsFromPaths(filePaths) {
|
|
|
152
216
|
}
|
|
153
217
|
return runTSCDiagnostics(project);
|
|
154
218
|
}
|
|
155
|
-
catch {
|
|
219
|
+
catch (err) {
|
|
220
|
+
health?.noteKind('tsc', 'error', 'tsc diagnostics could not build a ts-morph Project', debugDetail(err));
|
|
221
|
+
if (process.env.KERN_DEBUG)
|
|
222
|
+
console.error('tsc project build error:', err.message);
|
|
156
223
|
return [];
|
|
157
224
|
}
|
|
158
225
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-tools.js","sourceRoot":"","sources":["../src/external-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"external-tools.js","sourceRoot":"","sources":["../src/external-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,WAAW,EAA4B,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,GAAY;IACpC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAClD,MAAM,IAAI,GAAI,GAA0B,CAAC,IAAI,CAAC;IAC9C,OAAO,IAAI,KAAK,kBAAkB,IAAI,IAAI,KAAK,sBAAsB,CAAC;AACxE,CAAC;AAED,4EAA4E;AAE5E;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,SAAmB,EACnB,GAAW,EACX,MAA4B;IAE5B,uFAAuF;IACvF,sFAAsF;IACtF,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IAClC,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAQ,CAAC;QAC7D,MAAM,GAAG,YAAY,CAAC,MAAM,IAAI,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC;IAC/D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,EAAE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AAM,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,oDAAoD,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACzG,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU;YAAE,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAG,GAAa,CAAC,OAAO,CAAC,CAAC;QAC9F,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,4EAA4E;AAE5E;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,QAAyB,EAAE,QAAuB;IAC5E,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;YAAE,SAAS,CAAC,iBAAiB;QAElE,MAAM,IAAI,GAAG,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC;QACrC,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,IAAI,IAAI,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;QAEpF,IAAI,YAAY,EAAE,CAAC;YACjB,CAAC,CAAC,OAAO,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/graph.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Codex contributions: extension fallback, shortest-distance tracking, skip counters.
|
|
9
9
|
*/
|
|
10
|
+
import { existsSync } from 'fs';
|
|
11
|
+
import { resolve } from 'path';
|
|
10
12
|
import { Project } from 'ts-morph';
|
|
11
13
|
/** Extension fallback map: .js→.ts, .jsx→.tsx (Codex idea) */
|
|
12
14
|
const EXT_FALLBACK = {
|
|
@@ -42,13 +44,20 @@ export function resolveImportGraph(entryFiles, options = {}) {
|
|
|
42
44
|
sf = project.addSourceFileAtPath(entry);
|
|
43
45
|
}
|
|
44
46
|
catch {
|
|
45
|
-
|
|
47
|
+
const entryPath = resolve(entry);
|
|
48
|
+
if (!existsSync(entryPath)) {
|
|
49
|
+
skipped++;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (!fileMap.has(entryPath)) {
|
|
53
|
+
fileMap.set(entryPath, makeGraphFile(entryPath, 0));
|
|
54
|
+
}
|
|
46
55
|
continue;
|
|
47
56
|
}
|
|
48
57
|
}
|
|
49
58
|
const p = sf.getFilePath();
|
|
50
59
|
if (!fileMap.has(p)) {
|
|
51
|
-
fileMap.set(p,
|
|
60
|
+
fileMap.set(p, makeGraphFile(p, 0));
|
|
52
61
|
queue.push({ path: p, distance: 0 });
|
|
53
62
|
}
|
|
54
63
|
}
|
|
@@ -65,31 +74,9 @@ export function resolveImportGraph(entryFiles, options = {}) {
|
|
|
65
74
|
continue;
|
|
66
75
|
const current = fileMap.get(filePath);
|
|
67
76
|
// Collect module references from imports and re-exports (barrel file support)
|
|
68
|
-
const refs =
|
|
69
|
-
for (const
|
|
70
|
-
|
|
71
|
-
refs.push({
|
|
72
|
-
specifier: decl.getModuleSpecifierValue(),
|
|
73
|
-
resolved: decl.getModuleSpecifierSourceFile(),
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
catch {
|
|
77
|
-
/* skip dynamic imports with non-literal specifiers */
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
for (const decl of sf.getExportDeclarations()) {
|
|
81
|
-
const spec = decl.getModuleSpecifierValue();
|
|
82
|
-
if (spec) {
|
|
83
|
-
refs.push({ specifier: spec, resolved: decl.getModuleSpecifierSourceFile() });
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
for (const { specifier, resolved } of refs) {
|
|
87
|
-
// Try ts-morph resolution first (handles path aliases via tsconfig)
|
|
88
|
-
let resolvedFile = resolved;
|
|
89
|
-
// For relative imports that weren't resolved, try extension fallback
|
|
90
|
-
if (!resolvedFile && (specifier.startsWith('.') || specifier.startsWith('/'))) {
|
|
91
|
-
resolvedFile = tryExtensionFallback(project, sf, specifier);
|
|
92
|
-
}
|
|
77
|
+
const refs = collectModuleEdgeRefs(sf);
|
|
78
|
+
for (const ref of refs) {
|
|
79
|
+
const { sourceFile: resolvedFile, via } = resolveModuleReference(project, sf, ref.specifier, ref.resolved);
|
|
93
80
|
if (!resolvedFile) {
|
|
94
81
|
skipped++;
|
|
95
82
|
continue;
|
|
@@ -104,16 +91,24 @@ export function resolveImportGraph(entryFiles, options = {}) {
|
|
|
104
91
|
skipped++;
|
|
105
92
|
continue;
|
|
106
93
|
}
|
|
94
|
+
const edge = {
|
|
95
|
+
from: filePath,
|
|
96
|
+
to: resolvedPath,
|
|
97
|
+
specifier: ref.specifier,
|
|
98
|
+
kind: ref.kind,
|
|
99
|
+
importedName: ref.importedName,
|
|
100
|
+
localName: ref.localName,
|
|
101
|
+
via,
|
|
102
|
+
};
|
|
103
|
+
pushUniqueEdge(current.importEdges, edge);
|
|
107
104
|
if (!current.imports.includes(resolvedPath)) {
|
|
108
105
|
current.imports.push(resolvedPath);
|
|
109
106
|
}
|
|
110
107
|
if (!fileMap.has(resolvedPath)) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
importedBy: [filePath],
|
|
116
|
-
});
|
|
108
|
+
const nextFile = makeGraphFile(resolvedPath, distance + 1);
|
|
109
|
+
nextFile.importedBy.push(filePath);
|
|
110
|
+
nextFile.incomingEdges.push(edge);
|
|
111
|
+
fileMap.set(resolvedPath, nextFile);
|
|
117
112
|
queue.push({ path: resolvedPath, distance: distance + 1 });
|
|
118
113
|
}
|
|
119
114
|
else {
|
|
@@ -125,6 +120,7 @@ export function resolveImportGraph(entryFiles, options = {}) {
|
|
|
125
120
|
if (!existing.importedBy.includes(filePath)) {
|
|
126
121
|
existing.importedBy.push(filePath);
|
|
127
122
|
}
|
|
123
|
+
pushUniqueEdge(existing.incomingEdges, edge);
|
|
128
124
|
}
|
|
129
125
|
}
|
|
130
126
|
}
|
|
@@ -134,6 +130,7 @@ export function resolveImportGraph(entryFiles, options = {}) {
|
|
|
134
130
|
entryFiles: files.filter((f) => f.distance === 0).map((f) => f.path),
|
|
135
131
|
totalFiles: files.length,
|
|
136
132
|
skipped,
|
|
133
|
+
project,
|
|
137
134
|
};
|
|
138
135
|
}
|
|
139
136
|
/**
|
|
@@ -147,14 +144,127 @@ function tryExtensionFallback(project, fromFile, specifier) {
|
|
|
147
144
|
const base = specifier.slice(0, -jsExt.length);
|
|
148
145
|
for (const tsExt of tsExts) {
|
|
149
146
|
const candidate = base + tsExt;
|
|
150
|
-
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if (
|
|
155
|
-
|
|
147
|
+
const fullPath = resolve(fromFile.getDirectoryPath(), candidate);
|
|
148
|
+
const existing = project.getSourceFile(fullPath);
|
|
149
|
+
if (existing)
|
|
150
|
+
return existing;
|
|
151
|
+
if (!existsSync(fullPath))
|
|
152
|
+
continue;
|
|
153
|
+
try {
|
|
154
|
+
return project.addSourceFileAtPath(fullPath);
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
/* ignore unreadable candidates */
|
|
158
|
+
}
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
return undefined;
|
|
159
162
|
}
|
|
163
|
+
function makeGraphFile(path, distance) {
|
|
164
|
+
return {
|
|
165
|
+
path,
|
|
166
|
+
distance,
|
|
167
|
+
imports: [],
|
|
168
|
+
importedBy: [],
|
|
169
|
+
importEdges: [],
|
|
170
|
+
incomingEdges: [],
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function resolveModuleReference(project, fromFile, specifier, resolved) {
|
|
174
|
+
if (resolved)
|
|
175
|
+
return { sourceFile: resolved, via: 'ts-morph' };
|
|
176
|
+
if (specifier.startsWith('.') || specifier.startsWith('/')) {
|
|
177
|
+
const fallback = tryExtensionFallback(project, fromFile, specifier);
|
|
178
|
+
if (fallback)
|
|
179
|
+
return { sourceFile: fallback, via: 'extension-fallback' };
|
|
180
|
+
}
|
|
181
|
+
return { sourceFile: undefined, via: 'ts-morph' };
|
|
182
|
+
}
|
|
183
|
+
function collectModuleEdgeRefs(sourceFile) {
|
|
184
|
+
const refs = [];
|
|
185
|
+
for (const decl of sourceFile.getImportDeclarations()) {
|
|
186
|
+
try {
|
|
187
|
+
const specifier = decl.getModuleSpecifierValue();
|
|
188
|
+
const resolved = decl.getModuleSpecifierSourceFile();
|
|
189
|
+
let recorded = false;
|
|
190
|
+
const defaultImport = decl.getDefaultImport();
|
|
191
|
+
if (defaultImport) {
|
|
192
|
+
refs.push({
|
|
193
|
+
specifier,
|
|
194
|
+
resolved,
|
|
195
|
+
kind: 'default-import',
|
|
196
|
+
importedName: 'default',
|
|
197
|
+
localName: defaultImport.getText(),
|
|
198
|
+
});
|
|
199
|
+
recorded = true;
|
|
200
|
+
}
|
|
201
|
+
for (const named of decl.getNamedImports()) {
|
|
202
|
+
refs.push({
|
|
203
|
+
specifier,
|
|
204
|
+
resolved,
|
|
205
|
+
kind: 'named-import',
|
|
206
|
+
importedName: named.getName(),
|
|
207
|
+
localName: named.getAliasNode()?.getText() ?? named.getName(),
|
|
208
|
+
});
|
|
209
|
+
recorded = true;
|
|
210
|
+
}
|
|
211
|
+
const namespaceImport = decl.getNamespaceImport();
|
|
212
|
+
if (namespaceImport) {
|
|
213
|
+
refs.push({
|
|
214
|
+
specifier,
|
|
215
|
+
resolved,
|
|
216
|
+
kind: 'namespace-import',
|
|
217
|
+
importedName: '*',
|
|
218
|
+
localName: namespaceImport.getText(),
|
|
219
|
+
});
|
|
220
|
+
recorded = true;
|
|
221
|
+
}
|
|
222
|
+
if (!recorded) {
|
|
223
|
+
refs.push({ specifier, resolved, kind: 'side-effect-import' });
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
/* skip dynamic imports with non-literal specifiers */
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
for (const decl of sourceFile.getExportDeclarations()) {
|
|
231
|
+
let specifier;
|
|
232
|
+
let resolved;
|
|
233
|
+
try {
|
|
234
|
+
specifier = decl.getModuleSpecifierValue();
|
|
235
|
+
if (!specifier)
|
|
236
|
+
continue;
|
|
237
|
+
resolved = decl.getModuleSpecifierSourceFile() ?? undefined;
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
const namedExports = decl.getNamedExports();
|
|
243
|
+
if (namedExports.length === 0) {
|
|
244
|
+
refs.push({ specifier, resolved, kind: 'export-all' });
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
for (const named of namedExports) {
|
|
248
|
+
refs.push({
|
|
249
|
+
specifier,
|
|
250
|
+
resolved,
|
|
251
|
+
kind: 'named-reexport',
|
|
252
|
+
importedName: named.getName(),
|
|
253
|
+
localName: named.getAliasNode()?.getText() ?? named.getName(),
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return refs;
|
|
258
|
+
}
|
|
259
|
+
function pushUniqueEdge(edges, edge) {
|
|
260
|
+
const exists = edges.some((existing) => existing.from === edge.from &&
|
|
261
|
+
existing.to === edge.to &&
|
|
262
|
+
existing.specifier === edge.specifier &&
|
|
263
|
+
existing.kind === edge.kind &&
|
|
264
|
+
existing.importedName === edge.importedName &&
|
|
265
|
+
existing.localName === edge.localName &&
|
|
266
|
+
existing.via === edge.via);
|
|
267
|
+
if (!exists)
|
|
268
|
+
edges.push(edge);
|
|
269
|
+
}
|
|
160
270
|
//# sourceMappingURL=graph.js.map
|
package/dist/graph.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../src/graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,OAAO,EAAmB,MAAM,UAAU,CAAC;AAGpD,8DAA8D;A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FromPaths }
|
|
|
21
21
|
export { buildFileContextMap, clearFileContextCache } from './file-context.js';
|
|
22
22
|
export { classifyFileRole } from './file-role.js';
|
|
23
23
|
export { resolveImportGraph } from './graph.js';
|
|
24
|
-
export { inferFromFile, inferFromSource } from './inferrer.js';
|
|
24
|
+
export { findTsConfig, inferFromFile, inferFromSource } from './inferrer.js';
|
|
25
25
|
export type { KernLintRule } from './kern-lint.js';
|
|
26
26
|
export { flattenIR, lintKernIR } from './kern-lint.js';
|
|
27
|
-
export type { LLMBridgeConfig, LLMReviewInput, ReviewInstructionOptions } from './llm-bridge.js';
|
|
27
|
+
export type { LLMBridgeConfig, LLMCallResult, LLMReviewInput, LLMReviewResult, LLMUsage, ReviewInstructionOptions, } from './llm-bridge.js';
|
|
28
28
|
export { buildReviewInstructions, isLLMAvailable, runLLMReview } from './llm-bridge.js';
|
|
29
29
|
export type { LLMGraphContext } from './llm-review.js';
|
|
30
30
|
export { buildLLMPrompt, exportKernIR, parseLLMResponse } from './llm-review.js';
|
|
@@ -33,8 +33,11 @@ export type { NormViolation } from './norm-miner.js';
|
|
|
33
33
|
export { mineNorms } from './norm-miner.js';
|
|
34
34
|
export type { ObligationType, ProofObligation } from './obligations.js';
|
|
35
35
|
export { obligationsFromNorms, obligationsFromStructure, synthesizeObligations } from './obligations.js';
|
|
36
|
+
export type { PublicApiMap, PublicApiOverrides } from './public-api.js';
|
|
37
|
+
export { buildPublicApiMap, EMPTY_PUBLIC_API, expandPublicApiThroughReExports, isPublicApi, resolvePackageEntryFiles, resolveSpecifierToSrc, } from './public-api.js';
|
|
36
38
|
export { runQualityRules } from './quality-rules.js';
|
|
37
|
-
export { assignDefaultConfidence, calculateStats, checkEnforcement, dedup, formatEnforcement, formatReport, formatReportJSON, formatSARIF, formatSARIFWithSuppressions, formatSummary, sortAndDedup, sortFindings, } from './reporter.js';
|
|
39
|
+
export { assignDefaultConfidence, calculateStats, checkEnforcement, dedup, formatEnforcement, formatReport, formatReportJSON, formatSARIF, formatSARIFWithMetadata, formatSARIFWithSuppressions, formatSummary, sortAndDedup, sortFindings, } from './reporter.js';
|
|
40
|
+
export { debugDetail, ReviewHealthBuilder } from './review-health.js';
|
|
38
41
|
export { CONFIDENCE_RULES, lintConfidenceGraph, lintMultiFileConfidenceGraph } from './rules/confidence.js';
|
|
39
42
|
export { actionMissingIdempotent, assumeLowTrust, branchNonExhaustive, collectUnbounded, expectRangeInverted, GROUND_LAYER_RULES, guardWithoutElse, reasonWithoutBasis, } from './rules/ground-layer.js';
|
|
40
43
|
export type { RuleInfo } from './rules/index.js';
|
|
@@ -49,7 +52,7 @@ export { applySuppression, configDirectives, isConceptRule, parseDirectives } fr
|
|
|
49
52
|
export type { CrossFileTaintResult, ExportedFunction, TaintPath, TaintResult, TaintSink, TaintSource, } from './taint.js';
|
|
50
53
|
export { analyzeTaint, analyzeTaintCrossFile, buildExportMap, buildImportMap, crossFileTaintToFindings, isSanitizerSufficient, taintToFindings, } from './taint.js';
|
|
51
54
|
export { detectTemplates } from './template-detector.js';
|
|
52
|
-
export type { AnalysisContext, Confidence, EnforceResult, FileContext, FileRole, GraphFile, GraphOptions, GraphResult, InferResult, ReviewConfig, ReviewFinding, ReviewReport, ReviewRule, ReviewStats, RuleContext, RuntimeBoundary, SourceSpan, TemplateMatch, } from './types.js';
|
|
55
|
+
export type { AnalysisContext, Confidence, EnforceResult, FileContext, FileRole, GraphEdge, GraphEdgeKind, GraphFile, GraphOptions, GraphResult, InferResult, ReviewConfig, ReviewFinding, ReviewHealth, ReviewHealthEntry, ReviewHealthKind, ReviewHealthSubsystem, ReviewReport, ReviewRule, ReviewStats, RuleContext, RuntimeBoundary, SourceSpan, TemplateMatch, } from './types.js';
|
|
53
56
|
export { createFingerprint } from './types.js';
|
|
54
57
|
import { clearReviewCache } from './cache.js';
|
|
55
58
|
export type { ImplRoute, SpecCheckResult, SpecContract, SpecViolation, ViolationKind } from './spec-checker.js';
|
|
@@ -57,6 +60,28 @@ export { checkSpec, checkSpecFiles, extractImplRoutes, extractSpecContracts, mat
|
|
|
57
60
|
export { clearReviewCache };
|
|
58
61
|
/** Reset the shared project (for tests / watch mode) */
|
|
59
62
|
export declare function resetFsProject(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Refresh stale source files in the shared fs Project from disk.
|
|
65
|
+
*
|
|
66
|
+
* The singleton caches every source file it has ever loaded — including transitive imports
|
|
67
|
+
* followed by cross-file taint and call-graph analysis. In a long-running process (watch mode,
|
|
68
|
+
* IDE extension, repeated CLI invocations) those cached ASTs go stale whenever the underlying
|
|
69
|
+
* file changes on disk outside our own `replaceWithText` path. Cross-file findings would then
|
|
70
|
+
* reflect the OLD imported source, not the current one.
|
|
71
|
+
*
|
|
72
|
+
* This helper is the lightweight counterpart to resetFsProject(): instead of throwing the
|
|
73
|
+
* whole Project away, it stat-checks each loaded source file and calls ts-morph's
|
|
74
|
+
* refreshFromFileSystemSync only on the ones whose mtime moved. Use it between reviews in
|
|
75
|
+
* watch-mode callers. One-shot CLI runs don't need it — the process exits before stale
|
|
76
|
+
* reads matter.
|
|
77
|
+
*
|
|
78
|
+
* Returns the number of source files actually refreshed, so callers can log "reloaded N
|
|
79
|
+
* files" or decide not to re-review when the count is zero.
|
|
80
|
+
*/
|
|
81
|
+
export declare function refreshFsProjectFromDisk(): number;
|
|
82
|
+
/** True when the file is codegen output — detected via common path patterns or a @generated header. */
|
|
83
|
+
export declare function isGeneratedFile(filePath: string, source?: string): boolean;
|
|
84
|
+
export declare function isReviewableFile(filePath: string): boolean;
|
|
60
85
|
/**
|
|
61
86
|
* Review a single file. Auto-detects language from extension.
|
|
62
87
|
* Uses a filesystem-backed ts-morph Project for type-aware analysis.
|