@ysicing/plane-cli 1.0.2 → 1.1.1
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 +1 -1
- package/package.json +5 -2
- package/scripts/install-skills.js +61 -0
- package/skills/plane/SKILL.md +232 -0
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ysicing/plane-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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,232 @@
|
|
|
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
|
+
- 工作项标识在 commit message 中必须写成 `#GAEA-30`、`#TEST-12` 这种形式,不能省略 `#`
|
|
86
|
+
- 若本次改动明确只对应一个工作项,则追加一个标识:
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
feat(cli): 完善 issue 链接管理 #GAEA-30 Cost:30m
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
- 若本次改动同时覆盖多个工作项,优先拆分为多个提交;若确实只能一次提交,则在同一条 commit message 末尾顺序追加多个标识:
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
refactor(cli): 收敛 issue 帮助信息 #GAEA-30 Cost:20m #GAEA-31 Cost:15m
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- `type(scope): summary` 仍然遵循仓库原有提交规范,工作项信息只是追加在末尾,不替代原规范
|
|
99
|
+
- `type` 建议使用:`feat` / `fix` / `refactor` / `docs` / `test` / `chore`
|
|
100
|
+
- `scope` 尽量使用实际改动范围,如:`cli`、`issue`、`project`、`config`
|
|
101
|
+
- `summary` 使用简洁中文动词短句,不加句号
|
|
102
|
+
- `Cost` 使用**本次提交对应工作项的实际处理耗时**,可使用小时、分钟,或小时+分钟组合,推荐格式:
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
Cost:30m
|
|
106
|
+
Cost:2h
|
|
107
|
+
Cost:1h30m
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
- 若某个单位值为 0,则该单位不写。例如:
|
|
111
|
+
|
|
112
|
+
```text
|
|
113
|
+
30 分钟写成:Cost:30m
|
|
114
|
+
2 小时写成:Cost:2h
|
|
115
|
+
1 小时 30 分钟写成:Cost:1h30m
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
- `Cost` 不写小数,不写中文单位,例如以下都不推荐:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
Cost:0.5h
|
|
122
|
+
Cost:30分钟
|
|
123
|
+
Cost:0h30m
|
|
124
|
+
Cost:1h0m
|
|
125
|
+
Cost:0h0m
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- 如果本次只是查询、分析、讨论,且**没有提交代码**,不要附加该标记
|
|
129
|
+
|
|
130
|
+
## 高频命令
|
|
131
|
+
|
|
132
|
+
### 基础
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
plane me
|
|
136
|
+
plane workspace current
|
|
137
|
+
plane workspace ls
|
|
138
|
+
plane workspace use <slug>
|
|
139
|
+
plane config list
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Project
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
plane project ls --json
|
|
146
|
+
plane project get <project-id> --json
|
|
147
|
+
plane project summary <project-id> --json
|
|
148
|
+
plane project create --name Demo --identifier DEMO --json
|
|
149
|
+
plane project update <project-id> --description 'updated description' --json
|
|
150
|
+
plane project members workspace --json
|
|
151
|
+
plane project members ls --project <project-id> --json
|
|
152
|
+
plane project members add --project <project-id> --member <user-id> --role member --json
|
|
153
|
+
plane project features get <project-id> --json
|
|
154
|
+
plane project features set <project-id> --epics on --milestones on --auto-transition on --json
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Issue / Work Item
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
plane issue ls --project <project-id> --json
|
|
161
|
+
plane issue get GAEA-30 --json
|
|
162
|
+
plane issue key GAEA-30 --json
|
|
163
|
+
plane issue search --query login --workspace-search --json
|
|
164
|
+
plane issue create --project <project-id> --name "First work item" --json
|
|
165
|
+
plane issue update --project <project-id> <issue-id> --priority high --json
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Labels / Comments / Activities
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
plane issue labels ls --project <project-id> --json
|
|
172
|
+
plane issue labels create --project <project-id> --name backend --color '#ff6600' --json
|
|
173
|
+
|
|
174
|
+
plane issue comments ls GAEA-30 --json
|
|
175
|
+
plane issue comments add GAEA-30 --html '<p>Need follow-up</p>' --json
|
|
176
|
+
plane issue comments update GAEA-30 <comment-id> --html '<p>Updated</p>' --json
|
|
177
|
+
|
|
178
|
+
plane issue activities ls GAEA-30 --json
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Links / Relations / Attachments
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
plane issue links ls GAEA-30 --json
|
|
185
|
+
plane issue links add GAEA-30 --url 'https://example.com/doc' --json
|
|
186
|
+
plane issue links update GAEA-30 <link-id> --url 'https://example.com/doc-v2' --json
|
|
187
|
+
|
|
188
|
+
plane issue relations ls GAEA-30 --json
|
|
189
|
+
plane issue relations add GAEA-30 --relation-type blocking --issues '<other-issue-id>' --json
|
|
190
|
+
|
|
191
|
+
plane issue attachments ls GAEA-30 --json
|
|
192
|
+
plane issue attachments upload GAEA-30 --file ./spec.pdf --json
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## 参数规则
|
|
196
|
+
|
|
197
|
+
### 指定 Assignee
|
|
198
|
+
|
|
199
|
+
`issue create` 与 `issue update` 的 `--assignees` 支持:
|
|
200
|
+
|
|
201
|
+
- 用户 ID
|
|
202
|
+
- 邮箱
|
|
203
|
+
- 精确全名
|
|
204
|
+
|
|
205
|
+
如需查看可分配成员:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
plane project members workspace --json
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Issue Key 自动解析
|
|
212
|
+
|
|
213
|
+
以下命令支持直接使用 `GAEA-30` 这类 key,而无需显式传 `--project`:
|
|
214
|
+
|
|
215
|
+
- `issue get`
|
|
216
|
+
- `issue comments ls/add/update`
|
|
217
|
+
- `issue activities ls`
|
|
218
|
+
- `issue links ls/add/update`
|
|
219
|
+
- `issue relations ls/add`
|
|
220
|
+
- `issue attachments ls/upload`
|
|
221
|
+
|
|
222
|
+
## 输出约定
|
|
223
|
+
|
|
224
|
+
- 人类阅读:默认输出
|
|
225
|
+
- 机器消费:`--json`
|
|
226
|
+
- 当命令失败时,`--json` 返回结构化错误对象
|
|
227
|
+
|
|
228
|
+
## 限制
|
|
229
|
+
|
|
230
|
+
- 默认不提供危险删除命令
|
|
231
|
+
- `project members ls` 受 Plane 外部 API 返回结构限制,仅稳定返回用户资料
|
|
232
|
+
- 某些写操作在启用读副本的实例上,可能存在短暂回读延迟
|