@ysicing/plane-cli 1.0.2 → 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,6 +1,6 @@
1
1
  # plane-cli
2
2
 
3
- `plane-cli` 是一个基于 Plane 外部 API(`/api/v1`)的命令行工具,用于在终端中管理 workspace、project 和 work item(issue)。
3
+ `plane-cli` 是一个基于 Plane 外部 API(`/api/v1`)的命令行工具,用于在终端中管理 workspace、project 和 work item(issue),并内置 Codex skill `plane`。
4
4
 
5
5
  ## 特性
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ysicing/plane-cli",
3
- "version": "1.0.2",
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
+ - 某些写操作在启用读副本的实例上,可能存在短暂回读延迟