@comate/zulu 1.4.0-beta.2 → 1.4.0-beta.4
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/comate-engine/assets/skills/auto-commit/SKILL.md +241 -0
- package/comate-engine/assets/skills/auto-commit/references/data_structures.md +183 -0
- package/comate-engine/assets/skills/auto-commit/references/interaction_instruction.md +220 -0
- package/comate-engine/assets/skills/auto-commit/references/issue_type_mapping.json +19 -0
- package/comate-engine/assets/skills/auto-commit/references/query_reference.md +176 -0
- package/comate-engine/assets/skills/auto-commit/scripts/build_git_commit_payload.py +195 -0
- package/comate-engine/assets/skills/auto-commit/scripts/build_icafe_cards_payload.py +80 -0
- package/comate-engine/assets/skills/auto-commit/scripts/cache_manager.py +69 -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 +201 -0
- package/comate-engine/assets/skills/auto-commit/scripts/git_utils.py +230 -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 +473 -0
- package/comate-engine/assets/skills/auto-commit/scripts/icafe/farseer.py +52 -0
- package/comate-engine/assets/skills/auto-commit/scripts/icafe/matching.py +784 -0
- package/comate-engine/assets/skills/auto-commit/scripts/logger.py +32 -0
- package/comate-engine/assets/skills/auto-commit/scripts/match_card_cli.py +41 -0
- package/comate-engine/assets/skills/auto-commit/scripts/payload_validators.py +309 -0
- package/comate-engine/assets/skills/auto-commit/scripts/recognize_card_cli.py +63 -0
- package/comate-engine/assets/skills/{automation-browser-comate → automation-browser}/SKILL.md +1 -0
- package/comate-engine/assets/skills/{cnap-comate → cnap}/SKILL.md +1 -0
- package/comate-engine/assets/skills/code-review/SKILL.md +202 -0
- package/comate-engine/assets/skills/code-review/agents/correctness-reviewer.md +62 -0
- package/comate-engine/assets/skills/code-review/agents/custom-reviewer.md +53 -0
- package/comate-engine/assets/skills/code-review/agents/meta-reviewer.md +84 -0
- package/comate-engine/assets/skills/code-review/agents/reliability-reviewer.md +72 -0
- package/comate-engine/assets/skills/code-review/agents/reuse-reviewer.md +101 -0
- package/comate-engine/assets/skills/code-review/agents/style-reviewer.md +65 -0
- package/comate-engine/assets/skills/code-review/evals/SKILL.md +334 -0
- package/comate-engine/assets/skills/code-review/evals/agents/gt-generator.md +76 -0
- package/comate-engine/assets/skills/code-review/evals/agents/miner.md +87 -0
- package/comate-engine/assets/skills/code-review/evals/agents/score-judge.md +168 -0
- package/comate-engine/assets/skills/code-review/evals/references/cli-query-template.md +114 -0
- package/comate-engine/assets/skills/code-review/evals/references/gt-schema.md +77 -0
- package/comate-engine/assets/skills/code-review/references/custom-rules/RULE_TEMPLATE.md +141 -0
- package/comate-engine/assets/skills/code-review/references/dispatch-template.md +142 -0
- package/comate-engine/assets/skills/code-review/references/output-schema.md +197 -0
- package/comate-engine/assets/skills/code-review/references/report-format.md +41 -0
- package/comate-engine/assets/skills/code-review/references/rules/Go/GO_AUTH_RULES.md +29 -0
- package/comate-engine/assets/skills/code-review/references/rules/Go/GO_CORRECTNESS_RULES.md +111 -0
- package/comate-engine/assets/skills/code-review/references/rules/Go/GO_RESOURCE_CONCURRENCY_RULES.md +190 -0
- package/comate-engine/assets/skills/code-review/references/rules/Go/GO_STYLE_RULES.md +354 -0
- package/comate-engine/assets/skills/code-review/references/rules/Java/JAVA_AUTH_RULES.md +34 -0
- package/comate-engine/assets/skills/code-review/references/rules/Java/JAVA_CORRECTNESS_RULES.md +207 -0
- package/comate-engine/assets/skills/code-review/references/rules/Java/JAVA_RESOURCE_CONCURRENCY_RULES.md +220 -0
- package/comate-engine/assets/skills/code-review/references/rules/Java/JAVA_STYLE_RULES.md +306 -0
- package/comate-engine/assets/skills/code-review/references/rules/Js/JS_AUTH_RULES.md +48 -0
- package/comate-engine/assets/skills/code-review/references/rules/Js/JS_CORRECTNESS_RULES.md +364 -0
- package/comate-engine/assets/skills/code-review/references/rules/Js/JS_RESOURCE_CONCURRENCY_RULES.md +180 -0
- package/comate-engine/assets/skills/code-review/references/rules/Js/JS_STYLE_RULES.md +350 -0
- package/comate-engine/assets/skills/code-review/references/rules/Python/PYTHON_AUTH_RULES.md +38 -0
- package/comate-engine/assets/skills/code-review/references/rules/Python/PYTHON_CORRECTNESS_RULES.md +255 -0
- package/comate-engine/assets/skills/code-review/references/rules/Python/PYTHON_RESOURCE_CONCURRENCY_RULES.md +180 -0
- package/comate-engine/assets/skills/code-review/references/rules/Python/PYTHON_STYLE_RULES.md +195 -0
- package/comate-engine/assets/skills/code-review/references/telemetry.md +27 -0
- package/comate-engine/assets/skills/{code-security-comate → code-security}/SKILL.md +1 -0
- package/comate-engine/assets/skills/{comate-docs-comate → comate-docs}/SKILL.md +1 -1
- package/comate-engine/assets/skills/create-automation-tasks-comate/SKILL.md +300 -0
- package/comate-engine/assets/skills/create-automation-tasks-comate/references/backend_dev.md +109 -0
- package/comate-engine/assets/skills/create-automation-tasks-comate/references/env_setup.md +130 -0
- package/comate-engine/assets/skills/create-automation-tasks-comate/references/frontend_dev.md +74 -0
- package/comate-engine/assets/skills/create-automation-tasks-comate/references/git_operations.md +88 -0
- package/comate-engine/assets/skills/create-automation-tasks-comate/references/long_running_task.md +96 -0
- package/comate-engine/assets/skills/create-automation-tasks-comate/references/testing_strategy.md +94 -0
- package/comate-engine/assets/skills/create-automation-tasks-comate/scripts/check_config.py +397 -0
- package/comate-engine/assets/skills/{create-image-comate → create-image}/SKILL.md +14 -9
- package/comate-engine/assets/skills/{create-rule-comate → create-rule}/SKILL.md +1 -0
- package/comate-engine/assets/skills/{create-skill-comate → create-skill}/SKILL.md +2 -3
- package/comate-engine/assets/skills/{figma2code-comate → figma2code}/SKILL.md +1 -0
- package/comate-engine/assets/skills/{get-ugate-token-comate → get-ugate-token}/SKILL.md +97 -13
- package/comate-engine/assets/skills/get-ugate-token/getUgateToken.py +244 -0
- package/comate-engine/assets/skills/{icafe-comate → icafe}/SKILL.md +1 -13
- package/comate-engine/assets/skills/{icode-comate → icode}/SKILL.md +1 -0
- package/comate-engine/fallbackServer.js +1 -1
- package/comate-engine/node_modules/@baidu/comate-browser-use/dist/launch-chrome/index.js +1 -1
- package/comate-engine/node_modules/@baidu/comate-browser-use/package.json +5 -5
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +3 -3
- package/comate-engine/package.json +1 -1
- package/comate-engine/server.js +137 -77
- package/dist/bundle/index.js +20 -9
- package/package.json +1 -1
- package/comate-engine/assets/skills/get-ugate-token-comate/getUgateToken.py +0 -150
- /package/comate-engine/assets/skills/{cnap-comate → cnap}/references/cases.md +0 -0
- /package/comate-engine/assets/skills/{cnap-comate → cnap}/references/deploy-troubleshoot.md +0 -0
- /package/comate-engine/assets/skills/{cnap-comate → cnap}/references/install.md +0 -0
- /package/comate-engine/assets/skills/{cnap-comate → cnap}/references/kubectl.md +0 -0
- /package/comate-engine/assets/skills/{cnap-comate → cnap}/references/login.md +0 -0
- /package/comate-engine/assets/skills/{cnap-comate → cnap}/references/oncall.md +0 -0
- /package/comate-engine/assets/skills/{cnap-comate → cnap}/scripts/install_cnap_cli.sh +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/references/credential_hosting.md +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/references/vul_repair-go_sql_injection.md +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/references/vul_repair-java_sql_injection.md +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/references/vul_repair-php_sql_injection.md +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/references/vul_repair-python_sql_injection.md +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/references/vul_repair_sensitive.md +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/scripts/credential_hosting.py +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/scripts/credential_poll.py +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/scripts/http_client.py +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/scripts/parse_scan_result.py +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/scripts/repair_vulnerability.py +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/scripts/report_chat.py +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/scripts/scan_vulnerability.py +0 -0
- /package/comate-engine/assets/skills/{code-security-comate → code-security}/scripts/utils.py +0 -0
- /package/comate-engine/assets/skills/{comate-docs-comate → comate-docs}/references/doc-map-extended.md +0 -0
- /package/comate-engine/assets/skills/{comate-docs-comate → comate-docs}/references/models-and-billing.md +0 -0
- /package/comate-engine/assets/skills/{comate-docs-comate → comate-docs}/references/product-overview.md +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/LICENSE.txt +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/agents/analyzer.md +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/agents/comparator.md +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/agents/grader.md +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/assets/eval_review.html +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/eval-viewer/generate_review.py +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/eval-viewer/viewer.html +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/references/schemas.md +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/scripts/__init__.py +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/scripts/__pycache__/__init__.cpython-311.pyc +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/scripts/__pycache__/aggregate_benchmark.cpython-311.pyc +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/scripts/aggregate_benchmark.py +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/scripts/generate_report.py +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/scripts/package_skill.py +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/scripts/quick_validate.py +0 -0
- /package/comate-engine/assets/skills/{create-skill-comate → create-skill}/scripts/utils.py +0 -0
- /package/comate-engine/assets/skills/{create-subagent-comate → create-subagent}/SKILL.md +0 -0
- /package/comate-engine/assets/skills/{figma2code-comate → figma2code}/references/codeConnect.md +0 -0
- /package/comate-engine/assets/skills/{figma2code-comate → figma2code}/references/designToken.md +0 -0
- /package/comate-engine/assets/skills/{figma2code-comate → figma2code}/references/image2design.md +0 -0
- /package/comate-engine/assets/skills/{find-skills-comate → find-skills}/SKILL.md +0 -0
- /package/comate-engine/assets/skills/{find-skills-comate → find-skills}/scripts/fetch_skills.py +0 -0
- /package/comate-engine/assets/skills/{find-skills-comate → find-skills}/scripts/get_download_url.py +0 -0
- /package/comate-engine/assets/skills/{find-skills-comate → find-skills}/scripts/install_skill.py +0 -0
- /package/comate-engine/assets/skills/{find-skills-comate → find-skills}/scripts/preview_skill.py +0 -0
- /package/comate-engine/assets/skills/{icafe-comate → icafe}/references/ai-workflows.md +0 -0
- /package/comate-engine/assets/skills/{icafe-comate → icafe}/references/commands.md +0 -0
- /package/comate-engine/assets/skills/{icafe-comate → icafe}/references/error-handling.md +0 -0
- /package/comate-engine/assets/skills/{icafe-comate → icafe}/references/git-auto-bindcard-workflow.md +0 -0
- /package/comate-engine/assets/skills/{icafe-comate → icafe}/references/git-bindcard-workflow.md +0 -0
- /package/comate-engine/assets/skills/{icafe-comate → icafe}/references/iql-syntax.md +0 -0
- /package/comate-engine/assets/skills/{icafe-comate → icafe}/references/platform-concepts.md +0 -0
- /package/comate-engine/assets/skills/{icafe-comate → icafe}/references/smart-create-workflow.md +0 -0
- /package/comate-engine/assets/skills/{icafe-comate → icafe}/references/smart-find-workflow.md +0 -0
- /package/comate-engine/assets/skills/{icafe-comate → icafe}/references/smart-update-workflow.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/add_reviewers.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/build_fetch_command.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/check_repo_permission.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/create_branch.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/create_draft_comment.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_ai_cr_result.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_ai_review.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_diff_content.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_diff_file.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_machine_check.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_my_reviews.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_person_commit.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_person_repo.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_repo_branch.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_repo_config.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_repo_members.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_repo_reviews.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_review_comments.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_review_info.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/get_submit_settings.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/icode-api.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/publish_comments.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/set_review_score.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/start_ai_review.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/submit_review.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/api/trigger_ai_cr.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/feature/add-reviewer.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/feature/fix-machine-check.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/feature/merge-cr.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/feature/ssh-setup.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/feature/submit-acr.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/feature/submit-cr.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/git/clone.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/git/icode-git.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/git/push.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/git/push_cr.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/install.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/references/login.md +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/scripts/add-reviewer.sh +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/scripts/common.sh +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/scripts/fix-machine-check.sh +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/scripts/merge-cr.sh +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/scripts/ssh-setup.sh +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/scripts/submit-acr.sh +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/scripts/submit-cr.sh +0 -0
- /package/comate-engine/assets/skills/{icode-comate → icode}/scripts/test-preflight.sh +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/SKILL.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/examples.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/add_member.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/change_scope.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/copy_doc.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/create_doc.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/delete_doc.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/edit_content.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/move_doc.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/query_comment.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/query_content.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/query_flowchart.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/query_permission.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/query_recent_view.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/query_repo.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/query_user_info.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/update_member.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/references/upload_attachment.md +0 -0
- /package/comate-engine/assets/skills/{ku-operator-comate → ku-operator}/scripts/ku_operator.py +0 -0
|
@@ -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,195 @@
|
|
|
1
|
+
"""命令行工具:构建并验证 git-commit UI payload
|
|
2
|
+
|
|
3
|
+
用法:
|
|
4
|
+
# 缓存模式(推荐):脚本自动从缓存读取 diff、执行 git branch 获取分支信息
|
|
5
|
+
python3 build_git_commit_payload.py --cache --commit-message "msg" --bound-card '{"sequence":"39",...}'
|
|
6
|
+
python3 build_git_commit_payload.py --cache --commit-message "msg" --bound-card 'null'
|
|
7
|
+
|
|
8
|
+
# JSON 模式(降级):Agent 手动构造完整 workspaces 数组
|
|
9
|
+
python3 build_git_commit_payload.py --json '<payload JSON>'
|
|
10
|
+
|
|
11
|
+
缓存模式输入:
|
|
12
|
+
--commit-message: commit message(必填)
|
|
13
|
+
--bound-card: 绑定卡片 JSON 对象,或字符串 'null' 表示无卡片(必填)
|
|
14
|
+
|
|
15
|
+
JSON 模式输入:
|
|
16
|
+
--json: 完整 payload JSON,包含 commitMessage、boundCard、workspaces。
|
|
17
|
+
diffSummary 内部保持 snake_case(与 git_diff_cli.py 输出一致)。
|
|
18
|
+
|
|
19
|
+
输出:
|
|
20
|
+
验证通过: {"valid": true, "payload": {...}}
|
|
21
|
+
验证失败: {"valid": false, "errors": ["...", ...]}
|
|
22
|
+
系统错误: {"error": "..."}
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
import argparse
|
|
26
|
+
import json
|
|
27
|
+
import os
|
|
28
|
+
import subprocess
|
|
29
|
+
import sys
|
|
30
|
+
|
|
31
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
32
|
+
from cache_manager import get_all_git_diffs, CACHE_PATH
|
|
33
|
+
from payload_validators import convert_git_commit_payload
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _get_current_branch(workspace):
|
|
37
|
+
"""通过 git branch --show-current 获取当前分支名。"""
|
|
38
|
+
try:
|
|
39
|
+
result = subprocess.run(
|
|
40
|
+
["git", "branch", "--show-current"],
|
|
41
|
+
capture_output=True, text=True, encoding="utf-8", errors="replace",
|
|
42
|
+
timeout=10, cwd=workspace
|
|
43
|
+
)
|
|
44
|
+
if result.returncode == 0 and result.stdout.strip():
|
|
45
|
+
return result.stdout.strip()
|
|
46
|
+
except (subprocess.TimeoutExpired, FileNotFoundError, OSError):
|
|
47
|
+
pass
|
|
48
|
+
return ""
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _get_remote_branches(workspace, current_branch):
|
|
52
|
+
"""通过 git branch -r 获取远程分支列表,最多 10 个。"""
|
|
53
|
+
try:
|
|
54
|
+
result = subprocess.run(
|
|
55
|
+
["git", "branch", "-r", "--sort=-committerdate"],
|
|
56
|
+
capture_output=True, text=True, encoding="utf-8", errors="replace",
|
|
57
|
+
timeout=10, cwd=workspace
|
|
58
|
+
)
|
|
59
|
+
if result.returncode == 0:
|
|
60
|
+
branches = []
|
|
61
|
+
for line in result.stdout.splitlines():
|
|
62
|
+
line = line.strip()
|
|
63
|
+
if not line or "->" in line:
|
|
64
|
+
continue
|
|
65
|
+
# 去掉 "origin/" 前缀
|
|
66
|
+
name = line.split("/", 1)[-1] if "/" in line else line
|
|
67
|
+
is_current = (name == current_branch)
|
|
68
|
+
branches.append({"name": name, "isCurrent": is_current})
|
|
69
|
+
if len(branches) >= 10:
|
|
70
|
+
break
|
|
71
|
+
|
|
72
|
+
# 确保当前分支在列表中
|
|
73
|
+
if current_branch and not any(b["isCurrent"] for b in branches):
|
|
74
|
+
branches.insert(0, {"name": current_branch, "isCurrent": True})
|
|
75
|
+
|
|
76
|
+
return branches
|
|
77
|
+
except (subprocess.TimeoutExpired, FileNotFoundError, OSError):
|
|
78
|
+
pass
|
|
79
|
+
return []
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _build_workspace_entry(workspace_path, diff_data):
|
|
83
|
+
"""为单个 workspace 构建 payload 条目。"""
|
|
84
|
+
has_changes = diff_data.get("has_changes", False)
|
|
85
|
+
repo_name = os.path.basename(workspace_path)
|
|
86
|
+
|
|
87
|
+
if has_changes:
|
|
88
|
+
current_branch = _get_current_branch(workspace_path)
|
|
89
|
+
remote_branches = _get_remote_branches(workspace_path, current_branch)
|
|
90
|
+
diff_summary = {
|
|
91
|
+
"changed_files": diff_data.get("changed_files", []),
|
|
92
|
+
"stat_summary": diff_data.get("stat_summary", ""),
|
|
93
|
+
}
|
|
94
|
+
else:
|
|
95
|
+
current_branch = ""
|
|
96
|
+
remote_branches = []
|
|
97
|
+
diff_summary = None
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
"workspace": workspace_path,
|
|
101
|
+
"repoName": repo_name,
|
|
102
|
+
"currentBranch": current_branch,
|
|
103
|
+
"remoteBranches": remote_branches,
|
|
104
|
+
"hasChanges": has_changes,
|
|
105
|
+
"diffSummary": diff_summary,
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _handle_cache_mode(args):
|
|
110
|
+
"""从缓存读取 diff 数据,自动构建 workspaces 并验证。"""
|
|
111
|
+
git_diffs = get_all_git_diffs()
|
|
112
|
+
|
|
113
|
+
if not git_diffs:
|
|
114
|
+
print(json.dumps({"error": f"缓存中无 git_diffs 数据(缓存路径: {CACHE_PATH})。"
|
|
115
|
+
"请确保步骤 2 已执行 git_diff_cli.py"}, ensure_ascii=False))
|
|
116
|
+
sys.exit(1)
|
|
117
|
+
|
|
118
|
+
# 解析 bound_card
|
|
119
|
+
bound_card = None
|
|
120
|
+
if args.bound_card and args.bound_card.lower() != "null":
|
|
121
|
+
try:
|
|
122
|
+
bound_card = json.loads(args.bound_card)
|
|
123
|
+
except json.JSONDecodeError as e:
|
|
124
|
+
print(json.dumps({"error": f"--bound-card JSON 解析失败: {e}"}, ensure_ascii=False))
|
|
125
|
+
sys.exit(1)
|
|
126
|
+
|
|
127
|
+
# 构建 workspaces 数组
|
|
128
|
+
workspaces = []
|
|
129
|
+
for workspace_path, diff_data in git_diffs.items():
|
|
130
|
+
ws_entry = _build_workspace_entry(workspace_path, diff_data)
|
|
131
|
+
workspaces.append(ws_entry)
|
|
132
|
+
|
|
133
|
+
# 构建完整 payload
|
|
134
|
+
raw = {
|
|
135
|
+
"commitMessage": args.commit_message,
|
|
136
|
+
"boundCard": bound_card,
|
|
137
|
+
"workspaces": workspaces,
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
converted, errors = convert_git_commit_payload(raw)
|
|
141
|
+
|
|
142
|
+
if errors:
|
|
143
|
+
print(json.dumps({"valid": False, "errors": errors}, ensure_ascii=False))
|
|
144
|
+
else:
|
|
145
|
+
print(json.dumps({"valid": True, "payload": converted}, ensure_ascii=False))
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def _handle_json_mode(args):
|
|
149
|
+
"""原有 --json 模式,直接解析传入的 JSON 进行验证。"""
|
|
150
|
+
try:
|
|
151
|
+
data = json.loads(args.json)
|
|
152
|
+
except json.JSONDecodeError as e:
|
|
153
|
+
print(json.dumps({"error": f"JSON 解析失败: {e}"}, ensure_ascii=False))
|
|
154
|
+
sys.exit(1)
|
|
155
|
+
|
|
156
|
+
converted, errors = convert_git_commit_payload(data)
|
|
157
|
+
|
|
158
|
+
if errors:
|
|
159
|
+
print(json.dumps({"valid": False, "errors": errors}, ensure_ascii=False))
|
|
160
|
+
else:
|
|
161
|
+
print(json.dumps({"valid": True, "payload": converted}, ensure_ascii=False))
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def main():
|
|
165
|
+
"""解析命令行参数,构建并验证 git-commit UI payload。"""
|
|
166
|
+
parser = argparse.ArgumentParser(description="构建并验证 git-commit UI payload")
|
|
167
|
+
|
|
168
|
+
# 缓存模式参数
|
|
169
|
+
parser.add_argument("--cache", action="store_true",
|
|
170
|
+
help="从统一缓存读取 git_diff 数据,自动构建 workspaces")
|
|
171
|
+
parser.add_argument("--commit-message", default=None,
|
|
172
|
+
help="commit message(--cache 模式必填)")
|
|
173
|
+
parser.add_argument("--bound-card", default=None,
|
|
174
|
+
help="绑定卡片 JSON(--cache 模式,传 'null' 表示无卡片)")
|
|
175
|
+
|
|
176
|
+
# JSON 模式参数(向后兼容)
|
|
177
|
+
parser.add_argument("--json", default=None,
|
|
178
|
+
help="payload 数据 JSON(向后兼容,与 --cache 二选一)")
|
|
179
|
+
|
|
180
|
+
args = parser.parse_args()
|
|
181
|
+
|
|
182
|
+
if args.cache:
|
|
183
|
+
if not args.commit_message:
|
|
184
|
+
print(json.dumps({"error": "--cache 模式下 --commit-message 为必填参数"}, ensure_ascii=False))
|
|
185
|
+
sys.exit(1)
|
|
186
|
+
_handle_cache_mode(args)
|
|
187
|
+
elif args.json:
|
|
188
|
+
_handle_json_mode(args)
|
|
189
|
+
else:
|
|
190
|
+
print(json.dumps({"error": "必须提供 --cache 或 --json 参数"}, ensure_ascii=False))
|
|
191
|
+
sys.exit(1)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
if __name__ == "__main__":
|
|
195
|
+
main()
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""命令行工具:构建并验证 icafe-cards UI payload
|
|
2
|
+
|
|
3
|
+
用法:
|
|
4
|
+
python3 build_icafe_cards_payload.py --view-mode list --default-title "优化 xxx 相关功能"
|
|
5
|
+
|
|
6
|
+
输入:
|
|
7
|
+
--result-file: match_card_cli.py 的输出 JSON 文件路径(可选,默认读取 /tmp/__comate_icafe_result.json)
|
|
8
|
+
--view-mode: "list" 或 "create"(必填,模型决策)
|
|
9
|
+
--default-title: 推荐卡片标题(必填,模型根据 diff 生成)
|
|
10
|
+
--cards: 排序后的卡片列表 JSON(可选,不传则使用 result 中的原始 cards)
|
|
11
|
+
|
|
12
|
+
脚本从 result 文件读取所有数据,完成 snake_case → camelCase 转换,
|
|
13
|
+
覆盖模型决策字段(viewMode、defaults.title、cards),验证后输出 payload。
|
|
14
|
+
Agent 不需要手动转换任何字段名,不需要拼 JSON。
|
|
15
|
+
|
|
16
|
+
输出:
|
|
17
|
+
验证通过: {"valid": true, "payload": {...}}
|
|
18
|
+
验证失败: {"valid": false, "errors": ["...", ...]}
|
|
19
|
+
系统错误: {"error": "..."}
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
import argparse
|
|
23
|
+
import json
|
|
24
|
+
import os
|
|
25
|
+
import sys
|
|
26
|
+
|
|
27
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
28
|
+
from cache_manager import get_icafe_result, CACHE_PATH
|
|
29
|
+
from payload_validators import convert_icafe_cards_payload
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def main():
|
|
33
|
+
"""解析命令行参数,构建并验证 icafe-cards UI payload。"""
|
|
34
|
+
parser = argparse.ArgumentParser(description="构建并验证 icafe-cards UI payload")
|
|
35
|
+
parser.add_argument("--result-file", default=None,
|
|
36
|
+
help="已废弃,忽略此参数。脚本自动从统一缓存读取")
|
|
37
|
+
parser.add_argument("--view-mode", required=True, choices=["list", "create"], help="视图模式")
|
|
38
|
+
parser.add_argument("--default-title", required=True, help="默认卡片标题")
|
|
39
|
+
parser.add_argument("--cards", default=None, help="排序后的卡片列表 JSON(可选)")
|
|
40
|
+
args = parser.parse_args()
|
|
41
|
+
|
|
42
|
+
# 从统一缓存读取 result
|
|
43
|
+
result = get_icafe_result()
|
|
44
|
+
if result is None:
|
|
45
|
+
print(json.dumps({"error": f"缓存中无 icafe_result 数据(缓存路径: {CACHE_PATH})"}, ensure_ascii=False))
|
|
46
|
+
sys.exit(1)
|
|
47
|
+
|
|
48
|
+
if not isinstance(result, dict):
|
|
49
|
+
print(json.dumps({"error": "result 文件内容必须是 JSON 对象"}, ensure_ascii=False))
|
|
50
|
+
sys.exit(1)
|
|
51
|
+
|
|
52
|
+
# 覆盖模型决策字段
|
|
53
|
+
result["viewMode"] = args.view_mode
|
|
54
|
+
|
|
55
|
+
# 覆盖 defaults.title
|
|
56
|
+
if "defaults" not in result or not isinstance(result["defaults"], dict):
|
|
57
|
+
result["defaults"] = {}
|
|
58
|
+
result["defaults"]["title"] = args.default_title
|
|
59
|
+
|
|
60
|
+
# 覆盖 cards(如果传了 --cards)
|
|
61
|
+
if args.cards is not None:
|
|
62
|
+
try:
|
|
63
|
+
cards = json.loads(args.cards)
|
|
64
|
+
if isinstance(cards, list):
|
|
65
|
+
result["cards"] = cards
|
|
66
|
+
except json.JSONDecodeError:
|
|
67
|
+
print(json.dumps({"error": "--cards 参数 JSON 解析失败"}, ensure_ascii=False))
|
|
68
|
+
sys.exit(1)
|
|
69
|
+
|
|
70
|
+
# 转换 + 验证
|
|
71
|
+
converted, errors = convert_icafe_cards_payload(result)
|
|
72
|
+
|
|
73
|
+
if errors:
|
|
74
|
+
print(json.dumps({"valid": False, "errors": errors}, ensure_ascii=False))
|
|
75
|
+
else:
|
|
76
|
+
print(json.dumps({"valid": True, "payload": converted}, ensure_ascii=False))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if __name__ == "__main__":
|
|
80
|
+
main()
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""统一的缓存文件管理模块
|
|
2
|
+
|
|
3
|
+
所有脚本共享一个缓存文件 /tmp/__comate_auto_commit_cache.json,
|
|
4
|
+
结构为 {"icafe_result": {...}, "git_diffs": {"/path": {...}}}。
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
import os
|
|
9
|
+
|
|
10
|
+
# 统一缓存文件路径(唯一声明位置)
|
|
11
|
+
CACHE_PATH = "/tmp/__comate_auto_commit_cache.json"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def read_cache():
|
|
15
|
+
"""读取完整缓存 dict。文件不存在或解析失败返回空 dict。"""
|
|
16
|
+
try:
|
|
17
|
+
with open(CACHE_PATH, "r", encoding="utf-8") as f:
|
|
18
|
+
return json.load(f)
|
|
19
|
+
except (OSError, json.JSONDecodeError):
|
|
20
|
+
return {}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def write_cache(data):
|
|
24
|
+
"""将完整 dict 写入缓存文件。失败静默忽略。"""
|
|
25
|
+
try:
|
|
26
|
+
with open(CACHE_PATH, "w", encoding="utf-8") as f:
|
|
27
|
+
json.dump(data, f, ensure_ascii=False)
|
|
28
|
+
except OSError:
|
|
29
|
+
pass
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def update_icafe_result(result):
|
|
33
|
+
"""更新缓存中的 icafe_result 字段。"""
|
|
34
|
+
cache = read_cache()
|
|
35
|
+
cache["icafe_result"] = result
|
|
36
|
+
write_cache(cache)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def update_git_diff(workspace, diff_data):
|
|
40
|
+
"""更新缓存中指定 workspace 的 git_diff 数据。"""
|
|
41
|
+
cache = read_cache()
|
|
42
|
+
if "git_diffs" not in cache:
|
|
43
|
+
cache["git_diffs"] = {}
|
|
44
|
+
cache["git_diffs"][workspace] = diff_data
|
|
45
|
+
write_cache(cache)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def get_icafe_result():
|
|
49
|
+
"""读取缓存中的 icafe_result。不存在返回 None。"""
|
|
50
|
+
return read_cache().get("icafe_result")
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def get_git_diff(workspace):
|
|
54
|
+
"""读取缓存中指定 workspace 的 git_diff。不存在返回 None。"""
|
|
55
|
+
return read_cache().get("git_diffs", {}).get(workspace)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def get_all_git_diffs():
|
|
59
|
+
"""读取缓存中所有 workspace 的 git_diff dict。不存在返回空 dict。"""
|
|
60
|
+
return read_cache().get("git_diffs", {})
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def cleanup():
|
|
64
|
+
"""删除缓存文件。用于 skill 流程结束时清理。"""
|
|
65
|
+
try:
|
|
66
|
+
if os.path.exists(CACHE_PATH):
|
|
67
|
+
os.remove(CACHE_PATH)
|
|
68
|
+
except OSError:
|
|
69
|
+
pass
|
|
@@ -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()
|