@coze/cli 0.3.1 → 0.3.2-alpha.77ac1a

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/README.md CHANGED
@@ -8,7 +8,17 @@ Coze CLI — A command-line tool for interacting with [Coze](https://www.coze.cn
8
8
  npm install -g @coze/cli
9
9
  ```
10
10
 
11
- After installation the CLI silently runs `coze self skill install`, which installs the bundled skills to your local AI agents (Claude Code, Trae, Comate, ...). If that step is skipped or fails, run it manually:
11
+ After installation the CLI silently runs `coze self skill install`, which installs the bundled skills to your local AI agents (Claude Code, Trae, Comate, ...). On a first install this sync can take up to a minute (it detects every AI agent on your machine and copies/links the skills), so the install may appear to pause near the end — this is expected.
12
+
13
+ > npm 7+ hides lifecycle-script output by default, so you won't see the sync progress. To watch it, install with `--foreground-scripts`:
14
+ >
15
+ > ```bash
16
+ > npm install -g @coze/cli --foreground-scripts
17
+ > ```
18
+ >
19
+ > (pnpm and yarn classic show the progress without any extra flag.)
20
+
21
+ If that step is skipped or fails, run it manually:
12
22
 
13
23
  ```bash
14
24
  coze self skill install
@@ -809,6 +819,23 @@ coze upgrade --tag beta
809
819
  | `--force` | Force upgrade even if already on the latest version |
810
820
  | `--tag <tag>` | Specify the dist-tag to upgrade to (default: `latest`) |
811
821
 
822
+ #### Auto-Upgrade
823
+
824
+ By default Coze CLI keeps itself up to date: it checks for new versions in the background (throttled, never blocking the current command) and, in `auto` mode, installs the update silently so it takes effect on your **next run**. Behavior is controlled via `coze config set`:
825
+
826
+ | Config | Values | Default | Description |
827
+ | ----------------- | ------------------------------- | -------- | --------------------------------------------------------------------------------------------------- |
828
+ | `upgrade.mode` | `auto` / `notify` / `off` | `auto` | `auto`: silent background upgrade; `notify`: only prompt to run `coze upgrade`; `off`: disable checks |
829
+ | `upgrade.channel` | `latest` / `beta` / `alpha` / … | `latest` | npm dist-tag to track |
830
+
831
+ ```bash
832
+ coze config set upgrade.mode notify # only prompt, don't auto-install
833
+ coze config set upgrade.mode off # disable upgrade checks entirely
834
+ coze config set upgrade.channel beta # track the beta channel
835
+ ```
836
+
837
+ Upgrade checks are automatically skipped in CI (the `CI` env var is set), for dev/local builds, and when `COZE_CLI_NO_UPDATE_NOTIFIER` is set. Version checks are throttled to at most once every **4 hours**; a failed background upgrade is retried at most once every **10 minutes**. In JSON output the hint is attached as `_notice.update` with a ready-to-run `command` field. See [`docs/design/auto-upgrade-and-skill-sync.md`](docs/design/auto-upgrade-and-skill-sync.md) for the full auto-upgrade and bundled-skill design.
838
+
812
839
  ### Other Commands
813
840
 
814
841
  | Command | Description |
@@ -855,7 +882,9 @@ The CLI reads configuration from multiple sources with the following priority (h
855
882
  | `COZE_PROJECT_ID` | Default Project ID (used by `message` commands) |
856
883
  | `COZE_CONFIG_FILE` | Custom configuration file path |
857
884
  | `COZE_CONFIG_SCOPE` | Config write scope: `global` or `local` |
858
- | `COZE_AUTO_CHECK_UPDATE` | Enable/disable auto update check: `true` or `false` |
885
+ | `COZE_CLI_NO_UPDATE_NOTIFIER` | Set to any non-empty value to skip the upgrade check for this run (overrides `upgrade.mode`) |
886
+ | `COZE_CLI_NO_SKILL_NOTIFIER` | Set to any non-empty value to suppress the bundled-skill version-mismatch notice |
887
+ | `CI` | When set (to any value other than `false`/`0`), auto-skips upgrade checks and skill notices |
859
888
 
860
889
  ## Exit Codes
861
890
 
@@ -18,7 +18,7 @@ try {
18
18
  const { spawnSync } = require('child_process');
19
19
 
20
20
  // CI 环境不执行同步(不可控环境不写家目录)
21
- // 开发仓库内的安装(rush update / pnpm install)也跳过:发布包不含 src/
21
+ // 开发仓库内的依赖更新(rush update / pnpm add 等)也跳过:发布包不含 src/
22
22
  if (process.env.CI || existsSync(join(__dirname, '..', 'src'))) {
23
23
  process.exit(0);
24
24
  }
@@ -26,8 +26,16 @@ try {
26
26
  const useColor = !process.env.NO_COLOR;
27
27
  const cyan = text => (useColor ? `[36m${text}[0m` : text);
28
28
 
29
+ // 同步前先给一行"正在进行、请稍候"的预期文案:扇出会探测本机所有 AI agent 并
30
+ // 拷贝/软链 skill,首次安装可能耗时近 1 分钟。注意 npm >= 7 默认丢弃 postinstall
31
+ // 输出(需 --foreground-scripts 才可见),故此提示主要服务 pnpm / yarn / 旧版 npm。
32
+ process.stdout.write(
33
+ `\n${cyan('Coze CLI')}: syncing bundled skills to your AI agents ` +
34
+ '(first install can take up to a minute)...\n',
35
+ );
36
+
29
37
  // 通过包内 CLI 入口走真实的 `coze self skill install` 代码路径(skipAuth,纯本地:
30
- // 释放 bundled skills ~/.coze/cli/skills 并软链到已安装的 AI agents)。
38
+ // 委托 skills 工具把 bundled skills 拷入中心池 ~/.agents/skills 并软链到已安装的 AI agents)。
31
39
  // 用户改过的 skill 不会被覆盖(sync 默认不带 --force 即阻止)。
32
40
  const result = spawnSync(
33
41
  process.execPath,