@xenos1996/usa 2.27.0 → 2.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +13 -0
- package/dist/cli-help.js.map +1 -1
- package/dist/cli-intent.d.ts +4 -0
- package/dist/cli-intent.d.ts.map +1 -0
- package/dist/cli-intent.js +108 -0
- package/dist/cli-intent.js.map +1 -0
- package/dist/cli-scan.d.ts +12 -0
- package/dist/cli-scan.d.ts.map +1 -0
- package/dist/cli-scan.js +142 -0
- package/dist/cli-scan.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/engine/evaluate.d.ts.map +1 -1
- package/dist/engine/evaluate.js +31 -8
- package/dist/engine/evaluate.js.map +1 -1
- package/dist/intent/match.d.ts +38 -0
- package/dist/intent/match.d.ts.map +1 -0
- package/dist/intent/match.js +108 -0
- package/dist/intent/match.js.map +1 -0
- package/dist/intent/otm.d.ts +16 -0
- package/dist/intent/otm.d.ts.map +1 -0
- package/dist/intent/otm.js +144 -0
- package/dist/intent/otm.js.map +1 -0
- package/dist/intent/types.d.ts +111 -0
- package/dist/intent/types.d.ts.map +1 -0
- package/dist/intent/types.js +16 -0
- package/dist/intent/types.js.map +1 -0
- package/dist/scanner/adapters/codeql.d.ts +14 -0
- package/dist/scanner/adapters/codeql.d.ts.map +1 -0
- package/dist/scanner/adapters/codeql.js +134 -0
- package/dist/scanner/adapters/codeql.js.map +1 -0
- package/dist/scanner/adapters/dependency-cruiser.d.ts +3 -0
- package/dist/scanner/adapters/dependency-cruiser.d.ts.map +1 -0
- package/dist/scanner/adapters/dependency-cruiser.js +195 -0
- package/dist/scanner/adapters/dependency-cruiser.js.map +1 -0
- package/dist/scanner/adapters/ort.d.ts +12 -0
- package/dist/scanner/adapters/ort.d.ts.map +1 -0
- package/dist/scanner/adapters/ort.js +259 -0
- package/dist/scanner/adapters/ort.js.map +1 -0
- package/dist/scanner/adapters/scorecard.d.ts +7 -0
- package/dist/scanner/adapters/scorecard.d.ts.map +1 -0
- package/dist/scanner/adapters/scorecard.js +209 -0
- package/dist/scanner/adapters/scorecard.js.map +1 -0
- package/dist/scanner/adapters/semgrep.d.ts +3 -0
- package/dist/scanner/adapters/semgrep.d.ts.map +1 -0
- package/dist/scanner/adapters/semgrep.js +163 -0
- package/dist/scanner/adapters/semgrep.js.map +1 -0
- package/dist/scanner/adapters/trivy.d.ts +3 -0
- package/dist/scanner/adapters/trivy.d.ts.map +1 -0
- package/dist/scanner/adapters/trivy.js +163 -0
- package/dist/scanner/adapters/trivy.js.map +1 -0
- package/dist/scanner/config.d.ts +4 -0
- package/dist/scanner/config.d.ts.map +1 -0
- package/dist/scanner/config.js +15 -0
- package/dist/scanner/config.js.map +1 -0
- package/dist/scanner/identity.d.ts +17 -0
- package/dist/scanner/identity.d.ts.map +1 -0
- package/dist/scanner/identity.js +50 -0
- package/dist/scanner/identity.js.map +1 -0
- package/dist/scanner/normalize.d.ts +40 -0
- package/dist/scanner/normalize.d.ts.map +1 -0
- package/dist/scanner/normalize.js +85 -0
- package/dist/scanner/normalize.js.map +1 -0
- package/dist/scanner/registry.d.ts +19 -0
- package/dist/scanner/registry.d.ts.map +1 -0
- package/dist/scanner/registry.js +43 -0
- package/dist/scanner/registry.js.map +1 -0
- package/dist/scanner/run.d.ts +71 -0
- package/dist/scanner/run.d.ts.map +1 -0
- package/dist/scanner/run.js +461 -0
- package/dist/scanner/run.js.map +1 -0
- package/dist/scanner/sarif.d.ts +21 -0
- package/dist/scanner/sarif.d.ts.map +1 -0
- package/dist/scanner/sarif.js +156 -0
- package/dist/scanner/sarif.js.map +1 -0
- package/dist/scanner/types.d.ts +242 -0
- package/dist/scanner/types.d.ts.map +1 -0
- package/dist/scanner/types.js +11 -0
- package/dist/scanner/types.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1 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IAAI;QACJ,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QAC1D,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;KACnE,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,IAAY,EAAE,OAAe,EAAE,MAAc;IAC5D,OAAO;QACL,EAAE,EAAE,WAAW,IAAI,IAAI,MAAM,EAAE,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QAC3E,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE;QAC/D,UAAU,EAAE,WAAW,EAAE;QACzB,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,MAAM;QAChB,cAAc,EAAE,iBAAiB;QACjC,UAAU,EAAE,GAAG;QACf,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,EAAE;KACjB,CAAC;AACJ,CAAC;AAED,SAAS,WAAW;IAClB,OAAO;QACL,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;QACV,kBAAkB,EAAE,EAAE;QACtB,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,CAAC;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scanner subsystem types.
|
|
3
|
+
*
|
|
4
|
+
* These are the only types the adapter layer owns, and nothing in `src/engine/`
|
|
5
|
+
* imports them: a rule consumes scanner *artifacts* through the existing
|
|
6
|
+
* `oracle` check (ADR-0011) instead of importing evidence objects. That keeps
|
|
7
|
+
* the dependency direction one-way and keeps the rule engine free of any
|
|
8
|
+
* scanner-specific schema.
|
|
9
|
+
*/
|
|
10
|
+
/** The tool's own severity word, quoted verbatim and never re-mapped. */
|
|
11
|
+
export type ScannerSeverity = 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW' | 'INFO';
|
|
12
|
+
/**
|
|
13
|
+
* A scanner's verdict about its own observation — NOT a rule status.
|
|
14
|
+
* `UNAVAILABLE` exists so that "no evidence found" can never be read as
|
|
15
|
+
* "the feature does not exist" (Phase 5's hard requirement).
|
|
16
|
+
*/
|
|
17
|
+
export type ScannerVerdict = 'PASS' | 'FAIL' | 'PARTIAL' | 'UNKNOWN' | 'NOT_APPLICABLE' | 'UNAVAILABLE';
|
|
18
|
+
export type ScannerStatus = 'ok' | 'unavailable' | 'timeout' | 'error' | 'skipped';
|
|
19
|
+
/**
|
|
20
|
+
* One fact, observed by a tool, with enough provenance to re-find it.
|
|
21
|
+
*
|
|
22
|
+
* The `id` is a content hash over source + identifier + location + claim, so the
|
|
23
|
+
* same observation deduplicates across tools and across runs.
|
|
24
|
+
*/
|
|
25
|
+
export interface Evidence {
|
|
26
|
+
/** Stable content hash (EVT-<hex>). */
|
|
27
|
+
id: string;
|
|
28
|
+
source: EvidenceSource;
|
|
29
|
+
provenance: EvidenceProvenance;
|
|
30
|
+
claim: string;
|
|
31
|
+
severity: ScannerSeverity;
|
|
32
|
+
severitySource: 'tool-native' | 'adapter-default';
|
|
33
|
+
confidence: number;
|
|
34
|
+
status: ScannerVerdict;
|
|
35
|
+
/** Where to look. `null` means the tool does not locate — never "everywhere". */
|
|
36
|
+
location: EvidenceLocation | null;
|
|
37
|
+
/** Pointer back into the raw tool output, for re-reading. */
|
|
38
|
+
rawReference: RawReference;
|
|
39
|
+
/**
|
|
40
|
+
* CWE ids the tool itself attached to this finding (`CWE-79`).
|
|
41
|
+
*
|
|
42
|
+
* Structured rather than inferred from the claim text, because this is the
|
|
43
|
+
* join key between scanner evidence and a declared threat model — and a join
|
|
44
|
+
* built on substring matching would invent relationships.
|
|
45
|
+
*/
|
|
46
|
+
cwes?: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface EvidenceSource {
|
|
49
|
+
/** Adapter id, e.g. `trivy`. */
|
|
50
|
+
tool: string;
|
|
51
|
+
/** Tool version, as reported by `tool --version`. */
|
|
52
|
+
version: string;
|
|
53
|
+
/** Tool-native category (e.g. `vulnerability`, `secret`, `dependency-edge`). */
|
|
54
|
+
kind: string;
|
|
55
|
+
/** Tool-native identifier, preserved verbatim (CVE id, rule id, …). */
|
|
56
|
+
identifier: string;
|
|
57
|
+
}
|
|
58
|
+
export interface EvidenceProvenance {
|
|
59
|
+
executionId: string;
|
|
60
|
+
/** argv actually executed, for a re-run. */
|
|
61
|
+
command: string[];
|
|
62
|
+
/**
|
|
63
|
+
* Upstream stages that ran before `command`, in order. Present so that a
|
|
64
|
+
* provenance record reproduces the run rather than only its last step.
|
|
65
|
+
*/
|
|
66
|
+
preparedBy?: string[][];
|
|
67
|
+
/** Adapter config in effect, including rule-pack versions. */
|
|
68
|
+
config: Record<string, unknown>;
|
|
69
|
+
/** The commit the target pointed at, or `unversioned`. */
|
|
70
|
+
repositoryRevision: string;
|
|
71
|
+
timestamp: string;
|
|
72
|
+
executable: string;
|
|
73
|
+
/** Command timeout in milliseconds. */
|
|
74
|
+
timeoutMs: number;
|
|
75
|
+
/** Seconds the tool ran. */
|
|
76
|
+
elapsedMs: number;
|
|
77
|
+
}
|
|
78
|
+
export interface EvidenceLocation {
|
|
79
|
+
file: string;
|
|
80
|
+
line?: number;
|
|
81
|
+
column?: number;
|
|
82
|
+
}
|
|
83
|
+
export interface RawReference {
|
|
84
|
+
/** Byte offset into the artifact the claim came from. */
|
|
85
|
+
artifactOffset?: number;
|
|
86
|
+
jsonPath?: string;
|
|
87
|
+
excerpt?: string;
|
|
88
|
+
}
|
|
89
|
+
/** A finding produced directly from scanner evidence (path 2). */
|
|
90
|
+
export interface ScannerFinding {
|
|
91
|
+
id: string;
|
|
92
|
+
ruleId: string;
|
|
93
|
+
title: string;
|
|
94
|
+
claim: string;
|
|
95
|
+
severity: ScannerSeverity;
|
|
96
|
+
confidence: number;
|
|
97
|
+
status: ScannerVerdict;
|
|
98
|
+
evidenceIds: string[];
|
|
99
|
+
remediation: string;
|
|
100
|
+
locations: EvidenceLocation[];
|
|
101
|
+
}
|
|
102
|
+
/** One adapter's record in the run manifest — coverage as a first-class fact. */
|
|
103
|
+
export interface AdapterRun {
|
|
104
|
+
id: string;
|
|
105
|
+
available: boolean;
|
|
106
|
+
version: string;
|
|
107
|
+
command: string[];
|
|
108
|
+
/** Upstream stages that ran before `command`, in order. */
|
|
109
|
+
prepare?: string[][];
|
|
110
|
+
/** Artifact the evidence was parsed from, relative to the workdir. */
|
|
111
|
+
artifact?: string;
|
|
112
|
+
status: ScannerStatus;
|
|
113
|
+
/** Why an adapter did not produce evidence. Mandatory unless ok. */
|
|
114
|
+
reason?: string;
|
|
115
|
+
/**
|
|
116
|
+
* The process exit status, recorded and never interpreted.
|
|
117
|
+
*
|
|
118
|
+
* Tools disagree about what a non-zero status means: ORT exits 2 when it
|
|
119
|
+
* found violations (the run succeeded), while a usage error is also non-zero.
|
|
120
|
+
* The verdict comes from the parsed payload; the status is here so a reader
|
|
121
|
+
* can tell "it ran and objected" from "it never started".
|
|
122
|
+
*/
|
|
123
|
+
exitCode?: number;
|
|
124
|
+
evidenceCount: number;
|
|
125
|
+
elapsedMs: number;
|
|
126
|
+
needsNetwork: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface RunManifest {
|
|
129
|
+
executionId: string;
|
|
130
|
+
target: string;
|
|
131
|
+
repositoryRevision: string;
|
|
132
|
+
timestamp: string;
|
|
133
|
+
adapters: AdapterRun[];
|
|
134
|
+
environment: {
|
|
135
|
+
sandbox: string;
|
|
136
|
+
network: 'denied' | 'allowed';
|
|
137
|
+
outputCapBytes: number;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/** Everything an adapter needs to describe how it should run. */
|
|
141
|
+
export interface ScanTarget {
|
|
142
|
+
/** Absolute path to the audited project. */
|
|
143
|
+
path: string;
|
|
144
|
+
/** Scratch copy working directory; adapters run here, never in `path`. */
|
|
145
|
+
workdir: string;
|
|
146
|
+
revision: string;
|
|
147
|
+
executionId: string;
|
|
148
|
+
}
|
|
149
|
+
/** One process in a staged tool's pipeline (ORT `analyze`, CodeQL `create`). */
|
|
150
|
+
export interface ScannerStage {
|
|
151
|
+
argv: string[];
|
|
152
|
+
/** Overrides the command timeout for this stage alone. */
|
|
153
|
+
timeoutMs?: number;
|
|
154
|
+
}
|
|
155
|
+
export interface ScannerCommand {
|
|
156
|
+
/** The command that produces the evidence. */
|
|
157
|
+
argv: string[];
|
|
158
|
+
/**
|
|
159
|
+
* Stages that must succeed before `argv` runs.
|
|
160
|
+
*
|
|
161
|
+
* Some tools are pipelines, not single processes: ORT's `evaluate` reads a
|
|
162
|
+
* result file that `analyze` writes, and CodeQL's `analyze` reads a database
|
|
163
|
+
* that `create` writes. Without this the adapter can only describe a command
|
|
164
|
+
* that will always fail on a fresh checkout.
|
|
165
|
+
*/
|
|
166
|
+
prepare?: ScannerStage[];
|
|
167
|
+
/**
|
|
168
|
+
* Files the tool writes its parseable output to, relative to the scan
|
|
169
|
+
* workdir. The first that exists is read and handed to `parse` instead of
|
|
170
|
+
* stdout.
|
|
171
|
+
*
|
|
172
|
+
* Measured, not assumed: ORT's `evaluate` and CodeQL's `analyze` write JSON
|
|
173
|
+
* to a file and log to stdout, so an adapter that parses stdout gets progress
|
|
174
|
+
* lines where it expected violations.
|
|
175
|
+
*/
|
|
176
|
+
artifacts?: string[];
|
|
177
|
+
network?: boolean;
|
|
178
|
+
/** Extra wall-time for slow tools (database builds). */
|
|
179
|
+
timeoutMs?: number;
|
|
180
|
+
}
|
|
181
|
+
export interface ScannerConfig {
|
|
182
|
+
[key: string]: unknown;
|
|
183
|
+
}
|
|
184
|
+
export interface AdapterProbe {
|
|
185
|
+
available: boolean;
|
|
186
|
+
version: string;
|
|
187
|
+
/** Why it is unavailable, when it is. */
|
|
188
|
+
reason?: string;
|
|
189
|
+
executable?: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* The contract every scanner lives behind.
|
|
193
|
+
*
|
|
194
|
+
* `buildCommand` and `parse` are pure functions of their inputs — that is what
|
|
195
|
+
* makes a scanner testable without being installed.
|
|
196
|
+
*/
|
|
197
|
+
export interface ScannerAdapter {
|
|
198
|
+
readonly id: string;
|
|
199
|
+
readonly name: string;
|
|
200
|
+
/** True when a run may need network access (declared in the manifest). */
|
|
201
|
+
readonly needsNetwork?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* The `.usa/scanners.yaml` key that removes this adapter's network need, e.g.
|
|
204
|
+
* `scanners.semgrep.rules`. Named in the refusal message, because "needs
|
|
205
|
+
* network" is only actionable if the reader knows what to change.
|
|
206
|
+
*/
|
|
207
|
+
readonly networkConfigKey?: string;
|
|
208
|
+
defaultConfig(): ScannerConfig;
|
|
209
|
+
/**
|
|
210
|
+
* `target` is optional so existing callers keep working, but the runner passes
|
|
211
|
+
* it: a scanner installed as the project's own devDependency lives in
|
|
212
|
+
* `node_modules/.bin`, not on PATH, and it is the better binary because it can
|
|
213
|
+
* resolve the project's dependencies.
|
|
214
|
+
*/
|
|
215
|
+
probe(target?: ScanTarget): AdapterProbe;
|
|
216
|
+
buildCommand(target: ScanTarget, config: ScannerConfig): ScannerCommand;
|
|
217
|
+
parse(raw: string, context: ParseContext): Evidence[];
|
|
218
|
+
findings?(evidence: Evidence[]): ScannerFinding[];
|
|
219
|
+
}
|
|
220
|
+
export interface ParseContext {
|
|
221
|
+
adapterId: string;
|
|
222
|
+
adapterVersion: string;
|
|
223
|
+
target: ScanTarget;
|
|
224
|
+
config: ScannerConfig;
|
|
225
|
+
}
|
|
226
|
+
export interface ScanOptions {
|
|
227
|
+
target: string;
|
|
228
|
+
/** Adapter ids to run; default = all enabled in config. */
|
|
229
|
+
adapters?: string[];
|
|
230
|
+
config?: Record<string, ScannerConfig>;
|
|
231
|
+
/** Refuse to run anything that needs a build step (default true). */
|
|
232
|
+
allowBuildCommands?: boolean;
|
|
233
|
+
network?: boolean;
|
|
234
|
+
timeoutMs?: number;
|
|
235
|
+
now?: () => Date;
|
|
236
|
+
}
|
|
237
|
+
export interface ScanResult {
|
|
238
|
+
manifest: RunManifest;
|
|
239
|
+
evidence: Evidence[];
|
|
240
|
+
findings: ScannerFinding[];
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/scanner/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,yEAAyE;AACzE,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AAE9E;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,MAAM,GACN,SAAS,GACT,SAAS,GACT,gBAAgB,GAChB,aAAa,CAAC;AAElB,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,uCAAuC;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,eAAe,CAAC;IAC1B,cAAc,EAAE,aAAa,GAAG,iBAAiB,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,cAAc,CAAC;IACvB,iFAAiF;IACjF,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,6DAA6D;IAC7D,YA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ACnD;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACvC,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scanner subsystem types.
|
|
3
|
+
*
|
|
4
|
+
* These are the only types the adapter layer owns, and nothing in `src/engine/`
|
|
5
|
+
* imports them: a rule consumes scanner *artifacts* through the existing
|
|
6
|
+
* `oracle` check (ADR-0011) instead of importing evidence objects. That keeps
|
|
7
|
+
* the dependency direction one-way and keeps the rule engine free of any
|
|
8
|
+
* scanner-specific schema.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/scanner/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xenos1996/usa",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.1",
|
|
4
4
|
"description": "Universal Software Auditor — an open-source, self-adapting audit framework for any project, any stack, any stage",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"@eslint/js": "^10.0.1",
|
|
77
77
|
"@types/node": "^26.6.4",
|
|
78
78
|
"@vitest/coverage-v8": "^5.0.0",
|
|
79
|
+
"dependency-cruiser": "^18.7.0",
|
|
79
80
|
"eslint": "^10.12.0",
|
|
80
81
|
"husky": "^9.1.7",
|
|
81
82
|
"lint-staged": "^17.6.0",
|