Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

feat: 新增 gitcode-api SKILL

SushiNinja5343fb312940
diff --git a/jiuwenswarm/resources/.env.template b/jiuwenswarm/resources/.env.template
index 0a655076fa..7a6c500174 100644
--- a/jiuwenswarm/resources/.env.template
+++ b/jiuwenswarm/resources/.env.template
@@ -124,3 +124,7 @@ EXTENSION_DIRS=""
# Use English commas only; add "none" to allow connections without an Origin header.
JIUWENSWARM_ENABLE_ORIGIN_CHECK=0
JIUWENSWARM_WS_ALLOWED_ORIGIN_HOSTS=127.0.0.1,localhost
+
+# For GitCode Operations
+# Create one at https://gitcode.com/setting/token-classic
+GITCODE_ACCESS_TOKEN=
diff --git a/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/CHANGELOG.md b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/CHANGELOG.md
new file mode 100644
index 0000000000..e9262e3606
--- /dev/null
+++ b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/CHANGELOG.md
@@ -0,0 +1,21 @@
+# 1.0.0 - 初始版本
+
+## 改动
+初始版本,包含一个特定任务(summarize-repo-changes)
+
+## 新增
+- gitcode-api/CHANGELOG.md
+- gitcode-api/SKILL.md
+- gitcode-api/references/cli-usage.md
+- gitcode-api/references/command-discovery.md
+- gitcode-api/references/common-recipes.md
+- gitcode-api/references/install-and-auth.md
+- gitcode-api/references/troubleshooting.md
+- gitcode-api/scripts/gitcode_api_cli.py
+- gitcode-api/tasks/summarize-repo-changes.md
+
+## 更新
+
+## 删除
+
+---
diff --git a/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/SKILL.md b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/SKILL.md
new file mode 100644
index 0000000000..4cd799b84b
--- /dev/null
+++ b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/SKILL.md
@@ -0,0 +1,92 @@
+---
+name: gitcode-api
+description: 使用 gitcode-api 命令行工具访问 GitCode REST API。适用于需要查询仓库、Issue、Pull Request、文件内容、用户、组织、搜索结果,或需要获取 Issue 与 Pull Request 模版的场景。还可用于总结仓库最近 commit / PR / issue、责任人、模块、风险或对外接口影响。
+version: 1.0.0
+metadata:
+ version: 1.0.0
+---
+
+# gitcode-api CLI
+
+使用 `gitcode-api` 命令行调用 GitCode REST API。这个技能只覆盖 `gitcode-api` 1.2.14 及以上版本的 CLI。
+
+## Quickstart
+
+1. 先确认 CLI 是否可用:
+
+```bash
+gitcode-api --version
+```
+
+2. 如果未安装或版本低于 `1.2.14`,提示用户安装或升级:
+
+```bash
+pip install -U gitcode-api
+```
+
+也可以使用 `uv` 临时运行或安装:
+
+```bash
+uvx gitcode-api --version
+uv pip install -U gitcode-api
+```
+
+3. 优先使用环境变量保存 token,避免把 token 写进命令历史:
+- 用户需要在 `~/.jiuwenclaw/config/.env` 中配置 `GITCODE_ACCESS_TOKEN` 环境变量
+- 若用户没有GitCode token,告知可以使用此链接新建并按需配置读写权限:https://gitcode.com/setting/token-classic
+
+4. CLI 基本形状:
+
+```bash
+gitcode-api <resource> <method> [options]
+```
+
+例如:
+
+```bash
+gitcode-api repos get --owner openJiuwen --repo agent-core
+gitcode-api pulls list --owner openJiuwen --repo agent-core --state open
+gitcode-api search repositories --q sdk
+```
+
+5. 不确定命令或参数时,先看 help,不要猜参数:
+
+```bash
+gitcode-api --help
+gitcode-api pulls --help
+gitcode-api pulls create --help
+```
+
+## 使用原则
+
+- 优先运行 `gitcode-api --version` 和分级 help 来确认本机实际 CLI 能力。
+- 资源组和方法名使用 kebab-case,例如 SDK 的 `build_authorize_url` 在 CLI 中是 `build-authorize-url`。
+- 大多数命令输出 JSON;需要机器处理时使用 `--compact`,需要保存结果时使用 `--output-file`。
+- 遇到 `**params` 或 `**payload` 类型的额外参数,用 `--set key=value` 或 `--set-json '{...}'`。
+- 如果用户要求的是完整开发流程、提交、创建 PR、解决 Issue,本技能只负责 GitCode CLI 查询或调用部分,不负责端到端工程流程。
+
+## 何时阅读参考文件
+
+- 安装、版本、token、`uv` 用法:读 [references/install-and-auth.md](references/install-and-auth.md)。
+- CLI 语法、通用参数、输出保存、转义:读 [references/cli-usage.md](references/cli-usage.md)。
+- 查找资源组、方法、参数签名:读 [references/command-discovery.md](references/command-discovery.md)。
+- 常见任务示例:读 [references/common-recipes.md](references/common-recipes.md)。
+- 报错、权限、参数、MCP server 问题:读 [references/troubleshooting.md](references/troubleshooting.md)。
+
+## 任务文档
+
+- 总结仓库最近 commit / PR / issue、责任人、模块、风险或对外接口影响:读 [tasks/summarize-repo-changes.md](tasks/summarize-repo-changes.md)。
+
+## 脚本入口
+
+如果当前环境更适合运行 Python 脚本(不建议),可调用:
+
+```bash
+python scripts/gitcode_api_cli.py --help
+```
+
+该脚本只是 `gitcode_api.cli.main` 的薄封装,行为应与 `gitcode-api` 控制台命令一致。
+
+## 企业网络 SSL / 自定义 CA
+
+可通过设置环境变量 `GITCODE_CA_BUNDLE` 或 `REQUESTS_CA_BUNDLE` 指定默认**CA 证书路径**。
diff --git a/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/cli-usage.md b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/cli-usage.md
new file mode 100644
index 0000000000..bdbe95c08f
--- /dev/null
+++ b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/cli-usage.md
@@ -0,0 +1,65 @@
+# CLI 使用规则
+
+## 命令形状
+
+```bash
+gitcode-api <resource> <method> [options]
+```
+
+## 常见资源组
+
+CLI 资源组来自同步客户端 `GitCode`:
+
+- `repos`:仓库元数据、仓库设置、fork、贡献者、事件、模板等。
+- `contents`:文件内容、raw 文件、tree、blob、创建/更新/删除文件。
+- `branches`:分支查询与创建。
+- `commits`:commit 查询、compare、commit comment。
+- `issues`:Issue 创建、查询、更新、评论、标签等。
+- `pulls`:Pull Request 创建、查询、更新、merge、评论、审查等。
+- `labels`、`milestones`、`members`、`releases`、`tags`、`webhooks`:对应仓库管理资源。
+- `users`、`orgs`:用户与组织相关接口。
+- `search`:搜索 `repositories`、`issues`、`users`。
+- `oauth`:OAuth token 与授权 URL 辅助方法。
+
+## 通用参数
+
+叶子命令通常支持:
+
+- `--api-key`:GitCode access token;默认读取 `GITCODE_ACCESS_TOKEN`。
+- `--base-url`:REST API base URL,通常不需要改。
+- `--timeout`:请求超时时间,单位秒。
+- `--output-file`:把响应写入文件。
+- `--compact`:输出单行 JSON。
+- `-e` / `--escape`:把参数中的 `\n`、`\t` 等转义序列还原。
+
+## 额外参数
+
+部分方法在 SDK 中接受 `**params` 或 `**payload`。CLI 对这类动态参数提供:
+
+```bash
+--set key=value
+--set-json '{"key": "value"}'
+--set-json @payload.json
+```
+
+`--set` 的 value 会先尝试按 JSON 解析;例如 `true` 会成为布尔值,`123` 会成为数字,解析失败才作为字符串。
+
+## 输出
+
+大多数命令输出 JSON:
+
+```bash
+gitcode-api search repositories --q sdk --compact
+```
+
+保存到文件:
+
+```bash
+gitcode-api repos get --owner openJiuwen --repo agent-core --output-file repo.json
+```
+
+raw bytes 接口也可以写文件,例如:
+
+```bash
+gitcode-api contents get-raw --owner openJiuwen --repo agent-core --path pyproject.toml --output-file jiuwenclaw_pyproject.toml
+```
diff --git a/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/command-discovery.md b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/command-discovery.md
new file mode 100644
index 0000000000..a7d913cfc9
--- /dev/null
+++ b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/command-discovery.md
@@ -0,0 +1,44 @@
+# 命令发现
+
+## 不要猜命令
+
+当不确定资源组、方法名或参数时,先运行 help:
+
+```bash
+gitcode-api --help
+gitcode-api <resource> --help
+gitcode-api <resource> <method> --help
+```
+
+示例:
+
+```bash
+gitcode-api pulls --help
+gitcode-api pulls create --help
+```
+
+资源级 help 会列出该资源组的 subcommands。方法级 help 开头会展示对应 SDK 方法签名,可直接据此补齐参数。
+
+## 命名映射
+
+Python SDK 方法名中的下划线在 CLI 中变成连字符:
+
+```text
+client.oauth.build_authorize_url(...) -> gitcode-api oauth build-authorize-url ...
+client.contents.get_raw(...) -> gitcode-api contents get-raw ...
+```
+
+资源组名称通常保持不变,例如 `repos`、`pulls`、`issues`、`search`。
+
+## 推荐发现流程
+
+1. 运行 `gitcode-api --version` 确认版本。
+2. 运行 `gitcode-api --help` 看当前安装版本暴露的资源组。
+3. 运行 `gitcode-api <resource> --help` 看方法列表。
+4. 运行 `gitcode-api <resource> <method> --help` 看参数签名。
+5. 只传 help 中确认存在的参数;不要传空字符串、空数组或猜测字段。
+6. 如果接口报错,先读错误信息,再回到方法 help 校正参数。
+
+## 与文档不一致时
+
+以本机 `gitcode-api ... --help` 为准。该 CLI 是从同步 SDK 资源方法动态生成的,不同安装版本可能暴露不同方法。
diff --git a/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/common-recipes.md b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/common-recipes.md
new file mode 100644
index 0000000000..7e3183d566
--- /dev/null
+++ b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/common-recipes.md
@@ -0,0 +1,294 @@
+# 常见任务示例
+
+示例中的 owner 和 repo 使用占位值;实际执行前替换为用户目标仓库。若本机安装版本不同,先用 `gitcode-api <resource> <method> --help` 确认参数。
+
+## 查看当前登录用户
+
+```bash
+gitcode-api users me
+```
+
+## 获取仓库概览
+
+用 CLI 分三步获取仓库元数据、分支和最近提交。
+
+```bash
+gitcode-api repos get --owner openJiuwen --repo agent-core
+gitcode-api branches list --owner openJiuwen --repo agent-core --per-page 5
+gitcode-api commits list --owner openJiuwen --repo agent-core --per-page 5
+```
+
+只需要单独信息时,可分别调用:
+
+```bash
+gitcode-api repos get --owner openJiuwen --repo agent-core --compact
+gitcode-api branches list --owner openJiuwen --repo agent-core --per-page 20
+gitcode-api commits list --owner openJiuwen --repo agent-core --per-page 20
+```
+
+## 列出分支
+
+CLI 只暴露同步命令形状,不区分 sync / async。
+
+```bash
+gitcode-api branches list --owner openJiuwen --repo agent-core --per-page 20
+```
+
+## 列出 Pull Requests
+
+```bash
+gitcode-api pulls list --owner openJiuwen --repo agent-core --state open --per-page 20
+```
+
+如果用户在环境中设置了 `GITCODE_PULL_STATE`,CLI 不会自动读取这个变量;需要显式传成 `--state "$GITCODE_PULL_STATE"`。
+
+## 获取 Pull Request 模板
+
+先列出 SDK 解析后的 active PR templates:
+
+```bash
+gitcode-api pulls list-templates --owner openJiuwen --repo agent-core
+```
+
+从返回结果中选择 `path`。如果模板来自继承解析后的其它仓库,使用返回里的 `template_owner` / `template_repo` 作为 `--owner` / `--repo`:
+
+```bash
+gitcode-api pulls get-template \
+ --owner openJiuwen \
+ --repo .gitcode \
+ --path .gitcode/PULL_REQUEST_TEMPLATE.md
+```
+
+把模板正文保存到文件:
+
+```bash
+gitcode-api pulls get-template \
+ --owner openJiuwen \
+ --repo .gitcode \
+ --path .gitcode/PULL_REQUEST_TEMPLATE.md \
+ --output-file PULL_REQUEST_TEMPLATE.md
+```
+
+## 创建 Pull Request
+
+先查看参数:
+
+```bash
+gitcode-api pulls create --help
+```
+
+再按签名传参,例如:
+
+```bash
+gitcode-api pulls create \
+ --owner openJiuwen \
+ --repo agent-core \
+ --title "Add feature" \
+ --head feature-branch \
+ --base main \
+ --body "Implements the new flow."
+```
+
+本技能只提供 CLI 调用方法;不要把它扩展成完整的开发、提交、解决 Issue、创建 PR 工作流。
+
+## 合并 Pull Request
+
+```bash
+gitcode-api pulls merge --owner openJiuwen --repo agent-core --number 42
+```
+
+执行破坏性或不可逆操作前,先向用户确认目标仓库、编号和意图。
+
+## 列出 Issues
+
+```bash
+gitcode-api issues list --owner openJiuwen --repo agent-core --state open
+```
+
+## 获取 Issue 模板
+
+先列出 SDK 解析后的 active issue templates:
+
+```bash
+gitcode-api issues list-templates --owner openJiuwen --repo agent-core
+```
+
+从返回结果中选择 `path`。如果模板来自继承解析后的其它仓库,使用返回里的 `template_owner` / `template_repo` 作为 `--owner` / `--repo`:
+
+```bash
+gitcode-api issues get-template \
+ --owner openJiuwen \
+ --repo .gitcode \
+ --path .gitcode/ISSUE_TEMPLATE.zh/001-bug-report.yml
+```
+
+把模板正文保存到文件:
+
+```bash
+gitcode-api issues get-template \
+ --owner openJiuwen \
+ --repo .gitcode \
+ --path .gitcode/ISSUE_TEMPLATE.zh/001-bug-report.yml \
+ --output-file ISSUE_TEMPLATE_BUG_REPORT.zh.yml
+```
+
+## 创建 Issue
+
+```bash
+gitcode-api issues create \
+ --owner openJiuwen \
+ --repo agent-core \
+ --title "Bug report" \
+ --body "Steps to reproduce..."
+```
+
+## 搜索仓库
+
+```bash
+gitcode-api search repositories --q sdk
+```
+
+带分页参数时,先用 help 确认该版本支持的参数名:
+
+```bash
+gitcode-api search repositories --help
+```
+
+## 获取文件内容
+
+```bash
+gitcode-api contents get --owner openJiuwen --repo agent-core --path <repo-file-path>
+```
+
+获取 raw 文件并保存:
+
+```bash
+gitcode-api contents get-raw \
+ --owner openJiuwen \
+ --repo agent-core \
+ --path <repo-file-path> \
+ --output-file <output-file>
+```
+
+## 列出 Releases
+
+```bash
+gitcode-api releases list \
+ --owner openJiuwen \
+ --repo agent-core \
+ --per-page 50 \
+ --page 1
+```
+
+如需翻页,递增 `--page`,直到返回数量小于 `--per-page`。
+
+## 列出 Tags
+
+读取 GitCode tags 并建立 tag 到 commit sha 映射时,可以分页列出 tags。
+
+```bash
+gitcode-api tags list \
+ --owner openJiuwen \
+ --repo agent-core \
+ --per-page 50 \
+ --page 1
+```
+
+## 创建 Release
+
+```bash
+gitcode-api releases create \
+ --owner openJiuwen \
+ --repo agent-core \
+ --tag v1.2.3 \
+ --name "1.2.3" \
+ --body "Release notes..." \
+ --target-commitish <commit-sha> \
+ --release-status latest
+```
+
+预发布可使用:
+
+```bash
+gitcode-api releases create \
+ --owner openJiuwen \
+ --repo agent-core \
+ --tag v1.2.3-rc.1 \
+ --name "1.2.3 rc1" \
+ --body "Release candidate notes..." \
+ --target-commitish <commit-sha> \
+ --release-status pre
+```
+
+创建 release 会改变远端仓库状态;执行前先向用户确认 tag、目标 commit、标题和正文。
+
+## 上传 Release 附件
+
+```bash
+gitcode-api releases upload \
+ --owner openJiuwen \
+ --repo agent-core \
+ --tag v1.2.3 \
+ --file-name dist.zip \
+ --content dist.zip \
+ --upload-timeout 6000
+```
+
+`--content` 可以传文件路径,SDK 会读取该路径的 bytes 后上传。复杂同步或大量附件上传更适合写 Python 脚本调用 SDK。
+
+## 使用额外查询参数
+
+```bash
+gitcode-api pulls list \
+ --owner openJiuwen \
+ --repo agent-core \
+ --set only_count=true \
+ --set reviewer=octocat
+```
+
+## 使用 JSON payload
+
+```bash
+gitcode-api repos update \
+ --owner openJiuwen \
+ --repo agent-core \
+ --set-json '{"description": "Updated from CLI", "has_wiki": false}'
+```
+
+payload 较长时写入文件:
+
+```bash
+gitcode-api repos update --owner openJiuwen --repo agent-core --set-json @payload.json
+```
+
+## 构建 OAuth 授权 URL
+
+```bash
+gitcode-api oauth build-authorize-url \
+ --client-id client-id \
+ --redirect-uri https://example.com/callback \
+ --scope user_info \
+ --state opaque-state
+```
+
+## 查看资源组和方法
+
+资源组列表:
+
+```bash
+gitcode-api --help
+```
+
+某个资源组的方法列表:
+
+```bash
+gitcode-api pulls --help
+```
+
+某个方法的签名和参数:
+
+```bash
+gitcode-api pulls list-issues --help
+```
+
+CLI help 的方法顺序与 SDK 的 `resource.methods` 顺序一致;方法级 help 开头会展示对应 SDK 签名。
diff --git a/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/install-and-auth.md b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/install-and-auth.md
new file mode 100644
index 0000000000..4640d31443
--- /dev/null
+++ b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/install-and-auth.md
@@ -0,0 +1,59 @@
+# 安装与认证
+
+## 版本要求
+
+本技能只覆盖 `gitcode-api` CLI `1.2.16` 及以上版本。使用前先检查:
+
+```bash
+gitcode-api --version
+```
+
+若命令不存在或版本过低,提示用户安装或升级。
+
+## 安装
+
+使用 pip:
+
+```bash
+pip install -U gitcode-api
+```
+
+使用 uv 安装到当前环境:
+
+```bash
+uv pip install -U gitcode-api
+```
+
+不想改动当前环境时,可以用 `uvx` 临时运行:
+
+```bash
+uvx gitcode-api --version
+```
+
+## 认证
+
+推荐用户在 `~/.jiuwenclaw/config/.env` 中配置 `GITCODE_ACCESS_TOKEN` 环境变量
+
+若用户坚持临时设置环境变量(Windows环境时):
+
+```bat
+set GITCODE_ACCESS_TOKEN=<your-token>
+```
+
+若用户坚持临时设置环境变量(MacOS / Linux):
+
+```bash
+export GITCODE_ACCESS_TOKEN=<your-token>
+```
+
+也可以在单次命令中传入:
+
+```bash
+gitcode-api users me --api-key "$GITCODE_ACCESS_TOKEN"
+```
+
+不要在回答中暴露用户 token。需要用户提供 token 时,提醒其使用环境变量或宿主平台的 secret 输入能力。
+
+## CLI 限制
+
+CLI 不暴露 Python SDK 的 `decrypt` 或自定义 `http_client` 能力。如果用户需要密文 token 解密、自定义 CA、代理或特殊 httpx client,应改用 Python SDK,而不是继续用 CLI 硬绕。
diff --git a/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/troubleshooting.md b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/troubleshooting.md
new file mode 100644
index 0000000000..3198b3b9d4
--- /dev/null
+++ b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/references/troubleshooting.md
@@ -0,0 +1,120 @@
+# Troubleshooting
+
+## `gitcode-api: command not found`
+
+安装或升级:
+
+```bash
+pip install -U gitcode-api
+```
+
+也可以临时运行:
+
+```bash
+uvx gitcode-api --version
+```
+
+## 版本低于 1.2.16
+
+升级:
+
+```bash
+pip install -U gitcode-api
+```
+
+然后重新检查:
+
+```bash
+gitcode-api --version
+```
+
+## token 或权限错误
+
+检查环境变量是否存在:
+
+```bash
+printf '%s\n' "${GITCODE_ACCESS_TOKEN:+GITCODE_ACCESS_TOKEN is set}"
+```
+
+不要打印 token 原文。若 token 已设置但仍失败,通常是权限范围、仓库可见性或 token 过期问题。
+若没有GitCode token,告知用户可以使用此链接新建并按需配置读写权限:https://gitcode.com/setting/token-classic
+
+## 缺少 owner / repo
+
+仓库相关命令通常需要 `--owner` 和 `--repo`:
+
+```bash
+gitcode-api repos get --owner <owner> --repo <repo>
+```
+
+如果报配置错误,回到方法 help 确认该方法需要哪些仓库上下文参数。
+
+## Unknown argument 或 Missing required parameter
+
+先看方法级 help:
+
+```bash
+gitcode-api <resource> <method> --help
+```
+
+只传该版本实际支持的参数。Python SDK 的下划线参数名在 CLI 中通常是连字符形式,例如 `pull_number` 变为 `--pull-number`。
+
+## JSON 参数解析失败
+
+`--set-json` 必须是 JSON object,或 `@` 加 JSON 文件路径:
+
+```bash
+gitcode-api repos update --owner <owner> --repo <repo> --set-json @payload.json
+```
+
+shell 中 JSON 引号容易出错时,优先使用文件。
+
+## 多行正文没有换行
+
+使用 `-e` / `--escape`:
+
+```bash
+gitcode-api pulls update ... --body 'Line1\nLine2' -e '\n'
+```
+
+## 企业网络 SSL / 自定义 CA
+
+可通过设置环境变量 `GITCODE_CA_BUNDLE` 或 `REQUESTS_CA_BUNDLE` 指定默认**CA 证书路径**。
+
+## 文档与反馈
+
+- [官方文档](https://gitcode-api.readthedocs.io)
+- [Changelog](https://gitcode-api.readthedocs.io/en/latest/changelog.html)
+
+若以上步骤仍无法解决问题,欢迎在仓库提交 Issue:
+
+- [GitHub Issues](https://github.com/Trenza1ore/GitCode-API/issues)
+- [GitCode Issues](https://gitcode.com/SushiNinja/GitCode-API/issues)
+
+## 创建 Issue 反馈示例
+
+> 请与用户确认,不要直接自行创建。推荐告知用户 GitHub / GitCode Issue 链接并由用户创建,可帮用户构思标题与正文。
+
+### 自行创建 GitCode Issue
+
+需已设置 `GITCODE_ACCESS_TOKEN`(见上文 token 小节):
+
+```bash
+gitcode-api issues create \
+ --owner "Trenza1ore" \
+ --repo "GitCode-API" \
+ --title "gitcode-api CLI feedback" \
+ --body "What happened and what you expected..."
+```
+
+### 自行创建 GitHub Issue
+
+技能目录下的 [scripts/open_github_issue.py](../scripts/open_github_issue.py) 依赖 [githubkit](https://github.com/yanyongyu/githubkit)。在技能根目录执行,需设置 `GITHUB_ACCESS_TOKEN`(或传入`--api-key`):
+
+```bash
+uv run --with githubkit scripts/open_github_issue.py \
+ "gitcode-api CLI feedback" \
+ --body "What happened and what you expected..."
+```
+
+可选 `--label`(可重复),例如 `--label bug`。未传 `--owner` / `--repo` 时默认为 `Trenza1ore/GitCode-API`。
diff --git a/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/scripts/gitcode_api_cli.py b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/scripts/gitcode_api_cli.py
new file mode 100644
index 0000000000..fb68207898
--- /dev/null
+++ b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/scripts/gitcode_api_cli.py
@@ -0,0 +1,6 @@
+"""Run the gitcode-api package CLI from this skill."""
+
+from gitcode_api.cli import main
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/scripts/open_github_issue.py b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/scripts/open_github_issue.py
new file mode 100644
index 0000000000..7e74376158
--- /dev/null
+++ b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/scripts/open_github_issue.py
@@ -0,0 +1,55 @@
+"""Create a GitHub issue (e.g. feedback for GitCode-API)."""
+
+import argparse
+from functools import partial
+import os
+import sys
+from typing import Optional, Sequence
+
+from githubkit import GitHub
+
+DEFAULT_OWNER = "Trenza1ore"
+DEFAULT_REPO = "GitCode-API"
+API_VERSION = "2026-03-10"
+
+output_content = partial(print)
+
+
+def main(argv: Optional[Sequence[str]] = None) -> int:
+ """Main CLI entry point."""
+ parser = argparse.ArgumentParser(description="Create a GitHub issue.")
+ parser.add_argument("title", help="Issue title")
+ parser.add_argument("--body", default="", required=True, help="Issue body")
+ parser.add_argument(
+ "--label",
+ dest="labels",
+ action="append",
+ help="Label (repeatable)",
+ )
+ parser.add_argument("--owner", default=DEFAULT_OWNER)
+ parser.add_argument("--repo", default=DEFAULT_REPO)
+ parser.add_argument("--api-key", default="", help="GitHub API Token")
+ args = parser.parse_args(argv)
+
+ token = os.getenv("GITHUB_ACCESS_TOKEN") or args.api_key
+ if not token:
+ output_content("GITHUB_ACCESS_TOKEN is not set", file=sys.stderr)
+ return 1
+
+ payload: dict = {
+ "owner": args.owner,
+ "repo": args.repo,
+ "title": args.title,
+ "body": args.body,
+ }
+ if args.labels:
+ payload["labels"] = list(args.labels)
+
+ gh = GitHub(auth=token)
+ resp = gh.rest(version=API_VERSION).issues.create(**payload)
+ output_content(resp.parsed_data)
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/tasks/summarize-repo-changes.md b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/tasks/summarize-repo-changes.md
new file mode 100644
index 0000000000..068f395319
--- /dev/null
+++ b/jiuwenswarm/resources/agent/workspace/skills/gitcode-api/tasks/summarize-repo-changes.md
@@ -0,0 +1,387 @@
+# 总结仓库最近改动
+
+## 目标
+
+围绕 GitCode 仓库最近的 commit / PR / issue 生成高可信摘要,重点回答以下问题:
+
+- 最近 x 条内容主要做了什么。
+- 责任人是谁,是否限定到某个 GitCode 用户。
+- 改到了哪些代码模块。
+- 可能引入了什么风险。
+- 改到了哪些对外接口。
+
+默认使用 `gitcode-api` CLI 获取结构化结果。
+
+## 需确认的输入
+
+优先收集这些输入;缺失时补问:
+
+- `owner`: GitCode 仓库所属空间 path。
+- `repo`: GitCode 仓库 path。
+- `kind`: `commit` / `pull request` / `issue`。
+- `limit`: 最近多少条,默认 5,建议不超过 20。
+- `filter_user`: 可选,按 GitCode 用户过滤。
+- `focus`: 用户更关心哪类输出:
+ - 内容摘要 + 责任人
+ - 模块 + 风险 + 责任人
+ - 对外接口 + 责任人
+- `repo_dir`: 可选;当用户要求“模块”或“对外接口”分析时,检查本地仓库目录能显著提高准确率。
+
+## 核心规则
+
+- 先确认 `gitcode-api --version` 是 `1.2.16` 或更高;命令不可用时按 `references/install-and-auth.md` 处理。
+- 不要只复述标题;要尽量基于详情、文件路径、patch、issue 正文或评论来总结。
+- 不要把“作者 / 创建者 / assignee / reviewer / tester”混成一个字段;必须说明你把谁视为“主要责任人”。
+- 责任人可以有多个,次要责任人也要报告,均需输出用户名。
+- 不要编造风险或接口变更;证据不足时明确写“未发现明确证据”或“仅为推测”。
+- 当用户要“最近 x 条”,默认按服务端最近更新时间倒序获取;若 CLI 方法不直接支持排序参数,以接口默认顺序为准并说明限制。
+- 单次 CLI 调用返回内容不全时,多次调用补全,不要漏掉必要信息。
+- 哪怕用户只说明总结 Issue 或 PR,实际执行时也要检查 Issue 关联的 PR、PR 关联的 Issue 或正文中出现的交叉引用线索。
+- 最后报告时,先给总览,再挑最重要的几条展开。
+
+## CLI 用法确认
+
+不同版本可能有细微差异。执行前先用 help 确认参数:
+
+```bash
+gitcode-api commits list --help
+gitcode-api pulls list --help
+gitcode-api issues list --help
+```
+
+需要补详情时继续确认:
+
+```bash
+gitcode-api commits get --help
+gitcode-api pulls get --help
+gitcode-api pulls list-files --help
+gitcode-api pulls list-commits --help
+gitcode-api issues get --help
+gitcode-api issues list-comments --help
+```
+
+所有示例都可改用脚本入口(不建议):
+
+```bash
+python scripts/gitcode_api_cli.py <resource> <method> [options]
+```
+
+## 如何搜集必要信息
+
+### 1. 提交(Commit)总结
+
+获取最近 commits:
+
+```bash
+gitcode-api commits list \
+ --owner <owner> \
+ --repo <repo> \
+ --per-page <limit> \
+ --compact
+```
+
+可选限定分支或路径:
+
+```bash
+gitcode-api commits list \
+ --owner <owner> \
+ --repo <repo> \
+ --sha <branch-or-sha> \
+ --path <path> \
+ --per-page <limit>
+```
+
+用户指定 GitCode 用户时,先拉取足够数量的最近 commits,再在返回结果中按 author / committer 字段过滤;`commits list` 不直接暴露 `author` / `since` / `until` 时不要伪造筛选。
+
+对选中的每条 commit 补详情:
+
+```bash
+gitcode-api commits get \
+ --owner <owner> \
+ --repo <repo> \
+ --sha <sha> \
+ --compact
+```
+
+需要比较两个 ref 时:
+
+```bash
+gitcode-api commits compare \
+ --owner <owner> \
+ --repo <repo> \
+ --base <base> \
+ --head <head>
+```
+
+### 2. 拉取请求(Pull request)总结
+
+获取最近 PR:
+
+```bash
+gitcode-api pulls list \
+ --owner <owner> \
+ --repo <repo> \
+ --per-page <limit> \
+ --compact
+```
+
+如果该版本 help 支持排序参数,可按 help 添加 `--sort updated`、`--direction desc` 或等价参数;不支持时不要传不存在的 flag。
+
+用户指定 GitCode 用户时,先拉取最近 PR,再在返回结果中按 creator / assignee / reviewer / tester 等字段过滤。
+
+对每条 PR 补详情:
+
+```bash
+gitcode-api pulls get \
+ --owner <owner> \
+ --repo <repo> \
+ --number <number> \
+ --compact
+```
+
+分析 PR 改动范围时,默认优先拉文件和提交列表:
+
+```bash
+gitcode-api pulls list-files \
+ --owner <owner> \
+ --repo <repo> \
+ --number <number> \
+ --compact
+
+gitcode-api pulls list-commits \
+ --owner <owner> \
+ --repo <repo> \
+ --number <number> \
+ --compact
+```
+
+如果接口失败或数据不足,再从 PR 详情中取 `base.ref` / `base.sha` 与 `head.ref` / `head.sha`,调用 `commits compare` 补全。优先使用 SHA;缺失时再退到分支名。
+
+### 3. 工单(Issue)总结
+
+获取最近 issues:
+
+```bash
+gitcode-api issues list \
+ --owner <owner> \
+ --repo <repo> \
+ --per-page <limit> \
+ --compact
+```
+
+如果该版本 help 支持排序参数,可按 help 添加 `--sort updated`、`--direction desc` 或等价参数;不支持时不要传不存在的 flag。
+
+用户指定 GitCode 用户时,先拉取最近 issues,再在返回结果中按 creator / assignee 字段过滤。
+
+对每条 issue 补详情和评论:
+
+```bash
+gitcode-api issues get \
+ --owner <owner> \
+ --repo <repo> \
+ --number <number> \
+ --compact
+
+gitcode-api issues list-comments \
+ --owner <owner> \
+ --repo <repo> \
+ --number <number> \
+ --per-page 100 \
+ --compact
+```
+
+issue 通常没有代码 diff;因此模块、风险、接口分析应基于:
+
+- issue 标题与正文。
+- 评论中的设计、验收、联动信息。
+- 是否提及 PR、commit、分支、服务名、接口名。
+- 若有本地仓库和对应 PR / commit 线索,再继续下钻。
+
+### 4. 总结任务中的交叉引用
+
+Issue 与 Pull Request 天然互相连接。总结 issue 时,需要同时检查关联的 pull requests;总结 PR 时,也要检查标题、正文、评论或提交信息里关联的 issue。
+
+CLI 没有直接返回关联对象时,按证据逐步处理:
+
+1. 在 PR / issue 标题、正文、评论、commit message 中寻找 `#123`、`!123`、URL、分支名或 commit sha。
+2. 对明确编号调用 `issues get` 或 `pulls get`。
+3. 对只有 commit sha 的线索调用 `commits get`。
+4. 证据不足时,在报告中写明“未发现明确关联”。
+
+## 责任人的定义
+
+不同对象的“责任人”定义不同,输出时必须写清楚:
+
+- `commit`: 默认责任人是 commit author;committer / merger 视为协作角色。
+- `pull request`: 默认责任人是 PR creator;若有 assignees,可写“主责任人候选”;reviewer / tester 视为协作角色。
+- `issue`: 默认责任人优先取 assignee;没有 assignee 时退回 creator。
+
+建议统一输出:
+
+- `primary_owner`
+- `collaborators`
+- `evidence`
+
+## 模块改动分析
+
+优先根据改动文件路径归纳模块,而不是根据 commit message 猜。
+
+推荐顺序:
+
+1. 先聚合改动文件路径。
+2. 归纳 top-level 目录、子系统目录、包名或服务名。
+3. 若用户给了 `repo_dir`,再到本地仓库确认这些路径属于什么模块。
+
+常用判断方法:
+
+- 顶层目录:如 `frontend/`、`backend/`、`docs/`、`sdk/`
+- 服务目录:如 `services/xxx/`、`apps/xxx/`、`modules/xxx/`
+- 协议与接口目录:如 `api/`、`routes/`、`controllers/`、`handlers/`、`openapi/`、`proto/`
+- 基础设施目录:如 `migrations/`、`deploy/`、`helm/`、`terraform/`
+
+若只能看到零散文件名,就诚实输出“可能涉及某模块”,不要过度定性。
+
+## 风险分析
+
+风险必须绑定证据。优先给“为什么可能有风险”。
+
+高关注信号:
+
+- 数据库迁移、存储结构调整、索引变更。
+- 权限、认证、鉴权、租户隔离。
+- 缓存键、消息协议、异步任务。
+- 公共 SDK、公共库、共享组件。
+- 配置项、环境变量、网关、路由。
+- 大量删除、重命名、跨模块联动。
+- 测试缺失,或只改生产代码未见验证信息。
+
+输出建议分为:
+
+- `Low`: 影响面局部,改动集中。
+- `Medium`: 跨模块或配置 / 协议存在联动。
+- `High`: 数据、鉴权、兼容性、对外接口或大范围重构。
+
+如果证据不足,不要强行分级,可以写:
+
+- `Risk: unknown`
+- `Reason: 缺少 diff / 缺少本地仓库上下文`
+
+## 对外接口分析
+
+这里的“对外接口”优先指 **库 / SDK / 框架 / 服务 对外暴露给调用方的 interface**,而不是网络端口或基础设施端口。
+
+典型例子:
+
+- SDK 可调用入口,如 `client.chat.completions.create(...)`。
+- 公共导出类、函数、方法、命名空间。
+- 函数或方法的参数、默认值、可选项、返回结构。
+- OpenAPI / API schema / DTO / JSON schema / proto 中定义的请求与响应契约。
+- CLI 对外命令、子命令、flag、参数语义。
+
+只有在仓库本身明确提供 HTTP / RPC / GraphQL 等服务接口时,才把这些请求接口也视为“对外接口”的一部分。
+
+当用户明确要求“改了哪些对外接口”时,优先走下面流程:
+
+1. 获取变更对应的文件列表与 patch。
+2. 优先定位这些路径或代码区域:
+ - `sdk/`
+ - `client/`
+ - `clients/`
+ - `api/`
+ - `public/`
+ - `exports/`
+ - `interfaces/`
+ - `types/`
+ - `schemas/`
+ - `openapi/`
+ - `swagger/`
+ - `proto/`
+ - `cli/`
+3. 若用户给了 `repo_dir`,继续在本地仓库核实:
+ - 对外暴露的 API 接口 / 参数是否变化。
+ - 类 / 方法 / 函数签名是否变化。
+ - 参数名、参数类型、默认值、必填项是否变化。
+ - 返回值、响应 schema、异常或错误码是否变化。
+ - 调用入口链路是否变化,例如 `client.chat.completions.create`。
+4. 对每条候选接口,区分以下几类:
+ - 明确新增的对外接口。
+ - 明确修改的对外接口。
+ - 明确废弃或删除的对外接口。
+ - 仅内部实现变化、无证据表明 interface 变化。
+5. 最终输出时,优先写“接口名 + 变化点”。
+
+如果只有 issue 没有代码 diff,除非 issue 正文明确写了接口名、调用方式或参数变更,否则不要把需求描述当成“已发生接口改动”。
+
+## 推荐工作流程
+
+1. 先确认 `owner`、`repo`、`kind`、`limit`、`filter_user`、`focus`。
+2. 运行 `gitcode-api --version`;版本不满足时提示安装或升级。
+3. 用方法级 help 确认当前版本的 CLI 参数。
+4. 拉取最近记录列表,先做一轮粗筛,保留最相关的 x 条。
+5. 对每条记录补详情:
+ - commit: `gitcode-api commits get`,必要时 `gitcode-api commits compare`。
+ - PR: `gitcode-api pulls get`,必要时 `gitcode-api pulls list-files` / `gitcode-api pulls list-commits` / `gitcode-api commits compare`。
+ - issue: `gitcode-api issues get`,必要时 `gitcode-api issues list-comments`。
+6. 归一化责任人。
+7. 根据文件路径和 patch 归纳模块。
+8. 根据变更类型判断风险。
+9. 当 focus 包含“对外接口”时,优先结合本地仓库做二次核实。
+10. 以“结论先行、证据在后”的方式输出。
+
+## 输出模板
+
+### A. 最近 x 条内容,仅摘要(用户明确要求不要过于详细)
+
+```markdown
+## 摘要
+- [类型 #编号/sha] 一句话说明做了什么
+- [类型 #编号/sha] 一句话说明做了什么
+
+## 要点
+- 归纳 2-4 个主要主题
+```
+
+### B. 责任人 + 模块 + 风险
+
+```markdown
+## 摘要
+- 最近 <x> 条 <kind> 主要集中在:<themes>
+
+## 条目分解
+1. <identifier>
+ - Owner: <primary_owner>
+ - Modules: <module list>
+ - Risk: <Low/Medium/High/unknown>
+ - Reason: <why>
+
+## 跨条目风险
+- <shared risk>
+```
+
+### C. 责任人 + 对外接口
+
+```markdown
+## 摘要
+- 最近 <x> 条 <kind> 中,明确涉及的对外接口主要有:<interfaces>
+
+## 条目分解
+1. <identifier>
+ - Owner: <primary_owner>
+ - External interface: <endpoint / command / schema / exported API>
+ - Evidence: <path / patch / title / body>
+ - Confidence: <high / medium / low>
+```
+
+## 解读指引
+
+- “模块”尽量写成用户能理解的业务 / 技术模块,不要只贴裸文件名。
+- “风险”要讲原因,不要只给标签。
+- “对外接口”优先写用户可调用或可依赖的公开 interface 名称,以及具体变化点,例如方法名、参数、返回结构、导出符号或命令参数。
+- 当多条记录明显属于同一主题时,先做主题聚合,再展开逐条说明。
+
+## 安全规则
+
+- 不要把 issue 的创建人误写成代码变更责任人。
+- 不要把 reviewer / tester 自动认定为 owner。
+- 当 CLI 能力不够时,要明确说明你的回退方法或证据缺口。
+- 当没有本地仓库上下文时,对“模块”和“对外接口”的判断要降低置信度。
diff --git a/pyproject.toml b/pyproject.toml
index 3eb6cf6d3a..fc3698cbf0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -44,6 +44,7 @@ dependencies = [
"pyyaml>=6.0",
"httpx[socks]>=0.27",
"json-repair>=0.30.0",
+ "gitcode-api>=1.2.20",
]
[project.optional-dependencies]
diff --git a/uv.lock b/uv.lock
index ce702516a5..f17d22af63 100644
--- a/uv.lock
+++ b/uv.lock
@@ -1688,6 +1688,7 @@ dependencies = [
{ name = "dingtalk-stream" },
{ name = "discord-py" },
{ name = "fastapi" },
+ { name = "gitcode-api" },
{ name = "google-genai" },
{ name = "greenlet" },
{ name = "httpx", extra = ["socks"] },
@@ -1793,6 +1794,7 @@ requires-dist = [
{ name = "dingtalk-stream", specifier = ">=0.24.3" },
{ name = "discord-py", specifier = ">=2.4.0" },
{ name = "fastapi", specifier = ">=0.115" },
+ { name = "gitcode-api", specifier = ">=1.2.20" },
{ name = "google-genai", specifier = ">=1.68.0" },
{ name = "greenlet", specifier = ">=3.3.2" },
{ name = "httpx", extras = ["socks"], specifier = ">=0.27" },