@ttpos/cli 0.0.0-stage → 0.3.0
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 +12 -2
- package/bin/ttpos.js +40 -0
- package/package.json +15 -4
package/README.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ttpos/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TTPOS 只读运维 CLI。安装后得到 `ttpos` 命令。
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install -g @ttpos/cli
|
|
7
|
+
ttpos --version
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
支持 linux/darwin × x64/arm64。其他平台或不便用 npm 时,用安装脚本:
|
|
11
|
+
https://github.com/ZonEaseTech/ttpos-cli
|
|
12
|
+
|
|
13
|
+
上手、命令列表与 agent skills 见公开仓库 README。
|
package/bin/ttpos.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
// @ttpos/cli 入口:按平台解析 optionalDependencies 里的真二进制并执行。
|
|
4
|
+
// 不用 postinstall 换二进制:--ignore-scripts 下会静默坏掉,且触发安装告警。
|
|
5
|
+
const { spawnSync } = require("child_process");
|
|
6
|
+
|
|
7
|
+
const PLATFORM_PACKAGES = {
|
|
8
|
+
"darwin-arm64": "@ttpos/cli-darwin-arm64",
|
|
9
|
+
"darwin-x64": "@ttpos/cli-darwin-x64",
|
|
10
|
+
"linux-arm64": "@ttpos/cli-linux-arm64",
|
|
11
|
+
"linux-x64": "@ttpos/cli-linux-x64",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const key = `${process.platform}-${process.arch}`;
|
|
15
|
+
const pkg = PLATFORM_PACKAGES[key];
|
|
16
|
+
if (!pkg) {
|
|
17
|
+
console.error(`ttpos: 不支持的平台 ${key}(支持: ${Object.keys(PLATFORM_PACKAGES).join(", ")})`);
|
|
18
|
+
console.error("其他平台可用安装脚本: https://github.com/ZonEaseTech/ttpos-cli#安装");
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let bin;
|
|
23
|
+
try {
|
|
24
|
+
bin = require.resolve(`${pkg}/bin/ttpos`);
|
|
25
|
+
} catch {
|
|
26
|
+
console.error(`ttpos: 找不到平台包 ${pkg}。`);
|
|
27
|
+
console.error("可能原因: 安装时带了 --omit=optional,或 lockfile 是在其他平台生成的。");
|
|
28
|
+
console.error(`修复: 重新执行 npm install,或改用安装脚本: https://github.com/ZonEaseTech/ttpos-cli#安装`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const r = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
33
|
+
if (r.error) {
|
|
34
|
+
console.error(`ttpos: 无法启动二进制: ${r.error.message}`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
if (r.signal) {
|
|
38
|
+
process.kill(process.pid, r.signal);
|
|
39
|
+
}
|
|
40
|
+
process.exit(r.status === null ? 1 : r.status);
|
package/package.json
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttpos/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
}
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "TTPOS 只读运维 CLI(安装后提供 ttpos 命令)",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"repository": { "type": "git", "url": "git+https://github.com/ZonEaseTech/ttpos-cli.git" },
|
|
7
|
+
"bin": { "ttpos": "bin/ttpos.js" },
|
|
8
|
+
"engines": { "node": ">=18" },
|
|
9
|
+
"files": ["bin/ttpos.js", "README.md"],
|
|
10
|
+
"optionalDependencies": {
|
|
11
|
+
"@ttpos/cli-linux-x64": "0.3.0",
|
|
12
|
+
"@ttpos/cli-linux-arm64": "0.3.0",
|
|
13
|
+
"@ttpos/cli-darwin-x64": "0.3.0",
|
|
14
|
+
"@ttpos/cli-darwin-arm64": "0.3.0"
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": { "access": "public" }
|
|
17
|
+
}
|