@coze/cli 0.1.0-alpha.cb1d83 → 0.1.0-alpha.f2c85f

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/lib/cli.js +22 -12
  2. package/package.json +1 -1
package/lib/cli.js CHANGED
@@ -148,6 +148,7 @@ function _nullishCoalesce$m(lhs, rhsFn) { if (lhs != null) { return lhs; } else
148
148
 
149
149
 
150
150
 
151
+
151
152
 
152
153
 
153
154
  const GLOBAL_CONFIG_DIR = path__namespace.join(os__namespace.homedir(), '.coze');
@@ -184,6 +185,7 @@ async function readJsonIfExists(file) {
184
185
  * - COZE_SPACE_ID -> spaceId
185
186
  * - COZE_CONFIG_SCOPE -> configScope ('global' | 'local')
186
187
  * - COZE_CONFIG_FILE -> 指定配置文件路径(优先级最高)
188
+ * - COZE_AUTO_CHECK_UPDATE -> autoCheckUpdate ('true' | 'false')
187
189
  */
188
190
  function getEnvConfig() {
189
191
  const envConfig = {};
@@ -205,6 +207,9 @@ function getEnvConfig() {
205
207
  ) {
206
208
  envConfig.configScope = process.env.COZE_CONFIG_SCOPE;
207
209
  }
210
+ if (process.env.COZE_AUTO_CHECK_UPDATE) {
211
+ envConfig.autoCheckUpdate = process.env.COZE_AUTO_CHECK_UPDATE === 'true';
212
+ }
208
213
  return envConfig;
209
214
  }
210
215
 
@@ -405,7 +410,7 @@ async function listConfigs() {
405
410
  }
406
411
 
407
412
  var name = "@coze/cli";
408
- var version = "0.1.0-alpha.cb1d83";
413
+ var version = "0.1.0-alpha.f2c85f";
409
414
  const packageJson = {
410
415
  name: name,
411
416
  version: version};
@@ -526,18 +531,23 @@ async function updateCheckMiddleware(
526
531
  ) {
527
532
  await next();
528
533
 
529
- try {
530
- const result = await checkForUpdates(context);
531
-
532
- if (result.hasUpdate) {
533
- const message =
534
- `\nUpdate available: ${chalk.gray(result.currentVersion)} → ${chalk.green(result.latestVersion)}` +
535
- `\nRun ${chalk.cyan('coze upgrade')} to update\n`;
536
- context.ui.info(message);
534
+ // Check if auto update check is enabled
535
+ if (context.config.autoCheckUpdate === true) {
536
+ try {
537
+ // Check for available updates
538
+ const result = await checkForUpdates(context);
539
+
540
+ // Display update notification if a new version is available
541
+ if (result.hasUpdate) {
542
+ const message =
543
+ `\nUpdate available: ${chalk.gray(result.currentVersion)} → ${chalk.green(result.latestVersion)}` +
544
+ `\nRun ${chalk.cyan('coze upgrade')} to update\n`;
545
+ context.ui.info(message);
546
+ }
547
+ // eslint-disable-next-line @coze-arch/no-empty-catch -- update check failure is non-critical
548
+ } catch (_error) {
549
+ /* noop */
537
550
  }
538
- // eslint-disable-next-line @coze-arch/no-empty-catch -- update check failure is non-critical
539
- } catch (_error) {
540
- /* noop */
541
551
  }
542
552
  }
543
553
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze/cli",
3
- "version": "0.1.0-alpha.cb1d83",
3
+ "version": "0.1.0-alpha.f2c85f",
4
4
  "private": false,
5
5
  "description": "tmp",
6
6
  "license": "MIT",