skilld 0.14.1 → 0.14.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.
@@ -1,6 +1,6 @@
1
1
  import { n as sanitizeMarkdown, t as repairMarkdown } from "./sanitize.mjs";
2
2
  import { t as yamlEscape } from "./yaml.mjs";
3
- import { a as getPackageRules, i as getFilePatterns } from "./package-registry.mjs";
3
+ import { i as resolveSkilldCommand, l as getFilePatterns, u as getPackageRules } from "./shared.mjs";
4
4
  import { homedir } from "node:os";
5
5
  import { dirname, join, relative } from "pathe";
6
6
  import { existsSync, lstatSync, mkdirSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
@@ -589,22 +589,23 @@ function checkAbsolutePaths(content) {
589
589
  function apiChangesSection({ packageName, version, hasReleases, hasChangelog, hasDocs, hasIssues, hasDiscussions, pkgFiles, features, enabledSectionCount, releaseCount }) {
590
590
  const [, major, minor] = version?.match(/^(\d+)\.(\d+)/) ?? [];
591
591
  const boost = releaseBoost(releaseCount, minor ? Number(minor) : void 0);
592
+ const cmd = resolveSkilldCommand();
592
593
  const searchHints = [];
593
594
  if (features?.search !== false) {
594
- searchHints.push(`\`npx -y skilld search "deprecated" -p ${packageName}\``, `\`npx -y skilld search "breaking" -p ${packageName}\``);
595
+ searchHints.push(`\`${cmd} search "deprecated" -p ${packageName}\``, `\`${cmd} search "breaking" -p ${packageName}\``);
595
596
  if (major && minor) {
596
597
  const minorNum = Number(minor);
597
598
  const majorNum = Number(major);
598
599
  if (minorNum <= 2) {
599
- searchHints.push(`\`npx -y skilld search "v${majorNum}.${minorNum}" -p ${packageName}\``);
600
- if (minorNum > 0) searchHints.push(`\`npx -y skilld search "v${majorNum}.${minorNum - 1}" -p ${packageName}\``);
601
- if (majorNum > 0) searchHints.push(`\`npx -y skilld search "v${majorNum - 1}" -p ${packageName}\``);
600
+ searchHints.push(`\`${cmd} search "v${majorNum}.${minorNum}" -p ${packageName}\``);
601
+ if (minorNum > 0) searchHints.push(`\`${cmd} search "v${majorNum}.${minorNum - 1}" -p ${packageName}\``);
602
+ if (majorNum > 0) searchHints.push(`\`${cmd} search "v${majorNum - 1}" -p ${packageName}\``);
602
603
  } else {
603
- searchHints.push(`\`npx -y skilld search "v${majorNum}.${minorNum}" -p ${packageName}\``);
604
- searchHints.push(`\`npx -y skilld search "v${majorNum}.${minorNum - 1}" -p ${packageName}\``);
605
- searchHints.push(`\`npx -y skilld search "v${majorNum}.${minorNum - 2}" -p ${packageName}\``);
604
+ searchHints.push(`\`${cmd} search "v${majorNum}.${minorNum}" -p ${packageName}\``);
605
+ searchHints.push(`\`${cmd} search "v${majorNum}.${minorNum - 1}" -p ${packageName}\``);
606
+ searchHints.push(`\`${cmd} search "v${majorNum}.${minorNum - 2}" -p ${packageName}\``);
606
607
  }
607
- searchHints.push(`\`npx -y skilld search "Features" -p ${packageName}\``);
608
+ searchHints.push(`\`${cmd} search "Features" -p ${packageName}\``);
608
609
  }
609
610
  }
610
611
  const referenceWeights = [];
@@ -710,8 +711,9 @@ Each item: BREAKING/DEPRECATED/NEW label + API name + what changed + source link
710
711
  function bestPracticesSection({ packageName, hasIssues, hasDiscussions, hasReleases, hasChangelog, hasDocs, pkgFiles, features, enabledSectionCount, releaseCount, version }) {
711
712
  const [, , minor] = version?.match(/^(\d+)\.(\d+)/) ?? [];
712
713
  const boost = 1 + (releaseBoost(releaseCount, minor ? Number(minor) : void 0) - 1) * .5;
714
+ const cmd = resolveSkilldCommand();
713
715
  const searchHints = [];
714
- if (features?.search !== false) searchHints.push(`\`npx -y skilld search "recommended" -p ${packageName}\``, `\`npx -y skilld search "avoid" -p ${packageName}\``);
716
+ if (features?.search !== false) searchHints.push(`\`${cmd} search "recommended" -p ${packageName}\``, `\`${cmd} search "avoid" -p ${packageName}\``);
715
717
  const referenceWeights = [];
716
718
  if (hasDocs) referenceWeights.push({
717
719
  name: "Docs",
@@ -851,13 +853,15 @@ function generateImportantBlock({ packageName, hasIssues, hasDiscussions, hasRel
851
853
  "|----------|------|",
852
854
  ...rows.map(([desc, cmd]) => `| ${desc} | ${cmd} |`)
853
855
  ].join("\n");
856
+ const cmd = resolveSkilldCommand();
857
+ const fallbackCmd = cmd === "skilld" ? "npx -y skilld" : "skilld";
854
858
  return `**IMPORTANT:** Use these references${features?.search !== false ? `\n\n## Search
855
859
 
856
- Use \`npx -y skilld search\` as your primary research tool — search before manually reading files. Hybrid semantic + keyword search across all indexed docs, issues, and releases.
860
+ Use \`${cmd} search\` as your primary research tool — search before manually reading files. If \`${cmd}\` is unavailable, use \`${fallbackCmd} search\`.
857
861
 
858
862
  \`\`\`bash
859
- npx -y skilld search "<query>" -p ${packageName}
860
- ${hasIssues ? `npx -y skilld search "issues:<query>" -p ${packageName}\n` : ""}${hasReleases ? `npx -y skilld search "releases:<query>" -p ${packageName}\n` : ""}\`\`\`
863
+ ${cmd} search "<query>" -p ${packageName}
864
+ ${hasIssues ? `${cmd} search "issues:<query>" -p ${packageName}\n` : ""}${hasReleases ? `${cmd} search "releases:<query>" -p ${packageName}\n` : ""}\`\`\`
861
865
 
862
866
  Filters: \`docs:\`, \`issues:\`, \`releases:\` prefix narrows by source type.` : ""}
863
867
 
@@ -942,7 +946,10 @@ function buildSectionPrompt(opts) {
942
946
  "- **Stop exploring once you have enough high-quality items** to fill the budget. Do not read additional files just to be thorough.",
943
947
  opts.pkgFiles?.some((f) => f.endsWith(".d.ts")) ? "- **To verify API exports:** Read the `.d.ts` file directly (see Types row in references). Package directories are often gitignored — if you search `pkg/`, pass `no_ignore: true` to avoid silent empty results." : ""
944
948
  ].filter(Boolean);
945
- return `${preamble}${sectionDef.referenceWeights?.length ? `\n\n## Reference Priority\n\n| Reference | Path | Score | Use For |\n|-----------|------|:-----:|--------|\n${sectionDef.referenceWeights.map((w) => `| ${w.name} | [\`${w.path.split("/").pop()}\`](${w.path}) | ${w.score}/10 | ${w.useFor} |`).join("\n")}` : ""}
949
+ const weightsTable = sectionDef.referenceWeights?.length ? `\n\n## Reference Priority\n\n| Reference | Path | Score | Use For |\n|-----------|------|:-----:|--------|\n${sectionDef.referenceWeights.map((w) => `| ${w.name} | [\`${w.path.split("/").pop()}\`](${w.path}) | ${w.score}/10 | ${w.useFor} |`).join("\n")}` : "";
950
+ const cmd = resolveSkilldCommand();
951
+ const fallbackCmd = cmd === "skilld" ? "npx -y skilld" : "skilld";
952
+ return `${preamble}${weightsTable}
946
953
 
947
954
  ## Task
948
955
 
@@ -960,7 +967,7 @@ ${rules.join("\n")}
960
967
 
961
968
  Write your final output to the file \`${skillDir}/.skilld/${outputFile}\` using the Write tool. Do NOT write to any other file path.
962
969
 
963
- After writing, run \`npx -y skilld validate ${skillDir}/.skilld/${outputFile}\` and fix any warnings before finishing.
970
+ After writing, run \`${cmd} validate ${skillDir}/.skilld/${outputFile}\` and fix any warnings before finishing. If unavailable, use \`${fallbackCmd} validate ${skillDir}/.skilld/${outputFile}\`.
964
971
  `;
965
972
  }
966
973
  function buildAllSectionPrompts(opts) {
@@ -1166,12 +1173,14 @@ function generateFrontmatter({ name, version, description: pkgDescription, globs
1166
1173
  return lines.join("\n");
1167
1174
  }
1168
1175
  function generateSearchBlock(name, hasIssues, hasReleases) {
1169
- const examples = [`npx -y skilld search "query" -p ${name}`];
1170
- if (hasIssues) examples.push(`npx -y skilld search "issues:error handling" -p ${name}`);
1171
- if (hasReleases) examples.push(`npx -y skilld search "releases:deprecated" -p ${name}`);
1176
+ const cmd = resolveSkilldCommand();
1177
+ const fallbackCmd = cmd === "skilld" ? "npx -y skilld" : "skilld";
1178
+ const examples = [`${cmd} search "query" -p ${name}`];
1179
+ if (hasIssues) examples.push(`${cmd} search "issues:error handling" -p ${name}`);
1180
+ if (hasReleases) examples.push(`${cmd} search "releases:deprecated" -p ${name}`);
1172
1181
  return `## Search
1173
1182
 
1174
- Use \`npx -y skilld search\` instead of grepping \`.skilld/\` directories — hybrid semantic + keyword search across all indexed docs, issues, and releases.
1183
+ Use \`${cmd} search\` instead of grepping \`.skilld/\` directories — hybrid semantic + keyword search across all indexed docs, issues, and releases. If \`${cmd}\` is unavailable, use \`${fallbackCmd} search\`.
1175
1184
 
1176
1185
  \`\`\`bash
1177
1186
  ${examples.join("\n")}