feat:增加 teai organizations 指令(#45) #46

Merged
chenyunda218 merged 1 commits from feat/issue45-organizations into main 2026-09-13 21:29:19 +08:00
Member

實作 tea organizations 對等的日常操作(#45)。

內容

  • teai organizations list:GET /user/orgs,輸出 name/full_name/website/location/description/visibility。與既有 teai orgs(工作流精簡版,只輸出帳號)同一端點,此為完整欄位版,輸出欄位與 tea organizations list --output json 一致。
  • teai organizations create --name <org> [--full-name …] [--description …] [--website …] [--location …] [--visibility public|limited|private] --yes:POST /orgs。組織名改用 --name 旗標(teai 慣例,與 issues create --title 等一致;tea 用位置參數)。
  • teai organizations delete <org> --yes:DELETE /orgs/{org},組織名為位置參數(tea 相容)。

慣例

  • 寫入操作(create/delete)比照 #40 起的慣例要求 --yes,未確認時不發出任何 HTTP 請求(exit 2)。
  • --visibility 有值域檢查(public|limited|private);未指定時不傳,由服務端預設。
  • 分頁、認證、輸出(json|table)沿用 internal/gitea 既有基礎。

測試

  • 新增 internal/cli/organizations_commands_test.go:9 個測試涵蓋端點、payload、--yes 閘門、值域檢查、位置參數拒絕與未知子命令。
  • go test ./... 全綠;以本機建置對 Gitea 實測 list 輸出與 tea 一致、--yes 閘門生效。

Closes #45

實作 tea organizations 對等的日常操作(#45)。 ## 內容 - `teai organizations list`:GET /user/orgs,輸出 name/full_name/website/location/description/visibility。與既有 `teai orgs`(工作流精簡版,只輸出帳號)同一端點,此為完整欄位版,輸出欄位與 `tea organizations list --output json` 一致。 - `teai organizations create --name <org> [--full-name …] [--description …] [--website …] [--location …] [--visibility public|limited|private] --yes`:POST /orgs。組織名改用 --name 旗標(teai 慣例,與 issues create --title 等一致;tea 用位置參數)。 - `teai organizations delete <org> --yes`:DELETE /orgs/{org},組織名為位置參數(tea 相容)。 ## 慣例 - 寫入操作(create/delete)比照 #40 起的慣例要求 --yes,未確認時不發出任何 HTTP 請求(exit 2)。 - --visibility 有值域檢查(public|limited|private);未指定時不傳,由服務端預設。 - 分頁、認證、輸出(json|table)沿用 internal/gitea 既有基礎。 ## 測試 - 新增 internal/cli/organizations_commands_test.go:9 個測試涵蓋端點、payload、--yes 閘門、值域檢查、位置參數拒絕與未知子命令。 - go test ./... 全綠;以本機建置對 Gitea 實測 list 輸出與 tea 一致、--yes 閘門生效。 Closes #45
ceo added 1 commit 2026-09-13 19:32:42 +08:00
tea organizations 對等的日常操作:
- organizations list:GET /user/orgs,輸出 name/full_name/website/
  location/description/visibility(與 teai orgs 工作流命令同一
  端點,但輸出完整欄位)
- organizations create:POST /orgs,--name 必填,可選 --full-name/
  --description/--website/--location/--visibility;寫入需 --yes
- organizations delete:DELETE /orgs/{org},組織名為位置參數
  (tea 相容);寫入需 --yes

驗收測試涵蓋端點、payload、--yes 閘門(未確認不發請求)與
值域檢查;並以本機建置對 Gitea 實測 list 輸出欄位與 tea 一致。
Author
Member

補充:此 PR 是 #45 的實作(branch feat/issue45-organizations、commit 8d446ed)。本機已實測:organizations list 對本站輸出 [{"name":"alterminal",...}] 與 tea 一致;create 未帶 --yes 時 exit 2 且不發請求。麻煩審核。

補充:此 PR 是 #45 的實作(branch feat/issue45-organizations、commit 8d446ed)。本機已實測:`organizations list` 對本站輸出 [{"name":"alterminal",...}] 與 tea 一致;`create` 未帶 --yes 時 exit 2 且不發請求。麻煩審核。
chenyunda218 merged commit 8e358185f4 into main 2026-09-13 21:29:19 +08:00
chenyunda218 deleted branch feat/issue45-organizations 2026-09-13 21:29:19 +08:00
Sign in to join this conversation.