@yixiaoermail/cli 3.2.2 → 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.
Files changed (114) hide show
  1. package/README.md +19 -1
  2. package/bin/install.js +300 -0
  3. package/bin/postinstall.js +4 -8
  4. package/bin/resolve-binary.js +5 -19
  5. package/bin/yxer.js +47 -12
  6. package/checksums.txt +6 -0
  7. package/package.json +29 -28
  8. package/references/cli/command-design.md +305 -305
  9. package/references/cli/command-reference.md +35 -35
  10. package/references/legacy/capabilities.md +13 -13
  11. package/references/workflows/payload-sourcing.md +17 -17
  12. package/references/workflows/publish-troubleshooting.md +10 -10
  13. package/schemas/platforms/acfun.article.schema.json +117 -117
  14. package/schemas/platforms/acfun.video.schema.json +139 -139
  15. package/schemas/platforms/aiqiyi.article.schema.json +29 -29
  16. package/schemas/platforms/aiqiyi.video.schema.json +154 -154
  17. package/schemas/platforms/baijiahao.article.schema.json +160 -160
  18. package/schemas/platforms/baijiahao.imageText.schema.json +111 -111
  19. package/schemas/platforms/baijiahao.video.schema.json +180 -180
  20. package/schemas/platforms/bilibili.article.schema.json +109 -109
  21. package/schemas/platforms/bilibili.video.schema.json +175 -175
  22. package/schemas/platforms/chejiahao.article.schema.json +108 -108
  23. package/schemas/platforms/chejiahao.video.schema.json +111 -111
  24. package/schemas/platforms/csdn.article.schema.json +106 -106
  25. package/schemas/platforms/dayuhao.article.schema.json +106 -106
  26. package/schemas/platforms/dayuhao.video.schema.json +153 -153
  27. package/schemas/platforms/dewu.video.schema.json +134 -134
  28. package/schemas/platforms/douban.article.schema.json +48 -48
  29. package/schemas/platforms/douyin.article.schema.json +318 -318
  30. package/schemas/platforms/douyin.imageText.schema.json +287 -287
  31. package/schemas/platforms/douyin.video.schema.json +852 -852
  32. package/schemas/platforms/duoduoshipin.video.schema.json +108 -108
  33. package/schemas/platforms/facebook.video.schema.json +28 -28
  34. package/schemas/platforms/fengwang.video.schema.json +135 -135
  35. package/schemas/platforms/instagram.video.schema.json +28 -28
  36. package/schemas/platforms/jianshu.article.schema.json +33 -33
  37. package/schemas/platforms/kuaichuanhao.article.schema.json +83 -83
  38. package/schemas/platforms/kuaishou.imageText.schema.json +171 -171
  39. package/schemas/platforms/kuaishou.video.schema.json +243 -243
  40. package/schemas/platforms/meipai.video.schema.json +123 -123
  41. package/schemas/platforms/meiyou.video.schema.json +96 -96
  42. package/schemas/platforms/pipixia.video.schema.json +94 -94
  43. package/schemas/platforms/qiehao.article.schema.json +89 -89
  44. package/schemas/platforms/qiehao.video.schema.json +147 -147
  45. package/schemas/platforms/shipinhao.imageText.schema.json +139 -139
  46. package/schemas/platforms/shipinhao.video.schema.json +237 -237
  47. package/schemas/platforms/souhuhao.article.schema.json +73 -73
  48. package/schemas/platforms/souhuhao.video.schema.json +171 -171
  49. package/schemas/platforms/souhushipin.video.schema.json +115 -115
  50. package/schemas/platforms/tengxunshipin.video.schema.json +114 -114
  51. package/schemas/platforms/tiktok.video.schema.json +72 -72
  52. package/schemas/platforms/toutiaohao.article.schema.json +166 -166
  53. package/schemas/platforms/toutiaohao.imageText.schema.json +83 -83
  54. package/schemas/platforms/toutiaohao.video.schema.json +134 -134
  55. package/schemas/platforms/wangyihao.article.schema.json +85 -85
  56. package/schemas/platforms/wangyihao.video.schema.json +151 -151
  57. package/schemas/platforms/weishi.video.schema.json +101 -101
  58. package/schemas/platforms/weixin.account.article.schema.json +148 -148
  59. package/schemas/platforms/xhs.imageText.schema.json +131 -131
  60. package/schemas/platforms/xiaohongshu.video.schema.json +225 -225
  61. package/schemas/platforms/xiaohongshushop.video.schema.json +142 -142
  62. package/schemas/platforms/xinlang.article.schema.json +69 -69
  63. package/schemas/platforms/xinlang.imageText.schema.json +86 -86
  64. package/schemas/platforms/xinlang.video.schema.json +152 -152
  65. package/schemas/platforms/xueqiuhao.article.schema.json +84 -84
  66. package/schemas/platforms/yichehao.article.schema.json +140 -140
  67. package/schemas/platforms/yichehao.video.schema.json +101 -101
  68. package/schemas/platforms/yidianhao.article.schema.json +77 -77
  69. package/schemas/platforms/yidianhao.video.schema.json +152 -152
  70. package/schemas/platforms/youtube.video.schema.json +92 -92
  71. package/schemas/platforms/zhihu.article.schema.json +104 -104
  72. package/schemas/platforms/zhihu.imageText.schema.json +61 -61
  73. package/schemas/platforms/zhihu.video.schema.json +144 -144
  74. package/skills/yixiaoer/QUICKSTART.md +4 -4
  75. package/skills/yixiaoer/SKILL.md +1 -1
  76. package/skills/yixiaoer/references/cli/command-reference.md +32 -32
  77. package/skills/yixiaoer/references/create-account-group.md +27 -27
  78. package/skills/yixiaoer/references/delete-account-group.md +20 -20
  79. package/skills/yixiaoer/references/domains/accounts-and-env.md +17 -17
  80. package/skills/yixiaoer/references/domains/install-and-sync.md +42 -16
  81. package/skills/yixiaoer/references/domains/publish.md +11 -11
  82. package/skills/yixiaoer/references/execution-standard.md +18 -18
  83. package/skills/yixiaoer/references/get-account-groups.md +14 -14
  84. package/skills/yixiaoer/references/get-members.md +28 -28
  85. package/skills/yixiaoer/references/go-live-process.md +11 -19
  86. package/skills/yixiaoer/references/keyword-reference.md +4 -4
  87. package/skills/yixiaoer/references/material-resource.md +8 -8
  88. package/skills/yixiaoer/references/platforms/article/toutiaohao.md +28 -28
  89. package/skills/yixiaoer/references/platforms/video/facebook.md +37 -37
  90. package/skills/yixiaoer/references/platforms/video/index.md +7 -7
  91. package/skills/yixiaoer/references/platforms/video/instagram.md +40 -40
  92. package/skills/yixiaoer/references/platforms/video/tiktok.md +50 -50
  93. package/skills/yixiaoer/references/platforms/video/youtube.md +53 -53
  94. package/skills/yixiaoer/references/proxy-management.md +9 -9
  95. package/skills/yixiaoer/references/topic-tags.md +31 -31
  96. package/skills/yixiaoer/references/troubleshooting-guide.md +2 -2
  97. package/skills/yixiaoer/references/update-account-group.md +28 -28
  98. package/skills/yixiaoer/references/upload-resource.md +6 -6
  99. package/skills/yixiaoer/references/usage-workflow.md +3 -5
  100. package/skills/yixiaoer/references/workflows/common-rules.md +29 -29
  101. package/skills/yixiaoer/references/workflows/data-accuracy.md +83 -83
  102. package/skills/yixiaoer/references/workflows/payload-sourcing.md +24 -24
  103. package/skills/yixiaoer/references/workflows/publish-troubleshooting.md +10 -10
  104. package/skills/yixiaoer/references/yixiaoer-shared.md +2 -2
  105. package/dist/yxer-darwin-amd64 +0 -0
  106. package/dist/yxer-darwin-arm64 +0 -0
  107. package/dist/yxer-linux-amd64 +0 -0
  108. package/dist/yxer-linux-arm64 +0 -0
  109. package/dist/yxer-windows-amd64.exe +0 -0
  110. package/dist/yxer-windows-arm64.exe +0 -0
  111. package/references/cli/skill-install.md +0 -76
  112. package/skills/yixiaoer/plugin.json +0 -21
  113. package/skills/yixiaoer/references/cli/skill-install.md +0 -65
  114. package/skills/yixiaoer/references/cli-install-uninstall.md +0 -196
package/README.md CHANGED
@@ -5,9 +5,11 @@ Packaged `yxer` CLI for global npm installation.
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install -g @yixiaoer/cli
8
+ npm install -g @yixiaoermail/cli
9
9
  ```
10
10
 
11
+ The npm package installs a lightweight launcher. During install or first run it downloads the matching platform binary from the release assets.
12
+
11
13
  ## Verify
12
14
 
13
15
  ```bash
@@ -23,3 +25,19 @@ yxer skill sync
23
25
  ```
24
26
 
25
27
  Use `yxer skill sync --global` if your host expects a global skill install.
28
+
29
+ ## Release Packaging
30
+
31
+ This package expects release assets named like:
32
+
33
+ ```text
34
+ yxer-cli-3.2.2-windows-amd64.zip
35
+ yxer-cli-3.2.2-windows-arm64.zip
36
+ yxer-cli-3.2.2-darwin-amd64.tar.gz
37
+ yxer-cli-3.2.2-darwin-arm64.tar.gz
38
+ yxer-cli-3.2.2-linux-amd64.tar.gz
39
+ yxer-cli-3.2.2-linux-arm64.tar.gz
40
+ checksums.txt
41
+ ```
42
+
43
+ If you mirror the download host, set `YXER_DOWNLOAD_BASE_URL` before installation.
package/bin/install.js ADDED
@@ -0,0 +1,300 @@
1
+ #!/usr/bin/env node
2
+
3
+ const crypto = require("node:crypto");
4
+ const fs = require("node:fs");
5
+ const os = require("node:os");
6
+ const path = require("node:path");
7
+ const { execFileSync } = require("node:child_process");
8
+ const { ensureExecutable } = require("./ensure-executable");
9
+
10
+ const PACKAGE_NAME = "yxer";
11
+ const ARCHIVE_PREFIX = "yxer-cli";
12
+ const VERSION = require("../package.json").version.replace(/-.*$/, "");
13
+ const DEFAULT_REPO = "yixiaoer888/yixiaoer-skill";
14
+ const DEFAULT_BASE_URL = `https://github.com/${DEFAULT_REPO}/releases/download/v${VERSION}`;
15
+ const ALLOWED_HOSTS = new Set([
16
+ "github.com",
17
+ "objects.githubusercontent.com",
18
+ "release-assets.githubusercontent.com",
19
+ "registry.npmmirror.com"
20
+ ]);
21
+
22
+ const PLATFORM_MAP = {
23
+ darwin: "darwin",
24
+ linux: "linux",
25
+ win32: "windows"
26
+ };
27
+
28
+ const ARCH_MAP = {
29
+ x64: "amd64",
30
+ arm64: "arm64"
31
+ };
32
+
33
+ function getTarget(platform = process.platform, arch = process.arch) {
34
+ const mappedPlatform = PLATFORM_MAP[platform];
35
+ const mappedArch = ARCH_MAP[arch];
36
+ if (!mappedPlatform || !mappedArch) {
37
+ return null;
38
+ }
39
+
40
+ const ext = platform === "win32" ? "zip" : "tar.gz";
41
+ const binaryExt = platform === "win32" ? ".exe" : "";
42
+ const baseName = `${ARCHIVE_PREFIX}-${VERSION}-${mappedPlatform}-${mappedArch}`;
43
+
44
+ return {
45
+ platform,
46
+ arch,
47
+ mappedPlatform,
48
+ mappedArch,
49
+ archiveName: `${baseName}.${ext}`,
50
+ binaryName: `${PACKAGE_NAME}${binaryExt}`
51
+ };
52
+ }
53
+
54
+ function isSupportedPlatform(platform = process.platform, arch = process.arch) {
55
+ return getTarget(platform, arch) !== null;
56
+ }
57
+
58
+ function getBinDir(baseDir = __dirname) {
59
+ return path.join(baseDir, "..", "bin-native");
60
+ }
61
+
62
+ function getChecksumsPath(baseDir = __dirname) {
63
+ return path.join(baseDir, "..", "checksums.txt");
64
+ }
65
+
66
+ function getBinaryPath(baseDir = __dirname, platform = process.platform, arch = process.arch) {
67
+ const target = getTarget(platform, arch);
68
+ if (!target) {
69
+ return null;
70
+ }
71
+
72
+ return path.join(getBinDir(baseDir), target.binaryName);
73
+ }
74
+
75
+ function assertAllowedHost(url) {
76
+ const hostname = new URL(url).hostname;
77
+ if (!ALLOWED_HOSTS.has(hostname)) {
78
+ throw new Error(`Download host not allowed: ${hostname}`);
79
+ }
80
+ }
81
+
82
+ function buildDownloadUrl(baseUrl, archiveName) {
83
+ return `${baseUrl.replace(/\/+$/, "")}/${archiveName}`;
84
+ }
85
+
86
+ function downloadWithCurl(url, destPath, execFile = execFileSync) {
87
+ assertAllowedHost(url);
88
+
89
+ const args = [
90
+ "--fail",
91
+ "--location",
92
+ "--silent",
93
+ "--show-error",
94
+ "--connect-timeout",
95
+ "10",
96
+ "--max-time",
97
+ "120",
98
+ "--max-redirs",
99
+ "3",
100
+ "--output",
101
+ destPath
102
+ ];
103
+
104
+ if (process.platform === "win32") {
105
+ args.unshift("--ssl-revoke-best-effort");
106
+ }
107
+
108
+ args.push(url);
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
+ }
151
+ }
152
+
153
+ function parseChecksums(content) {
154
+ const result = new Map();
155
+ for (const line of content.split(/\r?\n/)) {
156
+ const trimmed = line.trim();
157
+ if (!trimmed) {
158
+ continue;
159
+ }
160
+
161
+ const separator = trimmed.indexOf(" ");
162
+ if (separator === -1) {
163
+ continue;
164
+ }
165
+
166
+ result.set(trimmed.slice(separator + 2), trimmed.slice(0, separator));
167
+ }
168
+
169
+ return result;
170
+ }
171
+
172
+ function getExpectedChecksum(archiveName, checksumsPath = getChecksumsPath()) {
173
+ if (!fs.existsSync(checksumsPath)) {
174
+ return null;
175
+ }
176
+
177
+ const checksums = parseChecksums(fs.readFileSync(checksumsPath, "utf8"));
178
+ return checksums.get(archiveName) || null;
179
+ }
180
+
181
+ function verifyChecksum(archivePath, expectedHash) {
182
+ if (!expectedHash) {
183
+ return;
184
+ }
185
+
186
+ const hash = crypto.createHash("sha256");
187
+ const fd = fs.openSync(archivePath, "r");
188
+
189
+ try {
190
+ const buffer = Buffer.alloc(64 * 1024);
191
+ let bytesRead = 0;
192
+ while ((bytesRead = fs.readSync(fd, buffer, 0, buffer.length, null)) > 0) {
193
+ hash.update(buffer.subarray(0, bytesRead));
194
+ }
195
+ } finally {
196
+ fs.closeSync(fd);
197
+ }
198
+
199
+ const actualHash = hash.digest("hex");
200
+ if (actualHash.toLowerCase() !== expectedHash.toLowerCase()) {
201
+ throw new Error(
202
+ `Checksum mismatch for ${path.basename(archivePath)}: expected ${expectedHash} but got ${actualHash}`
203
+ );
204
+ }
205
+ }
206
+
207
+ function extractArchive(archivePath, destDir) {
208
+ if (process.platform === "win32") {
209
+ const psCommand =
210
+ "$ErrorActionPreference='Stop';" +
211
+ "Expand-Archive -LiteralPath $env:YXER_ARCHIVE -DestinationPath $env:YXER_DEST -Force";
212
+ execFileSync(
213
+ "powershell.exe",
214
+ ["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", psCommand],
215
+ {
216
+ stdio: ["ignore", "inherit", "inherit"],
217
+ env: {
218
+ ...process.env,
219
+ YXER_ARCHIVE: archivePath,
220
+ YXER_DEST: destDir
221
+ }
222
+ }
223
+ );
224
+ return;
225
+ }
226
+
227
+ execFileSync("tar", ["-xzf", archivePath, "-C", destDir], { stdio: "ignore" });
228
+ }
229
+
230
+ function resolveBaseUrl() {
231
+ const customUrl = (process.env.YXER_DOWNLOAD_BASE_URL || "").trim();
232
+ if (!customUrl) {
233
+ return DEFAULT_BASE_URL;
234
+ }
235
+
236
+ ALLOWED_HOSTS.add(new URL(customUrl).hostname);
237
+ return customUrl;
238
+ }
239
+
240
+ function install(baseDir = __dirname) {
241
+ const target = getTarget();
242
+ if (!target) {
243
+ throw new Error(`Unsupported platform: ${process.platform}/${process.arch}`);
244
+ }
245
+
246
+ const binDir = getBinDir(baseDir);
247
+ const binaryPath = path.join(binDir, target.binaryName);
248
+ fs.mkdirSync(binDir, { recursive: true });
249
+
250
+ if (fs.existsSync(binaryPath)) {
251
+ ensureExecutable(binaryPath);
252
+ return binaryPath;
253
+ }
254
+
255
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "yxer-install-"));
256
+ const archivePath = path.join(tmpDir, target.archiveName);
257
+
258
+ try {
259
+ const downloadUrl = buildDownloadUrl(resolveBaseUrl(), target.archiveName);
260
+ download(downloadUrl, archivePath);
261
+ verifyChecksum(archivePath, getExpectedChecksum(target.archiveName, getChecksumsPath(baseDir)));
262
+ extractArchive(archivePath, tmpDir);
263
+
264
+ const extractedBinary = path.join(tmpDir, target.binaryName);
265
+ if (!fs.existsSync(extractedBinary)) {
266
+ throw new Error(`Extracted binary not found: ${target.binaryName}`);
267
+ }
268
+
269
+ fs.copyFileSync(extractedBinary, binaryPath);
270
+ ensureExecutable(binaryPath);
271
+ return binaryPath;
272
+ } finally {
273
+ fs.rmSync(tmpDir, { recursive: true, force: true });
274
+ }
275
+ }
276
+
277
+ if (require.main === module) {
278
+ try {
279
+ install();
280
+ } catch (error) {
281
+ console.error(`Failed to install yxer: ${error.message}`);
282
+ process.exit(1);
283
+ }
284
+ }
285
+
286
+ module.exports = {
287
+ ALLOWED_HOSTS,
288
+ buildDownloadUrl,
289
+ download,
290
+ downloadWithCurl,
291
+ downloadWithPowerShell,
292
+ getBinaryPath,
293
+ getBinDir,
294
+ getExpectedChecksum,
295
+ getTarget,
296
+ install,
297
+ isSupportedPlatform,
298
+ parseChecksums,
299
+ verifyChecksum
300
+ };
@@ -1,18 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { ensureExecutable } = require("./ensure-executable");
4
- const { resolveBinaryPath } = require("./resolve-binary");
3
+ const { install, isSupportedPlatform } = require("./install");
5
4
 
6
5
  try {
7
- const binaryPath = resolveBinaryPath(__dirname, process.platform, process.arch);
8
- if (!binaryPath) {
6
+ if (!isSupportedPlatform(process.platform, process.arch)) {
9
7
  process.exit(0);
10
8
  }
11
9
 
12
- ensureExecutable(binaryPath);
10
+ install();
13
11
  } catch (error) {
14
- console.error(
15
- `[yxer] postinstall failed to ensure executable permission: ${error.message}`
16
- );
12
+ console.error(`[yxer] postinstall failed: ${error.message}`);
17
13
  process.exit(0);
18
14
  }
@@ -1,29 +1,15 @@
1
1
  const fs = require("node:fs");
2
2
  const os = require("node:os");
3
- const path = require("node:path");
3
+ const { getBinaryPath, getTarget } = require("./install");
4
4
 
5
5
  function getBinaryFilename(platform = os.platform(), arch = os.arch()) {
6
- const key = `${platform}/${arch}`;
7
- const binaries = {
8
- "win32/x64": "yxer-windows-amd64.exe",
9
- "win32/arm64": "yxer-windows-arm64.exe",
10
- "darwin/x64": "yxer-darwin-amd64",
11
- "darwin/arm64": "yxer-darwin-arm64",
12
- "linux/x64": "yxer-linux-amd64",
13
- "linux/arm64": "yxer-linux-arm64"
14
- };
15
-
16
- return binaries[key] || null;
6
+ const target = getTarget(platform, arch);
7
+ return target ? target.binaryName : null;
17
8
  }
18
9
 
19
10
  function resolveBinaryPath(baseDir = __dirname, platform = os.platform(), arch = os.arch()) {
20
- const filename = getBinaryFilename(platform, arch);
21
- if (!filename) {
22
- return null;
23
- }
24
-
25
- const binaryPath = path.join(baseDir, "..", "dist", filename);
26
- if (!fs.existsSync(binaryPath)) {
11
+ const binaryPath = getBinaryPath(baseDir, platform, arch);
12
+ if (!binaryPath || !fs.existsSync(binaryPath)) {
27
13
  return null;
28
14
  }
29
15
 
package/bin/yxer.js CHANGED
@@ -3,6 +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 { getBinaryPath, install } = require("./install");
6
7
  const { getBinaryFilename, resolveBinaryPath } = require("./resolve-binary");
7
8
 
8
9
  function resolveBinary() {
@@ -24,20 +25,54 @@ function resolveBinary() {
24
25
  process.exit(1);
25
26
  }
26
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
+
27
57
  const binaryPath = resolveBinaryPath(__dirname, platform, arch);
28
58
  if (!binaryPath || !fs.existsSync(binaryPath)) {
29
- console.error(
30
- JSON.stringify({
31
- error: {
32
- code: "missing_binary",
33
- message: `Expected packaged binary not found: ${filename}`,
34
- category: "environment",
35
- hint: "Reinstall the npm package or rebuild the release artifact.",
36
- retryable: false
37
- }
38
- })
39
- );
40
- process.exit(1);
59
+ try {
60
+ return install(__dirname);
61
+ } catch (error) {
62
+ console.error(
63
+ JSON.stringify({
64
+ error: {
65
+ code: "missing_binary",
66
+ message: `Expected packaged binary not found: ${filename}`,
67
+ category: "environment",
68
+ hint: `Automatic install failed: ${error.message}`,
69
+ nextCommand: "yxer update",
70
+ retryable: true
71
+ }
72
+ })
73
+ );
74
+ process.exit(1);
75
+ }
41
76
  }
42
77
 
43
78
  return binaryPath;
package/checksums.txt ADDED
@@ -0,0 +1,6 @@
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,29 +1,30 @@
1
- {
2
- "name": "@yixiaoermail/cli",
3
- "version": "3.2.2",
4
- "description": "Yixiaoer CLI packaged for npm global installation",
5
- "bin": {
6
- "yxer": "bin/yxer.js"
7
- },
8
- "scripts": {
9
- "postinstall": "node bin/postinstall.js",
10
- "test": "node --test ../test/npm/*.test.js"
11
- },
12
- "files": [
13
- "bin",
14
- "dist",
15
- "references",
16
- "schemas",
17
- "skills",
18
- "README.md"
19
- ],
20
- "keywords": [
21
- "yixiaoer",
22
- "yxer",
23
- "cli"
24
- ],
25
- "license": "UNLICENSED",
26
- "engines": {
27
- "node": "\u003e=18"
28
- }
1
+ {
2
+ "name": "@yixiaoermail/cli",
3
+ "version": "3.2.4",
4
+ "description": "Yixiaoer CLI packaged for npm global installation",
5
+ "bin": {
6
+ "yxer": "bin/yxer.js"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node bin/postinstall.js",
10
+ "test": "node --test ../test/npm/*.test.js"
11
+ },
12
+ "files": [
13
+ "bin",
14
+ "bin-native",
15
+ "checksums.txt",
16
+ "references",
17
+ "schemas",
18
+ "skills",
19
+ "README.md"
20
+ ],
21
+ "keywords": [
22
+ "yixiaoer",
23
+ "yxer",
24
+ "cli"
25
+ ],
26
+ "license": "UNLICENSED",
27
+ "engines": {
28
+ "node": ">=18"
29
+ }
29
30
  }