ali-skills 0.0.12 → 0.0.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.
@@ -2,6 +2,18 @@
2
2
 
3
3
  import module from 'node:module';
4
4
 
5
+ // Check Node.js version (require >= 18 for native fetch)
6
+ const nodeVersion = process.versions.node;
7
+ const majorVersion = parseInt(nodeVersion.split('.')[0], 10);
8
+
9
+ if (majorVersion < 18) {
10
+ console.error(`\n❌ Error: Node.js version ${nodeVersion} is not supported.`);
11
+ console.error(`\n This CLI requires Node.js 18 or higher due to native fetch API usage.`);
12
+ console.error(` Please upgrade to Node.js 20 or later (recommended).\n`);
13
+ console.error(` Current version: ${nodeVersion}\n`);
14
+ process.exit(1);
15
+ }
16
+
5
17
  // https://nodejs.org/api/module.html#module-compile-cache
6
18
  if (module.enableCompileCache && !process.env.NODE_DISABLE_COMPILE_CACHE) {
7
19
  try {
@@ -1674,6 +1674,16 @@ async function listInstalledSkills(options = {}) {
1674
1674
  const TELEMETRY_URL = `${SKILLS_API_BASE_URL}/telemetry`;
1675
1675
  const AUDIT_URL = `${SKILLS_API_BASE_URL}/audit`;
1676
1676
  let cliVersion = null;
1677
+ const pendingPromises = [];
1678
+ let pendingCount = 0;
1679
+ function getPendingTelemetryCount() {
1680
+ return pendingCount;
1681
+ }
1682
+ async function flushTelemetry() {
1683
+ if (pendingPromises.length === 0) return;
1684
+ await Promise.allSettled(pendingPromises);
1685
+ pendingCount = 0;
1686
+ }
1677
1687
  function isCI() {
1678
1688
  return !!(process.env.CI || process.env.GITHUB_ACTIONS || process.env.GITLAB_CI || process.env.CIRCLECI || process.env.TRAVIS || process.env.BUILDKITE || process.env.JENKINS_URL || process.env.TEAMCITY_VERSION);
1679
1689
  }
@@ -1706,11 +1716,19 @@ function track(data) {
1706
1716
  if (!isEnabled()) return;
1707
1717
  try {
1708
1718
  const params = new URLSearchParams();
1719
+ pendingCount++;
1709
1720
  if (cliVersion) params.set("v", cliVersion);
1710
1721
  if (isCI()) params.set("ci", "1");
1711
1722
  for (const [key, value] of Object.entries(data)) if (value !== void 0 && value !== null) params.set(key, String(value));
1712
- fetch(`${TELEMETRY_URL}?${params.toString()}`).catch((err) => {
1713
- if (process.env.DEBUG) console.error("[Telemetry] Failed to send telemetry:", err);
1723
+ const requestUrl = `${TELEMETRY_URL}?${params.toString()}`;
1724
+ if (process.env.DEBUG) console.log("[Telemetry] request:", requestUrl);
1725
+ const promise = fetch(requestUrl).catch((err) => {
1726
+ console.error("[Telemetry] Failed to send telemetry:", err);
1727
+ });
1728
+ pendingPromises.push(promise);
1729
+ promise.finally(() => {
1730
+ const index = pendingPromises.indexOf(promise);
1731
+ if (index > -1) pendingPromises.splice(index, 1);
1714
1732
  });
1715
1733
  } catch {}
1716
1734
  }
@@ -2083,7 +2101,7 @@ function logSkillParseFailures(failures) {
2083
2101
  if (f.hint) M.message(import_picocolors.default.yellow(` 提示: ${f.hint}`));
2084
2102
  }
2085
2103
  }
2086
- var version$1 = "2.0.11";
2104
+ var version$1 = "2.0.13";
2087
2105
  const isCancelled$1 = (value) => typeof value === "symbol";
2088
2106
  async function isSourcePrivate(source) {
2089
2107
  const ownerRepo = parseOwnerRepo(source);
@@ -2322,7 +2340,7 @@ async function handleWellKnownSkills(source, url, options, spinner) {
2322
2340
  M.info(`Valid agents: ${validAgents.join(", ")}`);
2323
2341
  process.exit(1);
2324
2342
  }
2325
- targetAgents = options.agent;
2343
+ targetAgents = ensureUniversalAgents(options.agent);
2326
2344
  } else {
2327
2345
  spinner.start("Loading agents...");
2328
2346
  const installedAgents = await detectInstalledAgents();
@@ -2380,8 +2398,7 @@ async function handleWellKnownSkills(source, url, options, spinner) {
2380
2398
  installGlobally = scope;
2381
2399
  }
2382
2400
  let installMode = options.copy ? "copy" : "symlink";
2383
- const uniqueDirs = new Set(targetAgents.map((a) => agents[a].skillsDir));
2384
- if (!options.copy && !options.yes && uniqueDirs.size > 1) {
2401
+ if (!options.copy && !options.yes) {
2385
2402
  const modeChoice = await ve({
2386
2403
  message: "Installation method",
2387
2404
  options: [{
@@ -2399,7 +2416,7 @@ async function handleWellKnownSkills(source, url, options, spinner) {
2399
2416
  process.exit(0);
2400
2417
  }
2401
2418
  installMode = modeChoice;
2402
- } else if (uniqueDirs.size <= 1) installMode = "copy";
2419
+ }
2403
2420
  const cwd = process.cwd();
2404
2421
  const summaryLines = [];
2405
2422
  const overwriteChecks = await Promise.all(selectedSkills.flatMap((skill) => targetAgents.map(async (agent) => ({
@@ -2822,7 +2839,7 @@ async function runAdd(args, options = {}) {
2822
2839
  await cleanup(tempDir);
2823
2840
  process.exit(1);
2824
2841
  }
2825
- targetAgents = options.agent;
2842
+ targetAgents = ensureUniversalAgents(options.agent);
2826
2843
  } else {
2827
2844
  spinner.start("Loading agents...");
2828
2845
  const installedAgents = await detectInstalledAgents();
@@ -2883,8 +2900,7 @@ async function runAdd(args, options = {}) {
2883
2900
  installGlobally = scope;
2884
2901
  }
2885
2902
  let installMode = options.copy ? "copy" : "symlink";
2886
- const uniqueDirs = new Set(targetAgents.map((a) => agents[a].skillsDir));
2887
- if (!options.copy && !options.yes && uniqueDirs.size > 1) {
2903
+ if (!options.copy && !options.yes) {
2888
2904
  const modeChoice = await ve({
2889
2905
  message: "Installation method",
2890
2906
  options: [{
@@ -2903,7 +2919,7 @@ async function runAdd(args, options = {}) {
2903
2919
  process.exit(0);
2904
2920
  }
2905
2921
  installMode = modeChoice;
2906
- } else if (uniqueDirs.size <= 1) installMode = "copy";
2922
+ }
2907
2923
  const cwd = process.cwd();
2908
2924
  const summaryLines = [];
2909
2925
  const overwriteChecks = await Promise.all(selectedSkills.flatMap((skill) => targetAgents.map(async (agent) => ({
@@ -4901,5 +4917,16 @@ async function main() {
4901
4917
  console.log(`Run ${BOLD}cli-skills --help${RESET} for usage.`);
4902
4918
  }
4903
4919
  }
4904
- main();
4920
+ main().then(async () => {
4921
+ if (getPendingTelemetryCount() > 0) {
4922
+ console.log();
4923
+ console.log(`${DIM}Syncing installation data...${RESET}`);
4924
+ }
4925
+ await flushTelemetry();
4926
+ process.exit(0);
4927
+ }).catch(async (error) => {
4928
+ console.error(error);
4929
+ await flushTelemetry();
4930
+ process.exit(1);
4931
+ });
4905
4932
  export {};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ali/cli-skills",
3
- "version": "2.0.11",
3
+ "version": "2.0.13",
4
4
  "description": "The open agent skills ecosystem",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,7 +16,8 @@
16
16
  "scripts": {
17
17
  "build": "node scripts/generate-licenses.ts && obuild",
18
18
  "generate-licenses": "node scripts/generate-licenses.ts",
19
- "dev": "node --env-file=.env src/cli.ts",
19
+ "dev": "node src/cli.ts",
20
+ "dev:env": "node --env-file=.env src/cli.ts",
20
21
  "exec:test": "node scripts/execute-tests.ts",
21
22
  "prepublishOnly": "npm run build",
22
23
  "format": "prettier --write 'src/**/*.ts' 'scripts/**/*.ts'",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ali-skills",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "The open agent skills ecosystem",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  "author": "",
32
32
  "license": "MIT",
33
33
  "dependencies": {
34
- "@ali/cli-skills": "^2.0.11"
34
+ "@ali/cli-skills": "^2.0.13"
35
35
  },
36
36
  "bundleDependencies": [
37
37
  "@ali/cli-skills"