v0.1.1: Gitea transport surface de-MCP — REST+swagger sole canon (adapter recipes, terminology map, review probes)
This commit is contained in:
@@ -12,7 +12,12 @@ Owner/repo 固定 `Octopus/octopus`。compaction 恢复从 Pattern 6
|
||||
## Pattern 1: read-wiki-page
|
||||
|
||||
```
|
||||
gitea_wiki__get_page(owner="Octopus", repo="octopus", page_name="{slug}/{page_title}")
|
||||
# 1. 列 wiki 页拿 mangled sub_url(绝不手工拼 mangled name)
|
||||
curl -fsS -H "Authorization: token <token>" \
|
||||
"<gitea-base-url>/api/v1/repos/Octopus/octopus/wiki/pages"
|
||||
# 2. 用返回的 sub_url 原样读页(含 %2F 编码与 .- 尾缀)
|
||||
curl -fsS -H "Authorization: token <token>" \
|
||||
"<gitea-base-url>/api/v1/repos/Octopus/octopus/wiki/page/{mangled-name}"
|
||||
```
|
||||
|
||||
常用页名(全量文法 + 例外枚举见 `core/rules/artifact-addressing.md` §2):
|
||||
@@ -45,7 +50,7 @@ gitea_wiki__get_page(owner="Octopus", repo="octopus", page_name="{slug}/{page_ti
|
||||
`{slug}/roadmap/{page}`、`{slug}/shared/{file}`、
|
||||
`{slug}/reviews/{roadmap|design-space|plan}/final/report`。
|
||||
|
||||
**本地回退(wiki MCP 工具不可用)**:读本地 wiki 克隆(实例路径见
|
||||
**本地回退(REST 不可达时)**:读本地 wiki 克隆(实例路径见
|
||||
TERMINOLOGY.md)。wiki 文件名 URL 编码(`/`→`%2F`,`.md` 前可能带
|
||||
`.-`),用 glob 而非固定路径解析:
|
||||
|
||||
@@ -56,7 +61,8 @@ glob(pattern="*{slug}*{page-title}*.md", path="<local-wiki-clone>/{repo}-wiki/")
|
||||
## Pattern 2: read-issue
|
||||
|
||||
```
|
||||
gitea_issue__get(owner="Octopus", repo="octopus", index={issue_number})
|
||||
curl -fsS -H "Authorization: token <token>" \
|
||||
"<gitea-base-url>/api/v1/repos/Octopus/octopus/issues/{issue_number}"
|
||||
```
|
||||
|
||||
读工单详情、正文、元数据(label、assignee、milestone、state)。
|
||||
@@ -64,20 +70,28 @@ gitea_issue__get(owner="Octopus", repo="octopus", index={issue_number})
|
||||
## Pattern 3: read-issue-comments
|
||||
|
||||
```
|
||||
gitea_issue_comment__list(owner="Octopus", repo="octopus", index={issue_number})
|
||||
curl -fsS -H "Authorization: token <token>" \
|
||||
"<gitea-base-url>/api/v1/repos/Octopus/octopus/issues/{issue_number}/comments?page=N&limit=50"
|
||||
```
|
||||
|
||||
分页用 `page`/`limit`(上限 50),响应头 `x-total-count` 给总数。
|
||||
|
||||
读工单全部评论(评审结果、状态备注、讨论线程)。
|
||||
|
||||
## Pattern 4: read-project-column-issues
|
||||
|
||||
看板列工单队列。project/column 发现:
|
||||
|
||||
```
|
||||
gitea_column__list_issues(owner="Octopus", repo="octopus",
|
||||
project_id={project_id}, column_id={column_id})
|
||||
curl -fsS -H "Authorization: token <token>" \
|
||||
"<gitea-base-url>/api/v1/repos/Octopus/octopus/projects"
|
||||
curl -fsS -H "Authorization: token <token>" \
|
||||
"<gitea-base-url>/api/v1/repos/Octopus/octopus/projects/{project_id}/columns"
|
||||
```
|
||||
|
||||
看板列工单队列。project/column 发现:`gitea_project__list` +
|
||||
`gitea_column__list`。
|
||||
「把工单移到列」等复杂操作:经 `swagger.v1.json`
|
||||
(`jq '.paths | keys[]' | grep projects`)查询 projects 相关端点后调用,
|
||||
不要臆造具体端点路径。projects 仅 repo 级(无 org/user 级端点)。
|
||||
|
||||
## Pattern 5: read-review-status(CLI)
|
||||
|
||||
@@ -103,17 +117,24 @@ success,1 = 有 failure/error。
|
||||
而非猜测页名路径:
|
||||
|
||||
```
|
||||
gitea_issue__get(owner="Octopus", repo="octopus", index={issue_number})
|
||||
gitea_issue_comment__list(owner="Octopus", repo="octopus", index={issue_number})
|
||||
# 找 body 以 "## 工件索引"(遗留 "## Pipeline 工件追踪表")开头的评论
|
||||
gitea_wiki__get_page(owner="Octopus", repo="octopus", page_name=page_name)
|
||||
# 1. 读源工单
|
||||
curl -fsS -H "Authorization: token <token>" \
|
||||
"<gitea-base-url>/api/v1/repos/Octopus/octopus/issues/{issue_number}"
|
||||
# 2. 拉评论列表,找 body 以 "## 工件索引"(遗留 "## Pipeline 工件追踪表")开头的评论
|
||||
curl -fsS -H "Authorization: token <token>" \
|
||||
"<gitea-base-url>/api/v1/repos/Octopus/octopus/issues/{issue_number}/comments?page=N&limit=50"
|
||||
# 3. 按 CORE 行位置列逐个读工件页:先 GET .../wiki/pages 拿 sub_url(mangled
|
||||
# name),再原样请求
|
||||
curl -fsS -H "Authorization: token <token>" \
|
||||
"<gitea-base-url>/api/v1/repos/Octopus/octopus/wiki/page/{mangled-name}"
|
||||
```
|
||||
|
||||
**位置列提取规则**:单元格形如 ``[`{page_name}`]({html_url})`` ——
|
||||
取**链接文本**(首个 `[` 与 `]` 之间、剥反引号)作为 page_name,不是
|
||||
href(含 `%2F`/`.-`,API 不认)。裸 page_name 单元格(无链接包裹)也
|
||||
接受:整格即 page_name。形如 `#comment-{id}` 的值改用
|
||||
`gitea_issue_comment__list` 读,不得喂给 `gitea_wiki__get_page`。
|
||||
`GET .../issues/{index}/comments` 拉工单评论列表后按 id 取,不得当作
|
||||
wiki 页名去读 wiki 端点。
|
||||
|
||||
**重读规则**:重读集 = 全部 `CORE` 行;`ON-DEMAND` 行仅当前任务需要
|
||||
时读;绝不读 `ARCHIVE` 行。索引缺失(历史工单)→ 回退 issue body +
|
||||
|
||||
Reference in New Issue
Block a user