@llmist/cli 9.3.2 → 9.5.0

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/cli.js CHANGED
@@ -79,7 +79,7 @@ import { Command, InvalidArgumentError as InvalidArgumentError2 } from "commande
79
79
  // package.json
80
80
  var package_default = {
81
81
  name: "@llmist/cli",
82
- version: "9.3.2",
82
+ version: "9.5.0",
83
83
  description: "CLI for llmist - run LLM agents from the command line",
84
84
  type: "module",
85
85
  main: "dist/cli.js",
@@ -916,6 +916,21 @@ import fs5 from "fs";
916
916
  import path4 from "path";
917
917
  import os from "os";
918
918
  import { pathToFileURL } from "url";
919
+ function detectPackageManager() {
920
+ try {
921
+ execSync("bun --version", { stdio: "pipe" });
922
+ return "bun";
923
+ } catch {
924
+ return "npm";
925
+ }
926
+ }
927
+ var cachedPackageManager = null;
928
+ function getPackageManager() {
929
+ if (!cachedPackageManager) {
930
+ cachedPackageManager = detectPackageManager();
931
+ }
932
+ return cachedPackageManager;
933
+ }
919
934
  var CACHE_DIR = path4.join(os.homedir(), ".llmist", "gadget-cache");
920
935
  function isExternalPackageSpecifier(specifier) {
921
936
  if (/^(?:@[a-z0-9][\w.-]*\/)?[a-z0-9][\w.-]*(?:@[\w.-]+)?(?::[a-z]+)?(?:\/[A-Z]\w*)?$/i.test(
@@ -1037,14 +1052,16 @@ async function installNpmPackage(spec, cacheDir) {
1037
1052
  };
1038
1053
  fs5.writeFileSync(path4.join(cacheDir, "package.json"), JSON.stringify(packageJson, null, 2));
1039
1054
  const packageSpec = spec.version ? `${spec.package}@${spec.version}` : spec.package;
1055
+ const pm = getPackageManager();
1056
+ const installCmd = pm === "bun" ? `bun add "${packageSpec}"` : `npm install "${packageSpec}"`;
1040
1057
  try {
1041
- execSync(`bun add "${packageSpec}"`, {
1058
+ execSync(installCmd, {
1042
1059
  stdio: "pipe",
1043
1060
  cwd: cacheDir
1044
1061
  });
1045
1062
  } catch (error) {
1046
1063
  const message = error instanceof Error ? error.message : String(error);
1047
- throw new Error(`Failed to install npm package '${packageSpec}': ${message}`);
1064
+ throw new Error(`Failed to install npm package '${packageSpec}' using ${pm}: ${message}`);
1048
1065
  }
1049
1066
  }
1050
1067
  async function installGitPackage(spec, cacheDir) {
@@ -1068,16 +1085,19 @@ async function installGitPackage(spec, cacheDir) {
1068
1085
  throw new Error(`Failed to clone git repository '${spec.package}': ${message}`);
1069
1086
  }
1070
1087
  if (fs5.existsSync(path4.join(cacheDir, "package.json"))) {
1088
+ const pm = getPackageManager();
1089
+ const installCmd = pm === "bun" ? "bun install" : "npm install";
1090
+ const runCmd = pm === "bun" ? "bun run" : "npm run";
1071
1091
  try {
1072
- execSync("bun install", { cwd: cacheDir, stdio: "inherit" });
1092
+ execSync(installCmd, { cwd: cacheDir, stdio: "inherit" });
1073
1093
  } catch (error) {
1074
1094
  const message = error instanceof Error ? error.message : String(error);
1075
- throw new Error(`Failed to install dependencies for '${spec.package}': ${message}`);
1095
+ throw new Error(`Failed to install dependencies for '${spec.package}' using ${pm}: ${message}`);
1076
1096
  }
1077
1097
  const packageJson = JSON.parse(fs5.readFileSync(path4.join(cacheDir, "package.json"), "utf-8"));
1078
1098
  if (packageJson.scripts?.build) {
1079
1099
  try {
1080
- execSync("bun run build", { cwd: cacheDir, stdio: "inherit" });
1100
+ execSync(`${runCmd} build`, { cwd: cacheDir, stdio: "inherit" });
1081
1101
  } catch (error) {
1082
1102
  const entryPoint = packageJson.llmist?.gadgets || "./dist/index.js";
1083
1103
  const entryPointPath = path4.join(cacheDir, entryPoint);