codewave-openclaw-installer 2.1.4 → 2.1.6

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.
@@ -71,7 +71,7 @@ export const CHANNEL_DEFINITIONS = {
71
71
  ? ['powershell', ['-Command', 'irm https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-workspace-cli/main/scripts/install.ps1 | iex']]
72
72
  : ['sh', ['-c', 'curl -fsSL https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-workspace-cli/main/scripts/install.sh | sh']],
73
73
  initCandidates: [
74
- ['dws', ['auth', 'login']],
74
+ ['dws', ['auth', 'login', '--force']],
75
75
  ['dingtalk', ['auth', 'login']],
76
76
  ['dingtalk-workspace-cli', ['auth', 'login']],
77
77
  ],
package/bin/install.mjs CHANGED
@@ -37,6 +37,22 @@ const NPM = 'npm';
37
37
  const PIP = isWin ? 'pip' : 'pip3';
38
38
  const DRY_RUN = shouldDryRun(process.argv);
39
39
  const OPENCLAW_CONFIG_PATH = join(homedir(), '.openclaw', 'openclaw.json');
40
+
41
+ function resolveExecutable(cmd) {
42
+ if (!isWin) {
43
+ return cmd;
44
+ }
45
+ if (cmd === 'npm') return 'npm.cmd';
46
+ if (cmd === 'npx') return 'npx.cmd';
47
+ if (cmd === 'pip') return 'pip.exe';
48
+ if (cmd === 'pip3') return 'pip3.exe';
49
+ if (cmd === 'python3') return 'python.exe';
50
+ return cmd;
51
+ }
52
+
53
+ function shouldUseShell(executable) {
54
+ return isWin && /\.(cmd|bat)$/i.test(executable);
55
+ }
40
56
  const WINDOWS_UNINSTALL_KEYS = [
41
57
  'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
42
58
  'HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
@@ -51,12 +67,13 @@ function step(index, total, title) {
51
67
  }
52
68
 
53
69
  function run(cmd, args, opts = {}) {
70
+ const executable = resolveExecutable(cmd);
54
71
  if (DRY_RUN) {
55
- console.log(dim(` [dry-run] ${cmd} ${args.join(' ')}`));
72
+ console.log(dim(` [dry-run] ${executable} ${args.join(' ')}`));
56
73
  return Promise.resolve(0);
57
74
  }
58
75
  return new Promise((resolve) => {
59
- const child = spawn(cmd, args, { stdio: 'inherit', shell: isWin, ...opts });
76
+ const child = spawn(executable, args, { stdio: 'inherit', shell: shouldUseShell(executable), ...opts });
60
77
  child.on('close', (code) => resolve(code ?? 1));
61
78
  child.on('error', (err) => {
62
79
  console.log(yellow(` ⚠ 进程启动失败: ${err.message}`));
@@ -66,8 +83,9 @@ function run(cmd, args, opts = {}) {
66
83
  }
67
84
 
68
85
  function runCapture(cmd, args, opts = {}) {
86
+ const executable = resolveExecutable(cmd);
69
87
  return new Promise((resolve) => {
70
- const child = spawn(cmd, args, { stdio: ['ignore', 'pipe', 'pipe'], shell: isWin, ...opts });
88
+ const child = spawn(executable, args, { stdio: ['ignore', 'pipe', 'pipe'], shell: shouldUseShell(executable), ...opts });
71
89
  let stdout = '';
72
90
  let stderr = '';
73
91
  child.stdout?.on('data', (chunk) => { stdout += chunk.toString(); });
@@ -80,7 +98,7 @@ function runCapture(cmd, args, opts = {}) {
80
98
  function commandExists(cmd) {
81
99
  return new Promise((resolve) => {
82
100
  const check = isWin ? 'where' : 'which';
83
- const child = spawn(check, [cmd], { stdio: 'ignore', shell: isWin });
101
+ const child = spawn(check, [cmd], { stdio: 'ignore', shell: false });
84
102
  child.on('close', (code) => resolve(code === 0));
85
103
  child.on('error', () => resolve(false));
86
104
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codewave-openclaw-installer",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "网易智企 CodeWave OpenClaw 扩展:Skills + CLI 依赖一键安装",
5
5
  "type": "module",
6
6
  "main": "index.js",