@rely-ai/caliber 0.5.0 → 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.
Files changed (2) hide show
  1. package/dist/bin.js +39 -24
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -4628,8 +4628,7 @@ function getInstalledSkills() {
4628
4628
  return installed;
4629
4629
  }
4630
4630
  async function searchSkillsSh(technologies) {
4631
- const results = [];
4632
- const seen = /* @__PURE__ */ new Set();
4631
+ const bestBySlug = /* @__PURE__ */ new Map();
4633
4632
  for (const tech of technologies) {
4634
4633
  try {
4635
4634
  const resp = await fetch(`https://skills.sh/api/search?q=${encodeURIComponent(tech)}&limit=10`, {
@@ -4639,23 +4638,24 @@ async function searchSkillsSh(technologies) {
4639
4638
  const data = await resp.json();
4640
4639
  if (!data.skills?.length) continue;
4641
4640
  for (const skill of data.skills) {
4642
- if (seen.has(skill.skillId)) continue;
4643
- seen.add(skill.skillId);
4644
- results.push({
4641
+ const existing = bestBySlug.get(skill.skillId);
4642
+ if (existing && existing.installs >= (skill.installs ?? 0)) continue;
4643
+ bestBySlug.set(skill.skillId, {
4645
4644
  name: skill.name,
4646
4645
  slug: skill.skillId,
4647
4646
  source_url: skill.source ? `https://github.com/${skill.source}` : "",
4648
4647
  score: 0,
4649
4648
  reason: skill.description || "",
4650
4649
  detected_technology: tech,
4651
- item_type: "skill"
4650
+ item_type: "skill",
4651
+ installs: skill.installs ?? 0
4652
4652
  });
4653
4653
  }
4654
4654
  } catch {
4655
4655
  continue;
4656
4656
  }
4657
4657
  }
4658
- return results;
4658
+ return Array.from(bestBySlug.values());
4659
4659
  }
4660
4660
  async function searchTessl(technologies) {
4661
4661
  const results = [];
@@ -4736,8 +4736,9 @@ async function searchAllProviders(technologies, platform) {
4736
4736
  const combined = [];
4737
4737
  for (const batch of results) {
4738
4738
  for (const result of batch) {
4739
- if (seen.has(result.slug)) continue;
4740
- seen.add(result.slug);
4739
+ const key = result.name.toLowerCase().replace(/[-_]/g, "");
4740
+ if (seen.has(key)) continue;
4741
+ seen.add(key);
4741
4742
  combined.push(result);
4742
4743
  }
4743
4744
  }
@@ -5039,26 +5040,40 @@ async function interactiveSelect(recs) {
5039
5040
  });
5040
5041
  }
5041
5042
  async function fetchSkillContent(rec) {
5042
- try {
5043
- const resp = await fetch(`https://skills.sh/api/skills/${rec.slug}`, {
5044
- signal: AbortSignal.timeout(1e4)
5045
- });
5046
- if (resp.ok) {
5047
- const data = await resp.json();
5048
- const content = data.content || data.text;
5049
- if (content) return content;
5050
- }
5051
- } catch {
5052
- }
5053
- if (rec.source_url) {
5043
+ if (!rec.source_url) return null;
5044
+ const repoPath = rec.source_url.replace("https://github.com/", "");
5045
+ const candidates = [
5046
+ `https://raw.githubusercontent.com/${repoPath}/HEAD/skills/${rec.slug}/SKILL.md`,
5047
+ `https://raw.githubusercontent.com/${repoPath}/HEAD/${rec.slug}/SKILL.md`,
5048
+ `https://raw.githubusercontent.com/${repoPath}/HEAD/.claude/skills/${rec.slug}/SKILL.md`
5049
+ ];
5050
+ for (const url of candidates) {
5054
5051
  try {
5055
- const repoPath = rec.source_url.replace("https://github.com/", "");
5056
- const url = `https://raw.githubusercontent.com/${repoPath}/HEAD/skills/${rec.slug}/SKILL.md`;
5057
5052
  const resp = await fetch(url, { signal: AbortSignal.timeout(1e4) });
5058
- if (resp.ok) return await resp.text();
5053
+ if (resp.ok) {
5054
+ const text = await resp.text();
5055
+ if (text.length > 20) return text;
5056
+ }
5059
5057
  } catch {
5060
5058
  }
5061
5059
  }
5060
+ try {
5061
+ const resp = await fetch(
5062
+ `https://api.github.com/repos/${repoPath}/git/trees/HEAD?recursive=1`,
5063
+ { signal: AbortSignal.timeout(1e4) }
5064
+ );
5065
+ if (resp.ok) {
5066
+ const tree = await resp.json();
5067
+ const needle = `${rec.slug}/SKILL.md`;
5068
+ const match = tree.tree?.find((f) => f.path.endsWith(needle));
5069
+ if (match) {
5070
+ const rawUrl = `https://raw.githubusercontent.com/${repoPath}/HEAD/${match.path}`;
5071
+ const contentResp = await fetch(rawUrl, { signal: AbortSignal.timeout(1e4) });
5072
+ if (contentResp.ok) return await contentResp.text();
5073
+ }
5074
+ }
5075
+ } catch {
5076
+ }
5062
5077
  return null;
5063
5078
  }
5064
5079
  async function installSkills(recs, platforms) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-ai/caliber",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Analyze your codebase and generate optimized AI agent configs (CLAUDE.md, .cursorrules, skills) — no API key needed",
5
5
  "type": "module",
6
6
  "bin": {