@skild/core 0.5.1 → 0.7.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/dist/index.d.ts CHANGED
@@ -129,6 +129,8 @@ declare function clearRegistryAuth(): void;
129
129
  declare function getSkillsDir(platform: Platform, scope: InstallScope): string;
130
130
  declare function getSkillInstallDir(platform: Platform, scope: InstallScope, skillName: string): string;
131
131
 
132
+ declare function readSkillMd(skillDir: string): string | null;
133
+ declare function parseSkillFrontmatter(skillMdContent: string): SkillFrontmatter | null;
132
134
  declare function validateSkillDir(skillDir: string): SkillValidationResult;
133
135
 
134
136
  interface InitOptions {
@@ -245,4 +247,4 @@ declare function uninstallSkill(name: string, options?: InstallOptions & {
245
247
  }): void;
246
248
  declare function updateSkill(name?: string, options?: UpdateOptions): Promise<InstallRecord[]>;
247
249
 
248
- 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, assertValidAlias, canonicalNameToInstallDirName, clearRegistryAuth, deriveChildSource, downloadAndExtractTarball, fetchWithTimeout, getSkillInfo, getSkillInstallDir, getSkillsDir, initSkill, installRegistrySkill, installSkill, isValidAlias, listAllSkills, listSkills, loadOrCreateGlobalConfig, loadRegistryAuth, materializeSourceToDir, materializeSourceToTemp, normalizeAlias, parseRegistrySpecifier, resolveRegistryAlias, resolveRegistryUrl, resolveRegistryVersion, saveRegistryAuth, searchRegistrySkills, splitCanonicalName, stripSourceRef, toDegitPath, uninstallSkill, updateSkill, validateSkill, validateSkillDir };
250
+ 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, assertValidAlias, canonicalNameToInstallDirName, clearRegistryAuth, deriveChildSource, downloadAndExtractTarball, fetchWithTimeout, getSkillInfo, getSkillInstallDir, getSkillsDir, initSkill, installRegistrySkill, installSkill, isValidAlias, listAllSkills, listSkills, loadOrCreateGlobalConfig, loadRegistryAuth, materializeSourceToDir, materializeSourceToTemp, normalizeAlias, parseRegistrySpecifier, parseSkillFrontmatter, readSkillMd, resolveRegistryAlias, resolveRegistryUrl, resolveRegistryVersion, saveRegistryAuth, searchRegistrySkills, splitCanonicalName, stripSourceRef, toDegitPath, uninstallSkill, updateSkill, validateSkill, validateSkillDir };
package/dist/index.js CHANGED
@@ -634,13 +634,22 @@ async function resolveRegistryAlias(registryUrl, alias) {
634
634
  throw new SkildError("REGISTRY_RESOLVE_FAILED", `Failed to resolve alias "${a}" (${res.status}). ${text}`.trim());
635
635
  }
636
636
  const json = await res.json();
637
- if (!json?.ok || !json.type || typeof json.spec !== "string" || !json.spec.trim()) {
637
+ const normalizedSpec = normalizeResolvedSpec(json?.spec);
638
+ if (!json?.ok || !json.type || !normalizedSpec) {
638
639
  throw new SkildError("REGISTRY_RESOLVE_FAILED", `Invalid registry response for alias "${a}".`);
639
640
  }
640
- if (json.type === "registry") return { type: "registry", spec: json.spec.trim() };
641
- if (json.type === "linked") return { type: "linked", spec: json.spec.trim() };
641
+ if (json.type === "registry") return { type: "registry", spec: normalizedSpec };
642
+ if (json.type === "linked") return { type: "linked", spec: normalizedSpec };
642
643
  throw new SkildError("REGISTRY_RESOLVE_FAILED", `Unsupported alias target type "${json.type}".`);
643
644
  }
645
+ function normalizeResolvedSpec(spec) {
646
+ if (typeof spec !== "string") return "";
647
+ let normalized = spec.trim();
648
+ while (normalized.length >= 2 && (normalized.startsWith('"') && normalized.endsWith('"') || normalized.startsWith("'") && normalized.endsWith("'"))) {
649
+ normalized = normalized.slice(1, -1).trim();
650
+ }
651
+ return normalized;
652
+ }
644
653
  async function downloadAndExtractTarball(resolved, tempRoot, stagingDir) {
645
654
  const res = await fetchWithTimeout(resolved.tarballUrl, {}, 3e4);
646
655
  if (!res.ok) {
@@ -1219,6 +1228,8 @@ export {
1219
1228
  materializeSourceToTemp,
1220
1229
  normalizeAlias,
1221
1230
  parseRegistrySpecifier,
1231
+ parseSkillFrontmatter,
1232
+ readSkillMd,
1222
1233
  resolveRegistryAlias,
1223
1234
  resolveRegistryUrl,
1224
1235
  resolveRegistryVersion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skild/core",
3
- "version": "0.5.1",
3
+ "version": "0.7.0",
4
4
  "description": "Skild core library (headless) for installing, validating, and managing Agent Skills locally.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",