Repository navigation
feat(ci-status): experimental Gitea CI-status detection - #2702
Merged
Merged
Conversation
`wt list --full` and `wt config show --full` now recognize Gitea repos, mirroring the existing GitHub / GitLab / Azure DevOps support. Previously Gitea was wired up only for the `wt switch pr:<N>` shortcut. - New `src/commands/list/ci_status/gitea.rs` with two paths (mirrors `azure.rs`): `detect_gitea_pr` lists open PRs (`tea api .../pulls`), surfaces conflicts from `mergeable` plus the PR head commit's combined status and the PR's `html_url`; `detect_gitea_commit_status` is the branch fallback, querying the combined commit status of the local HEAD. - `CiPlatform::Gitea` enum variant — also makes `forge.platform = "gitea"` drive CI detection, not just `pr:`; URL detection matches "gitea" hosts. - `CiToolsStatus` gains `tea_installed`/`tea_authenticated` (auth read from tea's config file via the new `gitea::has_any_login`, not by invoking `tea`). - `config show --full` shows a `tea`/Gitea diagnostics row; `render_ci_tool_status` now derives the auth-setup hint per CLI (`az login`, `tea login add`, else `<tool> auth login`) — also fixes a pre-existing wrong `az` hint. - Docs: updated only stale text (the `config show` "CI status requires …" string, the `platform_from_config` warning, `[forge]`/`[ci]` doc comments); the `wt list --help` CI section stays generic. - Tests: `tea` mock helpers + `test_list_full_with_gitea_*`, `test_config_show_full_gitea_remote`, unit tests. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
# Conflicts: # src/commands/list/ci_status/platform.rs
Gitea's `GET /repos/{owner}/{repo}/pulls` does NOT default `state` to
`open` despite what the Swagger says — the handler reads
`ctx.FormTrim("state")` and treats empty as no filter, so omitting the
param returns PRs in *all* states (verified live against gitea.com and
codeberg/Forgejo). Without `state=open`, `prs.iter().find(...)` could
match a closed PR whose source branch still exists with the same name —
wrong CI indicator, wrong `html_url` link.
This restores the query string after a prior review-loop iteration had
dropped it on an unverified-`tea`-passthrough concern. `tea api`
forwards query strings verbatim (verified against `tea` v0.14.0
source), so it's safe; `limit=20` stays dropped (Gitea's default page
size is plenty).
Also reworded `parse_gitea_status_state`'s docstring to accurately
describe Gitea's `Combine()` semantics (per-status `error`/`failure`/
`warning` collapse to combined `failure`; `skipped` collapses to
`success`); the per-status values stay handled defensively. Tweaked
the head-repo-owner-filter comment to stop overclaiming "mirrors the
GitHub path" wholesale — GitHub matches the push-remote owner; Gitea
matches the queried repo's owner (same-repo PRs only).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
worktrunk-bot
approved these changes
May 11, 2026
worktrunk-bot
left a comment
Collaborator
There was a problem hiding this comment.
Approving — mirrors the existing forge dispatch cleanly, the state=open fix is well-justified by the commit message, and the experimental scope/limitations are documented.
One overlap to flag: this PR's change to the Invalid CI platform in config warning (in src/git/ci_platform.rs:98) plus the matching snapshot update entirely subsume #2698 — that smaller PR can be closed as a duplicate once this lands.
worktrunk-bot
added a commit
that referenced
this pull request
May 11, 2026
#2702 (experimental Gitea CI-status detection) landed on main and made `gitea` a fully-recognized `CiPlatform` variant. That commit also already includes `gitea` in the invalid-platform warning hint, so this PR's one-line change is fully subsumed by main — taking main's version of `src/git/ci_platform.rs`. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This was referenced May 11, 2026
Merged
max-sixty
added a commit
that referenced
this pull request
May 13, 2026
Release v0.50.0. Highlights: - Experimental Azure DevOps support (#1256, thanks @mikeyroush; fixes #1144 from @dlecan) — `wt switch pr:<N>`, `wt list --full`, and `wt config show --full` recognize Azure DevOps via the `az` CLI. - Experimental Gitea CI-status detection (#2702) on top of the Gitea `pr:` shortcut (#1320, thanks @SjB). - Hooks now resolve `.config/wt.toml` from the worktree they act on — the primary-worktree fallback is gone, and `post-remove` reads the removed worktree's config (snapshotted before removal). Approval prompts collect hook commands from the same worktree. Breaking change for setups that relied on the primary-worktree fallback; the changelog entry has the recovery action. (#2690, #2703, #2714, #2717, #2701, #2708, #2727, #2736, #2748) - The `wt switch` picker's `alt-r` removal no longer runs unapproved project hooks (#2746) — the picker's removal path is now routed through `handle_remove_output` and consults the existing approval state read-only. - `wt config alias show` with no name lists every alias's full definition (#2684, #2691); `wt --help` switches to a compact aliases pointer (#2688). - `wt list --branches` warm-run perf: SHA-keyed cache for `main↕` and `Remote⇅` ahead/behind counts; shared push-remote URL and local-branch scan (#2704, #2718, #2673). - Claude Code plugin ships the `wt-switch-create` skill (#2737, thanks @onetom for #2631). See `CHANGELOG.md` for the full list (8 Improved, 5 Fixed, 5 Internal). semver-checks reports breaking library-API changes (new enum variants without `#[non_exhaustive]`, removed `Branch::github_push_url`, new trait method on `RemoteRefProvider`), which mandates at minimum a minor bump pre-1.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
wt list --fullandwt config show --fullnow recognize Gitea repos, mirroring the existing GitHub / GitLab / Azure DevOps support. Previously Gitea was wired up only for thewt switch pr:<N>shortcut.What this does
wt list --fullshows a CI indicator for Gitea repos:tea api repos/{o}/{r}/pulls?state=open), finds the one whose head branch matches, surfaces conflicts frommergeableplus the real CI state from the PR head commit's combined status, and links the indicator to the PR (html_url).tea api repos/{o}/{r}/commits/{sha}/status). Both Gitea Actions and external CI report into commit statuses, so this is the pass/fail/pending rollup — the equivalent of GitHub's check-runs API.wt config show --fulladds atea/Gitea diagnostics row when the repo's a Gitea remote;render_ci_tool_statusnow derives the auth-setup command per CLI (`az login`, `tea login add`, else ` auth login`) — which also fixes a pre-existing wrong hint for `az`.`forge.platform = "gitea"` now opts a repo into Gitea CI detection (in addition to its existing role for the `pr:` shortcut). The previous "valid for `pr:`, but no CI" special-case in `configured_ci_platform` is removed; `CiPlatform::Gitea` flows through the same dispatch as the other forges.
Design notes
Mirrors `azure.rs`'s two-path structure but improves on it: when a PR exists, Azure's path only ever surfaces conflicts/queued (pass/fail is unreachable once a PR is found). Gitea's path additionally queries the PR head commit's combined status, so PRs with passing CI show green instead of blank. Cost: two `tea api` calls per PR'd branch; results cached 30–60s.
Auth detection reads `tea`'s config file (`has_any_login`) rather than invoking `tea` — matches the existing `is_authed_for` to avoid OAuth-refresh side effects.
Known limitations (experimental)
Docs
The `--help` CI section ("GitHub/GitLab pipeline status") stays generic, matching #1256's precedent of not enumerating Azure there either. The `forge.platform` value lists, the `config show --full` "CI status requires …" string, the "Invalid CI platform … Expected …" warning, and the field docs on `[forge]`/`[ci]` all enumerate Gitea.
Verification
API claims verified live against `gitea.com` (v1.26-dev) and `codeberg.org` (Forgejo, Gitea-1.22 base), plus the Gitea source and `tea` v0.14.0 source — the combined-status endpoint, the PR JSON shape, the `tea api` query-string passthrough, and the `?state=open` requirement (Gitea's pulls list does NOT default to `open` — Swagger's `default` is doc-only). New tests cover passed/failed/running/conflicts/no-ci/retriable-error (×2 paths)/no-`tea`-installed/`config show --full` Gitea diagnostics — 10 new integration tests + unit tests for parsing.
🤖 Generated with Claude Code