@ysicing/plane-cli 1.0.1 → 1.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/README.md CHANGED
@@ -1,28 +1,15 @@
1
1
  # plane-cli
2
2
 
3
- 基于 Plane 外部 API(`/api/v1`)的轻量命令行工具,使用 Node.js 原生能力实现,不依赖第三方包。
3
+ `plane-cli` 是一个基于 Plane 外部 API(`/api/v1`)的命令行工具,用于在终端中管理 workspace、project 和 work item(issue),并内置 Codex skill `plane`。
4
4
 
5
- 默认输出偏人类可读;如果要给脚本、Agent 或其他自动化系统消费,统一加 `--json`:
5
+ ## 特性
6
6
 
7
- ```bash
8
- plane workspace current
9
- plane workspace current --json
10
- plane issue get --project <project-id> <issue-id> --json
11
- ```
12
-
13
- ## 当前状态
14
-
15
- 这套 CLI 已经在真实 Plane 实例上做过 smoke 验证,当前重点覆盖:
16
-
17
- - 认证与 workspace 选择
18
- - `project` 的查询、创建、更新、成员管理、features 开关
19
- - `issue/work-item` 的查询、创建、更新
20
- - `issue` 的 labels、comments、activities、links、relations、attachments
21
-
22
- 适合:
23
-
24
- - 人类直接在终端里操作
25
- - Agent / 脚本通过 `--json` 消费结果
7
+ - 支持 API Key 配置与账号密码登录
8
+ - 支持多 workspace 选择与切换
9
+ - 支持人类可读输出与结构化 JSON 输出
10
+ - 支持 `project` 查询、创建、更新、成员管理、features 开关
11
+ - 支持 `issue` 查询、创建、更新、labels、comments、activities、links、relations、attachments
12
+ - 支持 `GAEA-25` 这类 issue key 自动解析
26
13
 
27
14
  ## 安装
28
15
 
@@ -30,104 +17,97 @@ plane issue get --project <project-id> <issue-id> --json
30
17
  npm install -g @ysicing/plane-cli
31
18
  ```
32
19
 
33
- 或直接用 `npx`:
20
+ 安装完成后可执行命令为:
34
21
 
35
22
  ```bash
36
- npx @ysicing/plane-cli --help
23
+ plane
37
24
  ```
38
25
 
39
- ## 约束
26
+ ## 环境要求
40
27
 
41
- - 鉴权方式:`X-Api-Key`
42
- - 默认面向 `project` 与 `work-item`
43
- - 暂不提供危险删除命令
28
+ - Node.js 22 或更高版本
44
29
 
45
- ## 要求
30
+ ## 输出格式
46
31
 
47
- - Node.js 22+
32
+ 默认输出为人类可读格式。
48
33
 
49
- ## 初始化
34
+ 如需供脚本、Agent 或流水线消费,可使用:
50
35
 
51
36
  ```bash
52
- node ./src/cli.js config set \
53
- --base-url https://plane.example.com \
54
- --api-key your-api-key \
55
- --workspace your-workspace-slug
56
- ```
57
-
58
- 也支持环境变量覆盖:
59
-
60
- ```bash
61
- export PLANE_BASE_URL=https://plane.example.com
62
- export PLANE_API_KEY=your-api-key
63
- export PLANE_WORKSPACE=your-workspace-slug
37
+ plane project ls --json
38
+ plane issue get GAEA-25 --format json
64
39
  ```
65
40
 
66
- ## 快速开始
41
+ ## 认证
67
42
 
68
- 如果已经有 API key,最短路径是:
43
+ ### 方式一:直接配置 API Key
69
44
 
70
45
  ```bash
71
46
  plane config set \
72
47
  --base-url https://plane.example.com \
73
48
  --api-key your-api-key \
74
49
  --workspace your-workspace-slug
75
-
76
- plane me
77
- plane project ls
78
50
  ```
79
51
 
80
- ## 登录并自动生成 API Token
52
+ 也可通过环境变量提供:
53
+
54
+ ```bash
55
+ export PLANE_BASE_URL=https://plane.example.com
56
+ export PLANE_API_KEY=your-api-key
57
+ export PLANE_WORKSPACE=your-workspace-slug
58
+ ```
81
59
 
82
- 普通账号密码登录:
60
+ ### 方式二:账号密码登录
83
61
 
84
62
  ```bash
85
- node ./src/cli.js auth login \
63
+ plane auth login \
86
64
  --base-url https://plane.example.com \
87
65
  --username you@example.com \
88
66
  --password 'your-password'
89
67
  ```
90
68
 
91
- LDAP 登录:
69
+ ### 方式三:LDAP 登录
92
70
 
93
71
  ```bash
94
- node ./src/cli.js auth login \
72
+ plane auth login \
95
73
  --base-url https://plane.example.com \
96
74
  --ldap \
97
- --username your-ldap-account \
75
+ --username your-ldap-user \
98
76
  --password 'your-password'
99
77
  ```
100
78
 
101
- 如果不想把密码放进命令行:
79
+ 如需避免在命令行中直接暴露密码:
102
80
 
103
81
  ```bash
104
- printf '%s' 'your-password' | node ./src/cli.js auth login \
82
+ printf '%s' 'your-password' | plane auth login \
105
83
  --base-url https://plane.example.com \
106
84
  --ldap \
107
- --username your-ldap-account \
85
+ --username your-ldap-user \
108
86
  --password-stdin
109
87
  ```
110
88
 
111
- 如果账号下有多个 workspace,且没有显式传 `--workspace`,CLI 会保存登录态生成的 API token,但不会自动选中 workspace。此时请先查看并选择:
89
+ ## Workspace 管理
90
+
91
+ 如账号下存在多个 workspace,建议先查看并选择默认 workspace:
112
92
 
113
93
  ```bash
114
- node ./src/cli.js workspace ls
115
- node ./src/cli.js workspace current
116
- node ./src/cli.js workspace use <slug>
94
+ plane workspace current
95
+ plane workspace ls
96
+ plane workspace use <slug>
117
97
  ```
118
98
 
119
- ## 常用命令
99
+ ## 命令概览
120
100
 
121
- ### Workspace
101
+ ### 基础命令
122
102
 
123
103
  ```bash
104
+ plane --help
124
105
  plane me
106
+ plane config list
125
107
  plane workspace current
126
- plane workspace ls
127
- plane workspace use <slug>
128
108
  ```
129
109
 
130
- ### Project
110
+ ### Project 命令
131
111
 
132
112
  ```bash
133
113
  plane project ls
@@ -143,111 +123,122 @@ plane project members ls --project <project-id>
143
123
  plane project members add --project <project-id> --member <user-id> --role member
144
124
 
145
125
  plane project features get <project-id>
146
- plane project features enable-all <project-id>
147
126
  plane project features set <project-id> --epics on --milestones on --auto-transition on
127
+ plane project features enable-all <project-id>
148
128
  ```
149
129
 
150
- ### Issue / Work Item
130
+ ### Issue / Work Item 命令
131
+
132
+ `work-item` 是 `issue` 的别名。
151
133
 
152
134
  ```bash
153
135
  plane issue ls --project <project-id>
154
136
  plane issue get --project <project-id> <issue-id>
155
- plane issue key DEMO-123
156
- plane issue get DEMO-123
137
+ plane issue get GAEA-25
138
+ plane issue key GAEA-25
157
139
  plane issue search --query login --workspace-search
158
140
 
159
141
  plane issue create --project <project-id> --name "First work item"
160
142
  plane issue update --project <project-id> <issue-id> --priority high
143
+ ```
144
+
145
+ ### Issue Labels
161
146
 
147
+ ```bash
162
148
  plane issue labels ls --project <project-id>
163
149
  plane issue labels create --project <project-id> --name backend --color '#ff6600'
150
+ ```
164
151
 
165
- plane issue comments ls --project <project-id> <issue-id>
166
- plane issue comments ls DEMO-123
167
- plane issue comments add --project <project-id> <issue-id> --html '<p>Need follow-up</p>'
168
- plane issue comments add DEMO-123 --html '<p>Need follow-up</p>'
169
- plane issue comments update --project <project-id> <issue-id> <comment-id> --html '<p>Updated</p>'
170
-
171
- plane issue activities ls --project <project-id> <issue-id>
172
- plane issue activities ls DEMO-123
152
+ ### Issue Comments
173
153
 
174
- plane issue links ls --project <project-id> <issue-id>
175
- plane issue links ls DEMO-123
176
- plane issue links add --project <project-id> <issue-id> --url 'https://example.com/doc'
177
- plane issue links update --project <project-id> <issue-id> <link-id> --url 'https://example.com/doc-v2'
154
+ ```bash
155
+ plane issue comments ls GAEA-25
156
+ plane issue comments add GAEA-25 --html '<p>Need follow-up</p>'
157
+ plane issue comments update GAEA-25 <comment-id> --html '<p>Updated</p>'
158
+ ```
178
159
 
179
- plane issue relations ls --project <project-id> <issue-id>
180
- plane issue relations ls DEMO-123
181
- plane issue relations add --project <project-id> <issue-id> --relation-type blocking --issues '<other-issue-id>'
160
+ ### Issue Activities
182
161
 
183
- plane issue attachments ls --project <project-id> <issue-id>
184
- plane issue attachments ls DEMO-123
185
- plane issue attachments upload --project <project-id> <issue-id> --file ./spec.pdf
162
+ ```bash
163
+ plane issue activities ls GAEA-25
186
164
  ```
187
165
 
188
- `work-item` `issue` 的别名:
166
+ ### Issue Links
189
167
 
190
168
  ```bash
191
- node ./src/cli.js work-item ls --project <project-id>
169
+ plane issue links ls GAEA-25
170
+ plane issue links add GAEA-25 --url 'https://example.com/doc'
171
+ plane issue links update GAEA-25 <link-id> --url 'https://example.com/doc-v2'
192
172
  ```
193
173
 
194
- ## AI / Agent 友好约定
174
+ ### Issue Relations
195
175
 
196
- - 默认输出是人类可读格式
197
- - `--json` `--format json` 后,成功结果和错误结果都会变成结构化 JSON
198
- - 参数缺失、workspace 未选择、API 返回错误时,都会带明确 `message`
176
+ ```bash
177
+ plane issue relations ls GAEA-25
178
+ plane issue relations add GAEA-25 --relation-type blocking --issues '<other-issue-id>'
179
+ ```
199
180
 
200
- 示例:
181
+ ### Issue Attachments
201
182
 
202
183
  ```bash
203
- plane issue get --project <project-id> <issue-id> --json
204
- plane project ls --json
184
+ plane issue attachments ls GAEA-25
185
+ plane issue attachments upload GAEA-25 --file ./spec.pdf
205
186
  ```
206
187
 
207
- ## 使用注意
208
-
209
- - 多 workspace 登录后,如果没有显式传 `--workspace`,CLI 不会自动替你选择默认 workspace。先执行 `plane workspace ls`,再执行 `plane workspace use <slug>`。
210
- - `issue create/update --assignees` 支持传用户 ID、邮箱、或精确全名。CLI 会先读取 workspace 成员再解析成后端需要的 member ID。
211
- - `project create` 带 `--project-lead` 和 `--default-assignee` 时,CLI 会自动采用“两段式创建”:先建项目,再补一次 update。这是为了兼容部分 Plane 实例的后端校验差异。
212
- - `project features set`、`issue attachments upload` 这类命令在真实实例上可能会遇到几秒钟的读副本延迟。写入成功后如果立刻回读不到,稍后再查一次通常即可。
213
- - 当前不提供危险删除命令,也不主动清理服务端 token。
188
+ ## 交互与参数约定
214
189
 
215
- ## 已验证命令
190
+ ### Issue Key 自动解析
216
191
 
217
- 在真实 Plane 实例上已验证:
192
+ 对于以下命令,若目标是已存在的 issue,可直接使用 `GAEA-25` 这类 key,而无需显式提供 `--project` 与 issue UUID:
218
193
 
219
- - `me`
220
- - `workspace current/ls/use`
221
- - `project ls/get/summary/create/update`
222
- - `project members workspace/ls/add`
223
- - `project features get/set/enable-all`
224
- - `issue ls/get/key/search/create/update`
225
- - `issue labels ls/create`
194
+ - `issue get`
226
195
  - `issue comments ls/add/update`
227
196
  - `issue activities ls`
228
197
  - `issue links ls/add/update`
229
198
  - `issue relations ls/add`
230
199
  - `issue attachments ls/upload`
231
200
 
232
- ## 发布
201
+ ### 指定 Assignee
202
+
203
+ `issue create` 与 `issue update` 的 `--assignees` 支持以下输入形式:
204
+
205
+ - 用户 ID
206
+ - 邮箱
207
+ - 精确全名
208
+
209
+ CLI 会自动根据 workspace 成员列表解析为后端所需的 member ID。
233
210
 
234
- 当前包名使用 `@ysicing/plane-cli`,因为 `plane-cli` 已被 npm 占用。
211
+ ## Help 体系
235
212
 
236
- 发布前检查:
213
+ 支持以下层级的帮助信息:
237
214
 
238
215
  ```bash
239
- npm test
240
- npm run pack:check
216
+ plane -h
217
+ plane project -h
218
+ plane project features set --help
219
+ plane issue comments add --help
220
+ plane issue attachments upload --help
241
221
  ```
242
222
 
243
- 发布:
223
+ ## 限制说明
224
+
225
+ - 当前不提供危险删除命令
226
+ - 当前不自动回收服务端 API Token
227
+ - `project members ls` 受限于 Plane `api/v1` 返回结构,仅返回用户资料,不包含完整的 `ProjectMember` 记录字段
228
+ - `project create` 在部分 Plane 实例上对 `project_lead/default_assignee` 的校验较严格,CLI 已采用“两段式创建”兼容该行为
229
+ - `project features set`、`issue attachments upload` 在启用读副本的实例上,可能存在短暂回读延迟
230
+
231
+ ## 发布
232
+
233
+ 当前包名为 `@ysicing/plane-cli`。发布前建议执行:
244
234
 
245
235
  ```bash
246
- npm publish
236
+ npm test
237
+ npm run pack:check
247
238
  ```
248
239
 
249
- 如果本机还没登录 npm:
240
+ 发布:
250
241
 
251
242
  ```bash
252
- npm login
243
+ npm publish
253
244
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ysicing/plane-cli",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Node.js CLI for managing Plane via the external API",
6
6
  "license": "UNLICENSED",
@@ -21,7 +21,9 @@
21
21
  ],
22
22
  "files": [
23
23
  "src",
24
- "README.md"
24
+ "README.md",
25
+ "skills",
26
+ "scripts"
25
27
  ],
26
28
  "bin": {
27
29
  "plane": "./src/cli.js"
@@ -31,6 +33,7 @@
31
33
  "registry": "https://registry.npmjs.org/"
32
34
  },
33
35
  "scripts": {
36
+ "postinstall": "node ./scripts/install-skills.js",
34
37
  "start": "node ./src/cli.js",
35
38
  "test": "node --test",
36
39
  "pack:check": "npm pack --dry-run",
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { cp, mkdir, readdir } from "node:fs/promises";
4
+ import { existsSync } from "node:fs";
5
+ import { dirname, join } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+
10
+ export function resolveCodexHome() {
11
+ if (process.env.CODEX_HOME) {
12
+ return process.env.CODEX_HOME;
13
+ }
14
+ const home = process.env.HOME || process.env.USERPROFILE;
15
+ if (!home) {
16
+ throw new Error("Cannot resolve home directory for Codex skill installation.");
17
+ }
18
+ return join(home, ".codex");
19
+ }
20
+
21
+ export async function installBundledSkills({
22
+ sourceRoot = join(__dirname, "..", "skills"),
23
+ targetRoot = join(resolveCodexHome(), "skills"),
24
+ } = {}) {
25
+ if (!existsSync(sourceRoot)) {
26
+ return { installed: [] };
27
+ }
28
+
29
+ await mkdir(targetRoot, { recursive: true });
30
+ const entries = await readdir(sourceRoot, { withFileTypes: true });
31
+ const installed = [];
32
+
33
+ for (const entry of entries) {
34
+ if (!entry.isDirectory()) continue;
35
+ const sourcePath = join(sourceRoot, entry.name);
36
+ const targetPath = join(targetRoot, entry.name);
37
+ await cp(sourcePath, targetPath, { recursive: true, force: true });
38
+ installed.push(entry.name);
39
+ }
40
+
41
+ return { installed, targetRoot };
42
+ }
43
+
44
+ async function main() {
45
+ if (process.env.PLANE_CLI_SKIP_SKILL_INSTALL === "1") {
46
+ return;
47
+ }
48
+
49
+ try {
50
+ const result = await installBundledSkills();
51
+ if (result.installed.length > 0) {
52
+ console.log(`plane-cli: installed Codex skills -> ${result.installed.join(", ")}`);
53
+ }
54
+ } catch (error) {
55
+ console.warn(`plane-cli: failed to install Codex skills: ${error.message}`);
56
+ }
57
+ }
58
+
59
+ if (process.argv[1] === fileURLToPath(import.meta.url)) {
60
+ await main();
61
+ }
@@ -0,0 +1,231 @@
1
+ ---
2
+ name: plane
3
+ description: 管理 Plane 工作项与项目能力。当用户提到工作项标识(如 GAEA-30)或需要查询/维护 Plane 项目、工作项、评论、链接、关系、附件、成员、features 时使用。
4
+ ---
5
+
6
+ # Plane Skill
7
+
8
+ 通过本机安装的 `plane` 命令管理 Plane。
9
+
10
+ ## 严格要求
11
+
12
+ - 优先使用 `plane` 命令,不要手写 curl 直接调 Plane API
13
+ - 自动化消费结果时,优先加 `--json`
14
+ - 用户消息中只要出现工作项标识(如 `GAEA-30`、`TEST-12`),优先先查询该工作项
15
+ - 如果提交代码,commit message 必须包含工作项标识与工时,格式:
16
+
17
+ ```text
18
+ <type>(scope): <summary> #<工作项标识> Cost:<工时>
19
+ ```
20
+
21
+ 示例:
22
+
23
+ ```text
24
+ feat(cli): 完善 issue 链接管理 #GAEA-30 Cost:30m
25
+ ```
26
+
27
+ ## 意图判断
28
+
29
+ 用户提到:
30
+
31
+ - `GAEA-30`、`TEST-12`、`OPS-7` 这类标识
32
+ - 工作项 / issue / work item
33
+ - 项目 / project
34
+ - 标签 / label
35
+ - 评论 / comment
36
+ - 活动 / activity
37
+ - 链接 / link
38
+ - 关系 / relation
39
+ - 附件 / attachment
40
+ - 成员 / members
41
+ - features / 自动化开关
42
+
43
+ 则应优先考虑使用本技能。
44
+
45
+ ## 触发规则
46
+
47
+ ### 1. 工作项标识触发
48
+
49
+ 如果用户消息中直接提到工作项标识,默认先查详情:
50
+
51
+ ```bash
52
+ plane issue get GAEA-30 --json
53
+ ```
54
+
55
+ 如果需要继续操作,沿用同一个 key:
56
+
57
+ ```bash
58
+ plane issue comments ls GAEA-30 --json
59
+ plane issue links add GAEA-30 --url 'https://example.com/doc' --json
60
+ plane issue attachments upload GAEA-30 --file ./spec.pdf --json
61
+ ```
62
+
63
+ ### 2. 多 workspace 场景
64
+
65
+ 如果账号下存在多个 workspace,先确认当前 workspace:
66
+
67
+ ```bash
68
+ plane workspace current
69
+ plane workspace ls
70
+ plane workspace use <slug>
71
+ ```
72
+
73
+ ### 3. 代码提交场景
74
+
75
+ 如果当前任务涉及代码实现、修复、重构、测试补充,并且要提交代码,则 commit message 使用:
76
+
77
+ ```text
78
+ <type>(scope): <summary> #GAEA-30 Cost:30m
79
+ ```
80
+
81
+ 细化规则如下:
82
+
83
+ - 只有在**实际提交代码**时才追加 `#<工作项标识> Cost:<工时>`
84
+ - 若本次改动没有明确工作项标识,则不要伪造工作项标识
85
+ - 若本次改动明确只对应一个工作项,则追加一个标识:
86
+
87
+ ```text
88
+ feat(cli): 完善 issue 链接管理 #GAEA-30 Cost:30m
89
+ ```
90
+
91
+ - 若本次改动同时覆盖多个工作项,优先拆分为多个提交;若确实只能一次提交,则在同一条 commit message 末尾顺序追加多个标识:
92
+
93
+ ```text
94
+ refactor(cli): 收敛 issue 帮助信息 #GAEA-30 Cost:20m #GAEA-31 Cost:15m
95
+ ```
96
+
97
+ - `type(scope): summary` 仍然遵循仓库原有提交规范,工作项信息只是追加在末尾,不替代原规范
98
+ - `type` 建议使用:`feat` / `fix` / `refactor` / `docs` / `test` / `chore`
99
+ - `scope` 尽量使用实际改动范围,如:`cli`、`issue`、`project`、`config`
100
+ - `summary` 使用简洁中文动词短句,不加句号
101
+ - `Cost` 使用**本次提交对应工作项的实际处理耗时**,可使用小时、分钟,或小时+分钟组合,推荐格式:
102
+
103
+ ```text
104
+ Cost:30m
105
+ Cost:2h
106
+ Cost:1h30m
107
+ ```
108
+
109
+ - 若某个单位值为 0,则该单位不写。例如:
110
+
111
+ ```text
112
+ 30 分钟写成:Cost:30m
113
+ 2 小时写成:Cost:2h
114
+ 1 小时 30 分钟写成:Cost:1h30m
115
+ ```
116
+
117
+ - `Cost` 不写小数,不写中文单位,例如以下都不推荐:
118
+
119
+ ```text
120
+ Cost:0.5h
121
+ Cost:30分钟
122
+ Cost:0h30m
123
+ Cost:1h0m
124
+ Cost:0h0m
125
+ ```
126
+
127
+ - 如果本次只是查询、分析、讨论,且**没有提交代码**,不要附加该标记
128
+
129
+ ## 高频命令
130
+
131
+ ### 基础
132
+
133
+ ```bash
134
+ plane me
135
+ plane workspace current
136
+ plane workspace ls
137
+ plane workspace use <slug>
138
+ plane config list
139
+ ```
140
+
141
+ ### Project
142
+
143
+ ```bash
144
+ plane project ls --json
145
+ plane project get <project-id> --json
146
+ plane project summary <project-id> --json
147
+ plane project create --name Demo --identifier DEMO --json
148
+ plane project update <project-id> --description 'updated description' --json
149
+ plane project members workspace --json
150
+ plane project members ls --project <project-id> --json
151
+ plane project members add --project <project-id> --member <user-id> --role member --json
152
+ plane project features get <project-id> --json
153
+ plane project features set <project-id> --epics on --milestones on --auto-transition on --json
154
+ ```
155
+
156
+ ### Issue / Work Item
157
+
158
+ ```bash
159
+ plane issue ls --project <project-id> --json
160
+ plane issue get GAEA-30 --json
161
+ plane issue key GAEA-30 --json
162
+ plane issue search --query login --workspace-search --json
163
+ plane issue create --project <project-id> --name "First work item" --json
164
+ plane issue update --project <project-id> <issue-id> --priority high --json
165
+ ```
166
+
167
+ ### Labels / Comments / Activities
168
+
169
+ ```bash
170
+ plane issue labels ls --project <project-id> --json
171
+ plane issue labels create --project <project-id> --name backend --color '#ff6600' --json
172
+
173
+ plane issue comments ls GAEA-30 --json
174
+ plane issue comments add GAEA-30 --html '<p>Need follow-up</p>' --json
175
+ plane issue comments update GAEA-30 <comment-id> --html '<p>Updated</p>' --json
176
+
177
+ plane issue activities ls GAEA-30 --json
178
+ ```
179
+
180
+ ### Links / Relations / Attachments
181
+
182
+ ```bash
183
+ plane issue links ls GAEA-30 --json
184
+ plane issue links add GAEA-30 --url 'https://example.com/doc' --json
185
+ plane issue links update GAEA-30 <link-id> --url 'https://example.com/doc-v2' --json
186
+
187
+ plane issue relations ls GAEA-30 --json
188
+ plane issue relations add GAEA-30 --relation-type blocking --issues '<other-issue-id>' --json
189
+
190
+ plane issue attachments ls GAEA-30 --json
191
+ plane issue attachments upload GAEA-30 --file ./spec.pdf --json
192
+ ```
193
+
194
+ ## 参数规则
195
+
196
+ ### 指定 Assignee
197
+
198
+ `issue create` 与 `issue update` 的 `--assignees` 支持:
199
+
200
+ - 用户 ID
201
+ - 邮箱
202
+ - 精确全名
203
+
204
+ 如需查看可分配成员:
205
+
206
+ ```bash
207
+ plane project members workspace --json
208
+ ```
209
+
210
+ ### Issue Key 自动解析
211
+
212
+ 以下命令支持直接使用 `GAEA-30` 这类 key,而无需显式传 `--project`:
213
+
214
+ - `issue get`
215
+ - `issue comments ls/add/update`
216
+ - `issue activities ls`
217
+ - `issue links ls/add/update`
218
+ - `issue relations ls/add`
219
+ - `issue attachments ls/upload`
220
+
221
+ ## 输出约定
222
+
223
+ - 人类阅读:默认输出
224
+ - 机器消费:`--json`
225
+ - 当命令失败时,`--json` 返回结构化错误对象
226
+
227
+ ## 限制
228
+
229
+ - 默认不提供危险删除命令
230
+ - `project members ls` 受 Plane 外部 API 返回结构限制,仅稳定返回用户资料
231
+ - 某些写操作在启用读副本的实例上,可能存在短暂回读延迟
@@ -21,6 +21,19 @@ function printHelp() {
21
21
  `);
22
22
  }
23
23
 
24
+ function printGetHelp() {
25
+ console.log(`Usage:
26
+ plane config get
27
+ plane config get <baseUrl|apiKey|workspace|knownWorkspaces>
28
+ `);
29
+ }
30
+
31
+ function printSetHelp() {
32
+ console.log(`Usage:
33
+ plane config set [--base-url <url>] [--api-key <key>] [--workspace <slug>]
34
+ `);
35
+ }
36
+
24
37
  export async function runConfigCommand(args, context) {
25
38
  const [subcommand = "list", ...rest] = args;
26
39
  const path = resolveConfigPath();
@@ -38,7 +51,7 @@ export async function runConfigCommand(args, context) {
38
51
 
39
52
  if (subcommand === "get") {
40
53
  if (rest.includes("--help") || rest.includes("-h") || rest.includes("help")) {
41
- printHelp();
54
+ printGetHelp();
42
55
  return;
43
56
  }
44
57
 
@@ -61,7 +74,7 @@ export async function runConfigCommand(args, context) {
61
74
 
62
75
  if (subcommand === "set") {
63
76
  if (rest.includes("--help") || rest.includes("-h") || rest.includes("help")) {
64
- printHelp();
77
+ printSetHelp();
65
78
  return;
66
79
  }
67
80
 
@@ -295,6 +295,108 @@ function printHelp() {
295
295
  `);
296
296
  }
297
297
 
298
+ function printIssueCommentsHelp() {
299
+ console.log(`Usage:
300
+ plane issue comments ls --project <project-id> <issue-id>
301
+ plane issue comments ls GAEA-25
302
+ plane issue comments add --project <project-id> <issue-id> --html '<p>comment</p>' [--access <value>]
303
+ plane issue comments add GAEA-25 --html '<p>comment</p>' [--access <value>]
304
+ plane issue comments update --project <project-id> <issue-id> <comment-id> --html '<p>comment</p>' [--access <value>]
305
+ plane issue comments update GAEA-25 <comment-id> --html '<p>comment</p>' [--access <value>]
306
+ `);
307
+ }
308
+
309
+ function printIssueLinksHelp() {
310
+ console.log(`Usage:
311
+ plane issue links ls --project <project-id> <issue-id>
312
+ plane issue links ls GAEA-25
313
+ plane issue links add --project <project-id> <issue-id> --url <url> [--title <text>]
314
+ plane issue links add GAEA-25 --url <url> [--title <text>]
315
+ plane issue links update --project <project-id> <issue-id> <link-id> --url <url> [--title <text>]
316
+ plane issue links update GAEA-25 <link-id> --url <url> [--title <text>]
317
+ `);
318
+ }
319
+
320
+ function printIssueRelationsHelp() {
321
+ console.log(`Usage:
322
+ plane issue relations ls --project <project-id> <issue-id>
323
+ plane issue relations ls GAEA-25
324
+ plane issue relations add --project <project-id> <issue-id> --relation-type <blocking|blocked_by|duplicate|relates_to|start_before|start_after|finish_before|finish_after> --issues <id1,id2>
325
+ plane issue relations add GAEA-25 --relation-type <blocking|blocked_by|duplicate|relates_to|start_before|start_after|finish_before|finish_after> --issues <id1,id2>
326
+ `);
327
+ }
328
+
329
+ function printIssueAttachmentsHelp() {
330
+ console.log(`Usage:
331
+ plane issue attachments ls --project <project-id> <issue-id>
332
+ plane issue attachments ls GAEA-25
333
+ plane issue attachments upload --project <project-id> <issue-id> --file <path> [--name <filename>] [--type <mime>]
334
+ plane issue attachments upload GAEA-25 --file <path> [--name <filename>] [--type <mime>]
335
+ `);
336
+ }
337
+
338
+ function printIssueActivitiesHelp() {
339
+ console.log(`Usage:
340
+ plane issue activities ls --project <project-id> <issue-id>
341
+ plane issue activities ls GAEA-25
342
+ `);
343
+ }
344
+
345
+ function printIssueLabelsHelp() {
346
+ console.log(`Usage:
347
+ plane issue labels ls --project <project-id>
348
+ plane issue labels create --project <project-id> --name <name> [--color <hex>] [--description <text>] [--parent <label-id>] [--sort-order <n>]
349
+ `);
350
+ }
351
+
352
+ function printIssueLabelsCreateHelp() {
353
+ console.log(`Usage:
354
+ plane issue labels create --project <project-id> --name <name> [--color <hex>] [--description <text>] [--parent <label-id>] [--sort-order <n>]
355
+ `);
356
+ }
357
+
358
+ function printIssueCommentsAddHelp() {
359
+ console.log(`Usage:
360
+ plane issue comments add --project <project-id> <issue-id> --html '<p>comment</p>' [--access <value>]
361
+ plane issue comments add GAEA-25 --html '<p>comment</p>' [--access <value>]
362
+ `);
363
+ }
364
+
365
+ function printIssueCommentsUpdateHelp() {
366
+ console.log(`Usage:
367
+ plane issue comments update --project <project-id> <issue-id> <comment-id> --html '<p>comment</p>' [--access <value>]
368
+ plane issue comments update GAEA-25 <comment-id> --html '<p>comment</p>' [--access <value>]
369
+ `);
370
+ }
371
+
372
+ function printIssueLinksAddHelp() {
373
+ console.log(`Usage:
374
+ plane issue links add --project <project-id> <issue-id> --url <url> [--title <text>]
375
+ plane issue links add GAEA-25 --url <url> [--title <text>]
376
+ `);
377
+ }
378
+
379
+ function printIssueLinksUpdateHelp() {
380
+ console.log(`Usage:
381
+ plane issue links update --project <project-id> <issue-id> <link-id> --url <url> [--title <text>]
382
+ plane issue links update GAEA-25 <link-id> --url <url> [--title <text>]
383
+ `);
384
+ }
385
+
386
+ function printIssueRelationsAddHelp() {
387
+ console.log(`Usage:
388
+ plane issue relations add --project <project-id> <issue-id> --relation-type <blocking|blocked_by|duplicate|relates_to|start_before|start_after|finish_before|finish_after> --issues <id1,id2>
389
+ plane issue relations add GAEA-25 --relation-type <blocking|blocked_by|duplicate|relates_to|start_before|start_after|finish_before|finish_after> --issues <id1,id2>
390
+ `);
391
+ }
392
+
393
+ function printIssueAttachmentsUploadHelp() {
394
+ console.log(`Usage:
395
+ plane issue attachments upload --project <project-id> <issue-id> --file <path> [--name <filename>] [--type <mime>]
396
+ plane issue attachments upload GAEA-25 --file <path> [--name <filename>] [--type <mime>]
397
+ `);
398
+ }
399
+
298
400
  async function runIssueLabelsCommand(issueClient, args, context) {
299
401
  const [subcommand, ...rest] = args;
300
402
 
@@ -304,7 +406,11 @@ async function runIssueLabelsCommand(issueClient, args, context) {
304
406
  }
305
407
 
306
408
  if (hasHelpFlag(rest)) {
307
- printHelp();
409
+ if (subcommand === "create") {
410
+ printIssueLabelsCreateHelp();
411
+ return;
412
+ }
413
+ printIssueLabelsHelp();
308
414
  return;
309
415
  }
310
416
 
@@ -368,7 +474,15 @@ async function runIssueCommentsCommand(issueClient, args, context) {
368
474
  }
369
475
 
370
476
  if (hasHelpFlag(rest)) {
371
- printHelp();
477
+ if (subcommand === "add") {
478
+ printIssueCommentsAddHelp();
479
+ return;
480
+ }
481
+ if (subcommand === "update") {
482
+ printIssueCommentsUpdateHelp();
483
+ return;
484
+ }
485
+ printIssueCommentsHelp();
372
486
  return;
373
487
  }
374
488
 
@@ -459,7 +573,7 @@ async function runIssueActivitiesCommand(issueClient, args, context) {
459
573
  }
460
574
 
461
575
  if (hasHelpFlag(rest)) {
462
- printHelp();
576
+ printIssueActivitiesHelp();
463
577
  return;
464
578
  }
465
579
 
@@ -503,7 +617,15 @@ async function runIssueLinksCommand(issueClient, args, context) {
503
617
  }
504
618
 
505
619
  if (hasHelpFlag(rest)) {
506
- printHelp();
620
+ if (subcommand === "add") {
621
+ printIssueLinksAddHelp();
622
+ return;
623
+ }
624
+ if (subcommand === "update") {
625
+ printIssueLinksUpdateHelp();
626
+ return;
627
+ }
628
+ printIssueLinksHelp();
507
629
  return;
508
630
  }
509
631
 
@@ -583,7 +705,11 @@ async function runIssueRelationsCommand(issueClient, args, context) {
583
705
  }
584
706
 
585
707
  if (hasHelpFlag(rest)) {
586
- printHelp();
708
+ if (subcommand === "add") {
709
+ printIssueRelationsAddHelp();
710
+ return;
711
+ }
712
+ printIssueRelationsHelp();
587
713
  return;
588
714
  }
589
715
 
@@ -660,7 +786,11 @@ async function runIssueAttachmentsCommand(issueClient, args, context) {
660
786
  }
661
787
 
662
788
  if (hasHelpFlag(rest)) {
663
- printHelp();
789
+ if (subcommand === "upload") {
790
+ printIssueAttachmentsUploadHelp();
791
+ return;
792
+ }
793
+ printIssueAttachmentsHelp();
664
794
  return;
665
795
  }
666
796
 
@@ -739,6 +869,30 @@ export async function runIssueCommand(args, context) {
739
869
  }
740
870
 
741
871
  if (hasHelpFlag(rest)) {
872
+ if (subcommand === "labels") {
873
+ printIssueLabelsHelp();
874
+ return;
875
+ }
876
+ if (subcommand === "comments") {
877
+ printIssueCommentsHelp();
878
+ return;
879
+ }
880
+ if (subcommand === "activities") {
881
+ printIssueActivitiesHelp();
882
+ return;
883
+ }
884
+ if (subcommand === "links") {
885
+ printIssueLinksHelp();
886
+ return;
887
+ }
888
+ if (subcommand === "relations") {
889
+ printIssueRelationsHelp();
890
+ return;
891
+ }
892
+ if (subcommand === "attachments") {
893
+ printIssueAttachmentsHelp();
894
+ return;
895
+ }
742
896
  printHelp();
743
897
  return;
744
898
  }
@@ -129,6 +129,46 @@ function printHelp() {
129
129
  `);
130
130
  }
131
131
 
132
+ function printProjectMembersHelp() {
133
+ console.log(`Usage:
134
+ plane project members ls --project <project-id>
135
+ plane project members workspace
136
+ plane project members add --project <project-id> --member <user-id> --role <admin|member|guest>
137
+ `);
138
+ }
139
+
140
+ function printProjectMembersAddHelp() {
141
+ console.log(`Usage:
142
+ plane project members add --project <project-id> --member <user-id> --role <admin|member|guest>
143
+ `);
144
+ }
145
+
146
+ function printProjectFeaturesHelp() {
147
+ console.log(`Usage:
148
+ plane project features get <project-id>
149
+ plane project features set <project-id> [--issue-types on|off] [--epics on|off] [--milestones on|off] [--time-tracking on|off] [--auto-transition on|off] [--auto-assign on|off] [--auto-worklog on|off] [--require-worklog-before-completion on|off]
150
+ plane project features enable-all <project-id>
151
+ `);
152
+ }
153
+
154
+ function printProjectFeaturesSetHelp() {
155
+ console.log(`Usage:
156
+ plane project features set <project-id> [--issue-types on|off] [--epics on|off] [--milestones on|off] [--time-tracking on|off] [--auto-transition on|off] [--auto-assign on|off] [--auto-worklog on|off] [--require-worklog-before-completion on|off]
157
+ `);
158
+ }
159
+
160
+ function printProjectCreateHelp() {
161
+ console.log(`Usage:
162
+ plane project create --name <name> --identifier <identifier> [--description <text>] [--project-lead <user-id>] [--default-assignee <user-id>]
163
+ `);
164
+ }
165
+
166
+ function printProjectUpdateHelp() {
167
+ console.log(`Usage:
168
+ plane project update <project-id> [--name <name>] [--identifier <identifier>] [--description <text>] [--project-lead <user-id>] [--default-assignee <user-id>]
169
+ `);
170
+ }
171
+
132
172
  async function runProjectMembersCommand(projectClient, args, context) {
133
173
  const [subcommand, ...rest] = args;
134
174
 
@@ -138,7 +178,11 @@ async function runProjectMembersCommand(projectClient, args, context) {
138
178
  }
139
179
 
140
180
  if (hasHelpFlag(rest)) {
141
- printHelp();
181
+ if (subcommand === "add") {
182
+ printProjectMembersAddHelp();
183
+ return;
184
+ }
185
+ printProjectMembersHelp();
142
186
  return;
143
187
  }
144
188
 
@@ -204,7 +248,11 @@ async function runProjectFeaturesCommand(projectClient, args, context) {
204
248
  }
205
249
 
206
250
  if (hasHelpFlag(rest)) {
207
- printHelp();
251
+ if (subcommand === "set") {
252
+ printProjectFeaturesSetHelp();
253
+ return;
254
+ }
255
+ printProjectFeaturesHelp();
208
256
  return;
209
257
  }
210
258
 
@@ -290,6 +338,22 @@ export async function runProjectCommand(args, context) {
290
338
  }
291
339
 
292
340
  if (hasHelpFlag(rest)) {
341
+ if (subcommand === "members") {
342
+ printProjectMembersHelp();
343
+ return;
344
+ }
345
+ if (subcommand === "features") {
346
+ printProjectFeaturesHelp();
347
+ return;
348
+ }
349
+ if (subcommand === "create") {
350
+ printProjectCreateHelp();
351
+ return;
352
+ }
353
+ if (subcommand === "update") {
354
+ printProjectUpdateHelp();
355
+ return;
356
+ }
293
357
  printHelp();
294
358
  return;
295
359
  }