skilld 1.7.0 → 1.7.2

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.
Files changed (68) hide show
  1. package/dist/_chunks/agent.mjs +14 -5
  2. package/dist/_chunks/agent.mjs.map +1 -1
  3. package/dist/_chunks/assemble.mjs +1 -1
  4. package/dist/_chunks/author.mjs +6 -9
  5. package/dist/_chunks/author.mjs.map +1 -1
  6. package/dist/_chunks/cache.mjs +11 -1
  7. package/dist/_chunks/cache.mjs.map +1 -1
  8. package/dist/_chunks/cli-helpers.mjs +1 -1
  9. package/dist/_chunks/core.mjs +1 -1
  10. package/dist/_chunks/index.d.mts +4 -1
  11. package/dist/_chunks/index.d.mts.map +1 -1
  12. package/dist/_chunks/index3.d.mts +3 -1
  13. package/dist/_chunks/index3.d.mts.map +1 -1
  14. package/dist/_chunks/install.mjs +523 -85
  15. package/dist/_chunks/install.mjs.map +1 -1
  16. package/dist/_chunks/list.mjs +1 -1
  17. package/dist/_chunks/lockfile.mjs +4 -1
  18. package/dist/_chunks/lockfile.mjs.map +1 -1
  19. package/dist/_chunks/prefix.mjs +5 -5
  20. package/dist/_chunks/prefix.mjs.map +1 -1
  21. package/dist/_chunks/prepare2.mjs +4 -4
  22. package/dist/_chunks/prepare2.mjs.map +1 -1
  23. package/dist/_chunks/prompts.mjs +3 -142
  24. package/dist/_chunks/prompts.mjs.map +1 -1
  25. package/dist/_chunks/search-helpers.mjs +2 -2
  26. package/dist/_chunks/search-interactive.mjs +1 -1
  27. package/dist/_chunks/search.mjs +1 -1
  28. package/dist/_chunks/shared.mjs +463 -1
  29. package/dist/_chunks/shared.mjs.map +1 -1
  30. package/dist/_chunks/skill.mjs +329 -0
  31. package/dist/_chunks/skill.mjs.map +1 -0
  32. package/dist/_chunks/skills.mjs +3 -3
  33. package/dist/_chunks/sources.mjs +7 -3
  34. package/dist/_chunks/sources.mjs.map +1 -1
  35. package/dist/_chunks/sync-registry.mjs +4 -4
  36. package/dist/_chunks/sync-registry.mjs.map +1 -1
  37. package/dist/_chunks/sync-shared2.mjs +9 -10
  38. package/dist/_chunks/sync-shared2.mjs.map +1 -1
  39. package/dist/_chunks/sync.mjs +48 -62
  40. package/dist/_chunks/sync.mjs.map +1 -1
  41. package/dist/_chunks/uninstall.mjs +2 -2
  42. package/dist/_chunks/upload.mjs +1 -1
  43. package/dist/_chunks/validate.mjs +1 -1
  44. package/dist/_chunks/wizard.mjs +1 -1
  45. package/dist/agent/index.d.mts +3 -1
  46. package/dist/agent/index.d.mts.map +1 -1
  47. package/dist/agent/index.mjs +4 -4
  48. package/dist/cache/index.d.mts +2 -2
  49. package/dist/cache/index.mjs +2 -2
  50. package/dist/cli.mjs +5 -6
  51. package/dist/cli.mjs.map +1 -1
  52. package/dist/index.d.mts +2 -2
  53. package/dist/index.mjs +1 -1
  54. package/dist/prepare.mjs +1 -1
  55. package/dist/sources/index.d.mts +2 -2
  56. package/dist/sources/index.mjs +3 -3
  57. package/dist/types.d.mts +2 -2
  58. package/package.json +6 -5
  59. package/dist/THIRD-PARTY-LICENSES.md +0 -38
  60. package/dist/_chunks/formatting.mjs +0 -82
  61. package/dist/_chunks/formatting.mjs.map +0 -1
  62. package/dist/_chunks/install2.mjs +0 -554
  63. package/dist/_chunks/install2.mjs.map +0 -1
  64. package/dist/_chunks/libs/@sinclair/typebox.mjs +0 -2304
  65. package/dist/_chunks/libs/@sinclair/typebox.mjs.map +0 -1
  66. package/dist/_chunks/package-registry.mjs +0 -465
  67. package/dist/_chunks/package-registry.mjs.map +0 -1
  68. package/dist/_chunks/rolldown-runtime.mjs +0 -11
@@ -1,20 +1,19 @@
1
+ import { a as getModelLabel, i as getAvailableModels, s as optimizeDocs, t as detectImportedPackages } from "./agent.mjs";
1
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, f as listReferenceFiles, i as getPkgKeyFiles, l as linkPkgNamed, m as readCachedSection, o as isCached, r as ensureCacheDir } from "./cache.mjs";
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
- import { J as isPrerelease, M as resolveGitHubRepo, f as resolvePackageDocsWithAttempts, i as fetchPkgDist, m as fetchGitSkills, p as searchNpmPackages, rt as parsePackageSpec, s as readLocalDependencies, w as resolveCrateDocsWithAttempts } from "./sources.mjs";
7
7
  import { a as semverDiff, n as getSharedSkillsDir, t as SHARED_SKILLS_DIR } from "./shared.mjs";
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 { c as portabilizePrompt, i as buildAllSectionPrompts, l as wrapSection, n as SECTION_MERGE_ORDER, r as SECTION_OUTPUT_FILES, t as generateSkillMd } from "./prompts.mjs";
10
- import { i as sanitizeName, r as linkSkillToAgents, t as computeSkillDirName } from "./install.mjs";
11
- import { a as getModelLabel, i as getAvailableModels, s as optimizeDocs, t as detectImportedPackages } from "./agent.mjs";
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
12
  import { a as readConfig, o as registerProject, r as hasCompletedWizard, t as defaultFeatures } from "./config.mjs";
13
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 removeLockEntry, i as readLock, n as parsePackages, s as writeLock } from "./lockfile.mjs";
14
+ import { a as readLock, c as writeLock, n as parsePackageNames, o as removeLockEntry, r as parsePackages } from "./lockfile.mjs";
15
15
  import { t as getProjectState } from "./skills.mjs";
16
16
  import { n as resolveSkillName, r as toStoragePackageName, t as parseSkillInput } from "./prefix.mjs";
17
- import { l as timedSpinner, n as formatDuration } from "./formatting.mjs";
18
17
  import { t as runWizard } from "./wizard.mjs";
19
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";
20
19
  import { n as shutdownWorker } from "./pool2.mjs";
@@ -87,7 +86,7 @@ async function syncGitSkills(opts) {
87
86
  for (const skill of selected) {
88
87
  const skillDir = join(baseDir, skill.name);
89
88
  mkdirSync(skillDir, { recursive: true });
90
- writeFileSync(join(skillDir, "SKILL.md"), sanitizeMarkdown(skill.content));
89
+ writeSkillMd(skillDir, sanitizeMarkdown(skill.content));
91
90
  if (skill.files.length > 0) for (const f of skill.files) {
92
91
  const filePath = join(skillDir, f.path);
93
92
  mkdirSync(dirname(filePath), { recursive: true });
@@ -99,7 +98,7 @@ async function syncGitSkills(opts) {
99
98
  repo: source.type === "local" ? source.localPath : `${source.owner}/${source.repo}`,
100
99
  path: skill.path || void 0,
101
100
  ref: source.ref || "main",
102
- syncedAt: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
101
+ syncedAt: todayIsoDate(),
103
102
  generator: "external"
104
103
  });
105
104
  }
@@ -182,10 +181,10 @@ async function syncGitHubRepo(opts) {
182
181
  version,
183
182
  repo: `${owner}/${repo}`,
184
183
  source: resources.docSource,
185
- syncedAt: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
184
+ syncedAt: todayIsoDate(),
186
185
  generator: "skilld"
187
186
  });
188
- const baseSkillMd = generateSkillMd({
187
+ writeGeneratedSkillMd(skillDir, {
189
188
  name: packageName,
190
189
  version,
191
190
  releasedAt: resolved.releasedAt,
@@ -202,7 +201,6 @@ async function syncGitHubRepo(opts) {
202
201
  repoUrl,
203
202
  features
204
203
  });
205
- writeFileSync(join(skillDir, "SKILL.md"), baseSkillMd);
206
204
  p.log.success(`Created base skill: ${relative(cwd, skillDir)}`);
207
205
  if (!readConfig().skipLlm && (!yes || opts.model)) {
208
206
  const llmConfig = await selectLlmConfig(opts.model);
@@ -369,7 +367,7 @@ async function syncPackagesParallel(config) {
369
367
  if (content) cachedParts.push(wrapSection(s, content));
370
368
  }
371
369
  const cachedBody = cachedParts.join("\n\n");
372
- const skillMd = generateSkillMd({
370
+ writeGeneratedSkillMd(skillDir, {
373
371
  name: resolvedName,
374
372
  version: data.version,
375
373
  releasedAt: data.resolved.releasedAt,
@@ -389,7 +387,6 @@ async function syncPackagesParallel(config) {
389
387
  repoUrl: data.resolved.repoUrl,
390
388
  features: data.features
391
389
  });
392
- writeFileSync(join(skillDir, "SKILL.md"), skillMd);
393
390
  cachedPkgs.push(pkg);
394
391
  }
395
392
  }
@@ -579,19 +576,19 @@ async function syncBaseSkill(packageSpec, config, cwd, update) {
579
576
  const relatedSkills = await findRelatedSkills(packageName, baseDir);
580
577
  const shippedDocs = hasShippedDocs(packageName, cwd, version);
581
578
  const pkgFiles = getPkgKeyFiles(packageName, cwd, version);
582
- const repoSlug = resolved.repoUrl?.match(/github\.com\/([^/]+\/[^/]+?)(?:\.git)?(?:[/#]|$)/)?.[1];
579
+ const repoSlug = parseGitHubRepoSlug(resolved.repoUrl);
583
580
  linkPkgNamed(skillDir, packageName, cwd, version);
584
581
  writeLock(baseDir, skillDirName, {
585
582
  packageName,
586
583
  version,
587
584
  repo: repoSlug,
588
585
  source: resources.docSource,
589
- syncedAt: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
586
+ syncedAt: todayIsoDate(),
590
587
  generator: "skilld"
591
588
  });
592
589
  const updatedLock = readLock(baseDir)?.skills[skillDirName];
593
- const allPackages = parsePackages(updatedLock?.packages).map((p) => ({ name: p.name }));
594
- const skillMd = generateSkillMd({
590
+ const allPackages = parsePackageNames(updatedLock?.packages);
591
+ const overheadLines = writeGeneratedSkillMd(skillDir, {
595
592
  name: packageName,
596
593
  version,
597
594
  releasedAt: resolved.releasedAt,
@@ -609,9 +606,7 @@ async function syncBaseSkill(packageSpec, config, cwd, update) {
609
606
  packages: allPackages.length > 1 ? allPackages : void 0,
610
607
  repoUrl: resolved.repoUrl,
611
608
  features
612
- });
613
- writeFileSync(join(skillDir, "SKILL.md"), skillMd);
614
- const overheadLines = skillMd.split("\n").length;
609
+ }).split("\n").length;
615
610
  const shared = !config.global && getSharedSkillsDir(cwd);
616
611
  if (shared) linkSkillToAgents(skillDirName, shared, cwd, config.agent);
617
612
  if (!config.global) registerProject(cwd);
@@ -672,28 +667,25 @@ async function enhanceWithLLM(packageName, data, config, cwd, update, sections,
672
667
  update(packageName, "error", error, versionKey);
673
668
  throw new Error(error);
674
669
  }
675
- if (wasOptimized) {
676
- const skillMd = generateSkillMd({
677
- name: packageName,
678
- version: data.version,
679
- releasedAt: data.resolved.releasedAt,
680
- distTags: data.resolved.distTags,
681
- body: optimized,
682
- relatedSkills: data.relatedSkills,
683
- hasIssues: data.hasIssues,
684
- hasDiscussions: data.hasDiscussions,
685
- hasReleases: data.hasReleases,
686
- hasChangelog: data.hasChangelog,
687
- docsType: data.docsType,
688
- hasShippedDocs: data.shippedDocs,
689
- pkgFiles: data.pkgFiles,
690
- dirName: data.skillDirName,
691
- packages: data.packages,
692
- repoUrl: data.resolved.repoUrl,
693
- features: data.features
694
- });
695
- writeFileSync(join(skillDir, "SKILL.md"), skillMd);
696
- }
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
+ });
697
689
  update(packageName, "done", "Skill optimized", versionKey);
698
690
  }
699
691
  const RESOLVE_SOURCE_LABELS = {
@@ -930,23 +922,23 @@ async function syncSinglePackage(packageSpec, config) {
930
922
  if (isMerge) {
931
923
  spin.stop(`Merging ${identityPackageName} into ${skillDirName}`);
932
924
  linkPkgNamed(skillDir, storagePackageName, cwd, version);
933
- const repoSlug = resolved.repoUrl?.match(/github\.com\/([^/]+\/[^/]+?)(?:\.git)?(?:[/#]|$)/)?.[1];
925
+ const repoSlug = parseGitHubRepoSlug(resolved.repoUrl);
934
926
  writeLock(baseDir, skillDirName, {
935
927
  packageName: identityPackageName,
936
928
  version,
937
929
  repo: repoSlug,
938
930
  source: existingLock.source,
939
- syncedAt: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
931
+ syncedAt: todayIsoDate(),
940
932
  generator: "skilld"
941
933
  });
942
934
  const updatedLock = readLock(baseDir)?.skills[skillDirName];
943
- const allPackages = parsePackages(updatedLock?.packages).map((p) => ({ name: p.name }));
935
+ const allPackages = parsePackageNames(updatedLock?.packages);
944
936
  const relatedSkills = await findRelatedSkills(storagePackageName, baseDir);
945
937
  const existingStorageName = toStoragePackageName(existingLock.packageName);
946
938
  const pkgFiles = getPkgKeyFiles(existingStorageName, cwd, existingLock.version);
947
939
  const shippedDocs = hasShippedDocs(existingStorageName, cwd, existingLock.version);
948
940
  const mergeFeatures = readConfig().features ?? defaultFeatures;
949
- const skillMd = generateSkillMd({
941
+ writeGeneratedSkillMd(skillDir, {
950
942
  name: existingLock.packageName,
951
943
  version: existingLock.version,
952
944
  relatedSkills,
@@ -960,7 +952,6 @@ async function syncSinglePackage(packageSpec, config) {
960
952
  packages: allPackages,
961
953
  features: mergeFeatures
962
954
  });
963
- writeFileSync(join(skillDir, "SKILL.md"), skillMd);
964
955
  const mergeShared = !config.global && getSharedSkillsDir(cwd);
965
956
  if (mergeShared) linkSkillToAgents(skillDirName, mergeShared, cwd, config.agent);
966
957
  if (!config.global) registerProject(cwd);
@@ -1008,7 +999,7 @@ async function syncSinglePackage(packageSpec, config) {
1008
999
  const relatedSkills = await findRelatedSkills(storagePackageName, baseDir);
1009
1000
  const shippedDocs = hasShippedDocs(storagePackageName, cwd, version);
1010
1001
  const pkgFiles = getPkgKeyFiles(storagePackageName, cwd, version);
1011
- const repoSlug = resolved.repoUrl?.match(/github\.com\/([^/]+\/[^/]+?)(?:\.git)?(?:[/#]|$)/)?.[1];
1002
+ const repoSlug = parseGitHubRepoSlug(resolved.repoUrl);
1012
1003
  if (!config.eject) linkPkgNamed(skillDir, storagePackageName, cwd, version);
1013
1004
  if (!config.eject) {
1014
1005
  writeLock(baseDir, skillDirName, {
@@ -1016,7 +1007,7 @@ async function syncSinglePackage(packageSpec, config) {
1016
1007
  version,
1017
1008
  repo: repoSlug,
1018
1009
  source: resources.docSource,
1019
- syncedAt: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
1010
+ syncedAt: todayIsoDate(),
1020
1011
  generator: "skilld"
1021
1012
  });
1022
1013
  const lock = readLock(baseDir);
@@ -1029,9 +1020,9 @@ async function syncSinglePackage(packageSpec, config) {
1029
1020
  }
1030
1021
  }
1031
1022
  }
1032
- const allPackages = parsePackages((config.eject ? void 0 : readLock(baseDir)?.skills[skillDirName])?.packages).map((p) => ({ name: p.name }));
1023
+ const allPackages = parsePackageNames((config.eject ? void 0 : readLock(baseDir)?.skills[skillDirName])?.packages);
1033
1024
  const isEject = !!config.eject;
1034
- const baseSkillMd = generateSkillMd({
1025
+ const overheadLines = writeGeneratedSkillMd(skillDir, {
1035
1026
  name: identityPackageName,
1036
1027
  version,
1037
1028
  releasedAt: resolved.releasedAt,
@@ -1050,9 +1041,7 @@ async function syncSinglePackage(packageSpec, config) {
1050
1041
  repoUrl: resolved.repoUrl,
1051
1042
  features,
1052
1043
  eject: isEject
1053
- });
1054
- writeFileSync(join(skillDir, "SKILL.md"), baseSkillMd);
1055
- const overheadLines = baseSkillMd.split("\n").length;
1044
+ }).split("\n").length;
1056
1045
  p.log.success(config.mode === "update" ? `Updated skill: ${relative(cwd, skillDir)}` : `Created base skill: ${relative(cwd, skillDir)}`);
1057
1046
  const allSectionsCached = !config.force && DEFAULT_SECTIONS.every((s) => {
1058
1047
  const outputFile = SECTION_OUTPUT_FILES[s];
@@ -1067,7 +1056,7 @@ async function syncSinglePackage(packageSpec, config) {
1067
1056
  if (content) cachedParts.push(wrapSection(s, content));
1068
1057
  }
1069
1058
  const cachedBody = cachedParts.join("\n\n");
1070
- const skillMd = generateSkillMd({
1059
+ writeGeneratedSkillMd(skillDir, {
1071
1060
  name: identityPackageName,
1072
1061
  version,
1073
1062
  releasedAt: resolved.releasedAt,
@@ -1089,7 +1078,6 @@ async function syncSinglePackage(packageSpec, config) {
1089
1078
  features,
1090
1079
  eject: isEject
1091
1080
  });
1092
- writeFileSync(join(skillDir, "SKILL.md"), skillMd);
1093
1081
  p.log.success("Applied cached SKILL.md sections");
1094
1082
  }
1095
1083
  const globalConfig = readConfig();
@@ -1557,7 +1545,7 @@ async function exportPortablePrompts(packageSpec, opts) {
1557
1545
  writeFileSync(join(skillDir, `PROMPT_${section}.md`), portable);
1558
1546
  }
1559
1547
  const relatedSkills = await findRelatedSkills(packageName, join(skillDir, ".."));
1560
- const skillMd = generateSkillMd({
1548
+ writeGeneratedSkillMd(skillDir, {
1561
1549
  name: packageName,
1562
1550
  version,
1563
1551
  releasedAt: resolved.releasedAt,
@@ -1575,14 +1563,12 @@ async function exportPortablePrompts(packageSpec, opts) {
1575
1563
  features,
1576
1564
  eject: true
1577
1565
  });
1578
- writeFileSync(join(skillDir, "SKILL.md"), skillMd);
1579
- const repoSlug = resolved.repoUrl?.match(/github\.com\/([^/]+\/[^/]+?)(?:\.git)?(?:[/#]|$)/)?.[1];
1580
1566
  writeLock(baseDir, skillDirName, {
1581
1567
  packageName,
1582
1568
  version,
1583
- repo: repoSlug,
1569
+ repo: parseGitHubRepoSlug(resolved.repoUrl),
1584
1570
  source: resources.docSource,
1585
- syncedAt: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
1571
+ syncedAt: todayIsoDate(),
1586
1572
  generator: "skilld"
1587
1573
  });
1588
1574
  if (agent) {