weaver-work-cli 0.1.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/LICENSE +21 -0
- package/README.md +422 -0
- package/dist/cmd/action.js +35 -0
- package/dist/cmd/commands/index.js +15 -0
- package/dist/cmd/config/index.js +64 -0
- package/dist/cmd/docs/index.js +56 -0
- package/dist/cmd/doctor/index.js +45 -0
- package/dist/cmd/e10/index.js +25 -0
- package/dist/cmd/index.js +18 -0
- package/dist/cmd/register.js +19 -0
- package/dist/cmd/root.js +36 -0
- package/dist/cmd/run/index.js +38 -0
- package/dist/cmd/setup/index.js +77 -0
- package/dist/cmd/skills/index.js +72 -0
- package/dist/core/config-store.js +43 -0
- package/dist/core/context.js +31 -0
- package/dist/core/errors.js +60 -0
- package/dist/core/hooks.js +41 -0
- package/dist/core/logger.js +27 -0
- package/dist/core/output.js +25 -0
- package/dist/core/write-with-retry.js +21 -0
- package/dist/index.js +11 -0
- package/dist/internal/e10/auth/commands.js +594 -0
- package/dist/internal/e10/auth/crypto.js +126 -0
- package/dist/internal/e10/auth/paths.js +12 -0
- package/dist/internal/e10/auth/session.js +449 -0
- package/dist/internal/e10/client.js +104 -0
- package/dist/internal/e10/context.js +20 -0
- package/dist/internal/e10/index.js +2 -0
- package/dist/internal/e10/types.js +1 -0
- package/dist/internal/skills/install.js +99 -0
- package/dist/internal/skills/reader.js +119 -0
- package/dist/services/command-runner.js +44 -0
- package/dist/shortcuts/index.js +4 -0
- package/dist/shortcuts/invoice/continuation.js +70 -0
- package/dist/shortcuts/invoice/errors.js +59 -0
- package/dist/shortcuts/invoice/host.js +337 -0
- package/dist/shortcuts/invoice/index.js +301 -0
- package/dist/shortcuts/invoice/manifest.js +288 -0
- package/dist/shortcuts/invoice/operations/add.js +106 -0
- package/dist/shortcuts/invoice/operations/delete.js +92 -0
- package/dist/shortcuts/invoice/operations/download.js +16 -0
- package/dist/shortcuts/invoice/operations/get.js +7 -0
- package/dist/shortcuts/invoice/operations/import.js +128 -0
- package/dist/shortcuts/invoice/operations/list.js +12 -0
- package/dist/shortcuts/invoice/operations/ocr-preview.js +40 -0
- package/dist/shortcuts/invoice/operations/registry.js +50 -0
- package/dist/shortcuts/invoice/operations/shared.js +640 -0
- package/dist/shortcuts/invoice/operations/types.js +1 -0
- package/dist/shortcuts/invoice/operations/update.js +109 -0
- package/dist/shortcuts/invoice/operations/upload.js +8 -0
- package/dist/shortcuts/invoice/operations/validate-preview.js +39 -0
- package/dist/shortcuts/invoice/operations.js +8 -0
- package/dist/types.js +1 -0
- package/docs/SKILL.md +36 -0
- package/docs/_catalog.md +12 -0
- package/docs/agent-invoice.md +53 -0
- package/docs/e10-auth.md +51 -0
- package/docs/invoice.md +99 -0
- package/package.json +51 -0
- package/scripts/clean.mjs +4 -0
- package/scripts/package-skill.mjs +164 -0
- package/scripts/sync-docs.mjs +17 -0
- package/skill-template/business-info.json +4 -0
- package/skill-template/domains/invoice.md +23 -0
- package/skill-template/domains/shared.md +8 -0
- package/skill-template/master-skill-template.md +29 -0
- package/skill-template/skill-template.md +60 -0
- package/skills/weaver-work-cli-invoice/SKILL.md +103 -0
- package/skills/weaver-work-cli-invoice/product.json +8 -0
- package/skills/weaver-work-cli-invoice/references/invoice-add.md +18 -0
- package/skills/weaver-work-cli-invoice/references/invoice-agent-entry.md +38 -0
- package/skills/weaver-work-cli-invoice/references/invoice-delete.md +20 -0
- package/skills/weaver-work-cli-invoice/references/invoice-detail.md +29 -0
- package/skills/weaver-work-cli-invoice/references/invoice-disabled-capabilities.md +26 -0
- package/skills/weaver-work-cli-invoice/references/invoice-download.md +22 -0
- package/skills/weaver-work-cli-invoice/references/invoice-enterprise-list.md +35 -0
- package/skills/weaver-work-cli-invoice/references/invoice-file-upload.md +28 -0
- package/skills/weaver-work-cli-invoice/references/invoice-import.md +28 -0
- package/skills/weaver-work-cli-invoice/references/invoice-ocr-preview.md +33 -0
- package/skills/weaver-work-cli-invoice/references/invoice-personal-list.md +47 -0
- package/skills/weaver-work-cli-invoice/references/invoice-update.md +38 -0
- package/skills/weaver-work-cli-invoice/references/invoice-validation-preview.md +26 -0
- package/skills/weaver-work-cli-shared/SKILL.md +53 -0
- package/skills/weaver-work-cli-shared/references/e10-auth-and-session.md +83 -0
- package/skills/weaver-work-cli-shared/references/high-risk-write.md +36 -0
- package/skills/weaver-work-cli-shared/references/json-output-contract.md +61 -0
- package/skills/weaver-work-cli-shared/references/weaver-work-cli-installation.md +61 -0
- package/templates/shortcut/index.ts.tpl +19 -0
- package/templates/shortcut/operations/ping.ts.tpl +7 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: weaver-work-cli-shared
|
|
3
|
+
description: weaver-work-cli 共享规则:安装检查、E10 认证、JSON 输出、高风险写入、安全边界和引用路由。
|
|
4
|
+
metadata:
|
|
5
|
+
requires:
|
|
6
|
+
bins: ["weaver-work-cli"]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# weaver-work-cli 共享规则
|
|
10
|
+
|
|
11
|
+
所有 `weaver-work-cli-*` Skill 共享的底座:命令可用性、E10 认证、JSON 输出契约与高风险操作。
|
|
12
|
+
|
|
13
|
+
## 通用准则
|
|
14
|
+
|
|
15
|
+
1. 执行业务命令前先确认用法:优先读当前业务 Skill 和被路由到的 reference,必要时跑对应命令的 `--help` 或 `schema`,不要猜参数。
|
|
16
|
+
|
|
17
|
+
2. 首次使用先确认 CLI 可用:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
weaver-work-cli --version
|
|
21
|
+
weaver-work-cli doctor --e10
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
3. 业务输入只描述业务对象和意图。认证、Cookie、ETEAMSID、业务 Token、接口地址和回查细节都由 CLI 托管。
|
|
25
|
+
|
|
26
|
+
## 输出契约
|
|
27
|
+
|
|
28
|
+
Agent 调用业务能力时优先加 `--json`。成功看进程退出码 0 和 JSON envelope 的 `ok=true`;失败看非 0 退出码和 stderr JSON 的 `error.type/subtype/message`。不要用老式 `code == 0` 判断成功。
|
|
29
|
+
|
|
30
|
+
返回 `partial`、`write_uncertain`、登录失效、回查失败或网络中断时,立即停止当前写流程,不自动重试写入或删除。
|
|
31
|
+
|
|
32
|
+
## Reference 强触发索引
|
|
33
|
+
|
|
34
|
+
命中任一触发条件时,执行下一步前读取对应 reference。命中多条时按表中顺序读取,同一 reference 只读取一次。
|
|
35
|
+
|
|
36
|
+
| 强触发条件 | Reference |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| 命令不可用、安装、构建、全局 link、检查可用 skill | [`weaver-work-cli-installation.md`](references/weaver-work-cli-installation.md) |
|
|
39
|
+
| 登录、profile、E10 会话、baseUrl、auth 文件、`WEAVER_*` 环境变量;**未登录或登录失效(需要用户提供登录域名)** | [`e10-auth-and-session.md`](references/e10-auth-and-session.md) |
|
|
40
|
+
| 判断 stdout/stderr、JSON envelope、退出码、脚本封装、自动化调用 | [`json-output-contract.md`](references/json-output-contract.md) |
|
|
41
|
+
| 准备执行写入/删除/导入/更新、遇到 `confirmation.required`、`partial.write_uncertain`、网络中断或回查失败 | [`high-risk-write.md`](references/high-risk-write.md) |
|
|
42
|
+
|
|
43
|
+
## 安全规则
|
|
44
|
+
|
|
45
|
+
1. 禁止输出或索取 Cookie、ETEAMSID、业务 Token、access token、app key、app secret。
|
|
46
|
+
|
|
47
|
+
2. 禁止绕过 `weaver-work-cli` 直接 `curl`、`fetch`、浏览器自动化或访问 E10 业务接口。
|
|
48
|
+
|
|
49
|
+
3. 写入、删除、导入、更新等高风险操作必须使用 CLI 提供的确认流程;业务 Skill 要求 `prepare -> apply` 时,必须把 prepare 返回的 continuation 原样传给 apply,并在 apply 前取得用户明确确认。
|
|
50
|
+
|
|
51
|
+
4. 不能猜测 CLI 未暴露的内部字段、接口路径、ID 解析逻辑或回查语义。
|
|
52
|
+
|
|
53
|
+
5. 未登录或登录失效(`authentication` / `session_expired` / `auth status` 未登录)时,必须先通过宿主提问或弹框向用户确认 E10 登录域名,或用 `auth profile list` 让用户选择已有 profile;**禁止**使用示例占位域名登录,也禁止在拿到域名前反复重试业务命令。具体流程读取 [`e10-auth-and-session.md`](references/e10-auth-and-session.md)。
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# E10 认证与会话
|
|
2
|
+
|
|
3
|
+
## 什么时候读取
|
|
4
|
+
|
|
5
|
+
用户需要登录、切换 profile、诊断 E10 连接、处理登录失效,或任务涉及 `base-url`、auth 文件、Keychain、`WEAVER_*` 环境变量时读取本文件。
|
|
6
|
+
|
|
7
|
+
## 基本检查
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
weaver-work-cli auth status --no-check
|
|
11
|
+
weaver-work-cli auth whoami
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
`--no-check` 只读取本地登录态;需要实际验证服务端可用性时使用业务命令或明确带 live 校验的命令。
|
|
15
|
+
|
|
16
|
+
## 未登录 / 登录失效:必须先向用户提问登录域名,再登录
|
|
17
|
+
|
|
18
|
+
业务命令依赖 E10 登录态。出现以下任一情况即判定为未登录或登录失效:
|
|
19
|
+
|
|
20
|
+
- `weaver-work-cli auth status` 输出 `loggedIn: false`,或本地不存在 auth 文件
|
|
21
|
+
- `weaver-work-cli doctor --e10` 的 `e10AuthFile` 检查为 `ok: false`
|
|
22
|
+
- 业务命令失败,stderr JSON 中 `error.type === "authentication"`(如 `E10 auth not found`)
|
|
23
|
+
- 业务命令返回 `error.subtype === "session_expired"`(E10 登录态 401/302 失效)
|
|
24
|
+
|
|
25
|
+
此时**禁止**:
|
|
26
|
+
|
|
27
|
+
- 使用示例占位域名(如 `https://weapp.xxx.cn`)或自行猜测域名执行登录
|
|
28
|
+
- 未向用户确认登录域名前,反复重试业务命令
|
|
29
|
+
- 要求用户提供 Cookie、ETEAMSID、业务 Token(见安全边界)
|
|
30
|
+
|
|
31
|
+
**正确流程(按序执行,缺一不可):**
|
|
32
|
+
|
|
33
|
+
1. **先调用宿主提供的提问 / 弹框能力询问用户**,让用户二选一:
|
|
34
|
+
- 输入本次要登录的 E10 登录域名(base URL),形如 `https://<企业域名>`;或
|
|
35
|
+
- 从已有 profile 中选择一个已登录环境:先运行 `weaver-work-cli auth profile list` 列出候选,让用户选择。
|
|
36
|
+
2. 用户提供了**新域名**时,用真实域名执行浏览器 OAuth 登录:
|
|
37
|
+
```bash
|
|
38
|
+
weaver-work-cli auth login --base-url "<用户输入的域名>"
|
|
39
|
+
```
|
|
40
|
+
端口冲突时加 `--port 19801`。
|
|
41
|
+
3. 用户选择了**已有 profile** 时,切换后验证登录态:
|
|
42
|
+
```bash
|
|
43
|
+
weaver-work-cli auth profile use <name>
|
|
44
|
+
weaver-work-cli auth status
|
|
45
|
+
```
|
|
46
|
+
4. 登录成功后再继续原业务操作。仍失败时,把 `error.type/subtype/message` 原样反馈给用户并停止,不要自动重试。
|
|
47
|
+
|
|
48
|
+
登录域名一律以用户实际提供为准;拿不到域名前,不要执行任何依赖登录态的业务命令。
|
|
49
|
+
|
|
50
|
+
## 登录
|
|
51
|
+
|
|
52
|
+
先取得用户确认的登录域名(见上节流程),再让用户通过浏览器 OAuth 登录:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
weaver-work-cli auth login --base-url "<用户确认的登录域名>"
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
如果端口冲突:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
weaver-work-cli auth login --base-url "<用户确认的登录域名>" --port 19801
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
保底方式是让用户手动写入浏览器中的 `ETEAMSID`:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
weaver-work-cli auth set --eteamsid "PCACCOUNT_xxx" --base-url "<用户确认的登录域名>"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Profile 与环境
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
weaver-work-cli auth profile list
|
|
74
|
+
weaver-work-cli auth profile current
|
|
75
|
+
weaver-work-cli auth profile use <name>
|
|
76
|
+
weaver-work-cli --profile <name> auth status --no-check
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
通过 `weaver-work-cli run` 执行外部命令时,CLI 会按当前 profile 注入 `WEAVER_BASE_URL`、`WEAVER_ETEAMSID`、`WEAVER_COOKIE`、`WEAVER_USER_AGENT` 和 `WEAVER_AGENT_TYPE`。这些值只给子进程使用,不应在回复或日志中明文展示。
|
|
80
|
+
|
|
81
|
+
## 安全边界
|
|
82
|
+
|
|
83
|
+
Agent 不要要求用户贴 Cookie、ETEAMSID、业务 Token、app key 或 app secret。业务 Skill 只负责调用 CLI;登录态读取、Cookie 拼接、业务 Token 获取和 HTTP header 注入都由 `weaver-work-cli` 内部完成。
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# 高风险写入协议
|
|
2
|
+
|
|
3
|
+
## 什么时候读取
|
|
4
|
+
|
|
5
|
+
准备执行新增、导入、更新、删除、确认写入,或看到 `confirmation.required`、`partial.write_uncertain`、网络中断、回查失败时读取本文件。
|
|
6
|
+
|
|
7
|
+
## 固定流程
|
|
8
|
+
|
|
9
|
+
高风险业务能力必须由 CLI 的 `prepare -> apply` 流程承载:
|
|
10
|
+
|
|
11
|
+
1. 调用 `.prepare` 获取 `preview`、`continuation`、`expiresInSeconds` 和 `workflow`。
|
|
12
|
+
2. 把 `preview` 中的目标对象、变更内容、风险和关键参数展示给用户。
|
|
13
|
+
3. 用户明确确认后,调用对应 `.apply`,传入 prepare 返回的 `continuation` 和 `confirm=true`,或使用命令行 `--yes`。
|
|
14
|
+
4. `.apply` 成功后以 CLI 回查结果为准报告结果。
|
|
15
|
+
|
|
16
|
+
`continuation` 由 CLI 生成并验证,可能绑定当前 `baseUrl`、profile、userId、目标对象指纹、本地文件 SHA-256 和业务选项。不要修改、解码、复用或手工构造 continuation。
|
|
17
|
+
|
|
18
|
+
## 停止条件
|
|
19
|
+
|
|
20
|
+
出现以下任一情况时停止写流程,不自动重复提交:
|
|
21
|
+
|
|
22
|
+
- `error.type === "partial"` 且 `error.subtype === "write_uncertain"`
|
|
23
|
+
- 写入请求发送后网络中断
|
|
24
|
+
- 服务端返回部分成功
|
|
25
|
+
- 写入接口返回成功但详情回查失败
|
|
26
|
+
- 回查结果与预期目标或变更不一致
|
|
27
|
+
- CLI 提示上下文、目标文件、目标对象或 continuation 已变化
|
|
28
|
+
|
|
29
|
+
停止后向用户说明已知的 `workflow.state`、已尝试目标、成功/失败项和需要人工确认的点。
|
|
30
|
+
|
|
31
|
+
## 不允许的做法
|
|
32
|
+
|
|
33
|
+
- 在用户未确认前补 `confirm=true` 或 `--yes`
|
|
34
|
+
- 将失败的 `.apply` 静默重跑
|
|
35
|
+
- 用当前输入重新拼一个 apply payload 代替 prepare 结果
|
|
36
|
+
- 猜测 CLI 未暴露的接口路径、Token、Cookie、内部控制字段或写后回查语义
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# JSON 输出契约
|
|
2
|
+
|
|
3
|
+
## 什么时候读取
|
|
4
|
+
|
|
5
|
+
需要判断命令成功或失败、编写脚本封装、处理 stdout/stderr,或连续执行多个 Agent operation 时读取本文件。
|
|
6
|
+
|
|
7
|
+
## 成功 envelope
|
|
8
|
+
|
|
9
|
+
成功写入 stdout,退出码为 0:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"schemaVersion": 1,
|
|
14
|
+
"ok": true,
|
|
15
|
+
"operation": "invoice.list",
|
|
16
|
+
"data": {},
|
|
17
|
+
"meta": { "status": "COMPLETE" },
|
|
18
|
+
"warnings": []
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
判断成功使用退出码 0 和 `ok === true`。不要用 `code === 0`,成功 envelope 没有顶层 `code/msg`。
|
|
23
|
+
|
|
24
|
+
## 失败 envelope
|
|
25
|
+
|
|
26
|
+
失败写入 stderr,退出码非 0:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"schemaVersion": 1,
|
|
31
|
+
"ok": false,
|
|
32
|
+
"error": {
|
|
33
|
+
"type": "validation",
|
|
34
|
+
"subtype": "input_invalid",
|
|
35
|
+
"message": "必须提供 fid 或 number",
|
|
36
|
+
"retryable": false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
错误判断优先看:
|
|
42
|
+
|
|
43
|
+
- `error.type`
|
|
44
|
+
- `error.subtype`
|
|
45
|
+
- `error.message`
|
|
46
|
+
- `error.retryable`
|
|
47
|
+
- `error.stage`
|
|
48
|
+
- 进程退出码
|
|
49
|
+
|
|
50
|
+
## 退出码
|
|
51
|
+
|
|
52
|
+
| 退出码 | 含义 |
|
|
53
|
+
| --- | --- |
|
|
54
|
+
| `0` | 成功 |
|
|
55
|
+
| `2` | 参数或业务输入错误 |
|
|
56
|
+
| `3` | 认证错误 |
|
|
57
|
+
| `4` | 网络错误 |
|
|
58
|
+
| `10` | 需要明确确认 |
|
|
59
|
+
| `11` | 部分完成或结果不确定 |
|
|
60
|
+
|
|
61
|
+
`retryable=true` 只表示读操作或准备阶段可能可以重试;写入请求已经发出后,遇到 `partial/write_uncertain` 必须停止并交给用户判断。
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# 安装与可用性检查
|
|
2
|
+
|
|
3
|
+
## 什么时候读取
|
|
4
|
+
|
|
5
|
+
命令不可用、版本不确定、用户刚安装、全局命令可能指向旧版本,或需要确认当前安装包含哪些 Agent Skill 时读取本文件。
|
|
6
|
+
|
|
7
|
+
## 检查命令
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
weaver-work-cli --version
|
|
11
|
+
weaver-work-cli setup invoice
|
|
12
|
+
weaver-work-cli doctor --e10
|
|
13
|
+
weaver-work-cli skills list
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`weaver-work-cli skills list` 只证明包内 Skill 文件可读,不证明业务 API 可用;E10 登录态和 live API 仍需按业务命令实际验证。
|
|
17
|
+
|
|
18
|
+
## 本地源码安装
|
|
19
|
+
|
|
20
|
+
开发或本机调试时可以从源码构建并 link:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# 在克隆到本地的仓库根目录执行(将 <repo-root> 替换为实际路径)
|
|
24
|
+
cd <repo-root>
|
|
25
|
+
npm install
|
|
26
|
+
npm run build
|
|
27
|
+
npm link
|
|
28
|
+
weaver-work-cli --help
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
如果怀疑全局 `weaver-work-cli` 仍是旧版本,在仓库内验证时优先直接调用当前构建产物:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
node dist/index.js --version
|
|
35
|
+
node dist/index.js commands list
|
|
36
|
+
node dist/index.js skills list
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 推荐交付模式
|
|
40
|
+
|
|
41
|
+
`weaver-work-cli` npm 包是唯一必须安装的运行时,包含 CLI 命令、E10 鉴权、
|
|
42
|
+
发票业务 operation 和随包 Agent Skill 文档。普通用户安装 npm 包后即可使用:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install -g weaver-work-cli
|
|
46
|
+
weaver-work-cli setup invoice
|
|
47
|
+
weaver-work-cli auth login --base-url "<E10_BASE_URL>"
|
|
48
|
+
weaver-work-cli invoice schema
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
如果当前环境需要让 Codex/Agent 直接加载发票 Skill,优先使用随包一键安装:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
weaver-work-cli skills install invoice
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
该命令会同时安装 `weaver-work-cli-shared` 和 `weaver-work-cli-invoice` 到
|
|
58
|
+
`$CODEX_HOME/skills`;未设置 `CODEX_HOME` 时使用 `~/.codex/skills`。
|
|
59
|
+
|
|
60
|
+
交付给 Agent 的 Skill ZIP 不内置运行时,只声明依赖本机可用的 `weaver-work-cli`
|
|
61
|
+
bin。ZIP 主要用于平台导入、离线分发或版本归档,不应作为普通用户的必经安装步骤。
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MODULE_NAMEPingOperation } from './operations/ping.js';
|
|
2
|
+
import type { CliCommand } from '../../types.js';
|
|
3
|
+
|
|
4
|
+
const pingOperation = new MODULE_NAMEPingOperation();
|
|
5
|
+
|
|
6
|
+
export const MODULE_NAME_SHORTCUT: CliCommand = {
|
|
7
|
+
name: 'MODULE_NAME',
|
|
8
|
+
description: 'MODULE_NAME business shortcut',
|
|
9
|
+
category: 'shortcut',
|
|
10
|
+
register({ program, action }) {
|
|
11
|
+
const command = program.command('MODULE_NAME').description('MODULE_NAME business commands');
|
|
12
|
+
|
|
13
|
+
command.command('ping')
|
|
14
|
+
.description('Test MODULE_NAME business shortcut wiring')
|
|
15
|
+
.action(action(async (ctx) => {
|
|
16
|
+
ctx.output.write(await pingOperation.execute(ctx));
|
|
17
|
+
}));
|
|
18
|
+
},
|
|
19
|
+
};
|