bip-skills 1.4.3 → 1.4.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +20 -14
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -29,6 +29,7 @@ const DEFAULT_DISCOVERY_SITE_URL = DEFAULT_WELL_KNOWN_BASE_URL;
29
29
  const DEFAULT_SEARCH_API_BASE = DEFAULT_WELL_KNOWN_BASE_URL;
30
30
  const DEFAULT_GIT_HOST = "git.yonyou.com";
31
31
  const DEFAULT_GIT_BASE_URL = `https://${DEFAULT_GIT_HOST}`;
32
+ const DEFAULT_GIT_FALLBACK_SSH_HOST = "git.yyrd.com";
32
33
  function isYyuapHost(hostname) {
33
34
  return hostname === "yyuap.com" || hostname.endsWith(".yyuap.com");
34
35
  }
@@ -1476,15 +1477,16 @@ var WellKnownProvider = class {
1476
1477
  return { matches: false };
1477
1478
  }
1478
1479
  }
1479
- async fetchIndex(baseUrl) {
1480
+ async fetchIndex(baseUrl, options = {}) {
1480
1481
  try {
1482
+ const { fallbackToRoot = true } = options;
1481
1483
  const parsed = new URL(baseUrl);
1482
1484
  const basePath = parsed.pathname.replace(/\/$/, "");
1483
1485
  const urlsToTry = [{
1484
1486
  indexUrl: `${parsed.protocol}//${parsed.host}${basePath}/${this.WELL_KNOWN_PATH}/${this.INDEX_FILE}`,
1485
1487
  baseUrl: `${parsed.protocol}//${parsed.host}${basePath}`
1486
1488
  }];
1487
- if (basePath && basePath !== "") urlsToTry.push({
1489
+ if (fallbackToRoot && basePath && basePath !== "") urlsToTry.push({
1488
1490
  indexUrl: `${parsed.protocol}//${parsed.host}/${this.WELL_KNOWN_PATH}/${this.INDEX_FILE}`,
1489
1491
  baseUrl: `${parsed.protocol}//${parsed.host}`
1490
1492
  });
@@ -1532,10 +1534,10 @@ var WellKnownProvider = class {
1532
1534
  if (!e.files.some((f) => typeof f === "string" && f.toLowerCase() === "skill.md")) return false;
1533
1535
  return true;
1534
1536
  }
1535
- async fetchSkill(url) {
1537
+ async fetchSkill(url, options = {}) {
1536
1538
  try {
1537
1539
  const parsed = new URL(url);
1538
- const result = await this.fetchIndex(url);
1540
+ const result = await this.fetchIndex(url, options);
1539
1541
  if (!result) return null;
1540
1542
  const { index, resolvedBaseUrl } = result;
1541
1543
  let skillName = null;
@@ -1588,9 +1590,9 @@ var WellKnownProvider = class {
1588
1590
  return null;
1589
1591
  }
1590
1592
  }
1591
- async fetchAllSkills(url) {
1593
+ async fetchAllSkills(url, options = {}) {
1592
1594
  try {
1593
- const result = await this.fetchIndex(url);
1595
+ const result = await this.fetchIndex(url, options);
1594
1596
  if (!result) return [];
1595
1597
  const { index, resolvedBaseUrl } = result;
1596
1598
  const skillPromises = index.skills.map((entry) => this.fetchSkillByEntry(resolvedBaseUrl, entry));
@@ -1621,8 +1623,8 @@ var WellKnownProvider = class {
1621
1623
  return "unknown";
1622
1624
  }
1623
1625
  }
1624
- async hasSkillsIndex(url) {
1625
- return await this.fetchIndex(url) !== null;
1626
+ async hasSkillsIndex(url, options = {}) {
1627
+ return await this.fetchIndex(url, options) !== null;
1626
1628
  }
1627
1629
  };
1628
1630
  const wellKnownProvider = new WellKnownProvider();
@@ -1802,7 +1804,7 @@ function createEmptyLocalLock() {
1802
1804
  skills: {}
1803
1805
  };
1804
1806
  }
1805
- var version$1 = "1.4.3";
1807
+ var version$1 = "1.4.4";
1806
1808
  const isCancelled$1 = (value) => typeof value === "symbol";
1807
1809
  async function isSourcePrivate(source) {
1808
1810
  const ownerRepo = parseOwnerRepo(source);
@@ -1974,9 +1976,12 @@ function isBareSkillNameSource(source) {
1974
1976
  function shouldProbeDefaultWellKnownPath(source) {
1975
1977
  return source.includes("/") && !source.includes("@") && !source.startsWith("http://") && !source.startsWith("https://") && !source.startsWith("git@") && !source.startsWith("ssh://") && !source.startsWith("./") && !source.startsWith("../") && source !== "." && source !== "..";
1976
1978
  }
1977
- async function handleWellKnownSkills(source, url, options, spinner, allowFallback = false) {
1979
+ function buildFallbackGitSshUrl(source) {
1980
+ return `git@${DEFAULT_GIT_FALLBACK_SSH_HOST}:${source.replace(/\.git$/, "")}.git`;
1981
+ }
1982
+ async function handleWellKnownSkills(source, url, options, spinner, allowFallback = false, fallbackToRoot = true) {
1978
1983
  spinner.start("Discovering skills from well-known endpoint...");
1979
- const skills = await wellKnownProvider.fetchAllSkills(url);
1984
+ const skills = await wellKnownProvider.fetchAllSkills(url, { fallbackToRoot });
1980
1985
  if (skills.length === 0) {
1981
1986
  if (allowFallback) {
1982
1987
  spinner.stop(import_picocolors.default.yellow("Default well-known endpoint unavailable"));
@@ -2285,13 +2290,14 @@ async function runAdd(args, options = {}) {
2285
2290
  if (source && isBareSkillNameSource(source)) {
2286
2291
  options.skill = options.skill || [];
2287
2292
  if (!options.skill.includes(source)) options.skill.push(source);
2288
- if (await handleWellKnownSkills(source, DEFAULT_WELL_KNOWN_BASE_URL, options, spinner, true)) return;
2293
+ if (await handleWellKnownSkills(source, DEFAULT_WELL_KNOWN_BASE_URL, options, spinner, true, true)) return;
2289
2294
  Se(import_picocolors.default.red(`No skills found for: ${source}`));
2290
2295
  process.exit(1);
2291
2296
  }
2292
2297
  if (source && shouldProbeDefaultWellKnownPath(source)) {
2293
- if (await handleWellKnownSkills(source, `${DEFAULT_WELL_KNOWN_BASE_URL}/${source.replace(/^\/+/, "")}`, options, spinner, true)) return;
2294
- M.info(`Falling back to source parsing: ${import_picocolors.default.cyan(source)}`);
2298
+ if (await handleWellKnownSkills(source, `${DEFAULT_WELL_KNOWN_BASE_URL}/${source.replace(/^\/+/, "")}`, options, spinner, true, false)) return;
2299
+ source = buildFallbackGitSshUrl(source);
2300
+ M.info(`Falling back to git source: ${import_picocolors.default.cyan(source)}`);
2295
2301
  }
2296
2302
  spinner.start("Parsing source...");
2297
2303
  const parsed = parseSource(source);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bip-skills",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "The open agent skills ecosystem",
5
5
  "type": "module",
6
6
  "bin": {