@doccov/sdk 0.25.12 → 0.26.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.
@@ -5,13 +5,30 @@ interface DetectedSchemaEntry {
5
5
  schema: Record<string, unknown>;
6
6
  vendor: string;
7
7
  }
8
- import { DocCovSpec } from "@doccov/spec";
8
+ import { DocCovSpec, TypeReferenceLocation } from "@doccov/spec";
9
9
  import { OpenPkg } from "@openpkg-ts/spec";
10
10
  type OpenPkgSpec = OpenPkg;
11
+ /** Forgotten from extract package (different shape than spec type) */
12
+ interface ExtractForgottenExport {
13
+ name: string;
14
+ definedIn?: string;
15
+ referencedBy: Array<{
16
+ typeName: string;
17
+ exportName: string;
18
+ location: TypeReferenceLocation;
19
+ path?: string;
20
+ }>;
21
+ isExternal: boolean;
22
+ fix?: string;
23
+ }
11
24
  interface BuildDocCovOptions {
12
25
  openpkgPath: string;
13
26
  openpkg: OpenPkgSpec;
14
27
  packagePath?: string;
28
+ /** Forgotten exports from extraction (for API surface calculation) */
29
+ forgottenExports?: ExtractForgottenExport[];
30
+ /** Type names to ignore in API surface calculation */
31
+ apiSurfaceIgnore?: string[];
15
32
  }
16
33
  /**
17
34
  * Build a DocCov spec from an OpenPkg spec.
@@ -467,6 +484,7 @@ declare function getExportMissing(exp: SpecExport7, doccov: DocCovSpec2): Missin
467
484
  declare function isExportFullyDocumented(exp: SpecExport7, doccov: DocCovSpec2): boolean;
468
485
  import { DocCovSpec as DocCovSpec3 } from "@doccov/spec";
469
486
  import { OpenPkg as OpenPkg3 } from "@openpkg-ts/spec";
487
+ import { ApiSurfaceResult } from "@doccov/spec";
470
488
  /**
471
489
  * Drift summary with category breakdown.
472
490
  */
@@ -572,6 +590,10 @@ interface DocCovReport {
572
590
  * Per-coverage data, keyed by ID.
573
591
  */
574
592
  exports: Record<string, ExportCoverageData>;
593
+ /**
594
+ * API surface analysis (forgotten exports).
595
+ */
596
+ apiSurface?: ApiSurfaceResult;
575
597
  }
576
598
  /**
577
599
  * Generate a DocCov report from an OpenPkg spec.
@@ -666,4 +688,4 @@ interface SchemaDetectionResult {
666
688
  noCompiledJsWarning?: boolean;
667
689
  }
668
690
  declare function detectRuntimeSchemas(context: SchemaDetectionContext): Promise<SchemaDetectionResult>;
669
- export { saveSnapshot, saveReport, renderSparkline, renderApiSurface, pruneHistory, pruneByTier, parseAssertions, loadSnapshotsForDays, loadSnapshots, loadCachedReport, isExportFullyDocumented, isCachedReportValid, hasNonAssertionComments, groupDriftsByCategory, getTrend, getExtendedTrend, getExportScore, getExportMissing, getExportDrift, getExportAnalysis, getDriftSummary, generateWeeklySummaries, generateReportFromDocCov, generateReport, formatDriftSummaryLine, formatDelta, ensureSpecCoverage, detectRuntimeSchemas, detectExampleRuntimeErrors, detectExampleAssertionFailures, computeSnapshot, computeExportDrift, computeDrift, categorizeDrift, calculateAggregateCoverage, buildExportRegistry, buildDocCovSpec, WeeklySummary, SchemaDetectionResult, SchemaDetectionContext, RetentionTier, RETENTION_DAYS, OpenPkgSpec, HISTORY_DIR, ExtendedTrendAnalysis, ExportDriftResult, DriftSummary, DriftResult, DetectedSchemaEntry, CoverageTrend, CoverageSnapshot, CategorizedDrift, BuildDocCovOptions };
691
+ export { saveSnapshot, saveReport, renderSparkline, renderApiSurface, pruneHistory, pruneByTier, parseAssertions, loadSnapshotsForDays, loadSnapshots, loadCachedReport, isExportFullyDocumented, isCachedReportValid, hasNonAssertionComments, groupDriftsByCategory, getTrend, getExtendedTrend, getExportScore, getExportMissing, getExportDrift, getExportAnalysis, getDriftSummary, generateWeeklySummaries, generateReportFromDocCov, generateReport, formatDriftSummaryLine, formatDelta, ensureSpecCoverage, detectRuntimeSchemas, detectExampleRuntimeErrors, detectExampleAssertionFailures, computeSnapshot, computeExportDrift, computeDrift, categorizeDrift, calculateAggregateCoverage, buildExportRegistry, buildDocCovSpec, WeeklySummary, SchemaDetectionResult, SchemaDetectionContext, RetentionTier, RETENTION_DAYS, OpenPkgSpec, HISTORY_DIR, ExtractForgottenExport, ExtendedTrendAnalysis, ExportDriftResult, DriftSummary, DriftResult, DetectedSchemaEntry, CoverageTrend, CoverageSnapshot, CategorizedDrift, BuildDocCovOptions };
@@ -38,7 +38,7 @@ import {
38
38
  renderSparkline,
39
39
  saveReport,
40
40
  saveSnapshot
41
- } from "../shared/chunk-cbe8089a.js";
41
+ } from "../shared/chunk-yqqqk8by.js";
42
42
  import"../shared/chunk-esptwrfq.js";
43
43
  export {
44
44
  saveSnapshot,
package/dist/index.d.ts CHANGED
@@ -1,10 +1,27 @@
1
- import { DocCovSpec } from "@doccov/spec";
1
+ import { DocCovSpec, TypeReferenceLocation } from "@doccov/spec";
2
2
  import { OpenPkg } from "@openpkg-ts/spec";
3
3
  type OpenPkgSpec = OpenPkg;
4
+ /** Forgotten from extract package (different shape than spec type) */
5
+ interface ExtractForgottenExport {
6
+ name: string;
7
+ definedIn?: string;
8
+ referencedBy: Array<{
9
+ typeName: string;
10
+ exportName: string;
11
+ location: TypeReferenceLocation;
12
+ path?: string;
13
+ }>;
14
+ isExternal: boolean;
15
+ fix?: string;
16
+ }
4
17
  interface BuildDocCovOptions {
5
18
  openpkgPath: string;
6
19
  openpkg: OpenPkgSpec;
7
20
  packagePath?: string;
21
+ /** Forgotten exports from extraction (for API surface calculation) */
22
+ forgottenExports?: ExtractForgottenExport[];
23
+ /** Type names to ignore in API surface calculation */
24
+ apiSurfaceIgnore?: string[];
8
25
  }
9
26
  /**
10
27
  * Build a DocCov spec from an OpenPkg spec.
@@ -328,6 +345,7 @@ declare function getExportMissing(exp: SpecExport7, doccov: DocCovSpec2): Missin
328
345
  declare function isExportFullyDocumented(exp: SpecExport7, doccov: DocCovSpec2): boolean;
329
346
  import { DocCovSpec as DocCovSpec3 } from "@doccov/spec";
330
347
  import { OpenPkg as OpenPkg2 } from "@openpkg-ts/spec";
348
+ import { ApiSurfaceResult } from "@doccov/spec";
331
349
  /**
332
350
  * DocCov report schema version.
333
351
  */
@@ -503,6 +521,10 @@ interface DocCovReport {
503
521
  * Per-coverage data, keyed by ID.
504
522
  */
505
523
  exports: Record<string, ExportCoverageData>;
524
+ /**
525
+ * API surface analysis (forgotten exports).
526
+ */
527
+ apiSurface?: ApiSurfaceResult;
506
528
  }
507
529
  /**
508
530
  * Generate a DocCov report from an OpenPkg spec.
@@ -748,6 +770,17 @@ type ExampleValidationMode = "presence" | "typecheck" | "run";
748
770
  */
749
771
  type SchemaExtractionMode = "static" | "runtime" | "hybrid";
750
772
  /**
773
+ * API surface configuration options.
774
+ */
775
+ interface ApiSurfaceConfig {
776
+ /** Minimum completeness percentage to pass (0-100) */
777
+ minCompleteness?: number;
778
+ /** Warning threshold - warn when below this (0-100) */
779
+ warnBelow?: number;
780
+ /** Type names to ignore (won't be flagged as forgotten exports) */
781
+ ignore?: string[];
782
+ }
783
+ /**
751
784
  * Check command configuration options.
752
785
  */
753
786
  interface CheckConfig {
@@ -763,6 +796,10 @@ interface CheckConfig {
763
796
  minCoverage?: number;
764
797
  /** Maximum drift percentage allowed (0-100) */
765
798
  maxDrift?: number;
799
+ /** Minimum API surface completeness percentage (0-100) - deprecated, use apiSurface.minCompleteness */
800
+ minApiSurface?: number;
801
+ /** API surface configuration */
802
+ apiSurface?: ApiSurfaceConfig;
766
803
  }
767
804
  /**
768
805
  * Normalized DocCov configuration.
@@ -849,6 +886,20 @@ interface AnalysisResult {
849
886
  fromCache?: boolean;
850
887
  /** Cache validation details (if cache was checked) */
851
888
  cacheStatus?: CacheValidationResult;
889
+ /** Forgotten exports (types referenced but not exported) */
890
+ forgottenExports?: ForgottenExportResult[];
891
+ }
892
+ interface ForgottenExportResult {
893
+ name: string;
894
+ definedIn?: string;
895
+ referencedBy: Array<{
896
+ typeName: string;
897
+ exportName: string;
898
+ location: "return" | "parameter" | "property" | "extends" | "type-parameter";
899
+ path?: string;
900
+ }>;
901
+ isExternal: boolean;
902
+ fix?: string;
852
903
  }
853
904
  interface AnalysisMetadata {
854
905
  baseDir: string;
@@ -1510,6 +1561,55 @@ declare function categorizeDrifts(drifts: SpecDocDrift[]): {
1510
1561
  fixable: SpecDocDrift[];
1511
1562
  nonFixable: SpecDocDrift[];
1512
1563
  };
1564
+ import { ApiSurfaceResult as ApiSurfaceResult2 } from "@doccov/spec";
1565
+ /** Fix for a forgotten */
1566
+ interface ForgottenExportFix {
1567
+ type: "forgotten-export";
1568
+ typeName: string;
1569
+ targetFile: string;
1570
+ exportStatement: string;
1571
+ insertPosition: "append" | {
1572
+ afterLine: number;
1573
+ };
1574
+ }
1575
+ /** Result of applying forgotten fixes */
1576
+ interface ApplyForgottenExportResult {
1577
+ filesModified: number;
1578
+ fixesApplied: number;
1579
+ errors: Array<{
1580
+ file: string;
1581
+ error: string;
1582
+ }>;
1583
+ }
1584
+ /** Options for generating fixes */
1585
+ interface GenerateForgottenExportFixesOptions {
1586
+ /** Base directory for resolving paths */
1587
+ baseDir: string;
1588
+ /** Entry file for the package */
1589
+ entryFile: string;
1590
+ }
1591
+ /**
1592
+ * Generate fixes for forgotten exports.
1593
+ * Groups fixes by target file and generates minimal statements.
1594
+ */
1595
+ declare function generateForgottenExportFixes(apiSurface: ApiSurfaceResult2, options: GenerateForgottenExportFixesOptions): ForgottenExportFix[];
1596
+ /**
1597
+ * Group fixes by target file for efficient application.
1598
+ */
1599
+ declare function groupFixesByFile(fixes: ForgottenExportFix[]): Map<string, ForgottenExportFix[]>;
1600
+ /**
1601
+ * Apply forgotten fixes to files.
1602
+ * Reads files, finds best insertion points, and applies edits.
1603
+ */
1604
+ declare function applyForgottenExportFixes(fixes: ForgottenExportFix[]): Promise<ApplyForgottenExportResult>;
1605
+ /**
1606
+ * Preview forgotten fixes without applying them.
1607
+ * Returns a map of file paths to the changes that would be made.
1608
+ */
1609
+ declare function previewForgottenExportFixes(fixes: ForgottenExportFix[]): Map<string, {
1610
+ insertLine: number;
1611
+ statements: string[];
1612
+ }>;
1513
1613
  import { SpecDiff } from "@openpkg-ts/spec";
1514
1614
  type MemberChangeType = "added" | "removed" | "signature-changed";
1515
1615
  interface MemberChange {
@@ -2515,7 +2615,7 @@ interface SpecSummary {
2515
2615
  * ```
2516
2616
  */
2517
2617
  declare function extractSpecSummary(openpkg: OpenPkg8, doccov: DocCovSpec4): SpecSummary;
2518
- import { OpenPkg as OpenPkg_kdpxrtnzlr } from "@openpkg-ts/spec";
2618
+ import { OpenPkg as OpenPkg_ikpscozpjh } from "@openpkg-ts/spec";
2519
2619
  /**
2520
2620
  * Build Plan types for AI-powered repository scanning.
2521
2621
  */
@@ -2612,7 +2712,7 @@ interface BuildPlanExecutionResult {
2612
2712
  /** Whether all required steps succeeded */
2613
2713
  success: boolean;
2614
2714
  /** Generated OpenPkg spec (if successful) */
2615
- spec?: OpenPkg_kdpxrtnzlr;
2715
+ spec?: OpenPkg_ikpscozpjh;
2616
2716
  /** Results for each step */
2617
2717
  stepResults: BuildPlanStepResult[];
2618
2718
  /** Total execution time in milliseconds */
@@ -2620,4 +2720,4 @@ interface BuildPlanExecutionResult {
2620
2720
  /** Overall error message if failed */
2621
2721
  error?: string;
2622
2722
  }
2623
- export { validateSpecCache, validateExamples, typecheckExamples, typecheckExample, shouldValidate, serializeJSDoc, saveSpecCache, saveSnapshot, saveReport, safeParseJson, runExamplesWithPackage, runExamples, runExample, resolveTarget, resolveCompiledPath, renderSparkline, renderApiSurface, readPackageJson, pruneHistory, pruneByTier, parseGitHubUrl2 as parseScanGitHubUrl, parseMarkdownFiles, parseMarkdownFile, parseListFlag, parseJSDocToPatch, parseGitHubUrl, parseExamplesFlag, parseAssertions, mergeFixes, mergeFilters, loadSpecCache, loadSnapshots, loadCachedReport, listWorkspacePackages, isStandardJSONSchema, isSchemaType, isFixableDrift, isExportFullyDocumented, isExecutableLang, installDependencies, hashString, hashFiles, hashFile, hasNonAssertionComments, hasDocsImpact, hasDocsForExport, groupDriftsByCategory, getUndocumentedExports, getTrend, getSupportedLibraries, getSpecCachePath, getRunCommand, getReportPath, getRegisteredAdapters, getPrimaryBuildScript, getInstallCommand, getExtendedTrend, getExportScore, getExportMissing, getExportDrift, getExportAnalysis, getDriftSummary, getDocumentedExports, getDocsImpactSummary, getDiffReportPath, generateReportFromDocCov, generateReport, generateFixesForExport, generateFix, formatPackageList, formatDriftSummaryLine, formatDelta, findRemovedReferences, findPackageByName, findJSDocLocation, findExportReferences, findDeprecatedReferences, findAdapter, fetchSpecFromGitHub, fetchSpec, fetchGitHubContext, extractStandardSchemasFromProject, extractStandardSchemas, extractSpecSummary, extractSchemaType, extractSchemaOutputType, extractPackageSpec, extractImports, extractFunctionCalls, ensureSpecCoverage, diffSpecWithDocs, diffHashes, detectRuntimeSchemas, detectPackageManager, detectMonorepo, detectExampleRuntimeErrors, detectExampleAssertionFailures, detectEntryPoint, detectBuildInfo, defineConfig, createSourceFile, createNodeCommandRunner, computeSnapshot, computeExportDrift, computeDrift, clearSpecCache, categorizeDrifts, categorizeDrift, calculateAggregateCoverage, buildRawUrl, buildExportRegistry, buildDocCovSpec, buildDisplayUrl, buildCloneUrl, blockReferencesExport, applyPatchToJSDoc, applyEdits, analyzeProject2 as analyzeProject, analyzeFile, analyzeDocsImpact, analyze, WorkspacePackage, WorkspaceConfig, VALIDATION_INFO, TypecheckValidationResult, TypecheckResult, TypecheckOptions, SummaryDriftIssue, StandardSchemaExtractionResult, StandardSchemaExtractionOutput, StandardJSONSchemaV1, SpecSummary, SpecDocDrift, SpecDiffWithDocs, SpecCacheConfig, SpecCache, SchemaExtractionResult, SchemaExtractionMode, SchemaDetectionResult, SchemaDetectionContext, SchemaAdapter, SandboxFileSystem, SPEC_CACHE_FILE, RuntimeDrift, RunValidationResult, RunExamplesWithPackageResult, RunExamplesWithPackageOptions, RunExampleOptions, RetentionTier, ResolvedTarget, ResolvedFilters, ResolveTargetOptions, ReleaseTag, RETENTION_DAYS, REPORT_VERSION, REPORT_EXTENSIONS, ProjectInfo, PresenceResult, ParsedGitHubUrl, PackageManagerInfo, PackageManager, PackageJson, PackageExports, OpenPkgSpec, NodeFileSystem, MonorepoType, MonorepoInfo, MemberChange, MarkdownDocFile, MarkdownCodeBlock, LLMAssertion, JSDocTag, JSDocReturn, JSDocPatch, JSDocParam, JSDocEdit, InstallResult, InstallOptions, HISTORY_DIR, GitHubRepoMetadata, GitHubProjectContext, FixType, FixSuggestion, FilterSource, FilterOptions, FileSystem, FetchGitHubContextOptions, ExtractStandardSchemasOptions, ExtendedTrendAnalysis, ExportReference, ExportDriftResult, ExportCoverageData, ExampleValidationTypeError, ExampleValidationResult, ExampleValidationOptions, ExampleValidationMode, ExampleValidation, ExampleTypeError, ExampleRunResult, EntryPointSource, EntryPointInfo, DriftType, DriftSummary, DriftResult, DriftReportSummary, DriftReport, DriftCategory, DocsImpactResult, DocsImpactReference, DocsImpact, DocsConfig, DocsChangeType, DocCovReport, DocCovOptions, DocCovConfig, DocCov, DiffWithDocsOptions, Diagnostic, DetectedSchemaEntry, DetectedPackageManager, DRIFT_CATEGORY_LABELS, DRIFT_CATEGORY_DESCRIPTIONS, DRIFT_CATEGORIES, DEFAULT_REPORT_PATH, DEFAULT_REPORT_DIR, CoverageTrend, CoverageSummary, CoverageSnapshot, CommandRunner, CommandResult, CheckConfig, CategorizedDrift, CacheValidationResult, CacheContext, CACHE_VERSION, BuildPlanTarget, BuildPlanStepResult, BuildPlanStep, BuildPlanExecutionResult, BuildPlanEnvironment, BuildPlan, BuildInfo, BuildHints, BuildDocCovOptions, ApplyEditsResult, AnalyzeProjectOptions, AnalyzeOptions, AnalysisResult, ALL_VALIDATIONS };
2723
+ export { validateSpecCache, validateExamples, typecheckExamples, typecheckExample, shouldValidate, serializeJSDoc, saveSpecCache, saveSnapshot, saveReport, safeParseJson, runExamplesWithPackage, runExamples, runExample, resolveTarget, resolveCompiledPath, renderSparkline, renderApiSurface, readPackageJson, pruneHistory, pruneByTier, previewForgottenExportFixes, parseGitHubUrl2 as parseScanGitHubUrl, parseMarkdownFiles, parseMarkdownFile, parseListFlag, parseJSDocToPatch, parseGitHubUrl, parseExamplesFlag, parseAssertions, mergeFixes, mergeFilters, loadSpecCache, loadSnapshots, loadCachedReport, listWorkspacePackages, isStandardJSONSchema, isSchemaType, isFixableDrift, isExportFullyDocumented, isExecutableLang, installDependencies, hashString, hashFiles, hashFile, hasNonAssertionComments, hasDocsImpact, hasDocsForExport, groupFixesByFile, groupDriftsByCategory, getUndocumentedExports, getTrend, getSupportedLibraries, getSpecCachePath, getRunCommand, getReportPath, getRegisteredAdapters, getPrimaryBuildScript, getInstallCommand, getExtendedTrend, getExportScore, getExportMissing, getExportDrift, getExportAnalysis, getDriftSummary, getDocumentedExports, getDocsImpactSummary, getDiffReportPath, generateReportFromDocCov, generateReport, generateForgottenExportFixes, generateFixesForExport, generateFix, formatPackageList, formatDriftSummaryLine, formatDelta, findRemovedReferences, findPackageByName, findJSDocLocation, findExportReferences, findDeprecatedReferences, findAdapter, fetchSpecFromGitHub, fetchSpec, fetchGitHubContext, extractStandardSchemasFromProject, extractStandardSchemas, extractSpecSummary, extractSchemaType, extractSchemaOutputType, extractPackageSpec, extractImports, extractFunctionCalls, ensureSpecCoverage, diffSpecWithDocs, diffHashes, detectRuntimeSchemas, detectPackageManager, detectMonorepo, detectExampleRuntimeErrors, detectExampleAssertionFailures, detectEntryPoint, detectBuildInfo, defineConfig, createSourceFile, createNodeCommandRunner, computeSnapshot, computeExportDrift, computeDrift, clearSpecCache, categorizeDrifts, categorizeDrift, calculateAggregateCoverage, buildRawUrl, buildExportRegistry, buildDocCovSpec, buildDisplayUrl, buildCloneUrl, blockReferencesExport, applyPatchToJSDoc, applyForgottenExportFixes, applyEdits, analyzeProject2 as analyzeProject, analyzeFile, analyzeDocsImpact, analyze, WorkspacePackage, WorkspaceConfig, VALIDATION_INFO, TypecheckValidationResult, TypecheckResult, TypecheckOptions, SummaryDriftIssue, StandardSchemaExtractionResult, StandardSchemaExtractionOutput, StandardJSONSchemaV1, SpecSummary, SpecDocDrift, SpecDiffWithDocs, SpecCacheConfig, SpecCache, SchemaExtractionResult, SchemaExtractionMode, SchemaDetectionResult, SchemaDetectionContext, SchemaAdapter, SandboxFileSystem, SPEC_CACHE_FILE, RuntimeDrift, RunValidationResult, RunExamplesWithPackageResult, RunExamplesWithPackageOptions, RunExampleOptions, RetentionTier, ResolvedTarget, ResolvedFilters, ResolveTargetOptions, ReleaseTag, RETENTION_DAYS, REPORT_VERSION, REPORT_EXTENSIONS, ProjectInfo, PresenceResult, ParsedGitHubUrl, PackageManagerInfo, PackageManager, PackageJson, PackageExports, OpenPkgSpec, NodeFileSystem, MonorepoType, MonorepoInfo, MemberChange, MarkdownDocFile, MarkdownCodeBlock, LLMAssertion, JSDocTag, JSDocReturn, JSDocPatch, JSDocParam, JSDocEdit, InstallResult, InstallOptions, HISTORY_DIR, GitHubRepoMetadata, GitHubProjectContext, GenerateForgottenExportFixesOptions, ForgottenExportResult, ForgottenExportFix, FixType, FixSuggestion, FilterSource, FilterOptions, FileSystem, FetchGitHubContextOptions, ExtractStandardSchemasOptions, ExtendedTrendAnalysis, ExportReference, ExportDriftResult, ExportCoverageData, ExampleValidationTypeError, ExampleValidationResult, ExampleValidationOptions, ExampleValidationMode, ExampleValidation, ExampleTypeError, ExampleRunResult, EntryPointSource, EntryPointInfo, DriftType, DriftSummary, DriftResult, DriftReportSummary, DriftReport, DriftCategory, DocsImpactResult, DocsImpactReference, DocsImpact, DocsConfig, DocsChangeType, DocCovReport, DocCovOptions, DocCovConfig, DocCov, DiffWithDocsOptions, Diagnostic, DetectedSchemaEntry, DetectedPackageManager, DRIFT_CATEGORY_LABELS, DRIFT_CATEGORY_DESCRIPTIONS, DRIFT_CATEGORIES, DEFAULT_REPORT_PATH, DEFAULT_REPORT_DIR, CoverageTrend, CoverageSummary, CoverageSnapshot, CommandRunner, CommandResult, CheckConfig, CategorizedDrift, CacheValidationResult, CacheContext, CACHE_VERSION, BuildPlanTarget, BuildPlanStepResult, BuildPlanStep, BuildPlanExecutionResult, BuildPlanEnvironment, BuildPlan, BuildInfo, BuildHints, BuildDocCovOptions, ApplyForgottenExportResult, ApplyEditsResult, AnalyzeProjectOptions, AnalyzeOptions, AnalysisResult, ALL_VALIDATIONS };
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  HISTORY_DIR,
6
6
  RETENTION_DAYS,
7
7
  applyEdits,
8
+ applyForgottenExportFixes,
8
9
  applyPatchToJSDoc,
9
10
  buildDocCovSpec,
10
11
  buildExportRegistry,
@@ -26,6 +27,7 @@ import {
26
27
  formatDriftSummaryLine,
27
28
  generateFix,
28
29
  generateFixesForExport,
30
+ generateForgottenExportFixes,
29
31
  generateReport,
30
32
  generateReportFromDocCov,
31
33
  getDriftSummary,
@@ -36,6 +38,7 @@ import {
36
38
  getExtendedTrend,
37
39
  getTrend,
38
40
  groupDriftsByCategory,
41
+ groupFixesByFile,
39
42
  hasNonAssertionComments,
40
43
  isBuiltInIdentifier,
41
44
  isExportFullyDocumented,
@@ -46,6 +49,7 @@ import {
46
49
  mergeFixes,
47
50
  parseAssertions,
48
51
  parseJSDocToPatch,
52
+ previewForgottenExportFixes,
49
53
  pruneByTier,
50
54
  pruneHistory,
51
55
  renderApiSurface,
@@ -55,7 +59,7 @@ import {
55
59
  saveSnapshot,
56
60
  serializeJSDoc,
57
61
  ts
58
- } from "./shared/chunk-cbe8089a.js";
62
+ } from "./shared/chunk-yqqqk8by.js";
59
63
  import {
60
64
  mergeFilters,
61
65
  parseListFlag
@@ -290,7 +294,8 @@ async function runAnalysis(input) {
290
294
  sourceFiles
291
295
  },
292
296
  diagnostics,
293
- specDiagnostics
297
+ specDiagnostics,
298
+ forgottenExports: extractResult.forgottenExports
294
299
  };
295
300
  }
296
301
 
@@ -868,7 +873,8 @@ class DocCov {
868
873
  ...analysis.specDiagnostics,
869
874
  ...filterOutcome.diagnostics
870
875
  ],
871
- metadata: this.normalizeMetadata(analysis.metadata)
876
+ metadata: this.normalizeMetadata(analysis.metadata),
877
+ forgottenExports: analysis.forgottenExports
872
878
  };
873
879
  }
874
880
  async analyzeFileWithDiagnostics(filePath, analyzeOptions = {}) {
@@ -907,7 +913,8 @@ class DocCov {
907
913
  ...filterOutcome.diagnostics
908
914
  ],
909
915
  metadata,
910
- fromCache: false
916
+ fromCache: false,
917
+ forgottenExports: analysis.forgottenExports
911
918
  };
912
919
  if (useCache) {
913
920
  this.saveToCache(result, resolvedPath, analysis.metadata);
@@ -3575,6 +3582,7 @@ export {
3575
3582
  readPackageJson,
3576
3583
  pruneHistory,
3577
3584
  pruneByTier,
3585
+ previewForgottenExportFixes,
3578
3586
  parseGitHubUrl2 as parseScanGitHubUrl,
3579
3587
  parseMarkdownFiles,
3580
3588
  parseMarkdownFile,
@@ -3601,6 +3609,7 @@ export {
3601
3609
  hasNonAssertionComments,
3602
3610
  hasDocsImpact,
3603
3611
  hasDocsForExport,
3612
+ groupFixesByFile,
3604
3613
  groupDriftsByCategory,
3605
3614
  getUndocumentedExports,
3606
3615
  getTrend,
@@ -3622,6 +3631,7 @@ export {
3622
3631
  getDiffReportPath,
3623
3632
  generateReportFromDocCov,
3624
3633
  generateReport,
3634
+ generateForgottenExportFixes,
3625
3635
  generateFixesForExport,
3626
3636
  generateFix,
3627
3637
  formatPackageList,
@@ -3671,6 +3681,7 @@ export {
3671
3681
  buildCloneUrl,
3672
3682
  blockReferencesExport,
3673
3683
  applyPatchToJSDoc,
3684
+ applyForgottenExportFixes,
3674
3685
  applyEdits,
3675
3686
  analyzeProject,
3676
3687
  analyzeFile,
@@ -797,6 +797,123 @@ function createSourceFile(filePath) {
797
797
  const content = fs.readFileSync(filePath, "utf-8");
798
798
  return ts.createSourceFile(path.basename(filePath), content, ts.ScriptTarget.Latest, true, filePath.endsWith(".tsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
799
799
  }
800
+
801
+ // src/fix/forgotten-exports.ts
802
+ import * as fs2 from "node:fs";
803
+ import * as path2 from "node:path";
804
+ function generateForgottenExportFixes(apiSurface, options) {
805
+ const { baseDir, entryFile } = options;
806
+ const fixes = [];
807
+ for (const forgotten of apiSurface.forgotten) {
808
+ if (forgotten.isExternal)
809
+ continue;
810
+ if (!forgotten.fix)
811
+ continue;
812
+ const targetFile = forgotten.fix.targetFile ? path2.resolve(baseDir, forgotten.fix.targetFile) : path2.resolve(baseDir, entryFile);
813
+ fixes.push({
814
+ type: "forgotten-export",
815
+ typeName: forgotten.name,
816
+ targetFile,
817
+ exportStatement: forgotten.fix.exportStatement,
818
+ insertPosition: "append"
819
+ });
820
+ }
821
+ return fixes;
822
+ }
823
+ function groupFixesByFile(fixes) {
824
+ const grouped = new Map;
825
+ for (const fix of fixes) {
826
+ const existing = grouped.get(fix.targetFile) ?? [];
827
+ existing.push(fix);
828
+ grouped.set(fix.targetFile, existing);
829
+ }
830
+ return grouped;
831
+ }
832
+ async function applyForgottenExportFixes(fixes) {
833
+ const result = {
834
+ filesModified: 0,
835
+ fixesApplied: 0,
836
+ errors: []
837
+ };
838
+ const grouped = groupFixesByFile(fixes);
839
+ for (const [filePath, fileFixes] of grouped) {
840
+ try {
841
+ if (!fs2.existsSync(filePath)) {
842
+ result.errors.push({
843
+ file: filePath,
844
+ error: "File not found"
845
+ });
846
+ continue;
847
+ }
848
+ const content = await fs2.promises.readFile(filePath, "utf8");
849
+ const lines = content.split(`
850
+ `);
851
+ const insertLine = findBestInsertionPoint(lines, fileFixes);
852
+ const statements = fileFixes.map((f) => f.exportStatement);
853
+ const uniqueStatements = [...new Set(statements)];
854
+ const newContent = insertExportStatements(lines, insertLine, uniqueStatements);
855
+ await fs2.promises.writeFile(filePath, newContent, "utf8");
856
+ result.filesModified++;
857
+ result.fixesApplied += uniqueStatements.length;
858
+ } catch (err) {
859
+ result.errors.push({
860
+ file: filePath,
861
+ error: err instanceof Error ? err.message : String(err)
862
+ });
863
+ }
864
+ }
865
+ return result;
866
+ }
867
+ function findBestInsertionPoint(lines, _fixes) {
868
+ let lastExportLine = -1;
869
+ let lastReExportLine = -1;
870
+ for (let i = 0;i < lines.length; i++) {
871
+ const line = lines[i].trim();
872
+ if (line.match(/^export\s+(\*|\{[^}]*\})\s+from\s+['"]/)) {
873
+ lastReExportLine = i;
874
+ }
875
+ if (line.startsWith("export ")) {
876
+ lastExportLine = i;
877
+ }
878
+ }
879
+ if (lastReExportLine >= 0) {
880
+ return lastReExportLine + 1;
881
+ }
882
+ if (lastExportLine >= 0) {
883
+ return lastExportLine + 1;
884
+ }
885
+ return lines.length;
886
+ }
887
+ function insertExportStatements(lines, insertLine, statements) {
888
+ const newLines = [...lines];
889
+ const needsBlankBefore = insertLine > 0 && newLines[insertLine - 1]?.trim() !== "" && !newLines[insertLine - 1]?.trim().startsWith("export");
890
+ const insertBlock = statements.join(`
891
+ `);
892
+ if (needsBlankBefore) {
893
+ newLines.splice(insertLine, 0, "", insertBlock);
894
+ } else {
895
+ newLines.splice(insertLine, 0, insertBlock);
896
+ }
897
+ return newLines.join(`
898
+ `);
899
+ }
900
+ function previewForgottenExportFixes(fixes) {
901
+ const previews = new Map;
902
+ const grouped = groupFixesByFile(fixes);
903
+ for (const [filePath, fileFixes] of grouped) {
904
+ try {
905
+ if (!fs2.existsSync(filePath))
906
+ continue;
907
+ const content = fs2.readFileSync(filePath, "utf8");
908
+ const lines = content.split(`
909
+ `);
910
+ const insertLine = findBestInsertionPoint(lines, fileFixes);
911
+ const statements = [...new Set(fileFixes.map((f) => f.exportStatement))];
912
+ previews.set(filePath, { insertLine, statements });
913
+ } catch {}
914
+ }
915
+ return previews;
916
+ }
800
917
  // src/analysis/drift/example-drift.ts
801
918
  import ts2 from "typescript";
802
919
 
@@ -2019,7 +2136,7 @@ function computeExportDrift(entry, registry) {
2019
2136
  // src/analysis/doccov-builder.ts
2020
2137
  import { DRIFT_CATEGORIES } from "@doccov/spec";
2021
2138
  function buildDocCovSpec(options) {
2022
- const { openpkg, openpkgPath } = options;
2139
+ const { openpkg, openpkgPath, forgottenExports, apiSurfaceIgnore } = options;
2023
2140
  const registry = buildExportRegistry(openpkg);
2024
2141
  const exports = {};
2025
2142
  let totalScore = 0;
@@ -2073,6 +2190,7 @@ function buildDocCovSpec(options) {
2073
2190
  byCategory: driftByCategory
2074
2191
  }
2075
2192
  };
2193
+ const apiSurface = computeApiSurface(forgottenExports, openpkg.types?.length ?? 0, apiSurfaceIgnore);
2076
2194
  return {
2077
2195
  doccov: "1.0.0",
2078
2196
  source: {
@@ -2083,7 +2201,33 @@ function buildDocCovSpec(options) {
2083
2201
  },
2084
2202
  generatedAt: new Date().toISOString(),
2085
2203
  summary,
2086
- exports
2204
+ exports,
2205
+ ...apiSurface ? { apiSurface } : {}
2206
+ };
2207
+ }
2208
+ function computeApiSurface(forgottenExports, exportedTypesCount, ignoreList) {
2209
+ if (!forgottenExports)
2210
+ return;
2211
+ const ignoreSet = new Set(ignoreList ?? []);
2212
+ const filteredExports = forgottenExports.filter((f) => !ignoreSet.has(f.name));
2213
+ const forgotten = filteredExports.map((f) => ({
2214
+ name: f.name,
2215
+ definedIn: f.definedIn ? { file: f.definedIn } : undefined,
2216
+ referencedBy: f.referencedBy.map((r) => ({
2217
+ exportName: r.exportName,
2218
+ location: r.location
2219
+ })),
2220
+ isExternal: f.isExternal,
2221
+ fix: f.fix ? { targetFile: f.definedIn ?? "index.ts", exportStatement: f.fix } : undefined
2222
+ }));
2223
+ const forgottenCount = forgotten.length;
2224
+ const totalReferenced = exportedTypesCount + forgottenCount;
2225
+ const completeness = totalReferenced > 0 ? Math.round(exportedTypesCount / totalReferenced * 100) : 100;
2226
+ return {
2227
+ totalReferenced,
2228
+ exported: exportedTypesCount,
2229
+ forgotten,
2230
+ completeness
2087
2231
  };
2088
2232
  }
2089
2233
  function computeExportCoverage(exp) {
@@ -2285,8 +2429,8 @@ function isExportFullyDocumented(exp, doccov) {
2285
2429
  }
2286
2430
 
2287
2431
  // src/analysis/report.ts
2288
- import * as fs2 from "node:fs";
2289
- import * as path2 from "node:path";
2432
+ import * as fs3 from "node:fs";
2433
+ import * as path3 from "node:path";
2290
2434
  function generateReport(spec, openpkgPath = "openpkg.json") {
2291
2435
  const doccov = buildDocCovSpec({ openpkg: spec, openpkgPath });
2292
2436
  return generateReportFromDocCov(spec, doccov);
@@ -2339,28 +2483,29 @@ function generateReportFromDocCov(openpkg, doccov) {
2339
2483
  version: openpkg.meta.version
2340
2484
  },
2341
2485
  coverage,
2342
- exports: exportsData
2486
+ exports: exportsData,
2487
+ apiSurface: doccov.apiSurface
2343
2488
  };
2344
2489
  }
2345
2490
  function loadCachedReport(reportPath = DEFAULT_REPORT_PATH) {
2346
2491
  try {
2347
- const fullPath = path2.resolve(reportPath);
2348
- if (!fs2.existsSync(fullPath)) {
2492
+ const fullPath = path3.resolve(reportPath);
2493
+ if (!fs3.existsSync(fullPath)) {
2349
2494
  return null;
2350
2495
  }
2351
- const content = fs2.readFileSync(fullPath, "utf-8");
2496
+ const content = fs3.readFileSync(fullPath, "utf-8");
2352
2497
  return JSON.parse(content);
2353
2498
  } catch {
2354
2499
  return null;
2355
2500
  }
2356
2501
  }
2357
2502
  function saveReport(report, reportPath = DEFAULT_REPORT_PATH) {
2358
- const fullPath = path2.resolve(reportPath);
2359
- const dir = path2.dirname(fullPath);
2360
- if (!fs2.existsSync(dir)) {
2361
- fs2.mkdirSync(dir, { recursive: true });
2503
+ const fullPath = path3.resolve(reportPath);
2504
+ const dir = path3.dirname(fullPath);
2505
+ if (!fs3.existsSync(dir)) {
2506
+ fs3.mkdirSync(dir, { recursive: true });
2362
2507
  }
2363
- fs2.writeFileSync(fullPath, JSON.stringify(report, null, 2));
2508
+ fs3.writeFileSync(fullPath, JSON.stringify(report, null, 2));
2364
2509
  }
2365
2510
  function isCachedReportValid(reportPath = DEFAULT_REPORT_PATH, sourceFiles = []) {
2366
2511
  const report = loadCachedReport(reportPath);
@@ -2370,7 +2515,7 @@ function isCachedReportValid(reportPath = DEFAULT_REPORT_PATH, sourceFiles = [])
2370
2515
  const reportTime = new Date(report.generatedAt).getTime();
2371
2516
  for (const file of sourceFiles) {
2372
2517
  try {
2373
- const stat = fs2.statSync(file);
2518
+ const stat = fs3.statSync(file);
2374
2519
  if (stat.mtimeMs > reportTime) {
2375
2520
  return false;
2376
2521
  }
@@ -2559,8 +2704,8 @@ function renderApiSurface(spec) {
2559
2704
 
2560
2705
  // src/extract/schema/standard-schema.ts
2561
2706
  import { spawn } from "node:child_process";
2562
- import * as fs3 from "node:fs";
2563
- import * as path3 from "node:path";
2707
+ import * as fs4 from "node:fs";
2708
+ import * as path4 from "node:path";
2564
2709
  function isStandardJSONSchema(obj) {
2565
2710
  if (typeof obj !== "object" || obj === null)
2566
2711
  return false;
@@ -2667,16 +2812,16 @@ async function extract() {
2667
2812
  extract();
2668
2813
  `;
2669
2814
  function resolveCompiledPath(tsPath, baseDir) {
2670
- const relativePath = path3.relative(baseDir, tsPath);
2815
+ const relativePath = path4.relative(baseDir, tsPath);
2671
2816
  const withoutExt = relativePath.replace(/\.tsx?$/, "");
2672
2817
  const candidates = [
2673
- path3.join(baseDir, `${withoutExt}.js`),
2674
- path3.join(baseDir, "dist", `${withoutExt.replace(/^src\//, "")}.js`),
2675
- path3.join(baseDir, "build", `${withoutExt.replace(/^src\//, "")}.js`),
2676
- path3.join(baseDir, "lib", `${withoutExt.replace(/^src\//, "")}.js`)
2818
+ path4.join(baseDir, `${withoutExt}.js`),
2819
+ path4.join(baseDir, "dist", `${withoutExt.replace(/^src\//, "")}.js`),
2820
+ path4.join(baseDir, "build", `${withoutExt.replace(/^src\//, "")}.js`),
2821
+ path4.join(baseDir, "lib", `${withoutExt.replace(/^src\//, "")}.js`)
2677
2822
  ];
2678
2823
  for (const candidate of candidates) {
2679
- if (fs3.existsSync(candidate)) {
2824
+ if (fs4.existsSync(candidate)) {
2680
2825
  return candidate;
2681
2826
  }
2682
2827
  }
@@ -2688,11 +2833,11 @@ async function extractStandardSchemas(compiledJsPath, options = {}) {
2688
2833
  schemas: new Map,
2689
2834
  errors: []
2690
2835
  };
2691
- if (!fs3.existsSync(compiledJsPath)) {
2836
+ if (!fs4.existsSync(compiledJsPath)) {
2692
2837
  result.errors.push(`Compiled JS not found: ${compiledJsPath}`);
2693
2838
  return result;
2694
2839
  }
2695
- return new Promise((resolve2) => {
2840
+ return new Promise((resolve3) => {
2696
2841
  const child = spawn("node", ["-e", WORKER_SCRIPT, compiledJsPath, target], {
2697
2842
  timeout,
2698
2843
  stdio: ["ignore", "pipe", "pipe"]
@@ -2708,14 +2853,14 @@ async function extractStandardSchemas(compiledJsPath, options = {}) {
2708
2853
  child.on("close", (code) => {
2709
2854
  if (code !== 0) {
2710
2855
  result.errors.push(`Extraction process failed: ${stderr || `exit code ${code}`}`);
2711
- resolve2(result);
2856
+ resolve3(result);
2712
2857
  return;
2713
2858
  }
2714
2859
  try {
2715
2860
  const parsed = JSON.parse(stdout);
2716
2861
  if (!parsed.success) {
2717
2862
  result.errors.push(`Extraction failed: ${parsed.error}`);
2718
- resolve2(result);
2863
+ resolve3(result);
2719
2864
  return;
2720
2865
  }
2721
2866
  for (const item of parsed.results) {
@@ -2729,11 +2874,11 @@ async function extractStandardSchemas(compiledJsPath, options = {}) {
2729
2874
  } catch (e) {
2730
2875
  result.errors.push(`Failed to parse extraction output: ${e}`);
2731
2876
  }
2732
- resolve2(result);
2877
+ resolve3(result);
2733
2878
  });
2734
2879
  child.on("error", (err) => {
2735
2880
  result.errors.push(`Subprocess error: ${err.message}`);
2736
- resolve2(result);
2881
+ resolve3(result);
2737
2882
  });
2738
2883
  });
2739
2884
  }
@@ -2774,8 +2919,8 @@ async function detectRuntimeSchemas(context) {
2774
2919
  }
2775
2920
 
2776
2921
  // src/analysis/history.ts
2777
- import * as fs4 from "node:fs";
2778
- import * as path4 from "node:path";
2922
+ import * as fs5 from "node:fs";
2923
+ import * as path5 from "node:path";
2779
2924
  var HISTORY_DIR = ".doccov/history";
2780
2925
  var RETENTION_DAYS = {
2781
2926
  free: 7,
@@ -2813,24 +2958,24 @@ function computeSnapshot(spec, options) {
2813
2958
  };
2814
2959
  }
2815
2960
  function saveSnapshot(snapshot, cwd) {
2816
- const historyDir = path4.resolve(cwd, HISTORY_DIR);
2817
- if (!fs4.existsSync(historyDir)) {
2818
- fs4.mkdirSync(historyDir, { recursive: true });
2961
+ const historyDir = path5.resolve(cwd, HISTORY_DIR);
2962
+ if (!fs5.existsSync(historyDir)) {
2963
+ fs5.mkdirSync(historyDir, { recursive: true });
2819
2964
  }
2820
2965
  const filename = getSnapshotFilename(new Date(snapshot.timestamp));
2821
- const filepath = path4.join(historyDir, filename);
2822
- fs4.writeFileSync(filepath, JSON.stringify(snapshot, null, 2));
2966
+ const filepath = path5.join(historyDir, filename);
2967
+ fs5.writeFileSync(filepath, JSON.stringify(snapshot, null, 2));
2823
2968
  }
2824
2969
  function loadSnapshots(cwd) {
2825
- const historyDir = path4.resolve(cwd, HISTORY_DIR);
2826
- if (!fs4.existsSync(historyDir)) {
2970
+ const historyDir = path5.resolve(cwd, HISTORY_DIR);
2971
+ if (!fs5.existsSync(historyDir)) {
2827
2972
  return [];
2828
2973
  }
2829
- const files = fs4.readdirSync(historyDir).filter((f) => f.endsWith(".json")).sort().reverse();
2974
+ const files = fs5.readdirSync(historyDir).filter((f) => f.endsWith(".json")).sort().reverse();
2830
2975
  const snapshots = [];
2831
2976
  for (const file of files) {
2832
2977
  try {
2833
- const content = fs4.readFileSync(path4.join(historyDir, file), "utf-8");
2978
+ const content = fs5.readFileSync(path5.join(historyDir, file), "utf-8");
2834
2979
  snapshots.push(JSON.parse(content));
2835
2980
  } catch {}
2836
2981
  }
@@ -2870,15 +3015,15 @@ function formatDelta(delta) {
2870
3015
  return "→0%";
2871
3016
  }
2872
3017
  function pruneHistory(cwd, keepCount = 100) {
2873
- const historyDir = path4.resolve(cwd, HISTORY_DIR);
2874
- if (!fs4.existsSync(historyDir)) {
3018
+ const historyDir = path5.resolve(cwd, HISTORY_DIR);
3019
+ if (!fs5.existsSync(historyDir)) {
2875
3020
  return 0;
2876
3021
  }
2877
- const files = fs4.readdirSync(historyDir).filter((f) => f.endsWith(".json")).sort().reverse();
3022
+ const files = fs5.readdirSync(historyDir).filter((f) => f.endsWith(".json")).sort().reverse();
2878
3023
  const toDelete = files.slice(keepCount);
2879
3024
  for (const file of toDelete) {
2880
3025
  try {
2881
- fs4.unlinkSync(path4.join(historyDir, file));
3026
+ fs5.unlinkSync(path5.join(historyDir, file));
2882
3027
  } catch {}
2883
3028
  }
2884
3029
  return toDelete.length;
@@ -2887,20 +3032,20 @@ function pruneByTier(cwd, tier) {
2887
3032
  const retentionDays = RETENTION_DAYS[tier];
2888
3033
  const cutoffDate = new Date;
2889
3034
  cutoffDate.setDate(cutoffDate.getDate() - retentionDays);
2890
- const historyDir = path4.resolve(cwd, HISTORY_DIR);
2891
- if (!fs4.existsSync(historyDir)) {
3035
+ const historyDir = path5.resolve(cwd, HISTORY_DIR);
3036
+ if (!fs5.existsSync(historyDir)) {
2892
3037
  return 0;
2893
3038
  }
2894
- const files = fs4.readdirSync(historyDir).filter((f) => f.endsWith(".json"));
3039
+ const files = fs5.readdirSync(historyDir).filter((f) => f.endsWith(".json"));
2895
3040
  let deleted = 0;
2896
3041
  for (const file of files) {
2897
3042
  try {
2898
- const filepath = path4.join(historyDir, file);
2899
- const content = fs4.readFileSync(filepath, "utf-8");
3043
+ const filepath = path5.join(historyDir, file);
3044
+ const content = fs5.readFileSync(filepath, "utf-8");
2900
3045
  const snapshot = JSON.parse(content);
2901
3046
  const snapshotDate = new Date(snapshot.timestamp);
2902
3047
  if (snapshotDate < cutoffDate) {
2903
- fs4.unlinkSync(filepath);
3048
+ fs5.unlinkSync(filepath);
2904
3049
  deleted++;
2905
3050
  }
2906
3051
  } catch {}
@@ -3000,4 +3145,4 @@ function getExtendedTrend(spec, cwd, options) {
3000
3145
  };
3001
3146
  }
3002
3147
 
3003
- export { isFixableDrift, generateFix, generateFixesForExport, mergeFixes, categorizeDrifts, ts, parseJSDocToPatch, applyPatchToJSDoc, serializeJSDoc, findJSDocLocation, applyEdits, createSourceFile, isBuiltInIdentifier, detectExampleRuntimeErrors, parseAssertions, hasNonAssertionComments, detectExampleAssertionFailures, buildExportRegistry, computeDrift, computeExportDrift, buildDocCovSpec, DRIFT_CATEGORIES2 as DRIFT_CATEGORIES, DRIFT_CATEGORY_LABELS, DRIFT_CATEGORY_DESCRIPTIONS, categorizeDrift, groupDriftsByCategory, getDriftSummary, formatDriftSummaryLine, calculateAggregateCoverage, ensureSpecCoverage, getExportAnalysis, getExportScore, getExportDrift, getExportMissing, isExportFullyDocumented, generateReport, generateReportFromDocCov, loadCachedReport, saveReport, isCachedReportValid, renderApiSurface, isStandardJSONSchema, resolveCompiledPath, extractStandardSchemas, extractStandardSchemasFromProject, detectRuntimeSchemas, HISTORY_DIR, RETENTION_DAYS, computeSnapshot, saveSnapshot, loadSnapshots, getTrend, renderSparkline, formatDelta, pruneHistory, pruneByTier, loadSnapshotsForDays, generateWeeklySummaries, getExtendedTrend };
3148
+ export { isFixableDrift, generateFix, generateFixesForExport, mergeFixes, categorizeDrifts, ts, parseJSDocToPatch, applyPatchToJSDoc, serializeJSDoc, findJSDocLocation, applyEdits, createSourceFile, generateForgottenExportFixes, groupFixesByFile, applyForgottenExportFixes, previewForgottenExportFixes, isBuiltInIdentifier, detectExampleRuntimeErrors, parseAssertions, hasNonAssertionComments, detectExampleAssertionFailures, buildExportRegistry, computeDrift, computeExportDrift, buildDocCovSpec, DRIFT_CATEGORIES2 as DRIFT_CATEGORIES, DRIFT_CATEGORY_LABELS, DRIFT_CATEGORY_DESCRIPTIONS, categorizeDrift, groupDriftsByCategory, getDriftSummary, formatDriftSummaryLine, calculateAggregateCoverage, ensureSpecCoverage, getExportAnalysis, getExportScore, getExportDrift, getExportMissing, isExportFullyDocumented, generateReport, generateReportFromDocCov, loadCachedReport, saveReport, isCachedReportValid, renderApiSurface, isStandardJSONSchema, resolveCompiledPath, extractStandardSchemas, extractStandardSchemasFromProject, detectRuntimeSchemas, HISTORY_DIR, RETENTION_DAYS, computeSnapshot, saveSnapshot, loadSnapshots, getTrend, renderSparkline, formatDelta, pruneHistory, pruneByTier, loadSnapshotsForDays, generateWeeklySummaries, getExtendedTrend };
@@ -24,6 +24,17 @@ type ExampleValidationMode = "presence" | "typecheck" | "run";
24
24
  */
25
25
  type SchemaExtractionMode = "static" | "runtime" | "hybrid";
26
26
  /**
27
+ * API surface configuration options.
28
+ */
29
+ interface ApiSurfaceConfig {
30
+ /** Minimum completeness percentage to pass (0-100) */
31
+ minCompleteness?: number;
32
+ /** Warning threshold - warn when below this (0-100) */
33
+ warnBelow?: number;
34
+ /** Type names to ignore (won't be flagged as forgotten exports) */
35
+ ignore?: string[];
36
+ }
37
+ /**
27
38
  * Check command configuration options.
28
39
  */
29
40
  interface CheckConfig {
@@ -39,6 +50,10 @@ interface CheckConfig {
39
50
  minCoverage?: number;
40
51
  /** Maximum drift percentage allowed (0-100) */
41
52
  maxDrift?: number;
53
+ /** Minimum API surface completeness percentage (0-100) - deprecated, use apiSurface.minCompleteness */
54
+ minApiSurface?: number;
55
+ /** API surface configuration */
56
+ apiSurface?: ApiSurfaceConfig;
42
57
  }
43
58
  /**
44
59
  * Normalized DocCov configuration.
@@ -155,6 +170,7 @@ interface CategorizedDrift extends SpecDocDrift {
155
170
  category: DriftCategory;
156
171
  fixable: boolean;
157
172
  }
173
+ import { ApiSurfaceResult } from "@doccov/spec";
158
174
  /**
159
175
  * DocCov report schema version.
160
176
  */
@@ -330,5 +346,9 @@ interface DocCovReport {
330
346
  * Per-coverage data, keyed by ID.
331
347
  */
332
348
  exports: Record<string, ExportCoverageData>;
349
+ /**
350
+ * API surface analysis (forgotten exports).
351
+ */
352
+ apiSurface?: ApiSurfaceResult;
333
353
  }
334
354
  export { parseListFlag, mergeFilters, getReportPath, getDiffReportPath, ResolvedFilters, ReleaseTag, REPORT_VERSION, REPORT_EXTENSIONS, FilterSource, FilterOptions, ExportCoverageData, DriftReportSummary, DriftReport, DocCovReport, DEFAULT_REPORT_PATH, DEFAULT_REPORT_DIR, CoverageSummary };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doccov/sdk",
3
- "version": "0.25.12",
3
+ "version": "0.26.0",
4
4
  "description": "DocCov SDK - Documentation coverage and drift detection for TypeScript",
5
5
  "keywords": [
6
6
  "typescript",
@@ -47,8 +47,8 @@
47
47
  "dist"
48
48
  ],
49
49
  "dependencies": {
50
- "@doccov/spec": "^0.24.1",
51
- "@openpkg-ts/extract": "^0.15.0",
50
+ "@doccov/spec": "^0.26.0",
51
+ "@openpkg-ts/extract": "^0.16.0",
52
52
  "@openpkg-ts/spec": "^0.12.0",
53
53
  "@vercel/sandbox": "^1.0.3",
54
54
  "mdast": "^3.0.0",