@comate/zulu 1.1.0 → 1.2.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 +8 -0
- package/comate-engine/assets/skills/auto-commit/SKILL.md +386 -0
- package/comate-engine/assets/skills/auto-commit/references/issue_type_mapping.json +19 -0
- package/comate-engine/assets/skills/auto-commit/references/new_version_instruction.md +196 -0
- package/comate-engine/assets/skills/auto-commit/references/old_version_instruction.md +189 -0
- package/comate-engine/assets/skills/auto-commit/references/query_reference.md +176 -0
- package/comate-engine/assets/skills/auto-commit/scripts/compat.py +86 -0
- package/comate-engine/assets/skills/auto-commit/scripts/create_card_cli.py +67 -0
- package/comate-engine/assets/skills/auto-commit/scripts/git_diff_cli.py +195 -0
- package/comate-engine/assets/skills/auto-commit/scripts/git_utils.py +225 -0
- package/comate-engine/assets/skills/auto-commit/scripts/icafe/__init__.py +66 -0
- package/comate-engine/assets/skills/auto-commit/scripts/icafe/client.py +444 -0
- package/comate-engine/assets/skills/auto-commit/scripts/icafe/farseer.py +53 -0
- package/comate-engine/assets/skills/auto-commit/scripts/icafe/matching.py +778 -0
- package/comate-engine/assets/skills/auto-commit/scripts/logger.py +32 -0
- package/comate-engine/assets/skills/auto-commit/scripts/recognize_card_cli.py +63 -0
- package/comate-engine/assets/skills/automation-browser-comate/SKILL.md +193 -90
- package/comate-engine/assets/skills/figma2code-comate/SKILL.md +2 -2
- package/comate-engine/assets/skills/figma2code-comate/references/codeConnect.md +7 -10
- package/comate-engine/assets/skills/smart-commit/SKILL.md +646 -0
- package/comate-engine/assets/skills/smart-commit/references/issue_type_mapping.json +19 -0
- package/comate-engine/assets/skills/smart-commit/references/query_reference.md +176 -0
- package/comate-engine/assets/skills/smart-commit/scripts/compat.py +86 -0
- package/comate-engine/assets/skills/smart-commit/scripts/create_card_cli.py +67 -0
- package/comate-engine/assets/skills/smart-commit/scripts/git_utils.py +220 -0
- package/comate-engine/assets/skills/smart-commit/scripts/icafe/__init__.py +66 -0
- package/comate-engine/assets/skills/smart-commit/scripts/icafe/client.py +444 -0
- package/comate-engine/assets/skills/smart-commit/scripts/icafe/farseer.py +53 -0
- package/comate-engine/assets/skills/smart-commit/scripts/icafe/matching.py +728 -0
- package/comate-engine/assets/skills/smart-commit/scripts/logger.py +32 -0
- package/comate-engine/assets/skills/smart-commit/scripts/recognize_card_cli.py +63 -0
- package/comate-engine/node_modules/@comate/plugin-engine/dist/index.js +7 -7
- package/comate-engine/node_modules/@comate/plugin-host/dist/index.js +1 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/main.js +1 -1
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +8 -8
- package/comate-engine/node_modules/@comate/preview-proxy/package.json +2 -2
- package/comate-engine/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
- package/comate-engine/package.json +2 -2
- package/comate-engine/server.js +61 -44
- package/dist/bundle/index.js +8 -8
- package/package.json +1 -1
- package/comate-engine/node_modules/@comate/plugin-engine/dist/index.d.ts +0 -188
- package/comate-engine/node_modules/@comate/plugin-host/dist/main.d.ts +0 -14
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +0 -4817
- package/comate-engine/node_modules/better-sqlite3/README.md +0 -99
- package/comate-engine/node_modules/bindings/LICENSE.md +0 -22
- package/comate-engine/node_modules/bindings/README.md +0 -98
- package/comate-engine/node_modules/compare-versions/README.md +0 -133
- package/comate-engine/node_modules/compare-versions/lib/esm/compare.d.ts +0 -19
- package/comate-engine/node_modules/compare-versions/lib/esm/compareVersions.d.ts +0 -8
- package/comate-engine/node_modules/compare-versions/lib/esm/index.d.ts +0 -5
- package/comate-engine/node_modules/compare-versions/lib/esm/satisfies.d.ts +0 -14
- package/comate-engine/node_modules/compare-versions/lib/esm/utils.d.ts +0 -7
- package/comate-engine/node_modules/compare-versions/lib/esm/validate.d.ts +0 -28
- package/comate-engine/node_modules/file-uri-to-path/History.md +0 -21
- package/comate-engine/node_modules/file-uri-to-path/README.md +0 -74
- package/comate-engine/node_modules/file-uri-to-path/index.d.ts +0 -2
- package/comate-engine/node_modules/pkce-challenge/README.md +0 -55
- package/comate-engine/node_modules/pkce-challenge/dist/index.browser.d.ts +0 -19
- package/comate-engine/node_modules/pkce-challenge/dist/index.node.d.ts +0 -19
- package/comate-engine/node_modules/sqlite-vec/README.md +0 -1
- package/comate-engine/node_modules/sqlite-vec/index.d.ts +0 -17
- package/comate-engine/node_modules/sqlite-vec-darwin-arm64/README.md +0 -1
- package/comate-engine/node_modules/sqlite-vec-darwin-x64/README.md +0 -1
- package/comate-engine/node_modules/sqlite-vec-linux-arm64/README.md +0 -1
- package/comate-engine/node_modules/sqlite-vec-linux-x64/README.md +0 -1
- package/comate-engine/node_modules/sqlite-vec-windows-x64/README.md +0 -1
- package/comate-engine/node_modules/tree-sitter-bash/README.md +0 -44
- package/comate-engine/node_modules/tree-sitter-bash/bindings/node/binding_test.js +0 -9
- package/comate-engine/node_modules/tree-sitter-bash/bindings/node/index.d.ts +0 -28
- package/comate-engine/node_modules/tree-sitter-bash/bindings/node/index.js +0 -11
- package/comate-engine/node_modules/tree-sitter-bash/prebuilds/darwin-arm64/tree-sitter-bash.node +0 -0
- package/comate-engine/node_modules/tree-sitter-bash/prebuilds/darwin-x64/tree-sitter-bash.node +0 -0
- package/comate-engine/node_modules/tree-sitter-bash/prebuilds/linux-arm64/tree-sitter-bash.node +0 -0
- package/comate-engine/node_modules/tree-sitter-bash/prebuilds/linux-x64/tree-sitter-bash.node +0 -0
- package/comate-engine/node_modules/tree-sitter-bash/prebuilds/win32-arm64/tree-sitter-bash.node +0 -0
- package/comate-engine/node_modules/tree-sitter-bash/prebuilds/win32-x64/tree-sitter-bash.node +0 -0
- package/comate-engine/node_modules/tree-sitter-bash/src/grammar.json +0 -7145
- package/comate-engine/node_modules/tree-sitter-bash/src/node-types.json +0 -2894
- package/comate-engine/node_modules/web-streams-polyfill/README.md +0 -119
- package/comate-engine/node_modules/web-streams-polyfill/types/polyfill.d.ts +0 -28
- package/comate-engine/node_modules/web-streams-polyfill/types/ponyfill.d.ts +0 -809
- package/comate-engine/node_modules/web-tree-sitter/README.md +0 -269
- package/comate-engine/node_modules/web-tree-sitter/debug/tree-sitter.cjs +0 -4558
- package/comate-engine/node_modules/web-tree-sitter/debug/tree-sitter.js +0 -4516
- package/comate-engine/node_modules/web-tree-sitter/debug/tree-sitter.wasm +0 -0
- package/comate-engine/node_modules/web-tree-sitter/web-tree-sitter.d.ts +0 -1030
- package/comate-engine/node_modules/win-ca/README.md +0 -648
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# 旧版本 IDE 交互指南
|
|
2
|
+
|
|
3
|
+
本文档适用于**旧版本 IDE**(IDE 名称占位符未替换、或插件版本 < 4.1.0)的交互方式。旧版本不支持 `__silent:` 和 `__interactive:` 前缀。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 步骤 1:获取 iCafe 数据(旧版本命令)
|
|
8
|
+
|
|
9
|
+
使用 SKILL.md 步骤 1 中定义的命令模板,**不加 `__silent:` 前缀**直接执行。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 步骤 2:获取 git diff(旧版本命令)
|
|
14
|
+
|
|
15
|
+
使用 SKILL.md 步骤 2 中定义的命令模板,**不加 `__silent:` 前缀**直接执行。
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 步骤 4:展示卡片选择(文本交互)
|
|
20
|
+
|
|
21
|
+
根据 `viewMode` 输出文本列表。
|
|
22
|
+
|
|
23
|
+
**当 `viewMode == "list"`(有高匹配卡片)时:**
|
|
24
|
+
|
|
25
|
+
先展示卡片列表(已按匹配度排序,标注匹配理由),再展示新建选项:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
📋 根据代码变更,找到以下匹配的 iCafe 卡片:
|
|
29
|
+
|
|
30
|
+
1. ⭐ [${spacePrefix}-${card1.sequence}] ${card1.title}
|
|
31
|
+
类型: ${card1.type} | 状态: ${card1.status}
|
|
32
|
+
匹配理由: ${reason}
|
|
33
|
+
|
|
34
|
+
2. [${spacePrefix}-${card2.sequence}] ${card2.title}
|
|
35
|
+
类型: ${card2.type} | 状态: ${card2.status}
|
|
36
|
+
|
|
37
|
+
(最多显示 10 张卡片,⭐ 标记匹配度较高的卡片)
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
🆕 如需新建卡片,为你推荐以下信息:
|
|
41
|
+
- 推荐标题:${result.defaults.title}
|
|
42
|
+
- 推荐空间:${spaceName} (${spacePrefix})
|
|
43
|
+
- 推荐类型:${推荐的类型名称}(类型 ID: ${result.defaults.type_id})
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
请回复:
|
|
47
|
+
- 输入序号(如 "1")选择对应卡片
|
|
48
|
+
- 输入卡片 ID(如 "DevOps-iScan-35835")直接关联
|
|
49
|
+
- 输入 "new" 使用推荐信息直接新建卡片
|
|
50
|
+
- 输入 "new 自定义标题" 使用推荐空间和类型、但自定义标题新建
|
|
51
|
+
- 输入 "new?" 查看所有可选空间和类型枚举
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**当 `viewMode == "create"`(无高匹配卡片)时:**
|
|
55
|
+
|
|
56
|
+
先展示新建卡片推荐(突出位置),再附上已有卡片作为备选:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
💡 当前代码变更与已有卡片匹配度较低,建议新建卡片:
|
|
60
|
+
|
|
61
|
+
🆕 推荐新建卡片信息:
|
|
62
|
+
- 推荐标题:${result.defaults.title}
|
|
63
|
+
- 推荐空间:${spaceName} (${spacePrefix})
|
|
64
|
+
- 推荐类型:${推荐的类型名称}(类型 ID: ${result.defaults.type_id})
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
📋 以下是你当前活跃的卡片(供参考):
|
|
68
|
+
|
|
69
|
+
1. [${spacePrefix}-${card1.sequence}] ${card1.title}
|
|
70
|
+
类型: ${card1.type} | 状态: ${card1.status}
|
|
71
|
+
|
|
72
|
+
(最多显示 10 张卡片)
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
请回复:
|
|
76
|
+
- 输入 "new" 使用推荐信息直接新建卡片
|
|
77
|
+
- 输入 "new 自定义标题" 使用推荐空间和类型、但自定义标题新建
|
|
78
|
+
- 输入序号(如 "1")选择对应卡片
|
|
79
|
+
- 输入卡片 ID(如 "DevOps-iScan-35835")直接关联
|
|
80
|
+
- 输入 "new?" 查看所有可选空间和类型枚举
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
如果没有找到卡片,输出:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
📋 未找到可关联的 iCafe 卡片
|
|
87
|
+
|
|
88
|
+
🆕 为你推荐以下建卡信息:
|
|
89
|
+
- 推荐标题:${result.defaults.title}
|
|
90
|
+
- 推荐空间:${spaceName} (${spacePrefix})
|
|
91
|
+
- 推荐类型:${推荐的类型名称}
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
请回复:
|
|
95
|
+
- 输入卡片 ID(如 "DevOps-iScan-35835")直接关联
|
|
96
|
+
- 输入 "new" 使用推荐信息直接新建卡片
|
|
97
|
+
- 输入 "new 自定义标题" 使用推荐空间和类型、但自定义标题新建
|
|
98
|
+
- 输入 "new?" 查看所有可选空间和类型枚举
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**推荐类型名称的获取方式:** 从 `result.available_spaces` 中找到当前空间(匹配 `space_prefix`),取其 `types` 列表中 `id` 等于 `result.defaults.type_id` 的类型的 `name`。如果找不到,取该空间 `types` 列表第一个的 `name`。
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 步骤 5:处理用户操作(旧版本 IDE)
|
|
106
|
+
|
|
107
|
+
根据用户在对话中的文本回复:
|
|
108
|
+
|
|
109
|
+
**如果用户输入序号(如 "1"、"2"):**
|
|
110
|
+
- 解析用户选择的卡片,保存 `selected_card` 信息,继续步骤 7
|
|
111
|
+
|
|
112
|
+
**如果用户输入卡片 ID(如 "DevOps-iScan-35835"):**
|
|
113
|
+
- 调用 `recognize_card_cli.py` 获取卡片详情:
|
|
114
|
+
```
|
|
115
|
+
cd <用户项目目录> && python3 <skill_directory>/scripts/recognize_card_cli.py --link "<卡片ID>"
|
|
116
|
+
```
|
|
117
|
+
- 保存 `selected_card` 信息,继续步骤 7
|
|
118
|
+
|
|
119
|
+
**如果用户输入 "new"(使用推荐信息直接新建):**
|
|
120
|
+
- 使用 `result` 中的推荐信息调用 `create_card_cli.py` 创建卡片
|
|
121
|
+
- 标题 = `result.defaults.title`,空间 = `result.space_prefix`
|
|
122
|
+
- 类型 = 从 `result.available_spaces` 中匹配当前空间,取 `types` 中 `id` 等于 `result.defaults.type_id` 的类型名称
|
|
123
|
+
|
|
124
|
+
**如果用户输入 "new 自定义标题":**
|
|
125
|
+
- 与 "new" 逻辑相同,但标题使用用户输入的自定义标题(去掉 "new " 前缀后的部分)
|
|
126
|
+
|
|
127
|
+
**如果用户输入 "new?"(查看空间和类型枚举):**
|
|
128
|
+
|
|
129
|
+
从 `result.available_spaces` 输出完整枚举:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
📋 可选空间和类型:
|
|
133
|
+
|
|
134
|
+
空间 1: ${space1.name} (${space1.prefix})
|
|
135
|
+
可选类型:
|
|
136
|
+
- ${type1.name} (ID: ${type1.id})
|
|
137
|
+
- ${type2.name} (ID: ${type2.id})
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
请回复以下格式新建卡片:
|
|
141
|
+
new [标题] | [空间前缀] | [类型名称]
|
|
142
|
+
例如:new 修复登录问题 | dkx | Bug
|
|
143
|
+
|
|
144
|
+
也可以只指定部分:
|
|
145
|
+
new 修复登录问题 | dkx → 使用指定空间 + 该空间默认类型
|
|
146
|
+
new 修复登录问题 | | Story → 使用推荐空间 + 指定类型
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**如果用户输入 "new 标题 | 空间 | 类型"(完整指定):**
|
|
150
|
+
- 按 `|` 分割解析,第一段为标题,第二段(可选)为空间前缀,第三段(可选)为类型名称
|
|
151
|
+
- 为空的部分使用推荐值,调用 `create_card_cli.py` 创建卡片
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 步骤 8:展示提交确认(文本确认)
|
|
156
|
+
|
|
157
|
+
输出:
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
✅ 已关联卡片: ${spacePrefix}-${sequence}
|
|
161
|
+
标题: ${title}
|
|
162
|
+
类型: ${type} | 状态: ${status}
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
📝 建议的 commit message:
|
|
166
|
+
|
|
167
|
+
${spacePrefix}-${sequence} ${brief_description}
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
请确认:
|
|
171
|
+
- 回复 "ok" 或 "确认" 使用此 message 提交
|
|
172
|
+
- 回复 "edit: <新message>" 修改后提交(如 "edit: dkx-200 修复登录bug")
|
|
173
|
+
- 回复 "no" 或 "取消" 放弃提交
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 步骤 9:执行提交(旧版本 IDE)
|
|
179
|
+
|
|
180
|
+
**如果用户确认提交(回复 "ok"、"确认"、"yes"):**
|
|
181
|
+
- 执行 `git add . && git commit -m "${commit_message}"`
|
|
182
|
+
|
|
183
|
+
**如果用户修改后提交(回复 "edit: <新message>"):**
|
|
184
|
+
- 使用用户提供的新 message 执行提交
|
|
185
|
+
|
|
186
|
+
**如果用户取消(回复 "no"、"取消"):**
|
|
187
|
+
- 输出取消信息
|
|
188
|
+
|
|
189
|
+
旧版本 IDE 提交成功后额外提示:`如需推送到远程,请执行:git push`
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# iCafe 卡片查询 IQL 完整参考
|
|
2
|
+
|
|
3
|
+
## API 端点
|
|
4
|
+
|
|
5
|
+
### 条件查询卡片
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
GET {base_url}/api/spaces/{space_id}/cards?iql={iql_expression}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**请求参数:**
|
|
12
|
+
|
|
13
|
+
| 参数 | 位置 | 类型 | 必填 | 说明 |
|
|
14
|
+
|------|------|------|------|------|
|
|
15
|
+
| space_id | path | string | 是 | 空间 ID |
|
|
16
|
+
| iql | query | string | 是 | IQL 查询表达式 |
|
|
17
|
+
| page | query | int | 否 | 页码 |
|
|
18
|
+
| showDetail | query | flag | 否 | 显示详情(传空字符串即可) |
|
|
19
|
+
| showAssociations | query | flag | 否 | 显示关联信息 |
|
|
20
|
+
| isDesc | query | flag | 否 | 降序排列 |
|
|
21
|
+
| order | query | string | 否 | 排序字段 |
|
|
22
|
+
| showChildren | query | flag | 否 | 显示子卡片 |
|
|
23
|
+
| maxRecords | query | int | 否 | 最大返回数 |
|
|
24
|
+
| showOkr | query | flag | 否 | 显示 OKR |
|
|
25
|
+
| showAccumulate | query | flag | 否 | 显示累计信息 |
|
|
26
|
+
|
|
27
|
+
**响应示例:**
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"cards": [
|
|
32
|
+
{
|
|
33
|
+
"id": "12345",
|
|
34
|
+
"sequence": "628",
|
|
35
|
+
"title": "示例卡片",
|
|
36
|
+
"type": "Bug",
|
|
37
|
+
"status": "新建",
|
|
38
|
+
"assignee": "dongkexin01",
|
|
39
|
+
"priority": "P1-High",
|
|
40
|
+
"createdAt": "2025-01-15 10:30:00",
|
|
41
|
+
"updatedAt": "2025-01-16 14:20:00"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"total": 1,
|
|
45
|
+
"page": 1,
|
|
46
|
+
"pageSize": 20
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 获取单张卡片
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
GET {base_url}/api/spaces/{space_id}/cards/{card_id}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 查询最近访问空间
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
GET {base_url}/api/v2/space/latest?currentUser={user_id}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 获取空间计划
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
GET {base_url}/api/v2/space/{space_id}/plans
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## IQL 查询语法完整参考
|
|
69
|
+
|
|
70
|
+
### 运算符
|
|
71
|
+
|
|
72
|
+
| 运算符 | 含义 | 适用类型 | 示例 |
|
|
73
|
+
|--------|------|----------|------|
|
|
74
|
+
| `=` | 等于 | 所有类型 | `类型 = Bug` |
|
|
75
|
+
| `!=` | 不等于 | 所有类型 | `状态 != 已完成` |
|
|
76
|
+
| `>` | 大于 | 日期、数字、流程状态 | `创建时间 > "2025-01-01"` |
|
|
77
|
+
| `<` | 小于 | 日期、数字、流程状态 | `优先级数值 < 3` |
|
|
78
|
+
| `>=` | 大于等于 | 流程状态、数字 | `流程状态 >= 开发中` |
|
|
79
|
+
| `<=` | 小于等于 | 流程状态、数字 | `流程状态 <= 开发中` |
|
|
80
|
+
| `in ()` | 在列表中 | 人员、类型、状态、标签等 | `类型 in (Bug, Story)` |
|
|
81
|
+
| `not in ()` | 不在列表中 | 人员、类型、状态、标签等 | `状态 not in (已完成, 已关闭)` |
|
|
82
|
+
| `is empty` | 为空 | 所有类型 | `负责人 is empty` |
|
|
83
|
+
| `is not empty` | 不为空 | 所有类型 | `截止日期 is not empty` |
|
|
84
|
+
| `~` | 包含(模糊匹配) | 标题、文本、关键字、URL | `标题 ~ 登录` |
|
|
85
|
+
| `!~` | 不包含 | 标题、文本 | `标题 !~ 测试` |
|
|
86
|
+
| `AND` | 逻辑与 | 连接多个条件 | `类型 = Bug AND 状态 = 新建` |
|
|
87
|
+
| `OR` | 逻辑或 | 连接多个条件 | `类型 = Bug OR 类型 = Story` |
|
|
88
|
+
| `()` | 分组 | 控制优先级 | `(类型 = Bug OR 类型 = Story) AND 负责人 = currentUser` |
|
|
89
|
+
|
|
90
|
+
### 字段参考
|
|
91
|
+
|
|
92
|
+
| 字段名 | 类型 | 说明 |
|
|
93
|
+
|--------|------|------|
|
|
94
|
+
| 类型 | 枚举 | Bug, Story, Task, Epic 等 |
|
|
95
|
+
| 负责人 | 人员 | 用户 ID,如 "dongkexin01" |
|
|
96
|
+
| 创建人 | 人员 | 用户 ID |
|
|
97
|
+
| 流程状态 | 状态枚举 | 新建, 待开发, 开发中, 进行中, 已完成 等 |
|
|
98
|
+
| 优先级 | 枚举 | P0-Urgent, P1-High, P2-Medium, P3-Low 等 |
|
|
99
|
+
| 创建时间 | 日期 | 格式 "YYYY-MM-DD" 或 "YYYY-MM-DD HH:mm:ss" |
|
|
100
|
+
| 更新时间 | 日期 | 格式同上 |
|
|
101
|
+
| 截止日期 | 日期 | 格式同上 |
|
|
102
|
+
| 标题 | 文本 | 卡片标题 |
|
|
103
|
+
| 关键字 | 文本 | 全文搜索关键字 |
|
|
104
|
+
| Label | 标签 | 卡片标签 |
|
|
105
|
+
| 所属计划 | 树 | 需要完整路径,如 "测试/测试1" |
|
|
106
|
+
|
|
107
|
+
### 常用查询模式
|
|
108
|
+
|
|
109
|
+
#### 按类型查询
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
类型 = Bug
|
|
113
|
+
类型 in (Bug, Story, Task)
|
|
114
|
+
类型 != Epic
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### 按人员查询
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
负责人 = currentUser
|
|
121
|
+
负责人 = dongkexin01
|
|
122
|
+
创建人 = v_liuxiang
|
|
123
|
+
负责人 in (user1, user2, user3)
|
|
124
|
+
负责人 is empty
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### 按状态查询
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
流程状态 = 新建
|
|
131
|
+
流程状态 in (新建, 开发中, 待开发, 进行中)
|
|
132
|
+
流程状态 <= 开发中
|
|
133
|
+
流程状态 != 已完成
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### 按时间查询
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
创建时间 > "2025-01-01"
|
|
140
|
+
创建时间 > "2025-01-01 00:00:00" AND 创建时间 < "2025-06-30 23:59:59"
|
|
141
|
+
更新时间 > "2025-03-01"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### 按内容查询
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
标题 ~ 登录
|
|
148
|
+
标题 !~ 测试
|
|
149
|
+
关键字 ~ 性能优化
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### 组合查询
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
类型 = Bug AND 负责人 = currentUser AND 流程状态 != 已完成
|
|
156
|
+
(类型 = Bug OR 类型 = Story) AND 优先级 = P1-High
|
|
157
|
+
创建人 = dongkexin01 AND 创建时间 > "2025-01-01" AND 流程状态 in (新建, 开发中)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## 认证说明
|
|
161
|
+
|
|
162
|
+
所有请求需要 `x-ac-Authorization` header。Token 获取优先级:
|
|
163
|
+
|
|
164
|
+
1. 环境变量 `COMATE_AUTH_TOKEN`
|
|
165
|
+
2. 文件 `~/.comate/login`
|
|
166
|
+
|
|
167
|
+
## 错误码
|
|
168
|
+
|
|
169
|
+
| HTTP 状态码 | 说明 |
|
|
170
|
+
|-------------|------|
|
|
171
|
+
| 200 | 成功 |
|
|
172
|
+
| 400 | 请求参数错误(如 IQL 语法错误) |
|
|
173
|
+
| 401 | 认证失败(token 无效或过期) |
|
|
174
|
+
| 403 | 无权限访问该空间 |
|
|
175
|
+
| 404 | 空间或卡片不存在 |
|
|
176
|
+
| 500 | 服务端错误 |
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""
|
|
2
|
+
版本兼容性检测模块
|
|
3
|
+
|
|
4
|
+
用于检测当前 IDE 版本是否支持自定义交互式 UI
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
# 支持自定义 UI 的最低版本
|
|
8
|
+
MIN_INTERACTIVE_VERSION = '1.2.0'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def parse_version(version_str: str) -> tuple:
|
|
12
|
+
"""
|
|
13
|
+
解析版本号字符串为可比较的元组
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
version_str: 版本号字符串,如 "1.2.3"
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
版本号元组,如 (1, 2, 3)
|
|
20
|
+
"""
|
|
21
|
+
try:
|
|
22
|
+
parts = version_str.split('.')
|
|
23
|
+
return tuple(int(p) for p in parts[:3])
|
|
24
|
+
except (ValueError, AttributeError):
|
|
25
|
+
return (0, 0, 0)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def is_interactive_ui_supported(ide_name: str, plugin_version: str) -> bool:
|
|
29
|
+
"""
|
|
30
|
+
检测当前 IDE 版本是否支持自定义交互式 UI
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
ide_name: 从 ${COMATE_IDE_NAME} 获取的值
|
|
34
|
+
plugin_version: 从 ${COMATE_PLUGIN_VERSION} 获取的值
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
True 如果支持自定义 UI,否则 False
|
|
38
|
+
"""
|
|
39
|
+
# 1. 检测占位符是否被替换
|
|
40
|
+
# 旧版本 CLI 不支持这些占位符,值仍为 "${...}" 原样
|
|
41
|
+
if not ide_name or ide_name.startswith('${'):
|
|
42
|
+
return False
|
|
43
|
+
if not plugin_version or plugin_version.startswith('${'):
|
|
44
|
+
return False
|
|
45
|
+
|
|
46
|
+
# 2. 版本号比较
|
|
47
|
+
current = parse_version(plugin_version)
|
|
48
|
+
minimum = parse_version(MIN_INTERACTIVE_VERSION)
|
|
49
|
+
|
|
50
|
+
return current >= minimum
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def check_interactive_support(ide_name: str, plugin_version: str) -> str:
|
|
54
|
+
"""
|
|
55
|
+
检测并返回应使用的流程模式
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
ide_name: 从 ${COMATE_IDE_NAME} 获取的值
|
|
59
|
+
plugin_version: 从 ${COMATE_PLUGIN_VERSION} 获取的值
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
"INTERACTIVE_MODE" 或 "FALLBACK_MODE"
|
|
63
|
+
"""
|
|
64
|
+
if is_interactive_ui_supported(ide_name, plugin_version):
|
|
65
|
+
return "INTERACTIVE_MODE"
|
|
66
|
+
return "FALLBACK_MODE"
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
if __name__ == "__main__":
|
|
70
|
+
# 测试用例
|
|
71
|
+
test_cases = [
|
|
72
|
+
("vscode", "1.2.0", "INTERACTIVE_MODE"),
|
|
73
|
+
("vscode", "1.3.5", "INTERACTIVE_MODE"),
|
|
74
|
+
("vscode", "1.1.9", "FALLBACK_MODE"),
|
|
75
|
+
("vscode", "0.9.0", "FALLBACK_MODE"),
|
|
76
|
+
("${COMATE_IDE_NAME}", "1.2.0", "FALLBACK_MODE"),
|
|
77
|
+
("vscode", "${COMATE_PLUGIN_VERSION}", "FALLBACK_MODE"),
|
|
78
|
+
("", "1.2.0", "FALLBACK_MODE"),
|
|
79
|
+
("vscode", "", "FALLBACK_MODE"),
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
print("Running compatibility check tests...")
|
|
83
|
+
for ide, version, expected in test_cases:
|
|
84
|
+
result = check_interactive_support(ide, version)
|
|
85
|
+
status = "PASS" if result == expected else "FAIL"
|
|
86
|
+
print(f"[{status}] ide={ide!r}, version={version!r} -> {result} (expected: {expected})")
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""命令行工具:创建 iCafe 卡片
|
|
2
|
+
|
|
3
|
+
用法:
|
|
4
|
+
python3 create_card_cli.py --title "标题" --space-prefix "dkx" --type-name "Bug" --username "dongkexin01"
|
|
5
|
+
|
|
6
|
+
输出:
|
|
7
|
+
JSON 格式的创建结果,包含 sequence、title、spacePrefix 等字段。
|
|
8
|
+
失败时输出 {"error": "错误信息"}。
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import argparse
|
|
12
|
+
import json
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
|
|
16
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
17
|
+
|
|
18
|
+
from icafe.client import ICafeQueryClient
|
|
19
|
+
from git_utils import get_current_user
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def main():
|
|
23
|
+
"""解析命令行参数并调用 iCafe 接口创建卡片。"""
|
|
24
|
+
parser = argparse.ArgumentParser(description="创建 iCafe 卡片")
|
|
25
|
+
parser.add_argument("--title", required=True, help="卡片标题")
|
|
26
|
+
parser.add_argument("--space-prefix", required=True, help="空间前缀,如 dkx")
|
|
27
|
+
parser.add_argument("--type-name", required=True, help="卡片类型名称,如 Bug")
|
|
28
|
+
parser.add_argument("--description", default="", help="卡片描述")
|
|
29
|
+
parser.add_argument("--username", default=None, help="用户名,如 dongkexin01")
|
|
30
|
+
args = parser.parse_args()
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
client = ICafeQueryClient()
|
|
34
|
+
assignee = get_current_user(username=args.username)
|
|
35
|
+
|
|
36
|
+
created = client.create_card(
|
|
37
|
+
title=args.title,
|
|
38
|
+
space_id=args.space_prefix,
|
|
39
|
+
card_type=args.type_name,
|
|
40
|
+
description=args.description,
|
|
41
|
+
assignee_id=assignee,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
if created:
|
|
45
|
+
issues = created.get("issues", [])
|
|
46
|
+
if issues:
|
|
47
|
+
sequence = issues[0].get("sequence")
|
|
48
|
+
print(json.dumps({
|
|
49
|
+
"success": True,
|
|
50
|
+
"sequence": str(sequence),
|
|
51
|
+
"title": args.title,
|
|
52
|
+
"type": args.type_name,
|
|
53
|
+
"status": "新建",
|
|
54
|
+
"spacePrefix": args.space_prefix,
|
|
55
|
+
}))
|
|
56
|
+
else:
|
|
57
|
+
print(json.dumps({"error": "创建卡片成功但无法获取序列号"}))
|
|
58
|
+
else:
|
|
59
|
+
print(json.dumps({"error": "创建卡片失败,请重试"}))
|
|
60
|
+
except Exception as e:
|
|
61
|
+
err_name = type(e).__name__
|
|
62
|
+
print(json.dumps({"error": f"创建卡片异常: {err_name}: {e}"}))
|
|
63
|
+
sys.exit(1)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
if __name__ == "__main__":
|
|
67
|
+
main()
|