@offworld/sdk 0.1.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/README.md +127 -0
- package/dist/index.d.mts +1008 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3670 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +43 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,1008 @@
|
|
|
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.1.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$1): 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$1): 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$1;
|
|
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$1>): Config$1;
|
|
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$1;
|
|
153
|
+
declare function getReferenceFileNameForSource(source: RepoSource$1): 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$1;
|
|
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$1): 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$1): 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$1>): void;
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/map.d.ts
|
|
189
|
+
interface MapEntry {
|
|
190
|
+
scope: "project" | "global";
|
|
191
|
+
qualifiedName: string;
|
|
192
|
+
entry: GlobalMapRepoEntry$1 | ProjectMapRepoEntry$1;
|
|
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$1 | ProjectMap$1): 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$1;
|
|
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
|
+
/**
|
|
273
|
+
* Get the current commit SHA for a repository
|
|
274
|
+
*/
|
|
275
|
+
declare function getCommitSha(repoPath: string): string;
|
|
276
|
+
/**
|
|
277
|
+
* Get the number of commits between two SHAs.
|
|
278
|
+
* Returns the number of commits from `olderSha` to `newerSha`.
|
|
279
|
+
* Returns null if the distance cannot be determined (e.g., shallow clone without the commit).
|
|
280
|
+
*
|
|
281
|
+
* @param repoPath - Path to the git repository
|
|
282
|
+
* @param olderSha - The older commit SHA (e.g., remote skill's commit)
|
|
283
|
+
* @param newerSha - The newer commit SHA (e.g., current HEAD), defaults to HEAD
|
|
284
|
+
*/
|
|
285
|
+
declare function getCommitDistance(repoPath: string, olderSha: string, newerSha?: string): number | null;
|
|
286
|
+
/**
|
|
287
|
+
* Clone a remote repository to the local repo root.
|
|
288
|
+
*
|
|
289
|
+
* @param source - Remote repo source from parseRepoInput()
|
|
290
|
+
* @param options - Clone options (shallow, branch, config)
|
|
291
|
+
* @returns The local path where the repo was cloned
|
|
292
|
+
* @throws RepoExistsError if repo already exists (unless force is true)
|
|
293
|
+
* @throws GitError if clone fails
|
|
294
|
+
*/
|
|
295
|
+
declare function cloneRepo(source: RemoteRepoSource, options?: CloneOptions): Promise<string>;
|
|
296
|
+
/**
|
|
297
|
+
* Check if a repository is a shallow clone.
|
|
298
|
+
*/
|
|
299
|
+
declare function isShallowClone(repoPath: string): boolean;
|
|
300
|
+
/**
|
|
301
|
+
* Convert a shallow clone to a full clone by fetching all history.
|
|
302
|
+
* Returns true if the repo was shallow and is now unshallowed.
|
|
303
|
+
* Returns false if the repo was already a full clone.
|
|
304
|
+
*/
|
|
305
|
+
declare function unshallowRepo(repoPath: string): Promise<boolean>;
|
|
306
|
+
interface UpdateResult {
|
|
307
|
+
/** Whether any updates were fetched */
|
|
308
|
+
updated: boolean;
|
|
309
|
+
/** Previous commit SHA before update */
|
|
310
|
+
previousSha: string;
|
|
311
|
+
/** Current commit SHA after update */
|
|
312
|
+
currentSha: string;
|
|
313
|
+
/** Whether the repo was unshallowed */
|
|
314
|
+
unshallowed?: boolean;
|
|
315
|
+
}
|
|
316
|
+
interface UpdateOptions {
|
|
317
|
+
/** Convert shallow clone to full clone */
|
|
318
|
+
unshallow?: boolean;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Update a cloned repository by running git fetch and pull.
|
|
322
|
+
*
|
|
323
|
+
* @param qualifiedName - The qualified name of the repo (e.g., "github.com:owner/repo")
|
|
324
|
+
* @param options - Update options
|
|
325
|
+
* @returns Update result with commit SHAs
|
|
326
|
+
* @throws RepoNotFoundError if repo not in index
|
|
327
|
+
* @throws GitError if fetch/pull fails
|
|
328
|
+
*/
|
|
329
|
+
declare function updateRepo(qualifiedName: string, options?: UpdateOptions): Promise<UpdateResult>;
|
|
330
|
+
interface RemoveOptions {
|
|
331
|
+
/** Only remove reference files (keep cloned repo) */
|
|
332
|
+
referenceOnly?: boolean;
|
|
333
|
+
/** Only remove cloned repo (keep reference files) */
|
|
334
|
+
repoOnly?: boolean;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Remove a cloned repository and its reference data.
|
|
338
|
+
*
|
|
339
|
+
* @param qualifiedName - The qualified name of the repo
|
|
340
|
+
* @param options - Remove options
|
|
341
|
+
* @returns true if removed, false if not found
|
|
342
|
+
*/
|
|
343
|
+
declare function removeRepo(qualifiedName: string, options?: RemoveOptions): Promise<boolean>;
|
|
344
|
+
/**
|
|
345
|
+
* List all cloned repositories from the global map.
|
|
346
|
+
*
|
|
347
|
+
* @returns Array of qualified names
|
|
348
|
+
*/
|
|
349
|
+
declare function listRepos(): string[];
|
|
350
|
+
/**
|
|
351
|
+
* Check if a repository is cloned and in the map.
|
|
352
|
+
*
|
|
353
|
+
* @param qualifiedName - The qualified name of the repo
|
|
354
|
+
* @returns true if repo exists in map and on disk
|
|
355
|
+
*/
|
|
356
|
+
declare function isRepoCloned(qualifiedName: string): boolean;
|
|
357
|
+
/**
|
|
358
|
+
* Get the local path for a cloned repository.
|
|
359
|
+
*
|
|
360
|
+
* @param qualifiedName - The qualified name of the repo
|
|
361
|
+
* @returns The local path or undefined if not cloned
|
|
362
|
+
*/
|
|
363
|
+
declare function getClonedRepoPath(qualifiedName: string): string | undefined;
|
|
364
|
+
//#endregion
|
|
365
|
+
//#region src/ai/opencode.d.ts
|
|
366
|
+
interface StreamPromptOptions {
|
|
367
|
+
prompt: string;
|
|
368
|
+
cwd: string;
|
|
369
|
+
systemPrompt?: string;
|
|
370
|
+
provider?: string;
|
|
371
|
+
model?: string;
|
|
372
|
+
/** Timeout in milliseconds. Set to 0 or undefined for no timeout. */
|
|
373
|
+
timeoutMs?: number;
|
|
374
|
+
onDebug?: (message: string) => void;
|
|
375
|
+
onStream?: (text: string) => void;
|
|
376
|
+
}
|
|
377
|
+
interface StreamPromptResult {
|
|
378
|
+
text: string;
|
|
379
|
+
sessionId: string;
|
|
380
|
+
durationMs: number;
|
|
381
|
+
}
|
|
382
|
+
declare function streamPrompt(options: StreamPromptOptions): Promise<StreamPromptResult>;
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region src/ai/errors.d.ts
|
|
385
|
+
/**
|
|
386
|
+
* Base class for OpenCode reference errors
|
|
387
|
+
*/
|
|
388
|
+
declare class OpenCodeReferenceError extends Error {
|
|
389
|
+
readonly details?: unknown | undefined;
|
|
390
|
+
readonly _tag: string;
|
|
391
|
+
constructor(message: string, details?: unknown | undefined);
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Error when the @opencode-ai/sdk package is not installed
|
|
395
|
+
*/
|
|
396
|
+
declare class OpenCodeSDKError extends OpenCodeReferenceError {
|
|
397
|
+
readonly _tag: "OpenCodeSDKError";
|
|
398
|
+
constructor();
|
|
399
|
+
}
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/sync.d.ts
|
|
402
|
+
declare class SyncError extends Error {
|
|
403
|
+
constructor(message: string);
|
|
404
|
+
}
|
|
405
|
+
declare class NetworkError extends SyncError {
|
|
406
|
+
readonly statusCode?: number | undefined;
|
|
407
|
+
constructor(message: string, statusCode?: number | undefined);
|
|
408
|
+
}
|
|
409
|
+
declare class AuthenticationError extends SyncError {
|
|
410
|
+
constructor(message?: string);
|
|
411
|
+
}
|
|
412
|
+
declare class RateLimitError extends SyncError {
|
|
413
|
+
constructor(message?: string);
|
|
414
|
+
}
|
|
415
|
+
declare class ConflictError extends SyncError {
|
|
416
|
+
readonly remoteCommitSha?: string | undefined;
|
|
417
|
+
constructor(message?: string, remoteCommitSha?: string | undefined);
|
|
418
|
+
}
|
|
419
|
+
declare class CommitExistsError extends SyncError {
|
|
420
|
+
constructor(message?: string);
|
|
421
|
+
}
|
|
422
|
+
declare class InvalidInputError extends SyncError {
|
|
423
|
+
constructor(message: string);
|
|
424
|
+
}
|
|
425
|
+
declare class InvalidReferenceError extends SyncError {
|
|
426
|
+
constructor(message: string);
|
|
427
|
+
}
|
|
428
|
+
declare class RepoNotFoundError$1 extends SyncError {
|
|
429
|
+
constructor(message?: string);
|
|
430
|
+
}
|
|
431
|
+
declare class LowStarsError extends SyncError {
|
|
432
|
+
constructor(message?: string);
|
|
433
|
+
}
|
|
434
|
+
declare class PrivateRepoError extends SyncError {
|
|
435
|
+
constructor(message?: string);
|
|
436
|
+
}
|
|
437
|
+
declare class CommitNotFoundError extends SyncError {
|
|
438
|
+
constructor(message?: string);
|
|
439
|
+
}
|
|
440
|
+
declare class GitHubError extends SyncError {
|
|
441
|
+
constructor(message?: string);
|
|
442
|
+
}
|
|
443
|
+
declare class PushNotAllowedError extends SyncError {
|
|
444
|
+
readonly reason: "local" | "not-github";
|
|
445
|
+
constructor(message: string, reason: "local" | "not-github");
|
|
446
|
+
}
|
|
447
|
+
/** Reference data structure for sync operations */
|
|
448
|
+
interface ReferenceData {
|
|
449
|
+
fullName: string;
|
|
450
|
+
referenceName: string;
|
|
451
|
+
referenceDescription: string;
|
|
452
|
+
referenceContent: string;
|
|
453
|
+
commitSha: string;
|
|
454
|
+
generatedAt: string;
|
|
455
|
+
}
|
|
456
|
+
/** Response from pull query */
|
|
457
|
+
interface PullResponse {
|
|
458
|
+
fullName: string;
|
|
459
|
+
referenceName: string;
|
|
460
|
+
referenceDescription: string;
|
|
461
|
+
referenceContent: string;
|
|
462
|
+
commitSha: string;
|
|
463
|
+
generatedAt: string;
|
|
464
|
+
}
|
|
465
|
+
/** Response from check query */
|
|
466
|
+
interface CheckResponse {
|
|
467
|
+
exists: boolean;
|
|
468
|
+
commitSha?: string;
|
|
469
|
+
generatedAt?: string;
|
|
470
|
+
}
|
|
471
|
+
/** Response from push mutation */
|
|
472
|
+
interface PushResponse {
|
|
473
|
+
success: boolean;
|
|
474
|
+
message?: string;
|
|
475
|
+
}
|
|
476
|
+
/** Staleness check result */
|
|
477
|
+
interface StalenessResult {
|
|
478
|
+
isStale: boolean;
|
|
479
|
+
localCommitSha?: string;
|
|
480
|
+
remoteCommitSha?: string;
|
|
481
|
+
}
|
|
482
|
+
/** Can push result */
|
|
483
|
+
interface CanPushResult {
|
|
484
|
+
allowed: boolean;
|
|
485
|
+
reason?: string;
|
|
486
|
+
stars?: number;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Fetches reference from the remote server
|
|
490
|
+
* @param fullName - Repository full name (owner/repo)
|
|
491
|
+
* @returns Reference data or null if not found
|
|
492
|
+
*/
|
|
493
|
+
declare function pullReference(fullName: string): Promise<PullResponse | null>;
|
|
494
|
+
/**
|
|
495
|
+
* Fetches a specific reference by name from the remote server
|
|
496
|
+
* @param fullName - Repository full name (owner/repo)
|
|
497
|
+
* @param referenceName - Specific reference name to pull
|
|
498
|
+
* @returns Reference data or null if not found
|
|
499
|
+
*/
|
|
500
|
+
declare function pullReferenceByName(fullName: string, referenceName: string): Promise<PullResponse | null>;
|
|
501
|
+
/**
|
|
502
|
+
* Pushes reference to the remote server
|
|
503
|
+
* All validation happens server-side
|
|
504
|
+
* @param reference - Reference data to push
|
|
505
|
+
* @param token - Authentication token
|
|
506
|
+
* @returns Push result
|
|
507
|
+
*/
|
|
508
|
+
declare function pushReference(reference: ReferenceData, token: string): Promise<PushResponse>;
|
|
509
|
+
/**
|
|
510
|
+
* Checks if reference exists on remote server (lightweight check)
|
|
511
|
+
* @param fullName - Repository full name (owner/repo)
|
|
512
|
+
* @returns Check result
|
|
513
|
+
*/
|
|
514
|
+
declare function checkRemote(fullName: string): Promise<CheckResponse>;
|
|
515
|
+
/**
|
|
516
|
+
* Checks if a specific reference exists on the remote server
|
|
517
|
+
* @param fullName - Repository full name (owner/repo)
|
|
518
|
+
* @param referenceName - Specific reference name to check
|
|
519
|
+
* @returns Check result
|
|
520
|
+
*/
|
|
521
|
+
declare function checkRemoteByName(fullName: string, referenceName: string): Promise<CheckResponse>;
|
|
522
|
+
/**
|
|
523
|
+
* Compares local vs remote commit SHA to check staleness
|
|
524
|
+
* @param fullName - Repository full name (owner/repo)
|
|
525
|
+
* @param localCommitSha - Local commit SHA
|
|
526
|
+
* @returns Staleness result
|
|
527
|
+
*/
|
|
528
|
+
declare function checkStaleness(fullName: string, localCommitSha: string): Promise<StalenessResult>;
|
|
529
|
+
/** GitHub repository metadata */
|
|
530
|
+
interface GitHubRepoMetadata {
|
|
531
|
+
stars: number;
|
|
532
|
+
description?: string;
|
|
533
|
+
language?: string;
|
|
534
|
+
defaultBranch: string;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Fetches GitHub repository metadata
|
|
538
|
+
* @param owner - Repository owner
|
|
539
|
+
* @param repo - Repository name
|
|
540
|
+
* @returns Repository metadata or null on error
|
|
541
|
+
*/
|
|
542
|
+
declare function fetchGitHubMetadata(owner: string, repo: string): Promise<GitHubRepoMetadata | null>;
|
|
543
|
+
/**
|
|
544
|
+
* Fetches GitHub repository stars
|
|
545
|
+
* @param owner - Repository owner
|
|
546
|
+
* @param repo - Repository name
|
|
547
|
+
* @returns Number of stars, or 0 on error
|
|
548
|
+
*/
|
|
549
|
+
declare function fetchRepoStars(owner: string, repo: string): Promise<number>;
|
|
550
|
+
/**
|
|
551
|
+
* Checks if a repository can be pushed to offworld.sh (client-side quick checks)
|
|
552
|
+
* Note: Star count and other validations happen server-side
|
|
553
|
+
*
|
|
554
|
+
* @param source - Repository source
|
|
555
|
+
* @returns Can push result
|
|
556
|
+
*/
|
|
557
|
+
declare function canPushToWeb(source: RepoSource$1): CanPushResult;
|
|
558
|
+
/**
|
|
559
|
+
* Validates that a source can be pushed and throws appropriate error if not
|
|
560
|
+
* Note: This only does quick client-side checks. Full validation happens server-side.
|
|
561
|
+
* @param source - Repository source
|
|
562
|
+
* @throws PushNotAllowedError if push is not allowed
|
|
563
|
+
*/
|
|
564
|
+
declare function validatePushAllowed(source: RepoSource$1): void;
|
|
565
|
+
//#endregion
|
|
566
|
+
//#region src/auth.d.ts
|
|
567
|
+
/**
|
|
568
|
+
* Authentication utilities for offworld CLI
|
|
569
|
+
*/
|
|
570
|
+
/** Stored authentication data */
|
|
571
|
+
interface AuthData {
|
|
572
|
+
token: string;
|
|
573
|
+
expiresAt?: string;
|
|
574
|
+
workosId?: string;
|
|
575
|
+
refreshToken?: string;
|
|
576
|
+
email?: string;
|
|
577
|
+
}
|
|
578
|
+
/** Authentication status */
|
|
579
|
+
interface AuthStatus {
|
|
580
|
+
isLoggedIn: boolean;
|
|
581
|
+
email?: string;
|
|
582
|
+
workosId?: string;
|
|
583
|
+
expiresAt?: string;
|
|
584
|
+
}
|
|
585
|
+
declare class AuthError extends Error {
|
|
586
|
+
constructor(message: string);
|
|
587
|
+
}
|
|
588
|
+
declare class NotLoggedInError extends AuthError {
|
|
589
|
+
constructor(message?: string);
|
|
590
|
+
}
|
|
591
|
+
declare class TokenExpiredError extends AuthError {
|
|
592
|
+
constructor(message?: string);
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Returns the auth file path using XDG Base Directory spec
|
|
596
|
+
* Location: ~/.local/share/offworld/auth.json
|
|
597
|
+
*/
|
|
598
|
+
declare function getAuthPath(): string;
|
|
599
|
+
/**
|
|
600
|
+
* Saves authentication data to ~/.local/share/offworld/auth.json
|
|
601
|
+
* Creates directory if it doesn't exist
|
|
602
|
+
*/
|
|
603
|
+
declare function saveAuthData(data: AuthData): void;
|
|
604
|
+
/**
|
|
605
|
+
* Loads authentication data from ~/.local/share/offworld/auth.json
|
|
606
|
+
* Returns null if file doesn't exist or is invalid
|
|
607
|
+
*/
|
|
608
|
+
declare function loadAuthData(): AuthData | null;
|
|
609
|
+
/**
|
|
610
|
+
* Clears stored authentication data
|
|
611
|
+
* @returns true if auth file was deleted, false if it didn't exist
|
|
612
|
+
*/
|
|
613
|
+
declare function clearAuthData(): boolean;
|
|
614
|
+
/**
|
|
615
|
+
* Gets the current authentication token
|
|
616
|
+
* Auto-refreshes if token expires within 1 minute
|
|
617
|
+
* @throws NotLoggedInError if not logged in
|
|
618
|
+
* @throws TokenExpiredError if token is expired and refresh fails
|
|
619
|
+
*/
|
|
620
|
+
declare function getToken(): Promise<string>;
|
|
621
|
+
/**
|
|
622
|
+
* Gets the current authentication token, or null if not logged in
|
|
623
|
+
* Does not throw errors
|
|
624
|
+
*/
|
|
625
|
+
declare function getTokenOrNull(): Promise<string | null>;
|
|
626
|
+
/**
|
|
627
|
+
* Checks if user is logged in with valid token
|
|
628
|
+
*/
|
|
629
|
+
declare function isLoggedIn(): Promise<boolean>;
|
|
630
|
+
declare function getAuthStatus(): Promise<AuthStatus>;
|
|
631
|
+
/**
|
|
632
|
+
* Refreshes the access token using the stored refresh token
|
|
633
|
+
* @returns New auth data with refreshed token
|
|
634
|
+
* @throws AuthError if refresh fails
|
|
635
|
+
*/
|
|
636
|
+
declare function refreshAccessToken(): Promise<AuthData>;
|
|
637
|
+
//#endregion
|
|
638
|
+
//#region src/generate.d.ts
|
|
639
|
+
/**
|
|
640
|
+
* Simplified AI-only reference generation
|
|
641
|
+
*
|
|
642
|
+
* This module provides a streamlined approach to generating reference files
|
|
643
|
+
* by delegating all codebase exploration to the AI agent via OpenCode.
|
|
644
|
+
*/
|
|
645
|
+
interface GenerateReferenceOptions {
|
|
646
|
+
/** AI provider ID (e.g., "anthropic", "openai"). Defaults to config value. */
|
|
647
|
+
provider?: string;
|
|
648
|
+
/** AI model ID. Defaults to config value. */
|
|
649
|
+
model?: string;
|
|
650
|
+
/** Debug callback for detailed logging */
|
|
651
|
+
onDebug?: (message: string) => void;
|
|
652
|
+
/** Stream callback for real-time AI output */
|
|
653
|
+
onStream?: (text: string) => void;
|
|
654
|
+
}
|
|
655
|
+
interface GenerateReferenceResult {
|
|
656
|
+
/** The generated reference markdown content */
|
|
657
|
+
referenceContent: string;
|
|
658
|
+
/** The commit SHA at the time of generation */
|
|
659
|
+
commitSha: string;
|
|
660
|
+
}
|
|
661
|
+
interface InstallReferenceMeta {
|
|
662
|
+
/** ISO timestamp when the reference was generated */
|
|
663
|
+
referenceUpdatedAt: string;
|
|
664
|
+
/** Git commit SHA at time of generation */
|
|
665
|
+
commitSha: string;
|
|
666
|
+
/** SDK version used for generation */
|
|
667
|
+
version: string;
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Generate a reference markdown file for a repository using AI.
|
|
671
|
+
*
|
|
672
|
+
* Opens an OpenCode session and instructs the AI agent to explore the codebase
|
|
673
|
+
* using Read, Grep, and Glob tools, then produce a comprehensive reference.
|
|
674
|
+
*
|
|
675
|
+
* @param repoPath - Path to the repository to analyze
|
|
676
|
+
* @param repoName - Qualified name of the repo (e.g., "tanstack/query" or "my-local-repo")
|
|
677
|
+
* @param options - Generation options (provider, model, callbacks)
|
|
678
|
+
* @returns The generated reference content and commit SHA
|
|
679
|
+
*/
|
|
680
|
+
declare function generateReferenceWithAI(repoPath: string, repoName: string, options?: GenerateReferenceOptions): Promise<GenerateReferenceResult>;
|
|
681
|
+
/**
|
|
682
|
+
* Ensures the global SKILL.md exists and symlinks the offworld/ directory to all agent skill directories.
|
|
683
|
+
*
|
|
684
|
+
* Creates:
|
|
685
|
+
* - ~/.local/share/offworld/skill/offworld/SKILL.md (static routing template)
|
|
686
|
+
* - ~/.local/share/offworld/skill/offworld/assets/ (for map.json)
|
|
687
|
+
* - ~/.local/share/offworld/skill/offworld/references/ (for reference files)
|
|
688
|
+
* - Symlinks entire offworld/ directory to each agent's skill directory
|
|
689
|
+
*/
|
|
690
|
+
declare function installGlobalSkill(): void;
|
|
691
|
+
/**
|
|
692
|
+
* Install a reference file for a specific repository.
|
|
693
|
+
*
|
|
694
|
+
* Creates:
|
|
695
|
+
* - ~/.local/share/offworld/skill/offworld/references/{owner-repo}.md
|
|
696
|
+
* - ~/.local/share/offworld/meta/{owner-repo}/meta.json
|
|
697
|
+
* - Updates global map with reference info
|
|
698
|
+
*
|
|
699
|
+
* @param qualifiedName - Qualified key for map storage (e.g., "github.com:owner/repo" or "local:name")
|
|
700
|
+
* @param fullName - Full repo name for file naming (e.g., "owner/repo")
|
|
701
|
+
* @param localPath - Absolute path to the cloned repository
|
|
702
|
+
* @param referenceContent - The generated reference markdown content
|
|
703
|
+
* @param meta - Metadata about the generation (referenceUpdatedAt, commitSha, version)
|
|
704
|
+
* @param keywords - Optional array of keywords for search/routing
|
|
705
|
+
*/
|
|
706
|
+
declare function installReference(qualifiedName: string, fullName: string, localPath: string, referenceContent: string, meta: InstallReferenceMeta, keywords?: string[]): void;
|
|
707
|
+
//#endregion
|
|
708
|
+
//#region src/agents.d.ts
|
|
709
|
+
interface AgentConfig {
|
|
710
|
+
/** Agent identifier (matches AgentSchema enum) */
|
|
711
|
+
name: Agent;
|
|
712
|
+
/** Human-readable name for display */
|
|
713
|
+
displayName: string;
|
|
714
|
+
/** Project-level skill directory (relative path) */
|
|
715
|
+
skillsDir: string;
|
|
716
|
+
/** User-level skill directory (absolute with ~) */
|
|
717
|
+
globalSkillsDir: string;
|
|
718
|
+
/** Check if this agent is installed on the system */
|
|
719
|
+
detectInstalled: () => boolean;
|
|
720
|
+
}
|
|
721
|
+
declare const agents: Record<Agent, AgentConfig>;
|
|
722
|
+
/**
|
|
723
|
+
* Detect which agents are installed on the system.
|
|
724
|
+
* Checks for the existence of each agent's config directory.
|
|
725
|
+
*
|
|
726
|
+
* @returns Array of installed agent identifiers
|
|
727
|
+
*/
|
|
728
|
+
declare function detectInstalledAgents(): Agent[];
|
|
729
|
+
/**
|
|
730
|
+
* Get the configuration for a specific agent.
|
|
731
|
+
*
|
|
732
|
+
* @param type - Agent identifier
|
|
733
|
+
* @returns AgentConfig for the specified agent
|
|
734
|
+
*/
|
|
735
|
+
declare function getAgentConfig(type: Agent): AgentConfig;
|
|
736
|
+
/**
|
|
737
|
+
* Get all agent configurations as an array.
|
|
738
|
+
*
|
|
739
|
+
* @returns Array of all agent configurations
|
|
740
|
+
*/
|
|
741
|
+
declare function getAllAgentConfigs(): AgentConfig[];
|
|
742
|
+
//#endregion
|
|
743
|
+
//#region src/manifest.d.ts
|
|
744
|
+
/**
|
|
745
|
+
* Dependency manifest parsing for multiple package ecosystems
|
|
746
|
+
*/
|
|
747
|
+
type ManifestType = "npm" | "python" | "rust" | "go" | "unknown";
|
|
748
|
+
interface Dependency {
|
|
749
|
+
name: string;
|
|
750
|
+
version?: string;
|
|
751
|
+
dev: boolean;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Detects the manifest type in a directory
|
|
755
|
+
*/
|
|
756
|
+
declare function detectManifestType(dir: string): ManifestType;
|
|
757
|
+
/**
|
|
758
|
+
* Parses dependencies from manifest files
|
|
759
|
+
*/
|
|
760
|
+
declare function parseDependencies(dir: string): Dependency[];
|
|
761
|
+
//#endregion
|
|
762
|
+
//#region src/dep-mappings.d.ts
|
|
763
|
+
/**
|
|
764
|
+
* Three-tier dependency name to GitHub repo resolution:
|
|
765
|
+
* 1. KNOWN_MAPPINGS - hardcoded popular packages
|
|
766
|
+
* 2. npm registry fallback
|
|
767
|
+
* 3. User prompt (handled by caller)
|
|
768
|
+
*/
|
|
769
|
+
type ResolvedDep = {
|
|
770
|
+
dep: string;
|
|
771
|
+
repo: string | null;
|
|
772
|
+
source: "known" | "npm" | "unknown";
|
|
773
|
+
};
|
|
774
|
+
/**
|
|
775
|
+
* Hardcoded mappings for popular packages.
|
|
776
|
+
* Covers top ecosystems: React, Vue, Svelte, backend, database, validation, styling.
|
|
777
|
+
*/
|
|
778
|
+
declare const KNOWN_MAPPINGS: Record<string, string>;
|
|
779
|
+
/**
|
|
780
|
+
* Fallback to npm registry to extract repository.url.
|
|
781
|
+
* Returns null if package not found, no repo field, or not a GitHub repo.
|
|
782
|
+
*/
|
|
783
|
+
declare function resolveFromNpm(packageName: string): Promise<string | null>;
|
|
784
|
+
/**
|
|
785
|
+
* Three-tier resolution:
|
|
786
|
+
* 1. Check KNOWN_MAPPINGS
|
|
787
|
+
* 2. Query npm registry
|
|
788
|
+
* 3. Return unknown (caller prompts user)
|
|
789
|
+
*/
|
|
790
|
+
declare function resolveDependencyRepo(dep: string): Promise<ResolvedDep>;
|
|
791
|
+
//#endregion
|
|
792
|
+
//#region src/reference-matcher.d.ts
|
|
793
|
+
type ReferenceStatus = "installed" | "available" | "generate" | "unknown";
|
|
794
|
+
interface ReferenceMatch {
|
|
795
|
+
/** Dependency name */
|
|
796
|
+
dep: string;
|
|
797
|
+
/** GitHub repo (owner/repo) or null if unknown */
|
|
798
|
+
repo: string | null;
|
|
799
|
+
/** Reference availability status */
|
|
800
|
+
status: ReferenceStatus;
|
|
801
|
+
/** Resolution source: 'known' | 'npm' | 'unknown' */
|
|
802
|
+
source: "known" | "npm" | "unknown";
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Check if a reference is installed locally.
|
|
806
|
+
* A reference is considered installed if {owner-repo}.md exists in offworld/references/.
|
|
807
|
+
*
|
|
808
|
+
* @param repo - Repo name in owner/repo format
|
|
809
|
+
* @returns true if reference is installed locally
|
|
810
|
+
*/
|
|
811
|
+
declare function isReferenceInstalled(repo: string): boolean;
|
|
812
|
+
/**
|
|
813
|
+
* Match dependencies to their reference availability status.
|
|
814
|
+
*
|
|
815
|
+
* Status logic:
|
|
816
|
+
* - installed: {owner-repo}.md exists in offworld/references/
|
|
817
|
+
* - available: Has valid GitHub repo (can be cloned)
|
|
818
|
+
* - generate: Has valid GitHub repo but will need AI generation
|
|
819
|
+
* - unknown: No GitHub repo found
|
|
820
|
+
*
|
|
821
|
+
* Note: Since we don't have a reference registry/index, "available" and "generate"
|
|
822
|
+
* are the same. We use "available" for consistency and reserve "generate" for
|
|
823
|
+
* future use when we can distinguish pre-existing vs needs-generation.
|
|
824
|
+
*
|
|
825
|
+
* @param resolvedDeps - Array of resolved dependencies with repo info
|
|
826
|
+
* @returns Array of reference matches with status
|
|
827
|
+
*/
|
|
828
|
+
declare function matchDependenciesToReferences(resolvedDeps: ResolvedDep[]): ReferenceMatch[];
|
|
829
|
+
//#endregion
|
|
830
|
+
//#region src/agents-md.d.ts
|
|
831
|
+
/**
|
|
832
|
+
* AGENTS.md manipulation utilities
|
|
833
|
+
*
|
|
834
|
+
* Manages updating project AGENTS.md and agent-specific files with reference information.
|
|
835
|
+
*/
|
|
836
|
+
interface InstalledReference {
|
|
837
|
+
/** Dependency name */
|
|
838
|
+
dependency: string;
|
|
839
|
+
/** Reference identifier (matches reference file name without .md) */
|
|
840
|
+
reference: string;
|
|
841
|
+
/** Absolute path to reference file */
|
|
842
|
+
path: string;
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Update or append Project References section in a markdown file.
|
|
846
|
+
* If the section exists, replaces its content. Otherwise, appends to end.
|
|
847
|
+
*
|
|
848
|
+
* @param filePath - Path to markdown file
|
|
849
|
+
* @param references - Array of installed references
|
|
850
|
+
*/
|
|
851
|
+
declare function appendReferencesSection(filePath: string, references: InstalledReference[]): void;
|
|
852
|
+
/**
|
|
853
|
+
* Update AGENTS.md and agent-specific files with project references.
|
|
854
|
+
* Creates files if they don't exist.
|
|
855
|
+
*
|
|
856
|
+
* @param projectRoot - Project root directory
|
|
857
|
+
* @param references - Array of installed references to document
|
|
858
|
+
*/
|
|
859
|
+
declare function updateAgentFiles(projectRoot: string, references: InstalledReference[]): void;
|
|
860
|
+
//#endregion
|
|
861
|
+
//#region src/repo-manager.d.ts
|
|
862
|
+
interface RepoStatusSummary {
|
|
863
|
+
total: number;
|
|
864
|
+
withReference: number;
|
|
865
|
+
missing: number;
|
|
866
|
+
diskBytes: number;
|
|
867
|
+
}
|
|
868
|
+
interface RepoStatusOptions {
|
|
869
|
+
onProgress?: (current: number, total: number, repo: string) => void;
|
|
870
|
+
}
|
|
871
|
+
interface UpdateAllOptions {
|
|
872
|
+
pattern?: string;
|
|
873
|
+
dryRun?: boolean;
|
|
874
|
+
/** Convert shallow clones to full clones */
|
|
875
|
+
unshallow?: boolean;
|
|
876
|
+
onProgress?: (repo: string, status: "updating" | "updated" | "skipped" | "error" | "unshallowed", message?: string) => void;
|
|
877
|
+
}
|
|
878
|
+
interface UpdateAllResult {
|
|
879
|
+
updated: string[];
|
|
880
|
+
skipped: string[];
|
|
881
|
+
unshallowed: string[];
|
|
882
|
+
errors: Array<{
|
|
883
|
+
repo: string;
|
|
884
|
+
error: string;
|
|
885
|
+
}>;
|
|
886
|
+
}
|
|
887
|
+
interface PruneOptions {
|
|
888
|
+
dryRun?: boolean;
|
|
889
|
+
onProgress?: (repo: string, reason: string) => void;
|
|
890
|
+
}
|
|
891
|
+
interface PruneResult {
|
|
892
|
+
removedFromIndex: string[];
|
|
893
|
+
orphanedDirs: string[];
|
|
894
|
+
}
|
|
895
|
+
interface GcOptions {
|
|
896
|
+
olderThanDays?: number;
|
|
897
|
+
withoutReference?: boolean;
|
|
898
|
+
dryRun?: boolean;
|
|
899
|
+
onProgress?: (repo: string, reason: string, sizeBytes?: number) => void;
|
|
900
|
+
}
|
|
901
|
+
interface GcResult {
|
|
902
|
+
removed: Array<{
|
|
903
|
+
repo: string;
|
|
904
|
+
reason: string;
|
|
905
|
+
sizeBytes: number;
|
|
906
|
+
}>;
|
|
907
|
+
freedBytes: number;
|
|
908
|
+
}
|
|
909
|
+
declare function getRepoStatus(options?: RepoStatusOptions): Promise<RepoStatusSummary>;
|
|
910
|
+
declare function updateAllRepos(options?: UpdateAllOptions): Promise<UpdateAllResult>;
|
|
911
|
+
declare function pruneRepos(options?: PruneOptions): Promise<PruneResult>;
|
|
912
|
+
declare function gcRepos(options?: GcOptions): Promise<GcResult>;
|
|
913
|
+
interface DiscoverOptions {
|
|
914
|
+
repoRoot?: string;
|
|
915
|
+
dryRun?: boolean;
|
|
916
|
+
onProgress?: (repo: string, provider: string) => void;
|
|
917
|
+
}
|
|
918
|
+
interface DiscoverResult {
|
|
919
|
+
discovered: Array<{
|
|
920
|
+
fullName: string;
|
|
921
|
+
qualifiedName: string;
|
|
922
|
+
localPath: string;
|
|
923
|
+
}>;
|
|
924
|
+
alreadyIndexed: number;
|
|
925
|
+
}
|
|
926
|
+
declare function discoverRepos(options?: DiscoverOptions): Promise<DiscoverResult>;
|
|
927
|
+
//#endregion
|
|
928
|
+
//#region src/models.d.ts
|
|
929
|
+
/**
|
|
930
|
+
* Simplified provider info for CLI display
|
|
931
|
+
*/
|
|
932
|
+
interface ProviderInfo {
|
|
933
|
+
id: string;
|
|
934
|
+
name: string;
|
|
935
|
+
env: string[];
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Simplified model info for CLI display
|
|
939
|
+
*/
|
|
940
|
+
interface ModelInfo {
|
|
941
|
+
id: string;
|
|
942
|
+
name: string;
|
|
943
|
+
reasoning: boolean;
|
|
944
|
+
experimental?: boolean;
|
|
945
|
+
status?: "alpha" | "beta" | "deprecated";
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Full provider with models for CLI display
|
|
949
|
+
*/
|
|
950
|
+
interface ProviderWithModels extends ProviderInfo {
|
|
951
|
+
models: ModelInfo[];
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* List all available providers from models.dev
|
|
955
|
+
*/
|
|
956
|
+
declare function listProviders(): Promise<ProviderInfo[]>;
|
|
957
|
+
/**
|
|
958
|
+
* Get a specific provider with all its models
|
|
959
|
+
*/
|
|
960
|
+
declare function getProvider(providerId: string): Promise<ProviderWithModels | null>;
|
|
961
|
+
/**
|
|
962
|
+
* Get all providers with their models
|
|
963
|
+
*/
|
|
964
|
+
declare function listProvidersWithModels(): Promise<ProviderWithModels[]>;
|
|
965
|
+
/**
|
|
966
|
+
* Validate that a provider/model combination exists
|
|
967
|
+
*/
|
|
968
|
+
declare function validateProviderModel(providerId: string, modelId: string): Promise<{
|
|
969
|
+
valid: boolean;
|
|
970
|
+
error?: string;
|
|
971
|
+
}>;
|
|
972
|
+
//#endregion
|
|
973
|
+
//#region src/installation.d.ts
|
|
974
|
+
/**
|
|
975
|
+
* Installation utilities for upgrade/uninstall commands
|
|
976
|
+
*/
|
|
977
|
+
type InstallMethod = "curl" | "npm" | "pnpm" | "bun" | "brew" | "unknown";
|
|
978
|
+
/**
|
|
979
|
+
* Detect how offworld was installed
|
|
980
|
+
*/
|
|
981
|
+
declare function detectInstallMethod(): InstallMethod;
|
|
982
|
+
/**
|
|
983
|
+
* Get current installed version
|
|
984
|
+
*/
|
|
985
|
+
declare function getCurrentVersion(): string;
|
|
986
|
+
/**
|
|
987
|
+
* Fetch latest version from appropriate source
|
|
988
|
+
*/
|
|
989
|
+
declare function fetchLatestVersion(method?: InstallMethod): Promise<string | null>;
|
|
990
|
+
/**
|
|
991
|
+
* Execute upgrade for given method
|
|
992
|
+
*/
|
|
993
|
+
declare function executeUpgrade(method: InstallMethod, version: string): Promise<void>;
|
|
994
|
+
/**
|
|
995
|
+
* Execute uninstall for given method
|
|
996
|
+
*/
|
|
997
|
+
declare function executeUninstall(method: InstallMethod): Promise<void>;
|
|
998
|
+
/**
|
|
999
|
+
* Get shell config files to clean
|
|
1000
|
+
*/
|
|
1001
|
+
declare function getShellConfigFiles(): string[];
|
|
1002
|
+
/**
|
|
1003
|
+
* Clean PATH entries from shell config
|
|
1004
|
+
*/
|
|
1005
|
+
declare function cleanShellConfig(filePath: string): boolean;
|
|
1006
|
+
//#endregion
|
|
1007
|
+
export { type AgentConfig, type AuthData, AuthError, type AuthStatus, AuthenticationError, type CanPushResult, type CheckResponse, CloneError, type CloneOptions, CommitExistsError, CommitNotFoundError, type Config, ConflictError, DEFAULT_IGNORE_PATTERNS, type Dependency, type DiscoverOptions, type DiscoverResult, type FileIndex, type FileIndexEntry, type FileRole, type GcOptions, type GcResult, type GenerateReferenceOptions, type GenerateReferenceResult, type GetMapEntryOptions, GitError, GitHubError, type GitHubRepoMetadata, type GlobalMap, type GlobalMapRepoEntry, type InstallMethod, type InstallReferenceMeta, type InstalledReference, InvalidInputError, InvalidReferenceError, KNOWN_MAPPINGS, LowStarsError, type ManifestType, type MapEntry, type ModelInfo, NetworkError, NotGitRepoError, NotLoggedInError, OpenCodeSDKError, PathNotFoundError, Paths, PrivateRepoError, type ProjectMap, type ProjectMapRepoEntry, type ProviderInfo, type ProviderWithModels, type PruneOptions, type PruneResult, type PullResponse, PushNotAllowedError, type PushResponse, RateLimitError, type ReferenceData, type ReferenceMatch, type ReferenceStatus, type RemoveOptions, RepoExistsError, RepoNotFoundError, type RepoSource, RepoSourceError, type RepoStatusOptions, type RepoStatusSummary, type ResolvedDep, type SearchMapOptions, type SearchResult, type StalenessResult, type StreamPromptOptions, type StreamPromptResult, SyncError, RepoNotFoundError$1 as SyncRepoNotFoundError, TokenExpiredError, type UpdateAllOptions, type UpdateAllResult, type UpdateOptions, type UpdateResult, VERSION, agents, appendReferencesSection, canPushToWeb, checkRemote, checkRemoteByName, checkStaleness, cleanShellConfig, clearAuthData, cloneRepo, detectInstallMethod, detectInstalledAgents, detectManifestType, discoverRepos, executeUninstall, executeUpgrade, expandTilde, fetchGitHubMetadata, fetchLatestVersion, fetchRepoStars, gcRepos, generateReferenceWithAI, getAgentConfig, getAllAgentConfigs, getAuthPath, getAuthStatus, getClonedRepoPath, getCommitDistance, getCommitSha, getConfigPath, getCurrentVersion, getMapEntry, getMetaPath, getMetaRoot, getProjectMapPath, getProvider, getReferenceFileNameForSource, getReferencePath, getRepoPath, getRepoRoot, getRepoStatus, getShellConfigFiles, getToken, getTokenOrNull, installGlobalSkill, installReference, isLoggedIn, isReferenceInstalled, isRepoCloned, isShallowClone, listProviders, listProvidersWithModels, listRepos, loadAuthData, loadConfig, matchDependenciesToReferences, parseDependencies, parseRepoInput, pruneRepos, pullReference, pullReferenceByName, pushReference, readGlobalMap, refreshAccessToken, removeGlobalMapEntry, removeRepo, resolveDependencyRepo, resolveFromNpm, resolveRepoKey, saveAuthData, saveConfig, searchMap, streamPrompt, toMetaDirName, toReferenceFileName, toReferenceName, unshallowRepo, updateAgentFiles, updateAllRepos, updateRepo, upsertGlobalMapEntry, validateProviderModel, validatePushAllowed, writeGlobalMap, writeProjectMap };
|
|
1008
|
+
//# sourceMappingURL=index.d.mts.map
|