audit-tools 0.55.9 → 0.55.11
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/audit/cli/auditStep.d.ts +1 -1
- package/dist/audit/cli/dispatch/packetFilter.d.ts +1 -1
- package/dist/audit/cli/functionalPreflight.d.ts +4 -4
- package/dist/audit/cli/sampleRunCommand.d.ts +1 -1
- package/dist/audit/cli/steps.d.ts +2 -2
- package/dist/audit/contracts/workerSchemas.d.ts +14 -14
- package/dist/audit/contracts/wrapperResponse.d.ts +8 -8
- package/dist/audit/extractors/analyzers/css.d.ts.map +1 -1
- package/dist/audit/extractors/analyzers/css.js +2 -30
- package/dist/audit/extractors/analyzers/css.js.map +1 -1
- package/dist/audit/extractors/analyzers/html.d.ts.map +1 -1
- package/dist/audit/extractors/analyzers/html.js +2 -30
- package/dist/audit/extractors/analyzers/html.js.map +1 -1
- package/dist/audit/extractors/analyzers/python.d.ts.map +1 -1
- package/dist/audit/extractors/analyzers/python.js +9 -34
- package/dist/audit/extractors/analyzers/python.js.map +1 -1
- package/dist/audit/extractors/analyzers/treeSitterBatch.d.ts +6 -0
- package/dist/audit/extractors/analyzers/treeSitterBatch.d.ts.map +1 -0
- package/dist/audit/extractors/analyzers/treeSitterBatch.js +38 -0
- package/dist/audit/extractors/analyzers/treeSitterBatch.js.map +1 -0
- package/dist/audit/extractors/graph.d.ts.map +1 -1
- package/dist/audit/extractors/graph.js +9 -7
- package/dist/audit/extractors/graph.js.map +1 -1
- package/dist/audit/extractors/graphPathIndex.d.ts +8 -0
- package/dist/audit/extractors/graphPathIndex.d.ts.map +1 -0
- package/dist/audit/extractors/graphPathIndex.js +47 -0
- package/dist/audit/extractors/graphPathIndex.js.map +1 -0
- package/dist/audit/extractors/graphPythonImports.d.ts +5 -4
- package/dist/audit/extractors/graphPythonImports.d.ts.map +1 -1
- package/dist/audit/extractors/graphPythonImports.js +15 -27
- package/dist/audit/extractors/graphPythonImports.js.map +1 -1
- package/dist/audit/extractors/graphRouteSources.d.ts +2 -1
- package/dist/audit/extractors/graphRouteSources.d.ts.map +1 -1
- package/dist/audit/extractors/graphRouteSources.js +5 -4
- package/dist/audit/extractors/graphRouteSources.js.map +1 -1
- package/dist/audit/extractors/graphSuites.d.ts +2 -1
- package/dist/audit/extractors/graphSuites.d.ts.map +1 -1
- package/dist/audit/extractors/graphSuites.js +6 -7
- package/dist/audit/extractors/graphSuites.js.map +1 -1
- package/dist/audit/orchestrator/flowPlanning.d.ts +2 -6
- package/dist/audit/orchestrator/flowPlanning.d.ts.map +1 -1
- package/dist/audit/orchestrator/flowPlanning.js +2 -9
- package/dist/audit/orchestrator/flowPlanning.js.map +1 -1
- package/dist/audit/orchestrator/requeueCommand.d.ts +1 -1
- package/dist/audit/orchestrator/taskBuilder.js +1 -1
- package/dist/audit/orchestrator/taskBuilder.js.map +1 -1
- package/dist/audit/types/auditState.d.ts +2 -2
- package/dist/audit/types/reviewPlanning.d.ts +2 -2
- package/dist/audit/types.d.ts +12 -12
- package/dist/remediate/intake.d.ts +2 -2
- package/dist/shared/decompose/contentCoherence.d.ts.map +1 -1
- package/dist/shared/decompose/contentCoherence.js +25 -9
- package/dist/shared/decompose/contentCoherence.js.map +1 -1
- package/dist/shared/tooling/allowlistedExec.d.ts +10 -7
- package/dist/shared/tooling/allowlistedExec.d.ts.map +1 -1
- package/dist/shared/tooling/allowlistedExec.js +275 -94
- package/dist/shared/tooling/allowlistedExec.js.map +1 -1
- package/dist/shared/tooling/exec.d.ts +4 -1
- package/dist/shared/tooling/exec.d.ts.map +1 -1
- package/dist/shared/tooling/exec.js +76 -71
- package/dist/shared/tooling/exec.js.map +1 -1
- package/dist/shared/tooling/ownedProcessLifecycle.d.ts +30 -0
- package/dist/shared/tooling/ownedProcessLifecycle.d.ts.map +1 -0
- package/dist/shared/tooling/ownedProcessLifecycle.js +99 -0
- package/dist/shared/tooling/ownedProcessLifecycle.js.map +1 -0
- package/dist/shared/tooling/windowsOwnedJob.d.ts +35 -0
- package/dist/shared/tooling/windowsOwnedJob.d.ts.map +1 -0
- package/dist/shared/tooling/windowsOwnedJob.js +145 -0
- package/dist/shared/tooling/windowsOwnedJob.js.map +1 -0
- package/package.json +2 -1
- package/wrapper/audit-code-wrapper-io.mjs +12 -107
- package/wrapper/remediate-code-wrapper-io.mjs +12 -107
- package/wrapper/shared-wrapper-io.mjs +109 -0
|
@@ -113,7 +113,7 @@ export declare function ingestBatchAuditResults(options: {
|
|
|
113
113
|
batchFiles: string[];
|
|
114
114
|
bundle: ArtifactBundle;
|
|
115
115
|
audit_state: {
|
|
116
|
-
status: "
|
|
116
|
+
status: "active" | "blocked" | "complete" | "not_started";
|
|
117
117
|
obligations: {
|
|
118
118
|
state: "not_applicable" | "blocked" | "missing" | "present" | "stale" | "satisfied";
|
|
119
119
|
id: string;
|
|
@@ -15,6 +15,7 @@ export declare function buildPendingAuditTasks(bundle: ArtifactBundle): {
|
|
|
15
15
|
status?: "pending" | "complete" | undefined;
|
|
16
16
|
tags?: string[] | undefined;
|
|
17
17
|
token_estimate?: number | undefined;
|
|
18
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
18
19
|
inputs?: Record<string, string> | undefined;
|
|
19
20
|
completed_at?: string | undefined;
|
|
20
21
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -31,7 +32,6 @@ export declare function buildPendingAuditTasks(bundle: ArtifactBundle): {
|
|
|
31
32
|
score: number;
|
|
32
33
|
prior_findings: Record<string, number>;
|
|
33
34
|
}[] | undefined;
|
|
34
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
35
35
|
risk_estimate?: number | undefined;
|
|
36
36
|
completion_reason?: string | undefined;
|
|
37
37
|
}[];
|
|
@@ -39,7 +39,7 @@ export declare const FunctionalPreflightSchema: z.ZodEffects<z.ZodObject<{
|
|
|
39
39
|
evidence: string;
|
|
40
40
|
available: boolean;
|
|
41
41
|
};
|
|
42
|
-
decision: "degraded" | "
|
|
42
|
+
decision: "degraded" | "ready" | "stop";
|
|
43
43
|
operator_approved_degraded: boolean;
|
|
44
44
|
limitation?: string | undefined;
|
|
45
45
|
}, {
|
|
@@ -54,7 +54,7 @@ export declare const FunctionalPreflightSchema: z.ZodEffects<z.ZodObject<{
|
|
|
54
54
|
evidence: string;
|
|
55
55
|
available: boolean;
|
|
56
56
|
};
|
|
57
|
-
decision: "degraded" | "
|
|
57
|
+
decision: "degraded" | "ready" | "stop";
|
|
58
58
|
operator_approved_degraded?: boolean | undefined;
|
|
59
59
|
limitation?: string | undefined;
|
|
60
60
|
}>, {
|
|
@@ -69,7 +69,7 @@ export declare const FunctionalPreflightSchema: z.ZodEffects<z.ZodObject<{
|
|
|
69
69
|
evidence: string;
|
|
70
70
|
available: boolean;
|
|
71
71
|
};
|
|
72
|
-
decision: "degraded" | "
|
|
72
|
+
decision: "degraded" | "ready" | "stop";
|
|
73
73
|
operator_approved_degraded: boolean;
|
|
74
74
|
limitation?: string | undefined;
|
|
75
75
|
}, {
|
|
@@ -84,7 +84,7 @@ export declare const FunctionalPreflightSchema: z.ZodEffects<z.ZodObject<{
|
|
|
84
84
|
evidence: string;
|
|
85
85
|
available: boolean;
|
|
86
86
|
};
|
|
87
|
-
decision: "degraded" | "
|
|
87
|
+
decision: "degraded" | "ready" | "stop";
|
|
88
88
|
operator_approved_degraded?: boolean | undefined;
|
|
89
89
|
limitation?: string | undefined;
|
|
90
90
|
}>;
|
|
@@ -202,6 +202,7 @@ export declare function buildSampleAuditBundle(findings?: Finding[]): Promise<{
|
|
|
202
202
|
status?: "pending" | "complete" | undefined;
|
|
203
203
|
tags?: string[] | undefined;
|
|
204
204
|
token_estimate?: number | undefined;
|
|
205
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
205
206
|
inputs?: Record<string, string> | undefined;
|
|
206
207
|
completed_at?: string | undefined;
|
|
207
208
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -218,7 +219,6 @@ export declare function buildSampleAuditBundle(findings?: Finding[]): Promise<{
|
|
|
218
219
|
score: number;
|
|
219
220
|
prior_findings: Record<string, number>;
|
|
220
221
|
}[] | undefined;
|
|
221
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
222
222
|
risk_estimate?: number | undefined;
|
|
223
223
|
completion_reason?: string | undefined;
|
|
224
224
|
}[] | undefined;
|
|
@@ -185,7 +185,7 @@ export declare const StepArtifactSchema: z.ZodObject<{
|
|
|
185
185
|
}[];
|
|
186
186
|
}>>;
|
|
187
187
|
}, "strict", z.ZodTypeAny, {
|
|
188
|
-
status: "
|
|
188
|
+
status: "ready" | "blocked" | "complete";
|
|
189
189
|
run_id: string | null;
|
|
190
190
|
contract_version: "audit-code-step/v1alpha1";
|
|
191
191
|
prompt_path: string;
|
|
@@ -224,7 +224,7 @@ export declare const StepArtifactSchema: z.ZodObject<{
|
|
|
224
224
|
}[];
|
|
225
225
|
} | undefined;
|
|
226
226
|
}, {
|
|
227
|
-
status: "
|
|
227
|
+
status: "ready" | "blocked" | "complete";
|
|
228
228
|
run_id: string | null;
|
|
229
229
|
contract_version: "audit-code-step/v1alpha1";
|
|
230
230
|
prompt_path: string;
|
|
@@ -368,6 +368,7 @@ export declare const WorkerAuditTaskSchema: z.ZodObject<{
|
|
|
368
368
|
status?: "pending" | "complete" | undefined;
|
|
369
369
|
tags?: string[] | undefined;
|
|
370
370
|
token_estimate?: number | undefined;
|
|
371
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
371
372
|
inputs?: Record<string, string> | undefined;
|
|
372
373
|
completed_at?: string | undefined;
|
|
373
374
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -384,7 +385,6 @@ export declare const WorkerAuditTaskSchema: z.ZodObject<{
|
|
|
384
385
|
score: number;
|
|
385
386
|
prior_findings: Record<string, number>;
|
|
386
387
|
}[] | undefined;
|
|
387
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
388
388
|
risk_estimate?: number | undefined;
|
|
389
389
|
completion_reason?: string | undefined;
|
|
390
390
|
}, {
|
|
@@ -397,6 +397,7 @@ export declare const WorkerAuditTaskSchema: z.ZodObject<{
|
|
|
397
397
|
status?: "pending" | "complete" | undefined;
|
|
398
398
|
tags?: string[] | undefined;
|
|
399
399
|
token_estimate?: number | undefined;
|
|
400
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
400
401
|
inputs?: Record<string, string> | undefined;
|
|
401
402
|
completed_at?: string | undefined;
|
|
402
403
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -413,7 +414,6 @@ export declare const WorkerAuditTaskSchema: z.ZodObject<{
|
|
|
413
414
|
score: number;
|
|
414
415
|
prior_findings: Record<string, number>;
|
|
415
416
|
}[] | undefined;
|
|
416
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
417
417
|
risk_estimate?: number | undefined;
|
|
418
418
|
completion_reason?: string | undefined;
|
|
419
419
|
}>;
|
|
@@ -756,6 +756,7 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
756
756
|
status?: "pending" | "complete" | undefined;
|
|
757
757
|
tags?: string[] | undefined;
|
|
758
758
|
token_estimate?: number | undefined;
|
|
759
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
759
760
|
inputs?: Record<string, string> | undefined;
|
|
760
761
|
completed_at?: string | undefined;
|
|
761
762
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -772,7 +773,6 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
772
773
|
score: number;
|
|
773
774
|
prior_findings: Record<string, number>;
|
|
774
775
|
}[] | undefined;
|
|
775
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
776
776
|
risk_estimate?: number | undefined;
|
|
777
777
|
completion_reason?: string | undefined;
|
|
778
778
|
}, {
|
|
@@ -785,6 +785,7 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
785
785
|
status?: "pending" | "complete" | undefined;
|
|
786
786
|
tags?: string[] | undefined;
|
|
787
787
|
token_estimate?: number | undefined;
|
|
788
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
788
789
|
inputs?: Record<string, string> | undefined;
|
|
789
790
|
completed_at?: string | undefined;
|
|
790
791
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -801,7 +802,6 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
801
802
|
score: number;
|
|
802
803
|
prior_findings: Record<string, number>;
|
|
803
804
|
}[] | undefined;
|
|
804
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
805
805
|
risk_estimate?: number | undefined;
|
|
806
806
|
completion_reason?: string | undefined;
|
|
807
807
|
}>, "many">>;
|
|
@@ -821,6 +821,7 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
821
821
|
status?: "pending" | "complete" | undefined;
|
|
822
822
|
tags?: string[] | undefined;
|
|
823
823
|
token_estimate?: number | undefined;
|
|
824
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
824
825
|
inputs?: Record<string, string> | undefined;
|
|
825
826
|
completed_at?: string | undefined;
|
|
826
827
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -837,7 +838,6 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
837
838
|
score: number;
|
|
838
839
|
prior_findings: Record<string, number>;
|
|
839
840
|
}[] | undefined;
|
|
840
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
841
841
|
risk_estimate?: number | undefined;
|
|
842
842
|
completion_reason?: string | undefined;
|
|
843
843
|
}[] | undefined;
|
|
@@ -858,6 +858,7 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
858
858
|
status?: "pending" | "complete" | undefined;
|
|
859
859
|
tags?: string[] | undefined;
|
|
860
860
|
token_estimate?: number | undefined;
|
|
861
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
861
862
|
inputs?: Record<string, string> | undefined;
|
|
862
863
|
completed_at?: string | undefined;
|
|
863
864
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -874,7 +875,6 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
874
875
|
score: number;
|
|
875
876
|
prior_findings: Record<string, number>;
|
|
876
877
|
}[] | undefined;
|
|
877
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
878
878
|
risk_estimate?: number | undefined;
|
|
879
879
|
completion_reason?: string | undefined;
|
|
880
880
|
}[] | undefined;
|
|
@@ -964,6 +964,7 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
964
964
|
status?: "pending" | "complete" | undefined;
|
|
965
965
|
tags?: string[] | undefined;
|
|
966
966
|
token_estimate?: number | undefined;
|
|
967
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
967
968
|
inputs?: Record<string, string> | undefined;
|
|
968
969
|
completed_at?: string | undefined;
|
|
969
970
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -980,7 +981,6 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
980
981
|
score: number;
|
|
981
982
|
prior_findings: Record<string, number>;
|
|
982
983
|
}[] | undefined;
|
|
983
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
984
984
|
risk_estimate?: number | undefined;
|
|
985
985
|
completion_reason?: string | undefined;
|
|
986
986
|
}[] | undefined;
|
|
@@ -1074,6 +1074,7 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
1074
1074
|
status?: "pending" | "complete" | undefined;
|
|
1075
1075
|
tags?: string[] | undefined;
|
|
1076
1076
|
token_estimate?: number | undefined;
|
|
1077
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
1077
1078
|
inputs?: Record<string, string> | undefined;
|
|
1078
1079
|
completed_at?: string | undefined;
|
|
1079
1080
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -1090,7 +1091,6 @@ export declare const WorkerAuditResultSchema: z.ZodObject<{
|
|
|
1090
1091
|
score: number;
|
|
1091
1092
|
prior_findings: Record<string, number>;
|
|
1092
1093
|
}[] | undefined;
|
|
1093
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
1094
1094
|
risk_estimate?: number | undefined;
|
|
1095
1095
|
completion_reason?: string | undefined;
|
|
1096
1096
|
}[] | undefined;
|
|
@@ -1441,6 +1441,7 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1441
1441
|
status?: "pending" | "complete" | undefined;
|
|
1442
1442
|
tags?: string[] | undefined;
|
|
1443
1443
|
token_estimate?: number | undefined;
|
|
1444
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
1444
1445
|
inputs?: Record<string, string> | undefined;
|
|
1445
1446
|
completed_at?: string | undefined;
|
|
1446
1447
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -1457,7 +1458,6 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1457
1458
|
score: number;
|
|
1458
1459
|
prior_findings: Record<string, number>;
|
|
1459
1460
|
}[] | undefined;
|
|
1460
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
1461
1461
|
risk_estimate?: number | undefined;
|
|
1462
1462
|
completion_reason?: string | undefined;
|
|
1463
1463
|
}, {
|
|
@@ -1470,6 +1470,7 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1470
1470
|
status?: "pending" | "complete" | undefined;
|
|
1471
1471
|
tags?: string[] | undefined;
|
|
1472
1472
|
token_estimate?: number | undefined;
|
|
1473
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
1473
1474
|
inputs?: Record<string, string> | undefined;
|
|
1474
1475
|
completed_at?: string | undefined;
|
|
1475
1476
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -1486,7 +1487,6 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1486
1487
|
score: number;
|
|
1487
1488
|
prior_findings: Record<string, number>;
|
|
1488
1489
|
}[] | undefined;
|
|
1489
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
1490
1490
|
risk_estimate?: number | undefined;
|
|
1491
1491
|
completion_reason?: string | undefined;
|
|
1492
1492
|
}>, "many">>;
|
|
@@ -1506,6 +1506,7 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1506
1506
|
status?: "pending" | "complete" | undefined;
|
|
1507
1507
|
tags?: string[] | undefined;
|
|
1508
1508
|
token_estimate?: number | undefined;
|
|
1509
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
1509
1510
|
inputs?: Record<string, string> | undefined;
|
|
1510
1511
|
completed_at?: string | undefined;
|
|
1511
1512
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -1522,7 +1523,6 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1522
1523
|
score: number;
|
|
1523
1524
|
prior_findings: Record<string, number>;
|
|
1524
1525
|
}[] | undefined;
|
|
1525
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
1526
1526
|
risk_estimate?: number | undefined;
|
|
1527
1527
|
completion_reason?: string | undefined;
|
|
1528
1528
|
}[] | undefined;
|
|
@@ -1543,6 +1543,7 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1543
1543
|
status?: "pending" | "complete" | undefined;
|
|
1544
1544
|
tags?: string[] | undefined;
|
|
1545
1545
|
token_estimate?: number | undefined;
|
|
1546
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
1546
1547
|
inputs?: Record<string, string> | undefined;
|
|
1547
1548
|
completed_at?: string | undefined;
|
|
1548
1549
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -1559,7 +1560,6 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1559
1560
|
score: number;
|
|
1560
1561
|
prior_findings: Record<string, number>;
|
|
1561
1562
|
}[] | undefined;
|
|
1562
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
1563
1563
|
risk_estimate?: number | undefined;
|
|
1564
1564
|
completion_reason?: string | undefined;
|
|
1565
1565
|
}[] | undefined;
|
|
@@ -1649,6 +1649,7 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1649
1649
|
status?: "pending" | "complete" | undefined;
|
|
1650
1650
|
tags?: string[] | undefined;
|
|
1651
1651
|
token_estimate?: number | undefined;
|
|
1652
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
1652
1653
|
inputs?: Record<string, string> | undefined;
|
|
1653
1654
|
completed_at?: string | undefined;
|
|
1654
1655
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -1665,7 +1666,6 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1665
1666
|
score: number;
|
|
1666
1667
|
prior_findings: Record<string, number>;
|
|
1667
1668
|
}[] | undefined;
|
|
1668
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
1669
1669
|
risk_estimate?: number | undefined;
|
|
1670
1670
|
completion_reason?: string | undefined;
|
|
1671
1671
|
}[] | undefined;
|
|
@@ -1759,6 +1759,7 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1759
1759
|
status?: "pending" | "complete" | undefined;
|
|
1760
1760
|
tags?: string[] | undefined;
|
|
1761
1761
|
token_estimate?: number | undefined;
|
|
1762
|
+
priority?: "high" | "low" | "medium" | undefined;
|
|
1762
1763
|
inputs?: Record<string, string> | undefined;
|
|
1763
1764
|
completed_at?: string | undefined;
|
|
1764
1765
|
file_line_counts?: Record<string, number> | undefined;
|
|
@@ -1775,7 +1776,6 @@ export declare const WorkerAuditResultsSchema: z.ZodArray<z.ZodObject<{
|
|
|
1775
1776
|
score: number;
|
|
1776
1777
|
prior_findings: Record<string, number>;
|
|
1777
1778
|
}[] | undefined;
|
|
1778
|
-
priority?: "high" | "low" | "medium" | undefined;
|
|
1779
1779
|
risk_estimate?: number | undefined;
|
|
1780
1780
|
completion_reason?: string | undefined;
|
|
1781
1781
|
}[] | undefined;
|
|
@@ -44,7 +44,7 @@ export declare const AuditCodeResponseSchema: z.ZodObject<{
|
|
|
44
44
|
reason?: string | undefined;
|
|
45
45
|
}>, "many">;
|
|
46
46
|
}, "strict", z.ZodTypeAny, {
|
|
47
|
-
status: "
|
|
47
|
+
status: "active" | "blocked" | "complete" | "not_started";
|
|
48
48
|
obligations: {
|
|
49
49
|
state: "not_applicable" | "blocked" | "missing" | "present" | "stale" | "satisfied";
|
|
50
50
|
id: string;
|
|
@@ -54,7 +54,7 @@ export declare const AuditCodeResponseSchema: z.ZodObject<{
|
|
|
54
54
|
last_obligation?: string | undefined;
|
|
55
55
|
blockers?: string[] | undefined;
|
|
56
56
|
}, {
|
|
57
|
-
status: "
|
|
57
|
+
status: "active" | "blocked" | "complete" | "not_started";
|
|
58
58
|
obligations: {
|
|
59
59
|
state: "not_applicable" | "blocked" | "missing" | "present" | "stale" | "satisfied";
|
|
60
60
|
id: string;
|
|
@@ -149,7 +149,7 @@ export declare const AuditCodeResponseSchema: z.ZodObject<{
|
|
|
149
149
|
quick_start: z.ZodOptional<z.ZodString>;
|
|
150
150
|
file_map: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
151
151
|
}, "strict", z.ZodTypeAny, {
|
|
152
|
-
status: "
|
|
152
|
+
status: "active" | "blocked" | "complete" | "not_started";
|
|
153
153
|
summary: string;
|
|
154
154
|
repo_root: string;
|
|
155
155
|
artifacts_dir: string;
|
|
@@ -183,7 +183,7 @@ export declare const AuditCodeResponseSchema: z.ZodObject<{
|
|
|
183
183
|
quick_start?: string | undefined;
|
|
184
184
|
file_map?: Record<string, string> | undefined;
|
|
185
185
|
}, {
|
|
186
|
-
status: "
|
|
186
|
+
status: "active" | "blocked" | "complete" | "not_started";
|
|
187
187
|
summary: string;
|
|
188
188
|
repo_root: string;
|
|
189
189
|
artifacts_dir: string;
|
|
@@ -220,7 +220,7 @@ export declare const AuditCodeResponseSchema: z.ZodObject<{
|
|
|
220
220
|
}, "strict", z.ZodTypeAny, {
|
|
221
221
|
contract_version: "audit-code/v1alpha1";
|
|
222
222
|
audit_state: {
|
|
223
|
-
status: "
|
|
223
|
+
status: "active" | "blocked" | "complete" | "not_started";
|
|
224
224
|
obligations: {
|
|
225
225
|
state: "not_applicable" | "blocked" | "missing" | "present" | "stale" | "satisfied";
|
|
226
226
|
id: string;
|
|
@@ -237,7 +237,7 @@ export declare const AuditCodeResponseSchema: z.ZodObject<{
|
|
|
237
237
|
progress_made: boolean;
|
|
238
238
|
next_likely_step: string | null;
|
|
239
239
|
handoff?: {
|
|
240
|
-
status: "
|
|
240
|
+
status: "active" | "blocked" | "complete" | "not_started";
|
|
241
241
|
summary: string;
|
|
242
242
|
repo_root: string;
|
|
243
243
|
artifacts_dir: string;
|
|
@@ -274,7 +274,7 @@ export declare const AuditCodeResponseSchema: z.ZodObject<{
|
|
|
274
274
|
}, {
|
|
275
275
|
contract_version: "audit-code/v1alpha1";
|
|
276
276
|
audit_state: {
|
|
277
|
-
status: "
|
|
277
|
+
status: "active" | "blocked" | "complete" | "not_started";
|
|
278
278
|
obligations: {
|
|
279
279
|
state: "not_applicable" | "blocked" | "missing" | "present" | "stale" | "satisfied";
|
|
280
280
|
id: string;
|
|
@@ -291,7 +291,7 @@ export declare const AuditCodeResponseSchema: z.ZodObject<{
|
|
|
291
291
|
progress_made: boolean;
|
|
292
292
|
next_likely_step: string | null;
|
|
293
293
|
handoff?: {
|
|
294
|
-
status: "
|
|
294
|
+
status: "active" | "blocked" | "complete" | "not_started";
|
|
295
295
|
summary: string;
|
|
296
296
|
repo_root: string;
|
|
297
297
|
artifacts_dir: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../../../src/audit/extractors/analyzers/css.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../../../src/audit/extractors/analyzers/css.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAmC,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAwFpF,eAAO,MAAM,WAAW,EAAE,gBAKzB,CAAC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
1
|
import { graphEdge, normalizeGraphPath } from "../graphPathUtils.js";
|
|
4
|
-
import {
|
|
2
|
+
import { analyzeTreeSitterFiles } from "./treeSitterBatch.js";
|
|
5
3
|
import { resolveResourceUrl } from "./resourceUrl.js";
|
|
6
4
|
const CSS_IMPORT_EDGE_CONFIDENCE = 0.9;
|
|
7
5
|
const CSS_URL_EDGE_CONFIDENCE = 0.82;
|
|
8
|
-
const MAX_CSS_SOURCE_BYTES = 512 * 1024;
|
|
9
6
|
function supports(file) {
|
|
10
7
|
return normalizeGraphPath(file).toLowerCase().endsWith(".css");
|
|
11
8
|
}
|
|
@@ -66,32 +63,7 @@ function collectFileEdges(fromPath, root, pathLookup, edges) {
|
|
|
66
63
|
}
|
|
67
64
|
}
|
|
68
65
|
async function analyze(files, context) {
|
|
69
|
-
|
|
70
|
-
return { edges: [] };
|
|
71
|
-
const parser = await getTreeSitterParser("css", context.dependencyPath);
|
|
72
|
-
if (!parser)
|
|
73
|
-
return { edges: [] };
|
|
74
|
-
const root = resolve(context.root);
|
|
75
|
-
const edges = [];
|
|
76
|
-
for (const file of files) {
|
|
77
|
-
let content;
|
|
78
|
-
try {
|
|
79
|
-
content = await readFile(resolve(root, file), "utf8");
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
continue;
|
|
83
|
-
}
|
|
84
|
-
if (content.length > MAX_CSS_SOURCE_BYTES)
|
|
85
|
-
continue;
|
|
86
|
-
try {
|
|
87
|
-
const tree = parser.parse(content);
|
|
88
|
-
collectFileEdges(normalizeGraphPath(file), tree.rootNode, context.pathLookup, edges);
|
|
89
|
-
}
|
|
90
|
-
catch (e) {
|
|
91
|
-
process.stderr.write(`[audit-code] css-analyzer: parse failed for '${file}': ${e.message ?? String(e)}\n`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return { edges };
|
|
66
|
+
return analyzeTreeSitterFiles(files, context, "css", "css-analyzer", collectFileEdges);
|
|
95
67
|
}
|
|
96
68
|
export const cssAnalyzer = {
|
|
97
69
|
id: "css",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../../../src/audit/extractors/analyzers/css.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../../../src/audit/extractors/analyzers/css.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,0BAA0B,GAAG,GAAG,CAAC;AACvC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,OAAO,CAAC,KAAa;IAC5B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IACE,OAAO,CAAC,MAAM,IAAI,CAAC;QACnB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACjD,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EACrD,CAAC;QACD,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,gFAAgF;AAChF,SAAS,YAAY,CAA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C,IAAI,CAAC;YAAE,SAAS;QAC/C,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,GAAG;YAAE,SAAS;QACnB,MAAM,MAAM,GAAG,kBAAkB,CAAC,QAAQ,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QAC7D,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,QAAQ,IAAI,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,SAAS;QACrE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrB,KAAK,CAAC,IAAI,CACR,SAAS,CAAC;YACR,IAAI,EAAE,QAAQ;YACd,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,uBAAuB;YACnC,MAAM,EAAE,yBAAyB,MAAM,IAAI;SAC5C,CAAC,CACH,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,OAAO,CACpB,KAAe,EACf,OAAwB;IAExB,OAAO,sBAAsB,CAC3B,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,gBAAgB,CACxD,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAqB;IAC3C,EAAE,EAAE,KAAK;IACT,UAAU,EAAE,iBAAiB;IAC7B,QAAQ;IACR,OAAO;CACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../../src/audit/extractors/analyzers/html.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../../src/audit/extractors/analyzers/html.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAmC,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAapF,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAI1D,CAAC;AAyDF,eAAO,MAAM,YAAY,EAAE,gBAK1B,CAAC"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { resolve } from "node:path";
|
|
3
1
|
import { graphEdge, normalizeGraphPath } from "../graphPathUtils.js";
|
|
4
|
-
import {
|
|
2
|
+
import { analyzeTreeSitterFiles } from "./treeSitterBatch.js";
|
|
5
3
|
import { resolveResourceUrl } from "./resourceUrl.js";
|
|
6
4
|
// Above the regex floor's html-resource-link so the merge prefers the parsed
|
|
7
5
|
// edge for the same (from, to).
|
|
8
6
|
const HTML_RESOURCE_EDGE_CONFIDENCE = 0.96;
|
|
9
|
-
const MAX_HTML_SOURCE_BYTES = 512 * 1024;
|
|
10
7
|
const HTML_EXTENSIONS = [".html", ".htm"];
|
|
11
8
|
// tag → the attribute carrying its resource reference. Single-sourced here and
|
|
12
9
|
// consumed by the regex floor (browserExtension.ts) so both the tree-sitter
|
|
@@ -59,32 +56,7 @@ function collectFileEdges(fromPath, root, pathLookup, edges) {
|
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
58
|
async function analyze(files, context) {
|
|
62
|
-
|
|
63
|
-
return { edges: [] };
|
|
64
|
-
const parser = await getTreeSitterParser("html", context.dependencyPath);
|
|
65
|
-
if (!parser)
|
|
66
|
-
return { edges: [] };
|
|
67
|
-
const root = resolve(context.root);
|
|
68
|
-
const edges = [];
|
|
69
|
-
for (const file of files) {
|
|
70
|
-
let content;
|
|
71
|
-
try {
|
|
72
|
-
content = await readFile(resolve(root, file), "utf8");
|
|
73
|
-
}
|
|
74
|
-
catch {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
if (content.length > MAX_HTML_SOURCE_BYTES)
|
|
78
|
-
continue;
|
|
79
|
-
try {
|
|
80
|
-
const tree = parser.parse(content);
|
|
81
|
-
collectFileEdges(normalizeGraphPath(file), tree.rootNode, context.pathLookup, edges);
|
|
82
|
-
}
|
|
83
|
-
catch (e) {
|
|
84
|
-
process.stderr.write(`[audit-code] html-analyzer: parse failed for '${file}': ${e.message ?? String(e)}\n`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return { edges };
|
|
59
|
+
return analyzeTreeSitterFiles(files, context, "html", "html-analyzer", collectFileEdges);
|
|
88
60
|
}
|
|
89
61
|
export const htmlAnalyzer = {
|
|
90
62
|
id: "html",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../../../src/audit/extractors/analyzers/html.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../../../src/audit/extractors/analyzers/html.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAGrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,6EAA6E;AAC7E,gCAAgC;AAChC,MAAM,6BAA6B,GAAG,IAAI,CAAC;AAC3C,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,CAAU,CAAC;AAEnD,+EAA+E;AAC/E,4EAA4E;AAC5E,qEAAqE;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAA2B;IAC7D,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;CACX,CAAC;AAEF,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IACrD,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,cAAc,CAAC,GAAW,EAAE,IAAY;IAC/C,KAAK,MAAM,SAAS,IAAI,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC;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AS,CAAC;YACR,IAAI,EAAE,QAAQ;YACd,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,eAAe;YACrB,UAAU,EAAE,6BAA6B;YACzC,MAAM,EAAE,SAAS,OAAO,IAAI,SAAS,iBAAiB,MAAM,IAAI;SACjE,CAAC,CACH,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,OAAO,CACpB,KAAe,EACf,OAAwB;IAExB,OAAO,sBAAsB,CAC3B,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,gBAAgB,CAC1D,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAqB;IAC5C,EAAE,EAAE,MAAM;IACV,UAAU,EAAE,iBAAiB;IAC7B,QAAQ;IACR,OAAO;CACR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../../../src/audit/extractors/analyzers/python.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAmC,gBAAgB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../../../src/audit/extractors/analyzers/python.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAmC,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAyGpF,eAAO,MAAM,cAAc,EAAE,gBAK5B,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { graphEdge
|
|
1
|
+
// sites-pinned: tests/audit/tree-sitter-analyzers.test.ts, tests/audit/tree-sitter-batch.test.ts
|
|
2
|
+
import { buildGraphPathIndex } from "../graphPathIndex.js";
|
|
3
|
+
import { graphEdge } from "../graphPathUtils.js";
|
|
4
4
|
import { isPythonSourcePath, resolvePythonFromImportTargets, resolvePythonImportTarget, } from "../graphPythonImports.js";
|
|
5
|
-
import {
|
|
5
|
+
import { analyzeTreeSitterFiles } from "./treeSitterBatch.js";
|
|
6
6
|
// Set above the regex floor's 0.95 so the merge prefers the AST-resolved edge
|
|
7
7
|
// for the same (from, to). Resolution itself is shared with the floor, so the
|
|
8
8
|
// only difference is parse-grade extraction.
|
|
9
9
|
const PY_IMPORT_EDGE_CONFIDENCE = 0.97;
|
|
10
|
-
const MAX_PYTHON_SOURCE_BYTES = 512 * 1024;
|
|
11
10
|
function supports(file) {
|
|
12
11
|
return isPythonSourcePath(file);
|
|
13
12
|
}
|
|
@@ -19,7 +18,7 @@ function importModuleText(nameNode) {
|
|
|
19
18
|
const text = moduleNode?.text?.trim();
|
|
20
19
|
return text && text.length > 0 ? text : undefined;
|
|
21
20
|
}
|
|
22
|
-
function collectFileEdges(fromPath, root, pathLookup, edges) {
|
|
21
|
+
function collectFileEdges(fromPath, root, pathLookup, edges, pathIndex) {
|
|
23
22
|
const seen = new Set();
|
|
24
23
|
const push = (target, kind, specifier) => {
|
|
25
24
|
if (target === fromPath)
|
|
@@ -41,7 +40,7 @@ function collectFileEdges(fromPath, root, pathLookup, edges) {
|
|
|
41
40
|
const specifier = importModuleText(nameNode);
|
|
42
41
|
if (!specifier)
|
|
43
42
|
continue;
|
|
44
|
-
const target = resolvePythonImportTarget(fromPath, specifier, pathLookup);
|
|
43
|
+
const target = resolvePythonImportTarget(fromPath, specifier, pathLookup, pathIndex);
|
|
45
44
|
if (target)
|
|
46
45
|
push(target, "py-import", specifier);
|
|
47
46
|
}
|
|
@@ -54,7 +53,7 @@ function collectFileEdges(fromPath, root, pathLookup, edges) {
|
|
|
54
53
|
const importedNames = childrenForField(node, "name")
|
|
55
54
|
.map((nameNode) => importModuleText(nameNode))
|
|
56
55
|
.filter((name) => Boolean(name));
|
|
57
|
-
for (const { specifier, target } of resolvePythonFromImportTargets(fromPath, moduleSpecifier, importedNames, pathLookup)) {
|
|
56
|
+
for (const { specifier, target } of resolvePythonFromImportTargets(fromPath, moduleSpecifier, importedNames, pathLookup, pathIndex)) {
|
|
58
57
|
push(target, "py-from-import", specifier);
|
|
59
58
|
}
|
|
60
59
|
}
|
|
@@ -69,32 +68,8 @@ function childrenForField(node, field) {
|
|
|
69
68
|
return single ? [single] : [];
|
|
70
69
|
}
|
|
71
70
|
async function analyze(files, context) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
const parser = await getTreeSitterParser("python", context.dependencyPath);
|
|
75
|
-
if (!parser)
|
|
76
|
-
return { edges: [] };
|
|
77
|
-
const root = resolve(context.root);
|
|
78
|
-
const edges = [];
|
|
79
|
-
for (const file of files) {
|
|
80
|
-
let content;
|
|
81
|
-
try {
|
|
82
|
-
content = await readFile(resolve(root, file), "utf8");
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
if (content.length > MAX_PYTHON_SOURCE_BYTES)
|
|
88
|
-
continue;
|
|
89
|
-
try {
|
|
90
|
-
const tree = parser.parse(content);
|
|
91
|
-
collectFileEdges(normalizeGraphPath(file), tree.rootNode, context.pathLookup, edges);
|
|
92
|
-
}
|
|
93
|
-
catch (e) {
|
|
94
|
-
process.stderr.write(`[audit-code] python-analyzer: parse failed for '${file}': ${e.message ?? String(e)}\n`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return { edges };
|
|
71
|
+
let pathIndex;
|
|
72
|
+
return analyzeTreeSitterFiles(files, context, "python", "python-analyzer", (fromPath, root, pathLookup, edges) => collectFileEdges(fromPath, root, pathLookup, edges, pathIndex), undefined, () => { pathIndex = buildGraphPathIndex(context.pathLookup); });
|
|
98
73
|
}
|
|
99
74
|
export const pythonAnalyzer = {
|
|
100
75
|
id: "python",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"python.js","sourceRoot":"","sources":["../../../../src/audit/extractors/analyzers/python.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"python.js","sourceRoot":"","sources":["../../../../src/audit/extractors/analyzers/python.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,O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import { getTreeSitterParser, type TsNode } from "./treeSitter.js";
|
|
4
|
+
/** Internal batch lifecycle; language-specific collection stays in each analyzer. */
|
|
5
|
+
export declare function analyzeTreeSitterFiles(files: string[], context: AnalyzerContext, grammar: string, warningLabel: string, collectFileEdges: (fromPath: string, root: TsNode, pathLookup: Map<string, string>, edges: GraphEdge[]) => void, loadParser?: typeof getTreeSitterParser, prepareBatch?: () => void): Promise<AnalyzerOutput>;
|
|
6
|
+
//# sourceMappingURL=treeSitterBatch.d.ts.map
|