@offworld/sdk 0.3.1 → 0.3.2

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.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as AuthData, $t as getMetaRoot, A as pruneRepos, At as updateRepo, B as resolveFromNpm, Bt as removeGlobalMapEntry, C as RepoStatusOptions, Ct as getCommitDistance, D as discoverRepos, Dt as listRepos, E as UpdateAllResult, Et as isShallowClone, F as matchDependenciesToReferences, Ft as getMapEntry, G as AgentConfig, Gt as PathNotFoundError, H as ManifestType, Ht as writeGlobalMap, I as matchDependenciesToReferencesWithRemoteCheck, It as getProjectMapPath, J as getAgentConfig, Jt as parseRepoInput, K as agents, Kt as RepoSourceError, L as FALLBACK_MAPPINGS, Lt as resolveRepoKey, M as ReferenceMatch, Mt as MapEntry, N as ReferenceStatus, Nt as SearchMapOptions, O as gcRepos, Ot as removeRepo, P as isReferenceInstalled, Pt as SearchResult, Q as installReference, Qt as getMetaPath, R as ResolvedDep, Rt as searchMap, S as PruneResult, St as getClonedRepoPath, T as UpdateAllOptions, Tt as isRepoCloned, U as detectManifestType, Ut as writeProjectMap, V as Dependency, Vt as upsertGlobalMapEntry, W as parseDependencies, Wt as NotGitRepoError, X as InstallReferenceMeta, Xt as expandTilde, Y as getAllAgentConfigs, Yt as Paths, Z as installGlobalSkill, Zt as getConfigPath, _ as DiscoverOptions, _t as RepoExistsError, a as GlobalMap, an as toMetaDirName, at as getAuthPath, b as GcResult, bt as UpdateResult, c as ProjectMapRepoEntry, cn as DEFAULT_IGNORE_PATTERNS, ct as getTokenOrNull, d as ProviderInfo, dt as refreshAccessToken, en as getReferencePath, et as AuthError, f as ProviderWithModels, ft as saveAuthData, g as validateProviderModel, gt as RemoveOptions, h as listProvidersWithModels, ht as GitError, i as FileRole, in as saveConfig, it as clearAuthData, j as updateAllRepos, jt as GetMapEntryOptions, k as getRepoStatus, kt as unshallowRepo, l as RepoSource, ln as VERSION, lt as isLoggedIn, m as listProviders, mt as CloneOptions, n as FileIndex, nn as getRepoRoot, nt as NotLoggedInError, o as GlobalMapRepoEntry, on as toReferenceFileName, ot as getAuthStatus, p as getProvider, pt as CloneError, q as detectInstalledAgents, qt as getReferenceFileNameForSource, r as FileIndexEntry, rn as loadConfig, rt as TokenExpiredError, s as ProjectMap, sn as toReferenceName, st as getToken, t as Config, tn as getRepoPath, tt as AuthStatus, u as ModelInfo, ut as loadAuthData, v as DiscoverResult, vt as RepoNotFoundError, w as RepoStatusSummary, wt as getCommitSha, x as PruneOptions, xt as cloneRepo, y as GcOptions, yt as UpdateOptions, z as resolveDependencyRepo, zt as readGlobalMap } from "./public-Cdr8rPRd.mjs";
2
- export { AgentConfig, AuthData, AuthError, AuthStatus, CloneError, CloneOptions, Config, DEFAULT_IGNORE_PATTERNS, Dependency, DiscoverOptions, DiscoverResult, FALLBACK_MAPPINGS, FileIndex, FileIndexEntry, FileRole, GcOptions, GcResult, GetMapEntryOptions, GitError, GlobalMap, GlobalMapRepoEntry, InstallReferenceMeta, ManifestType, MapEntry, ModelInfo, NotGitRepoError, NotLoggedInError, PathNotFoundError, Paths, ProjectMap, ProjectMapRepoEntry, ProviderInfo, ProviderWithModels, PruneOptions, PruneResult, ReferenceMatch, ReferenceStatus, RemoveOptions, RepoExistsError, RepoNotFoundError, RepoSource, RepoSourceError, RepoStatusOptions, RepoStatusSummary, ResolvedDep, SearchMapOptions, SearchResult, TokenExpiredError, UpdateAllOptions, UpdateAllResult, UpdateOptions, UpdateResult, VERSION, agents, clearAuthData, cloneRepo, detectInstalledAgents, detectManifestType, discoverRepos, expandTilde, gcRepos, getAgentConfig, getAllAgentConfigs, getAuthPath, getAuthStatus, getClonedRepoPath, getCommitDistance, getCommitSha, getConfigPath, getMapEntry, getMetaPath, getMetaRoot, getProjectMapPath, getProvider, getReferenceFileNameForSource, getReferencePath, getRepoPath, getRepoRoot, getRepoStatus, getToken, getTokenOrNull, installGlobalSkill, installReference, isLoggedIn, isReferenceInstalled, isRepoCloned, isShallowClone, listProviders, listProvidersWithModels, listRepos, loadAuthData, loadConfig, matchDependenciesToReferences, matchDependenciesToReferencesWithRemoteCheck, parseDependencies, parseRepoInput, pruneRepos, readGlobalMap, refreshAccessToken, removeGlobalMapEntry, removeRepo, resolveDependencyRepo, resolveFromNpm, resolveRepoKey, saveAuthData, saveConfig, searchMap, toMetaDirName, toReferenceFileName, toReferenceName, unshallowRepo, updateAllRepos, updateRepo, upsertGlobalMapEntry, validateProviderModel, writeGlobalMap, writeProjectMap };
1
+ import { $ as installReference, $t as getConfigPath, A as pruneRepos, At as removeRepo, B as resolveDependencyRepo, Bt as searchMap, C as RepoStatusOptions, Ct as cloneRepo, D as discoverRepos, Dt as isRepoCloned, E as UpdateAllResult, Et as getCommitSha, F as matchDependenciesToReferences, Ft as SearchMapOptions, G as parseDependencies, Gt as writeProjectMap, H as Dependency, Ht as removeGlobalMapEntry, I as matchDependenciesToReferencesWithRemoteCheck, It as SearchResult, J as detectInstalledAgents, Jt as RepoSourceError, K as AgentConfig, Kt as NotGitRepoError, L as FALLBACK_MAPPINGS, Lt as getMapEntry, M as ReferenceMatch, Mt as updateRepo, N as ReferenceStatus, Nt as GetMapEntryOptions, O as gcRepos, Ot as isShallowClone, P as isReferenceInstalled, Pt as MapEntry, Q as installGlobalSkill, Qt as expandTilde, R as ResolvedDep, Rt as getProjectMapPath, S as PruneResult, St as UpdateResult, T as UpdateAllOptions, Tt as getCommitDistance, U as ManifestType, Ut as upsertGlobalMapEntry, V as resolveFromNpm, Vt as readGlobalMap, W as detectManifestType, Wt as writeGlobalMap, X as getAllAgentConfigs, Xt as parseRepoInput, Y as getAgentConfig, Yt as getReferenceFileNameForSource, Z as InstallReferenceMeta, Zt as Paths, _ as DiscoverOptions, _t as GitError, a as GlobalMap, an as loadConfig, at as TokenExpiredError, b as GcResult, bt as RepoNotFoundError, c as ProjectMapRepoEntry, cn as toReferenceFileName, ct as getAuthStatus, d as ProviderInfo, dn as VERSION, dt as isLoggedIn, en as getMetaPath, et as resolveReferenceKeywords, f as ProviderWithModels, ft as loadAuthData, g as validateProviderModel, gt as CloneOptions, h as listProvidersWithModels, ht as CloneError, i as FileRole, in as getRepoRoot, it as NotLoggedInError, j as updateAllRepos, jt as unshallowRepo, k as getRepoStatus, kt as listRepos, l as RepoSource, ln as toReferenceName, lt as getToken, m as listProviders, mt as saveAuthData, n as FileIndex, nn as getReferencePath, nt as AuthError, o as GlobalMapRepoEntry, on as saveConfig, ot as clearAuthData, p as getProvider, pt as refreshAccessToken, q as agents, qt as PathNotFoundError, r as FileIndexEntry, rn as getRepoPath, rt as AuthStatus, s as ProjectMap, sn as toMetaDirName, st as getAuthPath, t as Config, tn as getMetaRoot, tt as AuthData, u as ModelInfo, un as DEFAULT_IGNORE_PATTERNS, ut as getTokenOrNull, v as DiscoverResult, vt as RemoveOptions, w as RepoStatusSummary, wt as getClonedRepoPath, x as PruneOptions, xt as UpdateOptions, y as GcOptions, yt as RepoExistsError, z as getNpmKeywords, zt as resolveRepoKey } from "./public-DzjgxrUm.mjs";
2
+ export { AgentConfig, AuthData, AuthError, AuthStatus, CloneError, CloneOptions, Config, DEFAULT_IGNORE_PATTERNS, Dependency, DiscoverOptions, DiscoverResult, FALLBACK_MAPPINGS, FileIndex, FileIndexEntry, FileRole, GcOptions, GcResult, GetMapEntryOptions, GitError, GlobalMap, GlobalMapRepoEntry, InstallReferenceMeta, ManifestType, MapEntry, ModelInfo, NotGitRepoError, NotLoggedInError, PathNotFoundError, Paths, ProjectMap, ProjectMapRepoEntry, ProviderInfo, ProviderWithModels, PruneOptions, PruneResult, ReferenceMatch, ReferenceStatus, RemoveOptions, RepoExistsError, RepoNotFoundError, RepoSource, RepoSourceError, RepoStatusOptions, RepoStatusSummary, ResolvedDep, SearchMapOptions, SearchResult, TokenExpiredError, UpdateAllOptions, UpdateAllResult, UpdateOptions, UpdateResult, VERSION, agents, clearAuthData, cloneRepo, detectInstalledAgents, detectManifestType, discoverRepos, expandTilde, gcRepos, getAgentConfig, getAllAgentConfigs, getAuthPath, getAuthStatus, getClonedRepoPath, getCommitDistance, getCommitSha, getConfigPath, getMapEntry, getMetaPath, getMetaRoot, getNpmKeywords, getProjectMapPath, getProvider, getReferenceFileNameForSource, getReferencePath, getRepoPath, getRepoRoot, getRepoStatus, getToken, getTokenOrNull, installGlobalSkill, installReference, isLoggedIn, isReferenceInstalled, isRepoCloned, isShallowClone, listProviders, listProvidersWithModels, listRepos, loadAuthData, loadConfig, matchDependenciesToReferences, matchDependenciesToReferencesWithRemoteCheck, parseDependencies, parseRepoInput, pruneRepos, readGlobalMap, refreshAccessToken, removeGlobalMapEntry, removeRepo, resolveDependencyRepo, resolveFromNpm, resolveReferenceKeywords, resolveRepoKey, saveAuthData, saveConfig, searchMap, toMetaDirName, toReferenceFileName, toReferenceName, unshallowRepo, updateAllRepos, updateRepo, upsertGlobalMapEntry, validateProviderModel, writeGlobalMap, writeProjectMap };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { A as getToken, B as NotGitRepoError, C as getAllAgentConfigs, D as clearAuthData, E as TokenExpiredError, F as saveAuthData, G as DEFAULT_IGNORE_PATTERNS, H as RepoSourceError, I as getMapEntry, K as VERSION, L as getProjectMapPath, M as isLoggedIn, N as loadAuthData, O as getAuthPath, P as refreshAccessToken, R as resolveRepoKey, S as getAgentConfig, T as NotLoggedInError, U as getReferenceFileNameForSource, V as PathNotFoundError, W as parseRepoInput, _ as parseDependencies, a as discoverRepos, b as agents, c as pruneRepos, d as matchDependenciesToReferences, f as matchDependenciesToReferencesWithRemoteCheck, g as detectManifestType, h as resolveFromNpm, i as validateProviderModel, j as getTokenOrNull, k as getAuthStatus, l as updateAllRepos, m as resolveDependencyRepo, n as listProviders, o as gcRepos, p as FALLBACK_MAPPINGS, r as listProvidersWithModels, s as getRepoStatus, t as getProvider, u as isReferenceInstalled, v as installGlobalSkill, w as AuthError, x as detectInstalledAgents, y as installReference, z as searchMap } from "./public-CjA2mMwu.mjs";
1
+ import { A as getAuthPath, B as resolveRepoKey, C as detectInstalledAgents, D as NotLoggedInError, E as AuthError, F as loadAuthData, G as getReferenceFileNameForSource, H as NotGitRepoError, I as refreshAccessToken, J as VERSION, K as parseRepoInput, L as saveAuthData, M as getToken, N as getTokenOrNull, O as TokenExpiredError, P as isLoggedIn, R as getMapEntry, S as agents, T as getAllAgentConfigs, U as PathNotFoundError, V as searchMap, W as RepoSourceError, _ as resolveReferenceKeywords, a as discoverRepos, b as resolveDependencyRepo, c as pruneRepos, d as matchDependenciesToReferences, f as matchDependenciesToReferencesWithRemoteCheck, g as installReference, h as installGlobalSkill, i as validateProviderModel, j as getAuthStatus, k as clearAuthData, l as updateAllRepos, m as parseDependencies, n as listProviders, o as gcRepos, p as detectManifestType, q as DEFAULT_IGNORE_PATTERNS, r as listProvidersWithModels, s as getRepoStatus, t as getProvider, u as isReferenceInstalled, v as FALLBACK_MAPPINGS, w as getAgentConfig, x as resolveFromNpm, y as getNpmKeywords, z as getProjectMapPath } from "./public-BUgna8vR.mjs";
2
2
  import { a as getRepoPath, c as saveConfig, d as toReferenceName, f as Paths, i as getReferencePath, l as toMetaDirName, n as getMetaPath, o as getRepoRoot, p as expandTilde, r as getMetaRoot, s as loadConfig, t as getConfigPath, u as toReferenceFileName } from "./config-DW8J4gl5.mjs";
3
3
  import { _ as upsertGlobalMapEntry, a as cloneRepo, c as getCommitSha, d as listRepos, f as removeRepo, g as removeGlobalMapEntry, h as readGlobalMap, i as RepoNotFoundError, l as isRepoCloned, m as updateRepo, n as GitError, o as getClonedRepoPath, p as unshallowRepo, r as RepoExistsError, s as getCommitDistance, t as CloneError, u as isShallowClone, v as writeGlobalMap, y as writeProjectMap } from "./clone-DyLvmbJZ.mjs";
4
4
 
5
- export { AuthError, CloneError, DEFAULT_IGNORE_PATTERNS, FALLBACK_MAPPINGS, GitError, NotGitRepoError, NotLoggedInError, PathNotFoundError, Paths, RepoExistsError, RepoNotFoundError, RepoSourceError, TokenExpiredError, VERSION, agents, clearAuthData, cloneRepo, detectInstalledAgents, detectManifestType, discoverRepos, expandTilde, gcRepos, getAgentConfig, getAllAgentConfigs, getAuthPath, getAuthStatus, getClonedRepoPath, getCommitDistance, getCommitSha, getConfigPath, getMapEntry, getMetaPath, getMetaRoot, getProjectMapPath, getProvider, getReferenceFileNameForSource, getReferencePath, getRepoPath, getRepoRoot, getRepoStatus, getToken, getTokenOrNull, installGlobalSkill, installReference, isLoggedIn, isReferenceInstalled, isRepoCloned, isShallowClone, listProviders, listProvidersWithModels, listRepos, loadAuthData, loadConfig, matchDependenciesToReferences, matchDependenciesToReferencesWithRemoteCheck, parseDependencies, parseRepoInput, pruneRepos, readGlobalMap, refreshAccessToken, removeGlobalMapEntry, removeRepo, resolveDependencyRepo, resolveFromNpm, resolveRepoKey, saveAuthData, saveConfig, searchMap, toMetaDirName, toReferenceFileName, toReferenceName, unshallowRepo, updateAllRepos, updateRepo, upsertGlobalMapEntry, validateProviderModel, writeGlobalMap, writeProjectMap };
5
+ export { AuthError, CloneError, DEFAULT_IGNORE_PATTERNS, FALLBACK_MAPPINGS, GitError, NotGitRepoError, NotLoggedInError, PathNotFoundError, Paths, RepoExistsError, RepoNotFoundError, RepoSourceError, TokenExpiredError, VERSION, agents, clearAuthData, cloneRepo, detectInstalledAgents, detectManifestType, discoverRepos, expandTilde, gcRepos, getAgentConfig, getAllAgentConfigs, getAuthPath, getAuthStatus, getClonedRepoPath, getCommitDistance, getCommitSha, getConfigPath, getMapEntry, getMetaPath, getMetaRoot, getNpmKeywords, getProjectMapPath, getProvider, getReferenceFileNameForSource, getReferencePath, getRepoPath, getRepoRoot, getRepoStatus, getToken, getTokenOrNull, installGlobalSkill, installReference, isLoggedIn, isReferenceInstalled, isRepoCloned, isShallowClone, listProviders, listProvidersWithModels, listRepos, loadAuthData, loadConfig, matchDependenciesToReferences, matchDependenciesToReferencesWithRemoteCheck, parseDependencies, parseRepoInput, pruneRepos, readGlobalMap, refreshAccessToken, removeGlobalMapEntry, removeRepo, resolveDependencyRepo, resolveFromNpm, resolveReferenceKeywords, resolveRepoKey, saveAuthData, saveConfig, searchMap, toMetaDirName, toReferenceFileName, toReferenceName, unshallowRepo, updateAllRepos, updateRepo, upsertGlobalMapEntry, validateProviderModel, writeGlobalMap, writeProjectMap };
@@ -1,4 +1,4 @@
1
- import { $ as AuthData, $t as getMetaRoot, A as pruneRepos, At as updateRepo, B as resolveFromNpm, Bt as removeGlobalMapEntry, C as RepoStatusOptions, Ct as getCommitDistance, D as discoverRepos, Dt as listRepos, E as UpdateAllResult, Et as isShallowClone, F as matchDependenciesToReferences, Ft as getMapEntry, G as AgentConfig, Gt as PathNotFoundError, H as ManifestType, Ht as writeGlobalMap, I as matchDependenciesToReferencesWithRemoteCheck, It as getProjectMapPath, J as getAgentConfig, Jt as parseRepoInput, K as agents, Kt as RepoSourceError, L as FALLBACK_MAPPINGS, Lt as resolveRepoKey, M as ReferenceMatch, Mt as MapEntry, N as ReferenceStatus, Nt as SearchMapOptions, O as gcRepos, Ot as removeRepo, P as isReferenceInstalled, Pt as SearchResult, Q as installReference, Qt as getMetaPath, R as ResolvedDep, Rt as searchMap, S as PruneResult, St as getClonedRepoPath, T as UpdateAllOptions, Tt as isRepoCloned, U as detectManifestType, Ut as writeProjectMap, V as Dependency, Vt as upsertGlobalMapEntry, W as parseDependencies, Wt as NotGitRepoError, X as InstallReferenceMeta, Xt as expandTilde, Y as getAllAgentConfigs, Yt as Paths, Z as installGlobalSkill, Zt as getConfigPath, _ as DiscoverOptions, _t as RepoExistsError, a as GlobalMap, an as toMetaDirName, at as getAuthPath, b as GcResult, bt as UpdateResult, c as ProjectMapRepoEntry, cn as DEFAULT_IGNORE_PATTERNS, ct as getTokenOrNull, d as ProviderInfo, dt as refreshAccessToken, en as getReferencePath, et as AuthError, f as ProviderWithModels, ft as saveAuthData, g as validateProviderModel, gt as RemoveOptions, h as listProvidersWithModels, ht as GitError, i as FileRole, in as saveConfig, it as clearAuthData, j as updateAllRepos, jt as GetMapEntryOptions, k as getRepoStatus, kt as unshallowRepo, l as RepoSource, ln as VERSION, lt as isLoggedIn, m as listProviders, mt as CloneOptions, n as FileIndex, nn as getRepoRoot, nt as NotLoggedInError, o as GlobalMapRepoEntry, on as toReferenceFileName, ot as getAuthStatus, p as getProvider, pt as CloneError, q as detectInstalledAgents, qt as getReferenceFileNameForSource, r as FileIndexEntry, rn as loadConfig, rt as TokenExpiredError, s as ProjectMap, sn as toReferenceName, st as getToken, t as Config, tn as getRepoPath, tt as AuthStatus, u as ModelInfo, ut as loadAuthData, v as DiscoverResult, vt as RepoNotFoundError, w as RepoStatusSummary, wt as getCommitSha, x as PruneOptions, xt as cloneRepo, y as GcOptions, yt as UpdateOptions, z as resolveDependencyRepo, zt as readGlobalMap } from "./public-Cdr8rPRd.mjs";
1
+ import { $ as installReference, $t as getConfigPath, A as pruneRepos, At as removeRepo, B as resolveDependencyRepo, Bt as searchMap, C as RepoStatusOptions, Ct as cloneRepo, D as discoverRepos, Dt as isRepoCloned, E as UpdateAllResult, Et as getCommitSha, F as matchDependenciesToReferences, Ft as SearchMapOptions, G as parseDependencies, Gt as writeProjectMap, H as Dependency, Ht as removeGlobalMapEntry, I as matchDependenciesToReferencesWithRemoteCheck, It as SearchResult, J as detectInstalledAgents, Jt as RepoSourceError, K as AgentConfig, Kt as NotGitRepoError, L as FALLBACK_MAPPINGS, Lt as getMapEntry, M as ReferenceMatch, Mt as updateRepo, N as ReferenceStatus, Nt as GetMapEntryOptions, O as gcRepos, Ot as isShallowClone, P as isReferenceInstalled, Pt as MapEntry, Q as installGlobalSkill, Qt as expandTilde, R as ResolvedDep, Rt as getProjectMapPath, S as PruneResult, St as UpdateResult, T as UpdateAllOptions, Tt as getCommitDistance, U as ManifestType, Ut as upsertGlobalMapEntry, V as resolveFromNpm, Vt as readGlobalMap, W as detectManifestType, Wt as writeGlobalMap, X as getAllAgentConfigs, Xt as parseRepoInput, Y as getAgentConfig, Yt as getReferenceFileNameForSource, Z as InstallReferenceMeta, Zt as Paths, _ as DiscoverOptions, _t as GitError, a as GlobalMap, an as loadConfig, at as TokenExpiredError, b as GcResult, bt as RepoNotFoundError, c as ProjectMapRepoEntry, cn as toReferenceFileName, ct as getAuthStatus, d as ProviderInfo, dn as VERSION, dt as isLoggedIn, en as getMetaPath, et as resolveReferenceKeywords, f as ProviderWithModels, ft as loadAuthData, g as validateProviderModel, gt as CloneOptions, h as listProvidersWithModels, ht as CloneError, i as FileRole, in as getRepoRoot, it as NotLoggedInError, j as updateAllRepos, jt as unshallowRepo, k as getRepoStatus, kt as listRepos, l as RepoSource, ln as toReferenceName, lt as getToken, m as listProviders, mt as saveAuthData, n as FileIndex, nn as getReferencePath, nt as AuthError, o as GlobalMapRepoEntry, on as saveConfig, ot as clearAuthData, p as getProvider, pt as refreshAccessToken, q as agents, qt as PathNotFoundError, r as FileIndexEntry, rn as getRepoPath, rt as AuthStatus, s as ProjectMap, sn as toMetaDirName, st as getAuthPath, t as Config, tn as getMetaRoot, tt as AuthData, u as ModelInfo, un as DEFAULT_IGNORE_PATTERNS, ut as getTokenOrNull, v as DiscoverResult, vt as RemoveOptions, w as RepoStatusSummary, wt as getClonedRepoPath, x as PruneOptions, xt as UpdateOptions, y as GcOptions, yt as RepoExistsError, z as getNpmKeywords, zt as resolveRepoKey } from "./public-DzjgxrUm.mjs";
2
2
 
3
3
  //#region src/agents-md.d.ts
4
4
  /**
@@ -65,5 +65,5 @@ declare function getShellConfigFiles(): string[];
65
65
  */
66
66
  declare function cleanShellConfig(filePath: string): boolean;
67
67
  //#endregion
68
- export { AgentConfig, AuthData, AuthError, AuthStatus, CloneError, CloneOptions, Config, DEFAULT_IGNORE_PATTERNS, Dependency, DiscoverOptions, DiscoverResult, FALLBACK_MAPPINGS, FileIndex, FileIndexEntry, FileRole, GcOptions, GcResult, GetMapEntryOptions, GitError, GlobalMap, GlobalMapRepoEntry, type InstallMethod, InstallReferenceMeta, type InstalledReference, ManifestType, MapEntry, ModelInfo, NotGitRepoError, NotLoggedInError, PathNotFoundError, Paths, ProjectMap, ProjectMapRepoEntry, ProviderInfo, ProviderWithModels, PruneOptions, PruneResult, ReferenceMatch, ReferenceStatus, RemoveOptions, RepoExistsError, RepoNotFoundError, RepoSource, RepoSourceError, RepoStatusOptions, RepoStatusSummary, ResolvedDep, SearchMapOptions, SearchResult, TokenExpiredError, UpdateAllOptions, UpdateAllResult, UpdateOptions, UpdateResult, VERSION, agents, appendReferencesSection, cleanShellConfig, clearAuthData, cloneRepo, detectInstallMethod, detectInstalledAgents, detectManifestType, discoverRepos, executeUninstall, executeUpgrade, expandTilde, fetchLatestVersion, gcRepos, 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, matchDependenciesToReferencesWithRemoteCheck, parseDependencies, parseRepoInput, pruneRepos, readGlobalMap, refreshAccessToken, removeGlobalMapEntry, removeRepo, resolveDependencyRepo, resolveFromNpm, resolveRepoKey, saveAuthData, saveConfig, searchMap, toMetaDirName, toReferenceFileName, toReferenceName, unshallowRepo, updateAgentFiles, updateAllRepos, updateRepo, upsertGlobalMapEntry, validateProviderModel, writeGlobalMap, writeProjectMap };
68
+ export { AgentConfig, AuthData, AuthError, AuthStatus, CloneError, CloneOptions, Config, DEFAULT_IGNORE_PATTERNS, Dependency, DiscoverOptions, DiscoverResult, FALLBACK_MAPPINGS, FileIndex, FileIndexEntry, FileRole, GcOptions, GcResult, GetMapEntryOptions, GitError, GlobalMap, GlobalMapRepoEntry, type InstallMethod, InstallReferenceMeta, type InstalledReference, ManifestType, MapEntry, ModelInfo, NotGitRepoError, NotLoggedInError, PathNotFoundError, Paths, ProjectMap, ProjectMapRepoEntry, ProviderInfo, ProviderWithModels, PruneOptions, PruneResult, ReferenceMatch, ReferenceStatus, RemoveOptions, RepoExistsError, RepoNotFoundError, RepoSource, RepoSourceError, RepoStatusOptions, RepoStatusSummary, ResolvedDep, SearchMapOptions, SearchResult, TokenExpiredError, UpdateAllOptions, UpdateAllResult, UpdateOptions, UpdateResult, VERSION, agents, appendReferencesSection, cleanShellConfig, clearAuthData, cloneRepo, detectInstallMethod, detectInstalledAgents, detectManifestType, discoverRepos, executeUninstall, executeUpgrade, expandTilde, fetchLatestVersion, gcRepos, getAgentConfig, getAllAgentConfigs, getAuthPath, getAuthStatus, getClonedRepoPath, getCommitDistance, getCommitSha, getConfigPath, getCurrentVersion, getMapEntry, getMetaPath, getMetaRoot, getNpmKeywords, getProjectMapPath, getProvider, getReferenceFileNameForSource, getReferencePath, getRepoPath, getRepoRoot, getRepoStatus, getShellConfigFiles, getToken, getTokenOrNull, installGlobalSkill, installReference, isLoggedIn, isReferenceInstalled, isRepoCloned, isShallowClone, listProviders, listProvidersWithModels, listRepos, loadAuthData, loadConfig, matchDependenciesToReferences, matchDependenciesToReferencesWithRemoteCheck, parseDependencies, parseRepoInput, pruneRepos, readGlobalMap, refreshAccessToken, removeGlobalMapEntry, removeRepo, resolveDependencyRepo, resolveFromNpm, resolveReferenceKeywords, resolveRepoKey, saveAuthData, saveConfig, searchMap, toMetaDirName, toReferenceFileName, toReferenceName, unshallowRepo, updateAgentFiles, updateAllRepos, updateRepo, upsertGlobalMapEntry, validateProviderModel, writeGlobalMap, writeProjectMap };
69
69
  //# sourceMappingURL=internal.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.mts","names":[],"sources":["../src/agents-md.ts","../src/installation.ts"],"mappings":";;;;;;AASA;;UAAiB,kBAAA;EAAkB;EAElC,UAAA;EAEA;EAAA,SAAA;EAEI;EAAJ,IAAA;AAAA;;;;;;;;iBAsCe,uBAAA,CAAwB,QAAA,UAAkB,UAAA,EAAY,kBAAA;AAwBtE;;;;;;;AAAA,iBAAgB,gBAAA,CAAiB,WAAA,UAAqB,UAAA,EAAY,kBAAA;;;;;;KC/DtD,aAAA;;;;iBAKI,mBAAA,CAAA,GAAuB,aAAA;;;;iBAuFvB,iBAAA,CAAA;ADrDhB;;;AAAA,iBC4DsB,kBAAA,CAAmB,MAAA,GAAS,aAAA,GAAgB,OAAA;;;;iBAkClD,cAAA,CAAe,MAAA,EAAQ,aAAA,EAAe,OAAA,WAAkB,OAAA;;ADtExE;;iBCiHgB,gBAAA,CAAiB,MAAA,EAAQ,aAAA,GAAgB,OAAA;;;;iBAkDzC,mBAAA,CAAA;;;;iBA0BA,gBAAA,CAAiB,QAAA"}
1
+ {"version":3,"file":"internal.d.mts","names":[],"sources":["../src/agents-md.ts","../src/installation.ts"],"mappings":";;;;;;AASA;;UAAiB,kBAAA;EAAkB;EAElC,UAAA;EAEA;EAAA,SAAA;EAEI;EAAJ,IAAA;AAAA;;;;;;;;iBA2Be,uBAAA,CAAwB,QAAA,UAAkB,UAAA,EAAY,kBAAA;AAwBtE;;;;;;;AAAA,iBAAgB,gBAAA,CAAiB,WAAA,UAAqB,UAAA,EAAY,kBAAA;;;;;;KCpDtD,aAAA;;;;iBAKI,mBAAA,CAAA,GAAuB,aAAA;;;;iBAuFvB,iBAAA,CAAA;ADhEhB;;;AAAA,iBCuEsB,kBAAA,CAAmB,MAAA,GAAS,aAAA,GAAgB,OAAA;;;;iBAkClD,cAAA,CAAe,MAAA,EAAQ,aAAA,EAAe,OAAA,WAAkB,OAAA;;ADjFxE;;iBC4HgB,gBAAA,CAAiB,MAAA,EAAQ,aAAA,GAAgB,OAAA;;;;iBAkDzC,mBAAA,CAAA;;;;iBA0BA,gBAAA,CAAiB,QAAA"}
package/dist/internal.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as getToken, B as NotGitRepoError, C as getAllAgentConfigs, D as clearAuthData, E as TokenExpiredError, F as saveAuthData, G as DEFAULT_IGNORE_PATTERNS, H as RepoSourceError, I as getMapEntry, K as VERSION, L as getProjectMapPath, M as isLoggedIn, N as loadAuthData, O as getAuthPath, P as refreshAccessToken, R as resolveRepoKey, S as getAgentConfig, T as NotLoggedInError, U as getReferenceFileNameForSource, V as PathNotFoundError, W as parseRepoInput, _ as parseDependencies, a as discoverRepos, b as agents, c as pruneRepos, d as matchDependenciesToReferences, f as matchDependenciesToReferencesWithRemoteCheck, g as detectManifestType, h as resolveFromNpm, i as validateProviderModel, j as getTokenOrNull, k as getAuthStatus, l as updateAllRepos, m as resolveDependencyRepo, n as listProviders, o as gcRepos, p as FALLBACK_MAPPINGS, r as listProvidersWithModels, s as getRepoStatus, t as getProvider, u as isReferenceInstalled, v as installGlobalSkill, w as AuthError, x as detectInstalledAgents, y as installReference, z as searchMap } from "./public-CjA2mMwu.mjs";
1
+ import { A as getAuthPath, B as resolveRepoKey, C as detectInstalledAgents, D as NotLoggedInError, E as AuthError, F as loadAuthData, G as getReferenceFileNameForSource, H as NotGitRepoError, I as refreshAccessToken, J as VERSION, K as parseRepoInput, L as saveAuthData, M as getToken, N as getTokenOrNull, O as TokenExpiredError, P as isLoggedIn, R as getMapEntry, S as agents, T as getAllAgentConfigs, U as PathNotFoundError, V as searchMap, W as RepoSourceError, _ as resolveReferenceKeywords, a as discoverRepos, b as resolveDependencyRepo, c as pruneRepos, d as matchDependenciesToReferences, f as matchDependenciesToReferencesWithRemoteCheck, g as installReference, h as installGlobalSkill, i as validateProviderModel, j as getAuthStatus, k as clearAuthData, l as updateAllRepos, m as parseDependencies, n as listProviders, o as gcRepos, p as detectManifestType, q as DEFAULT_IGNORE_PATTERNS, r as listProvidersWithModels, s as getRepoStatus, t as getProvider, u as isReferenceInstalled, v as FALLBACK_MAPPINGS, w as getAgentConfig, x as resolveFromNpm, y as getNpmKeywords, z as getProjectMapPath } from "./public-BUgna8vR.mjs";
2
2
  import { a as getRepoPath, c as saveConfig, d as toReferenceName, f as Paths, i as getReferencePath, l as toMetaDirName, n as getMetaPath, o as getRepoRoot, p as expandTilde, r as getMetaRoot, s as loadConfig, t as getConfigPath, u as toReferenceFileName } from "./config-DW8J4gl5.mjs";
3
3
  import { _ as upsertGlobalMapEntry, a as cloneRepo, c as getCommitSha, d as listRepos, f as removeRepo, g as removeGlobalMapEntry, h as readGlobalMap, i as RepoNotFoundError, l as isRepoCloned, m as updateRepo, n as GitError, o as getClonedRepoPath, p as unshallowRepo, r as RepoExistsError, s as getCommitDistance, t as CloneError, u as isShallowClone, v as writeGlobalMap, y as writeProjectMap } from "./clone-DyLvmbJZ.mjs";
4
4
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
@@ -14,26 +14,18 @@ import { execSync, spawn } from "node:child_process";
14
14
  * Manages updating project AGENTS.md and agent-specific files with reference information.
15
15
  */
16
16
  /**
17
- * Generate markdown table for project references section.
17
+ * Generate single-line project reference guidance.
18
18
  *
19
- * @param references - Array of installed references
20
- * @returns Markdown string with table
19
+ * @param _references - Installed references (unused; reserved for future context)
20
+ * @returns Markdown string with one-line guidance
21
21
  */
22
- function generateReferencesTable(references) {
23
- const lines = [
22
+ function generateReferencesTable(_references) {
23
+ return [
24
24
  "## Project References",
25
25
  "",
26
- "References installed for this project's dependencies:",
27
- "",
28
- "| Dependency | Reference | Path |",
29
- "| --- | --- | --- |"
30
- ];
31
- for (const reference of references) lines.push(`| ${reference.dependency} | ${reference.reference} | ${reference.path} |`);
32
- lines.push("");
33
- lines.push("To update references: `ow pull <dependency>`");
34
- lines.push("To regenerate all: `ow project init --all --generate`");
35
- lines.push("");
36
- return lines.join("\n");
26
+ "Use the Offworld CLI to find and read directly from local codebases for any repo in `.offworld/map.json` whenever the user asks about a specific open source project.",
27
+ ""
28
+ ].join("\n");
37
29
  }
38
30
  /**
39
31
  * Update or append Project References section in a markdown file.
@@ -322,5 +314,5 @@ function cleanShellConfig(filePath) {
322
314
  }
323
315
 
324
316
  //#endregion
325
- export { AuthError, CloneError, DEFAULT_IGNORE_PATTERNS, FALLBACK_MAPPINGS, GitError, NotGitRepoError, NotLoggedInError, PathNotFoundError, Paths, RepoExistsError, RepoNotFoundError, RepoSourceError, TokenExpiredError, VERSION, agents, appendReferencesSection, cleanShellConfig, clearAuthData, cloneRepo, detectInstallMethod, detectInstalledAgents, detectManifestType, discoverRepos, executeUninstall, executeUpgrade, expandTilde, fetchLatestVersion, gcRepos, 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, matchDependenciesToReferencesWithRemoteCheck, parseDependencies, parseRepoInput, pruneRepos, readGlobalMap, refreshAccessToken, removeGlobalMapEntry, removeRepo, resolveDependencyRepo, resolveFromNpm, resolveRepoKey, saveAuthData, saveConfig, searchMap, toMetaDirName, toReferenceFileName, toReferenceName, unshallowRepo, updateAgentFiles, updateAllRepos, updateRepo, upsertGlobalMapEntry, validateProviderModel, writeGlobalMap, writeProjectMap };
317
+ export { AuthError, CloneError, DEFAULT_IGNORE_PATTERNS, FALLBACK_MAPPINGS, GitError, NotGitRepoError, NotLoggedInError, PathNotFoundError, Paths, RepoExistsError, RepoNotFoundError, RepoSourceError, TokenExpiredError, VERSION, agents, appendReferencesSection, cleanShellConfig, clearAuthData, cloneRepo, detectInstallMethod, detectInstalledAgents, detectManifestType, discoverRepos, executeUninstall, executeUpgrade, expandTilde, fetchLatestVersion, gcRepos, getAgentConfig, getAllAgentConfigs, getAuthPath, getAuthStatus, getClonedRepoPath, getCommitDistance, getCommitSha, getConfigPath, getCurrentVersion, getMapEntry, getMetaPath, getMetaRoot, getNpmKeywords, getProjectMapPath, getProvider, getReferenceFileNameForSource, getReferencePath, getRepoPath, getRepoRoot, getRepoStatus, getShellConfigFiles, getToken, getTokenOrNull, installGlobalSkill, installReference, isLoggedIn, isReferenceInstalled, isRepoCloned, isShallowClone, listProviders, listProvidersWithModels, listRepos, loadAuthData, loadConfig, matchDependenciesToReferences, matchDependenciesToReferencesWithRemoteCheck, parseDependencies, parseRepoInput, pruneRepos, readGlobalMap, refreshAccessToken, removeGlobalMapEntry, removeRepo, resolveDependencyRepo, resolveFromNpm, resolveReferenceKeywords, resolveRepoKey, saveAuthData, saveConfig, searchMap, toMetaDirName, toReferenceFileName, toReferenceName, unshallowRepo, updateAgentFiles, updateAllRepos, updateRepo, upsertGlobalMapEntry, validateProviderModel, writeGlobalMap, writeProjectMap };
326
318
  //# sourceMappingURL=internal.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.mjs","names":[],"sources":["../src/agents-md.ts","../src/installation.ts"],"sourcesContent":["/**\n * AGENTS.md manipulation utilities\n *\n * Manages updating project AGENTS.md and agent-specific files with reference information.\n */\n\nimport { readFileSync, writeFileSync, existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport interface InstalledReference {\n\t/** Dependency name */\n\tdependency: string;\n\t/** Reference identifier (matches reference file name without .md) */\n\treference: string;\n\t/** Absolute path to reference file */\n\tpath: string;\n}\n\n/**\n * Generate markdown table for project references section.\n *\n * @param references - Array of installed references\n * @returns Markdown string with table\n */\nfunction generateReferencesTable(references: InstalledReference[]): string {\n\tconst lines = [\n\t\t\"## Project References\",\n\t\t\"\",\n\t\t\"References installed for this project's dependencies:\",\n\t\t\"\",\n\t\t\"| Dependency | Reference | Path |\",\n\t\t\"| --- | --- | --- |\",\n\t];\n\n\tfor (const reference of references) {\n\t\tlines.push(`| ${reference.dependency} | ${reference.reference} | ${reference.path} |`);\n\t}\n\n\tlines.push(\"\");\n\tlines.push(\"To update references: `ow pull <dependency>`\");\n\tlines.push(\"To regenerate all: `ow project init --all --generate`\");\n\tlines.push(\"\");\n\n\treturn lines.join(\"\\n\");\n}\n\n/**\n * Update or append Project References section in a markdown file.\n * If the section exists, replaces its content. Otherwise, appends to end.\n *\n * @param filePath - Path to markdown file\n * @param references - Array of installed references\n */\nexport function appendReferencesSection(filePath: string, references: InstalledReference[]): void {\n\tconst content = existsSync(filePath) ? readFileSync(filePath, \"utf-8\") : \"\";\n\tconst referencesMarkdown = generateReferencesTable(references);\n\n\tconst sectionRegex = /^## Project References\\n(?:.*\\n)*?(?=^## |$)/m;\n\tconst match = content.match(sectionRegex);\n\n\tlet updatedContent: string;\n\tif (match) {\n\t\tupdatedContent = content.replace(sectionRegex, referencesMarkdown);\n\t} else {\n\t\tupdatedContent = content.trim() + \"\\n\\n\" + referencesMarkdown;\n\t}\n\n\twriteFileSync(filePath, updatedContent, \"utf-8\");\n}\n\n/**\n * Update AGENTS.md and agent-specific files with project references.\n * Creates files if they don't exist.\n *\n * @param projectRoot - Project root directory\n * @param references - Array of installed references to document\n */\nexport function updateAgentFiles(projectRoot: string, references: InstalledReference[]): void {\n\tconst agentsMdPath = join(projectRoot, \"AGENTS.md\");\n\tconst claudeMdPath = join(projectRoot, \"CLAUDE.md\");\n\n\tappendReferencesSection(agentsMdPath, references);\n\n\tif (existsSync(claudeMdPath)) {\n\t\tappendReferencesSection(claudeMdPath, references);\n\t}\n}\n","/**\n * Installation utilities for upgrade/uninstall commands\n */\n\nimport { execSync, spawn } from \"node:child_process\";\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { NpmPackageResponseSchema } from \"@offworld/types\";\nimport { VERSION } from \"./constants.js\";\n\nconst GITHUB_REPO = \"oscabriel/offworld\";\nconst NPM_PACKAGE = \"offworld\";\n\nexport type InstallMethod = \"curl\" | \"npm\" | \"pnpm\" | \"bun\" | \"brew\" | \"unknown\";\n\n/**\n * Detect how offworld was installed\n */\nexport function detectInstallMethod(): InstallMethod {\n\tconst execPath = process.execPath;\n\n\tif (execPath.includes(\".local/bin\")) return \"curl\";\n\n\tconst checks: Array<{ name: InstallMethod; test: () => boolean }> = [\n\t\t{\n\t\t\tname: \"npm\",\n\t\t\ttest: () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = execSync(\"npm list -g --depth=0 2>/dev/null\", {\n\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t});\n\t\t\t\t\treturn result.includes(NPM_PACKAGE);\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"pnpm\",\n\t\t\ttest: () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = execSync(\"pnpm list -g --depth=0 2>/dev/null\", {\n\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t});\n\t\t\t\t\treturn result.includes(NPM_PACKAGE);\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"bun\",\n\t\t\ttest: () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = execSync(\"bun pm ls -g 2>/dev/null\", {\n\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t});\n\t\t\t\t\treturn result.includes(NPM_PACKAGE);\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"brew\",\n\t\t\ttest: () => {\n\t\t\t\ttry {\n\t\t\t\t\texecSync(\"brew list --formula offworld 2>/dev/null\", {\n\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t];\n\n\tif (execPath.includes(\"npm\")) {\n\t\tconst check = checks.find((c) => c.name === \"npm\");\n\t\tif (check?.test()) return \"npm\";\n\t}\n\tif (execPath.includes(\"pnpm\")) {\n\t\tconst check = checks.find((c) => c.name === \"pnpm\");\n\t\tif (check?.test()) return \"pnpm\";\n\t}\n\tif (execPath.includes(\"bun\")) {\n\t\tconst check = checks.find((c) => c.name === \"bun\");\n\t\tif (check?.test()) return \"bun\";\n\t}\n\tif (execPath.includes(\"Cellar\") || execPath.includes(\"homebrew\")) {\n\t\tconst check = checks.find((c) => c.name === \"brew\");\n\t\tif (check?.test()) return \"brew\";\n\t}\n\n\tfor (const check of checks) {\n\t\tif (check.test()) return check.name;\n\t}\n\n\treturn \"unknown\";\n}\n\n/**\n * Get current installed version\n */\nexport function getCurrentVersion(): string {\n\treturn VERSION;\n}\n\n/**\n * Fetch latest version from appropriate source\n */\nexport async function fetchLatestVersion(method?: InstallMethod): Promise<string | null> {\n\tconst installMethod = method ?? detectInstallMethod();\n\n\ttry {\n\t\tif (installMethod === \"npm\" || installMethod === \"pnpm\" || installMethod === \"bun\") {\n\t\t\tconst response = await fetch(`https://registry.npmjs.org/${NPM_PACKAGE}/latest`);\n\t\t\tif (!response.ok) return null;\n\t\t\tconst json = await response.json();\n\t\t\tconst result = NpmPackageResponseSchema.safeParse(json);\n\t\t\tif (!result.success) return null;\n\t\t\treturn result.data.version ?? null;\n\t\t}\n\n\t\tconst response = await fetch(`https://api.github.com/repos/${GITHUB_REPO}/releases/latest`, {\n\t\t\theaders: {\n\t\t\t\tAccept: \"application/vnd.github.v3+json\",\n\t\t\t\t\"User-Agent\": \"offworld-cli\",\n\t\t\t},\n\t\t});\n\t\tif (!response.ok) return null;\n\t\tconst json = await response.json();\n\t\tconst tagName =\n\t\t\ttypeof json === \"object\" && json !== null && \"tag_name\" in json\n\t\t\t\t? String(json.tag_name)\n\t\t\t\t: null;\n\t\treturn tagName?.replace(/^v/, \"\") ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Execute upgrade for given method\n */\nexport function executeUpgrade(method: InstallMethod, version: string): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tlet cmd: string;\n\t\tlet args: string[];\n\n\t\tswitch (method) {\n\t\t\tcase \"curl\":\n\t\t\t\tcmd = \"bash\";\n\t\t\t\targs = [\"-c\", `curl -fsSL https://offworld.sh/install | VERSION=${version} bash`];\n\t\t\t\tbreak;\n\t\t\tcase \"npm\":\n\t\t\t\tcmd = \"npm\";\n\t\t\t\targs = [\"install\", \"-g\", `${NPM_PACKAGE}@${version}`];\n\t\t\t\tbreak;\n\t\t\tcase \"pnpm\":\n\t\t\t\tcmd = \"pnpm\";\n\t\t\t\targs = [\"install\", \"-g\", `${NPM_PACKAGE}@${version}`];\n\t\t\t\tbreak;\n\t\t\tcase \"bun\":\n\t\t\t\tcmd = \"bun\";\n\t\t\t\targs = [\"install\", \"-g\", `${NPM_PACKAGE}@${version}`];\n\t\t\t\tbreak;\n\t\t\tcase \"brew\":\n\t\t\t\tcmd = \"brew\";\n\t\t\t\targs = [\"upgrade\", \"offworld\"];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treject(new Error(`Cannot upgrade: unknown installation method`));\n\t\t\t\treturn;\n\t\t}\n\n\t\tconst proc = spawn(cmd, args, { stdio: \"inherit\" });\n\t\tproc.on(\"close\", (code) => {\n\t\t\tif (code === 0) resolve();\n\t\t\telse reject(new Error(`Upgrade failed with exit code ${code}`));\n\t\t});\n\t\tproc.on(\"error\", reject);\n\t});\n}\n\n/**\n * Execute uninstall for given method\n */\nexport function executeUninstall(method: InstallMethod): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tlet cmd: string;\n\t\tlet args: string[];\n\n\t\tswitch (method) {\n\t\t\tcase \"curl\":\n\t\t\t\ttry {\n\t\t\t\t\tconst binPath = join(homedir(), \".local\", \"bin\", \"ow\");\n\t\t\t\t\tif (existsSync(binPath)) {\n\t\t\t\t\t\texecSync(`rm -f \"${binPath}\"`, { stdio: \"inherit\" });\n\t\t\t\t\t}\n\t\t\t\t\tresolve();\n\t\t\t\t} catch (err) {\n\t\t\t\t\treject(err);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\tcase \"npm\":\n\t\t\t\tcmd = \"npm\";\n\t\t\t\targs = [\"uninstall\", \"-g\", NPM_PACKAGE];\n\t\t\t\tbreak;\n\t\t\tcase \"pnpm\":\n\t\t\t\tcmd = \"pnpm\";\n\t\t\t\targs = [\"uninstall\", \"-g\", NPM_PACKAGE];\n\t\t\t\tbreak;\n\t\t\tcase \"bun\":\n\t\t\t\tcmd = \"bun\";\n\t\t\t\targs = [\"remove\", \"-g\", NPM_PACKAGE];\n\t\t\t\tbreak;\n\t\t\tcase \"brew\":\n\t\t\t\tcmd = \"brew\";\n\t\t\t\targs = [\"uninstall\", \"offworld\"];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treject(new Error(`Cannot uninstall: unknown installation method`));\n\t\t\t\treturn;\n\t\t}\n\n\t\tconst proc = spawn(cmd, args, { stdio: \"inherit\" });\n\t\tproc.on(\"close\", (code) => {\n\t\t\tif (code === 0) resolve();\n\t\t\telse reject(new Error(`Uninstall failed with exit code ${code}`));\n\t\t});\n\t\tproc.on(\"error\", reject);\n\t});\n}\n\n/**\n * Get shell config files to clean\n */\nexport function getShellConfigFiles(): string[] {\n\tconst home = homedir();\n\tconst configs: string[] = [];\n\n\tconst candidates = [\n\t\t\".bashrc\",\n\t\t\".bash_profile\",\n\t\t\".profile\",\n\t\t\".zshrc\",\n\t\t\".zshenv\",\n\t\t\".config/fish/config.fish\",\n\t];\n\n\tfor (const file of candidates) {\n\t\tconst path = join(home, file);\n\t\tif (existsSync(path)) {\n\t\t\tconfigs.push(path);\n\t\t}\n\t}\n\n\treturn configs;\n}\n\n/**\n * Clean PATH entries from shell config\n */\nexport function cleanShellConfig(filePath: string): boolean {\n\ttry {\n\t\tconst content = readFileSync(filePath, \"utf-8\");\n\t\tconst lines = content.split(\"\\n\");\n\t\tconst filtered: string[] = [];\n\t\tlet modified = false;\n\n\t\tfor (const line of lines) {\n\t\t\tconst trimmed = line.trim();\n\t\t\tif (\n\t\t\t\ttrimmed.includes(\".local/bin\") &&\n\t\t\t\t(trimmed.startsWith(\"export PATH=\") || trimmed.startsWith(\"fish_add_path\"))\n\t\t\t) {\n\t\t\t\tif (trimmed.includes(\"# offworld\") || trimmed === 'export PATH=\"$HOME/.local/bin:$PATH\"') {\n\t\t\t\t\tmodified = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfiltered.push(line);\n\t\t}\n\n\t\tif (modified) {\n\t\t\twriteFileSync(filePath, filtered.join(\"\\n\"), \"utf-8\");\n\t\t}\n\n\t\treturn modified;\n\t} catch {\n\t\treturn false;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,wBAAwB,YAA0C;CAC1E,MAAM,QAAQ;EACb;EACA;EACA;EACA;EACA;EACA;EACA;AAED,MAAK,MAAM,aAAa,WACvB,OAAM,KAAK,KAAK,UAAU,WAAW,KAAK,UAAU,UAAU,KAAK,UAAU,KAAK,IAAI;AAGvF,OAAM,KAAK,GAAG;AACd,OAAM,KAAK,+CAA+C;AAC1D,OAAM,KAAK,wDAAwD;AACnE,OAAM,KAAK,GAAG;AAEd,QAAO,MAAM,KAAK,KAAK;;;;;;;;;AAUxB,SAAgB,wBAAwB,UAAkB,YAAwC;CACjG,MAAM,UAAU,WAAW,SAAS,GAAG,aAAa,UAAU,QAAQ,GAAG;CACzE,MAAM,qBAAqB,wBAAwB,WAAW;CAE9D,MAAM,eAAe;CACrB,MAAM,QAAQ,QAAQ,MAAM,aAAa;CAEzC,IAAI;AACJ,KAAI,MACH,kBAAiB,QAAQ,QAAQ,cAAc,mBAAmB;KAElE,kBAAiB,QAAQ,MAAM,GAAG,SAAS;AAG5C,eAAc,UAAU,gBAAgB,QAAQ;;;;;;;;;AAUjD,SAAgB,iBAAiB,aAAqB,YAAwC;CAC7F,MAAM,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AAoB,EAAE;AAW5B,MAAK,MAAM,QATQ;EAClB;EACA;EACA;EACA;EACA;EACA;EACA,EAE8B;EAC9B,MAAM,OAAO,KAAK,MAAM,KAAK;AAC7B,MAAI,WAAW,KAAK,CACnB,SAAQ,KAAK,KAAK;;AAIpB,QAAO;;;;;AAMR,SAAgB,iBAAiB,UAA2B;AAC3D,KAAI;EAEH,MAAM,QADU,aAAa,UAAU,QAAQ,CACzB,MAAM,KAAK;EACjC,MAAM,WAAqB,EAAE;EAC7B,IAAI,WAAW;AAEf,OAAK,MAAM,QAAQ,OAAO;GACzB,MAAM,UAAU,KAAK,MAAM;AAC3B,OACC,QAAQ,SAAS,aAAa,KAC7B,QAAQ,WAAW,eAAe,IAAI,QAAQ,WAAW,gBAAgB,GAE1E;QAAI,QAAQ,SAAS,aAAa,IAAI,YAAY,0CAAwC;AACzF,gBAAW;AACX;;;AAGF,YAAS,KAAK,KAAK;;AAGpB,MAAI,SACH,eAAc,UAAU,SAAS,KAAK,KAAK,EAAE,QAAQ;AAGtD,SAAO;SACA;AACP,SAAO"}
1
+ {"version":3,"file":"internal.mjs","names":[],"sources":["../src/agents-md.ts","../src/installation.ts"],"sourcesContent":["/**\n * AGENTS.md manipulation utilities\n *\n * Manages updating project AGENTS.md and agent-specific files with reference information.\n */\n\nimport { readFileSync, writeFileSync, existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport interface InstalledReference {\n\t/** Dependency name */\n\tdependency: string;\n\t/** Reference identifier (matches reference file name without .md) */\n\treference: string;\n\t/** Absolute path to reference file */\n\tpath: string;\n}\n\n/**\n * Generate single-line project reference guidance.\n *\n * @param _references - Installed references (unused; reserved for future context)\n * @returns Markdown string with one-line guidance\n */\nfunction generateReferencesTable(_references: InstalledReference[]): string {\n\tconst lines = [\n\t\t\"## Project References\",\n\t\t\"\",\n\t\t\"Use the Offworld CLI to find and read directly from local codebases for any repo in `.offworld/map.json` whenever the user asks about a specific open source project.\",\n\t\t\"\",\n\t];\n\n\treturn lines.join(\"\\n\");\n}\n\n/**\n * Update or append Project References section in a markdown file.\n * If the section exists, replaces its content. Otherwise, appends to end.\n *\n * @param filePath - Path to markdown file\n * @param references - Array of installed references\n */\nexport function appendReferencesSection(filePath: string, references: InstalledReference[]): void {\n\tconst content = existsSync(filePath) ? readFileSync(filePath, \"utf-8\") : \"\";\n\tconst referencesMarkdown = generateReferencesTable(references);\n\n\tconst sectionRegex = /^## Project References\\n(?:.*\\n)*?(?=^## |$)/m;\n\tconst match = content.match(sectionRegex);\n\n\tlet updatedContent: string;\n\tif (match) {\n\t\tupdatedContent = content.replace(sectionRegex, referencesMarkdown);\n\t} else {\n\t\tupdatedContent = content.trim() + \"\\n\\n\" + referencesMarkdown;\n\t}\n\n\twriteFileSync(filePath, updatedContent, \"utf-8\");\n}\n\n/**\n * Update AGENTS.md and agent-specific files with project references.\n * Creates files if they don't exist.\n *\n * @param projectRoot - Project root directory\n * @param references - Array of installed references to document\n */\nexport function updateAgentFiles(projectRoot: string, references: InstalledReference[]): void {\n\tconst agentsMdPath = join(projectRoot, \"AGENTS.md\");\n\tconst claudeMdPath = join(projectRoot, \"CLAUDE.md\");\n\n\tappendReferencesSection(agentsMdPath, references);\n\n\tif (existsSync(claudeMdPath)) {\n\t\tappendReferencesSection(claudeMdPath, references);\n\t}\n}\n","/**\n * Installation utilities for upgrade/uninstall commands\n */\n\nimport { execSync, spawn } from \"node:child_process\";\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { NpmPackageResponseSchema } from \"@offworld/types\";\nimport { VERSION } from \"./constants.js\";\n\nconst GITHUB_REPO = \"oscabriel/offworld\";\nconst NPM_PACKAGE = \"offworld\";\n\nexport type InstallMethod = \"curl\" | \"npm\" | \"pnpm\" | \"bun\" | \"brew\" | \"unknown\";\n\n/**\n * Detect how offworld was installed\n */\nexport function detectInstallMethod(): InstallMethod {\n\tconst execPath = process.execPath;\n\n\tif (execPath.includes(\".local/bin\")) return \"curl\";\n\n\tconst checks: Array<{ name: InstallMethod; test: () => boolean }> = [\n\t\t{\n\t\t\tname: \"npm\",\n\t\t\ttest: () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = execSync(\"npm list -g --depth=0 2>/dev/null\", {\n\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t});\n\t\t\t\t\treturn result.includes(NPM_PACKAGE);\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"pnpm\",\n\t\t\ttest: () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = execSync(\"pnpm list -g --depth=0 2>/dev/null\", {\n\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t});\n\t\t\t\t\treturn result.includes(NPM_PACKAGE);\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"bun\",\n\t\t\ttest: () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = execSync(\"bun pm ls -g 2>/dev/null\", {\n\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t});\n\t\t\t\t\treturn result.includes(NPM_PACKAGE);\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"brew\",\n\t\t\ttest: () => {\n\t\t\t\ttry {\n\t\t\t\t\texecSync(\"brew list --formula offworld 2>/dev/null\", {\n\t\t\t\t\t\tencoding: \"utf-8\",\n\t\t\t\t\t});\n\t\t\t\t\treturn true;\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t];\n\n\tif (execPath.includes(\"npm\")) {\n\t\tconst check = checks.find((c) => c.name === \"npm\");\n\t\tif (check?.test()) return \"npm\";\n\t}\n\tif (execPath.includes(\"pnpm\")) {\n\t\tconst check = checks.find((c) => c.name === \"pnpm\");\n\t\tif (check?.test()) return \"pnpm\";\n\t}\n\tif (execPath.includes(\"bun\")) {\n\t\tconst check = checks.find((c) => c.name === \"bun\");\n\t\tif (check?.test()) return \"bun\";\n\t}\n\tif (execPath.includes(\"Cellar\") || execPath.includes(\"homebrew\")) {\n\t\tconst check = checks.find((c) => c.name === \"brew\");\n\t\tif (check?.test()) return \"brew\";\n\t}\n\n\tfor (const check of checks) {\n\t\tif (check.test()) return check.name;\n\t}\n\n\treturn \"unknown\";\n}\n\n/**\n * Get current installed version\n */\nexport function getCurrentVersion(): string {\n\treturn VERSION;\n}\n\n/**\n * Fetch latest version from appropriate source\n */\nexport async function fetchLatestVersion(method?: InstallMethod): Promise<string | null> {\n\tconst installMethod = method ?? detectInstallMethod();\n\n\ttry {\n\t\tif (installMethod === \"npm\" || installMethod === \"pnpm\" || installMethod === \"bun\") {\n\t\t\tconst response = await fetch(`https://registry.npmjs.org/${NPM_PACKAGE}/latest`);\n\t\t\tif (!response.ok) return null;\n\t\t\tconst json = await response.json();\n\t\t\tconst result = NpmPackageResponseSchema.safeParse(json);\n\t\t\tif (!result.success) return null;\n\t\t\treturn result.data.version ?? null;\n\t\t}\n\n\t\tconst response = await fetch(`https://api.github.com/repos/${GITHUB_REPO}/releases/latest`, {\n\t\t\theaders: {\n\t\t\t\tAccept: \"application/vnd.github.v3+json\",\n\t\t\t\t\"User-Agent\": \"offworld-cli\",\n\t\t\t},\n\t\t});\n\t\tif (!response.ok) return null;\n\t\tconst json = await response.json();\n\t\tconst tagName =\n\t\t\ttypeof json === \"object\" && json !== null && \"tag_name\" in json\n\t\t\t\t? String(json.tag_name)\n\t\t\t\t: null;\n\t\treturn tagName?.replace(/^v/, \"\") ?? null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/**\n * Execute upgrade for given method\n */\nexport function executeUpgrade(method: InstallMethod, version: string): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tlet cmd: string;\n\t\tlet args: string[];\n\n\t\tswitch (method) {\n\t\t\tcase \"curl\":\n\t\t\t\tcmd = \"bash\";\n\t\t\t\targs = [\"-c\", `curl -fsSL https://offworld.sh/install | VERSION=${version} bash`];\n\t\t\t\tbreak;\n\t\t\tcase \"npm\":\n\t\t\t\tcmd = \"npm\";\n\t\t\t\targs = [\"install\", \"-g\", `${NPM_PACKAGE}@${version}`];\n\t\t\t\tbreak;\n\t\t\tcase \"pnpm\":\n\t\t\t\tcmd = \"pnpm\";\n\t\t\t\targs = [\"install\", \"-g\", `${NPM_PACKAGE}@${version}`];\n\t\t\t\tbreak;\n\t\t\tcase \"bun\":\n\t\t\t\tcmd = \"bun\";\n\t\t\t\targs = [\"install\", \"-g\", `${NPM_PACKAGE}@${version}`];\n\t\t\t\tbreak;\n\t\t\tcase \"brew\":\n\t\t\t\tcmd = \"brew\";\n\t\t\t\targs = [\"upgrade\", \"offworld\"];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treject(new Error(`Cannot upgrade: unknown installation method`));\n\t\t\t\treturn;\n\t\t}\n\n\t\tconst proc = spawn(cmd, args, { stdio: \"inherit\" });\n\t\tproc.on(\"close\", (code) => {\n\t\t\tif (code === 0) resolve();\n\t\t\telse reject(new Error(`Upgrade failed with exit code ${code}`));\n\t\t});\n\t\tproc.on(\"error\", reject);\n\t});\n}\n\n/**\n * Execute uninstall for given method\n */\nexport function executeUninstall(method: InstallMethod): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tlet cmd: string;\n\t\tlet args: string[];\n\n\t\tswitch (method) {\n\t\t\tcase \"curl\":\n\t\t\t\ttry {\n\t\t\t\t\tconst binPath = join(homedir(), \".local\", \"bin\", \"ow\");\n\t\t\t\t\tif (existsSync(binPath)) {\n\t\t\t\t\t\texecSync(`rm -f \"${binPath}\"`, { stdio: \"inherit\" });\n\t\t\t\t\t}\n\t\t\t\t\tresolve();\n\t\t\t\t} catch (err) {\n\t\t\t\t\treject(err);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\tcase \"npm\":\n\t\t\t\tcmd = \"npm\";\n\t\t\t\targs = [\"uninstall\", \"-g\", NPM_PACKAGE];\n\t\t\t\tbreak;\n\t\t\tcase \"pnpm\":\n\t\t\t\tcmd = \"pnpm\";\n\t\t\t\targs = [\"uninstall\", \"-g\", NPM_PACKAGE];\n\t\t\t\tbreak;\n\t\t\tcase \"bun\":\n\t\t\t\tcmd = \"bun\";\n\t\t\t\targs = [\"remove\", \"-g\", NPM_PACKAGE];\n\t\t\t\tbreak;\n\t\t\tcase \"brew\":\n\t\t\t\tcmd = \"brew\";\n\t\t\t\targs = [\"uninstall\", \"offworld\"];\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treject(new Error(`Cannot uninstall: unknown installation method`));\n\t\t\t\treturn;\n\t\t}\n\n\t\tconst proc = spawn(cmd, args, { stdio: \"inherit\" });\n\t\tproc.on(\"close\", (code) => {\n\t\t\tif (code === 0) resolve();\n\t\t\telse reject(new Error(`Uninstall failed with exit code ${code}`));\n\t\t});\n\t\tproc.on(\"error\", reject);\n\t});\n}\n\n/**\n * Get shell config files to clean\n */\nexport function getShellConfigFiles(): string[] {\n\tconst home = homedir();\n\tconst configs: string[] = [];\n\n\tconst candidates = [\n\t\t\".bashrc\",\n\t\t\".bash_profile\",\n\t\t\".profile\",\n\t\t\".zshrc\",\n\t\t\".zshenv\",\n\t\t\".config/fish/config.fish\",\n\t];\n\n\tfor (const file of candidates) {\n\t\tconst path = join(home, file);\n\t\tif (existsSync(path)) {\n\t\t\tconfigs.push(path);\n\t\t}\n\t}\n\n\treturn configs;\n}\n\n/**\n * Clean PATH entries from shell config\n */\nexport function cleanShellConfig(filePath: string): boolean {\n\ttry {\n\t\tconst content = readFileSync(filePath, \"utf-8\");\n\t\tconst lines = content.split(\"\\n\");\n\t\tconst filtered: string[] = [];\n\t\tlet modified = false;\n\n\t\tfor (const line of lines) {\n\t\t\tconst trimmed = line.trim();\n\t\t\tif (\n\t\t\t\ttrimmed.includes(\".local/bin\") &&\n\t\t\t\t(trimmed.startsWith(\"export PATH=\") || trimmed.startsWith(\"fish_add_path\"))\n\t\t\t) {\n\t\t\t\tif (trimmed.includes(\"# offworld\") || trimmed === 'export PATH=\"$HOME/.local/bin:$PATH\"') {\n\t\t\t\t\tmodified = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfiltered.push(line);\n\t\t}\n\n\t\tif (modified) {\n\t\t\twriteFileSync(filePath, filtered.join(\"\\n\"), \"utf-8\");\n\t\t}\n\n\t\treturn modified;\n\t} catch {\n\t\treturn false;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,wBAAwB,aAA2C;AAQ3E,QAPc;EACb;EACA;EACA;EACA;EACA,CAEY,KAAK,KAAK;;;;;;;;;AAUxB,SAAgB,wBAAwB,UAAkB,YAAwC;CACjG,MAAM,UAAU,WAAW,SAAS,GAAG,aAAa,UAAU,QAAQ,GAAG;CACzE,MAAM,qBAAqB,wBAAwB,WAAW;CAE9D,MAAM,eAAe;CACrB,MAAM,QAAQ,QAAQ,MAAM,aAAa;CAEzC,IAAI;AACJ,KAAI,MACH,kBAAiB,QAAQ,QAAQ,cAAc,mBAAmB;KAElE,kBAAiB,QAAQ,MAAM,GAAG,SAAS;AAG5C,eAAc,UAAU,gBAAgB,QAAQ;;;;;;;;;AAUjD,SAAgB,iBAAiB,aAAqB,YAAwC;CAC7F,MAAM,eAAe,KAAK,aAAa,YAAY;CACnD,MAAM,eAAe,KAAK,aAAa,YAAY;AAEnD,yBAAwB,cAAc,WAAW;AAEjD,KAAI,WAAW,aAAa,CAC3B,yBAAwB,cAAc,WAAW;;;;;;;;AC9DnD,MAAM,cAAc;AACpB,MAAM,cAAc;;;;AAOpB,SAAgB,sBAAqC;CACpD,MAAM,WAAW,QAAQ;AAEzB,KAAI,SAAS,SAAS,aAAa,CAAE,QAAO;CAE5C,MAAM,SAA8D;EACnE;GACC,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,IAAI,WAAW;AAEf,OAAK,MAAM,QAAQ,OAAO;GACzB,MAAM,UAAU,KAAK,MAAM;AAC3B,OACC,QAAQ,SAAS,aAAa,KAC7B,QAAQ,WAAW,eAAe,IAAI,QAAQ,WAAW,gBAAgB,GAE1E;QAAI,QAAQ,SAAS,aAAa,IAAI,YAAY,0CAAwC;AACzF,gBAAW;AACX;;;AAGF,YAAS,KAAK,KAAK;;AAGpB,MAAI,SACH,eAAc,UAAU,SAAS,KAAK,KAAK,EAAE,QAAQ;AAGtD,SAAO;SACA;AACP,SAAO"}
@@ -12,7 +12,7 @@ import { z } from "zod";
12
12
  * SDK Constants
13
13
  */
14
14
  /** SDK version - must match package.json */
15
- const VERSION = "0.3.1";
15
+ const VERSION = "0.3.2";
16
16
  /**
17
17
  * Default patterns to ignore when scanning repositories.
18
18
  * Includes directories, binary files, IDE configs, and build outputs.
@@ -742,47 +742,136 @@ function getAllAgentConfigs() {
742
742
  }
743
743
 
744
744
  //#endregion
745
- //#region src/reference.ts
746
- const PackageJsonKeywordsSchema = z.object({
747
- name: z.string().optional(),
748
- keywords: z.array(z.string()).optional()
749
- });
750
- function normalizeKeyword(value) {
751
- const trimmed = value.trim();
752
- if (!trimmed) return [];
753
- const normalized = trimmed.toLowerCase();
754
- const tokens = /* @__PURE__ */ new Set();
755
- const addToken = (token) => {
756
- const cleaned = token.trim().toLowerCase();
757
- if (cleaned.length < 2) return;
758
- tokens.add(cleaned);
745
+ //#region src/dep-mappings.ts
746
+ /**
747
+ * Dependency name to GitHub repo resolution:
748
+ * 1. Query npm registry for repository.url
749
+ * 2. Fall back to FALLBACK_MAPPINGS for packages missing repository field
750
+ * 3. Return unknown (caller handles)
751
+ */
752
+ /**
753
+ * Fallback mappings for packages where npm registry doesn't have repository.url.
754
+ * Only add packages here that genuinely don't have the field set.
755
+ */
756
+ const FALLBACK_MAPPINGS = {
757
+ "@convex-dev/react-query": "get-convex/convex-react-query",
758
+ "@opencode-ai/sdk": "anomalyco/opencode-sdk-js"
759
+ };
760
+ /**
761
+ * Parse GitHub repo from various git URL formats.
762
+ * Handles:
763
+ * - git+https://github.com/owner/repo.git
764
+ * - https://github.com/owner/repo
765
+ * - git://github.com/owner/repo.git
766
+ * - github:owner/repo
767
+ */
768
+ function parseGitHubUrl(url) {
769
+ for (const pattern of [/github\.com[/:]([\w-]+)\/([\w.-]+?)(?:\.git)?$/, /^github:([\w-]+)\/([\w.-]+)$/]) {
770
+ const match = url.match(pattern);
771
+ if (match) return `${match[1]}/${match[2]}`;
772
+ }
773
+ return null;
774
+ }
775
+ async function fetchNpmPackage(packageName) {
776
+ try {
777
+ const res = await fetch(`https://registry.npmjs.org/${packageName}`);
778
+ if (!res.ok) return null;
779
+ const json = await res.json();
780
+ const result = NpmPackageResponseSchema.safeParse(json);
781
+ if (!result.success) return null;
782
+ return result.data;
783
+ } catch {
784
+ return null;
785
+ }
786
+ }
787
+ /**
788
+ * Fallback to npm registry to extract repository.url.
789
+ * Returns null if package not found, no repo field, or not a GitHub repo.
790
+ */
791
+ async function resolveFromNpm(packageName) {
792
+ const pkg = await fetchNpmPackage(packageName);
793
+ if (!pkg?.repository) return null;
794
+ const repoUrl = typeof pkg.repository === "string" ? pkg.repository : pkg.repository.url;
795
+ if (!repoUrl) return null;
796
+ return parseGitHubUrl(repoUrl);
797
+ }
798
+ async function getNpmKeywords(packageName) {
799
+ const pkg = await fetchNpmPackage(packageName);
800
+ if (!pkg?.keywords || pkg.keywords.length === 0) return [];
801
+ const seen = /* @__PURE__ */ new Set();
802
+ for (const keyword of pkg.keywords) {
803
+ const normalized = keyword.trim().toLowerCase();
804
+ if (normalized.length < 2) continue;
805
+ seen.add(normalized);
806
+ }
807
+ return Array.from(seen);
808
+ }
809
+ /**
810
+ * Resolution order:
811
+ * 1. Query npm registry for repository.url
812
+ * 2. Check FALLBACK_MAPPINGS for packages missing repository field
813
+ * 3. Return unknown
814
+ */
815
+ async function resolveDependencyRepo(dep) {
816
+ const npmRepo = await resolveFromNpm(dep);
817
+ if (npmRepo) return {
818
+ dep,
819
+ repo: npmRepo,
820
+ source: "npm"
759
821
  };
760
- addToken(normalized);
761
- addToken(normalized.replaceAll("/", "-"));
762
- addToken(normalized.replaceAll("/", ""));
763
- for (const token of normalized.split(/[\s/_-]+/)) addToken(token);
764
- if (normalized.startsWith("@")) addToken(normalized.slice(1));
765
- return Array.from(tokens);
766
- }
767
- function deriveKeywords(fullName, localPath, referenceContent) {
768
- const keywords = /* @__PURE__ */ new Set();
769
- const addKeywords = (value) => {
770
- for (const token of normalizeKeyword(value)) keywords.add(token);
822
+ if (dep in FALLBACK_MAPPINGS) return {
823
+ dep,
824
+ repo: FALLBACK_MAPPINGS[dep] ?? null,
825
+ source: "fallback"
771
826
  };
772
- addKeywords(fullName);
773
- const headingMatch = referenceContent.match(/^#\s+(.+)$/m);
774
- if (headingMatch?.[1]) addKeywords(headingMatch[1]);
827
+ return {
828
+ dep,
829
+ repo: null,
830
+ source: "unknown"
831
+ };
832
+ }
833
+
834
+ //#endregion
835
+ //#region src/reference.ts
836
+ const PackageJsonNameSchema = z.object({ name: z.string().optional() });
837
+ function normalizeKeywords(values) {
838
+ const seen = /* @__PURE__ */ new Set();
839
+ for (const value of values) {
840
+ const normalized = value.trim().toLowerCase();
841
+ if (normalized.length < 2) continue;
842
+ seen.add(normalized);
843
+ }
844
+ return Array.from(seen);
845
+ }
846
+ function deriveMinimalKeywords(fullName) {
847
+ const normalized = fullName.trim().toLowerCase();
848
+ if (!normalized) return [];
849
+ return normalizeKeywords([normalized, normalized.split("/").pop() ?? normalized]);
850
+ }
851
+ function getPackageName(localPath) {
775
852
  const packageJsonPath = join(localPath, "package.json");
776
- if (existsSync(packageJsonPath)) try {
853
+ if (!existsSync(packageJsonPath)) return null;
854
+ try {
777
855
  const content = readFileSync(packageJsonPath, "utf-8");
778
856
  const json = JSON.parse(content);
779
- const parsed = PackageJsonKeywordsSchema.safeParse(json);
780
- if (parsed.success) {
781
- if (parsed.data.name) addKeywords(parsed.data.name);
782
- if (parsed.data.keywords) for (const keyword of parsed.data.keywords) addKeywords(keyword);
783
- }
784
- } catch {}
785
- return Array.from(keywords);
857
+ const parsed = PackageJsonNameSchema.safeParse(json);
858
+ if (!parsed.success || !parsed.data.name) return null;
859
+ return parsed.data.name;
860
+ } catch {
861
+ return null;
862
+ }
863
+ }
864
+ /**
865
+ * Resolve keywords with npm-first strategy.
866
+ * - npm package: package name + npm keywords
867
+ * - non-npm package: minimal repo-derived keywords
868
+ */
869
+ async function resolveReferenceKeywords(fullName, localPath) {
870
+ const packageName = getPackageName(localPath);
871
+ if (!packageName) return deriveMinimalKeywords(fullName);
872
+ const npmKeywords = await getNpmKeywords(packageName);
873
+ if (npmKeywords.length > 0) return normalizeKeywords([packageName, ...npmKeywords]);
874
+ return normalizeKeywords([packageName]);
786
875
  }
787
876
  /**
788
877
  * Ensure a symlink exists, removing any existing file/directory at the path
@@ -823,33 +912,9 @@ Use \`ow\` to locate and read Offworld reference files for dependencies.
823
912
  - You want the verified reference instead of web search
824
913
  - You are about to work inside a repo clone
825
914
 
826
- ## Prerequisites
827
-
828
- Check that the CLI is available:
829
-
830
- \`\`\`bash
831
- ow --version
832
- \`\`\`
833
-
834
- If \`ow\` is not available, install it:
835
-
836
- \`\`\`bash
837
- curl -fsSL https://offworld.sh/install | bash
838
- \`\`\`
839
-
840
- ## Setup
915
+ ## Installation and Setup
841
916
 
842
- Initialize Offworld once per machine:
843
-
844
- \`\`\`bash
845
- ow init
846
- \`\`\`
847
-
848
- For a specific project, build a project map:
849
-
850
- \`\`\`bash
851
- ow project init
852
- \`\`\`
917
+ If Offworld CLI or opencode is missing, read \`references/installation.md\` in this skill directory and follow it.
853
918
 
854
919
  ## Usage
855
920
 
@@ -894,6 +959,59 @@ ow project init # scan project deps, install references
894
959
 
895
960
  - Docs: https://offworld.sh/cli
896
961
  `;
962
+ const INSTALLATION_REFERENCE_TEMPLATE = `# Offworld Installation
963
+
964
+ Use this when Offworld CLI or opencode is not installed.
965
+
966
+ ## 1) Check opencode
967
+
968
+ \`\`\`bash
969
+ opencode --version
970
+ \`\`\`
971
+
972
+ If missing:
973
+
974
+ \`\`\`bash
975
+ curl -fsSL https://opencode.ai/install | bash
976
+ \`\`\`
977
+
978
+ ## 2) Check Offworld CLI
979
+
980
+ \`\`\`bash
981
+ ow --version
982
+ \`\`\`
983
+
984
+ If missing:
985
+
986
+ \`\`\`bash
987
+ curl -fsSL https://offworld.sh/install | bash
988
+ \`\`\`
989
+
990
+ ## 3) Initialize Offworld (non-interactive)
991
+
992
+ \`\`\`bash
993
+ ow init --yes --agents "<agent-list>" --repo-root "<clone-dir>" --model "<provider/model>"
994
+ \`\`\`
995
+
996
+ Example:
997
+
998
+ \`\`\`bash
999
+ ow init --yes --agents "opencode,codex" --repo-root "~/ow" --model "anthropic/claude-sonnet-4-20250514"
1000
+ \`\`\`
1001
+
1002
+ ## 4) Initialize current project
1003
+
1004
+ \`\`\`bash
1005
+ ow project init --yes --all --generate
1006
+ \`\`\`
1007
+
1008
+ ## 5) Verify
1009
+
1010
+ \`\`\`bash
1011
+ ow config show
1012
+ ow list
1013
+ \`\`\`
1014
+ `;
897
1015
  /**
898
1016
  * Ensures the global SKILL.md exists and symlinks the offworld/ directory to all agent skill directories.
899
1017
  *
@@ -910,6 +1028,8 @@ function installGlobalSkill() {
910
1028
  mkdirSync(Paths.offworldReferencesDir, { recursive: true });
911
1029
  const skillPath = join(Paths.offworldSkillDir, "SKILL.md");
912
1030
  if (!existsSync(skillPath)) writeFileSync(skillPath, GLOBAL_SKILL_TEMPLATE, "utf-8");
1031
+ const installationReferencePath = join(Paths.offworldReferencesDir, "installation.md");
1032
+ if (!existsSync(installationReferencePath)) writeFileSync(installationReferencePath, INSTALLATION_REFERENCE_TEMPLATE, "utf-8");
913
1033
  const configuredAgents = config.agents ?? [];
914
1034
  for (const agentName of configuredAgents) {
915
1035
  const agentConfig = agents[agentName];
@@ -958,17 +1078,12 @@ function installReference(qualifiedName, fullName, localPath, referenceContent,
958
1078
  const legacyEntry = legacyQualifiedName ? map.repos[legacyQualifiedName] : void 0;
959
1079
  const references = [...existingEntry?.references ?? [], ...legacyEntry?.references ?? []];
960
1080
  if (!references.includes(referenceFileName)) references.push(referenceFileName);
961
- const derivedKeywords = keywords ?? deriveKeywords(fullName, localPath, referenceContent);
962
- const keywordsSet = new Set([
963
- ...existingEntry?.keywords ?? [],
964
- ...legacyEntry?.keywords ?? [],
965
- ...derivedKeywords
966
- ]);
1081
+ const derivedKeywords = keywords && keywords.length > 0 ? keywords : deriveMinimalKeywords(fullName);
967
1082
  map.repos[qualifiedName] = {
968
1083
  localPath,
969
1084
  references,
970
1085
  primary: referenceFileName,
971
- keywords: Array.from(keywordsSet),
1086
+ keywords: normalizeKeywords(derivedKeywords),
972
1087
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
973
1088
  };
974
1089
  if (legacyQualifiedName && legacyQualifiedName in map.repos) delete map.repos[legacyQualifiedName];
@@ -1278,80 +1393,6 @@ function parseRequirementsTxt(path) {
1278
1393
  }
1279
1394
  }
1280
1395
 
1281
- //#endregion
1282
- //#region src/dep-mappings.ts
1283
- /**
1284
- * Dependency name to GitHub repo resolution:
1285
- * 1. Query npm registry for repository.url
1286
- * 2. Fall back to FALLBACK_MAPPINGS for packages missing repository field
1287
- * 3. Return unknown (caller handles)
1288
- */
1289
- /**
1290
- * Fallback mappings for packages where npm registry doesn't have repository.url.
1291
- * Only add packages here that genuinely don't have the field set.
1292
- */
1293
- const FALLBACK_MAPPINGS = {
1294
- "@convex-dev/react-query": "get-convex/convex-react-query",
1295
- "@opencode-ai/sdk": "anomalyco/opencode-sdk-js"
1296
- };
1297
- /**
1298
- * Parse GitHub repo from various git URL formats.
1299
- * Handles:
1300
- * - git+https://github.com/owner/repo.git
1301
- * - https://github.com/owner/repo
1302
- * - git://github.com/owner/repo.git
1303
- * - github:owner/repo
1304
- */
1305
- function parseGitHubUrl(url) {
1306
- for (const pattern of [/github\.com[/:]([\w-]+)\/([\w.-]+?)(?:\.git)?$/, /^github:([\w-]+)\/([\w.-]+)$/]) {
1307
- const match = url.match(pattern);
1308
- if (match) return `${match[1]}/${match[2]}`;
1309
- }
1310
- return null;
1311
- }
1312
- /**
1313
- * Fallback to npm registry to extract repository.url.
1314
- * Returns null if package not found, no repo field, or not a GitHub repo.
1315
- */
1316
- async function resolveFromNpm(packageName) {
1317
- try {
1318
- const res = await fetch(`https://registry.npmjs.org/${packageName}`);
1319
- if (!res.ok) return null;
1320
- const json = await res.json();
1321
- const result = NpmPackageResponseSchema.safeParse(json);
1322
- if (!result.success) return null;
1323
- const repoUrl = result.data.repository?.url;
1324
- if (!repoUrl) return null;
1325
- return parseGitHubUrl(repoUrl);
1326
- } catch {
1327
- return null;
1328
- }
1329
- }
1330
- /**
1331
- * Resolution order:
1332
- * 1. Query npm registry for repository.url
1333
- * 2. Check FALLBACK_MAPPINGS for packages missing repository field
1334
- * 3. Return unknown
1335
- */
1336
- async function resolveDependencyRepo(dep) {
1337
- const npmRepo = await resolveFromNpm(dep);
1338
- if (npmRepo) return {
1339
- dep,
1340
- repo: npmRepo,
1341
- source: "npm"
1342
- };
1343
- if (dep in FALLBACK_MAPPINGS) return {
1344
- dep,
1345
- repo: FALLBACK_MAPPINGS[dep] ?? null,
1346
- source: "fallback"
1347
- };
1348
- return {
1349
- dep,
1350
- repo: null,
1351
- source: "unknown"
1352
- };
1353
- }
1354
-
1355
1396
  //#endregion
1356
1397
  //#region src/reference-matcher.ts
1357
1398
  /**
@@ -1819,5 +1860,5 @@ async function validateProviderModel(providerId, modelId) {
1819
1860
  }
1820
1861
 
1821
1862
  //#endregion
1822
- export { getToken as A, NotGitRepoError as B, getAllAgentConfigs as C, clearAuthData as D, TokenExpiredError as E, saveAuthData as F, DEFAULT_IGNORE_PATTERNS as G, RepoSourceError as H, getMapEntry as I, VERSION as K, getProjectMapPath as L, isLoggedIn as M, loadAuthData as N, getAuthPath as O, refreshAccessToken as P, resolveRepoKey as R, getAgentConfig as S, NotLoggedInError as T, getReferenceFileNameForSource as U, PathNotFoundError as V, parseRepoInput as W, parseDependencies as _, discoverRepos as a, agents as b, pruneRepos as c, matchDependenciesToReferences as d, matchDependenciesToReferencesWithRemoteCheck as f, detectManifestType as g, resolveFromNpm as h, validateProviderModel as i, getTokenOrNull as j, getAuthStatus as k, updateAllRepos as l, resolveDependencyRepo as m, listProviders as n, gcRepos as o, FALLBACK_MAPPINGS as p, listProvidersWithModels as r, getRepoStatus as s, getProvider as t, isReferenceInstalled as u, installGlobalSkill as v, AuthError as w, detectInstalledAgents as x, installReference as y, searchMap as z };
1823
- //# sourceMappingURL=public-CjA2mMwu.mjs.map
1863
+ export { getAuthPath as A, resolveRepoKey as B, detectInstalledAgents as C, NotLoggedInError as D, AuthError as E, loadAuthData as F, getReferenceFileNameForSource as G, NotGitRepoError as H, refreshAccessToken as I, VERSION as J, parseRepoInput as K, saveAuthData as L, getToken as M, getTokenOrNull as N, TokenExpiredError as O, isLoggedIn as P, getMapEntry as R, agents as S, getAllAgentConfigs as T, PathNotFoundError as U, searchMap as V, RepoSourceError as W, resolveReferenceKeywords as _, discoverRepos as a, resolveDependencyRepo as b, pruneRepos as c, matchDependenciesToReferences as d, matchDependenciesToReferencesWithRemoteCheck as f, installReference as g, installGlobalSkill as h, validateProviderModel as i, getAuthStatus as j, clearAuthData as k, updateAllRepos as l, parseDependencies as m, listProviders as n, gcRepos as o, detectManifestType as p, DEFAULT_IGNORE_PATTERNS as q, listProvidersWithModels as r, getRepoStatus as s, getProvider as t, isReferenceInstalled as u, FALLBACK_MAPPINGS as v, getAgentConfig as w, resolveFromNpm as x, getNpmKeywords as y, getProjectMapPath as z };
1864
+ //# sourceMappingURL=public-BUgna8vR.mjs.map