mjolnir-qa 6.0.0 → 6.0.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/CHANGELOG.md +384 -1
- package/README.md +314 -29
- package/dist/cli.d.mts +1 -477
- package/dist/cli.mjs +664 -554
- package/dist/mcp/stdio.mjs +254 -366
- package/package.json +24 -34
- package/dist/rolldown-runtime-8H4AJuhK.mjs +0 -14
package/dist/cli.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/types.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Mjolnir — canonical types (JSON contract v1, schemaVersion 1).
|
|
4
3
|
*
|
|
@@ -739,11 +738,7 @@ interface ForensicVerdictSummary {
|
|
|
739
738
|
/** INCONCLUSIVE outcome count — a first-class result, not a failure. */
|
|
740
739
|
inconclusive: number;
|
|
741
740
|
}
|
|
742
|
-
//#endregion
|
|
743
|
-
//#region src/engine/tier-policy.d.ts
|
|
744
741
|
type Tier = "core" | "extended" | "quarantine";
|
|
745
|
-
//#endregion
|
|
746
|
-
//#region src/engine/overlap-dedup.d.ts
|
|
747
742
|
/** Per-rule metadata the dedup pass needs, built from RULES. */
|
|
748
743
|
interface OverlapMeta {
|
|
749
744
|
/** Rule IDs this rule can double-report on the same root cause. */
|
|
@@ -753,8 +748,6 @@ interface OverlapMeta {
|
|
|
753
748
|
/** RULES registry order for final tie-breaking. */
|
|
754
749
|
order?: number;
|
|
755
750
|
}
|
|
756
|
-
//#endregion
|
|
757
|
-
//#region src/forensics/classify.d.ts
|
|
758
751
|
declare const FORENSIC_VERDICTS: readonly ["likely-real-defect", "environmental-failure", "infrastructure-failure", "flaky", "retry-dependent", "unstable-construction", "inconclusive"];
|
|
759
752
|
type ForensicVerdict = (typeof FORENSIC_VERDICTS)[number];
|
|
760
753
|
declare const EVIDENCE_STATES: readonly ["exists", "absent", "unsupported", "contradictory", "insufficient"];
|
|
@@ -769,8 +762,6 @@ interface ForensicClassification {
|
|
|
769
762
|
construction: number;
|
|
770
763
|
};
|
|
771
764
|
}
|
|
772
|
-
//#endregion
|
|
773
|
-
//#region src/forensics/types.d.ts
|
|
774
765
|
type RunStatus = "passed" | "failed" | "timedOut" | "skipped" | "interrupted";
|
|
775
766
|
/** Derived per-test reliability facts. */
|
|
776
767
|
interface TestVerdict {
|
|
@@ -841,80 +832,6 @@ interface ForensicsReport {
|
|
|
841
832
|
/** Named reasons for incompleteness (e.g. "size-limit", "cumulative-size-limit", "parse-failure"). */
|
|
842
833
|
incompleteReasons: string[];
|
|
843
834
|
}
|
|
844
|
-
//#endregion
|
|
845
|
-
//#region src/engine/dependency-graph.d.ts
|
|
846
|
-
/**
|
|
847
|
-
* Dependency Graph (ECO-005).
|
|
848
|
-
*
|
|
849
|
-
* Parses package manifests (package.json, pyproject.toml, pom.xml) to
|
|
850
|
-
* build a dependency graph. Supports transitive dependency resolution,
|
|
851
|
-
* dependent lookup, and reachable-file computation from test files.
|
|
852
|
-
*/
|
|
853
|
-
interface DependencyNode {
|
|
854
|
-
path: string;
|
|
855
|
-
dependencies: string[];
|
|
856
|
-
}
|
|
857
|
-
declare class DependencyGraph {
|
|
858
|
-
private readonly nodes;
|
|
859
|
-
addNode(node: DependencyNode): void;
|
|
860
|
-
getDependencies(path: string): string[];
|
|
861
|
-
getTransitiveDependencies(path: string): string[];
|
|
862
|
-
getDependents(path: string): string[];
|
|
863
|
-
get allPaths(): string[];
|
|
864
|
-
get size(): number;
|
|
865
|
-
/** Whether the graph knows this exact key. Reachability must not
|
|
866
|
-
* treat "not in the graph" as "nothing to traverse" without saying so. */
|
|
867
|
-
has(path: string): boolean;
|
|
868
|
-
}
|
|
869
|
-
//#endregion
|
|
870
|
-
//#region src/engine/degradation-ledger.d.ts
|
|
871
|
-
/**
|
|
872
|
-
* One ledger for every silent capability loss.
|
|
873
|
-
*
|
|
874
|
-
* The defect class this exists to kill is not a deprecation warning. It is a
|
|
875
|
-
* `catch` in a DETECTION path that swallows an error and returns a clean
|
|
876
|
-
* default, so the scan still reports `analysisComplete` while quietly running
|
|
877
|
-
* with less capability than the reader was promised. Fifteen such sites were
|
|
878
|
-
* verified in this tree; the AST-layer ones are the worst, because the layer
|
|
879
|
-
* they degrade is the one that keeps prose comments and sample strings from
|
|
880
|
-
* becoming false-positive findings.
|
|
881
|
-
*
|
|
882
|
-
* Two shapes, one rule. The precedent already in the tree is
|
|
883
|
-
* `parserRetryDegradationCount` (`src/engine/tree-sitter-ast.ts`): a counted,
|
|
884
|
-
* readable number rather than a swallowed exception. This generalizes it —
|
|
885
|
-
* every site records a REASON from the closed set below, and the scan result
|
|
886
|
-
* carries the per-reason counts, so "the parser failed" becomes
|
|
887
|
-
* "the AST mask was unavailable for 3 files".
|
|
888
|
-
*
|
|
889
|
-
* The ledger is APPEND-ONLY and process-scoped, which has one consequence
|
|
890
|
-
* worth stating because it is the security-relevant direction: `beginWindow`
|
|
891
|
-
* returns a MARKER, not an ownership claim. Two concurrent `runScan` calls in
|
|
892
|
-
* one process (there is a test that does exactly this,
|
|
893
|
-
* `tests/stress/concurrent-same-process.spec.ts`) each read the records
|
|
894
|
-
* appended after their own marker, so a degradation one scan records may be
|
|
895
|
-
* counted by the other. That can only ever OVER-count — a scan reporting a
|
|
896
|
-
* degradation that happened to a sibling is more cautious than the truth, and
|
|
897
|
-
* never less — so the failure direction is the honest one. The alternative,
|
|
898
|
-
* a sink threaded through every rule context, is a diff across every call site
|
|
899
|
-
* in the tree to fix a problem that cannot make a scan look better than it is.
|
|
900
|
-
*/
|
|
901
|
-
/**
|
|
902
|
-
* Every reason a detection path may lose capability.
|
|
903
|
-
*
|
|
904
|
-
* Closed on purpose: a `catch` site that wants a new reason has to add it
|
|
905
|
-
* here, which is the moment a reviewer sees the claim. `tests/contract/
|
|
906
|
-
* no-uncounted-degradation.spec.ts` reads this list and fails on any `catch`
|
|
907
|
-
* in a detection path that neither rethrows, records one of these, nor
|
|
908
|
-
* appears in its allowlist with a stated reason.
|
|
909
|
-
*/
|
|
910
|
-
declare const DEGRADATION_REASONS: readonly ["ast-parse-failed", "ast-mask-unavailable", "ast-range-scan-failed", "ci-workflow-listing-unreadable", "workspace-manifest-unreadable", "java-build-listing-unreadable", "rules-tree-listing-unreadable", "trend-record-unparseable", "explain-fixture-unreadable", "explain-workflow-parse-failed", "explain-rule-crash", "rule-doc-rule-crash", "rule-doc-fixture-unreadable", "rule-doc-workflow-parse-failed", "python-manifest-unreadable", "ast-grammar-unavailable", "ast-typescript-parse-failed", "workflow-parse-failed"];
|
|
911
|
-
type DegradationReason = (typeof DEGRADATION_REASONS)[number];
|
|
912
|
-
interface DegradationCount {
|
|
913
|
-
readonly reason: DegradationReason;
|
|
914
|
-
readonly count: number;
|
|
915
|
-
}
|
|
916
|
-
//#endregion
|
|
917
|
-
//#region src/discovery/workspace.d.ts
|
|
918
835
|
/**
|
|
919
836
|
* Repository discovery (Sprint-Plan W1-03).
|
|
920
837
|
* Finds project root, parses package.json, detects npm/yarn/pnpm workspaces.
|
|
@@ -928,26 +845,6 @@ interface Workspace {
|
|
|
928
845
|
/** Glob patterns from the root package.json workspaces field. */
|
|
929
846
|
workspaceGlobs: string[];
|
|
930
847
|
}
|
|
931
|
-
//#endregion
|
|
932
|
-
//#region src/discovery/frameworks.d.ts
|
|
933
|
-
/**
|
|
934
|
-
* The catalogued frameworks whose detection is implemented today.
|
|
935
|
-
*
|
|
936
|
-
* Every entry must exist in the inventory — enforced by the parity spec, not
|
|
937
|
-
* by comment.
|
|
938
|
-
*/
|
|
939
|
-
declare const DETECTABLE_TEST_FRAMEWORKS: readonly ["jest", "vitest", "playwright"];
|
|
940
|
-
/** The detection output type, in the inventory's vocabulary. */
|
|
941
|
-
type DetectedFramework = (typeof DETECTABLE_TEST_FRAMEWORKS)[number];
|
|
942
|
-
interface FrameworkInfo$1 {
|
|
943
|
-
/** Detected frameworks, as inventory ids. */
|
|
944
|
-
frameworks: DetectedFramework[];
|
|
945
|
-
/** True when no config evidence was found at all. */
|
|
946
|
-
unknown: boolean;
|
|
947
|
-
}
|
|
948
|
-
declare function detectFrameworks(ws: Workspace): FrameworkInfo$1;
|
|
949
|
-
//#endregion
|
|
950
|
-
//#region src/rules/rule.d.ts
|
|
951
848
|
/**
|
|
952
849
|
* How the rule's primary detection decision is made (Verification Trust
|
|
953
850
|
* Evolution Plan §09.6/§12.1 — the enforced D6 enum, replacing free text):
|
|
@@ -1309,14 +1206,6 @@ interface QADoctorRule extends RuleMeta {
|
|
|
1309
1206
|
astQuery?: AstQueryHook;
|
|
1310
1207
|
run: RuleFn;
|
|
1311
1208
|
}
|
|
1312
|
-
//#endregion
|
|
1313
|
-
//#region src/discovery/ignores.d.ts
|
|
1314
|
-
/** An immutable, per-root resolved ignore matcher (audit R-8). */
|
|
1315
|
-
interface IgnoreMatcher {
|
|
1316
|
-
isIgnored(relPath: string): boolean;
|
|
1317
|
-
}
|
|
1318
|
-
//#endregion
|
|
1319
|
-
//#region src/engine/adapter.d.ts
|
|
1320
1209
|
/** Semantic operations a parsed file exposes to rules. */
|
|
1321
1210
|
interface ParsedFile {
|
|
1322
1211
|
path: string;
|
|
@@ -1340,98 +1229,6 @@ interface ParsedFile {
|
|
|
1340
1229
|
*/
|
|
1341
1230
|
frameworkTags?: readonly string[];
|
|
1342
1231
|
}
|
|
1343
|
-
interface FrameworkInfo {
|
|
1344
|
-
frameworks: string[];
|
|
1345
|
-
unknown: boolean;
|
|
1346
|
-
}
|
|
1347
|
-
/**
|
|
1348
|
-
* The result of the async parse stage (Verification Trust Evolution Plan
|
|
1349
|
-
* Phase 0.5, §10): an AST plus its explicit disposal path. The scan
|
|
1350
|
-
* pipeline calls `dispose()` exactly once per file, in a
|
|
1351
|
-
* finally-equivalent position that runs whether or not rules completed —
|
|
1352
|
-
* normal completion, rule crash, per-file budget expiry, or scan abort.
|
|
1353
|
-
*/
|
|
1354
|
-
interface ParsedAst {
|
|
1355
|
-
/** Consumed synchronously by rules via `ParsedFile.ast`. */
|
|
1356
|
-
ast: unknown;
|
|
1357
|
-
/** Release WASM/AST resources (`tree.delete()` for tree-sitter). */
|
|
1358
|
-
dispose(): void;
|
|
1359
|
-
}
|
|
1360
|
-
interface ScanContext {
|
|
1361
|
-
workspace: Workspace;
|
|
1362
|
-
/** Absolute paths of discovered test files. */
|
|
1363
|
-
testFiles: string[];
|
|
1364
|
-
deadline: number;
|
|
1365
|
-
/** Resolved per-scan ignore matcher (audit R-8) — no module globals. */
|
|
1366
|
-
ignoreMatcher: IgnoreMatcher;
|
|
1367
|
-
/** Called once per file that could not be read/analyzed. */
|
|
1368
|
-
onSkippedFile: (reason: string) => void;
|
|
1369
|
-
/**
|
|
1370
|
-
* Called when discovery stops early (audit H-8): deadline expiry or
|
|
1371
|
-
* the per-adapter file cap. The reason is named in analysisStatus.
|
|
1372
|
-
*/
|
|
1373
|
-
onDiscoveryTruncated: (reason: string) => void;
|
|
1374
|
-
/** Per-adapter discovery budget (audit H-8). One language can no
|
|
1375
|
-
* longer consume the whole list and starve the others. */
|
|
1376
|
-
maxFiles: number;
|
|
1377
|
-
/** R4c Scope Integrity: counted matcher exclusions (optional — adapters
|
|
1378
|
-
* whose discovery walks sharedWalk pass this through to the counters). */
|
|
1379
|
-
onIgnored?: (path: string) => void;
|
|
1380
|
-
/** R4c Scope Integrity: counted files no adapter claims (optional). */
|
|
1381
|
-
onUnrecognized?: (path: string) => void;
|
|
1382
|
-
/**
|
|
1383
|
-
* Called when a rule throws on a file (audit R-9): crash isolation
|
|
1384
|
-
* stays silent by default, but the scan counts it and `--debug`
|
|
1385
|
-
* surfaces it.
|
|
1386
|
-
*/
|
|
1387
|
-
onRuleCrash?: (ruleId: string, file: string, error: unknown) => void;
|
|
1388
|
-
}
|
|
1389
|
-
interface LanguageAdapter {
|
|
1390
|
-
readonly id: string;
|
|
1391
|
-
readonly extensions: readonly string[];
|
|
1392
|
-
/** Human-readable patterns this adapter searches for (empty-state UX). */
|
|
1393
|
-
readonly testFileGlobs: readonly string[];
|
|
1394
|
-
/** Dependency/output directory names this adapter never enters. */
|
|
1395
|
-
readonly dirSkips: readonly string[];
|
|
1396
|
-
/** Canonical test-file check per ecosystem conventions. */
|
|
1397
|
-
isTestFile(path: string): boolean;
|
|
1398
|
-
detectFrameworks(root: string): FrameworkInfo;
|
|
1399
|
-
discoverTestFiles(ctx: ScanContext): void;
|
|
1400
|
-
/**
|
|
1401
|
-
* Async parse stage (Verification Trust Evolution Plan Phase 0.5, §10):
|
|
1402
|
-
* awaited by the scan pipeline between discovery and rule execution.
|
|
1403
|
-
* `runRules` and every rule stay synchronous and consume the produced
|
|
1404
|
-
* tree via `ParsedFile.ast` — the engine is NOT async end-to-end, only
|
|
1405
|
-
* this one seam is (WASM grammar load is inherently async).
|
|
1406
|
-
*
|
|
1407
|
-
* Contract: resolve to a ParsedAst on success, `undefined` when this
|
|
1408
|
-
* adapter has no AST layer (or parsing failed — rules fall back to the
|
|
1409
|
-
* regex path either way). Never throws.
|
|
1410
|
-
*
|
|
1411
|
-
* May return the result directly as well as a promise: the ts-morph path
|
|
1412
|
-
* (plan V5-021) is synchronous, and forcing it to allocate a promise per
|
|
1413
|
-
* file would be a cost the shared seam has no business imposing. The
|
|
1414
|
-
* pipeline awaits either form.
|
|
1415
|
-
*
|
|
1416
|
-
* Declared as a PROPERTY, not a method signature. A method signature
|
|
1417
|
-
* promises a `this` binding that no adapter uses, and it makes every
|
|
1418
|
-
* consumer that reads `adapter.parseAst` trip the unbound-method rule —
|
|
1419
|
-
* which is a lint error that gets suppressed rather than a design that
|
|
1420
|
-
* gets fixed, so the shape has to say what it means.
|
|
1421
|
-
*/
|
|
1422
|
-
parseAst?: (file: ParsedFile) => ParsedAst | undefined | Promise<ParsedAst | undefined>;
|
|
1423
|
-
/**
|
|
1424
|
-
* Run all rules this adapter hosts against one file. `onCrash` is
|
|
1425
|
-
* invoked when a rule throws (audit R-9) — the crash is still
|
|
1426
|
-
* isolated, but never invisible. `budget` (audit P-1) stops rule
|
|
1427
|
-
* execution mid-file when a single file is too expensive to analyze
|
|
1428
|
-
* in full; the caller reports the skip honestly.
|
|
1429
|
-
*/
|
|
1430
|
-
runRules(rules: readonly UniversalRule[], file: ParsedFile, emit: (f: Omit<Finding, "ruleId" | "category">, ruleId: string, category: string) => void, onCrash?: (ruleId: string, error: unknown) => void, budget?: {
|
|
1431
|
-
deadline: number;
|
|
1432
|
-
onExceeded: () => void;
|
|
1433
|
-
}): void;
|
|
1434
|
-
}
|
|
1435
1232
|
/**
|
|
1436
1233
|
* A rule that declares which adapters it supports. Backward compatible:
|
|
1437
1234
|
* legacy 'test-files' maps to ['typescript'], 'ci-workflows' to
|
|
@@ -1471,103 +1268,6 @@ interface UniversalRule {
|
|
|
1471
1268
|
detectorRevision?: number;
|
|
1472
1269
|
run(file: ParsedFile): Array<Omit<Finding, "ruleId" | "category">>;
|
|
1473
1270
|
}
|
|
1474
|
-
//#endregion
|
|
1475
|
-
//#region src/engine/evidence-core.d.ts
|
|
1476
|
-
/**
|
|
1477
|
-
* The core's own version — stamped into every record's provenance so a
|
|
1478
|
-
* consumer can tell which normalization contract produced a record.
|
|
1479
|
-
* Bump ONLY on a semantic change to the normalization itself.
|
|
1480
|
-
*/
|
|
1481
|
-
declare const EVIDENCE_CORE_VERSION = "evidence-core@1";
|
|
1482
|
-
/** Evidence source formats the core understands today (WI-17 adds trace.zip). */
|
|
1483
|
-
type EvidenceSource = ForensicsReport["source"];
|
|
1484
|
-
/** Normalized per-test runtime evidence (plan WI-2 field contract). */
|
|
1485
|
-
interface EvidenceRecord {
|
|
1486
|
-
/** Where this evidence came from (format identity). */
|
|
1487
|
-
source: EvidenceSource;
|
|
1488
|
-
/** Ingested artifact identity — the report path the records derive from. */
|
|
1489
|
-
artifact: string;
|
|
1490
|
-
/** Test identity: file + title (+ declaration line when known). */
|
|
1491
|
-
file: string;
|
|
1492
|
-
title: string;
|
|
1493
|
-
/** 1-based declaration line when the source carries one (JUnit: absent). */
|
|
1494
|
-
line?: number;
|
|
1495
|
-
/** Normalized execution status facts. */
|
|
1496
|
-
status: {
|
|
1497
|
-
/** Last attempt's outcome. */
|
|
1498
|
-
final: RunStatus;
|
|
1499
|
-
/** Failed at least once across attempts. */
|
|
1500
|
-
failed: boolean;
|
|
1501
|
-
/** Executed more than once. */
|
|
1502
|
-
retried: boolean;
|
|
1503
|
-
/** Passed only on attempt >= 2 (TRUE-FLAKE). */
|
|
1504
|
-
passedOnRetry: boolean;
|
|
1505
|
-
skipped: boolean;
|
|
1506
|
-
/** Final attempt timed out. */
|
|
1507
|
-
timedOut: boolean;
|
|
1508
|
-
};
|
|
1509
|
-
/** Number of attempts (retries = attempts − 1). */
|
|
1510
|
-
attempts: number;
|
|
1511
|
-
/** Total duration across attempts. */
|
|
1512
|
-
durationMs: number;
|
|
1513
|
-
/** Error messages, in report order. Empty: not captured by this source yet. */
|
|
1514
|
-
errors: string[];
|
|
1515
|
-
/** Attachment names/paths. Empty: not captured by this source yet (WI-17). */
|
|
1516
|
-
attachments: string[];
|
|
1517
|
-
/** Where the record came from and under which normalization contract. */
|
|
1518
|
-
provenance: {
|
|
1519
|
-
core: typeof EVIDENCE_CORE_VERSION;
|
|
1520
|
-
ingest: "mjolnir.forensics";
|
|
1521
|
-
};
|
|
1522
|
-
}
|
|
1523
|
-
//#endregion
|
|
1524
|
-
//#region src/engine/provenance.d.ts
|
|
1525
|
-
type FileProvenance = "unmarked" | "generated-marked" | "codegen-like";
|
|
1526
|
-
/** Classify one file's provenance. Pure. */
|
|
1527
|
-
declare function classifyProvenance(file: {
|
|
1528
|
-
text: string;
|
|
1529
|
-
codeText?: string;
|
|
1530
|
-
}): FileProvenance;
|
|
1531
|
-
//#endregion
|
|
1532
|
-
//#region src/engine/scan-cache.d.ts
|
|
1533
|
-
interface CacheStats {
|
|
1534
|
-
hits: number;
|
|
1535
|
-
misses: number;
|
|
1536
|
-
/** Where the cache lives — reported so `--json` consumers can audit it. */
|
|
1537
|
-
file: string;
|
|
1538
|
-
}
|
|
1539
|
-
interface ScanCache {
|
|
1540
|
-
readonly stats: CacheStats;
|
|
1541
|
-
lookup(key: string): Finding[] | undefined;
|
|
1542
|
-
store(key: string, findings: Finding[], fileBudgetExceeded: boolean): void;
|
|
1543
|
-
persist(): void;
|
|
1544
|
-
}
|
|
1545
|
-
//#endregion
|
|
1546
|
-
//#region src/config/config.d.ts
|
|
1547
|
-
interface IgnoreEntry {
|
|
1548
|
-
ruleId: string;
|
|
1549
|
-
files?: string[];
|
|
1550
|
-
reason: string;
|
|
1551
|
-
/** ISO date; omitted means the suppression has no expiry. */
|
|
1552
|
-
expires?: string;
|
|
1553
|
-
}
|
|
1554
|
-
interface QADoctorConfig {
|
|
1555
|
-
gate?: "advisory" | "error" | "warning";
|
|
1556
|
-
/** Path globs to skip during discovery (see DEFAULT_IGNORES dialect). */
|
|
1557
|
-
exclude?: string[];
|
|
1558
|
-
severityOverrides?: Record<string, Severity>;
|
|
1559
|
-
ignore?: IgnoreEntry[];
|
|
1560
|
-
}
|
|
1561
|
-
declare function loadConfig(root: string, options?: {
|
|
1562
|
-
knownRuleIds?: ReadonlySet<string>;
|
|
1563
|
-
}): {
|
|
1564
|
-
config: QADoctorConfig;
|
|
1565
|
-
path: string | null;
|
|
1566
|
-
/** Non-fatal notes (e.g. unknown rule IDs in severityOverrides). */
|
|
1567
|
-
warnings: string[];
|
|
1568
|
-
};
|
|
1569
|
-
//#endregion
|
|
1570
|
-
//#region src/lib/glob.d.ts
|
|
1571
1271
|
/**
|
|
1572
1272
|
* Whether `path` matches `glob`, in the dialect documented above.
|
|
1573
1273
|
*
|
|
@@ -1578,17 +1278,6 @@ declare function loadConfig(root: string, options?: {
|
|
|
1578
1278
|
* the defect that made the whole dialect worth unifying.
|
|
1579
1279
|
*/
|
|
1580
1280
|
declare function pathMatchesGlob$1(path: string, glob: string): boolean;
|
|
1581
|
-
declare namespace scan_pipeline_d_exports {
|
|
1582
|
-
export { AssembleScanResultInput, CliArgs, DiscoveryResult, EVIDENCE_OVERRIDES$1 as EVIDENCE_OVERRIDES, FileAnalysisResult, KNOWN_RULE_IDS$1 as KNOWN_RULE_IDS, OVERLAP_META_BY_RULE_ID$1 as OVERLAP_META_BY_RULE_ID, PostScanResult, SUITE_INVALIDATING_RULE_IDS$1 as SUITE_INVALIDATING_RULE_IDS, ScanHooks, applyPostScanProcessing, assembleScanResult, buildUniversalRules$1 as buildUniversalRules, discoverAndParseRuntimeReport$1 as discoverAndParseRuntimeReport, discoverTestFilesPhase, fallbackWorkspace$1 as fallbackWorkspace, isValidFindingRecord$1 as isValidFindingRecord, pathMatchesGlob$1 as pathMatchesGlob, runFileAnalysisPhase, runScan$1 as runScan, selectAdapter, summarizeForensicVerdicts };
|
|
1583
|
-
}
|
|
1584
|
-
/** Registered rule IDs — used to warn on unknown severityOverrides keys (M4). */
|
|
1585
|
-
declare const KNOWN_RULE_IDS$1: ReadonlySet<string>;
|
|
1586
|
-
/**
|
|
1587
|
-
* R6 (Bug Map M-02): per-rule overlap metadata, built from RULES the
|
|
1588
|
-
* same way tierByRuleId is — `asUniversal` drops `overlapWith`, so the
|
|
1589
|
-
* dedup map must come from the registry directly.
|
|
1590
|
-
*/
|
|
1591
|
-
declare const OVERLAP_META_BY_RULE_ID$1: ReadonlyMap<string, OverlapMeta>;
|
|
1592
1281
|
declare function buildUniversalRules$1(root: string, strict?: boolean, opts?: {
|
|
1593
1282
|
/** CLI trust-gate flag (`--enable-plugins`) for this scan. */
|
|
1594
1283
|
enablePlugins?: boolean;
|
|
@@ -1610,13 +1299,6 @@ declare function buildUniversalRules$1(root: string, strict?: boolean, opts?: {
|
|
|
1610
1299
|
/** The same rules, named. The count is the disclosure; this is the evidence. */
|
|
1611
1300
|
withheldRuleIds: string[];
|
|
1612
1301
|
}>;
|
|
1613
|
-
/** Rule-declared evidence-level overrides (Honesty Core). */
|
|
1614
|
-
declare const EVIDENCE_OVERRIDES$1: ReadonlyMap<string, string>;
|
|
1615
|
-
/**
|
|
1616
|
-
* Rules whose findings void the suite's pass claim (RuleMeta.suiteInvalidating).
|
|
1617
|
-
* Built from the registry so the scorer never has to import it.
|
|
1618
|
-
*/
|
|
1619
|
-
declare const SUITE_INVALIDATING_RULE_IDS$1: ReadonlySet<string>;
|
|
1620
1302
|
interface CliArgs {
|
|
1621
1303
|
target: string;
|
|
1622
1304
|
json: boolean;
|
|
@@ -1837,131 +1519,6 @@ declare function discoverAndParseRuntimeReport$1(scanRoot: string): {
|
|
|
1837
1519
|
* caller) — never silently scored.
|
|
1838
1520
|
*/
|
|
1839
1521
|
declare function isValidFindingRecord$1(f: unknown): f is Omit<Finding, "ruleId" | "category">;
|
|
1840
|
-
/**
|
|
1841
|
-
* Replace 7-way nested ternary with a linear probe.
|
|
1842
|
-
* Returns the adapter whose `isTestFile` matches the path, falling
|
|
1843
|
-
* back to the TypeScript adapter (the default language).
|
|
1844
|
-
*/
|
|
1845
|
-
declare function selectAdapter(path: string): LanguageAdapter;
|
|
1846
|
-
interface DiscoveryResult {
|
|
1847
|
-
testFiles: string[];
|
|
1848
|
-
stagedSurface: boolean;
|
|
1849
|
-
}
|
|
1850
|
-
declare function discoverTestFilesPhase(workspace: Workspace, args: CliArgs, hooks: ScanHooks, scanRoot: Workspace, ctx: ScanContext): DiscoveryResult;
|
|
1851
|
-
interface FileAnalysisResult {
|
|
1852
|
-
skippedFiles: number;
|
|
1853
|
-
testFileCount: number;
|
|
1854
|
-
testDeclarationCount: number;
|
|
1855
|
-
rulesPartial: boolean;
|
|
1856
|
-
parseFailed: number;
|
|
1857
|
-
parseFallbacks: number;
|
|
1858
|
-
scanned: number;
|
|
1859
|
-
analyzed: number;
|
|
1860
|
-
/**
|
|
1861
|
-
* Files that HAD an AST stage and lost it to the scan deadline, so they
|
|
1862
|
-
* were analyzed by regex alone. Zero for every adapter that declares no
|
|
1863
|
-
* `parseAst` — that is a capability envelope, not a downgrade.
|
|
1864
|
-
*/
|
|
1865
|
-
astFallbackFiles: number;
|
|
1866
|
-
}
|
|
1867
|
-
declare function runFileAnalysisPhase(findings: Finding[], testFiles: string[], workspace: Workspace, activeRules: UniversalRule[], hooks: ScanHooks, cache: ScanCache, rulesDigest: string, deadline: number, truncationReasons: Set<string>, declarationsByFile: Map<string, number>, fileProvenance: Array<{
|
|
1868
|
-
path: string;
|
|
1869
|
-
provenance: ReturnType<typeof classifyProvenance>;
|
|
1870
|
-
}>, onRuleCrash: (ruleId: string, file: string, error: unknown) => void): Promise<FileAnalysisResult>;
|
|
1871
|
-
interface PostScanResult {
|
|
1872
|
-
testDeclarationCount: number;
|
|
1873
|
-
scopeInfo: {
|
|
1874
|
-
scope: "all" | "changed";
|
|
1875
|
-
degraded?: string | undefined;
|
|
1876
|
-
};
|
|
1877
|
-
suppressionCount: number;
|
|
1878
|
-
frameworks: ReturnType<typeof detectFrameworks>;
|
|
1879
|
-
runtimeReportPath: string | undefined;
|
|
1880
|
-
runtimeIncomplete: boolean;
|
|
1881
|
-
/**
|
|
1882
|
-
* The normalized evidence core (V5-011). Persisted rather than discarded,
|
|
1883
|
-
* so every post-ingest projection reads records instead of re-parsing a
|
|
1884
|
-
* report that may have changed underneath it.
|
|
1885
|
-
*/
|
|
1886
|
-
evidenceRecords: EvidenceRecord[];
|
|
1887
|
-
/** Aggregate forensic classifications from the ingested runtime report. */
|
|
1888
|
-
forensicVerdicts: ForensicVerdictSummary | undefined;
|
|
1889
|
-
config: ReturnType<typeof loadConfig>["config"];
|
|
1890
|
-
}
|
|
1891
|
-
/**
|
|
1892
|
-
* Summarize forensic classifications from an ingested runtime report
|
|
1893
|
-
* (plan §10.4, WAVE 5). Returns undefined when no verdict carries a
|
|
1894
|
-
* classification — the machine contract slot stays absent rather than
|
|
1895
|
-
* reporting all-zero counts.
|
|
1896
|
-
*/
|
|
1897
|
-
declare function summarizeForensicVerdicts(report: ForensicsReport): ForensicVerdictSummary | undefined;
|
|
1898
|
-
declare function applyPostScanProcessing(findings: Finding[], workspace: Workspace, args: CliArgs, hooks: ScanHooks, scanRoot: Workspace, declarationsByFile: Map<string, number>, testDeclarationCount: number, tierByRuleId: Map<string, Tier>, REVISION_BY_RULE_ID: Map<string, number>): PostScanResult;
|
|
1899
|
-
interface AssembleScanResultInput {
|
|
1900
|
-
findings: Finding[];
|
|
1901
|
-
testFileCount: number;
|
|
1902
|
-
testDeclarationCount: number;
|
|
1903
|
-
declarationsByFile: Map<string, number>;
|
|
1904
|
-
skippedFiles: number;
|
|
1905
|
-
rulesCrashed: number;
|
|
1906
|
-
truncationReasons: Set<string>;
|
|
1907
|
-
discoveryTruncated: boolean;
|
|
1908
|
-
rulesPartial: boolean;
|
|
1909
|
-
scopeIgnored: number;
|
|
1910
|
-
scopeUnrecognized: number;
|
|
1911
|
-
parseFailed: number;
|
|
1912
|
-
parseFallbacks?: number;
|
|
1913
|
-
/** Files that lost their AST stage to the scan deadline. See completion.ts. */
|
|
1914
|
-
astFallbackFiles?: number;
|
|
1915
|
-
/**
|
|
1916
|
-
* Reason-coded capability losses recorded during this scan's window. See
|
|
1917
|
-
* `src/engine/degradation-ledger.ts` for why the window is an index rather
|
|
1918
|
-
* than an ownership claim.
|
|
1919
|
-
*/
|
|
1920
|
-
degradations?: readonly DegradationCount[];
|
|
1921
|
-
/**
|
|
1922
|
-
* Rules removed from the run by the quarantine filter because `--strict`
|
|
1923
|
-
* was absent. Threaded from the rule loader — the only site that knows
|
|
1924
|
-
* the withheld set — into `coverageState`. Never an input to `partial`.
|
|
1925
|
-
*/
|
|
1926
|
-
rulesWithheld?: number;
|
|
1927
|
-
/** Rules withheld, named. See `buildUniversalRules`. */
|
|
1928
|
-
withheldRuleIds?: string[];
|
|
1929
|
-
/** Rules that actually ran. The denominator `rulesWithheld` is measured against. */
|
|
1930
|
-
rulesApplied?: number;
|
|
1931
|
-
scanned: number;
|
|
1932
|
-
analyzed?: number;
|
|
1933
|
-
testFiles: string[];
|
|
1934
|
-
workspace: Workspace;
|
|
1935
|
-
scanRoot: Workspace;
|
|
1936
|
-
args: CliArgs;
|
|
1937
|
-
hooks: ScanHooks;
|
|
1938
|
-
cache: ScanCache;
|
|
1939
|
-
REVISION_BY_RULE_ID: Map<string, number>;
|
|
1940
|
-
pluginsLoaded: Array<{
|
|
1941
|
-
name: string;
|
|
1942
|
-
rules: number;
|
|
1943
|
-
}>;
|
|
1944
|
-
scopeInfo: {
|
|
1945
|
-
scope: "all" | "changed";
|
|
1946
|
-
degraded?: string | undefined;
|
|
1947
|
-
};
|
|
1948
|
-
suppressionCount: number;
|
|
1949
|
-
frameworks: ReturnType<typeof detectFrameworks>;
|
|
1950
|
-
runtimeReportPath: string | undefined;
|
|
1951
|
-
runtimeIncomplete?: boolean;
|
|
1952
|
-
evidenceRecords?: EvidenceRecord[];
|
|
1953
|
-
forensicVerdicts: ForensicVerdictSummary | undefined;
|
|
1954
|
-
config: ReturnType<typeof loadConfig>["config"];
|
|
1955
|
-
fileProvenance: Array<{
|
|
1956
|
-
path: string;
|
|
1957
|
-
provenance: ReturnType<typeof classifyProvenance>;
|
|
1958
|
-
}>;
|
|
1959
|
-
started: number;
|
|
1960
|
-
stagedSurface: boolean;
|
|
1961
|
-
/** ECO-005: dependency graph built from project manifests. */
|
|
1962
|
-
dependencyGraph?: DependencyGraph;
|
|
1963
|
-
}
|
|
1964
|
-
declare function assembleScanResult(o: AssembleScanResultInput): ScanResult;
|
|
1965
1522
|
/**
|
|
1966
1523
|
* Testable default scan path core. `hooks` lets callers observe
|
|
1967
1524
|
* normally-invisible events (swallowed rule crashes) without changing
|
|
@@ -1986,11 +1543,7 @@ declare function assembleScanResult(o: AssembleScanResultInput): ScanResult;
|
|
|
1986
1543
|
* without threading a Project through every adapter.
|
|
1987
1544
|
*/
|
|
1988
1545
|
declare function runScan$1(args: CliArgs, hooks?: ScanHooks): Promise<ScanResult>;
|
|
1989
|
-
|
|
1990
|
-
//#region src/engine/version.d.ts
|
|
1991
|
-
declare const ENGINE_VERSION = "6.0.0";
|
|
1992
|
-
//#endregion
|
|
1993
|
-
//#region src/cli-io.d.ts
|
|
1546
|
+
declare const ENGINE_VERSION = "6.0.1";
|
|
1994
1547
|
/**
|
|
1995
1548
|
* Shared process IO sinks (certification-audit Phase 5, G6): the variadic
|
|
1996
1549
|
* console sinks and the internal-error reporter lived in cli.ts, which
|
|
@@ -2003,15 +1556,11 @@ type Output = (...parts: unknown[]) => void;
|
|
|
2003
1556
|
export declare const out: Output;
|
|
2004
1557
|
export declare const err: Output;
|
|
2005
1558
|
export declare function internalErrorMessage(err: unknown, emit: (s: string) => void, debug: boolean): void;
|
|
2006
|
-
//#endregion
|
|
2007
|
-
//#region src/claim-evidence.d.ts
|
|
2008
1559
|
/**
|
|
2009
1560
|
* The gate level a command applies to its findings. `advisory` is the
|
|
2010
1561
|
* `--blocking none` posture: findings are reported and never gate.
|
|
2011
1562
|
*/
|
|
2012
1563
|
type GateLevel = "advisory" | "error" | "warning";
|
|
2013
|
-
//#endregion
|
|
2014
|
-
//#region src/commands/why.d.ts
|
|
2015
1564
|
/**
|
|
2016
1565
|
* Testable why command core. Returns the process exit code.
|
|
2017
1566
|
* Live mode awaits the real scan; saved-report mode is synchronous.
|
|
@@ -2020,8 +1569,6 @@ export declare function runWhyCommand(argv: string[], io?: {
|
|
|
2020
1569
|
out: Output;
|
|
2021
1570
|
err: Output;
|
|
2022
1571
|
}): Promise<number>;
|
|
2023
|
-
//#endregion
|
|
2024
|
-
//#region src/cli-handlers.d.ts
|
|
2025
1572
|
/**
|
|
2026
1573
|
* Render scan output in the requested format.
|
|
2027
1574
|
*
|
|
@@ -2135,8 +1682,6 @@ export declare function runDoctorPlaywright(argv: string[], io?: {
|
|
|
2135
1682
|
out: Output;
|
|
2136
1683
|
err?: Output;
|
|
2137
1684
|
}): Promise<number>;
|
|
2138
|
-
//#endregion
|
|
2139
|
-
//#region src/commands/milestone.d.ts
|
|
2140
1685
|
export declare function runFrameworkMaturityCommand(argv: string[], io?: {
|
|
2141
1686
|
out: Output;
|
|
2142
1687
|
err: Output;
|
|
@@ -2157,14 +1702,10 @@ export declare function runCIIntegrityCommand(argv: string[], io?: {
|
|
|
2157
1702
|
out: Output;
|
|
2158
1703
|
err: Output;
|
|
2159
1704
|
}): Promise<number>;
|
|
2160
|
-
//#endregion
|
|
2161
|
-
//#region src/commands/doctor-run.d.ts
|
|
2162
1705
|
export declare function runDoctorCommand(argv: string[], io?: {
|
|
2163
1706
|
out: Output;
|
|
2164
1707
|
err: Output;
|
|
2165
1708
|
}): number;
|
|
2166
|
-
//#endregion
|
|
2167
|
-
//#region src/commands/handoff.d.ts
|
|
2168
1709
|
/**
|
|
2169
1710
|
* Testable handoff command core. Returns the process exit code.
|
|
2170
1711
|
* `mjolnir handoff [mjolnir.json] [--category <cat>]... [--rules <ids>]`
|
|
@@ -2173,8 +1714,6 @@ export declare function runHandoffCommand(argv: string[], io?: {
|
|
|
2173
1714
|
out: Output;
|
|
2174
1715
|
err: Output;
|
|
2175
1716
|
}): number;
|
|
2176
|
-
//#endregion
|
|
2177
|
-
//#region src/commands/install-agents.d.ts
|
|
2178
1717
|
/**
|
|
2179
1718
|
* Testable install command core. Returns the process exit code.
|
|
2180
1719
|
* `mjolnir install [--dry-run] [--force]` — probes the given cwd
|
|
@@ -2184,8 +1723,6 @@ export declare function runInstallCommand(argv: string[], io?: {
|
|
|
2184
1723
|
out: Output;
|
|
2185
1724
|
err: Output;
|
|
2186
1725
|
}, cwd?: string): number;
|
|
2187
|
-
//#endregion
|
|
2188
|
-
//#region src/commands/release-trust.d.ts
|
|
2189
1726
|
/**
|
|
2190
1727
|
* CLI verb: `mjolnir ci release-trust [--json] [repo-root]`.
|
|
2191
1728
|
* Exit contract (frozen set): 0 verdict PASS · 1 verdict non-PASS ·
|
|
@@ -2196,38 +1733,26 @@ export declare function runReleaseTrustCommand(argv: string[], io?: {
|
|
|
2196
1733
|
out: Output;
|
|
2197
1734
|
err: Output;
|
|
2198
1735
|
}): number;
|
|
2199
|
-
//#endregion
|
|
2200
|
-
//#region src/commands/policy.d.ts
|
|
2201
1736
|
export declare function runPolicyCommand(argv: string[], io: {
|
|
2202
1737
|
out: Output;
|
|
2203
1738
|
err: Output;
|
|
2204
1739
|
}): Promise<number>;
|
|
2205
|
-
//#endregion
|
|
2206
|
-
//#region src/commands/analyze.d.ts
|
|
2207
1740
|
export declare function runAnalyzeCommand(argv: string[], io: {
|
|
2208
1741
|
out: Output;
|
|
2209
1742
|
err: Output;
|
|
2210
1743
|
}): number;
|
|
2211
|
-
//#endregion
|
|
2212
|
-
//#region src/commands/ci-adapter.d.ts
|
|
2213
1744
|
export declare function runCiAdapterCommand(argv: string[], io: {
|
|
2214
1745
|
out: Output;
|
|
2215
1746
|
err: Output;
|
|
2216
1747
|
}): number;
|
|
2217
|
-
//#endregion
|
|
2218
|
-
//#region src/commands/contract-verify.d.ts
|
|
2219
1748
|
export declare function runContractVerifyCommand(argv: string[], io?: {
|
|
2220
1749
|
out: Output;
|
|
2221
1750
|
err: Output;
|
|
2222
1751
|
}): Promise<number>;
|
|
2223
|
-
//#endregion
|
|
2224
|
-
//#region src/commands/release-trend.d.ts
|
|
2225
1752
|
export declare function runTrustTrendCommand(argv: string[], io?: {
|
|
2226
1753
|
out: Output;
|
|
2227
1754
|
err: Output;
|
|
2228
1755
|
}): Promise<number>;
|
|
2229
|
-
//#endregion
|
|
2230
|
-
//#region src/cli.d.ts
|
|
2231
1756
|
export declare const runScan: typeof runScan$1, buildUniversalRules: typeof buildUniversalRules$1, fallbackWorkspace: typeof fallbackWorkspace$1, pathMatchesGlob: typeof pathMatchesGlob$1, isValidFindingRecord: typeof isValidFindingRecord$1, discoverAndParseRuntimeReport: typeof discoverAndParseRuntimeReport$1, KNOWN_RULE_IDS: ReadonlySet<string>, OVERLAP_META_BY_RULE_ID: ReadonlyMap<string, OverlapMeta>, EVIDENCE_OVERRIDES: ReadonlyMap<string, string>, SUITE_INVALIDATING_RULE_IDS: ReadonlySet<string>;
|
|
2232
1757
|
/** A usage-error detail: the offending token, when one exists. */
|
|
2233
1758
|
export interface UsageErrorDetail {
|
|
@@ -2304,6 +1829,5 @@ export declare function runHelpCommand(argv: string[], io?: {
|
|
|
2304
1829
|
err: Output;
|
|
2305
1830
|
}): number;
|
|
2306
1831
|
export declare function isEntryPoint(): boolean;
|
|
2307
|
-
//#endregion
|
|
2308
1832
|
export { ENGINE_VERSION as CLI_VERSION, type CliArgs, type Output, type ScanHooks };
|
|
2309
1833
|
//# sourceMappingURL=cli.d.mts.map
|