bip-skills 1.4.12 → 1.4.13

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/cli.mjs +88 -51
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -692,6 +692,7 @@ function getYonClawBaseDir(options = {}) {
692
692
  const home = options.homeDir ?? homedir();
693
693
  const currentPlatform = options.platform ?? platform();
694
694
  const env = options.env ?? process.env;
695
+ if (env.YONCLAW_HOME) return env.YONCLAW_HOME;
695
696
  if (currentPlatform === "darwin") return join(home, "Library", "Application Support", "yonclaw");
696
697
  if (currentPlatform === "win32") return join(env.APPDATA || join(home, "AppData", "Roaming"), "yonclaw");
697
698
  return join(options.xdgConfigDir || env.XDG_CONFIG_HOME || xdgConfig || join(home, ".config"), "yonclaw");
@@ -2239,7 +2240,7 @@ function createEmptyLocalLock() {
2239
2240
  skills: {}
2240
2241
  };
2241
2242
  }
2242
- var version$1 = "1.4.12";
2243
+ var version$1 = "1.4.13";
2243
2244
  const isCancelled$1 = (value) => typeof value === "symbol";
2244
2245
  async function isSourcePrivate(source) {
2245
2246
  const ownerRepo = parseOwnerRepo(source);
@@ -2385,22 +2386,38 @@ function agentSupportsScope(agent, global) {
2385
2386
  if (global === false) return agents[agent].supportsProjectInstall !== false;
2386
2387
  return true;
2387
2388
  }
2388
- function filterProjectUnsupportedAgents(targetAgents, installGlobally, explicitlyRequestedAgents) {
2389
- if (installGlobally) return targetAgents;
2389
+ function resolveAgentScopes(targetAgents, installGlobally, explicitlyRequestedAgents) {
2390
+ if (installGlobally) return {
2391
+ targetAgents,
2392
+ autoGlobalAgents: []
2393
+ };
2390
2394
  const unsupported = targetAgents.filter((agent) => agents[agent].supportsProjectInstall === false);
2391
- if (unsupported.length === 0) return targetAgents;
2392
- const explicitUnsupported = explicitlyRequestedAgents?.filter((agent) => agent !== "*" && unsupported.includes(agent));
2393
- if (explicitUnsupported && explicitUnsupported.length > 0) {
2394
- M.error(`${formatList$1(unsupported.map((agent) => agents[agent].displayName))} only supports global skill installation. Use --global.`);
2395
- process.exit(1);
2396
- }
2397
- M.warn(`Skipping ${formatList$1(unsupported.map((agent) => agents[agent].displayName))}: global-only agent`);
2398
- const filtered = targetAgents.filter((agent) => agents[agent].supportsProjectInstall !== false);
2399
- if (filtered.length === 0) {
2400
- M.error("No selected agents support project skill installation.");
2401
- process.exit(1);
2395
+ if (unsupported.length === 0) return {
2396
+ targetAgents,
2397
+ autoGlobalAgents: []
2398
+ };
2399
+ if (explicitlyRequestedAgents?.includes("*")) {
2400
+ const filtered = targetAgents.filter((agent) => agents[agent].supportsProjectInstall !== false);
2401
+ if (filtered.length === 0) return {
2402
+ targetAgents: unsupported,
2403
+ autoGlobalAgents: unsupported
2404
+ };
2405
+ return {
2406
+ targetAgents: filtered,
2407
+ autoGlobalAgents: []
2408
+ };
2402
2409
  }
2403
- return filtered;
2410
+ return {
2411
+ targetAgents,
2412
+ autoGlobalAgents: unsupported
2413
+ };
2414
+ }
2415
+ function shouldInstallAgentGlobally(agent, installGlobally, autoGlobalAgents) {
2416
+ return installGlobally || autoGlobalAgents.includes(agent);
2417
+ }
2418
+ function warnAutoGlobalAgents(autoGlobalAgents) {
2419
+ if (autoGlobalAgents.length === 0) return;
2420
+ M.warn(`${formatList$1(autoGlobalAgents.map((agent) => agents[agent].displayName))} only supports global skill installation and was installed globally.`);
2404
2421
  }
2405
2422
  function buildResultLines(results, targetAgents) {
2406
2423
  const lines = [];
@@ -2658,7 +2675,9 @@ async function handleWellKnownSkills(source, url, options, spinner, allowFallbac
2658
2675
  }
2659
2676
  installGlobally = scope;
2660
2677
  }
2661
- targetAgents = filterProjectUnsupportedAgents(targetAgents, installGlobally, options.agent);
2678
+ const scopeResolution = resolveAgentScopes(targetAgents, installGlobally, options.agent);
2679
+ targetAgents = scopeResolution.targetAgents;
2680
+ const autoGlobalAgents = scopeResolution.autoGlobalAgents;
2662
2681
  let installMode = options.copy ? "copy" : "symlink";
2663
2682
  if (!options.copy && !options.yes) {
2664
2683
  const modeChoice = await ve({
@@ -2685,7 +2704,7 @@ async function handleWellKnownSkills(source, url, options, spinner, allowFallbac
2685
2704
  const overwriteChecks = await Promise.all(selectedSkills.flatMap((skill) => targetAgents.map(async (agent) => ({
2686
2705
  skillName: skill.installName,
2687
2706
  agent,
2688
- installed: await isSkillInstalled(skill.installName, agent, { global: installGlobally })
2707
+ installed: await isSkillInstalled(skill.installName, agent, { global: shouldInstallAgentGlobally(agent, installGlobally, autoGlobalAgents) })
2689
2708
  }))));
2690
2709
  const overwriteStatus = /* @__PURE__ */ new Map();
2691
2710
  for (const { skillName, agent, installed } of overwriteChecks) {
@@ -2694,7 +2713,7 @@ async function handleWellKnownSkills(source, url, options, spinner, allowFallbac
2694
2713
  }
2695
2714
  for (const skill of selectedSkills) {
2696
2715
  if (summaryLines.length > 0) summaryLines.push("");
2697
- const shortCanonical = shortenPath$2(getCanonicalPath(skill.installName, { global: installGlobally }), cwd);
2716
+ const shortCanonical = shortenPath$2(getCanonicalPath(skill.installName, { global: installGlobally || targetAgents.every((agent) => autoGlobalAgents.includes(agent)) }), cwd);
2698
2717
  summaryLines.push(`${import_picocolors.default.cyan(shortCanonical)}`);
2699
2718
  summaryLines.push(...buildAgentSummaryLines(targetAgents, installMode));
2700
2719
  const fileCount = getWellKnownFileCount(skill);
@@ -2747,11 +2766,11 @@ async function handleWellKnownSkills(source, url, options, spinner, allowFallbac
2747
2766
  error: "Repository-backed skill was not prepared"
2748
2767
  };
2749
2768
  else installOutcome = await installSkillForAgent(preparedSkill, agent, {
2750
- global: installGlobally,
2769
+ global: shouldInstallAgentGlobally(agent, installGlobally, autoGlobalAgents),
2751
2770
  mode: installMode
2752
2771
  });
2753
2772
  } else installOutcome = await installWellKnownSkillForAgent(skill, agent, {
2754
- global: installGlobally,
2773
+ global: shouldInstallAgentGlobally(agent, installGlobally, autoGlobalAgents),
2755
2774
  mode: installMode
2756
2775
  });
2757
2776
  results.push({
@@ -2762,9 +2781,11 @@ async function handleWellKnownSkills(source, url, options, spinner, allowFallbac
2762
2781
  }
2763
2782
  await Promise.all(repositoryTempDirs.map((dir) => cleanupTempDir(dir).catch(() => {})));
2764
2783
  spinner.stop("Installation complete");
2784
+ warnAutoGlobalAgents(autoGlobalAgents);
2765
2785
  console.log();
2766
2786
  const successful = results.filter((r) => r.success);
2767
2787
  const failed = results.filter((r) => !r.success);
2788
+ const hasAnyGlobalInstall = installGlobally || autoGlobalAgents.length > 0;
2768
2789
  const sourceIdentifier = wellKnownProvider.getSourceIdentifier(url);
2769
2790
  const skillFiles = {};
2770
2791
  for (const skill of selectedSkills) skillFiles[skill.installName] = skill.sourceUrl;
@@ -2773,7 +2794,7 @@ async function handleWellKnownSkills(source, url, options, spinner, allowFallbac
2773
2794
  source: sourceIdentifier,
2774
2795
  skills: selectedSkills.map((s) => s.installName).join(","),
2775
2796
  agents: targetAgents.join(","),
2776
- ...installGlobally && { global: "1" },
2797
+ ...hasAnyGlobalInstall && { global: "1" },
2777
2798
  skillFiles: JSON.stringify(skillFiles),
2778
2799
  sourceType: "well-known"
2779
2800
  });
@@ -2782,14 +2803,14 @@ async function handleWellKnownSkills(source, url, options, spinner, allowFallbac
2782
2803
  sourceUrl: url,
2783
2804
  skills: selectedSkills.map((s) => s.installName),
2784
2805
  agents: targetAgents,
2785
- installGlobally,
2806
+ installGlobally: hasAnyGlobalInstall,
2786
2807
  skillFiles,
2787
2808
  sourceType: "well-known",
2788
2809
  successfulCount: successful.length,
2789
2810
  failedCount: failed.length,
2790
2811
  failedDetails: buildFailedDetails(results)
2791
2812
  });
2792
- if (successful.length > 0 && installGlobally) {
2813
+ if (successful.length > 0 && hasAnyGlobalInstall) {
2793
2814
  const successfulSkillNames = new Set(successful.map((r) => r.skill));
2794
2815
  for (const skill of selectedSkills) if (successfulSkillNames.has(skill.installName)) try {
2795
2816
  await addSkillToLock(skill.installName, {
@@ -2803,18 +2824,21 @@ async function handleWellKnownSkills(source, url, options, spinner, allowFallbac
2803
2824
  }
2804
2825
  if (successful.length > 0 && !installGlobally) {
2805
2826
  const successfulSkillNames = new Set(successful.map((r) => r.skill));
2806
- for (const skill of selectedSkills) if (successfulSkillNames.has(skill.installName)) try {
2807
- const matchingResult = successful.find((r) => r.skill === skill.installName);
2808
- const installDir = matchingResult?.canonicalPath || matchingResult?.path;
2809
- if (installDir) {
2810
- const computedHash = await computeSkillFolderHash(installDir);
2811
- await addSkillToLocalLock(skill.installName, {
2812
- source: sourceIdentifier,
2813
- sourceType: "well-known",
2814
- computedHash
2815
- }, cwd);
2816
- }
2817
- } catch {}
2827
+ for (const skill of selectedSkills) if (successfulSkillNames.has(skill.installName)) {
2828
+ if (!successful.some((r) => r.skill === skill.installName && targetAgents.some((agent) => agents[agent].displayName === r.agent && !shouldInstallAgentGlobally(agent, installGlobally, autoGlobalAgents)))) continue;
2829
+ try {
2830
+ const matchingResult = successful.find((r) => r.skill === skill.installName);
2831
+ const installDir = matchingResult?.canonicalPath || matchingResult?.path;
2832
+ if (installDir) {
2833
+ const computedHash = await computeSkillFolderHash(installDir);
2834
+ await addSkillToLocalLock(skill.installName, {
2835
+ source: sourceIdentifier,
2836
+ sourceType: "well-known",
2837
+ computedHash
2838
+ }, cwd);
2839
+ }
2840
+ } catch {}
2841
+ }
2818
2842
  }
2819
2843
  if (successful.length > 0) {
2820
2844
  const bySkill = /* @__PURE__ */ new Map();
@@ -3119,7 +3143,9 @@ async function runAdd(args, options = {}) {
3119
3143
  }
3120
3144
  installGlobally = scope;
3121
3145
  }
3122
- targetAgents = filterProjectUnsupportedAgents(targetAgents, installGlobally, options.agent);
3146
+ const scopeResolution = resolveAgentScopes(targetAgents, installGlobally, options.agent);
3147
+ targetAgents = scopeResolution.targetAgents;
3148
+ const autoGlobalAgents = scopeResolution.autoGlobalAgents;
3123
3149
  let installMode = options.copy ? "copy" : "symlink";
3124
3150
  if (!options.copy && !options.yes) {
3125
3151
  const modeChoice = await ve({
@@ -3147,7 +3173,7 @@ async function runAdd(args, options = {}) {
3147
3173
  const overwriteChecks = await Promise.all(selectedSkills.flatMap((skill) => targetAgents.map(async (agent) => ({
3148
3174
  skillName: skill.name,
3149
3175
  agent,
3150
- installed: await isSkillInstalled(skill.name, agent, { global: installGlobally })
3176
+ installed: await isSkillInstalled(skill.name, agent, { global: shouldInstallAgentGlobally(agent, installGlobally, autoGlobalAgents) })
3151
3177
  }))));
3152
3178
  const overwriteStatus = /* @__PURE__ */ new Map();
3153
3179
  for (const { skillName, agent, installed } of overwriteChecks) {
@@ -3164,7 +3190,7 @@ async function runAdd(args, options = {}) {
3164
3190
  const printSkillSummary = (skills) => {
3165
3191
  for (const skill of skills) {
3166
3192
  if (summaryLines.length > 0) summaryLines.push("");
3167
- const shortCanonical = shortenPath$2(getCanonicalPath(skill.name, { global: installGlobally }), cwd);
3193
+ const shortCanonical = shortenPath$2(getCanonicalPath(skill.name, { global: installGlobally || targetAgents.every((agent) => autoGlobalAgents.includes(agent)) }), cwd);
3168
3194
  summaryLines.push(`${import_picocolors.default.cyan(shortCanonical)}`);
3169
3195
  summaryLines.push(...buildAgentSummaryLines(targetAgents, installMode));
3170
3196
  const skillOverwrites = overwriteStatus.get(skill.name);
@@ -3210,7 +3236,7 @@ async function runAdd(args, options = {}) {
3210
3236
  const results = [];
3211
3237
  for (const skill of selectedSkills) for (const agent of targetAgents) {
3212
3238
  const result = await installSkillForAgent(skill, agent, {
3213
- global: installGlobally,
3239
+ global: shouldInstallAgentGlobally(agent, installGlobally, autoGlobalAgents),
3214
3240
  mode: installMode
3215
3241
  });
3216
3242
  results.push({
@@ -3221,9 +3247,11 @@ async function runAdd(args, options = {}) {
3221
3247
  });
3222
3248
  }
3223
3249
  spinner.stop("Installation complete");
3250
+ warnAutoGlobalAgents(autoGlobalAgents);
3224
3251
  console.log();
3225
3252
  const successful = results.filter((r) => r.success);
3226
3253
  const failed = results.filter((r) => !r.success);
3254
+ const hasAnyGlobalInstall = installGlobally || autoGlobalAgents.length > 0;
3227
3255
  const skillFiles = {};
3228
3256
  for (const skill of selectedSkills) {
3229
3257
  let relativePath;
@@ -3238,7 +3266,7 @@ async function runAdd(args, options = {}) {
3238
3266
  sourceUrl: parsed.url,
3239
3267
  skills: selectedSkills.map((s) => s.name),
3240
3268
  agents: targetAgents,
3241
- installGlobally,
3269
+ installGlobally: hasAnyGlobalInstall,
3242
3270
  sourceType: parsed.type,
3243
3271
  skillFiles
3244
3272
  };
@@ -3250,7 +3278,7 @@ async function runAdd(args, options = {}) {
3250
3278
  source: normalizedSource,
3251
3279
  skills: selectedSkills.map((s) => s.name).join(","),
3252
3280
  agents: targetAgents.join(","),
3253
- ...installGlobally && { global: "1" },
3281
+ ...hasAnyGlobalInstall && { global: "1" },
3254
3282
  skillFiles: JSON.stringify(skillFiles)
3255
3283
  });
3256
3284
  } else track({
@@ -3258,7 +3286,7 @@ async function runAdd(args, options = {}) {
3258
3286
  source: normalizedSource,
3259
3287
  skills: selectedSkills.map((s) => s.name).join(","),
3260
3288
  agents: targetAgents.join(","),
3261
- ...installGlobally && { global: "1" },
3289
+ ...hasAnyGlobalInstall && { global: "1" },
3262
3290
  skillFiles: JSON.stringify(skillFiles)
3263
3291
  });
3264
3292
  }
@@ -3274,7 +3302,7 @@ async function runAdd(args, options = {}) {
3274
3302
  failedCount: failed.length,
3275
3303
  failedDetails: buildFailedDetails(results)
3276
3304
  });
3277
- if (successful.length > 0 && installGlobally && normalizedSource) {
3305
+ if (successful.length > 0 && (installGlobally || autoGlobalAgents.length > 0) && normalizedSource) {
3278
3306
  const successfulSkillNames = new Set(successful.map((r) => r.skill));
3279
3307
  for (const skill of selectedSkills) {
3280
3308
  const skillDisplayName = getSkillDisplayName(skill);
@@ -3300,14 +3328,17 @@ async function runAdd(args, options = {}) {
3300
3328
  const successfulSkillNames = new Set(successful.map((r) => r.skill));
3301
3329
  for (const skill of selectedSkills) {
3302
3330
  const skillDisplayName = getSkillDisplayName(skill);
3303
- if (successfulSkillNames.has(skillDisplayName)) try {
3304
- const computedHash = await computeSkillFolderHash(skill.path);
3305
- await addSkillToLocalLock(skill.name, {
3306
- source: normalizedSource || parsed.url,
3307
- sourceType: parsed.type,
3308
- computedHash
3309
- }, cwd);
3310
- } catch {}
3331
+ if (successfulSkillNames.has(skillDisplayName)) {
3332
+ if (!successful.some((r) => r.skill === skillDisplayName && targetAgents.some((agent) => agents[agent].displayName === r.agent && !shouldInstallAgentGlobally(agent, installGlobally, autoGlobalAgents)))) continue;
3333
+ try {
3334
+ const computedHash = await computeSkillFolderHash(skill.path);
3335
+ await addSkillToLocalLock(skill.name, {
3336
+ source: normalizedSource || parsed.url,
3337
+ sourceType: parsed.type,
3338
+ computedHash
3339
+ }, cwd);
3340
+ } catch {}
3341
+ }
3311
3342
  }
3312
3343
  }
3313
3344
  if (successful.length > 0) {
@@ -3475,6 +3506,12 @@ function parseAddOptions(args) {
3475
3506
  i--;
3476
3507
  } else if (arg === "--full-depth") options.fullDepth = true;
3477
3508
  else if (arg === "--copy") options.copy = true;
3509
+ else if (arg && /^-[ygld]+$/.test(arg)) for (const flag of arg.slice(1)) {
3510
+ if (flag === "y") options.yes = true;
3511
+ if (flag === "g") options.global = true;
3512
+ if (flag === "l") options.list = true;
3513
+ if (flag === "d") options.fullDepth = true;
3514
+ }
3478
3515
  else if (arg && !arg.startsWith("-")) source.push(arg);
3479
3516
  }
3480
3517
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bip-skills",
3
- "version": "1.4.12",
3
+ "version": "1.4.13",
4
4
  "description": "The open agent skills ecosystem",
5
5
  "type": "module",
6
6
  "bin": {