mjolnir-qa 0.5.2 → 0.5.4

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.th.md CHANGED
@@ -61,7 +61,7 @@ npx mjolnir-qa@latest
61
61
  รัน `mjolnir explain QA-CI-001` กับ finding แรกด้านบน แล้วคุณจะได้:
62
62
 
63
63
  ```text
64
- ▚▞ QA-CI-001 — continue-on-error masks a failing verification gate
64
+ QA-CI-001 — continue-on-error masks a failing verification gate
65
65
 
66
66
  Severity: error
67
67
  Confidence: high
@@ -370,7 +370,7 @@ repo ว่างจะได้คะแนน `null` ไม่ใช่เล
370
370
  ตัวชี้วัดพาดหัวสำหรับชุด Playwright — locator ของคุณทนทานแค่ไหน:
371
371
 
372
372
  ```text
373
- ▚▞ SELECTOR HEALTH — e2e/checkout.spec.ts
373
+ SELECTOR HEALTH — e2e/checkout.spec.ts
374
374
 
375
375
  [█████████████████░░░] 83 / 100
376
376
  role/text: 2 · testid: 1 · css-chains: 1 ⚠ · xpath: 0
@@ -391,7 +391,7 @@ mjolnir forensics ./test-results/
391
391
  ```
392
392
 
393
393
  ```text
394
- ▚▞ FLAKINESS LEADERBOARD
394
+ FLAKINESS LEADERBOARD
395
395
 
396
396
  3 tests · 1 failed · 1 flaky · 1 retried
397
397
 
package/README.tr.md CHANGED
@@ -64,7 +64,7 @@ Yukarıdaki ilk bulgu için `mjolnir explain QA-CI-001` komutunu çalıştırın
64
64
  elde edeceğiniz:
65
65
 
66
66
  ```text
67
- ▚▞ QA-CI-001 — continue-on-error masks a failing verification gate
67
+ QA-CI-001 — continue-on-error masks a failing verification gate
68
68
 
69
69
  Severity: error
70
70
  Confidence: high
@@ -377,7 +377,7 @@ Playwright takımları için başlık metriği — locator'larınız ne kadar
377
377
  dayanıklı:
378
378
 
379
379
  ```text
380
- ▚▞ SELECTOR HEALTH — e2e/checkout.spec.ts
380
+ SELECTOR HEALTH — e2e/checkout.spec.ts
381
381
 
382
382
  [█████████████████░░░] 83 / 100
383
383
  role/text: 2 · testid: 1 · css-chains: 1 ⚠ · xpath: 0
@@ -400,7 +400,7 @@ mjolnir forensics ./test-results/
400
400
  ```
401
401
 
402
402
  ```text
403
- ▚▞ FLAKINESS LEADERBOARD
403
+ FLAKINESS LEADERBOARD
404
404
 
405
405
  3 tests · 1 failed · 1 flaky · 1 retried
406
406
 
package/README.uk.md CHANGED
@@ -63,7 +63,7 @@ npx mjolnir-qa@latest
63
63
  отримаєте:
64
64
 
65
65
  ```text
66
- ▚▞ QA-CI-001 — continue-on-error masks a failing verification gate
66
+ QA-CI-001 — continue-on-error masks a failing verification gate
67
67
 
68
68
  Severity: error
69
69
  Confidence: high
@@ -376,7 +376,7 @@ OSS-коді** (по ≥ 10 вручну класифікованих знахі
376
376
  Головна метрика для Playwright-с'ютів — наскільки стійкі ваші локатори:
377
377
 
378
378
  ```text
379
- ▚▞ SELECTOR HEALTH — e2e/checkout.spec.ts
379
+ SELECTOR HEALTH — e2e/checkout.spec.ts
380
380
 
381
381
  [█████████████████░░░] 83 / 100
382
382
  role/text: 2 · testid: 1 · css-chains: 1 ⚠ · xpath: 0
@@ -399,7 +399,7 @@ mjolnir forensics ./test-results/
399
399
  ```
400
400
 
401
401
  ```text
402
- ▚▞ FLAKINESS LEADERBOARD
402
+ FLAKINESS LEADERBOARD
403
403
 
404
404
  3 tests · 1 failed · 1 flaky · 1 retried
405
405
 
package/README.vi.md CHANGED
@@ -62,7 +62,7 @@ Chạy `mjolnir explain QA-CI-001` trên finding đầu tiên ở trên và bạ
62
62
  được:
63
63
 
64
64
  ```text
65
- ▚▞ QA-CI-001 — continue-on-error masks a failing verification gate
65
+ QA-CI-001 — continue-on-error masks a failing verification gate
66
66
 
67
67
  Severity: error
68
68
  Confidence: high
@@ -374,7 +374,7 @@ Repo rỗng chấm `null`, không bao giờ 100 giả — xem
374
374
  Chỉ số tiêu đề cho suite Playwright — locator của bạn bền bao nhiêu:
375
375
 
376
376
  ```text
377
- ▚▞ SELECTOR HEALTH — e2e/checkout.spec.ts
377
+ SELECTOR HEALTH — e2e/checkout.spec.ts
378
378
 
379
379
  [█████████████████░░░] 83 / 100
380
380
  role/text: 2 · testid: 1 · css-chains: 1 ⚠ · xpath: 0
@@ -396,7 +396,7 @@ mjolnir forensics ./test-results/
396
396
  ```
397
397
 
398
398
  ```text
399
- ▚▞ FLAKINESS LEADERBOARD
399
+ FLAKINESS LEADERBOARD
400
400
 
401
401
  3 tests · 1 failed · 1 flaky · 1 retried
402
402
 
package/README.zh.md CHANGED
@@ -59,7 +59,7 @@ reporter 渲染——无任何删减。通过 `npm run docs:demo` 重新生成
59
59
  对上面第一条发现运行 `mjolnir explain QA-CI-001`,你会得到:
60
60
 
61
61
  ```text
62
- ▚▞ QA-CI-001 — continue-on-error masks a failing verification gate
62
+ QA-CI-001 — continue-on-error masks a failing verification gate
63
63
 
64
64
  Severity: error
65
65
  Confidence: high
@@ -363,7 +363,7 @@ TypeScript 与 Python 拥有最广的实测覆盖。Java 与 C# 已发布、有
363
363
  Playwright 套件的头号指标——你的定位器有多抗造:
364
364
 
365
365
  ```text
366
- ▚▞ SELECTOR HEALTH — e2e/checkout.spec.ts
366
+ SELECTOR HEALTH — e2e/checkout.spec.ts
367
367
 
368
368
  [█████████████████░░░] 83 / 100
369
369
  role/text: 2 · testid: 1 · css-chains: 1 ⚠ · xpath: 0
@@ -384,7 +384,7 @@ mjolnir forensics ./test-results/
384
384
  ```
385
385
 
386
386
  ```text
387
- ▚▞ FLAKINESS LEADERBOARD
387
+ FLAKINESS LEADERBOARD
388
388
 
389
389
  3 tests · 1 failed · 1 flaky · 1 retried
390
390
 
package/README.zht.md CHANGED
@@ -59,7 +59,7 @@ reporter 渲染——毫無刪減。以 `npm run docs:demo` 重新產生;
59
59
  對上面第一項發現執行 `mjolnir explain QA-CI-001`,你會得到:
60
60
 
61
61
  ```text
62
- ▚▞ QA-CI-001 — continue-on-error masks a failing verification gate
62
+ QA-CI-001 — continue-on-error masks a failing verification gate
63
63
 
64
64
  Severity: error
65
65
  Confidence: high
@@ -363,7 +363,7 @@ TypeScript 與 Python 擁有最廣的實測涵蓋。Java 與 C# 已發布、有
363
363
  Playwright 套件的首要指標——你的定位器有多耐操:
364
364
 
365
365
  ```text
366
- ▚▞ SELECTOR HEALTH — e2e/checkout.spec.ts
366
+ SELECTOR HEALTH — e2e/checkout.spec.ts
367
367
 
368
368
  [█████████████████░░░] 83 / 100
369
369
  role/text: 2 · testid: 1 · css-chains: 1 ⚠ · xpath: 0
@@ -384,7 +384,7 @@ mjolnir forensics ./test-results/
384
384
  ```
385
385
 
386
386
  ```text
387
- ▚▞ FLAKINESS LEADERBOARD
387
+ FLAKINESS LEADERBOARD
388
388
 
389
389
  3 tests · 1 failed · 1 flaky · 1 retried
390
390
 
package/dist/cli.d.mts CHANGED
@@ -128,6 +128,21 @@ interface Finding {
128
128
  /** How to fix — concrete action. */
129
129
  fix: string;
130
130
  docsUrl?: string;
131
+ /**
132
+ * Stable semantic identity of a remediation group: findings that can
133
+ * be reasoned about and potentially remediated as one root-cause unit
134
+ * (agent-handoff plan §5.1). This is intentionally a DIFFERENT
135
+ * concept from `ruleId` (which identifies the detector/rule).
136
+ *
137
+ * Current implementation strategy: fixGroupId = ruleId, because each
138
+ * rule currently represents one remediation group. Future rules may
139
+ * emit multiple findings belonging to one fix group, or multiple
140
+ * remediation groups. Consumers MUST NOT rely on
141
+ * fixGroupId === ruleId permanently.
142
+ *
143
+ * Additive within schemaVersion 1.
144
+ */
145
+ fixGroupId?: string;
131
146
  }
132
147
  interface DimensionScore {
133
148
  category: RuleCategory;
@@ -147,6 +162,16 @@ interface ScanResult {
147
162
  /** Present when --scope changed was requested. */
148
163
  scope?: "all" | "changed";
149
164
  scopeDegraded?: string;
165
+ /**
166
+ * Present when --staged was requested (agent-handoff plan §5.7):
167
+ * the scan surface was restricted to git staged files, and `files`
168
+ * is how many survived the intersection. The score reflects THAT
169
+ * surface — never present it as a full-repo score. Additive within
170
+ * schemaVersion 1.
171
+ */
172
+ staged?: {
173
+ files: number;
174
+ };
150
175
  /** Detected test frameworks (0.2). Empty + unknown=true when undetectable. */
151
176
  frameworks: string[];
152
177
  frameworkDetectionUnknown: boolean;
@@ -491,7 +516,7 @@ interface UniversalRule {
491
516
  * `scripts/sync-sarif-version.cjs` on release and guarded by
492
517
  * `tests/version-consistency.spec.ts` locally.
493
518
  */
494
- declare const CLI_VERSION = "0.5.2";
519
+ declare const CLI_VERSION = "0.5.4";
495
520
  declare function buildUniversalRules(root: string, strict?: boolean): Promise<{
496
521
  rules: UniversalRule[];
497
522
  pluginErrors: string[];
@@ -530,13 +555,75 @@ interface CliArgs {
530
555
  * under an unchanged rule set. Local-only, never leaves the machine.
531
556
  */
532
557
  cache?: boolean;
558
+ /**
559
+ * --no-progress: never render the live scan-progress line, even on an
560
+ * interactive TTY (plan M3, additive flag). Progress is stderr-only
561
+ * and auto-disabled in CI/machine formats; this flag is the manual off.
562
+ */
563
+ noProgress?: boolean;
564
+ /**
565
+ * --category <cat> (repeatable): presentation filter — narrows the
566
+ * TERMINAL findings display (and handoff/why output) to the given
567
+ * rule categories. NEVER filters the scan, the JSON/SARIF output,
568
+ * or the score (agent-handoff plan §5.5).
569
+ */
570
+ categories?: RuleCategory[];
571
+ /**
572
+ * --score: print only the numeric score (or `unknown` when the repo
573
+ * has no tests) instead of the full report. Pure rendering flag:
574
+ * scan semantics and exit codes are unchanged (plan §5.6).
575
+ */
576
+ scoreOnly?: boolean;
577
+ /**
578
+ * --staged: scan-surface restriction (plan §5.7) — intersect the
579
+ * discovered test files with the git staged file list. Does NOT
580
+ * change rule semantics; score implications come only from the
581
+ * narrowed surface (labeled as such in the report).
582
+ */
583
+ staged?: boolean;
584
+ /**
585
+ * --blocking error|warning|none (plan §5.8): invocation-level gate
586
+ * override. Controls PROCESS EXIT BEHAVIOR ONLY via the existing
587
+ * exitForFindings mechanism — detection, rendering, JSON and score
588
+ * are identical under all three values. Overrides config.gate.
589
+ */
590
+ blocking?: "error" | "warning" | "none";
591
+ }
592
+ /** A usage-error detail: the offending token, when one exists. */
593
+ interface UsageErrorDetail {
594
+ /** The unknown flag or rejected value (e.g. `--nope`, `loud`). */
595
+ token?: string | undefined;
596
+ /** The flag whose value was rejected (`--tone` for `--tone loud`). */
597
+ flag?: string | undefined;
533
598
  }
534
- declare function parseArgs(argv: string[]): CliArgs | null;
599
+ declare function parseArgs(argv: string[], onError?: (detail: UsageErrorDetail) => void): CliArgs | null;
600
+ /** Hand-rolled Levenshtein distance (plan M2: no new dependencies). */
601
+ declare function levenshtein(a: string, b: string): number;
602
+ /** Nearest known flags within distance ≤ 2, nearest first. */
603
+ declare function nearestFlags(flag: string, max?: number): string[];
604
+ /**
605
+ * Friendly usage error (plan M2, exit 10 preserved): nearest-flag
606
+ * suggestion, the valid neighbors, and the exact help command. Printed
607
+ * to stderr; findings/usage stay on their documented streams.
608
+ */
609
+ declare function usageErrorMessage(detail: UsageErrorDetail): string;
535
610
  interface ScanHooks {
536
611
  /** Invoked when a rule throws on a file (audit R-9). */
537
612
  onRuleCrash?: (ruleId: string, file: string, error: unknown) => void;
538
613
  /** Invoked for non-fatal config warnings (bug-audit M4). */
539
614
  onConfigWarning?: (message: string) => void;
615
+ /**
616
+ * Live-progress feed (plan M3, additive). Fired from the per-file
617
+ * parse+rules loop and the phase boundaries. Render-on-event only —
618
+ * the scan never waits on a timer, and output contracts are
619
+ * unchanged when the hook is absent.
620
+ */
621
+ onProgress?: (e: {
622
+ phase: "discover" | "parse" | "rules" | "score";
623
+ done?: number | undefined;
624
+ total?: number | undefined;
625
+ detail?: string | undefined;
626
+ }) => void;
540
627
  }
541
628
  /**
542
629
  * Workspace fallback for targets with no discoverable project root
@@ -675,7 +762,29 @@ declare function runPwReportCommand(argv: string[], io?: {
675
762
  out: Output;
676
763
  err: Output;
677
764
  }): number;
678
- declare function main(argv?: string[]): Promise<number>;
765
+ declare function main(argv?: string[], io?: {
766
+ out: Output;
767
+ err: Output;
768
+ }): Promise<number>;
769
+ /**
770
+ * `mjolnir help` / `mjolnir help <verb>` (plan M2). `--help`/`-h` and
771
+ * `<verb> --help` route here too. Exit 0 — help answers a question.
772
+ * Two-word verbs (`ci install`) are resolved first via the join of the
773
+ * leading non-flag tokens, then the single-word form.
774
+ */
775
+ declare function runHelpCommand(argv: string[], io?: {
776
+ out: Output;
777
+ err: Output;
778
+ }): number;
779
+ /**
780
+ * Friendly exit-20 path (plan M2): the crash says it's Mjölnir's bug,
781
+ * not the user's repo, carries the underlying message for a report, and
782
+ * prints the stack ONLY when `debug` is set (uniform across
783
+ * subcommands — they don't parse scan flags). Tests pin
784
+ * /internal error/i. Exported so the --debug stack arm is directly
785
+ * spec-coverable (spawning a real crash under --debug would be flaky).
786
+ */
787
+ declare function internalErrorMessage(err: unknown, emit: (s: string) => void, debug: boolean): void;
679
788
  declare function isEntryPoint(): boolean;
680
789
  //#endregion
681
- export { CLI_VERSION, Output, ScanHooks, buildUniversalRules, exitForFindings, fallbackWorkspace, isEntryPoint, main, parseArgs, pathMatchesGlob, runBadgeCommand, runBaselineCommand, runCiInstall, runCreateRuleCommand, runDebtCommand, runDiffCommand, runDoctorCommand, runDoctorPlaywright, runExplainCommand, runFixCommand, runForensicsCommand, runHandoverCommand, runImpactCommand, runInitCommand, runPrCommentCommand, runPwReportCommand, runRulesCommand, runScan, runScanCommand, runStatsCommand, runSuppressions, runTriageCommand };
790
+ export { CLI_VERSION, Output, ScanHooks, UsageErrorDetail, buildUniversalRules, exitForFindings, fallbackWorkspace, internalErrorMessage, isEntryPoint, levenshtein, main, nearestFlags, parseArgs, pathMatchesGlob, runBadgeCommand, runBaselineCommand, runCiInstall, runCreateRuleCommand, runDebtCommand, runDiffCommand, runDoctorCommand, runDoctorPlaywright, runExplainCommand, runFixCommand, runForensicsCommand, runHandoverCommand, runHelpCommand, runImpactCommand, runInitCommand, runPrCommentCommand, runPwReportCommand, runRulesCommand, runScan, runScanCommand, runStatsCommand, runSuppressions, runTriageCommand, usageErrorMessage };