@doccov/spec 0.24.0 → 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.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ declare const SCHEMA_VERSION = "1.0.0";
2
+ declare const SCHEMA_URL = "https://unpkg.com/@doccov/spec/schemas/v1.0.0/doccov.schema.json";
1
3
  type DriftType = "param-mismatch" | "param-type-mismatch" | "return-type-mismatch" | "generic-constraint-mismatch" | "optionality-mismatch" | "deprecated-mismatch" | "visibility-mismatch" | "async-mismatch" | "property-type-drift" | "example-drift" | "example-syntax-error" | "example-runtime-error" | "example-assertion-failed" | "broken-link";
2
4
  type DriftCategory = "structural" | "semantic" | "example";
3
5
  declare const DRIFT_CATEGORIES: Record<DriftType, DriftCategory>;
@@ -27,7 +29,7 @@ type ExampleAnalysis = {
27
29
  runtimeDrifts?: ExampleRuntimeDrift[];
28
30
  };
29
31
  type MissingDocRule = "description" | "params" | "returns" | "examples" | "throws";
30
- type DocCovSpecVersion = "1.0.0";
32
+ type DocCovSpecVersion = "0.1.0";
31
33
  type DocCovSpec = {
32
34
  $schema?: string;
33
35
  doccov: DocCovSpecVersion;
@@ -43,6 +45,8 @@ type DocCovSpec = {
43
45
  summary: DocCovSummary;
44
46
  /** Per-analysis, keyed by openpkg ID */
45
47
  exports: Record<string, ExportAnalysis>;
48
+ /** API surface completeness analysis */
49
+ apiSurface?: ApiSurfaceResult;
46
50
  };
47
51
  type DocCovSummary = {
48
52
  /** Overall coverage score (0-100) */
@@ -79,8 +83,41 @@ type ExportAnalysis = {
79
83
  /** Example validation results */
80
84
  examples?: ExampleAnalysis;
81
85
  };
82
- declare const SCHEMA_VERSION = "1.0.0";
83
- declare const SCHEMA_URL = "https://unpkg.com/@doccov/spec/schemas/v1.0.0/doccov.schema.json";
86
+ /** Location context for where a type is referenced */
87
+ type TypeReferenceLocation = "return" | "parameter" | "property" | "extends" | "type-parameter";
88
+ /** A type referenced in public API but not exported */
89
+ type ForgottenExport = {
90
+ /** Name of the forgotten type */
91
+ name: string;
92
+ /** Where the type is defined (file path) */
93
+ definedIn?: {
94
+ file: string;
95
+ line?: number;
96
+ };
97
+ /** Which exports reference this type */
98
+ referencedBy: Array<{
99
+ exportName: string;
100
+ location: TypeReferenceLocation;
101
+ }>;
102
+ /** Whether type is from external package */
103
+ isExternal: boolean;
104
+ /** Suggested fix if applicable */
105
+ fix?: {
106
+ targetFile: string;
107
+ exportStatement: string;
108
+ };
109
+ };
110
+ /** API Surface analysis result */
111
+ type ApiSurfaceResult = {
112
+ /** Total types referenced in public API */
113
+ totalReferenced: number;
114
+ /** Types that are properly exported */
115
+ exported: number;
116
+ /** Types referenced but not exported */
117
+ forgotten: ForgottenExport[];
118
+ /** Completeness percentage (exported / totalReferenced * 100) */
119
+ completeness: number;
120
+ };
84
121
  type DocCovSchemaVersion = "1.0.0" | "latest";
85
122
  declare const LATEST_VERSION: DocCovSchemaVersion;
86
123
  type DocCovSpecError = {
@@ -97,4 +134,4 @@ declare function validateDocCovSpec(spec: unknown, version?: DocCovSchemaVersion
97
134
  declare function assertDocCovSpec(spec: unknown, version?: DocCovSchemaVersion): asserts spec is DocCovSpec;
98
135
  declare function getDocCovValidationErrors(spec: unknown, version?: DocCovSchemaVersion): DocCovSpecError[];
99
136
  declare function getAvailableDocCovVersions(): string[];
100
- export { validateDocCovSpec, getDocCovValidationErrors, getAvailableDocCovVersions, assertDocCovSpec, SCHEMA_VERSION, SCHEMA_URL, MissingDocRule, LATEST_VERSION, ExportAnalysis, ExampleTypecheckError, ExampleRuntimeDrift, ExampleAnalysis, DriftType, DriftCategory, DocCovSummary, DocCovSpecVersion, DocCovSpecError, DocCovSpec, DocCovSchemaVersion, DocCovDrift, DRIFT_CATEGORY_LABELS, DRIFT_CATEGORY_DESCRIPTIONS, DRIFT_CATEGORIES };
137
+ export { validateDocCovSpec, getDocCovValidationErrors, getAvailableDocCovVersions, assertDocCovSpec, TypeReferenceLocation, SCHEMA_VERSION, SCHEMA_URL, MissingDocRule, LATEST_VERSION, ForgottenExport, ExportAnalysis, ExampleTypecheckError, ExampleRuntimeDrift, ExampleAnalysis, DriftType, DriftCategory, DocCovSummary, DocCovSpecVersion, DocCovSpecError, DocCovSpec, DocCovSchemaVersion, DocCovDrift, DRIFT_CATEGORY_LABELS, DRIFT_CATEGORY_DESCRIPTIONS, DRIFT_CATEGORIES, ApiSurfaceResult };
package/dist/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ // src/constants.ts
2
+ var SCHEMA_VERSION = "1.0.0";
3
+ var SCHEMA_URL = "https://unpkg.com/@doccov/spec/schemas/v1.0.0/doccov.schema.json";
1
4
  // src/types.ts
2
5
  var DRIFT_CATEGORIES = {
3
6
  "param-mismatch": "structural",
@@ -25,9 +28,6 @@ var DRIFT_CATEGORY_DESCRIPTIONS = {
25
28
  semantic: "Deprecation, visibility, or reference issues",
26
29
  example: "@example code has errors or doesn't work correctly"
27
30
  };
28
- // src/constants.ts
29
- var SCHEMA_VERSION = "1.0.0";
30
- var SCHEMA_URL = "https://unpkg.com/@doccov/spec/schemas/v1.0.0/doccov.schema.json";
31
31
  // src/validate.ts
32
32
  import Ajv from "ajv/dist/2020.js";
33
33
  import addFormats from "ajv-formats";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doccov/spec",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "description": "DocCov specification schema, types, and validation",
5
5
  "keywords": [
6
6
  "doccov",