@skild/core 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +8 -1
- package/dist/index.js +19 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -167,6 +167,13 @@ declare function searchRegistrySkills(registryUrl: string, query: string, limit?
|
|
|
167
167
|
created_at?: string;
|
|
168
168
|
updated_at?: string;
|
|
169
169
|
}>>;
|
|
170
|
+
declare function resolveRegistryAlias(registryUrl: string, alias: string): Promise<{
|
|
171
|
+
type: 'registry';
|
|
172
|
+
spec: string;
|
|
173
|
+
} | {
|
|
174
|
+
type: 'linked';
|
|
175
|
+
spec: string;
|
|
176
|
+
}>;
|
|
170
177
|
declare function downloadAndExtractTarball(resolved: RegistryResolvedVersion, tempRoot: string, stagingDir: string): Promise<void>;
|
|
171
178
|
|
|
172
179
|
interface InstallInput {
|
|
@@ -204,4 +211,4 @@ declare function uninstallSkill(name: string, options?: InstallOptions & {
|
|
|
204
211
|
}): void;
|
|
205
212
|
declare function updateSkill(name?: string, options?: UpdateOptions): Promise<InstallRecord[]>;
|
|
206
213
|
|
|
207
|
-
export { DEFAULT_REGISTRY_URL, type DependencySourceType, type GlobalConfig, type InstallOptions, type InstallRecord, type InstallScope, type InstalledDependency, type ListOptions, type Lockfile, PLATFORMS, type Platform, type RegistryAuth, SkildError, type SkillFrontmatter, type SkillValidationIssue, type SkillValidationResult, type UpdateOptions, canonicalNameToInstallDirName, clearRegistryAuth, downloadAndExtractTarball, fetchWithTimeout, getSkillInfo, getSkillInstallDir, getSkillsDir, initSkill, installRegistrySkill, installSkill, listAllSkills, listSkills, loadOrCreateGlobalConfig, loadRegistryAuth, parseRegistrySpecifier, resolveRegistryUrl, resolveRegistryVersion, saveRegistryAuth, searchRegistrySkills, splitCanonicalName, uninstallSkill, updateSkill, validateSkill, validateSkillDir };
|
|
214
|
+
export { DEFAULT_REGISTRY_URL, type DependencySourceType, type GlobalConfig, type InstallOptions, type InstallRecord, type InstallScope, type InstalledDependency, type ListOptions, type Lockfile, PLATFORMS, type Platform, type RegistryAuth, SkildError, type SkillFrontmatter, type SkillValidationIssue, type SkillValidationResult, type UpdateOptions, canonicalNameToInstallDirName, clearRegistryAuth, downloadAndExtractTarball, fetchWithTimeout, getSkillInfo, getSkillInstallDir, getSkillsDir, initSkill, installRegistrySkill, installSkill, listAllSkills, listSkills, loadOrCreateGlobalConfig, loadRegistryAuth, parseRegistrySpecifier, resolveRegistryAlias, resolveRegistryUrl, resolveRegistryVersion, saveRegistryAuth, searchRegistrySkills, splitCanonicalName, uninstallSkill, updateSkill, validateSkill, validateSkillDir };
|
package/dist/index.js
CHANGED
|
@@ -360,6 +360,24 @@ async function searchRegistrySkills(registryUrl, query, limit = 50) {
|
|
|
360
360
|
}
|
|
361
361
|
return json.skills;
|
|
362
362
|
}
|
|
363
|
+
async function resolveRegistryAlias(registryUrl, alias) {
|
|
364
|
+
const a = alias.trim();
|
|
365
|
+
if (!a) throw new SkildError("INVALID_SOURCE", "Missing alias.");
|
|
366
|
+
const url = new URL(`${registryUrl}/resolve`);
|
|
367
|
+
url.searchParams.set("alias", a);
|
|
368
|
+
const res = await fetchWithTimeout(url.toString(), { headers: { accept: "application/json" } }, 1e4);
|
|
369
|
+
if (!res.ok) {
|
|
370
|
+
const text = await res.text().catch(() => "");
|
|
371
|
+
throw new SkildError("REGISTRY_RESOLVE_FAILED", `Failed to resolve alias "${a}" (${res.status}). ${text}`.trim());
|
|
372
|
+
}
|
|
373
|
+
const json = await res.json();
|
|
374
|
+
if (!json?.ok || !json.type || typeof json.spec !== "string" || !json.spec.trim()) {
|
|
375
|
+
throw new SkildError("REGISTRY_RESOLVE_FAILED", `Invalid registry response for alias "${a}".`);
|
|
376
|
+
}
|
|
377
|
+
if (json.type === "registry") return { type: "registry", spec: json.spec.trim() };
|
|
378
|
+
if (json.type === "linked") return { type: "linked", spec: json.spec.trim() };
|
|
379
|
+
throw new SkildError("REGISTRY_RESOLVE_FAILED", `Unsupported alias target type "${json.type}".`);
|
|
380
|
+
}
|
|
363
381
|
async function downloadAndExtractTarball(resolved, tempRoot, stagingDir) {
|
|
364
382
|
const res = await fetchWithTimeout(resolved.tarballUrl, {}, 3e4);
|
|
365
383
|
if (!res.ok) {
|
|
@@ -1079,6 +1097,7 @@ export {
|
|
|
1079
1097
|
loadOrCreateGlobalConfig,
|
|
1080
1098
|
loadRegistryAuth,
|
|
1081
1099
|
parseRegistrySpecifier,
|
|
1100
|
+
resolveRegistryAlias,
|
|
1082
1101
|
resolveRegistryUrl,
|
|
1083
1102
|
resolveRegistryVersion,
|
|
1084
1103
|
saveRegistryAuth,
|