skilld 0.14.0 → 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,10 +1,11 @@
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";
7
7
  import { spawnSync } from "node:child_process";
8
+ import { isWindows } from "std-env";
8
9
  const SPEC_FRONTMATTER = {
9
10
  "name": {
10
11
  name: "name",
@@ -93,7 +94,7 @@ const claudeCode = defineTarget({
93
94
  agent: "claude-code",
94
95
  displayName: "Claude Code",
95
96
  detectInstalled: () => existsSync(claudeHome),
96
- detectEnv: () => !!(process.env.CLAUDE_CODE || process.env.CLAUDE_CONFIG_DIR),
97
+ detectEnv: () => !!(process.env.CLAUDE_CODE || process.env.CLAUDECODE || process.env.CLAUDE_CODE_ENTRYPOINT || process.env.CLAUDE_CONFIG_DIR),
97
98
  detectProject: (cwd) => existsSync(join(cwd, ".claude")) || existsSync(join(cwd, "CLAUDE.md")),
98
99
  cli: "claude",
99
100
  instructionFile: "CLAUDE.md",
@@ -528,7 +529,8 @@ function getAgentVersion(agentType) {
528
529
  "pipe",
529
530
  "pipe",
530
531
  "pipe"
531
- ]
532
+ ],
533
+ shell: isWindows
532
534
  });
533
535
  if (result.status !== 0) return null;
534
536
  const output = (result.stdout || "").trim();
@@ -587,22 +589,23 @@ function checkAbsolutePaths(content) {
587
589
  function apiChangesSection({ packageName, version, hasReleases, hasChangelog, hasDocs, hasIssues, hasDiscussions, pkgFiles, features, enabledSectionCount, releaseCount }) {
588
590
  const [, major, minor] = version?.match(/^(\d+)\.(\d+)/) ?? [];
589
591
  const boost = releaseBoost(releaseCount, minor ? Number(minor) : void 0);
592
+ const cmd = resolveSkilldCommand();
590
593
  const searchHints = [];
591
594
  if (features?.search !== false) {
592
- 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}\``);
593
596
  if (major && minor) {
594
597
  const minorNum = Number(minor);
595
598
  const majorNum = Number(major);
596
599
  if (minorNum <= 2) {
597
- searchHints.push(`\`npx -y skilld search "v${majorNum}.${minorNum}" -p ${packageName}\``);
598
- if (minorNum > 0) searchHints.push(`\`npx -y skilld search "v${majorNum}.${minorNum - 1}" -p ${packageName}\``);
599
- 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}\``);
600
603
  } else {
601
- searchHints.push(`\`npx -y skilld search "v${majorNum}.${minorNum}" -p ${packageName}\``);
602
- searchHints.push(`\`npx -y skilld search "v${majorNum}.${minorNum - 1}" -p ${packageName}\``);
603
- 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}\``);
604
607
  }
605
- searchHints.push(`\`npx -y skilld search "Features" -p ${packageName}\``);
608
+ searchHints.push(`\`${cmd} search "Features" -p ${packageName}\``);
606
609
  }
607
610
  }
608
611
  const referenceWeights = [];
@@ -708,8 +711,9 @@ Each item: BREAKING/DEPRECATED/NEW label + API name + what changed + source link
708
711
  function bestPracticesSection({ packageName, hasIssues, hasDiscussions, hasReleases, hasChangelog, hasDocs, pkgFiles, features, enabledSectionCount, releaseCount, version }) {
709
712
  const [, , minor] = version?.match(/^(\d+)\.(\d+)/) ?? [];
710
713
  const boost = 1 + (releaseBoost(releaseCount, minor ? Number(minor) : void 0) - 1) * .5;
714
+ const cmd = resolveSkilldCommand();
711
715
  const searchHints = [];
712
- 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}\``);
713
717
  const referenceWeights = [];
714
718
  if (hasDocs) referenceWeights.push({
715
719
  name: "Docs",
@@ -849,13 +853,15 @@ function generateImportantBlock({ packageName, hasIssues, hasDiscussions, hasRel
849
853
  "|----------|------|",
850
854
  ...rows.map(([desc, cmd]) => `| ${desc} | ${cmd} |`)
851
855
  ].join("\n");
856
+ const cmd = resolveSkilldCommand();
857
+ const fallbackCmd = cmd === "skilld" ? "npx -y skilld" : "skilld";
852
858
  return `**IMPORTANT:** Use these references${features?.search !== false ? `\n\n## Search
853
859
 
854
- 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\`.
855
861
 
856
862
  \`\`\`bash
857
- npx -y skilld search "<query>" -p ${packageName}
858
- ${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` : ""}\`\`\`
859
865
 
860
866
  Filters: \`docs:\`, \`issues:\`, \`releases:\` prefix narrows by source type.` : ""}
861
867
 
@@ -940,7 +946,10 @@ function buildSectionPrompt(opts) {
940
946
  "- **Stop exploring once you have enough high-quality items** to fill the budget. Do not read additional files just to be thorough.",
941
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." : ""
942
948
  ].filter(Boolean);
943
- 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}
944
953
 
945
954
  ## Task
946
955
 
@@ -958,7 +967,7 @@ ${rules.join("\n")}
958
967
 
959
968
  Write your final output to the file \`${skillDir}/.skilld/${outputFile}\` using the Write tool. Do NOT write to any other file path.
960
969
 
961
- 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}\`.
962
971
  `;
963
972
  }
964
973
  function buildAllSectionPrompts(opts) {
@@ -1164,12 +1173,14 @@ function generateFrontmatter({ name, version, description: pkgDescription, globs
1164
1173
  return lines.join("\n");
1165
1174
  }
1166
1175
  function generateSearchBlock(name, hasIssues, hasReleases) {
1167
- const examples = [`npx -y skilld search "query" -p ${name}`];
1168
- if (hasIssues) examples.push(`npx -y skilld search "issues:error handling" -p ${name}`);
1169
- 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}`);
1170
1181
  return `## Search
1171
1182
 
1172
- 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\`.
1173
1184
 
1174
1185
  \`\`\`bash
1175
1186
  ${examples.join("\n")}