@caliber-ai/cli 0.16.2 → 0.16.4

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/dist/bin.js CHANGED
@@ -2497,36 +2497,44 @@ async function interactiveSelect(recs) {
2497
2497
  stdin.on("data", onData);
2498
2498
  });
2499
2499
  }
2500
+ async function fetchSkillContent(rec) {
2501
+ if (rec.id) {
2502
+ try {
2503
+ const result = await apiRequest(
2504
+ `/api/recommendations/${rec.id}/content`
2505
+ );
2506
+ if (result?.content) return result.content;
2507
+ } catch {
2508
+ }
2509
+ }
2510
+ if (rec.source_url && rec.skill_slug) {
2511
+ try {
2512
+ const url = `https://raw.githubusercontent.com/${rec.source_url}/HEAD/skills/${rec.skill_slug}/SKILL.md`;
2513
+ const resp = await fetch(url);
2514
+ if (resp.ok) return await resp.text();
2515
+ } catch {
2516
+ }
2517
+ }
2518
+ return null;
2519
+ }
2500
2520
  async function installSkills(recs, platforms) {
2501
2521
  const spinner = ora5(`Installing ${recs.length} skill${recs.length > 1 ? "s" : ""}...`).start();
2502
2522
  const installed = [];
2503
2523
  const warnings = [];
2504
2524
  for (const rec of recs) {
2505
- if (!rec.id) {
2506
- warnings.push(`Missing ID for ${rec.skill_name}, skipping`);
2525
+ const content = await fetchSkillContent(rec);
2526
+ if (!content) {
2527
+ warnings.push(`No content available for ${rec.skill_name}`);
2507
2528
  continue;
2508
2529
  }
2509
- let accepted = false;
2510
2530
  for (const platform of platforms) {
2511
- try {
2512
- const result = await apiRequest(
2513
- `/api/recommendations/${rec.id}/content?platform=${platform}`
2514
- );
2515
- if (!result?.content) {
2516
- warnings.push(`[${platform}] No content available for ${rec.skill_name}`);
2517
- continue;
2518
- }
2519
- const skillPath = getSkillPath(platform, rec.skill_slug);
2520
- const fullPath = join(process.cwd(), skillPath);
2521
- mkdirSync(dirname2(fullPath), { recursive: true });
2522
- writeFileSync(fullPath, result.content, "utf-8");
2523
- installed.push(`[${platform}] ${skillPath}`);
2524
- accepted = true;
2525
- } catch {
2526
- warnings.push(`[${platform}] Failed to fetch ${rec.skill_name}`);
2527
- }
2531
+ const skillPath = getSkillPath(platform, rec.skill_slug);
2532
+ const fullPath = join(process.cwd(), skillPath);
2533
+ mkdirSync(dirname2(fullPath), { recursive: true });
2534
+ writeFileSync(fullPath, content, "utf-8");
2535
+ installed.push(`[${platform}] ${skillPath}`);
2528
2536
  }
2529
- if (accepted) {
2537
+ if (rec.id) {
2530
2538
  try {
2531
2539
  await apiRequest(`/api/recommendations/${rec.id}/status`, {
2532
2540
  method: "PUT",
@@ -3402,7 +3410,14 @@ Update available: ${current} -> ${latest}`)
3402
3410
  }
3403
3411
  const spinner = ora11("Updating @caliber-ai/cli...").start();
3404
3412
  try {
3405
- execSync4("npm install -g @caliber-ai/cli --force", { stdio: "pipe" });
3413
+ execSync4(`npm install -g @caliber-ai/cli@${latest}`, { stdio: "pipe" });
3414
+ const installed = execSync4("caliber --version", { encoding: "utf-8" }).trim();
3415
+ if (installed !== latest) {
3416
+ spinner.fail(`Update incomplete \u2014 installed ${installed}, expected ${latest}`);
3417
+ console.log(chalk15.yellow(`Run ${chalk15.bold(`npm install -g @caliber-ai/cli@${latest}`)} manually.
3418
+ `));
3419
+ return;
3420
+ }
3406
3421
  spinner.succeed(chalk15.green(`Updated to ${latest}`));
3407
3422
  const args = process.argv.slice(2);
3408
3423
  console.log(chalk15.dim(`