@offworld/sdk 0.2.2 → 0.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.
@@ -0,0 +1,655 @@
1
+ import { Agent, Config, Config as Config$1, FileIndex, FileIndexEntry, FileRole, GlobalMap, GlobalMap as GlobalMap$1, GlobalMapRepoEntry, GlobalMapRepoEntry as GlobalMapRepoEntry$1, ProjectMap, ProjectMap as ProjectMap$1, ProjectMapRepoEntry, ProjectMapRepoEntry as ProjectMapRepoEntry$1, RemoteRepoSource, RepoSource, RepoSource as RepoSource$1 } from "@offworld/types";
2
+
3
+ //#region src/constants.d.ts
4
+ /**
5
+ * SDK Constants
6
+ */
7
+ /** SDK version - must match package.json */
8
+ declare const VERSION = "0.3.0";
9
+ /**
10
+ * Default patterns to ignore when scanning repositories.
11
+ * Includes directories, binary files, IDE configs, and build outputs.
12
+ */
13
+ declare const DEFAULT_IGNORE_PATTERNS: readonly [".git", ".git/**", ".svn", ".hg", "node_modules", "node_modules/**", "vendor", "vendor/**", ".pnpm", ".yarn", "dist", "dist/**", "build", "build/**", "out", "out/**", ".next", ".nuxt", ".output", "target", "__pycache__", "*.pyc", ".vscode", ".vscode/**", ".idea", ".idea/**", "*.swp", "*.swo", ".DS_Store", "*.jpg", "*.jpeg", "*.png", "*.gif", "*.ico", "*.webp", "*.svg", "*.bmp", "*.tiff", "*.mp4", "*.webm", "*.mov", "*.avi", "*.mkv", "*.mp3", "*.wav", "*.flac", "*.ogg", "*.pdf", "*.zip", "*.tar", "*.gz", "*.rar", "*.7z", "*.exe", "*.dll", "*.so", "*.dylib", "*.bin", "*.wasm", "*.woff", "*.woff2", "*.ttf", "*.eot", "*.otf", "package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb", "Cargo.lock", "Gemfile.lock", "poetry.lock", "composer.lock", "go.sum", "coverage", "coverage/**", ".nyc_output", ".coverage", "htmlcov", "*.log", "logs", "tmp", "temp", ".tmp", ".temp", ".cache", ".env", ".env.*", "*.pem", "*.key"];
14
+ //#endregion
15
+ //#region src/config.d.ts
16
+ /**
17
+ * Returns the repository root directory.
18
+ * Uses configured repoRoot or defaults to ~/ow
19
+ */
20
+ declare function getMetaRoot(): string;
21
+ declare function getRepoRoot(config?: Config): string;
22
+ /**
23
+ * Returns the path for a specific repository.
24
+ * Format: {repoRoot}/{provider}/{owner}/{repo}
25
+ *
26
+ * @param fullName - The repo identifier in "owner/repo" format
27
+ * @param provider - Git provider (defaults to "github")
28
+ * @param config - Optional config for custom repoRoot
29
+ */
30
+ declare function getRepoPath(fullName: string, provider?: "github" | "gitlab" | "bitbucket", config?: Config): string;
31
+ /**
32
+ * Convert owner/repo format to meta directory name.
33
+ * Collapses owner==repo (e.g., better-auth/better-auth -> better-auth)
34
+ */
35
+ declare function toMetaDirName(repoName: string): string;
36
+ /**
37
+ * Convert owner/repo format to reference filename.
38
+ * Collapses redundant owner/repo pairs by checking if repo name is contained in owner:
39
+ * - honojs/hono -> hono.md (hono is in honojs)
40
+ * - get-convex/convex-backend -> convex-backend.md (convex is in get-convex)
41
+ * - tanstack/query -> tanstack-query.md (query is not in tanstack)
42
+ */
43
+ declare function toReferenceFileName(repoName: string): string;
44
+ declare function toReferenceName(repoName: string): string;
45
+ declare function getReferencePath(fullName: string): string;
46
+ declare function getMetaPath(fullName: string): string;
47
+ /**
48
+ * Returns the path to the configuration file
49
+ * Uses XDG Base Directory specification
50
+ */
51
+ declare function getConfigPath(): string;
52
+ /**
53
+ * Loads configuration from ~/.config/offworld/offworld.json
54
+ * Returns defaults if file doesn't exist
55
+ */
56
+ declare function loadConfig(): Config;
57
+ /**
58
+ * Saves configuration to ~/.config/offworld/offworld.json
59
+ * Creates directory if it doesn't exist
60
+ * Merges with existing config
61
+ */
62
+ declare function saveConfig(updates: Partial<Config>): Config;
63
+ //#endregion
64
+ //#region src/paths.d.ts
65
+ /**
66
+ * XDG-based directory paths for offworld CLI
67
+ * Uses xdg-basedir package for cross-platform compatibility (Linux/macOS)
68
+ */
69
+ /**
70
+ * Main namespace for all XDG-compliant paths
71
+ */
72
+ declare const Paths: {
73
+ /**
74
+ * XDG_CONFIG_HOME/offworld
75
+ * Fallback: ~/.config/offworld
76
+ */
77
+ readonly config: string;
78
+ /**
79
+ * XDG_DATA_HOME/offworld
80
+ * Fallback: ~/.local/share/offworld
81
+ */
82
+ readonly data: string;
83
+ /**
84
+ * XDG_STATE_HOME/offworld
85
+ * Fallback: ~/.local/state/offworld
86
+ */
87
+ readonly state: string;
88
+ /**
89
+ * Configuration file path: ~/.config/offworld/offworld.json
90
+ */
91
+ readonly configFile: string;
92
+ /**
93
+ * Auth file path: ~/.local/share/offworld/auth.json
94
+ */
95
+ readonly authFile: string;
96
+ /**
97
+ * Meta directory: ~/.local/share/offworld/meta
98
+ */
99
+ readonly metaDir: string;
100
+ /**
101
+ * Default repo root: ~/ow
102
+ */
103
+ readonly defaultRepoRoot: string;
104
+ /**
105
+ * Offworld single-skill directory: ~/.local/share/offworld/skill/offworld
106
+ */
107
+ readonly offworldSkillDir: string;
108
+ /**
109
+ * Offworld references directory: ~/.local/share/offworld/skill/offworld/references
110
+ */
111
+ readonly offworldReferencesDir: string;
112
+ /**
113
+ * Offworld assets directory: ~/.local/share/offworld/skill/offworld/assets
114
+ */
115
+ readonly offworldAssetsDir: string;
116
+ /**
117
+ * Global map path: ~/.local/share/offworld/skill/offworld/assets/map.json
118
+ */
119
+ readonly offworldGlobalMapPath: string;
120
+ };
121
+ /**
122
+ * Expands ~ to user's home directory (for backward compatibility)
123
+ */
124
+ declare function expandTilde(path: string): string;
125
+ //#endregion
126
+ //#region src/repo-source.d.ts
127
+ declare class RepoSourceError extends Error {
128
+ constructor(message: string);
129
+ }
130
+ declare class PathNotFoundError extends RepoSourceError {
131
+ constructor(path: string);
132
+ }
133
+ declare class NotGitRepoError extends RepoSourceError {
134
+ constructor(path: string);
135
+ }
136
+ /**
137
+ * Parses a repository input and returns a structured RepoSource
138
+ *
139
+ * Supported formats:
140
+ * - owner/repo (short format, defaults to GitHub)
141
+ * - https://github.com/owner/repo
142
+ * - https://gitlab.com/owner/repo
143
+ * - https://bitbucket.org/owner/repo
144
+ * - git@github.com:owner/repo.git (SSH format)
145
+ * - . (current directory as local repo)
146
+ * - /absolute/path (local repo)
147
+ *
148
+ * @throws PathNotFoundError if local path doesn't exist
149
+ * @throws NotGitRepoError if local path is not a git repository
150
+ * @throws RepoSourceError for other parsing failures
151
+ */
152
+ declare function parseRepoInput(input: string): RepoSource;
153
+ declare function getReferenceFileNameForSource(source: RepoSource): string;
154
+ //#endregion
155
+ //#region src/index-manager.d.ts
156
+ /**
157
+ * Reads the global map from ~/.local/share/offworld/skill/offworld/assets/map.json
158
+ * Returns empty map if file doesn't exist or is invalid
159
+ */
160
+ declare function readGlobalMap(): GlobalMap;
161
+ /**
162
+ * Writes the global map to ~/.local/share/offworld/skill/offworld/assets/map.json
163
+ * Creates directory if it doesn't exist
164
+ */
165
+ declare function writeGlobalMap(map: GlobalMap): void;
166
+ /**
167
+ * Adds or updates a repo entry in the global map
168
+ *
169
+ * @param qualifiedName - The qualified repo name (owner/repo)
170
+ * @param entry - The map entry to add/update
171
+ */
172
+ declare function upsertGlobalMapEntry(qualifiedName: string, entry: GlobalMapRepoEntry): void;
173
+ /**
174
+ * Removes a repo entry from the global map
175
+ *
176
+ * @param qualifiedName - The qualified repo name (owner/repo)
177
+ * @returns true if repo was removed, false if not found
178
+ */
179
+ declare function removeGlobalMapEntry(qualifiedName: string): boolean;
180
+ /**
181
+ * Writes a project map to ./.offworld/map.json
182
+ *
183
+ * @param projectRoot - Absolute path to project root
184
+ * @param entries - Map of qualified repo names to project map entries
185
+ */
186
+ declare function writeProjectMap(projectRoot: string, entries: Record<string, ProjectMapRepoEntry>): void;
187
+ //#endregion
188
+ //#region src/map.d.ts
189
+ interface MapEntry {
190
+ scope: "project" | "global";
191
+ qualifiedName: string;
192
+ entry: GlobalMapRepoEntry | ProjectMapRepoEntry;
193
+ }
194
+ interface SearchResult {
195
+ qualifiedName: string;
196
+ fullName: string;
197
+ localPath: string;
198
+ primary: string;
199
+ keywords: string[];
200
+ score: number;
201
+ }
202
+ interface GetMapEntryOptions {
203
+ preferProject?: boolean;
204
+ cwd?: string;
205
+ }
206
+ interface SearchMapOptions {
207
+ limit?: number;
208
+ cwd?: string;
209
+ }
210
+ /**
211
+ * Resolve an input string to a qualified repo key in a map.
212
+ *
213
+ * @param input - Accepts github.com:owner/repo, owner/repo, or repo name
214
+ * @param map - A global or project map
215
+ * @returns The matching qualified name or null
216
+ */
217
+ declare function resolveRepoKey(input: string, map: GlobalMap | ProjectMap): string | null;
218
+ /**
219
+ * Get a map entry for a repo, preferring project map if available.
220
+ *
221
+ * @param input - Repo identifier (github.com:owner/repo, owner/repo, or repo)
222
+ * @param options - Options for lookup
223
+ * @returns Entry with scope and qualified name, or null if not found
224
+ */
225
+ declare function getMapEntry(input: string, options?: GetMapEntryOptions): MapEntry | null;
226
+ /**
227
+ * Search the map for repos matching a term.
228
+ *
229
+ * Scoring:
230
+ * - Exact fullName match: 100
231
+ * - Keyword hit: 50 per keyword
232
+ * - Partial contains in fullName: 25
233
+ * - Partial contains in keywords: 10
234
+ *
235
+ * @param term - Search term
236
+ * @param options - Search options
237
+ * @returns Sorted list of matches
238
+ */
239
+ declare function searchMap(term: string, options?: SearchMapOptions): SearchResult[];
240
+ /**
241
+ * Get the project map path if it exists in cwd.
242
+ */
243
+ declare function getProjectMapPath(cwd?: string): string | null;
244
+ //#endregion
245
+ //#region src/clone.d.ts
246
+ declare class CloneError extends Error {
247
+ constructor(message: string);
248
+ }
249
+ declare class RepoExistsError extends CloneError {
250
+ constructor(path: string);
251
+ }
252
+ declare class RepoNotFoundError extends CloneError {
253
+ constructor(qualifiedName: string);
254
+ }
255
+ declare class GitError extends CloneError {
256
+ readonly command: string;
257
+ readonly exitCode: number | null;
258
+ constructor(message: string, command: string, exitCode: number | null);
259
+ }
260
+ interface CloneOptions {
261
+ /** Use shallow clone (--depth 1) */
262
+ shallow?: boolean;
263
+ /** Clone specific branch */
264
+ branch?: string;
265
+ /** Custom config for repo root path */
266
+ config?: Config;
267
+ /** Force clone even if directory exists (removes existing) */
268
+ force?: boolean;
269
+ /** Use sparse checkout for large repos (only src/, lib/, packages/, docs/) */
270
+ sparse?: boolean;
271
+ }
272
+ declare function getCommitSha(repoPath: string): string;
273
+ declare function getCommitDistance(repoPath: string, olderSha: string, newerSha?: string): number | null;
274
+ /**
275
+ * Clone a remote repository to the local repo root.
276
+ *
277
+ * @param source - Remote repo source from parseRepoInput()
278
+ * @param options - Clone options (shallow, branch, config)
279
+ * @returns The local path where the repo was cloned
280
+ * @throws RepoExistsError if repo already exists (unless force is true)
281
+ * @throws GitError if clone fails
282
+ */
283
+ declare function cloneRepo(source: RemoteRepoSource, options?: CloneOptions): Promise<string>;
284
+ declare function isShallowClone(repoPath: string): boolean;
285
+ declare function unshallowRepo(repoPath: string): Promise<boolean>;
286
+ interface UpdateResult {
287
+ /** Whether any updates were fetched */
288
+ updated: boolean;
289
+ /** Previous commit SHA before update */
290
+ previousSha: string;
291
+ /** Current commit SHA after update */
292
+ currentSha: string;
293
+ /** Whether the repo was unshallowed */
294
+ unshallowed?: boolean;
295
+ }
296
+ interface UpdateOptions {
297
+ /** Convert shallow clone to full clone */
298
+ unshallow?: boolean;
299
+ }
300
+ /**
301
+ * Update a cloned repository by running git fetch and pull.
302
+ *
303
+ * @param qualifiedName - The qualified name of the repo (e.g., "github.com:owner/repo")
304
+ * @param options - Update options
305
+ * @returns Update result with commit SHAs
306
+ * @throws RepoNotFoundError if repo not in index
307
+ * @throws GitError if fetch/pull fails
308
+ */
309
+ declare function updateRepo(qualifiedName: string, options?: UpdateOptions): Promise<UpdateResult>;
310
+ interface RemoveOptions {
311
+ referenceOnly?: boolean;
312
+ repoOnly?: boolean;
313
+ }
314
+ declare function removeRepo(qualifiedName: string, options?: RemoveOptions): Promise<boolean>;
315
+ declare function listRepos(): string[];
316
+ declare function isRepoCloned(qualifiedName: string): boolean;
317
+ /**
318
+ * Get the local path for a cloned repository.
319
+ *
320
+ * @param qualifiedName - The qualified name of the repo
321
+ * @returns The local path or undefined if not cloned
322
+ */
323
+ declare function getClonedRepoPath(qualifiedName: string): string | undefined;
324
+ //#endregion
325
+ //#region src/auth.d.ts
326
+ /**
327
+ * Authentication utilities for offworld CLI
328
+ */
329
+ interface AuthData {
330
+ token: string;
331
+ expiresAt?: string;
332
+ workosId?: string;
333
+ refreshToken?: string;
334
+ email?: string;
335
+ }
336
+ /** Authentication status */
337
+ interface AuthStatus {
338
+ isLoggedIn: boolean;
339
+ email?: string;
340
+ workosId?: string;
341
+ expiresAt?: string;
342
+ }
343
+ declare class AuthError extends Error {
344
+ constructor(message: string);
345
+ }
346
+ declare class NotLoggedInError extends AuthError {
347
+ constructor(message?: string);
348
+ }
349
+ declare class TokenExpiredError extends AuthError {
350
+ constructor(message?: string);
351
+ }
352
+ declare function getAuthPath(): string;
353
+ declare function saveAuthData(data: AuthData): void;
354
+ /**
355
+ * Loads authentication data from ~/.local/share/offworld/auth.json
356
+ * Returns null if file doesn't exist or is invalid
357
+ */
358
+ declare function loadAuthData(): AuthData | null;
359
+ /**
360
+ * Clears stored authentication data
361
+ * @returns true if auth file was deleted, false if it didn't exist
362
+ */
363
+ declare function clearAuthData(): boolean;
364
+ declare function getToken(): Promise<string>;
365
+ /**
366
+ * Gets the current authentication token, or null if not logged in
367
+ * Does not throw errors
368
+ */
369
+ declare function getTokenOrNull(): Promise<string | null>;
370
+ declare function isLoggedIn(): Promise<boolean>;
371
+ declare function getAuthStatus(): Promise<AuthStatus>;
372
+ declare function refreshAccessToken(): Promise<AuthData>;
373
+ //#endregion
374
+ //#region src/reference.d.ts
375
+ interface InstallReferenceMeta {
376
+ /** ISO timestamp when the reference was generated */
377
+ referenceUpdatedAt: string;
378
+ /** Git commit SHA at time of generation */
379
+ commitSha: string;
380
+ /** SDK version used for generation */
381
+ version: string;
382
+ }
383
+ /**
384
+ * Ensures the global SKILL.md exists and symlinks the offworld/ directory to all agent skill directories.
385
+ *
386
+ * Creates:
387
+ * - ~/.local/share/offworld/skill/offworld/SKILL.md (static routing template)
388
+ * - ~/.local/share/offworld/skill/offworld/assets/ (for map.json)
389
+ * - ~/.local/share/offworld/skill/offworld/references/ (for reference files)
390
+ * - Symlinks entire offworld/ directory to each agent's skill directory
391
+ */
392
+ declare function installGlobalSkill(): void;
393
+ /**
394
+ * Install a reference file for a specific repository.
395
+ *
396
+ * Creates:
397
+ * - ~/.local/share/offworld/skill/offworld/references/{owner-repo}.md
398
+ * - ~/.local/share/offworld/meta/{owner-repo}/meta.json
399
+ * - Updates global map with reference info
400
+ *
401
+ * @param qualifiedName - Qualified key for map storage (e.g., "github.com:owner/repo" or "local:name")
402
+ * @param fullName - Full repo name for file naming (e.g., "owner/repo")
403
+ * @param localPath - Absolute path to the cloned repository
404
+ * @param referenceContent - The generated reference markdown content
405
+ * @param meta - Metadata about the generation (referenceUpdatedAt, commitSha, version)
406
+ * @param keywords - Optional array of keywords for search/routing
407
+ */
408
+ declare function installReference(qualifiedName: string, fullName: string, localPath: string, referenceContent: string, meta: InstallReferenceMeta, keywords?: string[]): void;
409
+ //#endregion
410
+ //#region src/agents.d.ts
411
+ interface AgentConfig {
412
+ /** Agent identifier (matches AgentSchema enum) */
413
+ name: Agent;
414
+ /** Human-readable name for display */
415
+ displayName: string;
416
+ /** Project-level skill directory (relative path) */
417
+ skillsDir: string;
418
+ /** User-level skill directory (absolute with ~) */
419
+ globalSkillsDir: string;
420
+ /** Check if this agent is installed on the system */
421
+ detectInstalled: () => boolean;
422
+ }
423
+ declare const agents: Record<Agent, AgentConfig>;
424
+ /**
425
+ * Detect which agents are installed on the system.
426
+ * Checks for the existence of each agent's config directory.
427
+ *
428
+ * @returns Array of installed agent identifiers
429
+ */
430
+ declare function detectInstalledAgents(): Agent[];
431
+ /**
432
+ * Get the configuration for a specific agent.
433
+ *
434
+ * @param type - Agent identifier
435
+ * @returns AgentConfig for the specified agent
436
+ */
437
+ declare function getAgentConfig(type: Agent): AgentConfig;
438
+ /**
439
+ * Get all agent configurations as an array.
440
+ *
441
+ * @returns Array of all agent configurations
442
+ */
443
+ declare function getAllAgentConfigs(): AgentConfig[];
444
+ //#endregion
445
+ //#region src/manifest.d.ts
446
+ /**
447
+ * Dependency manifest parsing for multiple package ecosystems
448
+ */
449
+ type ManifestType = "npm" | "python" | "rust" | "go" | "unknown";
450
+ interface Dependency {
451
+ name: string;
452
+ version?: string;
453
+ dev: boolean;
454
+ }
455
+ /**
456
+ * Detects the manifest type in a directory
457
+ */
458
+ declare function detectManifestType(dir: string): ManifestType;
459
+ /**
460
+ * Parses dependencies from manifest files
461
+ */
462
+ declare function parseDependencies(dir: string): Dependency[];
463
+ //#endregion
464
+ //#region src/dep-mappings.d.ts
465
+ /**
466
+ * Dependency name to GitHub repo resolution:
467
+ * 1. Query npm registry for repository.url
468
+ * 2. Fall back to FALLBACK_MAPPINGS for packages missing repository field
469
+ * 3. Return unknown (caller handles)
470
+ */
471
+ type ResolvedDep = {
472
+ dep: string;
473
+ repo: string | null;
474
+ source: "npm" | "fallback" | "unknown";
475
+ };
476
+ /**
477
+ * Fallback mappings for packages where npm registry doesn't have repository.url.
478
+ * Only add packages here that genuinely don't have the field set.
479
+ */
480
+ declare const FALLBACK_MAPPINGS: Record<string, string>;
481
+ /**
482
+ * Fallback to npm registry to extract repository.url.
483
+ * Returns null if package not found, no repo field, or not a GitHub repo.
484
+ */
485
+ declare function resolveFromNpm(packageName: string): Promise<string | null>;
486
+ /**
487
+ * Resolution order:
488
+ * 1. Query npm registry for repository.url
489
+ * 2. Check FALLBACK_MAPPINGS for packages missing repository field
490
+ * 3. Return unknown
491
+ */
492
+ declare function resolveDependencyRepo(dep: string): Promise<ResolvedDep>;
493
+ //#endregion
494
+ //#region src/reference-matcher.d.ts
495
+ type ReferenceStatus = "installed" | "remote" | "generate" | "unknown";
496
+ interface ReferenceMatch {
497
+ /** Dependency name */
498
+ dep: string;
499
+ /** GitHub repo (owner/repo) or null if unknown */
500
+ repo: string | null;
501
+ /** Reference availability status */
502
+ status: ReferenceStatus;
503
+ /** Resolution source: 'npm' | 'fallback' | 'unknown' */
504
+ source: "npm" | "fallback" | "unknown";
505
+ }
506
+ /**
507
+ * Check if a reference is installed locally.
508
+ * A reference is considered installed if {owner-repo}.md exists in offworld/references/.
509
+ *
510
+ * @param repo - Repo name in owner/repo format
511
+ * @returns true if reference is installed locally
512
+ */
513
+ declare function isReferenceInstalled(repo: string): boolean;
514
+ /**
515
+ * Match dependencies to their reference availability status.
516
+ *
517
+ * Status logic:
518
+ * - installed: {owner-repo}.md exists in offworld/references/
519
+ * - remote: Reference exists on offworld.sh (quick pull)
520
+ * - generate: Has valid GitHub repo but needs AI generation (slow, uses tokens)
521
+ * - unknown: No GitHub repo found
522
+ *
523
+ * @param resolvedDeps - Array of resolved dependencies with repo info
524
+ * @returns Array of reference matches with status
525
+ */
526
+ declare function matchDependenciesToReferences(resolvedDeps: ResolvedDep[]): ReferenceMatch[];
527
+ /**
528
+ * Match dependencies to their reference availability status with remote check.
529
+ * This is async because it checks the remote server for each dependency.
530
+ *
531
+ * Status logic:
532
+ * - installed: {owner-repo}.md exists in offworld/references/
533
+ * - remote: Reference exists on offworld.sh (quick pull)
534
+ * - generate: Has valid GitHub repo but needs AI generation (slow, uses tokens)
535
+ * - unknown: No GitHub repo found
536
+ *
537
+ * @param resolvedDeps - Array of resolved dependencies with repo info
538
+ * @returns Promise of array of reference matches with status
539
+ */
540
+ declare function matchDependenciesToReferencesWithRemoteCheck(resolvedDeps: ResolvedDep[]): Promise<ReferenceMatch[]>;
541
+ //#endregion
542
+ //#region src/repo-manager.d.ts
543
+ interface RepoStatusSummary {
544
+ total: number;
545
+ withReference: number;
546
+ missing: number;
547
+ diskBytes: number;
548
+ }
549
+ interface RepoStatusOptions {
550
+ onProgress?: (current: number, total: number, repo: string) => void;
551
+ }
552
+ interface UpdateAllOptions {
553
+ pattern?: string;
554
+ dryRun?: boolean;
555
+ /** Convert shallow clones to full clones */
556
+ unshallow?: boolean;
557
+ onProgress?: (repo: string, status: "updating" | "updated" | "skipped" | "error" | "unshallowed", message?: string) => void;
558
+ }
559
+ interface UpdateAllResult {
560
+ updated: string[];
561
+ skipped: string[];
562
+ unshallowed: string[];
563
+ errors: Array<{
564
+ repo: string;
565
+ error: string;
566
+ }>;
567
+ }
568
+ interface PruneOptions {
569
+ dryRun?: boolean;
570
+ onProgress?: (repo: string, reason: string) => void;
571
+ }
572
+ interface PruneResult {
573
+ removedFromIndex: string[];
574
+ orphanedDirs: string[];
575
+ }
576
+ interface GcOptions {
577
+ olderThanDays?: number;
578
+ withoutReference?: boolean;
579
+ dryRun?: boolean;
580
+ onProgress?: (repo: string, reason: string, sizeBytes?: number) => void;
581
+ }
582
+ interface GcResult {
583
+ removed: Array<{
584
+ repo: string;
585
+ reason: string;
586
+ sizeBytes: number;
587
+ }>;
588
+ freedBytes: number;
589
+ }
590
+ declare function getRepoStatus(options?: RepoStatusOptions): Promise<RepoStatusSummary>;
591
+ declare function updateAllRepos(options?: UpdateAllOptions): Promise<UpdateAllResult>;
592
+ declare function pruneRepos(options?: PruneOptions): Promise<PruneResult>;
593
+ declare function gcRepos(options?: GcOptions): Promise<GcResult>;
594
+ interface DiscoverOptions {
595
+ repoRoot?: string;
596
+ dryRun?: boolean;
597
+ onProgress?: (repo: string, provider: string) => void;
598
+ }
599
+ interface DiscoverResult {
600
+ discovered: Array<{
601
+ fullName: string;
602
+ qualifiedName: string;
603
+ localPath: string;
604
+ }>;
605
+ alreadyIndexed: number;
606
+ }
607
+ declare function discoverRepos(options?: DiscoverOptions): Promise<DiscoverResult>;
608
+ //#endregion
609
+ //#region src/models.d.ts
610
+ /**
611
+ * Simplified provider info for CLI display
612
+ */
613
+ interface ProviderInfo {
614
+ id: string;
615
+ name: string;
616
+ env: string[];
617
+ }
618
+ /**
619
+ * Simplified model info for CLI display
620
+ */
621
+ interface ModelInfo {
622
+ id: string;
623
+ name: string;
624
+ reasoning: boolean;
625
+ experimental?: boolean;
626
+ status?: "alpha" | "beta" | "deprecated";
627
+ }
628
+ /**
629
+ * Full provider with models for CLI display
630
+ */
631
+ interface ProviderWithModels extends ProviderInfo {
632
+ models: ModelInfo[];
633
+ }
634
+ /**
635
+ * List all available providers from models.dev
636
+ */
637
+ declare function listProviders(): Promise<ProviderInfo[]>;
638
+ /**
639
+ * Get a specific provider with all its models
640
+ */
641
+ declare function getProvider(providerId: string): Promise<ProviderWithModels | null>;
642
+ /**
643
+ * Get all providers with their models
644
+ */
645
+ declare function listProvidersWithModels(): Promise<ProviderWithModels[]>;
646
+ /**
647
+ * Validate that a provider/model combination exists
648
+ */
649
+ declare function validateProviderModel(providerId: string, modelId: string): Promise<{
650
+ valid: boolean;
651
+ error?: string;
652
+ }>;
653
+ //#endregion
654
+ export { AuthData as $, getMetaRoot as $t, pruneRepos as A, updateRepo as At, resolveFromNpm as B, removeGlobalMapEntry as Bt, RepoStatusOptions as C, getCommitDistance as Ct, discoverRepos as D, listRepos as Dt, UpdateAllResult as E, isShallowClone as Et, matchDependenciesToReferences as F, getMapEntry as Ft, AgentConfig as G, PathNotFoundError as Gt, ManifestType as H, writeGlobalMap as Ht, matchDependenciesToReferencesWithRemoteCheck as I, getProjectMapPath as It, getAgentConfig as J, parseRepoInput as Jt, agents as K, RepoSourceError as Kt, FALLBACK_MAPPINGS as L, resolveRepoKey as Lt, ReferenceMatch as M, MapEntry as Mt, ReferenceStatus as N, SearchMapOptions as Nt, gcRepos as O, removeRepo as Ot, isReferenceInstalled as P, SearchResult as Pt, installReference as Q, getMetaPath as Qt, ResolvedDep as R, searchMap as Rt, PruneResult as S, getClonedRepoPath as St, UpdateAllOptions as T, isRepoCloned as Tt, detectManifestType as U, writeProjectMap as Ut, Dependency as V, upsertGlobalMapEntry as Vt, parseDependencies as W, NotGitRepoError as Wt, InstallReferenceMeta as X, expandTilde as Xt, getAllAgentConfigs as Y, Paths as Yt, installGlobalSkill as Z, getConfigPath as Zt, DiscoverOptions as _, RepoExistsError as _t, GlobalMap$1 as a, toMetaDirName as an, getAuthPath as at, GcResult as b, UpdateResult as bt, ProjectMapRepoEntry$1 as c, DEFAULT_IGNORE_PATTERNS as cn, getTokenOrNull as ct, ProviderInfo as d, refreshAccessToken as dt, getReferencePath as en, AuthError as et, ProviderWithModels as f, saveAuthData as ft, validateProviderModel as g, RemoveOptions as gt, listProvidersWithModels as h, GitError as ht, FileRole as i, saveConfig as in, clearAuthData as it, updateAllRepos as j, GetMapEntryOptions as jt, getRepoStatus as k, unshallowRepo as kt, RepoSource$1 as l, VERSION as ln, isLoggedIn as lt, listProviders as m, CloneOptions as mt, FileIndex as n, getRepoRoot as nn, NotLoggedInError as nt, GlobalMapRepoEntry$1 as o, toReferenceFileName as on, getAuthStatus as ot, getProvider as p, CloneError as pt, detectInstalledAgents as q, getReferenceFileNameForSource as qt, FileIndexEntry as r, loadConfig as rn, TokenExpiredError as rt, ProjectMap$1 as s, toReferenceName as sn, getToken as st, Config$1 as t, getRepoPath as tn, AuthStatus as tt, ModelInfo as u, loadAuthData as ut, DiscoverResult as v, RepoNotFoundError as vt, RepoStatusSummary as w, getCommitSha as wt, PruneOptions as x, cloneRepo as xt, GcOptions as y, UpdateOptions as yt, resolveDependencyRepo as z, readGlobalMap as zt };
655
+ //# sourceMappingURL=public-MYVLaKUi.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-MYVLaKUi.d.mts","names":[],"sources":["../src/constants.ts","../src/config.ts","../src/paths.ts","../src/repo-source.ts","../src/index-manager.ts","../src/map.ts","../src/clone.ts","../src/auth.ts","../src/reference.ts","../src/agents.ts","../src/manifest.ts","../src/dep-mappings.ts","../src/reference-matcher.ts","../src/repo-manager.ts","../src/models.ts"],"mappings":";;;;;;AAKA;AAAA,cAAa,OAAA;;;;AAMb;cAAa,uBAAA;;;;;;;iBCGG,WAAA,CAAA;AAAA,iBAIA,WAAA,CAAY,MAA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