@skild/core 0.4.0 → 0.4.1

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
@@ -158,6 +158,15 @@ declare function materializeSourceToTemp(source: string): Promise<{
158
158
  sourceType: SourceType;
159
159
  }>;
160
160
 
161
+ declare function toDegitPath(url: string): string;
162
+ /**
163
+ * Derive a child source spec from a base source and a relative path.
164
+ *
165
+ * - GitHub URLs are converted to degit shorthand so the result is a valid install source.
166
+ * - Keeps `#ref` when present.
167
+ */
168
+ declare function deriveChildSource(baseSource: string, relPath: string): string;
169
+
161
170
  declare const DEFAULT_REGISTRY_URL = "https://registry.skild.sh";
162
171
  interface RegistrySpecifier {
163
172
  canonicalName: string;
@@ -235,4 +244,4 @@ declare function uninstallSkill(name: string, options?: InstallOptions & {
235
244
  }): void;
236
245
  declare function updateSkill(name?: string, options?: UpdateOptions): Promise<InstallRecord[]>;
237
246
 
238
- 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, downloadAndExtractTarball, fetchWithTimeout, getSkillInfo, getSkillInstallDir, getSkillsDir, initSkill, installRegistrySkill, installSkill, isValidAlias, listAllSkills, listSkills, loadOrCreateGlobalConfig, loadRegistryAuth, materializeSourceToDir, materializeSourceToTemp, normalizeAlias, parseRegistrySpecifier, resolveRegistryAlias, resolveRegistryUrl, resolveRegistryVersion, saveRegistryAuth, searchRegistrySkills, splitCanonicalName, uninstallSkill, updateSkill, validateSkill, validateSkillDir };
247
+ 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, toDegitPath, uninstallSkill, updateSkill, validateSkill, validateSkillDir };
package/dist/index.js CHANGED
@@ -418,10 +418,26 @@ function toDegitPath(url) {
418
418
  const [, owner, repo, branch, subpath] = treeMatch;
419
419
  return `${owner}/${repo}/${subpath}#${branch}`;
420
420
  }
421
+ const treeRootMatch = url.match(/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)(?:\/)?$/);
422
+ if (treeRootMatch) {
423
+ const [, owner, repo, branch] = treeRootMatch;
424
+ return `${owner}/${repo}#${branch}`;
425
+ }
421
426
  const repoMatch = url.match(/github\.com\/([^/]+\/[^/]+)/);
422
427
  if (repoMatch) return repoMatch[1].replace(/\.git$/, "");
423
428
  return url;
424
429
  }
430
+ function normalizeRelPath(relPath) {
431
+ return relPath.split(path6.sep).join("/").replace(/^\/+/, "").replace(/\/+$/, "");
432
+ }
433
+ function deriveChildSource(baseSource, relPath) {
434
+ const baseType = classifySource(baseSource);
435
+ const baseSpec = baseType === "github-url" ? toDegitPath(baseSource) : baseSource;
436
+ const [pathPart, ref] = baseSpec.split("#", 2);
437
+ const clean = normalizeRelPath(relPath);
438
+ const joined = clean ? `${pathPart.replace(/\/+$/, "")}/${clean}` : pathPart;
439
+ return ref ? `${joined}#${ref}` : joined;
440
+ }
425
441
 
426
442
  // src/materialize.ts
427
443
  function ensureInstallableDir(sourcePath) {
@@ -1156,6 +1172,7 @@ export {
1156
1172
  assertValidAlias,
1157
1173
  canonicalNameToInstallDirName,
1158
1174
  clearRegistryAuth,
1175
+ deriveChildSource,
1159
1176
  downloadAndExtractTarball,
1160
1177
  fetchWithTimeout,
1161
1178
  getSkillInfo,
@@ -1179,6 +1196,7 @@ export {
1179
1196
  saveRegistryAuth,
1180
1197
  searchRegistrySkills,
1181
1198
  splitCanonicalName,
1199
+ toDegitPath,
1182
1200
  uninstallSkill,
1183
1201
  updateSkill,
1184
1202
  validateSkill,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skild/core",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
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",