@skild/core 0.4.7 → 0.5.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 +3 -2
- package/dist/index.js +31 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare class SkildError extends Error {
|
|
|
5
5
|
constructor(code: SkildErrorCode, message: string, details?: Record<string, unknown>);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
declare const PLATFORMS: readonly ["claude", "codex", "copilot", "antigravity", "opencode"];
|
|
8
|
+
declare const PLATFORMS: readonly ["claude", "codex", "copilot", "antigravity", "opencode", "cursor", "windsurf"];
|
|
9
9
|
type Platform = (typeof PLATFORMS)[number];
|
|
10
10
|
type InstallScope = 'global' | 'project';
|
|
11
11
|
type SourceType = 'local' | 'github-url' | 'degit-shorthand' | 'registry';
|
|
@@ -159,6 +159,7 @@ declare function materializeSourceToTemp(source: string): Promise<{
|
|
|
159
159
|
}>;
|
|
160
160
|
|
|
161
161
|
declare function toDegitPath(url: string): string;
|
|
162
|
+
declare function stripSourceRef(source: string): string;
|
|
162
163
|
/**
|
|
163
164
|
* Derive a child source spec from a base source and a relative path.
|
|
164
165
|
*
|
|
@@ -244,4 +245,4 @@ declare function uninstallSkill(name: string, options?: InstallOptions & {
|
|
|
244
245
|
}): void;
|
|
245
246
|
declare function updateSkill(name?: string, options?: UpdateOptions): Promise<InstallRecord[]>;
|
|
246
247
|
|
|
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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var SkildError = class extends Error {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
// src/types.ts
|
|
13
|
-
var PLATFORMS = ["claude", "codex", "copilot", "antigravity", "opencode"];
|
|
13
|
+
var PLATFORMS = ["claude", "codex", "copilot", "antigravity", "opencode", "cursor", "windsurf"];
|
|
14
14
|
|
|
15
15
|
// src/storage.ts
|
|
16
16
|
import fs2 from "fs";
|
|
@@ -47,6 +47,10 @@ function getSkillsDir(platform, scope) {
|
|
|
47
47
|
return scope === "project" ? path.join(getProjectDir(), ".agent", "skills") : path.join(getHomeDir(), ".gemini", "antigravity", "skills");
|
|
48
48
|
case "opencode":
|
|
49
49
|
return scope === "project" ? path.join(getProjectDir(), ".opencode", "skill") : path.join(getHomeDir(), ".config", "opencode", "skill");
|
|
50
|
+
case "cursor":
|
|
51
|
+
return scope === "project" ? path.join(getProjectDir(), ".cursor", "skills") : path.join(getHomeDir(), ".cursor", "skills");
|
|
52
|
+
case "windsurf":
|
|
53
|
+
return scope === "project" ? path.join(getProjectDir(), ".windsurf", "skills") : path.join(getHomeDir(), ".windsurf", "skills");
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
function getProjectSkildDir() {
|
|
@@ -429,6 +433,11 @@ function toDegitPath(url) {
|
|
|
429
433
|
if (repoMatch) return repoMatch[1].replace(/\.git$/, "");
|
|
430
434
|
return url;
|
|
431
435
|
}
|
|
436
|
+
function stripSourceRef(source) {
|
|
437
|
+
const hashIndex = source.indexOf("#");
|
|
438
|
+
if (hashIndex === -1) return source;
|
|
439
|
+
return source.slice(0, hashIndex);
|
|
440
|
+
}
|
|
432
441
|
function normalizeRelPath(relPath) {
|
|
433
442
|
return relPath.split(path6.sep).join("/").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
434
443
|
}
|
|
@@ -451,6 +460,24 @@ async function cloneRemote(degitSrc, targetPath) {
|
|
|
451
460
|
const emitter = degit(degitSrc, { force: true, verbose: false });
|
|
452
461
|
await emitter.clone(targetPath);
|
|
453
462
|
}
|
|
463
|
+
function isMissingRefError(error) {
|
|
464
|
+
if (!error) return false;
|
|
465
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
466
|
+
return /could not find commit hash/i.test(message);
|
|
467
|
+
}
|
|
468
|
+
async function cloneRemoteWithFallback(degitSrc, targetPath) {
|
|
469
|
+
try {
|
|
470
|
+
await cloneRemote(degitSrc, targetPath);
|
|
471
|
+
return degitSrc;
|
|
472
|
+
} catch (error) {
|
|
473
|
+
if (!degitSrc.includes("#") || !isMissingRefError(error)) {
|
|
474
|
+
throw error;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
const fallbackSrc = stripSourceRef(degitSrc);
|
|
478
|
+
await cloneRemote(fallbackSrc, targetPath);
|
|
479
|
+
return fallbackSrc;
|
|
480
|
+
}
|
|
454
481
|
async function materializeSourceToDir(input) {
|
|
455
482
|
const sourceType = classifySource(input.source);
|
|
456
483
|
const targetDir = path7.resolve(input.targetDir);
|
|
@@ -468,8 +495,8 @@ async function materializeSourceToDir(input) {
|
|
|
468
495
|
return { sourceType: "local", materializedFrom: localPath };
|
|
469
496
|
}
|
|
470
497
|
const degitPath = toDegitPath(input.source);
|
|
471
|
-
await
|
|
472
|
-
return { sourceType, materializedFrom
|
|
498
|
+
const materializedFrom = await cloneRemoteWithFallback(degitPath, targetDir);
|
|
499
|
+
return { sourceType, materializedFrom };
|
|
473
500
|
}
|
|
474
501
|
async function materializeSourceToTemp(source) {
|
|
475
502
|
const sourceType = classifySource(source);
|
|
@@ -1198,6 +1225,7 @@ export {
|
|
|
1198
1225
|
saveRegistryAuth,
|
|
1199
1226
|
searchRegistrySkills,
|
|
1200
1227
|
splitCanonicalName,
|
|
1228
|
+
stripSourceRef,
|
|
1201
1229
|
toDegitPath,
|
|
1202
1230
|
uninstallSkill,
|
|
1203
1231
|
updateSkill,
|