bpmax-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.
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: bpmax-shared
3
+ version: 1.0.0
4
+ description: Use when working with bpmax-cli across any BPMAX scenario and you need shared rules for command discovery, profile selection, global flags, login prerequisites, output format choice, or fallback to raw API calls.
5
+ metadata:
6
+ requires:
7
+ bins: ["bpmax-cli"]
8
+ cliHelp: "bpmax-cli --help"
9
+ ---
10
+
11
+ # bpmax-cli 共享规则
12
+
13
+ 本 skill 负责所有 BPMAX CLI 场景的共用约束。进入任何 `bpmax-*` 业务 skill 前,先应用这里的规则。
14
+
15
+ ## 命令发现
16
+
17
+ 优先直接执行:
18
+
19
+ ```bash
20
+ bpmax-cli --help
21
+ ```
22
+
23
+ 若 shell 中找不到 `bpmax-cli`,再检查是否提供了 `BPMAX_CLI_HOME`。存在时,用构建产物回退执行:
24
+
25
+ ```bash
26
+ node "$BPMAX_CLI_HOME/dist/bin.js" --help
27
+ ```
28
+
29
+ 若 `dist/bin.js` 不存在,先构建:
30
+
31
+ ```bash
32
+ npm --prefix "$BPMAX_CLI_HOME" install
33
+ npm --prefix "$BPMAX_CLI_HOME" run build
34
+ ```
35
+
36
+ 后文默认直接写 `bpmax-cli`。若当前环境只能通过 `BPMAX_CLI_HOME` 调用,把所有命令前缀替换成:
37
+
38
+ ```bash
39
+ node "$BPMAX_CLI_HOME/dist/bin.js" ...
40
+ ```
41
+
42
+ ## 开始前检查
43
+
44
+ 任何 BPMAX CLI 场景都先做两步:
45
+
46
+ ```bash
47
+ bpmax-cli config profile show
48
+ bpmax-cli auth status
49
+ ```
50
+
51
+ 判定规则:
52
+
53
+ - 如果 profile 未配置,先走 `config profile add` 或 `config profile use`
54
+ - 如果当前 profile 没有可用 API Key,先走 `auth login`
55
+ - 如果用户明确指定环境,始终显式加 `--profile <name>`
56
+
57
+ ## 配置与环境
58
+
59
+ 多环境 profile 管理统一走这里:
60
+
61
+ ```bash
62
+ bpmax-cli config profile list
63
+ bpmax-cli config profile show
64
+ bpmax-cli config profile add --name test --origin https://example.com
65
+ bpmax-cli config profile use test
66
+ bpmax-cli config profile remove test
67
+ ```
68
+
69
+ 规则:
70
+
71
+ - `origin` 只填环境根地址,不带 `/api`
72
+ - 默认环境来自 `current_profile`
73
+ - 读到旧版 `~/.bpmax/config.json` 单环境格式时,CLI 会迁移为多 profile 结构
74
+
75
+ ## 全局参数
76
+
77
+ 所有子命令都优先考虑这些参数:
78
+
79
+ - `--profile <name>`:覆盖默认 profile
80
+ - `--format json|pretty|table|ndjson`:Agent 读取优先 `json`
81
+ - `--workspace <name>`:覆盖 profile 默认工作空间
82
+ - `--language <code>`:覆盖 profile 默认语言
83
+
84
+ 推荐规则:
85
+
86
+ - 需要给 Agent 做后续判断时,优先 `--format json`
87
+ - 面向用户概览可用 `--format table`
88
+ - 需要流式处理时再用 `--format ndjson`
89
+
90
+ ## 原始 API 降级
91
+
92
+ 只有 CLI shortcut 未覆盖时才使用:
93
+
94
+ ```bash
95
+ bpmax-cli api GET /user/current
96
+ bpmax-cli api POST /project/list --data '{}'
97
+ ```
98
+
99
+ 规则:
100
+
101
+ - 路径写 `/api/*` 之后的相对路径,例如 `/user/current`
102
+ - 优先使用已封装命令,不要在已有 shortcut 场景退化为原始请求
103
+ - 服务端报错时优先保留原文,避免二次包装丢信息
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: bpmax-user
3
+ version: 1.0.0
4
+ description: Use when the user needs to confirm the current BPMAX identity or inspect the authenticated current-user payload through bpmax-cli.
5
+ metadata:
6
+ requires:
7
+ bins: ["bpmax-cli"]
8
+ cliHelp: "bpmax-cli user --help"
9
+ ---
10
+
11
+ # user
12
+
13
+ > **前置条件:** 先阅读 `../bpmax-shared/SKILL.md`。
14
+
15
+ ## 命令
16
+
17
+ ```bash
18
+ bpmax-cli user current --format json
19
+ ```
20
+
21
+ ## 何时使用
22
+
23
+ - 用户想确认当前登录账号
24
+ - 要在执行其他 BPMAX 操作前验证身份
25
+ - 要检查某个 profile 实际连到哪个环境、哪个用户
26
+
27
+ ## 规则
28
+
29
+ - 默认优先 `--format json`
30
+ - 若只是判断登录是否生效,`user current` 比原始 `api GET /user/current` 更优先
31
+ - 若用户明确指定环境,显式加 `--profile <name>`