@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 ADDED
@@ -0,0 +1,127 @@
1
+ # @offworld/sdk
2
+
3
+ Core business logic for Offworld CLI and web app.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @offworld/sdk
9
+ ```
10
+
11
+ ## Modules
12
+
13
+ | Module | Description |
14
+ | ---------------------- | ----------------------------------------- |
15
+ | `config.ts` | Config load/save, path utilities |
16
+ | `paths.ts` | XDG-compliant path resolution |
17
+ | `clone.ts` | Git clone/update/remove |
18
+ | `index-manager.ts` | Global + project map management |
19
+ | `generate.ts` | AI reference generation |
20
+ | `sync.ts` | Convex client for push/pull |
21
+ | `auth.ts` | WorkOS token management |
22
+ | `agents.ts` | Agent registry (6 agents) |
23
+ | `agents-md.ts` | AGENTS.md reference table generation |
24
+ | `repo-source.ts` | Parse repo input (URL, owner/repo, local) |
25
+ | `manifest.ts` | Dependency parsing (package.json, etc.) |
26
+ | `dep-mappings.ts` | npm package → GitHub repo resolution |
27
+ | `reference-matcher.ts` | Match deps to installed references |
28
+ | `repo-manager.ts` | Bulk repo operations (update, prune, gc) |
29
+ | `models.ts` | AI provider/model registry |
30
+ | `installation.ts` | Upgrade/uninstall utilities |
31
+
32
+ ## Key Exports
33
+
34
+ ### Config & Paths
35
+
36
+ ```typescript
37
+ import { loadConfig, saveConfig, Paths, expandTilde } from "@offworld/sdk";
38
+
39
+ const config = loadConfig();
40
+ const skillDir = Paths.offworldDir;
41
+ const globalMap = Paths.globalMap;
42
+ ```
43
+
44
+ ### Clone Management
45
+
46
+ ```typescript
47
+ import { cloneRepo, updateRepo, removeRepo, listRepos } from "@offworld/sdk";
48
+
49
+ await cloneRepo(repoSource, { shallow: true });
50
+ await updateRepo("owner/repo");
51
+ await removeRepo("owner/repo", { referenceOnly: true });
52
+ ```
53
+
54
+ ### Reference Generation
55
+
56
+ ```typescript
57
+ import { generateReferenceWithAI, installReference } from "@offworld/sdk";
58
+
59
+ const result = await generateReferenceWithAI(repoPath, { model: "claude-sonnet-4-20250514" });
60
+ await installReference("owner/repo", result.referenceContent, result.commitSha);
61
+ ```
62
+
63
+ ### Map Management
64
+
65
+ ```typescript
66
+ import { readGlobalMap, writeProjectMap, upsertGlobalMapEntry } from "@offworld/sdk";
67
+
68
+ const globalMap = readGlobalMap();
69
+ await upsertGlobalMapEntry("owner/repo", { localPath, references: ["repo.md"] });
70
+ await writeProjectMap(cwd, projectMap);
71
+ ```
72
+
73
+ ### Sync (Push/Pull)
74
+
75
+ ```typescript
76
+ import { pullReference, pushReference, checkRemote } from "@offworld/sdk";
77
+
78
+ const ref = await pullReference("owner/repo");
79
+ await pushReference("owner/repo", referenceData);
80
+ const status = await checkRemote("owner/repo");
81
+ ```
82
+
83
+ ### Dependency Resolution
84
+
85
+ ```typescript
86
+ import {
87
+ parseDependencies,
88
+ resolveDependencyRepo,
89
+ matchDependenciesToReferences,
90
+ } from "@offworld/sdk";
91
+
92
+ const deps = parseDependencies("package.json");
93
+ const repo = await resolveDependencyRepo("zod");
94
+ const matches = matchDependenciesToReferences(deps);
95
+ ```
96
+
97
+ ### Agent Management
98
+
99
+ ```typescript
100
+ import { detectInstalledAgents, agents } from "@offworld/sdk";
101
+
102
+ const installed = detectInstalledAgents();
103
+ console.log(agents); // AgentConfig[]
104
+ ```
105
+
106
+ ## Data Paths
107
+
108
+ | Purpose | Getter |
109
+ | ---------- | --------------------- |
110
+ | Config | `Paths.config` |
111
+ | Data root | `Paths.data` |
112
+ | Skill dir | `Paths.offworldDir` |
113
+ | Global map | `Paths.globalMap` |
114
+ | References | `Paths.referencesDir` |
115
+ | Auth | `Paths.auth` |
116
+ | State | `Paths.state` |
117
+
118
+ ## Commands
119
+
120
+ ```bash
121
+ bun run build # Build with tsdown
122
+ bun run dev # Watch mode
123
+ bun run typecheck # Type check
124
+ bun run test # Run tests
125
+ bun run test:unit # Unit tests only
126
+ bun run test:integration # Integration tests
127
+ ```