aicodeswitch 1.3.6 → 1.3.7

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/bin/update.js +19 -8
  2. package/package.json +1 -1
package/bin/update.js CHANGED
@@ -224,10 +224,24 @@ const update = async () => {
224
224
 
225
225
  // 检查是否需要 sudo
226
226
  const needSudo = needsSudo();
227
+
228
+ // 如果需要 sudo,显示提示让用户手动执行
227
229
  if (needSudo) {
228
- console.log(chalk.yellow.bold('⚠️ Note: '));
229
- console.log(chalk.white('This operation may require ') + chalk.yellow.bold('sudo') + chalk.white(' privileges.'));
230
- console.log(chalk.gray('If prompted, please enter your password.\n'));
230
+ console.log(boxen(
231
+ chalk.yellow.bold('⚠️ Sudo privileges required\n\n') +
232
+ chalk.white('This operation requires ') + chalk.yellow.bold('sudo') + chalk.white(' privileges.\n\n') +
233
+ chalk.white('Please run the following command to update:\n\n') +
234
+ chalk.cyan.bold(' sudo npm install -g ' + PACKAGE_NAME + '@latest\n\n') +
235
+ chalk.gray('After updating, run ') + chalk.cyan('aicos restart') + chalk.gray(' to restart the server.'),
236
+ {
237
+ padding: 1,
238
+ margin: 1,
239
+ borderStyle: 'round',
240
+ borderColor: 'yellow'
241
+ }
242
+ ));
243
+ console.log('');
244
+ process.exit(0);
231
245
  }
232
246
 
233
247
  // 执行更新
@@ -236,17 +250,14 @@ const update = async () => {
236
250
  color: 'cyan'
237
251
  }).start();
238
252
 
239
- const npmCommand = needSudo ? 'sudo' : 'npm';
240
- const npmArgs = needSudo ? ['npm', 'install', '-g', `${PACKAGE_NAME}@latest`] : ['install', '-g', `${PACKAGE_NAME}@latest`];
241
-
242
253
  try {
243
- await execCommand(npmCommand, npmArgs);
254
+ await execCommand('npm', ['install', '-g', `${PACKAGE_NAME}@latest`]);
244
255
  updateSpinner.succeed(chalk.green('Update successful!'));
245
256
  } catch (err) {
246
257
  updateSpinner.fail(chalk.red('Update failed'));
247
258
  console.log(chalk.yellow(`\nUpdate failed with error code ${err.code || 'unknown'}\n`));
248
259
  console.log(chalk.white('You can try manually updating:\n'));
249
- console.log(chalk.cyan(` ${npmCommand} ${npmArgs.join(' ')}\n`));
260
+ console.log(chalk.cyan(` npm install -g ${PACKAGE_NAME}@latest\n`));
250
261
  process.exit(1);
251
262
  }
252
263
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aicodeswitch",
3
- "version": "1.3.6",
3
+ "version": "1.3.7",
4
4
  "description": "A tool to help you manage AI programming tools to access large language models locally. It allows your Claude Code, Codex and other tools to no longer be limited to official models.",
5
5
  "author": "tangshuang",
6
6
  "license": "GPL-3.0",