skilld 1.6.2 → 1.7.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/README.md +29 -20
- package/dist/_chunks/agent.mjs +14 -4
- package/dist/_chunks/agent.mjs.map +1 -1
- package/dist/_chunks/assemble.mjs +1 -1
- package/dist/_chunks/author-group.mjs +17 -0
- package/dist/_chunks/author-group.mjs.map +1 -0
- package/dist/_chunks/author.mjs +11 -12
- package/dist/_chunks/author.mjs.map +1 -1
- package/dist/_chunks/cache.mjs +12 -2
- package/dist/_chunks/cache.mjs.map +1 -1
- package/dist/_chunks/cache2.mjs +1 -1
- package/dist/_chunks/cli-helpers.mjs +4 -120
- package/dist/_chunks/cli-helpers.mjs.map +1 -1
- package/dist/_chunks/config.mjs +119 -27
- package/dist/_chunks/config.mjs.map +1 -1
- package/dist/_chunks/core.mjs +2 -2
- package/dist/_chunks/embedding-cache2.mjs +1 -1
- package/dist/_chunks/index.d.mts +4 -1
- package/dist/_chunks/index.d.mts.map +1 -1
- package/dist/_chunks/index3.d.mts +81 -78
- package/dist/_chunks/index3.d.mts.map +1 -1
- package/dist/_chunks/install.mjs +22 -34
- package/dist/_chunks/install.mjs.map +1 -1
- package/dist/_chunks/list.mjs +1 -1
- package/dist/_chunks/lockfile.mjs +5 -1
- package/dist/_chunks/lockfile.mjs.map +1 -1
- package/dist/_chunks/prefix.mjs +108 -0
- package/dist/_chunks/prefix.mjs.map +1 -0
- package/dist/_chunks/prepare.mjs +6 -2
- package/dist/_chunks/prepare.mjs.map +1 -1
- package/dist/_chunks/prepare2.mjs +4 -4
- package/dist/_chunks/prepare2.mjs.map +1 -1
- package/dist/_chunks/prompts.mjs +4 -237
- package/dist/_chunks/prompts.mjs.map +1 -1
- package/dist/_chunks/search-helpers.mjs +99 -0
- package/dist/_chunks/search-helpers.mjs.map +1 -0
- package/dist/_chunks/search-interactive.mjs +2 -2
- package/dist/_chunks/search-interactive.mjs.map +1 -1
- package/dist/_chunks/search.mjs +219 -1
- package/dist/_chunks/search.mjs.map +1 -0
- package/dist/_chunks/skill.mjs +329 -0
- package/dist/_chunks/skill.mjs.map +1 -0
- package/dist/_chunks/skills.mjs +2 -2
- package/dist/_chunks/sources.mjs +1180 -987
- package/dist/_chunks/sources.mjs.map +1 -1
- package/dist/_chunks/sync-registry.mjs +59 -0
- package/dist/_chunks/sync-registry.mjs.map +1 -0
- package/dist/_chunks/sync-shared2.mjs +14 -12
- package/dist/_chunks/sync-shared2.mjs.map +1 -1
- package/dist/_chunks/sync.mjs +253 -158
- package/dist/_chunks/sync.mjs.map +1 -1
- package/dist/_chunks/sync2.mjs +1 -1
- package/dist/_chunks/uninstall.mjs +5 -4
- package/dist/_chunks/uninstall.mjs.map +1 -1
- package/dist/_chunks/upload.mjs +152 -0
- package/dist/_chunks/upload.mjs.map +1 -0
- package/dist/_chunks/validate.mjs +1 -1
- package/dist/_chunks/version.mjs +30 -0
- package/dist/_chunks/version.mjs.map +1 -0
- package/dist/_chunks/wizard.mjs +3 -2
- package/dist/_chunks/wizard.mjs.map +1 -1
- package/dist/agent/index.d.mts +3 -1
- package/dist/agent/index.d.mts.map +1 -1
- package/dist/agent/index.mjs +4 -3
- package/dist/cache/index.d.mts +2 -2
- package/dist/cache/index.mjs +3 -3
- package/dist/cli.mjs +48 -21
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/prepare.mjs +1 -1
- package/dist/sources/index.d.mts +2 -2
- package/dist/sources/index.mjs +2 -2
- package/dist/types.d.mts +2 -2
- package/package.json +12 -12
- package/dist/THIRD-PARTY-LICENSES.md +0 -38
- package/dist/_chunks/formatting.mjs +0 -82
- package/dist/_chunks/formatting.mjs.map +0 -1
- package/dist/_chunks/libs/@sinclair/typebox.mjs +0 -2304
- package/dist/_chunks/libs/@sinclair/typebox.mjs.map +0 -1
- package/dist/_chunks/rolldown-runtime.mjs +0 -11
- package/dist/_chunks/search2.mjs +0 -310
- package/dist/_chunks/search2.mjs.map +0 -1
package/dist/_chunks/sync.mjs
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as getModelLabel, i as getAvailableModels, s as optimizeDocs, t as detectImportedPackages } from "./agent.mjs";
|
|
2
|
+
import { i as CACHE_DIR, r as getVersionKey, t as getCacheDir } from "./version.mjs";
|
|
2
3
|
import { r as resolvePkgDir } from "./prepare.mjs";
|
|
3
4
|
import { n as sanitizeMarkdown } from "./sanitize.mjs";
|
|
4
|
-
import { a as hasShippedDocs,
|
|
5
|
+
import { a as hasShippedDocs, d as linkPkgNamed, g as readCachedSection, i as getPkgKeyFiles, m as listReferenceFiles, r as ensureCacheDir, s as isCached } from "./cache.mjs";
|
|
5
6
|
import { i as parseFrontmatter } from "./markdown.mjs";
|
|
6
7
|
import { a as semverDiff, n as getSharedSkillsDir, t as SHARED_SKILLS_DIR } from "./shared.mjs";
|
|
7
|
-
import {
|
|
8
|
+
import { J as isPrerelease, M as resolveGitHubRepo, f as resolvePackageDocsWithAttempts, i as fetchPkgDist, it as parsePackageSpec, m as fetchGitSkills, nt as parseGitHubRepoSlug, p as searchNpmPackages, s as readLocalDependencies, w as resolveCrateDocsWithAttempts } from "./sources.mjs";
|
|
8
9
|
import { a as targets } from "./detect.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { c as wrapSection, n as SECTION_OUTPUT_FILES, r as buildAllSectionPrompts, s as portabilizePrompt, t as SECTION_MERGE_ORDER } from "./prompts.mjs";
|
|
11
|
+
import { _ as timedSpinner, i as computeSkillDirName, n as writeGeneratedSkillMd, o as linkSkillToAgents, r as writeSkillMd, s as sanitizeName, u as formatDuration, v as todayIsoDate } from "./skill.mjs";
|
|
12
|
+
import { a as readConfig, o as registerProject, r as hasCompletedWizard, t as defaultFeatures } from "./config.mjs";
|
|
13
|
+
import { S as suggestPrepareHook, _ as promptForAgent, b as resolveAgent, f as introLine, o as getInstalledGenerators, p as isInteractive, x as sharedArgs } from "./cli-helpers.mjs";
|
|
14
|
+
import { a as readLock, c as writeLock, n as parsePackageNames, o as removeLockEntry, r as parsePackages } from "./lockfile.mjs";
|
|
13
15
|
import { t as getProjectState } from "./skills.mjs";
|
|
14
|
-
import {
|
|
16
|
+
import { n as resolveSkillName, r as toStoragePackageName, t as parseSkillInput } from "./prefix.mjs";
|
|
15
17
|
import { t as runWizard } from "./wizard.mjs";
|
|
16
18
|
import { S as writePromptFiles, _ as linkAllReferences, b as selectLlmConfig, c as ejectReferences, d as ensureGitignore, f as fetchAndCacheResources, g as indexResources, h as handleShippedSkills, l as enhanceSkillWithLLM, m as forceClearCache, n as RESOLVE_STEP_LABELS, o as detectChangelog, p as findRelatedSkills, t as DEFAULT_SECTIONS, u as ensureAgentInstructions, v as resolveBaseDir, y as resolveLocalDep } from "./sync-shared2.mjs";
|
|
17
19
|
import { n as shutdownWorker } from "./pool2.mjs";
|
|
@@ -84,7 +86,7 @@ async function syncGitSkills(opts) {
|
|
|
84
86
|
for (const skill of selected) {
|
|
85
87
|
const skillDir = join(baseDir, skill.name);
|
|
86
88
|
mkdirSync(skillDir, { recursive: true });
|
|
87
|
-
|
|
89
|
+
writeSkillMd(skillDir, sanitizeMarkdown(skill.content));
|
|
88
90
|
if (skill.files.length > 0) for (const f of skill.files) {
|
|
89
91
|
const filePath = join(skillDir, f.path);
|
|
90
92
|
mkdirSync(dirname(filePath), { recursive: true });
|
|
@@ -96,7 +98,7 @@ async function syncGitSkills(opts) {
|
|
|
96
98
|
repo: source.type === "local" ? source.localPath : `${source.owner}/${source.repo}`,
|
|
97
99
|
path: skill.path || void 0,
|
|
98
100
|
ref: source.ref || "main",
|
|
99
|
-
syncedAt: (
|
|
101
|
+
syncedAt: todayIsoDate(),
|
|
100
102
|
generator: "external"
|
|
101
103
|
});
|
|
102
104
|
}
|
|
@@ -179,10 +181,10 @@ async function syncGitHubRepo(opts) {
|
|
|
179
181
|
version,
|
|
180
182
|
repo: `${owner}/${repo}`,
|
|
181
183
|
source: resources.docSource,
|
|
182
|
-
syncedAt: (
|
|
184
|
+
syncedAt: todayIsoDate(),
|
|
183
185
|
generator: "skilld"
|
|
184
186
|
});
|
|
185
|
-
|
|
187
|
+
writeGeneratedSkillMd(skillDir, {
|
|
186
188
|
name: packageName,
|
|
187
189
|
version,
|
|
188
190
|
releasedAt: resolved.releasedAt,
|
|
@@ -199,7 +201,6 @@ async function syncGitHubRepo(opts) {
|
|
|
199
201
|
repoUrl,
|
|
200
202
|
features
|
|
201
203
|
});
|
|
202
|
-
writeFileSync(join(skillDir, "SKILL.md"), baseSkillMd);
|
|
203
204
|
p.log.success(`Created base skill: ${relative(cwd, skillDir)}`);
|
|
204
205
|
if (!readConfig().skipLlm && (!yes || opts.model)) {
|
|
205
206
|
const llmConfig = await selectLlmConfig(opts.model);
|
|
@@ -366,7 +367,7 @@ async function syncPackagesParallel(config) {
|
|
|
366
367
|
if (content) cachedParts.push(wrapSection(s, content));
|
|
367
368
|
}
|
|
368
369
|
const cachedBody = cachedParts.join("\n\n");
|
|
369
|
-
|
|
370
|
+
writeGeneratedSkillMd(skillDir, {
|
|
370
371
|
name: resolvedName,
|
|
371
372
|
version: data.version,
|
|
372
373
|
releasedAt: data.resolved.releasedAt,
|
|
@@ -386,7 +387,6 @@ async function syncPackagesParallel(config) {
|
|
|
386
387
|
repoUrl: data.resolved.repoUrl,
|
|
387
388
|
features: data.features
|
|
388
389
|
});
|
|
389
|
-
writeFileSync(join(skillDir, "SKILL.md"), skillMd);
|
|
390
390
|
cachedPkgs.push(pkg);
|
|
391
391
|
}
|
|
392
392
|
}
|
|
@@ -576,19 +576,19 @@ async function syncBaseSkill(packageSpec, config, cwd, update) {
|
|
|
576
576
|
const relatedSkills = await findRelatedSkills(packageName, baseDir);
|
|
577
577
|
const shippedDocs = hasShippedDocs(packageName, cwd, version);
|
|
578
578
|
const pkgFiles = getPkgKeyFiles(packageName, cwd, version);
|
|
579
|
-
const repoSlug = resolved.repoUrl
|
|
579
|
+
const repoSlug = parseGitHubRepoSlug(resolved.repoUrl);
|
|
580
580
|
linkPkgNamed(skillDir, packageName, cwd, version);
|
|
581
581
|
writeLock(baseDir, skillDirName, {
|
|
582
582
|
packageName,
|
|
583
583
|
version,
|
|
584
584
|
repo: repoSlug,
|
|
585
585
|
source: resources.docSource,
|
|
586
|
-
syncedAt: (
|
|
586
|
+
syncedAt: todayIsoDate(),
|
|
587
587
|
generator: "skilld"
|
|
588
588
|
});
|
|
589
589
|
const updatedLock = readLock(baseDir)?.skills[skillDirName];
|
|
590
|
-
const allPackages =
|
|
591
|
-
const
|
|
590
|
+
const allPackages = parsePackageNames(updatedLock?.packages);
|
|
591
|
+
const overheadLines = writeGeneratedSkillMd(skillDir, {
|
|
592
592
|
name: packageName,
|
|
593
593
|
version,
|
|
594
594
|
releasedAt: resolved.releasedAt,
|
|
@@ -606,9 +606,7 @@ async function syncBaseSkill(packageSpec, config, cwd, update) {
|
|
|
606
606
|
packages: allPackages.length > 1 ? allPackages : void 0,
|
|
607
607
|
repoUrl: resolved.repoUrl,
|
|
608
608
|
features
|
|
609
|
-
});
|
|
610
|
-
writeFileSync(join(skillDir, "SKILL.md"), skillMd);
|
|
611
|
-
const overheadLines = skillMd.split("\n").length;
|
|
609
|
+
}).split("\n").length;
|
|
612
610
|
const shared = !config.global && getSharedSkillsDir(cwd);
|
|
613
611
|
if (shared) linkSkillToAgents(skillDirName, shared, cwd, config.agent);
|
|
614
612
|
if (!config.global) registerProject(cwd);
|
|
@@ -669,28 +667,25 @@ async function enhanceWithLLM(packageName, data, config, cwd, update, sections,
|
|
|
669
667
|
update(packageName, "error", error, versionKey);
|
|
670
668
|
throw new Error(error);
|
|
671
669
|
}
|
|
672
|
-
if (wasOptimized) {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
});
|
|
692
|
-
writeFileSync(join(skillDir, "SKILL.md"), skillMd);
|
|
693
|
-
}
|
|
670
|
+
if (wasOptimized) writeGeneratedSkillMd(skillDir, {
|
|
671
|
+
name: packageName,
|
|
672
|
+
version: data.version,
|
|
673
|
+
releasedAt: data.resolved.releasedAt,
|
|
674
|
+
distTags: data.resolved.distTags,
|
|
675
|
+
body: optimized,
|
|
676
|
+
relatedSkills: data.relatedSkills,
|
|
677
|
+
hasIssues: data.hasIssues,
|
|
678
|
+
hasDiscussions: data.hasDiscussions,
|
|
679
|
+
hasReleases: data.hasReleases,
|
|
680
|
+
hasChangelog: data.hasChangelog,
|
|
681
|
+
docsType: data.docsType,
|
|
682
|
+
hasShippedDocs: data.shippedDocs,
|
|
683
|
+
pkgFiles: data.pkgFiles,
|
|
684
|
+
dirName: data.skillDirName,
|
|
685
|
+
packages: data.packages,
|
|
686
|
+
repoUrl: data.resolved.repoUrl,
|
|
687
|
+
features: data.features
|
|
688
|
+
});
|
|
694
689
|
update(packageName, "done", "Skill optimized", versionKey);
|
|
695
690
|
}
|
|
696
691
|
const RESOLVE_SOURCE_LABELS = {
|
|
@@ -713,10 +708,18 @@ function showResolveAttempts(attempts) {
|
|
|
713
708
|
p.log.message(` ${icon} ${source}${msg}`);
|
|
714
709
|
}
|
|
715
710
|
}
|
|
711
|
+
function isCrateSpec(spec) {
|
|
712
|
+
return spec.startsWith("crate:");
|
|
713
|
+
}
|
|
714
|
+
function toCrateIdentity(crateName) {
|
|
715
|
+
return `crate:${crateName}`;
|
|
716
|
+
}
|
|
716
717
|
async function syncCommand(state, opts) {
|
|
717
718
|
if (opts.packages && opts.packages.length > 0) {
|
|
718
|
-
|
|
719
|
-
|
|
719
|
+
const crateSpecs = opts.packages.filter(isCrateSpec);
|
|
720
|
+
const npmSpecs = opts.packages.filter((p) => !isCrateSpec(p));
|
|
721
|
+
if (npmSpecs.length > 1) await syncPackagesParallel({
|
|
722
|
+
packages: npmSpecs,
|
|
720
723
|
global: opts.global,
|
|
721
724
|
agent: opts.agent,
|
|
722
725
|
model: opts.model,
|
|
@@ -725,7 +728,8 @@ async function syncCommand(state, opts) {
|
|
|
725
728
|
debug: opts.debug,
|
|
726
729
|
mode: opts.mode
|
|
727
730
|
});
|
|
728
|
-
await syncSinglePackage(
|
|
731
|
+
else if (npmSpecs.length === 1) await syncSinglePackage(npmSpecs[0], opts);
|
|
732
|
+
for (const spec of crateSpecs) await syncSinglePackage(spec, opts);
|
|
729
733
|
return;
|
|
730
734
|
}
|
|
731
735
|
const packages = await interactivePicker(state);
|
|
@@ -802,64 +806,79 @@ async function pickFromList(packages, state) {
|
|
|
802
806
|
return selected;
|
|
803
807
|
}
|
|
804
808
|
async function syncSinglePackage(packageSpec, config) {
|
|
805
|
-
const
|
|
809
|
+
const isCrate = isCrateSpec(packageSpec);
|
|
810
|
+
const normalizedSpec = isCrate ? packageSpec.slice(6).trim() : packageSpec;
|
|
811
|
+
if (isCrate && !normalizedSpec) {
|
|
812
|
+
p.log.error("Invalid crate spec. Use format: crate:<name>");
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
const { name: parsedName, tag: requestedTag } = parsePackageSpec(normalizedSpec);
|
|
816
|
+
const packageName = isCrate ? parsedName.toLowerCase() : parsedName;
|
|
817
|
+
const identityPackageName = isCrate ? toCrateIdentity(packageName) : packageName;
|
|
818
|
+
const storagePackageName = toStoragePackageName(identityPackageName);
|
|
806
819
|
const spin = timedSpinner();
|
|
807
820
|
spin.start(`Resolving ${packageSpec}`);
|
|
808
821
|
const cwd = process.cwd();
|
|
809
|
-
const
|
|
810
|
-
const
|
|
822
|
+
const localDeps = isCrate ? [] : await readLocalDependencies(cwd).catch(() => []);
|
|
823
|
+
const localVersion = isCrate ? void 0 : localDeps.find((d) => d.name === packageName)?.version;
|
|
824
|
+
const resolveResult = isCrate ? await resolveCrateDocsWithAttempts(packageName, {
|
|
825
|
+
version: requestedTag,
|
|
826
|
+
onProgress: (step) => spin.message(`${identityPackageName}: ${step}`)
|
|
827
|
+
}) : await resolvePackageDocsWithAttempts(requestedTag ? normalizedSpec : packageName, {
|
|
811
828
|
version: localVersion,
|
|
812
829
|
cwd,
|
|
813
830
|
onProgress: (step) => spin.message(`${packageName}: ${RESOLVE_STEP_LABELS[step]}`)
|
|
814
831
|
});
|
|
815
832
|
let resolved = resolveResult.package;
|
|
816
|
-
if (!resolved) {
|
|
833
|
+
if (!resolved && !isCrate) {
|
|
817
834
|
spin.message(`Resolving local package: ${packageName}`);
|
|
818
835
|
resolved = await resolveLocalDep(packageName, cwd);
|
|
819
836
|
}
|
|
820
837
|
if (!resolved) {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
838
|
+
if (!isCrate) {
|
|
839
|
+
const earlyShipped = handleShippedSkills(packageName, localVersion || resolveResult.registryVersion || "latest", cwd, config.agent, config.global);
|
|
840
|
+
if (earlyShipped) {
|
|
841
|
+
const shared = !config.global && getSharedSkillsDir(cwd);
|
|
842
|
+
for (const shipped of earlyShipped.shipped) {
|
|
843
|
+
if (shared) linkSkillToAgents(shipped.skillName, shared, cwd, config.agent);
|
|
844
|
+
p.log.success(`Using published SKILL.md: ${shipped.skillName} → ${relative(cwd, shipped.skillDir)}`);
|
|
845
|
+
}
|
|
846
|
+
spin.stop(`Using published SKILL.md(s) from ${packageName}`);
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
spin.message(`Searching npm for "${packageName}"...`);
|
|
850
|
+
const suggestions = await searchNpmPackages(packageName);
|
|
851
|
+
if (suggestions.length > 0) {
|
|
852
|
+
spin.stop(`Package "${packageName}" not found on npm`);
|
|
853
|
+
showResolveAttempts(resolveResult.attempts);
|
|
854
|
+
const selected = await p.select({
|
|
855
|
+
message: "Did you mean one of these?",
|
|
856
|
+
options: [...suggestions.map((s) => ({
|
|
857
|
+
label: s.name,
|
|
858
|
+
value: s.name,
|
|
859
|
+
hint: s.description
|
|
860
|
+
})), {
|
|
861
|
+
label: "None of these",
|
|
862
|
+
value: "_none_"
|
|
863
|
+
}]
|
|
864
|
+
});
|
|
865
|
+
if (!p.isCancel(selected) && selected !== "_none_") return syncSinglePackage(selected, config);
|
|
866
|
+
return;
|
|
827
867
|
}
|
|
828
|
-
spin.stop(`Using published SKILL.md(s) from ${packageName}`);
|
|
829
|
-
return;
|
|
830
|
-
}
|
|
831
|
-
spin.message(`Searching npm for "${packageName}"...`);
|
|
832
|
-
const suggestions = await searchNpmPackages(packageName);
|
|
833
|
-
if (suggestions.length > 0) {
|
|
834
|
-
spin.stop(`Package "${packageName}" not found on npm`);
|
|
835
|
-
showResolveAttempts(resolveResult.attempts);
|
|
836
|
-
const selected = await p.select({
|
|
837
|
-
message: "Did you mean one of these?",
|
|
838
|
-
options: [...suggestions.map((s) => ({
|
|
839
|
-
label: s.name,
|
|
840
|
-
value: s.name,
|
|
841
|
-
hint: s.description
|
|
842
|
-
})), {
|
|
843
|
-
label: "None of these",
|
|
844
|
-
value: "_none_"
|
|
845
|
-
}]
|
|
846
|
-
});
|
|
847
|
-
if (!p.isCancel(selected) && selected !== "_none_") return syncSinglePackage(selected, config);
|
|
848
|
-
return;
|
|
849
868
|
}
|
|
850
|
-
spin.stop(`Could not find docs for: ${
|
|
869
|
+
spin.stop(`Could not find docs for: ${identityPackageName}`);
|
|
851
870
|
showResolveAttempts(resolveResult.attempts);
|
|
852
871
|
return;
|
|
853
872
|
}
|
|
854
|
-
const version = localVersion || resolved.version || "latest";
|
|
873
|
+
const version = isCrate ? resolved.version || requestedTag || "latest" : localVersion || resolved.version || "latest";
|
|
855
874
|
const versionKey = getVersionKey(version);
|
|
856
|
-
if (config.force) forceClearCache(
|
|
857
|
-
const useCache = isCached(
|
|
858
|
-
if (!existsSync(join(cwd, "node_modules", packageName))) {
|
|
875
|
+
if (config.force) forceClearCache(storagePackageName, version);
|
|
876
|
+
const useCache = isCached(storagePackageName, version);
|
|
877
|
+
if (!isCrate && !existsSync(join(cwd, "node_modules", packageName))) {
|
|
859
878
|
spin.message(`Downloading ${packageName}@${version} dist`);
|
|
860
879
|
await fetchPkgDist(packageName, version);
|
|
861
880
|
}
|
|
862
|
-
const shippedResult = handleShippedSkills(packageName, version, cwd, config.agent, config.global);
|
|
881
|
+
const shippedResult = isCrate ? null : handleShippedSkills(packageName, version, cwd, config.agent, config.global);
|
|
863
882
|
if (shippedResult) {
|
|
864
883
|
const shared = !config.global && getSharedSkillsDir(cwd);
|
|
865
884
|
for (const shipped of shippedResult.shipped) {
|
|
@@ -869,18 +888,18 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
869
888
|
spin.stop(`Using published SKILL.md(s) from ${packageName}`);
|
|
870
889
|
return;
|
|
871
890
|
}
|
|
872
|
-
spin.stop(`Resolved ${
|
|
873
|
-
if (!localVersion && !requestedTag && !isPrerelease(version)) {
|
|
891
|
+
spin.stop(`Resolved ${identityPackageName}@${useCache ? versionKey : version}${config.force ? " (force)" : useCache ? " (cached)" : ""}`);
|
|
892
|
+
if (!isCrate && !localVersion && !requestedTag && !isPrerelease(version)) {
|
|
874
893
|
const nextTag = resolved.distTags?.next ?? resolved.distTags?.beta ?? resolved.distTags?.alpha;
|
|
875
894
|
if (nextTag && (!resolved.releasedAt || !nextTag.releasedAt || nextTag.releasedAt > resolved.releasedAt)) p.log.warn(`\x1B[33mNo local dependency found — using latest stable (${version}). Prerelease ${nextTag.version} available: skilld add ${packageName}@beta\x1B[0m`);
|
|
876
895
|
}
|
|
877
896
|
ensureCacheDir();
|
|
878
897
|
const baseDir = resolveBaseDir(cwd, config.agent, config.global);
|
|
879
|
-
let skillDirName = config.name ? sanitizeName(config.name) : computeSkillDirName(
|
|
898
|
+
let skillDirName = config.name ? sanitizeName(config.name) : computeSkillDirName(storagePackageName);
|
|
880
899
|
if (config.mode === "update" && !config.name) {
|
|
881
900
|
const lock = readLock(baseDir);
|
|
882
901
|
if (lock) {
|
|
883
|
-
for (const [name, info] of Object.entries(lock.skills)) if (info.packageName ===
|
|
902
|
+
for (const [name, info] of Object.entries(lock.skills)) if (info.packageName === identityPackageName || parsePackages(info.packages).some((p) => p.name === identityPackageName)) {
|
|
884
903
|
skillDirName = name;
|
|
885
904
|
break;
|
|
886
905
|
}
|
|
@@ -889,7 +908,7 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
889
908
|
const skillDir = config.eject ? typeof config.eject === "string" ? join(resolve(cwd, config.eject), skillDirName) : join(cwd, "skills", skillDirName) : join(baseDir, skillDirName);
|
|
890
909
|
mkdirSync(skillDir, { recursive: true });
|
|
891
910
|
const existingLock = config.eject ? void 0 : readLock(baseDir)?.skills[skillDirName];
|
|
892
|
-
const isMerge = existingLock && existingLock.packageName && existingLock.packageName !==
|
|
911
|
+
const isMerge = existingLock && existingLock.packageName && existingLock.packageName !== identityPackageName;
|
|
893
912
|
const updateCtx = config.mode === "update" && existingLock ? {
|
|
894
913
|
oldVersion: existingLock.version,
|
|
895
914
|
newVersion: version,
|
|
@@ -901,24 +920,25 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
901
920
|
})()
|
|
902
921
|
} : void 0;
|
|
903
922
|
if (isMerge) {
|
|
904
|
-
spin.stop(`Merging ${
|
|
905
|
-
linkPkgNamed(skillDir,
|
|
906
|
-
const repoSlug = resolved.repoUrl
|
|
923
|
+
spin.stop(`Merging ${identityPackageName} into ${skillDirName}`);
|
|
924
|
+
linkPkgNamed(skillDir, storagePackageName, cwd, version);
|
|
925
|
+
const repoSlug = parseGitHubRepoSlug(resolved.repoUrl);
|
|
907
926
|
writeLock(baseDir, skillDirName, {
|
|
908
|
-
packageName,
|
|
927
|
+
packageName: identityPackageName,
|
|
909
928
|
version,
|
|
910
929
|
repo: repoSlug,
|
|
911
930
|
source: existingLock.source,
|
|
912
|
-
syncedAt: (
|
|
931
|
+
syncedAt: todayIsoDate(),
|
|
913
932
|
generator: "skilld"
|
|
914
933
|
});
|
|
915
934
|
const updatedLock = readLock(baseDir)?.skills[skillDirName];
|
|
916
|
-
const allPackages =
|
|
917
|
-
const relatedSkills = await findRelatedSkills(
|
|
918
|
-
const
|
|
919
|
-
const
|
|
935
|
+
const allPackages = parsePackageNames(updatedLock?.packages);
|
|
936
|
+
const relatedSkills = await findRelatedSkills(storagePackageName, baseDir);
|
|
937
|
+
const existingStorageName = toStoragePackageName(existingLock.packageName);
|
|
938
|
+
const pkgFiles = getPkgKeyFiles(existingStorageName, cwd, existingLock.version);
|
|
939
|
+
const shippedDocs = hasShippedDocs(existingStorageName, cwd, existingLock.version);
|
|
920
940
|
const mergeFeatures = readConfig().features ?? defaultFeatures;
|
|
921
|
-
|
|
941
|
+
writeGeneratedSkillMd(skillDir, {
|
|
922
942
|
name: existingLock.packageName,
|
|
923
943
|
version: existingLock.version,
|
|
924
944
|
relatedSkills,
|
|
@@ -932,11 +952,10 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
932
952
|
packages: allPackages,
|
|
933
953
|
features: mergeFeatures
|
|
934
954
|
});
|
|
935
|
-
writeFileSync(join(skillDir, "SKILL.md"), skillMd);
|
|
936
955
|
const mergeShared = !config.global && getSharedSkillsDir(cwd);
|
|
937
956
|
if (mergeShared) linkSkillToAgents(skillDirName, mergeShared, cwd, config.agent);
|
|
938
957
|
if (!config.global) registerProject(cwd);
|
|
939
|
-
p.outro(`Merged ${
|
|
958
|
+
p.outro(`Merged ${identityPackageName} into ${skillDirName}`);
|
|
940
959
|
return;
|
|
941
960
|
}
|
|
942
961
|
const features = { ...readConfig().features ?? defaultFeatures };
|
|
@@ -944,7 +963,7 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
944
963
|
const resSpin = timedSpinner();
|
|
945
964
|
resSpin.start("Finding resources");
|
|
946
965
|
const resources = await fetchAndCacheResources({
|
|
947
|
-
packageName,
|
|
966
|
+
packageName: storagePackageName,
|
|
948
967
|
resolved,
|
|
949
968
|
version,
|
|
950
969
|
useCache,
|
|
@@ -962,12 +981,12 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
962
981
|
if (resources.hasReleases) resParts.push("releases");
|
|
963
982
|
resSpin.stop(resources.usedCache ? `Loaded ${resParts.length > 0 ? resParts.join(", ") : "resources"} (cached)` : `Fetched ${resParts.length > 0 ? resParts.join(", ") : "resources"}`);
|
|
964
983
|
for (const w of resources.warnings) p.log.warn(`\x1B[33m${w}\x1B[0m`);
|
|
965
|
-
linkAllReferences(skillDir,
|
|
984
|
+
linkAllReferences(skillDir, storagePackageName, cwd, version, resources.docsType, void 0, features, resources.repoInfo);
|
|
966
985
|
if (features.search) {
|
|
967
986
|
const idxSpin = timedSpinner();
|
|
968
987
|
idxSpin.start("Creating search index");
|
|
969
988
|
await indexResources({
|
|
970
|
-
packageName,
|
|
989
|
+
packageName: storagePackageName,
|
|
971
990
|
version,
|
|
972
991
|
cwd,
|
|
973
992
|
docsToIndex: resources.docsToIndex,
|
|
@@ -976,35 +995,35 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
976
995
|
});
|
|
977
996
|
idxSpin.stop("Search index ready");
|
|
978
997
|
}
|
|
979
|
-
const hasChangelog = detectChangelog(resolvePkgDir(
|
|
980
|
-
const relatedSkills = await findRelatedSkills(
|
|
981
|
-
const shippedDocs = hasShippedDocs(
|
|
982
|
-
const pkgFiles = getPkgKeyFiles(
|
|
983
|
-
const repoSlug = resolved.repoUrl
|
|
984
|
-
if (!config.eject) linkPkgNamed(skillDir,
|
|
998
|
+
const hasChangelog = detectChangelog(resolvePkgDir(storagePackageName, cwd, version), getCacheDir(storagePackageName, version));
|
|
999
|
+
const relatedSkills = await findRelatedSkills(storagePackageName, baseDir);
|
|
1000
|
+
const shippedDocs = hasShippedDocs(storagePackageName, cwd, version);
|
|
1001
|
+
const pkgFiles = getPkgKeyFiles(storagePackageName, cwd, version);
|
|
1002
|
+
const repoSlug = parseGitHubRepoSlug(resolved.repoUrl);
|
|
1003
|
+
if (!config.eject) linkPkgNamed(skillDir, storagePackageName, cwd, version);
|
|
985
1004
|
if (!config.eject) {
|
|
986
1005
|
writeLock(baseDir, skillDirName, {
|
|
987
|
-
packageName,
|
|
1006
|
+
packageName: identityPackageName,
|
|
988
1007
|
version,
|
|
989
1008
|
repo: repoSlug,
|
|
990
1009
|
source: resources.docSource,
|
|
991
|
-
syncedAt: (
|
|
1010
|
+
syncedAt: todayIsoDate(),
|
|
992
1011
|
generator: "skilld"
|
|
993
1012
|
});
|
|
994
1013
|
const lock = readLock(baseDir);
|
|
995
1014
|
if (lock) for (const [name, info] of Object.entries(lock.skills)) {
|
|
996
1015
|
if (name === skillDirName) continue;
|
|
997
|
-
if (info.packageName ===
|
|
1016
|
+
if (info.packageName === identityPackageName || parsePackages(info.packages).some((p) => p.name === identityPackageName)) {
|
|
998
1017
|
removeLockEntry(baseDir, name);
|
|
999
1018
|
const staleDir = join(baseDir, name);
|
|
1000
1019
|
if (existsSync(staleDir)) rmSync(staleDir, { recursive: true });
|
|
1001
1020
|
}
|
|
1002
1021
|
}
|
|
1003
1022
|
}
|
|
1004
|
-
const allPackages =
|
|
1023
|
+
const allPackages = parsePackageNames((config.eject ? void 0 : readLock(baseDir)?.skills[skillDirName])?.packages);
|
|
1005
1024
|
const isEject = !!config.eject;
|
|
1006
|
-
const
|
|
1007
|
-
name:
|
|
1025
|
+
const overheadLines = writeGeneratedSkillMd(skillDir, {
|
|
1026
|
+
name: identityPackageName,
|
|
1008
1027
|
version,
|
|
1009
1028
|
releasedAt: resolved.releasedAt,
|
|
1010
1029
|
description: resolved.description,
|
|
@@ -1022,25 +1041,23 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
1022
1041
|
repoUrl: resolved.repoUrl,
|
|
1023
1042
|
features,
|
|
1024
1043
|
eject: isEject
|
|
1025
|
-
});
|
|
1026
|
-
writeFileSync(join(skillDir, "SKILL.md"), baseSkillMd);
|
|
1027
|
-
const overheadLines = baseSkillMd.split("\n").length;
|
|
1044
|
+
}).split("\n").length;
|
|
1028
1045
|
p.log.success(config.mode === "update" ? `Updated skill: ${relative(cwd, skillDir)}` : `Created base skill: ${relative(cwd, skillDir)}`);
|
|
1029
1046
|
const allSectionsCached = !config.force && DEFAULT_SECTIONS.every((s) => {
|
|
1030
1047
|
const outputFile = SECTION_OUTPUT_FILES[s];
|
|
1031
|
-
return readCachedSection(
|
|
1048
|
+
return readCachedSection(storagePackageName, version, outputFile) !== null;
|
|
1032
1049
|
});
|
|
1033
1050
|
if (allSectionsCached) {
|
|
1034
1051
|
const cachedParts = [];
|
|
1035
1052
|
for (const s of SECTION_MERGE_ORDER) {
|
|
1036
1053
|
if (!DEFAULT_SECTIONS.includes(s)) continue;
|
|
1037
1054
|
const outputFile = SECTION_OUTPUT_FILES[s];
|
|
1038
|
-
const content = readCachedSection(
|
|
1055
|
+
const content = readCachedSection(storagePackageName, version, outputFile);
|
|
1039
1056
|
if (content) cachedParts.push(wrapSection(s, content));
|
|
1040
1057
|
}
|
|
1041
1058
|
const cachedBody = cachedParts.join("\n\n");
|
|
1042
|
-
|
|
1043
|
-
name:
|
|
1059
|
+
writeGeneratedSkillMd(skillDir, {
|
|
1060
|
+
name: identityPackageName,
|
|
1044
1061
|
version,
|
|
1045
1062
|
releasedAt: resolved.releasedAt,
|
|
1046
1063
|
description: resolved.description,
|
|
@@ -1061,7 +1078,6 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
1061
1078
|
features,
|
|
1062
1079
|
eject: isEject
|
|
1063
1080
|
});
|
|
1064
|
-
writeFileSync(join(skillDir, "SKILL.md"), skillMd);
|
|
1065
1081
|
p.log.success("Applied cached SKILL.md sections");
|
|
1066
1082
|
}
|
|
1067
1083
|
const globalConfig = readConfig();
|
|
@@ -1074,7 +1090,7 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
1074
1090
|
if (!allSectionsCached && !globalConfig.skipLlm && !(config.yes && !resolvedModel)) {
|
|
1075
1091
|
const llmConfig = await selectLlmConfig(resolvedModel, void 0, updateCtx);
|
|
1076
1092
|
if (llmConfig?.promptOnly) writePromptFiles({
|
|
1077
|
-
packageName,
|
|
1093
|
+
packageName: storagePackageName,
|
|
1078
1094
|
skillDir,
|
|
1079
1095
|
version,
|
|
1080
1096
|
hasIssues: resources.hasIssues,
|
|
@@ -1092,7 +1108,8 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
1092
1108
|
else if (llmConfig) {
|
|
1093
1109
|
p.log.step(getModelLabel(llmConfig.model));
|
|
1094
1110
|
await enhanceSkillWithLLM({
|
|
1095
|
-
packageName,
|
|
1111
|
+
packageName: identityPackageName,
|
|
1112
|
+
cachePackageName: storagePackageName,
|
|
1096
1113
|
version,
|
|
1097
1114
|
skillDir,
|
|
1098
1115
|
dirName: skillDirName,
|
|
@@ -1123,7 +1140,7 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
1123
1140
|
recursive: true,
|
|
1124
1141
|
force: true
|
|
1125
1142
|
});
|
|
1126
|
-
ejectReferences(skillDir,
|
|
1143
|
+
ejectReferences(skillDir, storagePackageName, cwd, version, resources.docsType, features, resources.repoInfo);
|
|
1127
1144
|
}
|
|
1128
1145
|
if (!isEject) {
|
|
1129
1146
|
const shared = !config.global && getSharedSkillsDir(cwd);
|
|
@@ -1135,7 +1152,7 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
1135
1152
|
await shutdownWorker();
|
|
1136
1153
|
const ejectMsg = isEject ? " (ejected)" : "";
|
|
1137
1154
|
const relDir = relative(cwd, skillDir);
|
|
1138
|
-
p.outro(config.mode === "update" ? `Updated ${
|
|
1155
|
+
p.outro(config.mode === "update" ? `Updated ${identityPackageName}${ejectMsg}` : `Synced ${identityPackageName} → ${relDir}${ejectMsg}`);
|
|
1139
1156
|
try {
|
|
1140
1157
|
await suggestPrepareHook(cwd);
|
|
1141
1158
|
} catch (err) {
|
|
@@ -1145,12 +1162,12 @@ async function syncSinglePackage(packageSpec, config) {
|
|
|
1145
1162
|
const addCommandDef = defineCommand({
|
|
1146
1163
|
meta: {
|
|
1147
1164
|
name: "add",
|
|
1148
|
-
description: "
|
|
1165
|
+
description: "Install skills (npm:<pkg>, crate:<name>, gh:<owner/repo>, @<curator>)"
|
|
1149
1166
|
},
|
|
1150
1167
|
args: {
|
|
1151
1168
|
package: {
|
|
1152
1169
|
type: "positional",
|
|
1153
|
-
description: "Package(s) to sync (space
|
|
1170
|
+
description: "Package(s) to sync (space/comma-separated; npm:<pkg>, crate:<name>, or owner/repo)",
|
|
1154
1171
|
required: true
|
|
1155
1172
|
},
|
|
1156
1173
|
skill: {
|
|
@@ -1178,12 +1195,43 @@ const addCommandDef = defineCommand({
|
|
|
1178
1195
|
return;
|
|
1179
1196
|
}
|
|
1180
1197
|
if (!hasCompletedWizard()) await runWizard({ agent });
|
|
1198
|
+
const parsedSources = rawInputs.map(parseSkillInput);
|
|
1181
1199
|
const gitSources = [];
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1200
|
+
const npmEntries = [];
|
|
1201
|
+
const crateSpecs = [];
|
|
1202
|
+
const unsupported = [];
|
|
1203
|
+
for (const source of parsedSources) switch (source.type) {
|
|
1204
|
+
case "git":
|
|
1205
|
+
gitSources.push(source.source);
|
|
1206
|
+
break;
|
|
1207
|
+
case "npm":
|
|
1208
|
+
npmEntries.push({
|
|
1209
|
+
name: source.package,
|
|
1210
|
+
spec: source.tag ? `${source.package}@${source.tag}` : source.package
|
|
1211
|
+
});
|
|
1212
|
+
break;
|
|
1213
|
+
case "crate":
|
|
1214
|
+
crateSpecs.push(source.version ? `crate:${source.package}@${source.version}` : `crate:${source.package}`);
|
|
1215
|
+
break;
|
|
1216
|
+
case "bare":
|
|
1217
|
+
p.log.warn(`Bare names are deprecated. Use \x1B[36mnpm:${source.package}\x1B[0m instead.`);
|
|
1218
|
+
npmEntries.push({
|
|
1219
|
+
name: source.package,
|
|
1220
|
+
spec: source.tag ? `${source.package}@${source.tag}` : source.package
|
|
1221
|
+
});
|
|
1222
|
+
break;
|
|
1223
|
+
case "curator":
|
|
1224
|
+
unsupported.push(`@${source.handle} (curator)`);
|
|
1225
|
+
break;
|
|
1226
|
+
case "collection":
|
|
1227
|
+
unsupported.push(`@${source.handle}/${source.name} (collection)`);
|
|
1228
|
+
break;
|
|
1229
|
+
default: throw new Error(`Unhandled SkillSource type: ${JSON.stringify(source)}`);
|
|
1230
|
+
}
|
|
1231
|
+
if (unsupported.length > 0) {
|
|
1232
|
+
p.log.error(`Curator and collection installs are not yet available:\n ${unsupported.join("\n ")}\n\nFollow https://skilld.dev for launch updates.`);
|
|
1233
|
+
process.exitCode = 1;
|
|
1234
|
+
if (gitSources.length === 0 && npmEntries.length === 0 && crateSpecs.length === 0) return;
|
|
1187
1235
|
}
|
|
1188
1236
|
if (gitSources.length > 0) for (const source of gitSources) {
|
|
1189
1237
|
const skillFilter = args.skill ? args.skill.split(/[,\s]+/).map((s) => s.trim()).filter(Boolean) : void 0;
|
|
@@ -1198,15 +1246,50 @@ const addCommandDef = defineCommand({
|
|
|
1198
1246
|
skillFilter
|
|
1199
1247
|
});
|
|
1200
1248
|
}
|
|
1201
|
-
if (
|
|
1202
|
-
const
|
|
1249
|
+
if (npmEntries.length > 0) {
|
|
1250
|
+
const { syncRegistrySkill } = await import("./sync-registry.mjs");
|
|
1251
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1252
|
+
const dedupedEntries = npmEntries.filter((e) => {
|
|
1253
|
+
if (seen.has(e.name)) return false;
|
|
1254
|
+
seen.add(e.name);
|
|
1255
|
+
return true;
|
|
1256
|
+
});
|
|
1257
|
+
const fallbackPackages = [];
|
|
1258
|
+
for (const entry of dedupedEntries) {
|
|
1259
|
+
const result = await syncRegistrySkill({
|
|
1260
|
+
packageName: entry.name,
|
|
1261
|
+
agent,
|
|
1262
|
+
cwd
|
|
1263
|
+
});
|
|
1264
|
+
if (result) p.log.success(`Installed \x1B[36m${result.name}\x1B[0m from registry`);
|
|
1265
|
+
else fallbackPackages.push(entry.spec);
|
|
1266
|
+
}
|
|
1267
|
+
if (fallbackPackages.length > 0) {
|
|
1268
|
+
const state = await getProjectState(cwd);
|
|
1269
|
+
p.intro(introLine({
|
|
1270
|
+
state,
|
|
1271
|
+
agentId: agent || void 0
|
|
1272
|
+
}));
|
|
1273
|
+
await syncCommand(state, {
|
|
1274
|
+
packages: [...fallbackPackages, ...crateSpecs],
|
|
1275
|
+
global: args.global,
|
|
1276
|
+
agent,
|
|
1277
|
+
model: args.model,
|
|
1278
|
+
yes: args.yes,
|
|
1279
|
+
force: args.force,
|
|
1280
|
+
debug: args.debug
|
|
1281
|
+
});
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
if (crateSpecs.length > 0) {
|
|
1203
1286
|
const state = await getProjectState(cwd);
|
|
1204
1287
|
p.intro(introLine({
|
|
1205
1288
|
state,
|
|
1206
1289
|
agentId: agent || void 0
|
|
1207
1290
|
}));
|
|
1208
|
-
|
|
1209
|
-
packages,
|
|
1291
|
+
await syncCommand(state, {
|
|
1292
|
+
packages: crateSpecs,
|
|
1210
1293
|
global: args.global,
|
|
1211
1294
|
agent,
|
|
1212
1295
|
model: args.model,
|
|
@@ -1318,7 +1401,7 @@ const updateCommandDef = defineCommand({
|
|
|
1318
1401
|
}
|
|
1319
1402
|
if (agent === "none") {
|
|
1320
1403
|
const state = await getProjectState(cwd);
|
|
1321
|
-
const packages = args.package ?
|
|
1404
|
+
const packages = args.package ? Array.from(new Set([args.package, ...args._ || []].flatMap((s) => s.split(/[,\s]+/)).map((s) => s.trim()).filter(Boolean)), (s) => resolveSkillName(s)).filter((s) => s !== null) : state.outdated.map((s) => s.packageName || s.name);
|
|
1322
1405
|
if (packages.length === 0) {
|
|
1323
1406
|
if (!silent) p.log.success("All skills up to date");
|
|
1324
1407
|
return;
|
|
@@ -1340,22 +1423,36 @@ const updateCommandDef = defineCommand({
|
|
|
1340
1423
|
agentId: config.agent || agent || void 0
|
|
1341
1424
|
}));
|
|
1342
1425
|
}
|
|
1343
|
-
if (args.package)
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1426
|
+
if (args.package) {
|
|
1427
|
+
const raw = [...new Set([args.package, ...args._ || []].flatMap((s) => s.split(/[,\s]+/)).map((s) => s.trim()).filter(Boolean))];
|
|
1428
|
+
const packages = [];
|
|
1429
|
+
for (const r of raw) {
|
|
1430
|
+
const name = resolveSkillName(r);
|
|
1431
|
+
if (!name) {
|
|
1432
|
+
p.log.warn(`Cannot update \x1B[36m${r}\x1B[0m: curator/collection inputs are not addressable here.`);
|
|
1433
|
+
continue;
|
|
1434
|
+
}
|
|
1435
|
+
packages.push(name);
|
|
1436
|
+
}
|
|
1437
|
+
if (packages.length === 0) return;
|
|
1438
|
+
return syncCommand(state, {
|
|
1439
|
+
packages,
|
|
1440
|
+
global: args.global,
|
|
1441
|
+
agent,
|
|
1442
|
+
model: args.model || (silent ? config.model : void 0),
|
|
1443
|
+
yes: args.yes || silent,
|
|
1444
|
+
force: args.force,
|
|
1445
|
+
debug: args.debug,
|
|
1446
|
+
mode: "update"
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
const crateSpecs = state.skills.map((s) => s.info?.packageName).filter((name) => !!name && name.startsWith("crate:"));
|
|
1450
|
+
if (state.outdated.length === 0 && crateSpecs.length === 0) {
|
|
1354
1451
|
p.log.success("All skills up to date");
|
|
1355
1452
|
return;
|
|
1356
1453
|
}
|
|
1357
1454
|
return syncCommand(state, {
|
|
1358
|
-
packages: state.outdated.map((s) => s.packageName || s.name),
|
|
1455
|
+
packages: [...state.outdated.map((s) => s.packageName || s.name), ...crateSpecs],
|
|
1359
1456
|
global: args.global,
|
|
1360
1457
|
agent,
|
|
1361
1458
|
model: args.model || (silent ? config.model : void 0),
|
|
@@ -1448,7 +1545,7 @@ async function exportPortablePrompts(packageSpec, opts) {
|
|
|
1448
1545
|
writeFileSync(join(skillDir, `PROMPT_${section}.md`), portable);
|
|
1449
1546
|
}
|
|
1450
1547
|
const relatedSkills = await findRelatedSkills(packageName, join(skillDir, ".."));
|
|
1451
|
-
|
|
1548
|
+
writeGeneratedSkillMd(skillDir, {
|
|
1452
1549
|
name: packageName,
|
|
1453
1550
|
version,
|
|
1454
1551
|
releasedAt: resolved.releasedAt,
|
|
@@ -1466,14 +1563,12 @@ async function exportPortablePrompts(packageSpec, opts) {
|
|
|
1466
1563
|
features,
|
|
1467
1564
|
eject: true
|
|
1468
1565
|
});
|
|
1469
|
-
writeFileSync(join(skillDir, "SKILL.md"), skillMd);
|
|
1470
|
-
const repoSlug = resolved.repoUrl?.match(/github\.com\/([^/]+\/[^/]+?)(?:\.git)?(?:[/#]|$)/)?.[1];
|
|
1471
1566
|
writeLock(baseDir, skillDirName, {
|
|
1472
1567
|
packageName,
|
|
1473
1568
|
version,
|
|
1474
|
-
repo:
|
|
1569
|
+
repo: parseGitHubRepoSlug(resolved.repoUrl),
|
|
1475
1570
|
source: resources.docSource,
|
|
1476
|
-
syncedAt: (
|
|
1571
|
+
syncedAt: todayIsoDate(),
|
|
1477
1572
|
generator: "skilld"
|
|
1478
1573
|
});
|
|
1479
1574
|
if (agent) {
|
|
@@ -1490,6 +1585,6 @@ async function exportPortablePrompts(packageSpec, opts) {
|
|
|
1490
1585
|
const outputFileList = sectionList.map((s) => SECTION_OUTPUT_FILES[s]).join(", ");
|
|
1491
1586
|
p.log.info(`Have your agent enhance the skill. Give it this prompt:\n\x1B[2m\x1B[3m Read each prompt file (${promptFiles}) in ${relDir}/, read the\n referenced files, then write your output to the matching file (${outputFileList}).\n When done, run: skilld assemble\x1B[0m`);
|
|
1492
1587
|
}
|
|
1493
|
-
export {
|
|
1588
|
+
export { syncCommand as a, isCrateSpec as i, ejectCommandDef as n, updateCommandDef as o, exportPortablePrompts as r, addCommandDef as t };
|
|
1494
1589
|
|
|
1495
1590
|
//# sourceMappingURL=sync.mjs.map
|