@geoql/doctor-core 1.2.1 → 1.3.0

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/index.d.ts CHANGED
@@ -1,5 +1,31 @@
1
1
  import { z } from "zod";
2
2
 
3
+ //#region src/rule-registry.d.ts
4
+ type RuleCategory = 'ai-slop' | 'reactivity' | 'composition' | 'performance' | 'template' | 'template-perf' | 'build-quality' | 'deps' | 'dead-code' | 'sfc' | 'vue-builtin' | 'structure' | 'modules-deps' | 'nitro' | 'seo' | 'cloudflare' | 'server-routes' | 'hydration' | 'data-fetching' | 'security' | 'design';
5
+ type RuleSource = 'doctor' | 'oxlint-builtin' | 'eslint-plugin-vue';
6
+ interface RegisteredRule {
7
+ readonly id: string;
8
+ readonly severity: Severity;
9
+ readonly category: RuleCategory;
10
+ readonly source: RuleSource;
11
+ readonly recommended: boolean;
12
+ }
13
+ declare const RULE_REGISTRY: readonly RegisteredRule[];
14
+ interface ListRulesFilter {
15
+ readonly preset?: 'recommended' | 'all';
16
+ readonly category?: RuleCategory;
17
+ readonly source?: RuleSource;
18
+ readonly severity?: Severity;
19
+ }
20
+ declare function listRules(filter?: ListRulesFilter): RegisteredRule[];
21
+ //#endregion
22
+ //#region src/score-dimensions.d.ts
23
+ type ScoreDimension = 'performance' | 'correctness' | 'security' | 'maintainability' | 'nuxt' | 'design';
24
+ declare const SCORE_DIMENSIONS: readonly ScoreDimension[];
25
+ declare function dimensionForCategory(category: RuleCategory): ScoreDimension;
26
+ declare function isScoreDimension(value: string): value is ScoreDimension;
27
+ declare function categoriesForDimension(dimension: ScoreDimension): RuleCategory[];
28
+ //#endregion
3
29
  //#region src/score.d.ts
4
30
  interface ScoreBreakdownEntry {
5
31
  ruleId: string;
@@ -7,6 +33,13 @@ interface ScoreBreakdownEntry {
7
33
  weightPerOccurrence: number;
8
34
  penalty: number;
9
35
  }
36
+ interface DimensionScore {
37
+ score: number;
38
+ totalFindings: number;
39
+ errorCount: number;
40
+ warnCount: number;
41
+ infoCount: number;
42
+ }
10
43
  interface ScoreResult {
11
44
  score: number;
12
45
  passed: boolean;
@@ -16,6 +49,12 @@ interface ScoreResult {
16
49
  warnCount: number;
17
50
  infoCount: number;
18
51
  breakdown: ScoreBreakdownEntry[];
52
+ /**
53
+ * Per-dimension sub-scores. Each is computed with the SAME √-decay formula
54
+ * isolated to that dimension's diagnostics — diagnostic aids that do NOT sum
55
+ * to the overall score. The single `score` above stays the authoritative value.
56
+ */
57
+ byDimension: Readonly<Record<ScoreDimension, DimensionScore>>;
19
58
  }
20
59
  interface ScoreConfig {
21
60
  rules?: Record<string, {
@@ -495,6 +534,13 @@ interface DoctorReport {
495
534
  info: number;
496
535
  };
497
536
  breakdown: DoctorReportBreakdownEntry[];
537
+ byDimension: Record<string, {
538
+ score: number;
539
+ totalFindings: number;
540
+ error: number;
541
+ warn: number;
542
+ info: number;
543
+ }>;
498
544
  };
499
545
  diagnostics: DoctorReportDiagnostic[];
500
546
  timing: {
@@ -546,25 +592,6 @@ declare function renderRulePrompt(ruleId: string): string | null;
546
592
  */
547
593
  declare function renderAgentPlaybook(): string;
548
594
  //#endregion
549
- //#region src/rule-registry.d.ts
550
- type RuleCategory = 'ai-slop' | 'reactivity' | 'composition' | 'performance' | 'template' | 'template-perf' | 'build-quality' | 'deps' | 'dead-code' | 'sfc' | 'vue-builtin' | 'structure' | 'modules-deps' | 'nitro' | 'seo' | 'cloudflare' | 'server-routes' | 'hydration' | 'data-fetching' | 'security' | 'design';
551
- type RuleSource = 'doctor' | 'oxlint-builtin' | 'eslint-plugin-vue';
552
- interface RegisteredRule {
553
- readonly id: string;
554
- readonly severity: Severity;
555
- readonly category: RuleCategory;
556
- readonly source: RuleSource;
557
- readonly recommended: boolean;
558
- }
559
- declare const RULE_REGISTRY: readonly RegisteredRule[];
560
- interface ListRulesFilter {
561
- readonly preset?: 'recommended' | 'all';
562
- readonly category?: RuleCategory;
563
- readonly source?: RuleSource;
564
- readonly severity?: Severity;
565
- }
566
- declare function listRules(filter?: ListRulesFilter): RegisteredRule[];
567
- //#endregion
568
595
  //#region src/audit-filter.d.ts
569
596
  /**
570
597
  * Filter `report.diagnostics` to a known set of allowed rule ids, then
@@ -588,6 +615,24 @@ declare function listRules(filter?: ListRulesFilter): RegisteredRule[];
588
615
  */
589
616
  declare function filterReportByRules(report: AuditReport, allowedRuleIds: ReadonlySet<string>, failOn?: 'error' | 'warn' | 'none', oxlintStderr?: string): AuditReport;
590
617
  //#endregion
618
+ //#region src/config/category-filter.d.ts
619
+ interface CategoryScopeInput {
620
+ categories?: readonly string[];
621
+ dimensions?: readonly string[];
622
+ }
623
+ /**
624
+ * Resolve `--category` + `--dimension` inputs to the concrete set of
625
+ * RuleCategory values they cover. Returns undefined when no scope was
626
+ * requested (run everything). Throws on an unknown category/dimension so the
627
+ * CLI can exit 2 rather than silently ignore a typo.
628
+ */
629
+ declare function resolveCategoryScope(input: CategoryScopeInput): ReadonlySet<RuleCategory> | undefined;
630
+ /**
631
+ * Narrow `ruleIds` to those whose registered category is in `scope`. RuleIds
632
+ * not in the registry are dropped (a category scope is an explicit allowlist).
633
+ */
634
+ declare function filterRuleIdsByCategory(ruleIds: Iterable<string>, scope: ReadonlySet<RuleCategory>): Set<string>;
635
+ //#endregion
591
636
  //#region src/push.d.ts
592
637
  /**
593
638
  * The 6 fields the SaaS receives for each finding.
@@ -660,5 +705,5 @@ declare function buildPushPayload(input: PushPayloadInput): PushPayload;
660
705
  */
661
706
  declare function pushFindings(opts: PushOptions): Promise<PushResult>;
662
707
  //#endregion
663
- export { type ApplyInlineDisablesOptions, type AuditConfig, type AuditReport, type AuditTimings, BUILT_IN_RECOMMENDED, type Capability, type CliOverrides, ConfigCycleError, ConfigFileNotFoundError, type ConfigSource, DOCTOR_REPORT_SCHEMA_VERSION, DeadCodeImportFailed, DeadCodeTimeoutError, type Diagnostic, type DiagnosticSource, type DirectiveLine, type DirectiveRange, type DirectiveSet, type DoctorReport, type DoctorUserConfig, type DoctorUserConfigInput, DoctorUserConfigSchema, type Framework, type GitScopeMode, type InitConfigFormat, type InitFileWrite, type InitOptions, type InitPlan, type InitPreset, InvalidConfigError, LevelSchema, type ListRulesFilter, type LoadRuleDocOptions, type MonorepoKind, type MonorepoResult, OxlintOutputTooLarge, OxlintSpawnFailed, type ProjectInfo, type ProjectInfoLite, type PushOptions, type PushPayload, type PushPayloadInput, type PushResult, type PushedFinding, RULE_REGISTRY, type RawInitAnswers, type RegisteredRule, type ReporterFormat, type ReporterInput, type ReporterOptions, type ResolvedDoctorConfig, type ResolvedInitAnswers, type RuleCategory, type RuleDoc, RuleEntrySchema, type RuleSource, type ScoreBreakdownEntry, type ScoreConfig, type ScoreResult, type Severity, type VerboseTraceOptions, type WorkspacePackage, agentReport, applyInlineDisables, audit, buildDoctorReport, buildJsonSchema, buildPushPayload, checkBuildQuality, checkDeadCode, checkDeps, checkNuxtProject, dedupeDeadCodeAgainstLint, defineConfig, detectProject, detectSummary, docsUrl, encodeAnnotation, encodeAnnotations, filterReportByRules, findMonorepoRoot, format, isNuxtLayoutFile, isNuxtPageFile, isNuxtServerFile, jsonCompactReport, jsonReport, listChangedFiles, listRules, listWorkspacePackages, loadAllRuleDocs, loadDoctorConfig, loadRuleDoc, mergeCliOverrides, normalizeInitAnswers, parseDirectives, parseExcludeList, planInit, prCommentReport, prettyReport, pushFindings, renderAgentPlaybook, renderDetectSummary, renderRulePrompt, renderVerboseTrace, runCrossFilePass, sarifReport, scoreDiagnostics, stripFindings, validateConfig };
708
+ export { type ApplyInlineDisablesOptions, type AuditConfig, type AuditReport, type AuditTimings, BUILT_IN_RECOMMENDED, type Capability, type CliOverrides, ConfigCycleError, ConfigFileNotFoundError, type ConfigSource, DOCTOR_REPORT_SCHEMA_VERSION, DeadCodeImportFailed, DeadCodeTimeoutError, type Diagnostic, type DiagnosticSource, type DimensionScore, type DirectiveLine, type DirectiveRange, type DirectiveSet, type DoctorReport, type DoctorUserConfig, type DoctorUserConfigInput, DoctorUserConfigSchema, type Framework, type GitScopeMode, type InitConfigFormat, type InitFileWrite, type InitOptions, type InitPlan, type InitPreset, InvalidConfigError, LevelSchema, type ListRulesFilter, type LoadRuleDocOptions, type MonorepoKind, type MonorepoResult, OxlintOutputTooLarge, OxlintSpawnFailed, type ProjectInfo, type ProjectInfoLite, type PushOptions, type PushPayload, type PushPayloadInput, type PushResult, type PushedFinding, RULE_REGISTRY, type RawInitAnswers, type RegisteredRule, type ReporterFormat, type ReporterInput, type ReporterOptions, type ResolvedDoctorConfig, type ResolvedInitAnswers, type RuleCategory, type RuleDoc, RuleEntrySchema, type RuleSource, SCORE_DIMENSIONS, type ScoreBreakdownEntry, type ScoreConfig, type ScoreDimension, type ScoreResult, type Severity, type VerboseTraceOptions, type WorkspacePackage, agentReport, applyInlineDisables, audit, buildDoctorReport, buildJsonSchema, buildPushPayload, categoriesForDimension, checkBuildQuality, checkDeadCode, checkDeps, checkNuxtProject, dedupeDeadCodeAgainstLint, defineConfig, detectProject, detectSummary, dimensionForCategory, docsUrl, encodeAnnotation, encodeAnnotations, filterReportByRules, filterRuleIdsByCategory, findMonorepoRoot, format, isNuxtLayoutFile, isNuxtPageFile, isNuxtServerFile, isScoreDimension, jsonCompactReport, jsonReport, listChangedFiles, listRules, listWorkspacePackages, loadAllRuleDocs, loadDoctorConfig, loadRuleDoc, mergeCliOverrides, normalizeInitAnswers, parseDirectives, parseExcludeList, planInit, prCommentReport, prettyReport, pushFindings, renderAgentPlaybook, renderDetectSummary, renderRulePrompt, renderVerboseTrace, resolveCategoryScope, runCrossFilePass, sarifReport, scoreDiagnostics, stripFindings, validateConfig };
664
709
  //# sourceMappingURL=index.d.ts.map