@yixiaoermail/cli 3.2.3 → 3.2.4

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/bin/install.js CHANGED
@@ -83,7 +83,7 @@ function buildDownloadUrl(baseUrl, archiveName) {
83
83
  return `${baseUrl.replace(/\/+$/, "")}/${archiveName}`;
84
84
  }
85
85
 
86
- function download(url, destPath) {
86
+ function downloadWithCurl(url, destPath, execFile = execFileSync) {
87
87
  assertAllowedHost(url);
88
88
 
89
89
  const args = [
@@ -106,7 +106,48 @@ function download(url, destPath) {
106
106
  }
107
107
 
108
108
  args.push(url);
109
- execFileSync("curl", args, { stdio: ["ignore", "ignore", "pipe"] });
109
+ execFile("curl", args, { stdio: ["ignore", "ignore", "pipe"] });
110
+ }
111
+
112
+ function downloadWithPowerShell(url, destPath, execFile = execFileSync) {
113
+ assertAllowedHost(url);
114
+
115
+ const psCommand =
116
+ "$ProgressPreference='SilentlyContinue';" +
117
+ "$ErrorActionPreference='Stop';" +
118
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;" +
119
+ "Invoke-WebRequest -UseBasicParsing -Uri $env:YXER_URL -OutFile $env:YXER_DEST";
120
+
121
+ execFile(
122
+ "powershell.exe",
123
+ ["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", psCommand],
124
+ {
125
+ stdio: ["ignore", "ignore", "pipe"],
126
+ env: {
127
+ ...process.env,
128
+ YXER_URL: url,
129
+ YXER_DEST: destPath
130
+ }
131
+ }
132
+ );
133
+ }
134
+
135
+ function download(url, destPath, platform = process.platform, execFile = execFileSync) {
136
+ try {
137
+ downloadWithCurl(url, destPath, execFile);
138
+ } catch (error) {
139
+ if (platform !== "win32") {
140
+ throw error;
141
+ }
142
+
143
+ try {
144
+ downloadWithPowerShell(url, destPath, execFile);
145
+ } catch (fallbackError) {
146
+ fallbackError.message =
147
+ `${error.message}; fallback via PowerShell failed: ${fallbackError.message}`;
148
+ throw fallbackError;
149
+ }
150
+ }
110
151
  }
111
152
 
112
153
  function parseChecksums(content) {
@@ -245,6 +286,9 @@ if (require.main === module) {
245
286
  module.exports = {
246
287
  ALLOWED_HOSTS,
247
288
  buildDownloadUrl,
289
+ download,
290
+ downloadWithCurl,
291
+ downloadWithPowerShell,
248
292
  getBinaryPath,
249
293
  getBinDir,
250
294
  getExpectedChecksum,
package/bin/yxer.js CHANGED
@@ -3,7 +3,7 @@
3
3
  const { spawnSync } = require("node:child_process");
4
4
  const fs = require("node:fs");
5
5
  const { ensureExecutable } = require("./ensure-executable");
6
- const { install } = require("./install");
6
+ const { getBinaryPath, install } = require("./install");
7
7
  const { getBinaryFilename, resolveBinaryPath } = require("./resolve-binary");
8
8
 
9
9
  function resolveBinary() {
@@ -25,6 +25,35 @@ function resolveBinary() {
25
25
  process.exit(1);
26
26
  }
27
27
 
28
+ const expectedBinaryPath = getBinaryPath(__dirname, platform, arch);
29
+ const oldBinaryPath = expectedBinaryPath ? `${expectedBinaryPath}.old` : null;
30
+
31
+ if (platform === "win32" && expectedBinaryPath && oldBinaryPath && fs.existsSync(oldBinaryPath)) {
32
+ if (!fs.existsSync(expectedBinaryPath)) {
33
+ try {
34
+ fs.renameSync(oldBinaryPath, expectedBinaryPath);
35
+ } catch (_) {
36
+ // Best-effort recovery before the normal install path runs.
37
+ }
38
+ } else {
39
+ const probe = spawnSync(expectedBinaryPath, ["--version"], { stdio: "ignore" });
40
+ if (probe.status !== 0) {
41
+ try {
42
+ fs.rmSync(expectedBinaryPath, { force: true });
43
+ fs.renameSync(oldBinaryPath, expectedBinaryPath);
44
+ } catch (_) {
45
+ // Fall through to the normal install/error handling path.
46
+ }
47
+ } else {
48
+ try {
49
+ fs.rmSync(oldBinaryPath, { force: true });
50
+ } catch (_) {
51
+ // Best-effort stale file cleanup only.
52
+ }
53
+ }
54
+ }
55
+ }
56
+
28
57
  const binaryPath = resolveBinaryPath(__dirname, platform, arch);
29
58
  if (!binaryPath || !fs.existsSync(binaryPath)) {
30
59
  try {
@@ -37,7 +66,7 @@ function resolveBinary() {
37
66
  message: `Expected packaged binary not found: ${filename}`,
38
67
  category: "environment",
39
68
  hint: `Automatic install failed: ${error.message}`,
40
- nextCommand: "npm install -g @yixiaoermail/cli@latest",
69
+ nextCommand: "yxer update",
41
70
  retryable: true
42
71
  }
43
72
  })
package/checksums.txt CHANGED
@@ -1,6 +1,6 @@
1
- d093279058cbaaa12204c7190eeee44dea4dc4dfb31103fb285239393d2e1d55 yxer-cli-3.2.3-windows-amd64.zip
2
- df43afb1f0ce4119c1dbcaca16c246348e315e99f0cb465667a9b5be4856de46 yxer-cli-3.2.3-windows-arm64.zip
3
- c0baa31977fba50c0d214682f6c720954636af4af2efa79d83d5bc264492833d yxer-cli-3.2.3-darwin-amd64.tar.gz
4
- 6155c47c35ea99e8b3f59c14738fd0ce43a6bfe762f46e9c80b9b271dc7a9d7a yxer-cli-3.2.3-darwin-arm64.tar.gz
5
- 2d3d4dbfc6f5dae542b215faa0189d587976cfebcce962392bee84e70d758bf9 yxer-cli-3.2.3-linux-amd64.tar.gz
6
- 0b3ae9c4343ce43c9e9c66b761a2e041f8de0d68b0fdde2e6d6019f74c093c80 yxer-cli-3.2.3-linux-arm64.tar.gz
1
+ d73fbfbaf9285f6ccd631b7eb170ea88fcac342d7790ef119b49e93e70244805 yxer-cli-3.2.4-windows-amd64.zip
2
+ 68fec9fbf0bbb8ad996096eabfb2bdcb2802c42a0d9e256933e6036d6785a486 yxer-cli-3.2.4-windows-arm64.zip
3
+ 188a6a06a524a0118735b5cb07b2e9b62194d44043653eaa51efa0d001717a2c yxer-cli-3.2.4-darwin-amd64.tar.gz
4
+ e8510840ddf5afedd56b138c287b4f2c9e8123458ec751604e5a1db32af079c7 yxer-cli-3.2.4-darwin-arm64.tar.gz
5
+ 5c2144d2aab6fe98f1926705de5149ceddb5c759b1593d1f979b2fbfdccbddf4 yxer-cli-3.2.4-linux-amd64.tar.gz
6
+ f3dee29caf030c53652e26f81912bba2af3f884b4a886ccfe8653e9448660f8a yxer-cli-3.2.4-linux-arm64.tar.gz
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yixiaoermail/cli",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "description": "Yixiaoer CLI packaged for npm global installation",
5
5
  "bin": {
6
6
  "yxer": "bin/yxer.js"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: yixiaoer
3
- version: 3.2.3
3
+ version: 3.2.4
4
4
  description: "通过 yxer CLI 操作蚁小二多平台内容分发:账号查询、资源上传、发布前准备、payload 校验、云发布/本机发布、草稿保存、素材登记、发布记录排查与技能同步。"
5
5
  metadata:
6
6
  category: "productivity"
@@ -211,8 +211,8 @@ yxer publish video 抖音 .\payload.json --publish-channel local --client-id <cl
211
211
  - 成功输出格式:`ok/action/version/data`
212
212
  - 失败输出格式:`ok/version/error`
213
213
  - 错误通过统一错误 envelope 输出
214
- - `yxer doctor` 可能返回 `_notice.skills`,提示当前 AI skill 与 CLI 版本不同步
215
- - `yxer update` 当前会同步 AI skill,并给出 CLI 本体更新指引
214
+ - `yxer doctor` 可能返回 `_notice.skills`,提示当前 AI skill 与 CLI 版本不同步,并建议优先执行 `yxer update`
215
+ - `yxer update` 是当前推荐的统一入口:会检查 CLI 安装方式、在 npm 安装场景下升级 CLI,并同步 AI skill
216
216
 
217
217
  ## 入口约束
218
218
 
@@ -10,7 +10,7 @@
10
10
  npm install -g @yixiaoermail/cli
11
11
  yxer --version
12
12
  yxer config init --api-key <apiKey>
13
- yxer skill sync
13
+ yxer update
14
14
  yxer doctor
15
15
  ```
16
16
 
@@ -18,7 +18,7 @@ yxer doctor
18
18
 
19
19
  ```bash
20
20
  npm install -g @yixiaoermail/cli@latest
21
- yxer skill sync --global
21
+ yxer update --global
22
22
  yxer config init --api-key <apiKey>
23
23
  yxer doctor
24
24
  ```
@@ -26,9 +26,7 @@ yxer doctor
26
26
  ## 升级流程
27
27
 
28
28
  ```bash
29
- npm install -g @yixiaoermail/cli
30
- yxer --version
31
- yxer skill sync
29
+ yxer update
32
30
  yxer doctor
33
31
  ```
34
32
 
@@ -57,9 +55,9 @@ yxer skill show
57
55
  ## 规则
58
56
 
59
57
  - 安装 CLI 时优先使用 `npm install -g @yixiaoermail/cli`
60
- - CLI 安装后优先使用 `yxer skill sync`,让本地随包 skill 直接同步到宿主
58
+ - CLI 安装后优先使用 `yxer update`,让 CLI 升级检查与本地随包 skill 同步走同一条路径
61
59
  - `yxer --version` 升级后,应提示重新同步 skill
62
60
  - `SKILL.md` 或 `references/` 中影响 Agent 行为的文档更新后,应提示重新同步
63
- - `yxer doctor` 返回 `_notice.skills` 时,优先执行 `yxer skill sync`
61
+ - `yxer doctor` 返回 `_notice.skills` 时,优先执行 `yxer update`
64
62
  - 用户明确说“只想同步 skill / 看安装方法”时,完成本域说明后直接停下
65
63
  - 不要引导普通用户从源码构建或手动放置 `yxer.exe`;源码构建只用于研发、测试或 npm 成品包制作
@@ -50,8 +50,8 @@ yxer config set-local-client-id <clientId>
50
50
 
51
51
  ```bash
52
52
  yxer skill show
53
- yxer skill sync
54
- yxer skill sync --global
53
+ yxer update
54
+ yxer update --global
55
55
  ```
56
56
 
57
57
  以下情况应提示重新同步: