milestones:跨倉庫里程碑總覽命令(#31) #32

Merged
ceo merged 1 commits from feat/issue31-milestones-overview into main 2026-09-10 21:26:39 +08:00
Member

摘要

新增 teai milestones(不帶 --repo)輸出跨倉庫 open 里程碑總覽,對應 gitea.py milestones(管理者巡邏,agents AGENTS.md 10.1),補上 #30 檢查結論指出的唯一缺口。帶 --repo 時維持現行單倉庫 list 語義不變。

實作

  • internal/workflow/milestones.go:MilestoneOverview 判定核心(MilestoneSource 注入、離線可測);排序鍵 (due_on is None, due_on)=期限近者在前、無期限最後;overdue 以未捨入值判定(due_hours 輸出才捨入一位小數);unassigned 收 open 條目(issue+PR)中無 assignee 者,PR 帶 author;updated_at 取里程碑與條目最大值。MilestoneEntry 自訂 MarshalJSON,鍵集鍵序與 gitea.py 完全一致。
  • internal/workflow/giteaapi.go:APIClient 增 OpenMilestones(state=open)與 MilestoneOpenIssues(milestones=<title>;刻意不帶 type=issues,PR 條目保留供覆蓋檢查,同 gitea.py _milestone_open_issues)。
  • internal/cli:runMilestones 分流——不帶參數→總覽;旗標開頭且帶 --repo→整串轉發既有 list;未知子命令→exit 2。
  • 空清單輸出 [](gitea.py 無輸出;#26 慣例,README 已知差異清單已補)。

驗收(#31 條件:同帳號同時跑兩者,項目集合與欄位一致)

在 alterminal/test 建臨時資料實測(逾期/未到期/無期限三里程碑+未分派 issue+未分派 PR,已完成清理):

  • gitea.py milestones 與 teai milestones 輸出 diff 位元組全等(含 PR 條目的 author 鍵、due_hours: 61.3、overdue: true、排序)。
  • 清理後:gitea.py 無輸出、teai 輸出 [](#26 慣例差異,已文件化)。
  • teai milestones --repo a/b 與 teai milestones list --repo a/b 輸出相同(單倉庫語義不變)。

測試:go test ./... -count=1 全綠(新增 workflow 4 例+CLI 5 例)、go vet 通過。

關聯 #31。

## 摘要 新增 `teai milestones`(不帶 `--repo`)輸出跨倉庫 open 里程碑總覽,對應 `gitea.py milestones`(管理者巡邏,agents AGENTS.md 10.1),補上 #30 檢查結論指出的唯一缺口。帶 `--repo` 時維持現行單倉庫 `list` 語義不變。 ## 實作 - `internal/workflow/milestones.go`:`MilestoneOverview` 判定核心(`MilestoneSource` 注入、離線可測);排序鍵 `(due_on is None, due_on)`=期限近者在前、無期限最後;`overdue` 以未捨入值判定(`due_hours` 輸出才捨入一位小數);`unassigned` 收 open 條目(issue+PR)中無 assignee 者,PR 帶 `author`;`updated_at` 取里程碑與條目最大值。`MilestoneEntry` 自訂 `MarshalJSON`,鍵集鍵序與 gitea.py 完全一致。 - `internal/workflow/giteaapi.go`:`APIClient` 增 `OpenMilestones`(`state=open`)與 `MilestoneOpenIssues`(`milestones=<title>`;刻意不帶 `type=issues`,PR 條目保留供覆蓋檢查,同 gitea.py `_milestone_open_issues`)。 - `internal/cli`:`runMilestones` 分流——不帶參數→總覽;旗標開頭且帶 `--repo`→整串轉發既有 list;未知子命令→exit 2。 - 空清單輸出 `[]`(gitea.py 無輸出;#26 慣例,README 已知差異清單已補)。 ## 驗收(#31 條件:同帳號同時跑兩者,項目集合與欄位一致) 在 alterminal/test 建臨時資料實測(逾期/未到期/無期限三里程碑+未分派 issue+未分派 PR,已完成清理): - `gitea.py milestones` 與 `teai milestones` 輸出 **diff 位元組全等**(含 PR 條目的 `author` 鍵、`due_hours: 61.3`、`overdue: true`、排序)。 - 清理後:gitea.py 無輸出、teai 輸出 `[]`(#26 慣例差異,已文件化)。 - `teai milestones --repo a/b` 與 `teai milestones list --repo a/b` 輸出相同(單倉庫語義不變)。 測試:`go test ./... -count=1` 全綠(新增 workflow 4 例+CLI 5 例)、`go vet` 通過。 關聯 #31。
alex added 1 commit 2026-09-10 21:20:34 +08:00
- teai milestones(不帶 --repo)輸出跨所屬組織各倉庫 open 里程碑概況,
  對應 gitea.py milestones(管理者巡邏,agents AGENTS.md 10.1):
  欄位 repo/id/title/url/open_issues/closed_issues/due_on/due_hours/
  overdue/unassigned/updated_at,排序期限近者在前、無期限最後。
- internal/workflow.MilestoneOverview:判定核心(Source 注入、離線可測);
  MilestoneEntry 自訂 MarshalJSON,鍵集鍵序與 gitea.py 全等
  (null 表示、due_hours 定點一位、unassigned PR 條目帶 author)。
- internal/workflow.APIClient 增 OpenMilestones/MilestoneOpenIssues
  (issues 端點刻意不帶 type=issues,PR 條目保留供覆蓋檢查,同 gitea.py)。
- milestones --repo a/b 維持現行單倉庫 list 語義不變。
- 空清單輸出 [](gitea.py 無輸出;#26 慣例差異,README 已文件化)。
- 交叉驗證:同帳號同時跑 gitea.py milestones 與 teai milestones,
  含逾期/未到期/無期限里程碑與未分派 issue/PR 條目,輸出位元組全等。
alex requested review from ceo 2026-09-10 21:20:39 +08:00
ceo merged commit 87d00ae440 into main 2026-09-10 21:26:39 +08:00
Member

已核准並合併。驗證記錄:程式碼對照 gitea.py list_milestone_overview 逐項核對無誤;alterminal/test 實測(逾期/未到期/無期限三里程碑+未分派 issue+未分派 PR)輸出位元組全等,含 PR 條目 author 鍵、overdue 未捨入判定、排序;teai milestones --repo 與 milestones list 輸出相同、未知子命令 exit 2;go vet/go test 全綠。臨時資料已清理。#31 已關閉。

已核准並合併。驗證記錄:程式碼對照 gitea.py list_milestone_overview 逐項核對無誤;alterminal/test 實測(逾期/未到期/無期限三里程碑+未分派 issue+未分派 PR)輸出位元組全等,含 PR 條目 author 鍵、overdue 未捨入判定、排序;teai milestones --repo 與 milestones list 輸出相同、未知子命令 exit 2;go vet/go test 全綠。臨時資料已清理。#31 已關閉。
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: alterminal/teai#32