Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

refactor(ci): move `CiPlatform` to the lib crate, cache on `RepoCache`, drop the "override" framing (#2692)

Maximilian Roos00c450867127
diff --git a/dev/wt.example.toml b/dev/wt.example.toml
index 227ce346a..2d7d1b377 100644
--- a/dev/wt.example.toml
+++ b/dev/wt.example.toml
@@ -19,9 +19,9 @@
# [list]
# url = "http://localhost:{{ branch | hash_port }}"
#
-# ## Forge platform override
+# ## Forge platform
#
-# Override platform detection for SSH aliases or self-hosted instances:
+# Name the forge explicitly for SSH aliases or self-hosted instances, where it can't be detected from the remote URL:
#
# [forge]
# platform = "github" # or "gitlab", "gitea" (experimental), "azure-devops" (experimental)
diff --git a/docs/content/config.md b/docs/content/config.md
index 78e3004ca..0afb85069 100644
--- a/docs/content/config.md
+++ b/docs/content/config.md
@@ -396,9 +396,9 @@ URL column in `wt list` (dimmed when port not listening):
url = "http://localhost:{{ branch | hash_port }}"
```
-## Forge platform override
+## Forge platform
-Override platform detection for SSH aliases or self-hosted instances:
+Name the forge explicitly for SSH aliases or self-hosted instances, where it can't be detected from the remote URL:
```toml
[forge]
@@ -927,7 +927,7 @@ CI status cache.
Caches GitHub/GitLab CI status for display in [`wt list`](@/list.md#ci-status).
-Requires `gh` (GitHub) or `glab` (GitLab) CLI, authenticated. Platform auto-detects from remote URL; override with `forge.platform = "github"` (or `"gitlab"`) in `.config/wt.toml` for SSH host aliases or self-hosted instances. For GitHub Enterprise or self-hosted GitLab, also set `forge.hostname`.
+Requires `gh` (GitHub) or `glab` (GitLab) CLI, authenticated. Platform auto-detects from the remote URL; set `forge.platform = "github"` (or `"gitlab"`) in `.config/wt.toml` for SSH host aliases or self-hosted instances. For GitHub Enterprise or self-hosted GitLab, also set `forge.hostname`.
Checks open PRs/MRs first, then branch pipelines for branches with upstream. Local-only branches (no remote tracking) show blank.
diff --git a/skills/worktrunk/reference/config.md b/skills/worktrunk/reference/config.md
index d337cf369..3e300ed15 100644
--- a/skills/worktrunk/reference/config.md
+++ b/skills/worktrunk/reference/config.md
@@ -395,9 +395,9 @@ URL column in `wt list` (dimmed when port not listening):
url = "http://localhost:{{ branch | hash_port }}"
```
-## Forge platform override
+## Forge platform
-Override platform detection for SSH aliases or self-hosted instances:
+Name the forge explicitly for SSH aliases or self-hosted instances, where it can't be detected from the remote URL:
```toml
[forge]
@@ -971,7 +971,7 @@ CI status cache.
Caches GitHub/GitLab CI status for display in [`wt list`](https://worktrunk.dev/list/#ci-status).
-Requires `gh` (GitHub) or `glab` (GitLab) CLI, authenticated. Platform auto-detects from remote URL; override with `forge.platform = "github"` (or `"gitlab"`) in `.config/wt.toml` for SSH host aliases or self-hosted instances. For GitHub Enterprise or self-hosted GitLab, also set `forge.hostname`.
+Requires `gh` (GitHub) or `glab` (GitLab) CLI, authenticated. Platform auto-detects from the remote URL; set `forge.platform = "github"` (or `"gitlab"`) in `.config/wt.toml` for SSH host aliases or self-hosted instances. For GitHub Enterprise or self-hosted GitLab, also set `forge.hostname`.
Checks open PRs/MRs first, then branch pipelines for branches with upstream. Local-only branches (no remote tracking) show blank.
diff --git a/src/cli/config.rs b/src/cli/config.rs
index 302a48c24..cc532d74c 100644
--- a/src/cli/config.rs
+++ b/src/cli/config.rs
@@ -834,7 +834,7 @@ $ wt config state hints clear NAME # re-show specific hint
name = "ci-status",
after_long_help = r#"Caches GitHub/GitLab CI status for display in [`wt list`](@/list.md#ci-status).
-Requires `gh` (GitHub) or `glab` (GitLab) CLI, authenticated. Platform auto-detects from remote URL; override with `forge.platform = "github"` (or `"gitlab"`) in `.config/wt.toml` for SSH host aliases or self-hosted instances. For GitHub Enterprise or self-hosted GitLab, also set `forge.hostname`.
+Requires `gh` (GitHub) or `glab` (GitLab) CLI, authenticated. Platform auto-detects from the remote URL; set `forge.platform = "github"` (or `"gitlab"`) in `.config/wt.toml` for SSH host aliases or self-hosted instances. For GitHub Enterprise or self-hosted GitLab, also set `forge.hostname`.
Checks open PRs/MRs first, then branch pipelines for branches with upstream. Local-only branches (no remote tracking) show blank.
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 239c624a3..7ec6ca4bc 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -1932,9 +1932,9 @@ URL column in `wt list` (dimmed when port not listening):
url = "http://localhost:{{ branch | hash_port }}"
```
-## Forge platform override
+## Forge platform
-Override platform detection for SSH aliases or self-hosted instances:
+Name the forge explicitly for SSH aliases or self-hosted instances, where it can't be detected from the remote URL:
```toml
[forge]
diff --git a/src/commands/config/show.rs b/src/commands/config/show.rs
index c8dadcd3d..fce939c8e 100644
--- a/src/commands/config/show.rs
+++ b/src/commands/config/show.rs
@@ -12,7 +12,7 @@ use color_print::cformat;
use worktrunk::config::{
ProjectConfig, UserConfig, default_system_config_path, system_config_path,
};
-use worktrunk::git::{ErrorExt, Repository};
+use worktrunk::git::{CiPlatform, ErrorExt, Repository};
use worktrunk::path::format_path_for_display;
use worktrunk::shell::{FileDetectionResult, Shell, scan_for_detection_details};
use worktrunk::shell_exec::Cmd;
@@ -24,7 +24,7 @@ use worktrunk::styling::{
use super::state::require_user_config_path;
use crate::cli::{SwitchFormat, version_str};
use crate::commands::configure_shell::{ConfigAction, ConfigureResult, scan_shell_configs};
-use crate::commands::list::ci_status::{CiPlatform, CiToolsStatus, platform_for_repo};
+use crate::commands::list::ci_status::CiToolsStatus;
use crate::help_pager::show_help_in_pager;
use crate::llm::test_commit_generation;
use crate::output;
@@ -354,11 +354,9 @@ fn render_runtime_info(out: &mut String) -> anyhow::Result<()> {
fn render_diagnostics(out: &mut String) -> anyhow::Result<()> {
writeln!(out, "{}", format_heading("DIAGNOSTICS", None))?;
- // Check CI tool based on detected platform (with config override support)
+ // Check the CI tool for this repo's platform (project config, else remote URL).
let repo = Repository::current()?;
- let platform = platform_for_repo(&repo, None);
-
- match platform {
+ match repo.ci_platform(None) {
Some(CiPlatform::GitHub) => {
let ci_tools = CiToolsStatus::detect(None);
render_ci_tool_status(
diff --git a/src/commands/list/ci_status/mod.rs b/src/commands/list/ci_status/mod.rs
index eb095e962..5ab229df2 100644
--- a/src/commands/list/ci_status/mod.rs
+++ b/src/commands/list/ci_status/mod.rs
@@ -79,7 +79,6 @@ impl CiBranchName {
// Re-export public types
pub(crate) use cache::CachedCiStatus;
-pub use platform::{CiPlatform, platform_for_repo};
/// Maximum number of PRs/MRs to fetch when filtering by source repository.
///
@@ -377,9 +376,9 @@ impl PrStatus {
/// Detect CI status without caching (internal implementation)
///
- /// Platform is determined by project config override or remote URL detection.
- /// Returns `None` if the platform cannot be determined (user should set
- /// `forge.platform` in project config for non-standard hostnames).
+ /// Platform is determined from project config (`forge.platform`), falling
+ /// back to the remote URL host. Returns `None` if the platform cannot be
+ /// determined (user should set `forge.platform` for non-standard hostnames).
/// PR/MR detection always runs. Workflow/pipeline fallback only runs if `has_upstream`.
fn detect_uncached(
repo: &Repository,
@@ -387,11 +386,9 @@ impl PrStatus {
local_head: &str,
has_upstream: bool,
) -> Option<Self> {
- // Determine platform (config override, branch's remote, or primary remote URL)
- let platform = platform_for_repo(repo, branch.remote.as_deref());
-
- match platform {
- Some(p) => p.detect_ci(repo, branch, local_head, has_upstream),
+ // Determine platform (project config, branch's remote, or primary remote URL).
+ match repo.ci_platform(branch.remote.as_deref()) {
+ Some(p) => platform::detect_ci(p, repo, branch, local_head, has_upstream),
None => {
// Unknown platform — user should set forge.platform in project config
log::debug!(
diff --git a/src/commands/list/ci_status/platform.rs b/src/commands/list/ci_status/platform.rs
index 83263ece0..0b1e35a52 100644
--- a/src/commands/list/ci_status/platform.rs
+++ b/src/commands/list/ci_status/platform.rs
@@ -1,26 +1,20 @@
-//! CI platform detection.
+//! Forge dispatch for CI status detection.
//!
-//! Determines whether a repository uses GitHub, GitLab, or Azure DevOps based on
-//! project config override or remote URL detection.
+//! Given a [`CiPlatform`] (resolved by [`Repository::ci_platform`]), routes to
+//! the GitHub (`gh`), GitLab (`glab`), or Azure DevOps (`az`) backend and
+//! checks whether that CLI is installed.
use std::sync::OnceLock;
-use worktrunk::git::{GitRemoteUrl, Repository};
+use worktrunk::git::{CiPlatform, Repository};
use super::{CiBranchName, PrStatus, azure, github, gitlab, tool_available};
-/// Cached CI tool availability.
-static CI_TOOLS: OnceLock<CiToolsAvailable> = OnceLock::new();
-
-/// CI platform from project config (`forge.platform` / `ci.platform`), cached.
-///
-/// Resolved once per process, so the warning for an unrecognized value fires
-/// once per `wt list` invocation rather than once per branch.
-static CONFIGURED_PLATFORM: OnceLock<Option<CiPlatform>> = OnceLock::new();
-
/// Cached availability of CI CLI tools (`gh`, `glab`, `az`).
///
-/// Probed once on first access via `--version` check.
+/// Probed once on first access via a `--version` check.
+static CI_TOOLS: OnceLock<CiToolsAvailable> = OnceLock::new();
+
struct CiToolsAvailable {
gh: bool,
glab: bool,
@@ -37,295 +31,62 @@ impl CiToolsAvailable {
}
}
-/// CI platform detected from project config override or remote URL.
-///
-/// Platform is determined by:
-/// 1. Project config `forge.platform` (or deprecated `ci.platform`)
-/// 2. Remote URL detection (searches for "github", "gitlab", or Azure DevOps in hostname)
-#[derive(Debug, Clone, Copy, PartialEq, Eq, strum::Display, strum::EnumString)]
-#[strum(serialize_all = "lowercase")]
-pub enum CiPlatform {
- GitHub,
- GitLab,
- #[strum(serialize = "azure-devops", serialize = "azuredevops")]
- AzureDevOps,
-}
-
-impl CiPlatform {
- /// Check if the CLI tool for this platform is available (cached).
- fn is_tool_available(self) -> bool {
- match self {
- Self::GitHub => CiToolsAvailable::get().gh,
- Self::GitLab => CiToolsAvailable::get().glab,
- Self::AzureDevOps => CiToolsAvailable::get().az,
- }
- }
-
- /// Detect CI status from PR/MR.
- fn detect_pr_mr(
- self,
- repo: &Repository,
- branch: &CiBranchName,
- local_head: &str,
- ) -> Option<PrStatus> {
- match self {
- Self::GitHub => github::detect_github(repo, branch, local_head),
- Self::GitLab => gitlab::detect_gitlab(repo, branch, local_head),
- Self::AzureDevOps => azure::detect_azure_pr(repo, branch, local_head),
- }
- }
-
- /// Detect CI status from branch workflow/pipeline (fallback when no PR/MR).
- fn detect_branch(
- self,
- repo: &Repository,
- branch: &CiBranchName,
- local_head: &str,
- ) -> Option<PrStatus> {
- match self {
- Self::GitHub => github::detect_github_commit_checks(repo, branch, local_head),
- // GitLab pipeline uses the bare branch name (not "origin/feature")
- Self::GitLab => gitlab::detect_gitlab_pipeline(repo, &branch.name, local_head),
- Self::AzureDevOps => azure::detect_azure_pipeline(repo, &branch.name, local_head),
- }
- }
-
- /// Detect CI status: PR/MR first, then branch workflow/pipeline if `has_upstream`.
- ///
- /// Returns `None` if the CLI tool is not available or no CI status found.
- pub(super) fn detect_ci(
- self,
- repo: &Repository,
- branch: &CiBranchName,
- local_head: &str,
- has_upstream: bool,
- ) -> Option<PrStatus> {
- if !self.is_tool_available() {
- return None;
- }
- if let Some(status) = self.detect_pr_mr(repo, branch, local_head) {
- return Some(status);
- }
- if has_upstream {
- return self.detect_branch(repo, branch, local_head);
- }
- None
+/// Whether the CLI tool for this platform is installed (cached).
+fn is_tool_available(platform: CiPlatform) -> bool {
+ match platform {
+ CiPlatform::GitHub => CiToolsAvailable::get().gh,
+ CiPlatform::GitLab => CiToolsAvailable::get().glab,
+ CiPlatform::AzureDevOps => CiToolsAvailable::get().az,
}
}
-/// Detect the CI platform from a remote URL.
-///
-/// Uses [`GitRemoteUrl`] to parse the URL and check the host for "github", "gitlab",
-/// or Azure DevOps.
-pub fn detect_platform_from_url(url: &str) -> Option<CiPlatform> {
- let parsed = GitRemoteUrl::parse(url)?;
- if parsed.is_github() {
- Some(CiPlatform::GitHub)
- } else if parsed.is_gitlab() {
- Some(CiPlatform::GitLab)
- } else if parsed.is_azure_devops() {
- Some(CiPlatform::AzureDevOps)
- } else {
- None
+/// Detect CI status from a PR/MR.
+fn detect_pr_mr(
+ platform: CiPlatform,
+ repo: &Repository,
+ branch: &CiBranchName,
+ local_head: &str,
+) -> Option<PrStatus> {
+ match platform {
+ CiPlatform::GitHub => github::detect_github(repo, branch, local_head),
+ CiPlatform::GitLab => gitlab::detect_gitlab(repo, branch, local_head),
+ CiPlatform::AzureDevOps => azure::detect_azure_pr(repo, branch, local_head),
}
}
-/// Get the CI platform for a repository, optionally prioritizing a specific remote.
-///
-/// Priority order:
-/// 1. Project config `forge.platform` (or deprecated `ci.platform`)
-/// 2. The specific remote's effective URL (if `remote_hint` is provided)
-/// 3. The primary remote's effective URL
-///
-/// For remote branches, pass the branch's remote as `remote_hint` to ensure
-/// the correct platform is detected in mixed-remote repos (e.g., GitHub + GitLab).
-pub fn platform_for_repo(repo: &Repository, remote_hint: Option<&str>) -> Option<CiPlatform> {
- // Project config takes precedence.
- if let Some(platform) = platform_from_config(repo) {
- return Some(platform);
+/// Detect CI status from a branch workflow/pipeline (fallback when no PR/MR).
+fn detect_branch(
+ platform: CiPlatform,
+ repo: &Repository,
+ branch: &CiBranchName,
+ local_head: &str,
+) -> Option<PrStatus> {
+ match platform {
+ CiPlatform::GitHub => github::detect_github_commit_checks(repo, branch, local_head),
+ // GitLab pipelines use the bare branch name (not "origin/feature").
+ CiPlatform::GitLab => gitlab::detect_gitlab_pipeline(repo, &branch.name, local_head),
+ CiPlatform::AzureDevOps => azure::detect_azure_pipeline(repo, &branch.name, local_head),
}
-
- // If we have a specific remote hint (e.g., from a remote branch), use that first.
- // Uses effective URL to handle url.insteadOf aliases.
- if let Some(remote_name) = remote_hint
- && let Some(url) = repo.effective_remote_url(remote_name)
- && let Some(platform) = detect_platform_from_url(&url)
- {
- log::debug!(
- "Detected CI platform {} from remote '{}' (hint)",
- platform,
- remote_name
- );
- return Some(platform);
- }
-
- // Fall back to primary remote's effective URL.
- if let Some(remote) = repo.primary_remote().ok()
- && let Some(url) = repo.effective_remote_url(&remote)
- && let Some(platform) = detect_platform_from_url(&url)
- {
- log::debug!("Detected CI platform {} from remote '{}'", platform, remote);
- return Some(platform);
- }
-
- None
}
-/// Read the CI platform from project config (`forge.platform`, or the
-/// deprecated `ci.platform`), cached for the process.
+/// Detect CI status: PR/MR first, then branch workflow/pipeline if `has_upstream`.
///
-/// Returns `None` when nothing is configured or the value is unrecognized. An
-/// unrecognized value logs a warning — and because the result is cached, that
-/// warning fires once per `wt list` invocation rather than once per branch.
-///
-/// The cache is process-wide and so assumes a single repository per process,
-/// which holds for the CLI: `platform_for_repo` is reached only from `wt list`
-/// (per branch) and `wt config show` (once).
-fn platform_from_config(repo: &Repository) -> Option<CiPlatform> {
- *CONFIGURED_PLATFORM.get_or_init(|| {
- let configured = repo
- .load_project_config()
- .ok()
- .flatten()
- .and_then(|c| c.forge_platform().map(str::to_string))?;
- match configured.parse::<CiPlatform>() {
- Ok(platform) => {
- log::debug!("Using CI platform from config: {platform}");
- Some(platform)
- }
- Err(_) => {
- log::warn!(
- "Invalid CI platform in config: '{configured}'. Expected 'github', 'gitlab', or 'azure-devops'."
- );
- None
- }
- }
- })
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn test_detect_platform_from_url() {
- // GitHub - various URL formats
- assert_eq!(
- detect_platform_from_url("https://github.com/owner/repo.git"),
- Some(CiPlatform::GitHub)
- );
- assert_eq!(
- detect_platform_from_url("[email protected]:owner/repo.git"),
- Some(CiPlatform::GitHub)
- );
- assert_eq!(
- detect_platform_from_url("ssh://[email protected]/owner/repo.git"),
- Some(CiPlatform::GitHub)
- );
-
- // GitHub Enterprise
- assert_eq!(
- detect_platform_from_url("https://github.mycompany.com/owner/repo.git"),
- Some(CiPlatform::GitHub)
- );
-
- // GitLab - various URL formats
- assert_eq!(
- detect_platform_from_url("https://gitlab.com/owner/repo.git"),
- Some(CiPlatform::GitLab)
- );
- assert_eq!(
- detect_platform_from_url("[email protected]:owner/repo.git"),
- Some(CiPlatform::GitLab)
- );
-
- // Self-hosted GitLab
- assert_eq!(
- detect_platform_from_url("https://gitlab.example.com/owner/repo.git"),
- Some(CiPlatform::GitLab)
- );
-
- // Legacy schemes (http://, git://) - common on self-hosted installations
- assert_eq!(
- detect_platform_from_url("http://github.com/owner/repo.git"),
- Some(CiPlatform::GitHub)
- );
- assert_eq!(
- detect_platform_from_url("git://github.com/owner/repo.git"),
- Some(CiPlatform::GitHub)
- );
- assert_eq!(
- detect_platform_from_url("http://gitlab.example.com/owner/repo.git"),
- Some(CiPlatform::GitLab)
- );
- assert_eq!(
- detect_platform_from_url("git://gitlab.mycompany.com/owner/repo.git"),
- Some(CiPlatform::GitLab)
- );
-
- // Unknown platforms
- assert_eq!(
- detect_platform_from_url("https://bitbucket.org/owner/repo.git"),
- None
- );
- assert_eq!(
- detect_platform_from_url("https://codeberg.org/owner/repo.git"),
- None
- );
-
- // Azure DevOps - HTTPS
- assert_eq!(
- detect_platform_from_url("https://dev.azure.com/myorg/myproject/_git/myrepo"),
- Some(CiPlatform::AzureDevOps)
- );
- // Azure DevOps - SSH
- assert_eq!(
- detect_platform_from_url("[email protected]:v3/myorg/myproject/myrepo"),
- Some(CiPlatform::AzureDevOps)
- );
- // Azure DevOps - legacy visualstudio.com
- assert_eq!(
- detect_platform_from_url("https://myorg.visualstudio.com/myproject/_git/myrepo"),
- Some(CiPlatform::AzureDevOps)
- );
- }
-
- #[test]
- fn test_platform_override_azure_devops() {
- // Both serializations accepted; canonical is azure-devops
- assert_eq!(
- "azure-devops".parse::<CiPlatform>().ok(),
- Some(CiPlatform::AzureDevOps)
- );
- assert_eq!(
- "azuredevops".parse::<CiPlatform>().ok(),
- Some(CiPlatform::AzureDevOps)
- );
+/// Returns `None` if the CLI tool isn't installed or no CI status is found.
+pub(super) fn detect_ci(
+ platform: CiPlatform,
+ repo: &Repository,
+ branch: &CiBranchName,
+ local_head: &str,
+ has_upstream: bool,
+) -> Option<PrStatus> {
+ if !is_tool_available(platform) {
+ return None;
}
-
- #[test]
- fn test_platform_override_github() {
- // Config override should take precedence over URL detection
- assert_eq!(
- "github".parse::<CiPlatform>().ok(),
- Some(CiPlatform::GitHub)
- );
+ if let Some(status) = detect_pr_mr(platform, repo, branch, local_head) {
+ return Some(status);
}
-
- #[test]
- fn test_platform_override_gitlab() {
- // Config override should take precedence over URL detection
- assert_eq!(
- "gitlab".parse::<CiPlatform>().ok(),
- Some(CiPlatform::GitLab)
- );
- }
-
- #[test]
- fn test_platform_override_invalid() {
- // Invalid platform strings should not parse
- assert!("invalid".parse::<CiPlatform>().is_err());
- assert!("GITHUB".parse::<CiPlatform>().is_err()); // Case-sensitive
- assert!("GitHub".parse::<CiPlatform>().is_err()); // Case-sensitive
+ if has_upstream {
+ return detect_branch(platform, repo, branch, local_head);
}
+ None
}
diff --git a/src/commands/worktree/switch.rs b/src/commands/worktree/switch.rs
index be77a9cc5..e1f775bad 100644
--- a/src/commands/worktree/switch.rs
+++ b/src/commands/worktree/switch.rs
@@ -85,7 +85,7 @@ enum PrProviderChoice {
/// Choose which provider should handle `pr:<number>` resolution.
///
/// Priority:
-/// 1. `forge.platform` config override (`github` / `gitea` / `azure-devops`)
+/// 1. `forge.platform` config (`github` / `gitea` / `azure-devops`)
/// 2. Primary remote URL detection (host contains `github`/`gitea`/`dev.azure.com`)
/// 3. CLI auth lookup — if `tea` has a login for this host but `gh` does
/// not, pick Gitea; otherwise default to GitHub
diff --git a/src/config/project.rs b/src/config/project.rs
index ade28d583..0dc20af9c 100644
--- a/src/config/project.rs
+++ b/src/config/project.rs
@@ -39,8 +39,9 @@ pub struct ProjectListConfig {
/// Project-level CI configuration.
///
-/// Override CI platform detection when URL-based detection fails (e.g., GitHub
-/// Enterprise or self-hosted GitLab with custom domains).
+/// Names the CI platform explicitly, for repos where URL-based detection can't
+/// determine it (e.g., GitHub Enterprise or self-hosted GitLab with custom
+/// domains).
///
/// # Example
///
@@ -50,7 +51,7 @@ pub struct ProjectListConfig {
/// ```
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, JsonSchema)]
pub struct ProjectCiConfig {
- /// CI platform override. When set, skips URL-based platform detection.
+ /// CI platform. When unset, the platform is detected from the remote URL.
///
/// Values: "github" or "gitlab"
#[serde(default)]
@@ -59,8 +60,9 @@ pub struct ProjectCiConfig {
/// Project-level forge configuration.
///
-/// Override forge detection when URL-based detection fails (e.g., SSH host
-/// aliases, GitHub Enterprise, or self-hosted GitLab with custom domains).
+/// Names the forge explicitly, for repos where URL-based detection can't
+/// determine it (e.g., SSH host aliases, GitHub Enterprise, or self-hosted
+/// GitLab with custom domains).
///
/// # Example
///
@@ -71,7 +73,7 @@ pub struct ProjectCiConfig {
/// ```
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, JsonSchema)]
pub struct ProjectForgeConfig {
- /// Forge platform override. When set, skips URL-based platform detection.
+ /// Forge platform. When unset, the platform is detected from the remote URL.
///
/// Values: "github", "gitlab", "gitea" (experimental), or "azure-devops"
/// (experimental). The `wt switch pr:` shortcut uses `forge.platform` to
@@ -96,14 +98,14 @@ impl ProjectListConfig {
}
impl ProjectConfig {
- /// Get the CI platform override if configured.
+ /// The CI platform set in `[ci]`, if any.
///
/// Deprecated: use [`forge_platform()`](Self::forge_platform) instead.
pub fn ci_platform(&self) -> Option<&str> {
self.ci.platform.as_deref()
}
- /// Get the forge platform override, checking `[forge]` first then `[ci]`.
+ /// The configured forge platform, checking `[forge]` first then `[ci]`.
pub fn forge_platform(&self) -> Option<&str> {
self.forge
.platform
@@ -160,11 +162,11 @@ pub struct ProjectConfig {
#[serde(default, skip_serializing_if = "is_default")]
pub list: ProjectListConfig,
- /// CI configuration (platform override). Deprecated: use `[forge]` instead.
+ /// CI configuration (platform). Deprecated: use `[forge]` instead.
#[serde(default, skip_serializing_if = "is_default")]
pub ci: ProjectCiConfig,
- /// Forge configuration (platform detection override, API hostname)
+ /// Forge configuration (platform, API hostname)
#[serde(default, skip_serializing_if = "is_default")]
pub forge: ProjectForgeConfig,
diff --git a/src/git/ci_platform.rs b/src/git/ci_platform.rs
new file mode 100644
index 000000000..255a118ed
--- /dev/null
+++ b/src/git/ci_platform.rs
@@ -0,0 +1,188 @@
+//! CI platform identification.
+//!
+//! [`CiPlatform`] names the forge a repository's CI runs on (GitHub, GitLab, or
+//! Azure DevOps). It comes from project config (`forge.platform`, or the
+//! deprecated `ci.platform`) when set, otherwise from the remote URL host — see
+//! [`Repository::ci_platform`].
+
+use crate::git::{GitRemoteUrl, Repository};
+
+/// The forge a repository's CI runs on.
+///
+/// Resolved by [`Repository::ci_platform`]: project config (`forge.platform`,
+/// or the deprecated `ci.platform`) takes precedence, falling back to the
+/// remote URL host.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, strum::Display, strum::EnumString)]
+#[strum(serialize_all = "lowercase")]
+pub enum CiPlatform {
+ GitHub,
+ GitLab,
+ #[strum(serialize = "azure-devops", serialize = "azuredevops")]
+ AzureDevOps,
+}
+
+/// Identify the CI platform from a remote URL host ("github" / "gitlab" / Azure DevOps).
+fn platform_from_url(url: &str) -> Option<CiPlatform> {
+ let parsed = GitRemoteUrl::parse(url)?;
+ if parsed.is_github() {
+ Some(CiPlatform::GitHub)
+ } else if parsed.is_gitlab() {
+ Some(CiPlatform::GitLab)
+ } else if parsed.is_azure_devops() {
+ Some(CiPlatform::AzureDevOps)
+ } else {
+ None
+ }
+}
+
+impl Repository {
+ /// The CI platform for this repository, or `None` if it can't be determined.
+ ///
+ /// Priority order:
+ /// 1. Project config `forge.platform` (or the deprecated `ci.platform`)
+ /// 2. `remote_hint`'s effective URL host, when `remote_hint` is given
+ /// 3. The primary remote's effective URL host
+ ///
+ /// For a remote branch, pass its remote as `remote_hint` so the right
+ /// platform is picked in mixed-remote repos (e.g. GitHub + GitLab).
+ /// Effective URLs are used so `url.insteadOf` aliases resolve.
+ pub fn ci_platform(&self, remote_hint: Option<&str>) -> Option<CiPlatform> {
+ if let Some(platform) = self.configured_ci_platform() {
+ return Some(platform);
+ }
+
+ if let Some(remote) = remote_hint
+ && let Some(url) = self.effective_remote_url(remote)
+ && let Some(platform) = platform_from_url(&url)
+ {
+ log::debug!("Detected CI platform {platform} from remote '{remote}' (hint)");
+ return Some(platform);
+ }
+
+ if let Ok(remote) = self.primary_remote()
+ && let Some(url) = self.effective_remote_url(&remote)
+ && let Some(platform) = platform_from_url(&url)
+ {
+ log::debug!("Detected CI platform {platform} from remote '{remote}'");
+ return Some(platform);
+ }
+
+ None
+ }
+
+ /// The CI platform set in project config (`forge.platform` / `ci.platform`).
+ ///
+ /// `None` when unset, set to `gitea` (a valid `forge.platform` for `wt
+ /// switch pr:`, but one worktrunk doesn't fetch CI status from), or
+ /// unrecognized. Resolved once per repository handle, so an unrecognized
+ /// value warns a single time rather than once per branch `wt list` probes.
+ fn configured_ci_platform(&self) -> Option<CiPlatform> {
+ *self.cache.configured_ci_platform.get_or_init(|| {
+ let raw = self
+ .project_config()
+ .ok()
+ .flatten()?
+ .forge_platform()
+ .map(str::to_string)?;
+ if let Ok(platform) = raw.parse::<CiPlatform>() {
+ log::debug!("Using CI platform from config: {platform}");
+ return Some(platform);
+ }
+ // `gitea` is a valid `forge.platform` (the `wt switch pr:` shortcut
+ // uses it), but worktrunk fetches CI status only from GitHub and
+ // GitLab — so it's "no CI status here", not a misconfiguration.
+ if raw.eq_ignore_ascii_case("gitea") {
+ log::debug!(
+ "forge.platform is 'gitea'; CI status is shown for GitHub and GitLab only"
+ );
+ return None;
+ }
+ log::warn!(
+ "Invalid CI platform in config: '{raw}'. Expected 'github', 'gitlab', or 'azure-devops'."
+ );
+ None
+ })
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_ci_platform_string_roundtrip() {
+ assert_eq!(
+ "github".parse::<CiPlatform>().ok(),
+ Some(CiPlatform::GitHub)
+ );
+ assert_eq!(
+ "gitlab".parse::<CiPlatform>().ok(),
+ Some(CiPlatform::GitLab)
+ );
+ // Azure DevOps accepts both spellings; `azure-devops` is canonical.
+ assert_eq!(
+ "azure-devops".parse::<CiPlatform>().ok(),
+ Some(CiPlatform::AzureDevOps)
+ );
+ assert_eq!(
+ "azuredevops".parse::<CiPlatform>().ok(),
+ Some(CiPlatform::AzureDevOps)
+ );
+ assert_eq!(CiPlatform::GitHub.to_string(), "github");
+ assert_eq!(CiPlatform::GitLab.to_string(), "gitlab");
+
+ // Unrecognized values, including wrong case, must not parse.
+ assert!("invalid".parse::<CiPlatform>().is_err());
+ assert!("GITHUB".parse::<CiPlatform>().is_err());
+ assert!("GitHub".parse::<CiPlatform>().is_err());
+ }
+
+ #[test]
+ fn test_platform_from_url() {
+ // GitHub — various URL formats, plus GitHub Enterprise.
+ for url in [
+ "https://github.com/owner/repo.git",
+ "[email protected]:owner/repo.git",
+ "ssh://[email protected]/owner/repo.git",
+ "https://github.mycompany.com/owner/repo.git",
+ "http://github.com/owner/repo.git",
+ "git://github.com/owner/repo.git",
+ ] {
+ assert_eq!(platform_from_url(url), Some(CiPlatform::GitHub), "{url}");
+ }
+
+ // GitLab — various URL formats, plus self-hosted instances.
+ for url in [
+ "https://gitlab.com/owner/repo.git",
+ "[email protected]:owner/repo.git",
+ "https://gitlab.example.com/owner/repo.git",
+ "http://gitlab.example.com/owner/repo.git",
+ "git://gitlab.mycompany.com/owner/repo.git",
+ ] {
+ assert_eq!(platform_from_url(url), Some(CiPlatform::GitLab), "{url}");
+ }
+
+ // Azure DevOps — HTTPS, SSH, and the legacy visualstudio.com host.
+ for url in [
+ "https://dev.azure.com/myorg/myproject/_git/myrepo",
+ "[email protected]:v3/myorg/myproject/myrepo",
+ "https://myorg.visualstudio.com/myproject/_git/myrepo",
+ ] {
+ assert_eq!(
+ platform_from_url(url),
+ Some(CiPlatform::AzureDevOps),
+ "{url}"
+ );
+ }
+
+ // Unknown forges.
+ assert_eq!(
+ platform_from_url("https://bitbucket.org/owner/repo.git"),
+ None
+ );
+ assert_eq!(
+ platform_from_url("https://codeberg.org/owner/repo.git"),
+ None
+ );
+ }
+}
diff --git a/src/git/mod.rs b/src/git/mod.rs
index 8cc059af2..efc7d850b 100644
--- a/src/git/mod.rs
+++ b/src/git/mod.rs
@@ -3,6 +3,7 @@
use std::path::PathBuf;
// Submodules
+mod ci_platform;
mod diff;
mod error;
mod parse;
@@ -35,6 +36,7 @@ static HEAVY_OPS_SEMAPHORE: LazyLock<Semaphore> = LazyLock::new(|| Semaphore::ne
pub const NULL_OID: &str = "0000000000000000000000000000000000000000";
// Re-exports from submodules
+pub use ci_platform::CiPlatform;
pub(crate) use diff::DiffStats;
pub use diff::{LineDiff, parse_numstat_line};
pub use error::{
diff --git a/src/git/repository/mod.rs b/src/git/repository/mod.rs
index fe4a52552..6107812f9 100644
--- a/src/git/repository/mod.rs
+++ b/src/git/repository/mod.rs
@@ -103,7 +103,7 @@ use dunce::canonicalize;
use crate::config::{LoadError, ProjectConfig, ResolvedConfig, UserConfig};
// Import types from parent module
-use super::{CommandError, DefaultBranchName, GitError, LineDiff, WorktreeInfo};
+use super::{CiPlatform, CommandError, DefaultBranchName, GitError, LineDiff, WorktreeInfo};
// Re-export types needed by submodules
pub(super) use super::{
@@ -250,6 +250,11 @@ pub(super) struct RepoCache {
pub(super) project_identifier: OnceCell<String>,
/// Project config (loaded from .config/wt.toml in main worktree)
pub(super) project_config: OnceCell<Option<ProjectConfig>>,
+ /// CI platform from project config (`forge.platform` / `ci.platform`).
+ /// `None` when unset or unrecognized; an unrecognized value warns once,
+ /// deduplicating the warning across the many branches `wt list` probes.
+ /// Resolved via [`Repository::ci_platform`].
+ pub(super) configured_ci_platform: OnceCell<Option<CiPlatform>>,
/// User config (raw, as loaded from disk).
/// Populated by [`Repository::at`] from the
/// [`WORKTRUNK_USER_CONFIG_PRELOAD`] preload when prewarm ran; otherwise
diff --git a/src/git/repository/remotes.rs b/src/git/repository/remotes.rs
index da95cd2c0..6601a5d2b 100644
--- a/src/git/repository/remotes.rs
+++ b/src/git/repository/remotes.rs
@@ -39,7 +39,7 @@
//!
//! | Need | `wt switch pr:N` | `wt list` CI status |
//! |------|------------------|---------------------|
-//! | Platform | Implicit (`pr:` = GitHub, `mr:` = GitLab) | `platform_for_repo` |
+//! | Platform | Implicit (`pr:` = GitHub, `mr:` = GitLab) | `Repository::ci_platform` |
//! | Owner/repo | `fetch_pr_info` builds API path | `github_owner_repo` for check-runs API |
//! | API hostname | `forge.hostname` config, else omit | `forge.hostname` config, else omit |
//! | Fetch remote | `Repository::find_remote_for_repo` by owner/repo | Not needed |
@@ -51,7 +51,7 @@
//!
//! ```toml
//! [forge]
-//! platform = "github" # override platform detection
+//! platform = "github" # forge platform; else detected from URL
//! hostname = "github.example.com" # API hostname (GHE / self-hosted GitLab)
//! ```
//!
@@ -316,8 +316,8 @@ impl Repository {
///
/// Drives the numeric-branch hint in `BranchNotFound` only — `forge.platform`
/// is intentionally not consulted here. Honoring it would duplicate
- /// `platform_for_repo`'s precedence rules; users with that override and an
- /// opaque remote host fall through to the both-platforms hint.
+ /// `Repository::ci_platform`'s precedence rules; users who set it but have
+ /// an opaque remote host fall through to the both-platforms hint.
pub fn detect_ref_type(&self) -> Option<RefType> {
let url = self
.primary_remote()
diff --git a/tests/integration_tests/ci_status.rs b/tests/integration_tests/ci_status.rs
index 0830188df..c6de41d72 100644
--- a/tests/integration_tests/ci_status.rs
+++ b/tests/integration_tests/ci_status.rs
@@ -329,7 +329,7 @@ fn test_list_full_filters_by_repo_owner(mut repo: TestRepo) {
}
#[rstest]
-fn test_list_full_with_platform_override_github(mut repo: TestRepo) {
+fn test_list_full_with_configured_platform_github(mut repo: TestRepo) {
// Set a non-GitHub remote (bitbucket) as origin - platform won't be auto-detected
repo.run_git(&[
"remote",
@@ -338,8 +338,8 @@ fn test_list_full_with_platform_override_github(mut repo: TestRepo) {
"https://bitbucket.org/test-owner/test-repo.git",
]);
- // Add a GitHub remote for PR detection (platform override needs a GitHub remote
- // to determine which repo's PRs to check)
+ // Add a GitHub remote for PR detection (the configured platform still needs a
+ // GitHub remote to determine which repo's PRs to check)
repo.run_git(&[
"remote",
"add",
@@ -347,7 +347,7 @@ fn test_list_full_with_platform_override_github(mut repo: TestRepo) {
"https://github.com/test-owner/test-repo.git",
]);
- // Set platform override in project config
+ // Set the platform explicitly in project config
repo.write_project_config(
r#"
[ci]
@@ -362,7 +362,7 @@ platform = "github"
// Get actual commit SHA
let head_sha = branch_sha(&repo, "feature");
- // Setup mock gh with PR data - this should work because platform is overridden to github
+ // Setup mock gh with PR data - this should work because the platform is set to github
let pr_json = format!(
r#"[{{
"headRefOid": "{}",
@@ -382,7 +382,7 @@ platform = "github"
settings.bind(|| {
let mut cmd = make_snapshot_cmd(&repo, "list", &["--full"], None);
repo.configure_mock_commands(&mut cmd);
- // Platform override should force GitHub detection even with bitbucket remote
+ // The configured platform should force GitHub detection even with a bitbucket remote
assert_cmd_snapshot!(cmd);
});
}
@@ -413,7 +413,29 @@ fn test_list_full_with_gitlab_remote(mut repo: TestRepo) {
}
#[rstest]
-fn test_list_full_with_invalid_platform_override(mut repo: TestRepo) {
+fn test_list_full_with_gitea_forge_platform(mut repo: TestRepo) {
+ // `forge.platform = "gitea"` is a valid value (the `wt switch pr:` shortcut
+ // uses it), but worktrunk fetches CI status only from GitHub/GitLab. `wt
+ // list` must not warn that the value is "invalid" — it just leaves CI blank.
+ repo.run_git(&[
+ "remote",
+ "set-url",
+ "origin",
+ "https://gitea.example.com/test-owner/test-repo.git",
+ ]);
+ repo.write_project_config("[forge]\nplatform = \"gitea\"\n");
+
+ repo.add_worktree("feature");
+
+ let settings = setup_snapshot_settings(&repo);
+ settings.bind(|| {
+ let mut cmd = make_snapshot_cmd(&repo, "list", &["--full"], None);
+ assert_cmd_snapshot!(cmd);
+ });
+}
+
+#[rstest]
+fn test_list_full_with_invalid_configured_platform(mut repo: TestRepo) {
// Set GitHub remote URL
repo.run_git(&[
"remote",
@@ -422,7 +444,7 @@ fn test_list_full_with_invalid_platform_override(mut repo: TestRepo) {
"https://github.com/test-owner/test-repo.git",
]);
- // Set INVALID platform override - should warn and fall back to URL detection
+ // Set an invalid platform value - should warn and fall back to URL detection
repo.write_project_config(
r#"
[ci]
diff --git a/tests/integration_tests/list.rs b/tests/integration_tests/list.rs
index 225c41bc2..5fd8e691b 100644
--- a/tests/integration_tests/list.rs
+++ b/tests/integration_tests/list.rs
@@ -409,7 +409,7 @@ fn test_list_with_remotes_and_full(#[from(repo_with_remote)] repo: TestRepo) {
repo.run_git(&["branch", "-D", "feature-remote"]);
// Set a GitHub-style URL AFTER pushing so platform detection works
- // This exercises the remote_hint path in platform_for_repo
+ // This exercises the remote_hint path in Repository::ci_platform
repo.run_git(&[
"remote",
"set-url",
diff --git a/tests/integration_tests/repository.rs b/tests/integration_tests/repository.rs
index 001a10565..5086790a2 100644
--- a/tests/integration_tests/repository.rs
+++ b/tests/integration_tests/repository.rs
@@ -586,8 +586,8 @@ fn test_primary_remote_url_composition() {
/// `detect_ref_type` resolves the platform's PR/MR reference type from the
/// primary remote URL. Drives the numeric branch hint in `BranchNotFound`
-/// ("To switch to PR #N, run wt switch pr:N"). The `forge.platform` override
-/// branch is exercised end-to-end via the `platform_for_repo` paths.
+/// ("To switch to PR #N, run wt switch pr:N"). The `forge.platform` config
+/// branch is exercised end-to-end via the `Repository::ci_platform` paths.
#[test]
fn test_detect_ref_type() {
// GitHub remote → PR
diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rs
index 0a7a3fa79..66d643870 100644
--- a/tests/integration_tests/switch.rs
+++ b/tests/integration_tests/switch.rs
@@ -3711,11 +3711,11 @@ fn test_switch_pr_gitea_tea_not_installed(#[from(repo_with_remote)] repo: TestRe
});
}
-/// `forge.platform = "gitea"` overrides remote-URL detection. With a non-Gitea
-/// URL, the override picks the Gitea provider directly (no ambiguous fallback).
+/// `forge.platform = "gitea"` selects the Gitea provider directly, even when
+/// the remote URL doesn't look like Gitea (no ambiguous two-provider fallback).
#[rstest]
-fn test_switch_pr_gitea_forge_platform_override(#[from(repo_with_remote)] repo: TestRepo) {
- // Non-Gitea-looking URL — without the override we'd hit the ambiguous path.
+fn test_switch_pr_gitea_forge_platform(#[from(repo_with_remote)] repo: TestRepo) {
+ // Non-Gitea-looking URL — without `forge.platform` set we'd hit the ambiguous path.
repo.run_git(&[
"remote",
"set-url",
@@ -3751,7 +3751,7 @@ fn test_switch_pr_gitea_forge_platform_override(#[from(repo_with_remote)] repo:
settings.bind(|| {
let mut cmd = make_snapshot_cmd(&repo, "switch", &["--create", "pr:101"], None);
configure_mock_cli_env(&mut cmd, &mock_bin);
- assert_cmd_snapshot!("switch_pr_gitea_forge_platform_override", cmd);
+ assert_cmd_snapshot!("switch_pr_gitea_forge_platform", cmd);
});
}
diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_platform_override_github.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_configured_platform_github.snap
similarity index 100%
rename from tests/snapshots/integration__integration_tests__ci_status__list_full_with_platform_override_github.snap
rename to tests/snapshots/integration__integration_tests__ci_status__list_full_with_configured_platform_github.snap
diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_gitea_forge_platform.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_gitea_forge_platform.snap
new file mode 100644
index 000000000..0f4d020a4
--- /dev/null
+++ b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_gitea_forge_platform.snap
@@ -0,0 +1,63 @@
+---
+source: tests/integration_tests/ci_status.rs
+info:
+ program: wt
+ args:
+ - list
+ - "--full"
+ env:
+ APPDATA: "[TEST_CONFIG_HOME]"
+ CLICOLOR_FORCE: "1"
+ COLUMNS: "500"
+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"
+ GIT_COMMON_DIR: ""
+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"
+ GIT_CONFIG_SYSTEM: /dev/null
+ GIT_DIR: ""
+ GIT_EDITOR: ""
+ GIT_INDEX_FILE: ""
+ GIT_OBJECT_DIRECTORY: ""
+ GIT_TERMINAL_PROMPT: "0"
+ GIT_WORK_TREE: ""
+ HOME: "[TEST_HOME]"
+ LANG: C
+ LC_ALL: C
+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"
+ NO_COLOR: ""
+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"
+ PATH: "[PATH]"
+ PSModulePath: ""
+ RUST_LOG: warn
+ SHELL: ""
+ TERM: alacritty
+ USERPROFILE: "[TEST_HOME]"
+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"
+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"
+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"
+ WORKTRUNK_TEST_BASH_INSTALLED: "0"
+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"
+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"
+ WORKTRUNK_TEST_EPOCH: "1735776000"
+ WORKTRUNK_TEST_FISH_INSTALLED: "0"
+ WORKTRUNK_TEST_NUSHELL_ENV: "0"
+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"
+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"
+ WORKTRUNK_TEST_POWERSHELL_INSTALLED: "0"
+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"
+ WORKTRUNK_TEST_ZSH_INSTALLED: "0"
+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"
+---
+success: true
+exit_code: 0
+----- stdout -----
+ Branch Status HEAD± main↕ main…± Remote⇅ CI Path Commit Age Message
+@ main ? ^| | . 05a4a45d 16h Initial commit
++ feature _ ../repo.feature 05a4a45d 16h Initial commit
++ feature-a ↑ ↑1 +1 ../repo.feature-a 1b87d473 16h Add feature-a file
++ feature-b ↑ ↑1 +1 ../repo.feature-b f62940fc 16h Add feature-b file
++ feature-c ↑ ↑1 +1 ../repo.feature-c 345c7c93 16h Add feature-c file
+
+○ Showing 5 worktrees, 1 with changes, 3 ahead
+
+----- stderr -----
diff --git a/tests/snapshots/integration__integration_tests__ci_status__list_full_with_invalid_platform_override.snap b/tests/snapshots/integration__integration_tests__ci_status__list_full_with_invalid_configured_platform.snap
similarity index 100%
rename from tests/snapshots/integration__integration_tests__ci_status__list_full_with_invalid_platform_override.snap
rename to tests/snapshots/integration__integration_tests__ci_status__list_full_with_invalid_configured_platform.snap
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_create.snap b/tests/snapshots/integration__integration_tests__help__help_config_create.snap
index 0624afd3c..f5a744882 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_create.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_create.snap
@@ -354,9 +354,9 @@ With --project, creates .config/wt.toml in the current repositor
  # [list]
  # url = "http://localhost:{{ branch | hash_port }}"
  #
-  # ## Forge platform override
+  # ## Forge platform
  #
-  # Override platform detection for SSH aliases or self-hosted instances:
+  # Name the forge explicitly for SSH aliases or self-hosted instances, where it can't be detected from the remote URL:
  #
  # [forge]
  # platform = "github" # or "gitlab", "gitea" (experimental), "azure-devops" (experimental)
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_long.snap b/tests/snapshots/integration__integration_tests__help__help_config_long.snap
index d7fd86c97..01e6c57fe 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_long.snap
@@ -393,9 +393,9 @@ URL column in wt list (dimmed when port not listening):
  [list]
  url = "http://localhost:{{ branch | hash_port }}"
-Forge platform override
+Forge platform
-Override platform detection for SSH aliases or self-hosted instances:
+Name the forge explicitly for SSH aliases or self-hosted instances, where it can't be detected from the remote URL:
  [forge]
  platform = "github" # or "gitlab", "gitea" (experimental), "azure-devops" (experimental)
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_state_ci_status.snap b/tests/snapshots/integration__integration_tests__help__help_config_state_ci_status.snap
index 5a0165f2f..1e32f2697 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_state_ci_status.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_state_ci_status.snap
@@ -67,7 +67,7 @@ Usage: wt config state ci-status [OPTIONS] [COMMAND]
Caches GitHub/GitLab CI status for display in wt list.
-Requires gh (GitHub) or glab (GitLab) CLI, authenticated. Platform auto-detects from remote URL; override with forge.platform = "github" (or "gitlab") in .config/wt.toml for SSH host aliases or self-hosted instances. For GitHub Enterprise or self-hosted GitLab, also set forge.hostname.
+Requires gh (GitHub) or glab (GitLab) CLI, authenticated. Platform auto-detects from the remote URL; set forge.platform = "github" (or "gitlab") in .config/wt.toml for SSH host aliases or self-hosted instances. For GitHub Enterprise or self-hosted GitLab, also set forge.hostname.
Checks open PRs/MRs first, then branch pipelines for branches with upstream. Local-only branches (no remote tracking) show blank.
diff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_gitea_forge_platform_override.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_gitea_forge_platform.snap
similarity index 100%
rename from tests/snapshots/integration__integration_tests__switch__switch_pr_gitea_forge_platform_override.snap
rename to tests/snapshots/integration__integration_tests__switch__switch_pr_gitea_forge_platform.snap