@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.
- package/lib/cli.js +22 -12
- 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.
|
|
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
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
const
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
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
|
|