@yixiaoermail/cli 3.2.2 → 3.2.3
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 +19 -1
- package/bin/install.js +256 -0
- package/bin/postinstall.js +4 -8
- package/bin/resolve-binary.js +5 -19
- package/bin/yxer.js +18 -12
- package/checksums.txt +6 -0
- package/package.json +29 -28
- package/references/cli/command-design.md +305 -305
- package/references/cli/command-reference.md +35 -35
- package/references/legacy/capabilities.md +13 -13
- package/references/workflows/payload-sourcing.md +17 -17
- package/references/workflows/publish-troubleshooting.md +10 -10
- package/schemas/platforms/acfun.article.schema.json +117 -117
- package/schemas/platforms/acfun.video.schema.json +139 -139
- package/schemas/platforms/aiqiyi.article.schema.json +29 -29
- package/schemas/platforms/aiqiyi.video.schema.json +154 -154
- package/schemas/platforms/baijiahao.article.schema.json +160 -160
- package/schemas/platforms/baijiahao.imageText.schema.json +111 -111
- package/schemas/platforms/baijiahao.video.schema.json +180 -180
- package/schemas/platforms/bilibili.article.schema.json +109 -109
- package/schemas/platforms/bilibili.video.schema.json +175 -175
- package/schemas/platforms/chejiahao.article.schema.json +108 -108
- package/schemas/platforms/chejiahao.video.schema.json +111 -111
- package/schemas/platforms/csdn.article.schema.json +106 -106
- package/schemas/platforms/dayuhao.article.schema.json +106 -106
- package/schemas/platforms/dayuhao.video.schema.json +153 -153
- package/schemas/platforms/dewu.video.schema.json +134 -134
- package/schemas/platforms/douban.article.schema.json +48 -48
- package/schemas/platforms/douyin.article.schema.json +318 -318
- package/schemas/platforms/douyin.imageText.schema.json +287 -287
- package/schemas/platforms/douyin.video.schema.json +852 -852
- package/schemas/platforms/duoduoshipin.video.schema.json +108 -108
- package/schemas/platforms/facebook.video.schema.json +28 -28
- package/schemas/platforms/fengwang.video.schema.json +135 -135
- package/schemas/platforms/instagram.video.schema.json +28 -28
- package/schemas/platforms/jianshu.article.schema.json +33 -33
- package/schemas/platforms/kuaichuanhao.article.schema.json +83 -83
- package/schemas/platforms/kuaishou.imageText.schema.json +171 -171
- package/schemas/platforms/kuaishou.video.schema.json +243 -243
- package/schemas/platforms/meipai.video.schema.json +123 -123
- package/schemas/platforms/meiyou.video.schema.json +96 -96
- package/schemas/platforms/pipixia.video.schema.json +94 -94
- package/schemas/platforms/qiehao.article.schema.json +89 -89
- package/schemas/platforms/qiehao.video.schema.json +147 -147
- package/schemas/platforms/shipinhao.imageText.schema.json +139 -139
- package/schemas/platforms/shipinhao.video.schema.json +237 -237
- package/schemas/platforms/souhuhao.article.schema.json +73 -73
- package/schemas/platforms/souhuhao.video.schema.json +171 -171
- package/schemas/platforms/souhushipin.video.schema.json +115 -115
- package/schemas/platforms/tengxunshipin.video.schema.json +114 -114
- package/schemas/platforms/tiktok.video.schema.json +72 -72
- package/schemas/platforms/toutiaohao.article.schema.json +166 -166
- package/schemas/platforms/toutiaohao.imageText.schema.json +83 -83
- package/schemas/platforms/toutiaohao.video.schema.json +134 -134
- package/schemas/platforms/wangyihao.article.schema.json +85 -85
- package/schemas/platforms/wangyihao.video.schema.json +151 -151
- package/schemas/platforms/weishi.video.schema.json +101 -101
- package/schemas/platforms/weixin.account.article.schema.json +148 -148
- package/schemas/platforms/xhs.imageText.schema.json +131 -131
- package/schemas/platforms/xiaohongshu.video.schema.json +225 -225
- package/schemas/platforms/xiaohongshushop.video.schema.json +142 -142
- package/schemas/platforms/xinlang.article.schema.json +69 -69
- package/schemas/platforms/xinlang.imageText.schema.json +86 -86
- package/schemas/platforms/xinlang.video.schema.json +152 -152
- package/schemas/platforms/xueqiuhao.article.schema.json +84 -84
- package/schemas/platforms/yichehao.article.schema.json +140 -140
- package/schemas/platforms/yichehao.video.schema.json +101 -101
- package/schemas/platforms/yidianhao.article.schema.json +77 -77
- package/schemas/platforms/yidianhao.video.schema.json +152 -152
- package/schemas/platforms/youtube.video.schema.json +92 -92
- package/schemas/platforms/zhihu.article.schema.json +104 -104
- package/schemas/platforms/zhihu.imageText.schema.json +61 -61
- package/schemas/platforms/zhihu.video.schema.json +144 -144
- package/skills/yixiaoer/QUICKSTART.md +4 -4
- package/skills/yixiaoer/SKILL.md +1 -1
- package/skills/yixiaoer/references/cli/command-reference.md +30 -30
- package/skills/yixiaoer/references/create-account-group.md +27 -27
- package/skills/yixiaoer/references/delete-account-group.md +20 -20
- package/skills/yixiaoer/references/domains/accounts-and-env.md +17 -17
- package/skills/yixiaoer/references/domains/install-and-sync.md +41 -13
- package/skills/yixiaoer/references/domains/publish.md +11 -11
- package/skills/yixiaoer/references/execution-standard.md +18 -18
- package/skills/yixiaoer/references/get-account-groups.md +14 -14
- package/skills/yixiaoer/references/get-members.md +28 -28
- package/skills/yixiaoer/references/go-live-process.md +11 -19
- package/skills/yixiaoer/references/keyword-reference.md +4 -4
- package/skills/yixiaoer/references/material-resource.md +8 -8
- package/skills/yixiaoer/references/platforms/article/toutiaohao.md +28 -28
- package/skills/yixiaoer/references/platforms/video/facebook.md +37 -37
- package/skills/yixiaoer/references/platforms/video/index.md +7 -7
- package/skills/yixiaoer/references/platforms/video/instagram.md +40 -40
- package/skills/yixiaoer/references/platforms/video/tiktok.md +50 -50
- package/skills/yixiaoer/references/platforms/video/youtube.md +53 -53
- package/skills/yixiaoer/references/proxy-management.md +9 -9
- package/skills/yixiaoer/references/topic-tags.md +31 -31
- package/skills/yixiaoer/references/troubleshooting-guide.md +2 -2
- package/skills/yixiaoer/references/update-account-group.md +28 -28
- package/skills/yixiaoer/references/upload-resource.md +6 -6
- package/skills/yixiaoer/references/usage-workflow.md +3 -5
- package/skills/yixiaoer/references/workflows/common-rules.md +29 -29
- package/skills/yixiaoer/references/workflows/data-accuracy.md +83 -83
- package/skills/yixiaoer/references/workflows/payload-sourcing.md +24 -24
- package/skills/yixiaoer/references/workflows/publish-troubleshooting.md +10 -10
- package/dist/yxer-darwin-amd64 +0 -0
- package/dist/yxer-darwin-arm64 +0 -0
- package/dist/yxer-linux-amd64 +0 -0
- package/dist/yxer-linux-arm64 +0 -0
- package/dist/yxer-windows-amd64.exe +0 -0
- package/dist/yxer-windows-arm64.exe +0 -0
- package/references/cli/skill-install.md +0 -76
- package/skills/yixiaoer/plugin.json +0 -21
- package/skills/yixiaoer/references/cli/skill-install.md +0 -65
- 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 @
|
|
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,256 @@
|
|
|
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 download(url, destPath) {
|
|
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
|
+
execFileSync("curl", args, { stdio: ["ignore", "ignore", "pipe"] });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function parseChecksums(content) {
|
|
113
|
+
const result = new Map();
|
|
114
|
+
for (const line of content.split(/\r?\n/)) {
|
|
115
|
+
const trimmed = line.trim();
|
|
116
|
+
if (!trimmed) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const separator = trimmed.indexOf(" ");
|
|
121
|
+
if (separator === -1) {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
result.set(trimmed.slice(separator + 2), trimmed.slice(0, separator));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function getExpectedChecksum(archiveName, checksumsPath = getChecksumsPath()) {
|
|
132
|
+
if (!fs.existsSync(checksumsPath)) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const checksums = parseChecksums(fs.readFileSync(checksumsPath, "utf8"));
|
|
137
|
+
return checksums.get(archiveName) || null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function verifyChecksum(archivePath, expectedHash) {
|
|
141
|
+
if (!expectedHash) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const hash = crypto.createHash("sha256");
|
|
146
|
+
const fd = fs.openSync(archivePath, "r");
|
|
147
|
+
|
|
148
|
+
try {
|
|
149
|
+
const buffer = Buffer.alloc(64 * 1024);
|
|
150
|
+
let bytesRead = 0;
|
|
151
|
+
while ((bytesRead = fs.readSync(fd, buffer, 0, buffer.length, null)) > 0) {
|
|
152
|
+
hash.update(buffer.subarray(0, bytesRead));
|
|
153
|
+
}
|
|
154
|
+
} finally {
|
|
155
|
+
fs.closeSync(fd);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const actualHash = hash.digest("hex");
|
|
159
|
+
if (actualHash.toLowerCase() !== expectedHash.toLowerCase()) {
|
|
160
|
+
throw new Error(
|
|
161
|
+
`Checksum mismatch for ${path.basename(archivePath)}: expected ${expectedHash} but got ${actualHash}`
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function extractArchive(archivePath, destDir) {
|
|
167
|
+
if (process.platform === "win32") {
|
|
168
|
+
const psCommand =
|
|
169
|
+
"$ErrorActionPreference='Stop';" +
|
|
170
|
+
"Expand-Archive -LiteralPath $env:YXER_ARCHIVE -DestinationPath $env:YXER_DEST -Force";
|
|
171
|
+
execFileSync(
|
|
172
|
+
"powershell.exe",
|
|
173
|
+
["-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", psCommand],
|
|
174
|
+
{
|
|
175
|
+
stdio: ["ignore", "inherit", "inherit"],
|
|
176
|
+
env: {
|
|
177
|
+
...process.env,
|
|
178
|
+
YXER_ARCHIVE: archivePath,
|
|
179
|
+
YXER_DEST: destDir
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
execFileSync("tar", ["-xzf", archivePath, "-C", destDir], { stdio: "ignore" });
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function resolveBaseUrl() {
|
|
190
|
+
const customUrl = (process.env.YXER_DOWNLOAD_BASE_URL || "").trim();
|
|
191
|
+
if (!customUrl) {
|
|
192
|
+
return DEFAULT_BASE_URL;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
ALLOWED_HOSTS.add(new URL(customUrl).hostname);
|
|
196
|
+
return customUrl;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function install(baseDir = __dirname) {
|
|
200
|
+
const target = getTarget();
|
|
201
|
+
if (!target) {
|
|
202
|
+
throw new Error(`Unsupported platform: ${process.platform}/${process.arch}`);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const binDir = getBinDir(baseDir);
|
|
206
|
+
const binaryPath = path.join(binDir, target.binaryName);
|
|
207
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
208
|
+
|
|
209
|
+
if (fs.existsSync(binaryPath)) {
|
|
210
|
+
ensureExecutable(binaryPath);
|
|
211
|
+
return binaryPath;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "yxer-install-"));
|
|
215
|
+
const archivePath = path.join(tmpDir, target.archiveName);
|
|
216
|
+
|
|
217
|
+
try {
|
|
218
|
+
const downloadUrl = buildDownloadUrl(resolveBaseUrl(), target.archiveName);
|
|
219
|
+
download(downloadUrl, archivePath);
|
|
220
|
+
verifyChecksum(archivePath, getExpectedChecksum(target.archiveName, getChecksumsPath(baseDir)));
|
|
221
|
+
extractArchive(archivePath, tmpDir);
|
|
222
|
+
|
|
223
|
+
const extractedBinary = path.join(tmpDir, target.binaryName);
|
|
224
|
+
if (!fs.existsSync(extractedBinary)) {
|
|
225
|
+
throw new Error(`Extracted binary not found: ${target.binaryName}`);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
fs.copyFileSync(extractedBinary, binaryPath);
|
|
229
|
+
ensureExecutable(binaryPath);
|
|
230
|
+
return binaryPath;
|
|
231
|
+
} finally {
|
|
232
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (require.main === module) {
|
|
237
|
+
try {
|
|
238
|
+
install();
|
|
239
|
+
} catch (error) {
|
|
240
|
+
console.error(`Failed to install yxer: ${error.message}`);
|
|
241
|
+
process.exit(1);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
module.exports = {
|
|
246
|
+
ALLOWED_HOSTS,
|
|
247
|
+
buildDownloadUrl,
|
|
248
|
+
getBinaryPath,
|
|
249
|
+
getBinDir,
|
|
250
|
+
getExpectedChecksum,
|
|
251
|
+
getTarget,
|
|
252
|
+
install,
|
|
253
|
+
isSupportedPlatform,
|
|
254
|
+
parseChecksums,
|
|
255
|
+
verifyChecksum
|
|
256
|
+
};
|
package/bin/postinstall.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const {
|
|
4
|
-
const { resolveBinaryPath } = require("./resolve-binary");
|
|
3
|
+
const { install, isSupportedPlatform } = require("./install");
|
|
5
4
|
|
|
6
5
|
try {
|
|
7
|
-
|
|
8
|
-
if (!binaryPath) {
|
|
6
|
+
if (!isSupportedPlatform(process.platform, process.arch)) {
|
|
9
7
|
process.exit(0);
|
|
10
8
|
}
|
|
11
9
|
|
|
12
|
-
|
|
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
|
}
|
package/bin/resolve-binary.js
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
const fs = require("node:fs");
|
|
2
2
|
const os = require("node:os");
|
|
3
|
-
const
|
|
3
|
+
const { getBinaryPath, getTarget } = require("./install");
|
|
4
4
|
|
|
5
5
|
function getBinaryFilename(platform = os.platform(), arch = os.arch()) {
|
|
6
|
-
const
|
|
7
|
-
|
|
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
|
|
21
|
-
if (!
|
|
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 { install } = require("./install");
|
|
6
7
|
const { getBinaryFilename, resolveBinaryPath } = require("./resolve-binary");
|
|
7
8
|
|
|
8
9
|
function resolveBinary() {
|
|
@@ -26,18 +27,23 @@ function resolveBinary() {
|
|
|
26
27
|
|
|
27
28
|
const binaryPath = resolveBinaryPath(__dirname, platform, arch);
|
|
28
29
|
if (!binaryPath || !fs.existsSync(binaryPath)) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
try {
|
|
31
|
+
return install(__dirname);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error(
|
|
34
|
+
JSON.stringify({
|
|
35
|
+
error: {
|
|
36
|
+
code: "missing_binary",
|
|
37
|
+
message: `Expected packaged binary not found: ${filename}`,
|
|
38
|
+
category: "environment",
|
|
39
|
+
hint: `Automatic install failed: ${error.message}`,
|
|
40
|
+
nextCommand: "npm install -g @yixiaoermail/cli@latest",
|
|
41
|
+
retryable: true
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
return binaryPath;
|
package/checksums.txt
ADDED
|
@@ -0,0 +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
|
package/package.json
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@yixiaoermail/cli",
|
|
3
|
+
"version": "3.2.3",
|
|
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
|
}
|