@doccov/sdk 0.12.0 → 0.15.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 +240 -212
- package/dist/index.js +335 -192
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -45,8 +45,8 @@ declare function runExamples(examples: string[], options?: RunExampleOptions): P
|
|
|
45
45
|
* runs all examples, then cleans up.
|
|
46
46
|
*/
|
|
47
47
|
declare function runExamplesWithPackage(examples: string[], options: RunExamplesWithPackageOptions): Promise<RunExamplesWithPackageResult>;
|
|
48
|
-
import { OpenPkg } from "@openpkg-ts/spec";
|
|
49
|
-
type OpenPkgSpec =
|
|
48
|
+
import { OpenPkg as OpenPkg2 } from "@openpkg-ts/spec";
|
|
49
|
+
type OpenPkgSpec = OpenPkg2;
|
|
50
50
|
/**
|
|
51
51
|
* Result of computing drift for a single export.
|
|
52
52
|
*/
|
|
@@ -225,7 +225,7 @@ declare function ensureSpecCoverage(spec: OpenPkgSpec): OpenPkgSpec & {
|
|
|
225
225
|
coverageScore: number;
|
|
226
226
|
};
|
|
227
227
|
};
|
|
228
|
-
import { OpenPkg as
|
|
228
|
+
import { OpenPkg as OpenPkg3, SpecDocDrift as SpecDocDrift2, SpecDocsMetadata, SpecExport as SpecExport3 } from "@openpkg-ts/spec";
|
|
229
229
|
import { SpecExport as SpecExport2, SpecExportKind } from "@openpkg-ts/spec";
|
|
230
230
|
import * as TS from "typescript";
|
|
231
231
|
/**
|
|
@@ -445,7 +445,7 @@ type EnrichedDocsMetadata = SpecDocsMetadata & {
|
|
|
445
445
|
* An enriched OpenPkg spec with computed documentation metadata.
|
|
446
446
|
* Extends OpenPkg with per-and aggregate coverage data.
|
|
447
447
|
*/
|
|
448
|
-
type EnrichedOpenPkg = Omit<
|
|
448
|
+
type EnrichedOpenPkg = Omit<OpenPkg3, "exports"> & {
|
|
449
449
|
exports: EnrichedExport[];
|
|
450
450
|
docs?: EnrichedDocsMetadata;
|
|
451
451
|
/** Drift summary with category breakdown (if drift exists) */
|
|
@@ -490,8 +490,8 @@ interface EnrichOptions {
|
|
|
490
490
|
* console.log(enriched.docs?.missing); // e.g., ['has-examples']
|
|
491
491
|
* ```
|
|
492
492
|
*/
|
|
493
|
-
declare function enrichSpec(spec:
|
|
494
|
-
import { OpenPkg as
|
|
493
|
+
declare function enrichSpec(spec: OpenPkg3, options?: EnrichOptions): EnrichedOpenPkg;
|
|
494
|
+
import { OpenPkg as OpenPkg4 } from "@openpkg-ts/spec";
|
|
495
495
|
import { DriftCategory as DriftCategory2, SpecDocDrift as SpecDocDrift3 } from "@openpkg-ts/spec";
|
|
496
496
|
/**
|
|
497
497
|
* DocCov report schema version.
|
|
@@ -686,7 +686,7 @@ interface DocCovReport {
|
|
|
686
686
|
* console.log(`Coverage: ${report.coverage.score}%`);
|
|
687
687
|
* ```
|
|
688
688
|
*/
|
|
689
|
-
declare function generateReport(spec:
|
|
689
|
+
declare function generateReport(spec: OpenPkg4): DocCovReport;
|
|
690
690
|
/**
|
|
691
691
|
* Generate a DocCov report from an already-enriched spec.
|
|
692
692
|
*
|
|
@@ -755,7 +755,7 @@ declare function hashFiles(filePaths: string[], cwd: string): Record<string, str
|
|
|
755
755
|
* @returns Array of file paths that changed, were added, or were removed
|
|
756
756
|
*/
|
|
757
757
|
declare function diffHashes(cached: Record<string, string>, current: Record<string, string>): string[];
|
|
758
|
-
import { OpenPkg as
|
|
758
|
+
import { OpenPkg as OpenPkg5 } from "@openpkg-ts/spec";
|
|
759
759
|
/** Current cache format version */
|
|
760
760
|
declare const CACHE_VERSION = "1.0.0";
|
|
761
761
|
/** Default cache file path */
|
|
@@ -790,7 +790,7 @@ interface SpecCache {
|
|
|
790
790
|
/** Analysis configuration that affects output */
|
|
791
791
|
config: SpecCacheConfig;
|
|
792
792
|
/** The cached OpenPkg spec */
|
|
793
|
-
spec:
|
|
793
|
+
spec: OpenPkg5;
|
|
794
794
|
}
|
|
795
795
|
/**
|
|
796
796
|
* Result of cache validation.
|
|
@@ -833,7 +833,7 @@ declare function loadSpecCache(cwd: string): SpecCache | null;
|
|
|
833
833
|
* @param spec - OpenPkg spec to cache
|
|
834
834
|
* @param context - Cache context with file paths and config
|
|
835
835
|
*/
|
|
836
|
-
declare function saveSpecCache(spec:
|
|
836
|
+
declare function saveSpecCache(spec: OpenPkg5, context: CacheContext): void;
|
|
837
837
|
/**
|
|
838
838
|
* Validate if cached spec is still valid.
|
|
839
839
|
*
|
|
@@ -1378,9 +1378,7 @@ interface DocCovOptions {
|
|
|
1378
1378
|
/** Working directory for cache operations (default: process.cwd()) */
|
|
1379
1379
|
cwd?: string;
|
|
1380
1380
|
}
|
|
1381
|
-
|
|
1382
|
-
type OpenPkgOptions = DocCovOptions;
|
|
1383
|
-
declare function extractPackageSpec(entryFile: string, packageDir?: string, content?: string, options?: OpenPkgOptions): Promise<OpenPkgSpec>;
|
|
1381
|
+
declare function extractPackageSpec(entryFile: string, packageDir?: string, content?: string, options?: DocCovOptions): Promise<OpenPkgSpec>;
|
|
1384
1382
|
interface FilterOptions {
|
|
1385
1383
|
include?: string[];
|
|
1386
1384
|
exclude?: string[];
|
|
@@ -1477,7 +1475,7 @@ declare function categorizeDrifts(drifts: SpecDocDrift4[]): {
|
|
|
1477
1475
|
fixable: SpecDocDrift4[];
|
|
1478
1476
|
nonFixable: SpecDocDrift4[];
|
|
1479
1477
|
};
|
|
1480
|
-
import { OpenPkg as
|
|
1478
|
+
import { OpenPkg as OpenPkg6 } from "@openpkg-ts/spec";
|
|
1481
1479
|
/**
|
|
1482
1480
|
* Parsed components of a GitHub URL.
|
|
1483
1481
|
*/
|
|
@@ -1570,7 +1568,7 @@ declare function buildRawUrl(parsed: ParsedGitHubUrl, filePath: string): string;
|
|
|
1570
1568
|
* }
|
|
1571
1569
|
* ```
|
|
1572
1570
|
*/
|
|
1573
|
-
declare function fetchSpecFromGitHub(parsed: ParsedGitHubUrl): Promise<
|
|
1571
|
+
declare function fetchSpecFromGitHub(parsed: ParsedGitHubUrl): Promise<OpenPkg6 | null>;
|
|
1574
1572
|
/**
|
|
1575
1573
|
* Fetch an OpenPkg spec from a GitHub repository by owner/repo/branch.
|
|
1576
1574
|
*
|
|
@@ -1581,84 +1579,22 @@ declare function fetchSpecFromGitHub(parsed: ParsedGitHubUrl): Promise<OpenPkg5
|
|
|
1581
1579
|
* @param branch - Branch name (default: 'main')
|
|
1582
1580
|
* @returns The OpenPkg spec, or null if not found
|
|
1583
1581
|
*/
|
|
1584
|
-
declare function fetchSpec(owner: string, repo: string, branch?: string): Promise<
|
|
1585
|
-
/**
|
|
1586
|
-
* Scan types for CLI, API, and SDK consumers.
|
|
1587
|
-
* Single source of truth for scan-related interfaces.
|
|
1588
|
-
*/
|
|
1589
|
-
/**
|
|
1590
|
-
* Result of scanning a repository for documentation coverage.
|
|
1591
|
-
* Used by CLI scan command, API endpoints, and SDK consumers.
|
|
1592
|
-
*/
|
|
1593
|
-
interface ScanResult {
|
|
1594
|
-
/** GitHub repository owner */
|
|
1595
|
-
owner: string;
|
|
1596
|
-
/** GitHub repository name */
|
|
1597
|
-
repo: string;
|
|
1598
|
-
/** Git ref (branch/tag) that was scanned */
|
|
1599
|
-
ref: string;
|
|
1600
|
-
/** Package name if scanning a monorepo package */
|
|
1601
|
-
packageName?: string;
|
|
1602
|
-
/** Overall documentation coverage percentage (0-100) */
|
|
1603
|
-
coverage: number;
|
|
1604
|
-
/** Number of public exports analyzed */
|
|
1605
|
-
exportCount: number;
|
|
1606
|
-
/** Number of types analyzed */
|
|
1607
|
-
typeCount: number;
|
|
1608
|
-
/** Number of documentation drift issues found */
|
|
1609
|
-
driftCount: number;
|
|
1610
|
-
/** Names of exports missing documentation */
|
|
1611
|
-
undocumented: string[];
|
|
1612
|
-
/** Drift issues found during analysis */
|
|
1613
|
-
drift: DriftIssue[];
|
|
1614
|
-
}
|
|
1615
|
-
/**
|
|
1616
|
-
* A documentation drift issue.
|
|
1617
|
-
*/
|
|
1618
|
-
interface DriftIssue {
|
|
1619
|
-
/** Name of the with drift */
|
|
1620
|
-
export: string;
|
|
1621
|
-
/** Type of drift (e.g., 'param-mismatch', 'return-type') */
|
|
1622
|
-
type: string;
|
|
1623
|
-
/** Human-readable description of the issue */
|
|
1624
|
-
issue: string;
|
|
1625
|
-
/** Optional suggestion for fixing the issue */
|
|
1626
|
-
suggestion?: string;
|
|
1627
|
-
}
|
|
1582
|
+
declare function fetchSpec(owner: string, repo: string, branch?: string): Promise<OpenPkg6 | null>;
|
|
1628
1583
|
/**
|
|
1629
|
-
*
|
|
1584
|
+
* Progress event for installation status updates.
|
|
1630
1585
|
*/
|
|
1631
|
-
interface
|
|
1632
|
-
/**
|
|
1633
|
-
|
|
1634
|
-
/** Git ref (branch/tag) to scan */
|
|
1635
|
-
ref?: string;
|
|
1636
|
-
/** Target package name for monorepos */
|
|
1637
|
-
package?: string;
|
|
1638
|
-
/** Skip dependency installation */
|
|
1639
|
-
skipInstall?: boolean;
|
|
1640
|
-
/** Skip external type resolution */
|
|
1641
|
-
skipResolve?: boolean;
|
|
1642
|
-
}
|
|
1643
|
-
/**
|
|
1644
|
-
* Stages of the scan pipeline.
|
|
1645
|
-
*/
|
|
1646
|
-
type ProgressStage = "cloning" | "detecting" | "installing" | "building" | "analyzing" | "complete";
|
|
1647
|
-
/**
|
|
1648
|
-
* Progress event emitted during scan operations.
|
|
1649
|
-
*/
|
|
1650
|
-
interface ProgressEvent {
|
|
1651
|
-
/** Current stage of the scan */
|
|
1652
|
-
stage: ProgressStage;
|
|
1586
|
+
interface InstallProgressEvent {
|
|
1587
|
+
/** Current stage */
|
|
1588
|
+
stage: "installing";
|
|
1653
1589
|
/** Human-readable message */
|
|
1654
1590
|
message: string;
|
|
1655
1591
|
/** Progress percentage (0-100), if known */
|
|
1656
1592
|
progress?: number;
|
|
1657
1593
|
}
|
|
1658
1594
|
/**
|
|
1659
|
-
* Callback for receiving progress events.
|
|
1595
|
+
* Callback for receiving installation progress events.
|
|
1660
1596
|
*/
|
|
1661
|
-
type
|
|
1597
|
+
type InstallProgressCallback = (event: InstallProgressEvent) => void;
|
|
1662
1598
|
/**
|
|
1663
1599
|
* Result of running a command.
|
|
1664
1600
|
*/
|
|
@@ -1702,7 +1638,7 @@ interface InstallOptions {
|
|
|
1702
1638
|
/** Order of fallback package managers to try */
|
|
1703
1639
|
fallbackOrder?: PackageManager[];
|
|
1704
1640
|
/** Progress callback for status updates */
|
|
1705
|
-
onProgress?:
|
|
1641
|
+
onProgress?: InstallProgressCallback;
|
|
1706
1642
|
}
|
|
1707
1643
|
/**
|
|
1708
1644
|
* Install dependencies for a project.
|
|
@@ -1902,7 +1838,7 @@ declare function getDocumentedExports(markdownFiles: MarkdownDocFile[], exportNa
|
|
|
1902
1838
|
* Get all exports that lack documentation
|
|
1903
1839
|
*/
|
|
1904
1840
|
declare function getUndocumentedExports(markdownFiles: MarkdownDocFile[], exportNames: string[]): string[];
|
|
1905
|
-
import { CategorizedBreaking, OpenPkg as
|
|
1841
|
+
import { CategorizedBreaking, OpenPkg as OpenPkg8, SpecDiff as SpecDiff2 } from "@openpkg-ts/spec";
|
|
1906
1842
|
/**
|
|
1907
1843
|
* Extended spec diff result with docs impact
|
|
1908
1844
|
*/
|
|
@@ -1948,7 +1884,7 @@ interface DiffWithDocsOptions {
|
|
|
1948
1884
|
* }
|
|
1949
1885
|
* ```
|
|
1950
1886
|
*/
|
|
1951
|
-
declare function diffSpecWithDocs(oldSpec:
|
|
1887
|
+
declare function diffSpecWithDocs(oldSpec: OpenPkg8, newSpec: OpenPkg8, options?: DiffWithDocsOptions): SpecDiffWithDocs;
|
|
1952
1888
|
/**
|
|
1953
1889
|
* Check if a diff has any docs impact
|
|
1954
1890
|
*/
|
|
@@ -2004,7 +1940,29 @@ declare function findExportReferences(files: MarkdownDocFile[], exportNames: str
|
|
|
2004
1940
|
* Check if a code block references any of the given names
|
|
2005
1941
|
*/
|
|
2006
1942
|
declare function blockReferencesExport(block: MarkdownCodeBlock, exportName: string): boolean;
|
|
2007
|
-
|
|
1943
|
+
import { EntryPointDetectionMethod } from "@openpkg-ts/spec";
|
|
1944
|
+
/**
|
|
1945
|
+
* Input for generation metadata that comes from the caller (CLI, API, etc.)
|
|
1946
|
+
*/
|
|
1947
|
+
interface GenerationInput {
|
|
1948
|
+
/** Entry point file path (relative to package root) */
|
|
1949
|
+
entryPoint: string;
|
|
1950
|
+
/** How the entry point was detected */
|
|
1951
|
+
entryPointSource: EntryPointDetectionMethod;
|
|
1952
|
+
/** Whether this is a declaration-only analysis (.d.ts file) */
|
|
1953
|
+
isDeclarationOnly?: boolean;
|
|
1954
|
+
/** Generator tool name */
|
|
1955
|
+
generatorName: string;
|
|
1956
|
+
/** Generator tool version */
|
|
1957
|
+
generatorVersion: string;
|
|
1958
|
+
/** Detected package manager */
|
|
1959
|
+
packageManager?: string;
|
|
1960
|
+
/** Whether this is a monorepo */
|
|
1961
|
+
isMonorepo?: boolean;
|
|
1962
|
+
/** Target package name (for monorepos) */
|
|
1963
|
+
targetPackage?: string;
|
|
1964
|
+
}
|
|
1965
|
+
interface Diagnostic2 {
|
|
2008
1966
|
message: string;
|
|
2009
1967
|
severity: "error" | "warning" | "info";
|
|
2010
1968
|
suggestion?: string;
|
|
@@ -2016,7 +1974,7 @@ interface Diagnostic {
|
|
|
2016
1974
|
}
|
|
2017
1975
|
interface AnalysisResult {
|
|
2018
1976
|
spec: OpenPkgSpec;
|
|
2019
|
-
diagnostics:
|
|
1977
|
+
diagnostics: Diagnostic2[];
|
|
2020
1978
|
metadata: AnalysisMetadata;
|
|
2021
1979
|
/** True if result came from cache (no fresh analysis) */
|
|
2022
1980
|
fromCache?: boolean;
|
|
@@ -2034,6 +1992,8 @@ interface AnalysisMetadata {
|
|
|
2034
1992
|
}
|
|
2035
1993
|
interface AnalyzeOptions {
|
|
2036
1994
|
filters?: FilterOptions;
|
|
1995
|
+
/** Generation metadata input (entry point info, tool version, etc.) */
|
|
1996
|
+
generationInput?: GenerationInput;
|
|
2037
1997
|
}
|
|
2038
1998
|
declare class DocCov {
|
|
2039
1999
|
private readonly options;
|
|
@@ -2067,8 +2027,6 @@ declare class DocCov {
|
|
|
2067
2027
|
}
|
|
2068
2028
|
declare function analyze(code: string, options?: AnalyzeOptions): Promise<OpenPkgSpec>;
|
|
2069
2029
|
declare function analyzeFile(filePath: string, options?: AnalyzeOptions): Promise<OpenPkgSpec>;
|
|
2070
|
-
/** @deprecated Use DocCov instead */
|
|
2071
|
-
declare const OpenPkg8: typeof DocCov;
|
|
2072
2030
|
import { SpecExport as SpecExport6 } from "@openpkg-ts/spec";
|
|
2073
2031
|
import { SpecExportKind as SpecExportKind2 } from "@openpkg-ts/spec";
|
|
2074
2032
|
/**
|
|
@@ -2179,127 +2137,18 @@ interface ResolvedTarget {
|
|
|
2179
2137
|
* ```
|
|
2180
2138
|
*/
|
|
2181
2139
|
declare function resolveTarget(fs: FileSystem, options: ResolveTargetOptions): Promise<ResolvedTarget>;
|
|
2182
|
-
import { OpenPkg as OpenPkg9 } from "@openpkg-ts/spec";
|
|
2183
|
-
/**
|
|
2184
|
-
* Options for creating a ScanOrchestrator.
|
|
2185
|
-
*/
|
|
2186
|
-
interface ScanOrchestratorOptions {
|
|
2187
|
-
/** Progress callback for status updates */
|
|
2188
|
-
onProgress?: ProgressCallback;
|
|
2189
|
-
/** Command runner for executing shell commands */
|
|
2190
|
-
commandRunner?: CommandRunner;
|
|
2191
|
-
/** Skip external type resolution */
|
|
2192
|
-
skipResolve?: boolean;
|
|
2193
|
-
}
|
|
2194
|
-
/**
|
|
2195
|
-
* Context for the current scan operation.
|
|
2196
|
-
*/
|
|
2197
|
-
interface ScanContext {
|
|
2198
|
-
/** Parsed GitHub URL info */
|
|
2199
|
-
parsed: ParsedGitHubUrl;
|
|
2200
|
-
/** Target package name for monorepos */
|
|
2201
|
-
packageName?: string;
|
|
2202
|
-
/** Working directory for the scan */
|
|
2203
|
-
workDir: string;
|
|
2204
|
-
/** Entry point file path */
|
|
2205
|
-
entryFile?: string;
|
|
2206
|
-
}
|
|
2207
2140
|
/**
|
|
2208
|
-
*
|
|
2209
|
-
*
|
|
2210
|
-
* The orchestrator coordinates:
|
|
2211
|
-
* 1. Repository cloning (for remote URLs)
|
|
2212
|
-
* 2. Monorepo detection and package resolution
|
|
2213
|
-
* 3. Entry point detection
|
|
2214
|
-
* 4. Dependency installation
|
|
2215
|
-
* 5. Build execution (if needed)
|
|
2216
|
-
* 6. Documentation analysis
|
|
2217
|
-
* 7. Summary extraction
|
|
2218
|
-
*
|
|
2219
|
-
* It's designed to be FileSystem-agnostic so it works with both:
|
|
2220
|
-
* - NodeFileSystem (CLI - local execution)
|
|
2221
|
-
* - SandboxFileSystem (API - isolated execution)
|
|
2222
|
-
*
|
|
2223
|
-
* @example
|
|
2224
|
-
* ```typescript
|
|
2225
|
-
* import { ScanOrchestrator, NodeFileSystem, createNodeCommandRunner } from '@doccov/sdk';
|
|
2226
|
-
*
|
|
2227
|
-
* const fs = new NodeFileSystem('/path/to/repo');
|
|
2228
|
-
* const orchestrator = new ScanOrchestrator(fs, {
|
|
2229
|
-
* commandRunner: createNodeCommandRunner(),
|
|
2230
|
-
* onProgress: (event) => console.log(event.message),
|
|
2231
|
-
* });
|
|
2232
|
-
*
|
|
2233
|
-
* const result = await orchestrator.scan({
|
|
2234
|
-
* url: 'https://github.com/owner/repo',
|
|
2235
|
-
* ref: 'main',
|
|
2236
|
-
* });
|
|
2237
|
-
*
|
|
2238
|
-
* console.log(`Coverage: ${result.coverage}%`);
|
|
2239
|
-
* ```
|
|
2141
|
+
* A documentation drift issue in a spec summary.
|
|
2240
2142
|
*/
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
* Detect monorepo and resolve target package.
|
|
2251
|
-
*
|
|
2252
|
-
* @param packageName - Target package name (required for monorepos)
|
|
2253
|
-
* @returns Target directory path (relative to workDir)
|
|
2254
|
-
* @throws Error if monorepo requires --package flag
|
|
2255
|
-
*/
|
|
2256
|
-
detectPackage(packageName?: string): Promise<{
|
|
2257
|
-
targetPath: string;
|
|
2258
|
-
resolvedPackage?: string;
|
|
2259
|
-
}>;
|
|
2260
|
-
/**
|
|
2261
|
-
* Detect entry point for the package.
|
|
2262
|
-
*
|
|
2263
|
-
* @param targetPath - Path to the package directory
|
|
2264
|
-
* @returns Entry point file path (relative to workDir)
|
|
2265
|
-
*/
|
|
2266
|
-
detectEntry(targetPath: string): Promise<string>;
|
|
2267
|
-
/**
|
|
2268
|
-
* Install dependencies for the project.
|
|
2269
|
-
*
|
|
2270
|
-
* @param workDir - Working directory (absolute path)
|
|
2271
|
-
* @returns Installation result
|
|
2272
|
-
*/
|
|
2273
|
-
install(workDir: string): Promise<InstallResult>;
|
|
2274
|
-
/**
|
|
2275
|
-
* Run build if needed.
|
|
2276
|
-
*
|
|
2277
|
-
* @param workDir - Working directory (absolute path)
|
|
2278
|
-
* @param targetPath - Target package path (relative)
|
|
2279
|
-
*/
|
|
2280
|
-
build(workDir: string, targetPath: string): Promise<void>;
|
|
2281
|
-
/**
|
|
2282
|
-
* Run documentation analysis.
|
|
2283
|
-
*
|
|
2284
|
-
* @param entryFile - Path to entry file (absolute)
|
|
2285
|
-
* @returns OpenPkg spec
|
|
2286
|
-
*/
|
|
2287
|
-
analyze(entryFile: string): Promise<OpenPkg9>;
|
|
2288
|
-
/**
|
|
2289
|
-
* Run a complete scan workflow.
|
|
2290
|
-
*
|
|
2291
|
-
* @param options - Scan options
|
|
2292
|
-
* @returns Scan result with coverage statistics
|
|
2293
|
-
*/
|
|
2294
|
-
scan(options: ScanOptions): Promise<ScanResult>;
|
|
2295
|
-
}
|
|
2296
|
-
/**
|
|
2297
|
-
* Error thrown when a monorepo is detected but no package is specified.
|
|
2298
|
-
*/
|
|
2299
|
-
declare class MonorepoRequiresPackageError extends Error {
|
|
2300
|
-
/** Available package names */
|
|
2301
|
-
readonly availablePackages: string[];
|
|
2302
|
-
constructor(availablePackages: string[]);
|
|
2143
|
+
interface SummaryDriftIssue {
|
|
2144
|
+
/** Name of the with drift */
|
|
2145
|
+
export: string;
|
|
2146
|
+
/** Type of drift (e.g., 'param-mismatch', 'return-type') */
|
|
2147
|
+
type: string;
|
|
2148
|
+
/** Human-readable description of the issue */
|
|
2149
|
+
issue: string;
|
|
2150
|
+
/** Optional suggestion for fixing the issue */
|
|
2151
|
+
suggestion?: string;
|
|
2303
2152
|
}
|
|
2304
2153
|
/**
|
|
2305
2154
|
* Summary of a spec's documentation coverage.
|
|
@@ -2317,7 +2166,7 @@ interface SpecSummary {
|
|
|
2317
2166
|
/** Names of undocumented or partially documented exports */
|
|
2318
2167
|
undocumented: string[];
|
|
2319
2168
|
/** Drift issues */
|
|
2320
|
-
drift:
|
|
2169
|
+
drift: SummaryDriftIssue[];
|
|
2321
2170
|
}
|
|
2322
2171
|
/**
|
|
2323
2172
|
* Extract a summary from an enriched OpenPkg spec.
|
|
@@ -2342,6 +2191,185 @@ interface SpecSummary {
|
|
|
2342
2191
|
*/
|
|
2343
2192
|
declare function extractSpecSummary(spec: EnrichedOpenPkg): SpecSummary;
|
|
2344
2193
|
/**
|
|
2194
|
+
* Build Plan types for AI-powered repository scanning.
|
|
2195
|
+
*/
|
|
2196
|
+
/**
|
|
2197
|
+
* Target repository information for a build plan.
|
|
2198
|
+
*/
|
|
2199
|
+
interface BuildPlanTarget {
|
|
2200
|
+
/** Target type (currently only GitHub is supported) */
|
|
2201
|
+
type: "github";
|
|
2202
|
+
/** Full GitHub repository URL */
|
|
2203
|
+
repoUrl: string;
|
|
2204
|
+
/** Git ref (branch, tag, or commit) */
|
|
2205
|
+
ref: string;
|
|
2206
|
+
/** Root path within the repository (for monorepos) */
|
|
2207
|
+
rootPath?: string;
|
|
2208
|
+
/** Entry point files to analyze */
|
|
2209
|
+
entryPoints: string[];
|
|
2210
|
+
}
|
|
2211
|
+
/**
|
|
2212
|
+
* Runtime environment configuration for executing a build plan.
|
|
2213
|
+
*/
|
|
2214
|
+
interface BuildPlanEnvironment {
|
|
2215
|
+
/** Node.js or Bun runtime */
|
|
2216
|
+
runtime: "node20" | "node22" | "bun";
|
|
2217
|
+
/** Package manager to use */
|
|
2218
|
+
packageManager: "npm" | "yarn" | "pnpm" | "bun";
|
|
2219
|
+
/** Additional tools required (e.g., 'wasm-pack', 'cargo') */
|
|
2220
|
+
requiredTools?: string[];
|
|
2221
|
+
}
|
|
2222
|
+
/**
|
|
2223
|
+
* A single step in the build plan.
|
|
2224
|
+
*/
|
|
2225
|
+
interface BuildPlanStep {
|
|
2226
|
+
/** Unique identifier for this step */
|
|
2227
|
+
id: string;
|
|
2228
|
+
/** Human-readable step name */
|
|
2229
|
+
name: string;
|
|
2230
|
+
/** Command to execute */
|
|
2231
|
+
command: string;
|
|
2232
|
+
/** Command arguments */
|
|
2233
|
+
args: string[];
|
|
2234
|
+
/** Working directory (relative to repo root) */
|
|
2235
|
+
cwd?: string;
|
|
2236
|
+
/** Timeout in milliseconds */
|
|
2237
|
+
timeout?: number;
|
|
2238
|
+
/** If true, failure won't stop the plan execution */
|
|
2239
|
+
optional?: boolean;
|
|
2240
|
+
}
|
|
2241
|
+
/**
|
|
2242
|
+
* AI-generated build plan for analyzing a repository.
|
|
2243
|
+
*/
|
|
2244
|
+
interface BuildPlan {
|
|
2245
|
+
/** Build plan schema version */
|
|
2246
|
+
version: "1.0.0";
|
|
2247
|
+
/** When the plan was generated */
|
|
2248
|
+
generatedAt: string;
|
|
2249
|
+
/** Target repository information */
|
|
2250
|
+
target: BuildPlanTarget;
|
|
2251
|
+
/** Environment configuration */
|
|
2252
|
+
environment: BuildPlanEnvironment;
|
|
2253
|
+
/** Ordered list of steps to execute */
|
|
2254
|
+
steps: BuildPlanStep[];
|
|
2255
|
+
/** AI reasoning about the plan */
|
|
2256
|
+
reasoning: {
|
|
2257
|
+
/** Brief summary of the approach */
|
|
2258
|
+
summary: string;
|
|
2259
|
+
/** Why this approach was chosen */
|
|
2260
|
+
rationale: string;
|
|
2261
|
+
/** Potential issues or concerns */
|
|
2262
|
+
concerns: string[];
|
|
2263
|
+
};
|
|
2264
|
+
/** AI confidence in the plan */
|
|
2265
|
+
confidence: "high" | "medium" | "low";
|
|
2266
|
+
}
|
|
2267
|
+
/**
|
|
2268
|
+
* Result of executing a single build plan step.
|
|
2269
|
+
*/
|
|
2270
|
+
interface BuildPlanStepResult {
|
|
2271
|
+
/** Step ID that was executed */
|
|
2272
|
+
stepId: string;
|
|
2273
|
+
/** Whether the step succeeded */
|
|
2274
|
+
success: boolean;
|
|
2275
|
+
/** Duration in milliseconds */
|
|
2276
|
+
duration: number;
|
|
2277
|
+
/** Command output (stdout) */
|
|
2278
|
+
output?: string;
|
|
2279
|
+
/** Error message if failed */
|
|
2280
|
+
error?: string;
|
|
2281
|
+
}
|
|
2282
|
+
/**
|
|
2283
|
+
* Result of executing a complete build plan.
|
|
2284
|
+
*/
|
|
2285
|
+
interface BuildPlanExecutionResult {
|
|
2286
|
+
/** Whether all required steps succeeded */
|
|
2287
|
+
success: boolean;
|
|
2288
|
+
/** Generated OpenPkg spec (if successful) */
|
|
2289
|
+
spec?: import("@openpkg-ts/spec").OpenPkg;
|
|
2290
|
+
/** Results for each step */
|
|
2291
|
+
stepResults: BuildPlanStepResult[];
|
|
2292
|
+
/** Total execution time in milliseconds */
|
|
2293
|
+
totalDuration: number;
|
|
2294
|
+
/** Overall error message if failed */
|
|
2295
|
+
error?: string;
|
|
2296
|
+
}
|
|
2297
|
+
/**
|
|
2298
|
+
* Repository metadata from GitHub API.
|
|
2299
|
+
*/
|
|
2300
|
+
interface GitHubRepoMetadata {
|
|
2301
|
+
owner: string;
|
|
2302
|
+
repo: string;
|
|
2303
|
+
defaultBranch: string;
|
|
2304
|
+
description: string | null;
|
|
2305
|
+
language: string | null;
|
|
2306
|
+
topics: string[];
|
|
2307
|
+
isPrivate: boolean;
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Detected package manager from lockfile.
|
|
2311
|
+
*/
|
|
2312
|
+
type DetectedPackageManager = "npm" | "yarn" | "pnpm" | "bun" | "unknown";
|
|
2313
|
+
/**
|
|
2314
|
+
* Workspace/monorepo configuration.
|
|
2315
|
+
*/
|
|
2316
|
+
interface WorkspaceConfig {
|
|
2317
|
+
isMonorepo: boolean;
|
|
2318
|
+
tool?: "npm" | "yarn" | "pnpm" | "lerna" | "turborepo" | "nx";
|
|
2319
|
+
packages?: string[];
|
|
2320
|
+
}
|
|
2321
|
+
/**
|
|
2322
|
+
* Build hints detected from project files.
|
|
2323
|
+
*/
|
|
2324
|
+
interface BuildHints {
|
|
2325
|
+
hasTypeScript: boolean;
|
|
2326
|
+
hasWasm: boolean;
|
|
2327
|
+
hasNativeModules: boolean;
|
|
2328
|
+
hasBuildScript: boolean;
|
|
2329
|
+
buildScript?: string;
|
|
2330
|
+
frameworks: string[];
|
|
2331
|
+
}
|
|
2332
|
+
/**
|
|
2333
|
+
* Complete project context for build plan generation.
|
|
2334
|
+
*/
|
|
2335
|
+
interface GitHubProjectContext {
|
|
2336
|
+
/** Repository metadata */
|
|
2337
|
+
metadata: GitHubRepoMetadata;
|
|
2338
|
+
/** Git ref being analyzed */
|
|
2339
|
+
ref: string;
|
|
2340
|
+
/** Detected package manager */
|
|
2341
|
+
packageManager: DetectedPackageManager;
|
|
2342
|
+
/** Workspace/monorepo configuration */
|
|
2343
|
+
workspace: WorkspaceConfig;
|
|
2344
|
+
/** Build hints from project files */
|
|
2345
|
+
buildHints: BuildHints;
|
|
2346
|
+
/** Raw file contents for AI analysis */
|
|
2347
|
+
files: {
|
|
2348
|
+
packageJson?: string;
|
|
2349
|
+
tsconfigJson?: string;
|
|
2350
|
+
lockfile?: {
|
|
2351
|
+
name: string;
|
|
2352
|
+
content: string;
|
|
2353
|
+
};
|
|
2354
|
+
};
|
|
2355
|
+
}
|
|
2356
|
+
/**
|
|
2357
|
+
* Parse GitHub URL into owner and repo.
|
|
2358
|
+
* Uses the richer parseGitHubUrl from github/index.ts, returning null on error.
|
|
2359
|
+
*/
|
|
2360
|
+
declare function parseGitHubUrl2(url: string): {
|
|
2361
|
+
owner: string;
|
|
2362
|
+
repo: string;
|
|
2363
|
+
} | null;
|
|
2364
|
+
/**
|
|
2365
|
+
* Fetch complete project context from GitHub.
|
|
2366
|
+
*/
|
|
2367
|
+
declare function fetchGitHubContext(repoUrl: string, ref?: string): Promise<GitHubProjectContext>;
|
|
2368
|
+
/**
|
|
2369
|
+
* List packages in a monorepo workspace.
|
|
2370
|
+
*/
|
|
2371
|
+
declare function listWorkspacePackages(owner: string, repo: string, ref: string, patterns: string[]): Promise<string[]>;
|
|
2372
|
+
/**
|
|
2345
2373
|
* Type-check a single example
|
|
2346
2374
|
*/
|
|
2347
2375
|
declare function typecheckExample(example: string, packagePath: string, options?: TypecheckOptions): ExampleTypeError[];
|
|
@@ -2349,4 +2377,4 @@ declare function typecheckExample(example: string, packagePath: string, options?
|
|
|
2349
2377
|
* Type-check multiple examples
|
|
2350
2378
|
*/
|
|
2351
2379
|
declare function typecheckExamples(examples: string[], packagePath: string, options?: TypecheckOptions): TypecheckResult;
|
|
2352
|
-
export { validateSpecCache, validateExamples, typecheckExamples, typecheckExample, shouldValidate, serializeJSDoc, saveSpecCache, saveReport, safeParseJson, runExamplesWithPackage, runExamples, runExample, resolveTarget, readPackageJson, parseMarkdownFiles, parseMarkdownFile, parseListFlag, parseJSDocToPatch, parseGitHubUrl, parseExamplesFlag, parseAssertions, mergeFixes, mergeFilters, mergeConfig, loadSpecCache, loadCachedReport, isFixableDrift, isExecutableLang, isCachedReportValid, installDependencies, hashString, hashFiles, hashFile, hasNonAssertionComments, hasDocsImpact, hasDocsForExport, groupDriftsByCategory, getUndocumentedExports, getSpecCachePath, getRunCommand, getRulesForKind, getRule, getReportPath, getPrimaryBuildScript, getInstallCommand, getDriftSummary, getDocumentedExports, getDocsImpactSummary, getDiffReportPath, getDefaultConfig, getCoverageRules, generateReportFromEnriched, generateReport, generateFixesForExport, generateFix, formatPackageList, formatDriftSummaryLine, findRemovedReferences, findPackageByName, findJSDocLocation, findExportReferences, findDeprecatedReferences, fetchSpecFromGitHub, fetchSpec, extractSpecSummary, extractPackageSpec, extractImports, extractFunctionCalls, evaluateQuality, evaluateExportQuality, ensureSpecCoverage, enrichSpec, diffSpecWithDocs, diffHashes, detectPackageManager, detectMonorepo, detectExampleRuntimeErrors, detectExampleAssertionFailures, detectEntryPoint, detectBuildInfo, defineConfig, createSourceFile, createNodeCommandRunner, computeExportDrift, computeDrift, clearSpecCache, categorizeDrifts, categorizeDrift, calculateAggregateCoverage, buildRawUrl, buildExportRegistry, buildDisplayUrl, buildCloneUrl, blockReferencesExport, applyPatchToJSDoc, applyEdits, analyzeProject2 as analyzeProject, analyzeFile, analyzeDocsImpact, analyze, WorkspacePackage, VALIDATION_INFO, TypecheckValidationResult, TypecheckResult, TypecheckOptions, SpecSummary, SpecDiffWithDocs, SpecCacheConfig, SpecCache,
|
|
2380
|
+
export { validateSpecCache, validateExamples, typecheckExamples, typecheckExample, shouldValidate, serializeJSDoc, saveSpecCache, saveReport, safeParseJson, runExamplesWithPackage, runExamples, runExample, resolveTarget, readPackageJson, parseGitHubUrl2 as parseScanGitHubUrl, parseMarkdownFiles, parseMarkdownFile, parseListFlag, parseJSDocToPatch, parseGitHubUrl, parseExamplesFlag, parseAssertions, mergeFixes, mergeFilters, mergeConfig, loadSpecCache, loadCachedReport, listWorkspacePackages, isFixableDrift, isExecutableLang, isCachedReportValid, installDependencies, hashString, hashFiles, hashFile, hasNonAssertionComments, hasDocsImpact, hasDocsForExport, groupDriftsByCategory, getUndocumentedExports, getSpecCachePath, getRunCommand, getRulesForKind, getRule, getReportPath, getPrimaryBuildScript, getInstallCommand, getDriftSummary, getDocumentedExports, getDocsImpactSummary, getDiffReportPath, getDefaultConfig, getCoverageRules, generateReportFromEnriched, generateReport, generateFixesForExport, generateFix, formatPackageList, formatDriftSummaryLine, findRemovedReferences, findPackageByName, findJSDocLocation, findExportReferences, findDeprecatedReferences, fetchSpecFromGitHub, fetchSpec, fetchGitHubContext, extractSpecSummary, extractPackageSpec, extractImports, extractFunctionCalls, evaluateQuality, evaluateExportQuality, ensureSpecCoverage, enrichSpec, diffSpecWithDocs, diffHashes, detectPackageManager, detectMonorepo, detectExampleRuntimeErrors, detectExampleAssertionFailures, detectEntryPoint, detectBuildInfo, defineConfig, createSourceFile, createNodeCommandRunner, computeExportDrift, computeDrift, clearSpecCache, categorizeDrifts, categorizeDrift, calculateAggregateCoverage, buildRawUrl, buildExportRegistry, buildDisplayUrl, buildCloneUrl, blockReferencesExport, applyPatchToJSDoc, applyEdits, analyzeProject2 as analyzeProject, analyzeFile, analyzeDocsImpact, analyze, WorkspacePackage, WorkspaceConfig, VALIDATION_INFO, TypecheckValidationResult, TypecheckResult, TypecheckOptions, SummaryDriftIssue, SpecSummary, SpecDiffWithDocs, SpecCacheConfig, SpecCache, SandboxFileSystem, STYLE_RULES, SPEC_CACHE_FILE, RuntimeDrift, RunValidationResult, RunExamplesWithPackageResult, RunExamplesWithPackageOptions, RunExampleOptions, RuleContext, ResolvedTarget, ResolvedFilters, ResolveTargetOptions, REPORT_VERSION, REPORT_EXTENSIONS, QualityViolation, QualitySeverity2 as QualitySeverity, QualityRulesConfig, QualityRule, QualityResult, QualityConfig, ProjectInfo, PresenceResult, ParsedGitHubUrl, PackageManagerInfo, PackageManager, PackageJson, PackageExports, OpenPkgSpec, NodeFileSystem, MonorepoType, MonorepoInfo, MemberChange, MarkdownDocFile, MarkdownCodeBlock, LLMAssertion, JSDocTag, JSDocReturn, JSDocPatch, JSDocParam, JSDocEdit, InstallResult, InstallOptions, GitHubRepoMetadata, GitHubProjectContext, FixType, FixSuggestion, FilterSource, FilterOptions, FileSystem, ExportReference, ExportDriftResult, ExportCoverageData, ExampleValidationTypeError, ExampleValidationResult, ExampleValidationOptions, ExampleValidationMode, ExampleValidation, ExampleTypeError, ExampleRunResult, EntryPointSource, EntryPointInfo, EnrichedOpenPkg, EnrichedExport, EnrichedDocsMetadata, EnrichOptions, DriftSummary, DriftResult, DriftReportSummary, DriftReport, DocsImpactResult, DocsImpactReference, DocsImpact, DocsConfig, DocsChangeType, DocCovReport, DocCovOptions, DocCovConfig, DocCov, DiffWithDocsOptions, Diagnostic2 as Diagnostic, DetectedPackageManager, DEFAULT_REPORT_PATH, DEFAULT_REPORT_DIR, CoverageSummary, CommandRunner, CommandResult, CheckConfig, CategorizedDrift, CacheValidationResult, CacheContext, CORE_RULES, CACHE_VERSION, BuildPlanTarget, BuildPlanStepResult, BuildPlanStep, BuildPlanExecutionResult, BuildPlanEnvironment, BuildPlan, BuildInfo, BuildHints, BUILTIN_RULES, ApplyEditsResult, AnalyzeProjectOptions, AnalyzeOptions, AnalysisResult, AggregateQualityResult, ALL_VALIDATIONS };
|