@cannbot-ai/install-helper 0.0.2-beta.35 → 0.0.2-beta.36

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/index.js CHANGED
@@ -417,8 +417,9 @@ async function getCommandVersion(cmd, args = ["--version"]) {
417
417
  }
418
418
  async function getCommandPath(cmd) {
419
419
  try {
420
- const result = await execa("which", [cmd], { timeout: 5e3 });
421
- return result.stdout.trim();
420
+ const whichCmd = process.platform === "win32" ? "where" : "which";
421
+ const result = await execa(whichCmd, [cmd], { timeout: 5e3 });
422
+ return result.stdout.trim().split("\n")[0];
422
423
  } catch {
423
424
  return void 0;
424
425
  }
@@ -1906,13 +1907,14 @@ async function installPlugin(opts) {
1906
1907
  }
1907
1908
  }
1908
1909
  try {
1910
+ const shell = process.platform === "win32" ? "sh" : "bash";
1909
1911
  const execOptions = {
1910
1912
  cwd,
1911
1913
  timeout: 3e5,
1912
1914
  stdio: "pipe",
1913
1915
  input: opts.yes ? "y\n" : void 0
1914
1916
  };
1915
- await execa3("bash", [scriptPath, ...args], execOptions);
1917
+ await execa3(shell, [scriptPath, ...args], execOptions);
1916
1918
  const manifest = readManifest(configRoot);
1917
1919
  let skillsCount = 0;
1918
1920
  let agentsCount = 0;
@@ -2002,7 +2004,11 @@ async function installSkills(skillIds, tool, level, repoPath) {
2002
2004
  results.push({ skillId, success: true });
2003
2005
  installedIds.push(skillId);
2004
2006
  } catch (error) {
2005
- results.push({ skillId, success: false, error: error instanceof Error ? error.message : t("error_unknown") });
2007
+ let msg = error instanceof Error ? error.message : t("error_unknown");
2008
+ if (process.platform === "win32" && msg.includes("EPERM")) {
2009
+ msg = t("error_symlink_windows");
2010
+ }
2011
+ results.push({ skillId, success: false, error: msg });
2006
2012
  }
2007
2013
  }
2008
2014
  if (installedIds.length > 0) {
@@ -3032,7 +3038,7 @@ async function installPlugins(pluginIds, tool, level, repoPath, installPath, yes
3032
3038
 
3033
3039
  // src/commands/uninstall.ts
3034
3040
  import { existsSync as existsSync15, unlinkSync as unlinkSync6, rmdirSync as rmdirSync2, readdirSync as readdirSync6 } from "fs";
3035
- import { resolve } from "path";
3041
+ import { resolve, basename } from "path";
3036
3042
  import chalk11 from "chalk";
3037
3043
  async function uninstallCommand(names, options) {
3038
3044
  const tool = options.tool ? validateTool(options.tool) : "opencode";
@@ -3075,7 +3081,7 @@ async function uninstallCommand(names, options) {
3075
3081
  try {
3076
3082
  if (existsSync15(filePath) || isSymlink(filePath)) {
3077
3083
  unlinkSync6(filePath);
3078
- const name = filePath.split("/").pop() || filePath;
3084
+ const name = basename(filePath);
3079
3085
  logger.step(` ${t("uninstall_remove_label")}: ${name}`);
3080
3086
  removedFiles++;
3081
3087
  }
@@ -3092,7 +3098,7 @@ async function uninstallCommand(names, options) {
3092
3098
  const entries = readdirSync6(dirPath);
3093
3099
  if (entries.length === 0) {
3094
3100
  rmdirSync2(dirPath);
3095
- const name = dirPath.split("/").pop() || dirPath;
3101
+ const name = basename(dirPath);
3096
3102
  logger.step(` ${t("uninstall_clean_empty_dir")}: ${name}/`);
3097
3103
  removedDirs++;
3098
3104
  }