@zhiyueyun/cli 0.2.16

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 ADDED
@@ -0,0 +1,48 @@
1
+ # @zhiyueyun/cli
2
+
3
+ 职阅开放平台官方 CLI。命令 Catalog、业务域映射和领域 Skill 随二进制一起发布,
4
+ 本机只使用这份发布快照,运行时不会再拉内部仓库。
5
+
6
+ ## 安装
7
+
8
+ ```bash
9
+ npm install -g @zhiyueyun/cli
10
+ printf '%s\n' 'zy_...' | zhiyue-cli login --api-key-stdin --check
11
+ ```
12
+
13
+ 一个 npm 包包含 macOS、Linux 和 Windows 的原生二进制;运行时只启动当前
14
+ 系统和 CPU 架构对应的一份。支持 macOS(Apple Silicon/Intel)、Linux(x64/arm64)
15
+ 和 Windows(x64/arm64)。
16
+
17
+ 个人 API Key 在 [开放平台个人对接](https://open-platform.zhiyueyun.com/open-platform/personal-applications) 创建。
18
+
19
+ 从开放平台下载并安装 `zhiyue-unified` Skill(ZIP 根目录即为 Skill 根)。setup 会安装或检查
20
+ `zhiyue-cli`,再调用 `zhiyue-cli skills sync --destination <zhiyue-unified>/references`
21
+ 把 CLI 内嵌的领域 Skill references 投影到统一 Skill。多个 Agent Host 可以共用
22
+ 同一个 CLI。
23
+
24
+ ```bash
25
+ zhiyue-cli skills list
26
+ zhiyue-cli skills read zhiyue-task
27
+ zhiyue-cli skills sync --destination ~/.workbuddy/skills/zhiyue-unified/references
28
+ ```
29
+
30
+ 升级 CLI 后,在已安装的 `zhiyue-unified` 目录中再次运行 `scripts/setup.py`。
31
+
32
+ ## 命令
33
+
34
+ | Command | Purpose |
35
+ | --- | --- |
36
+ | `doctor` | 检查 CLI、凭据和内嵌 Catalog 快照 |
37
+ | `login` / `logout` | 管理个人 API Key |
38
+ | `domains` | 列出内嵌业务域 |
39
+ | `domain lookup <serviceCode>` | 查询内嵌 `serviceDomainMap` |
40
+ | `schema [operationId]` | 查看操作参数、Scope 和命令路径 |
41
+ | `catalog list` | 查看 CLI 内嵌的 Command Catalog 与映射 |
42
+ | `skills list/read` | 查看 CLI 内嵌的共享规则和领域 references |
43
+ | `skills sync` | 同步 CLI 内嵌的领域 references 到一个已安装的 `zhiyue-unified` |
44
+ | `<domain> <resource> <action>` | 经开放平台网关调用业务能力 |
45
+
46
+ 写操作必须先以 `--dry-run` 预览,获得确认后再加 `--yes`。
47
+
48
+ 每次业务调用只使用目标 serviceCode 的小范围 Token,由网关再换成操作级 Token。CLI 将 service Token 按 serviceCode 缓存到期前的短暂时间(目录 700、文件 600),不持久化操作级 Token。
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { spawnSync } = require('child_process');
5
+ const { existsSync } = require('fs');
6
+ const { join } = require('path');
7
+
8
+ const BUNDLED_BINARIES = {
9
+ 'darwin-arm64': 'native/darwin-arm64/zhiyue-cli',
10
+ 'darwin-x64': 'native/darwin-x64/zhiyue-cli',
11
+ 'linux-arm64': 'native/linux-arm64/zhiyue-cli',
12
+ 'linux-x64': 'native/linux-x64/zhiyue-cli',
13
+ 'win32-arm64': 'native/win32-arm64/zhiyue-cli.exe',
14
+ 'win32-x64': 'native/win32-x64/zhiyue-cli.exe',
15
+ };
16
+
17
+ const resolveBundledBinary = (platform, arch) => BUNDLED_BINARIES[`${platform}-${arch}`];
18
+
19
+ const main = () => {
20
+ const key = `${process.platform}-${process.arch}`;
21
+ const relativeBinary = resolveBundledBinary(process.platform, process.arch);
22
+ if (!relativeBinary) {
23
+ console.error(
24
+ `zhiyue-cli: unsupported platform ${key} (supported: ${Object.keys(BUNDLED_BINARIES).join(', ')})`,
25
+ );
26
+ process.exit(1);
27
+ }
28
+
29
+ const bin = join(__dirname, '..', relativeBinary);
30
+ if (!existsSync(bin)) {
31
+ console.error(`zhiyue-cli: bundled binary is missing for ${key}. Reinstall @zhiyueyun/cli.`);
32
+ process.exit(1);
33
+ }
34
+
35
+ const result = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit' });
36
+ if (result.error) {
37
+ console.error(result.error.message);
38
+ process.exit(1);
39
+ }
40
+ process.exit(result.status ?? 1);
41
+ };
42
+
43
+ if (require.main === module) {
44
+ main();
45
+ }
46
+
47
+ module.exports = { resolveBundledBinary };
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@zhiyueyun/cli",
3
+ "version": "0.2.16",
4
+ "description": "Official Zhiyue Open Platform CLI with embedded command metadata and Agent Skills",
5
+ "keywords": [
6
+ "cli",
7
+ "zhiyue",
8
+ "open-platform",
9
+ "agent",
10
+ "skills"
11
+ ],
12
+ "author": "AnyBuilder Team",
13
+ "private": false,
14
+ "bin": {
15
+ "zhiyue-cli": "bin/zhiyue-cli.js",
16
+ "zy": "bin/zhiyue-cli.js"
17
+ },
18
+ "publishConfig": {
19
+ "registry": "https://registry.npmjs.org/",
20
+ "access": "public"
21
+ },
22
+ "files": [
23
+ "bin/zhiyue-cli.js",
24
+ "native",
25
+ "README.md"
26
+ ],
27
+ "scripts": {
28
+ "build": "make build",
29
+ "build:all": "make build-all",
30
+ "test": "make test",
31
+ "check": "make check",
32
+ "prepublishOnly": "python3 scripts/check_release_snapshot.py && test -f bin/zhiyue-cli.js && test -f internal/registry/catalog.json && test -f skills/zhiyue-shared/SKILL.md && make build-all"
33
+ },
34
+ "os": [
35
+ "darwin",
36
+ "linux",
37
+ "win32"
38
+ ],
39
+ "cpu": [
40
+ "x64",
41
+ "arm64"
42
+ ],
43
+ "engines": {
44
+ "node": ">=16"
45
+ },
46
+ "license": "MIT"
47
+ }