Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
feat: experimental Azure DevOps support (#1256)
mikeyroush1ca73ab52c4e
diff --git a/dev/wt.example.toml b/dev/wt.example.tomlindex 96632f131..227ce346a 100644--- a/dev/wt.example.toml+++ b/dev/wt.example.toml@@ -24,7 +24,7 @@# Override platform detection for SSH aliases or self-hosted instances:## [forge]-# platform = "github" # or "gitea" (experimental), "gitlab"+# platform = "github" # or "gitlab", "gitea" (experimental), "azure-devops" (experimental)# hostname = "github.example.com" # Example: API host (GHE / self-hosted GitLab)## ## Copy-ignored excludesdiff --git a/docs/content/config.md b/docs/content/config.mdindex 28bed9c3d..af738686f 100644--- a/docs/content/config.md+++ b/docs/content/config.md@@ -402,7 +402,7 @@ Override platform detection for SSH aliases or self-hosted instances:```toml[forge]-platform = "github" # or "gitea" (experimental), "gitlab"+platform = "github" # or "gitlab", "gitea" (experimental), "azure-devops" (experimental)hostname = "github.example.com" # Example: API host (GHE / self-hosted GitLab)```diff --git a/docs/content/switch.md b/docs/content/switch.mdindex 6d6c3a031..45babb3c5 100644--- a/docs/content/switch.md+++ b/docs/content/switch.md@@ -108,6 +108,8 @@ Requires `gh` (GitHub) or `glab` (GitLab) CLI to be installed and authenticated.**Gitea (experimental):** `pr:` is also compatible with Gitea via the `tea` CLI. Set `[forge] platform = "gitea"` in `.config/wt.toml` to opt in; worktrunk also auto-detects Gitea when the remote host contains `gitea` or when `tea login add` has been run for the host.+**Azure DevOps (experimental):** `pr:` is also compatible with Azure DevOps via the `az` CLI (with the `azure-devops` extension). Set `[forge] platform = "azure-devops"` in `.config/wt.toml` to opt in; worktrunk also auto-detects Azure DevOps from `dev.azure.com` and `*.visualstudio.com` remotes.+## When wt switch fails- **Branch doesn't exist** — Use `--create`, or check `wt list --branches`diff --git a/skills/worktrunk/reference/config.md b/skills/worktrunk/reference/config.mdindex cda59c174..04684be6c 100644--- a/skills/worktrunk/reference/config.md+++ b/skills/worktrunk/reference/config.md@@ -401,7 +401,7 @@ Override platform detection for SSH aliases or self-hosted instances:```toml[forge]-platform = "github" # or "gitea" (experimental), "gitlab"+platform = "github" # or "gitlab", "gitea" (experimental), "azure-devops" (experimental)hostname = "github.example.com" # Example: API host (GHE / self-hosted GitLab)```diff --git a/skills/worktrunk/reference/switch.md b/skills/worktrunk/reference/switch.mdindex 1d377679e..822da432b 100644--- a/skills/worktrunk/reference/switch.md+++ b/skills/worktrunk/reference/switch.md@@ -106,6 +106,8 @@ Requires `gh` (GitHub) or `glab` (GitLab) CLI to be installed and authenticated.**Gitea (experimental):** `pr:` is also compatible with Gitea via the `tea` CLI. Set `[forge] platform = "gitea"` in `.config/wt.toml` to opt in; worktrunk also auto-detects Gitea when the remote host contains `gitea` or when `tea login add` has been run for the host.+**Azure DevOps (experimental):** `pr:` is also compatible with Azure DevOps via the `az` CLI (with the `azure-devops` extension). Set `[forge] platform = "azure-devops"` in `.config/wt.toml` to opt in; worktrunk also auto-detects Azure DevOps from `dev.azure.com` and `*.visualstudio.com` remotes.+## When wt switch fails- **Branch doesn't exist** — Use `--create`, or check `wt list --branches`diff --git a/src/cli/mod.rs b/src/cli/mod.rsindex 7ed9ee708..239c624a3 100644--- a/src/cli/mod.rs+++ b/src/cli/mod.rs@@ -634,6 +634,8 @@ Requires `gh` (GitHub) or `glab` (GitLab) CLI to be installed and authenticated.**Gitea (experimental):** `pr:` is also compatible with Gitea via the `tea` CLI. Set `[forge] platform = "gitea"` in `.config/wt.toml` to opt in; worktrunk also auto-detects Gitea when the remote host contains `gitea` or when `tea login add` has been run for the host.+**Azure DevOps (experimental):** `pr:` is also compatible with Azure DevOps via the `az` CLI (with the `azure-devops` extension). Set `[forge] platform = "azure-devops"` in `.config/wt.toml` to opt in; worktrunk also auto-detects Azure DevOps from `dev.azure.com` and `*.visualstudio.com` remotes.+## When wt switch fails- **Branch doesn't exist** — Use `--create`, or check `wt list --branches`@@ -1936,7 +1938,7 @@ Override platform detection for SSH aliases or self-hosted instances:```toml[forge]-platform = "github" # or "gitea" (experimental), "gitlab"+platform = "github" # or "gitlab", "gitea" (experimental), "azure-devops" (experimental)hostname = "github.example.com" # Example: API host (GHE / self-hosted GitLab)```diff --git a/src/commands/config/show.rs b/src/commands/config/show.rsindex 3cebdab89..c8dadcd3d 100644--- a/src/commands/config/show.rs+++ b/src/commands/config/show.rs@@ -379,11 +379,21 @@ fn render_diagnostics(out: &mut String) -> anyhow::Result<()> {ci_tools.glab_authenticated,)?;}+ Some(CiPlatform::AzureDevOps) => {+ let ci_tools = CiToolsStatus::detect(None);+ render_ci_tool_status(+ out,+ "az",+ "Azure DevOps",+ ci_tools.az_installed,+ ci_tools.az_authenticated,+ )?;+ }None => {writeln!(out,"{}",- hint_message("CI status requires GitHub or GitLab remote")+ hint_message("CI status requires GitHub, GitLab, or Azure DevOps remote"))?;}}diff --git a/src/commands/list/ci_status/azure.rs b/src/commands/list/ci_status/azure.rsnew file mode 100644index 000000000..73b8deeb1--- /dev/null+++ b/src/commands/list/ci_status/azure.rs@@ -0,0 +1,323 @@+//! Azure DevOps CI status detection.+//!+//! Detects CI status from Azure DevOps PRs and pipeline runs using the `az` CLI.+//! Requires the `azure-devops` extension (`az extension add --name azure-devops`).++use serde::Deserialize;+use worktrunk::git::remote_ref::azure as az_url;+use worktrunk::git::{GitRemoteUrl, Repository};++use super::{+ CiBranchName, CiSource, CiStatus, PrStatus, is_retriable_error, non_interactive_cmd, parse_json,+};++/// Resolve the Azure DevOps context (host, org, project, `--org` URL) for this+/// repo's `az` invocations.+///+/// Prefers the primary remote so fork workflows hit the right tenant. Falls+/// back to the first Azure remote found if the primary isn't Azure DevOps.+/// Returns `None` if no remote points at Azure DevOps.+fn azure_context(repo: &Repository) -> Option<AzureContext> {+ let try_remote = |url: &str| -> Option<AzureContext> {+ let parsed = GitRemoteUrl::parse(url)?;+ if !parsed.is_azure_devops() {+ return None;+ }+ let host = parsed.host().to_string();+ let organization = parsed.azure_organization()?.to_string();+ let project = parsed.azure_project()?.to_string();+ let org_url = az_url::az_org_url(&host, &organization);+ Some(AzureContext {+ host,+ organization,+ project,+ org_url,+ })+ };++ if let Ok(remote) = repo.primary_remote()+ && let Some(url) = repo.effective_remote_url(&remote)+ && let Some(ctx) = try_remote(&url)+ {+ return Some(ctx);+ }+ for (_, url) in repo.all_remote_urls() {+ if let Some(ctx) = try_remote(&url) {+ return Some(ctx);+ }+ }+ None+}++struct AzureContext {+ host: String,+ organization: String,+ project: String,+ org_url: String,+}++/// Detect Azure DevOps PR CI status for a branch.+///+/// Uses `az repos pr list` to find an open PR for the branch.+pub(super) fn detect_azure_pr(+ repo: &Repository,+ branch: &CiBranchName,+ local_head: &str,+) -> Option<PrStatus> {+ let repo_root = repo.repo_path().ok()?;+ let ctx = azure_context(repo)?;++ // `az repos pr list --source-branch` expects a full ref name.+ let source_ref = format!("refs/heads/{}", branch.name);+ let output = match non_interactive_cmd("az")+ .args([+ "repos",+ "pr",+ "list",+ "--source-branch",+ &source_ref,+ "--status",+ "active",+ "--project",+ &ctx.project,+ "--org",+ &ctx.org_url,+ "--output",+ "json",+ ])+ .current_dir(repo_root)+ .run()+ {+ Ok(output) => output,+ Err(e) => {+ log::warn!(+ "az repos pr list failed to execute for branch {}: {}",+ branch.full_name,+ e+ );+ return None;+ }+ };++ if !output.status.success() {+ let stderr = String::from_utf8_lossy(&output.stderr);+ if is_retriable_error(&stderr) {+ return Some(PrStatus::error());+ }+ return None;+ }++ let pr_list: Vec<AzPrListEntry> =+ parse_json(&output.stdout, "az repos pr list", &branch.full_name)?;+ let pr = pr_list.first()?;++ // mergeStatus reflects merge feasibility, not pipeline result. We surface+ // conflicts and queued states; pipeline pass/fail comes from the pipelines+ // fallback below (callers invoke detect_branch when this returns NoCI).+ let ci_status = match pr.merge_status.as_deref() {+ Some("conflicts") => CiStatus::Conflicts,+ Some("queued") => CiStatus::Running,+ _ => CiStatus::NoCI,+ };++ let is_stale = pr+ .last_merge_source_commit+ .as_ref()+ .and_then(|c| c.commit_id.as_ref())+ .map(|sha| sha != local_head)+ .unwrap_or(true);++ let url = pr.url_for(&ctx);++ Some(PrStatus {+ ci_status,+ source: CiSource::PullRequest,+ is_stale,+ url,+ })+}++/// Detect Azure Pipelines status for a branch (fallback when no PR exists).+///+/// Uses `az pipelines runs list --branch <branch>` to get the most recent run.+/// Note: `--top 1` returns the most recently queued run, which may be a retry+/// from a different SHA than `local_head`; `is_stale` flags that case so the UI+/// can dim the indicator rather than reporting fresh status against stale data.+pub(super) fn detect_azure_pipeline(+ repo: &Repository,+ branch: &str,+ local_head: &str,+) -> Option<PrStatus> {+ let repo_root = repo.repo_path().ok()?;+ let ctx = azure_context(repo)?;++ let branch_ref = format!("refs/heads/{}", branch);+ let output = match non_interactive_cmd("az")+ .args([+ "pipelines",+ "runs",+ "list",+ "--branch",+ &branch_ref,+ "--top",+ "1",+ "--project",+ &ctx.project,+ "--org",+ &ctx.org_url,+ "--output",+ "json",+ ])+ .current_dir(repo_root)+ .run()+ {+ Ok(output) => output,+ Err(e) => {+ log::warn!(+ "az pipelines runs list failed to execute for branch {}: {}",+ branch,+ e+ );+ return None;+ }+ };++ if !output.status.success() {+ let stderr = String::from_utf8_lossy(&output.stderr);+ if is_retriable_error(&stderr) {+ return Some(PrStatus::error());+ }+ return None;+ }++ let runs: Vec<AzPipelineRun> = parse_json(&output.stdout, "az pipelines runs list", branch)?;+ let run = runs.first()?;++ let ci_status = parse_azure_pipeline_status(run.status.as_deref(), run.result.as_deref());++ let is_stale = run+ .source_version+ .as_ref()+ .map(|sha| sha != local_head)+ .unwrap_or(true);++ // The `url` field in the API response is a REST endpoint, not a browser URL —+ // construct the web URL from the host/org/project/build ID instead.+ let web_url = Some(az_url::build_web_url(+ &ctx.host,+ &ctx.organization,+ &ctx.project,+ run.id,+ ));++ Some(PrStatus {+ ci_status,+ source: CiSource::Branch,+ is_stale,+ url: web_url,+ })+}++/// Map Azure Pipelines run status/result to [`CiStatus`].+fn parse_azure_pipeline_status(status: Option<&str>, result: Option<&str>) -> CiStatus {+ match status {+ Some("inProgress" | "notStarted") => CiStatus::Running,+ Some("completed") => match result {+ Some("succeeded") => CiStatus::Passed,+ Some("failed" | "canceled") => CiStatus::Failed,+ _ => CiStatus::NoCI,+ },+ Some("cancelling") => CiStatus::Failed,+ _ => CiStatus::NoCI,+ }+}++/// PR list entry from `az repos pr list --output json`.+#[derive(Debug, Deserialize)]+#[serde(rename_all = "camelCase")]+struct AzPrListEntry {+ pull_request_id: u32,+ #[serde(default)]+ merge_status: Option<String>,+ #[serde(default)]+ last_merge_source_commit: Option<AzCommitRef>,+ repository: AzPrRepository,+}++impl AzPrListEntry {+ fn url_for(&self, ctx: &AzureContext) -> Option<String> {+ Some(az_url::pr_web_url(+ &ctx.host,+ &ctx.organization,+ &self.repository.project.name,+ &self.repository.name,+ self.pull_request_id,+ ))+ }+}++#[derive(Debug, Deserialize)]+#[serde(rename_all = "camelCase")]+struct AzCommitRef {+ #[serde(default)]+ commit_id: Option<String>,+}++#[derive(Debug, Deserialize)]+#[serde(rename_all = "camelCase")]+struct AzPrRepository {+ name: String,+ project: AzPrProject,+}++#[derive(Debug, Deserialize)]+struct AzPrProject {+ name: String,+}++/// Pipeline run from `az pipelines runs list --output json`.+#[derive(Debug, Deserialize)]+#[serde(rename_all = "camelCase")]+struct AzPipelineRun {+ id: u32,+ #[serde(default)]+ status: Option<String>,+ #[serde(default)]+ result: Option<String>,+ #[serde(default)]+ source_version: Option<String>,+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn test_parse_azure_pipeline_status() {+ assert_eq!(+ parse_azure_pipeline_status(Some("inProgress"), None),+ CiStatus::Running+ );+ assert_eq!(+ parse_azure_pipeline_status(Some("notStarted"), None),+ CiStatus::Running+ );+ assert_eq!(+ parse_azure_pipeline_status(Some("completed"), Some("succeeded")),+ CiStatus::Passed+ );+ assert_eq!(+ parse_azure_pipeline_status(Some("completed"), Some("failed")),+ CiStatus::Failed+ );+ assert_eq!(+ parse_azure_pipeline_status(Some("completed"), Some("canceled")),+ CiStatus::Failed+ );+ assert_eq!(+ parse_azure_pipeline_status(Some("cancelling"), None),+ CiStatus::Failed+ );+ assert_eq!(parse_azure_pipeline_status(None, None), CiStatus::NoCI);+ }+}diff --git a/src/commands/list/ci_status/mod.rs b/src/commands/list/ci_status/mod.rsindex 2c634328a..eb095e962 100644--- a/src/commands/list/ci_status/mod.rs+++ b/src/commands/list/ci_status/mod.rs@@ -1,8 +1,10 @@-//! CI status detection for GitHub and GitLab.+//! CI status detection for GitHub, GitLab, and Azure DevOps.//!-//! This module provides CI status detection by querying GitHub PRs/workflows-//! and GitLab MRs/pipelines using their respective CLI tools (`gh` and `glab`).+//! This module provides CI status detection by querying GitHub PRs/workflows,+//! GitLab MRs/pipelines, and Azure DevOps PRs/pipelines using their respective+//! CLI tools (`gh`, `glab`, and `az`).+mod azure;mod cache;mod github;mod gitlab;@@ -154,6 +156,10 @@ pub struct CiToolsStatus {pub glab_installed: bool,/// glab is installed and authenticatedpub glab_authenticated: bool,+ /// az is installed (can run --version)+ pub az_installed: bool,+ /// az is installed and authenticated (logged in)+ pub az_authenticated: bool,}impl CiToolsStatus {@@ -172,11 +178,17 @@ impl CiToolsStatus {} else {tool_available("glab", &["auth", "status"])};+ let az_installed = tool_available("az", &["--version"]);+ // `az account show` exits non-zero when logged out — works whether or not+ // the azure-devops extension is installed.+ let az_authenticated = az_installed && tool_available("az", &["account", "show"]);Self {gh_installed,gh_authenticated,glab_installed,glab_authenticated,+ az_installed,+ az_authenticated,}}}diff --git a/src/commands/list/ci_status/platform.rs b/src/commands/list/ci_status/platform.rsindex 3a44dc7d4..83263ece0 100644--- a/src/commands/list/ci_status/platform.rs+++ b/src/commands/list/ci_status/platform.rs@@ -1,13 +1,13 @@//! CI platform detection.//!-//! Determines whether a repository uses GitHub or GitLab based on+//! Determines whether a repository uses GitHub, GitLab, or Azure DevOps based on//! project config override or remote URL detection.use std::sync::OnceLock;use worktrunk::git::{GitRemoteUrl, Repository};-use super::{CiBranchName, PrStatus, github, gitlab, tool_available};+use super::{CiBranchName, PrStatus, azure, github, gitlab, tool_available};/// Cached CI tool availability.static CI_TOOLS: OnceLock<CiToolsAvailable> = OnceLock::new();@@ -18,12 +18,13 @@ static CI_TOOLS: OnceLock<CiToolsAvailable> = OnceLock::new();/// 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`).+/// Cached availability of CI CLI tools (`gh`, `glab`, `az`).////// Probed once on first access via `--version` check.struct CiToolsAvailable {gh: bool,glab: bool,+ az: bool,}impl CiToolsAvailable {@@ -31,6 +32,7 @@ impl CiToolsAvailable {CI_TOOLS.get_or_init(|| Self {gh: tool_available("gh", &["--version"]),glab: tool_available("glab", &["--version"]),+ az: tool_available("az", &["--version"]),})}}@@ -39,12 +41,14 @@ impl CiToolsAvailable {////// Platform is determined by:/// 1. Project config `forge.platform` (or deprecated `ci.platform`)-/// 2. Remote URL detection (searches for "github" or "gitlab" in hostname)+/// 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 {@@ -53,6 +57,7 @@ impl CiPlatform {match self {Self::GitHub => CiToolsAvailable::get().gh,Self::GitLab => CiToolsAvailable::get().glab,+ Self::AzureDevOps => CiToolsAvailable::get().az,}}@@ -66,6 +71,7 @@ impl CiPlatform {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),}}@@ -80,6 +86,7 @@ impl CiPlatform {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),}}@@ -108,13 +115,16 @@ impl CiPlatform {/// Detect the CI platform from a remote URL.///-/// Uses [`GitRemoteUrl`] to parse the URL and check the host for "github" or "gitlab".+/// 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}@@ -185,7 +195,7 @@ fn platform_from_config(repo: &Repository) -> Option<CiPlatform> {}Err(_) => {log::warn!(- "Invalid CI platform in config: '{configured}'. Expected 'github' or 'gitlab'."+ "Invalid CI platform in config: '{configured}'. Expected 'github', 'gitlab', or 'azure-devops'.");None}@@ -262,6 +272,35 @@ mod tests {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)+ );}#[test]diff --git a/src/commands/worktree/switch.rs b/src/commands/worktree/switch.rsindex 4cd0a684d..be77a9cc5 100644--- a/src/commands/worktree/switch.rs+++ b/src/commands/worktree/switch.rs@@ -16,10 +16,12 @@ use worktrunk::config::{UserConfig, ValidationScope, expand_template, template_references_var, validate_template,};use worktrunk::git::remote_ref::{- self, GitHubProvider, GitLabProvider, GiteaProvider, RemoteRefInfo, RemoteRefProvider,+ self, AzureDevOpsProvider, GitHubProvider, GitLabProvider, GiteaProvider, RemoteRefInfo,+ RemoteRefProvider,};use worktrunk::git::{- GitError, RefContext, RefType, Repository, SwitchSuggestionCtx, current_or_recover,+ GitError, GitRemoteUrl, RefContext, RefType, Repository, SwitchSuggestionCtx,+ current_or_recover,};use worktrunk::styling::{eprintln, format_with_gutter, hint_message, info_message, progress_message, suggest_command,@@ -73,17 +75,18 @@ fn format_ref_context(ctx: &impl RefContext) -> String {)}-#[derive(Debug, Clone, Copy)]+#[derive(Debug, Clone, Copy, PartialEq, Eq)]enum PrProviderChoice {GitHub,Gitea,+ AzureDevOps,}/// Choose which provider should handle `pr:<number>` resolution.////// Priority:-/// 1. `forge.platform` config override-/// 2. Primary remote URL detection (host contains `github`/`gitea`)+/// 1. `forge.platform` config override (`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///@@ -102,46 +105,55 @@ fn choose_pr_provider(repo: &Repository) -> anyhow::Result<PrProviderChoice> {match platform.as_str() {"github" => return Ok(PrProviderChoice::GitHub),"gitea" => return Ok(PrProviderChoice::Gitea),+ "azure-devops" | "azuredevops" => return Ok(PrProviderChoice::AzureDevOps),"gitlab" => {bail!("forge.platform is set to gitlab; use mr:<number> instead of pr:<number>")}_ => bail!("Invalid forge.platform value `{platform_raw}` in .config/wt.toml; \- expected one of: github, gitea, gitlab"+ expected one of: github, gitlab, gitea, azure-devops"),}}- // Use the raw remote URL (not effective) — `insteadOf` rewrites are for- // git transport (e.g., redirecting fetches through a local mirror) and- // can produce a path that doesn't reflect the real forge host.- let detected = repo- .primary_remote()- .ok()- .and_then(|remote| repo.remote_url(&remote))- .and_then(|url| worktrunk::git::GitRemoteUrl::parse(&url));-- let Some(parsed) = detected else {- return Ok(PrProviderChoice::GitHub);- };+ // GitHub still wins in mixed-remote setups (preserves pre-Gitea/Azure+ // behaviour for repos that grew a mirror later). Scan every remote so a+ // non-primary `origin` doesn't hide a GitHub mirror.+ let all_parsed: Vec<_> = repo+ .all_remote_urls()+ .into_iter()+ .filter_map(|(_, url)| GitRemoteUrl::parse(&url))+ .collect();- if parsed.is_github() {+ if all_parsed.iter().any(|u| u.is_github()) {return Ok(PrProviderChoice::GitHub);}- if parsed.is_gitlab() {- bail!("Detected GitLab remote; use mr:<number> instead of pr:<number>")- }- if parsed.is_gitea() {+ if all_parsed.iter().any(|u| u.is_gitea()) {return Ok(PrProviderChoice::Gitea);}+ if all_parsed.iter().any(|u| u.is_azure_devops()) {+ return Ok(PrProviderChoice::AzureDevOps);+ }+ if all_parsed.iter().any(|u| u.is_gitlab()) {+ bail!("Detected GitLab remote; use mr:<number> instead of pr:<number>")+ }- // Self-hosted forge with a non-distinctive hostname. Ask the CLIs which- // one is configured for this host. If only `tea` has a login, pick Gitea;- // otherwise default to GitHub (the common case, and the one users get- // useful errors from when nothing is set up).- if remote_ref::gitea::is_authed_for(parsed.host())- && !remote_ref::github::is_authed_for(parsed.host())- {+ // No recognisable forge remote. Use the primary remote (raw URL — `insteadOf`+ // rewrites are for git transport and may not reflect the real forge host)+ // to ask the CLIs which one is configured for this host. If only `tea` has a+ // login, pick Gitea; otherwise default to GitHub (the common case, and the+ // one users get useful errors from when nothing is set up).+ let Some(host) = repo+ .primary_remote()+ .ok()+ .and_then(|remote| repo.remote_url(&remote))+ .and_then(|url| GitRemoteUrl::parse(&url))+ .map(|u| u.host().to_string())+ else {+ return Ok(PrProviderChoice::GitHub);+ };++ if remote_ref::gitea::is_authed_for(&host) && !remote_ref::github::is_authed_for(&host) {Ok(PrProviderChoice::Gitea)} else {Ok(PrProviderChoice::GitHub)@@ -165,6 +177,9 @@ fn resolve_pr_target(match choose_pr_provider(repo)? {PrProviderChoice::GitHub => resolve_remote_ref(repo, &GitHubProvider, number, create, base),PrProviderChoice::Gitea => resolve_remote_ref(repo, &GiteaProvider, number, create, base),+ PrProviderChoice::AzureDevOps => {+ resolve_remote_ref(repo, &AzureDevOpsProvider, number, create, base)+ }}}@@ -175,6 +190,9 @@ fn resolve_pr_base(match choose_pr_provider(repo)? {PrProviderChoice::GitHub => resolve_remote_ref_as_base(repo, &GitHubProvider, number),PrProviderChoice::Gitea => resolve_remote_ref_as_base(repo, &GiteaProvider, number),+ PrProviderChoice::AzureDevOps => {+ resolve_remote_ref_as_base(repo, &AzureDevOpsProvider, number)+ }}}@@ -509,7 +527,7 @@ fn resolve_switch_target(create: bool,base: Option<&str>,) -> anyhow::Result<ResolvedTarget> {- // Handle pr:<number> syntax+ // Handle pr:<number> syntax — dispatches to GitHub, Gitea, or Azure DevOps based on remotes.if let Some(suffix) = branch.strip_prefix("pr:")&& let Ok(number) = suffix.parse::<u32>(){@@ -1671,4 +1689,94 @@ mod tests {assert_eq!(branch, "main");assert!(!path.is_empty(), "source_path should be the worktree root");}++ #[test]+ fn choose_pr_provider_prefers_github_over_azure() {+ // Mixed-remote setup: a repo with both a GitHub remote and an Azure+ // DevOps remote falls through to GitHub. Operators with an explicit+ // preference set `forge.platform`.+ let test = TestRepo::with_initial_commit();+ test.run_git(&["remote", "add", "origin", "https://github.com/myorg/myrepo"]);+ test.run_git(&[+ "remote",+ "add",+ "azure",+ "https://dev.azure.com/myorg/proj/_git/myrepo",+ ]);++ assert_eq!(+ choose_pr_provider(&test.repo).unwrap(),+ PrProviderChoice::GitHub+ );+ }++ #[test]+ fn choose_pr_provider_azure_only() {+ // Azure-only repo (no GitHub remote) gets the Azure provider.+ let test = TestRepo::with_initial_commit();+ test.run_git(&[+ "remote",+ "add",+ "origin",+ "https://dev.azure.com/myorg/proj/_git/myrepo",+ ]);++ assert_eq!(+ choose_pr_provider(&test.repo).unwrap(),+ PrProviderChoice::AzureDevOps+ );+ }++ #[test]+ fn choose_pr_provider_no_recognised_remote() {+ // Falls back to GitHub when no recognisable forge remote exists,+ // preserving the existing error message from `gh`.+ let test = TestRepo::with_initial_commit();+ assert_eq!(+ choose_pr_provider(&test.repo).unwrap(),+ PrProviderChoice::GitHub+ );+ }++ #[test]+ fn choose_pr_provider_forge_platform_override_wins() {+ // The bug worth covering: a mixed-remote repo where the user explicitly+ // pinned `forge.platform = "azure-devops"`. Without the override, the+ // GitHub remote would win — and the user has no way to redirect `pr:N`.+ // A regression that drops the project-config read would flip this+ // assertion to `GitHub`.+ let test = TestRepo::with_initial_commit();+ test.run_git(&["remote", "add", "origin", "https://github.com/myorg/myrepo"]);+ test.run_git(&[+ "remote",+ "add",+ "azure",+ "https://dev.azure.com/myorg/proj/_git/myrepo",+ ]);+ test.write_project_config("[forge]\nplatform = \"azure-devops\"\n");++ assert_eq!(+ choose_pr_provider(&test.repo).unwrap(),+ PrProviderChoice::AzureDevOps+ );+ }++ #[test]+ fn choose_pr_provider_forge_platform_github_in_azure_only_repo() {+ // Inverse override: Azure-only remotes but `forge.platform = "github"`.+ // Verifies the config arm flips the inferred-from-remotes default.+ let test = TestRepo::with_initial_commit();+ test.run_git(&[+ "remote",+ "add",+ "origin",+ "https://dev.azure.com/myorg/proj/_git/myrepo",+ ]);+ test.write_project_config("[forge]\nplatform = \"github\"\n");++ assert_eq!(+ choose_pr_provider(&test.repo).unwrap(),+ PrProviderChoice::GitHub+ );+ }}diff --git a/src/config/project.rs b/src/config/project.rsindex 60aaa7fcc..ade28d583 100644--- a/src/config/project.rs+++ b/src/config/project.rs@@ -66,16 +66,16 @@ pub struct ProjectCiConfig {////// ```toml/// [forge]-/// platform = "github" # or "gitea" (experimental), "gitlab"+/// platform = "github" # or "gitlab", "gitea" (experimental), "azure-devops" (experimental)/// hostname = "github.example.com" # API hostname for GHE / self-hosted GitLab/// ```#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, JsonSchema)]pub struct ProjectForgeConfig {/// Forge platform override. When set, skips URL-based platform detection.///- /// Values: "github", "gitea" (experimental), or "gitlab". The `wt switch- /// pr:` shortcut uses `forge.platform` to decide which CLI to invoke- /// (`gh`, `tea`, or `glab`).+ /// Values: "github", "gitlab", "gitea" (experimental), or "azure-devops"+ /// (experimental). The `wt switch pr:` shortcut uses `forge.platform` to+ /// decide which CLI to invoke (`gh`, `glab`, `tea`, or `az`).#[serde(default)]pub platform: Option<String>,diff --git a/src/git/remote_ref/azure.rs b/src/git/remote_ref/azure.rsnew file mode 100644index 000000000..49922120c--- /dev/null+++ b/src/git/remote_ref/azure.rs@@ -0,0 +1,401 @@+//! Azure DevOps PR provider.+//!+//! Implements `RemoteRefProvider` for Azure DevOps Pull Requests using the `az` CLI.+//! Requires the `azure-devops` extension (`az extension add --name azure-devops`).++use anyhow::{Context, bail};+use serde::Deserialize;++use super::{CliApiRequest, PlatformData, RemoteRefInfo, RemoteRefProvider, cli_api_error};+use crate::git::url::GitRemoteUrl;+use crate::git::{RefType, Repository};++/// Azure DevOps Pull Request provider.+#[derive(Debug, Clone, Copy)]+pub struct AzureDevOpsProvider;++impl RemoteRefProvider for AzureDevOpsProvider {+ fn ref_type(&self) -> RefType {+ RefType::Pr+ }++ fn platform_label(&self) -> &'static str {+ "azure-devops"+ }++ fn fetch_info(&self, number: u32, repo: &Repository) -> anyhow::Result<RemoteRefInfo> {+ fetch_pr_info(number, repo)+ }++ fn ref_path(&self, number: u32) -> String {+ format!("pull/{}/head", number)+ }+}++/// Construct an Azure DevOps remote URL for a repo.+///+/// Emits `https://{host}/{org}/{project}/_git/{repo}` for `dev.azure.com` and+/// `https://{host}/{project}/_git/{repo}` for legacy `*.visualstudio.com` hosts+/// (where the org is in the hostname). Azure DevOps SSH URLs require per-org+/// public keys, so HTTPS — which works with both PAT and Azure CLI auth — is+/// the safe default.+pub fn fork_remote_url(host: &str, organization: &str, project: &str, repo: &str) -> String {+ if host.to_ascii_lowercase().ends_with(".visualstudio.com") {+ format!("https://{}/{}/_git/{}", host, project, repo)+ } else {+ format!(+ "https://{}/{}/{}/_git/{}",+ host, organization, project, repo+ )+ }+}++/// Construct the PR web URL for the user's actual host (handles `*.visualstudio.com`).+pub fn pr_web_url(host: &str, organization: &str, project: &str, repo: &str, pr: u32) -> String {+ if host.to_ascii_lowercase().ends_with(".visualstudio.com") {+ format!(+ "https://{}/{}/_git/{}/pullrequest/{}",+ host, project, repo, pr+ )+ } else {+ format!(+ "https://dev.azure.com/{}/{}/_git/{}/pullrequest/{}",+ organization, project, repo, pr+ )+ }+}++/// Construct the build-results web URL for the user's actual host.+pub fn build_web_url(host: &str, organization: &str, project: &str, build_id: u32) -> String {+ if host.to_ascii_lowercase().ends_with(".visualstudio.com") {+ format!(+ "https://{}/{}/_build/results?buildId={}",+ host, project, build_id+ )+ } else {+ format!(+ "https://dev.azure.com/{}/{}/_build/results?buildId={}",+ organization, project, build_id+ )+ }+}++/// Raw JSON response from `az repos pr show --id <N>`.+#[derive(Debug, Deserialize)]+#[serde(rename_all = "camelCase")]+struct AzPrResponse {+ title: String,+ created_by: AzIdentity,+ status: String,+ #[serde(default)]+ is_draft: bool,+ source_ref_name: String,+ repository: AzRepository,+ #[serde(default)]+ fork_source: Option<AzForkRef>,+}++#[derive(Debug, Deserialize)]+#[serde(rename_all = "camelCase")]+struct AzIdentity {+ unique_name: String,+}++#[derive(Debug, Deserialize)]+#[serde(rename_all = "camelCase")]+struct AzRepository {+ name: String,+ project: AzProject,+ #[serde(default)]+ web_url: Option<String>,+}++#[derive(Debug, Deserialize)]+struct AzProject {+ name: String,+}++#[derive(Debug, Deserialize)]+#[serde(rename_all = "camelCase")]+struct AzForkRef {+ repository: AzForkRepository,+}++#[derive(Debug, Deserialize)]+#[serde(rename_all = "camelCase")]+struct AzForkRepository {+ #[serde(default)]+ remote_url: Option<String>,+ #[serde(default)]+ ssh_url: Option<String>,+}++/// Detect the Azure DevOps `(host, organization)` to use for API calls.+///+/// Prefers the primary remote (typically `origin` or whatever the user pushed+/// with) so fork workflows hit the right tenant. Falls back to the first+/// Azure remote found if the primary isn't Azure DevOps.+fn detect_azure_target(repo: &Repository) -> Option<(String, String)> {+ if let Ok(remote) = repo.primary_remote()+ && let Some(url) = repo.effective_remote_url(&remote)+ && let Some(parsed) = GitRemoteUrl::parse(&url)+ && let Some(org) = parsed.azure_organization()+ {+ return Some((parsed.host().to_string(), org.to_string()));+ }+ for (_, url) in repo.all_remote_urls() {+ if let Some(parsed) = GitRemoteUrl::parse(&url)+ && let Some(org) = parsed.azure_organization()+ {+ return Some((parsed.host().to_string(), org.to_string()));+ }+ }+ None+}++/// Build the `--org` URL for the `az` CLI from a host and organization.+///+/// `dev.azure.com` and `ssh.dev.azure.com` both map to the cloud `dev.azure.com`+/// API host. Legacy `*.visualstudio.com` hosts keep their hostname (the API+/// accepts both forms).+pub fn az_org_url(host: &str, organization: &str) -> String {+ let lower = host.to_ascii_lowercase();+ if lower.ends_with(".visualstudio.com") {+ format!("https://{}", host)+ } else {+ format!("https://dev.azure.com/{}", organization)+ }+}++/// Parse `(host, organization)` out of an Azure DevOps web URL.+///+/// Returns `None` if the URL is missing or unrecognised; callers fall back to+/// the org detected from local remotes. We refuse to invent values here — the+/// previous version's `unwrap_or(project_name)` produced wrong but plausible+/// identifiers that propagated into the constructed PR URL.+///+/// Two shapes are recognised:+/// - `https://dev.azure.com/{org}/{project}/_git/{repo}` → `("dev.azure.com", org)`+/// - `https://{org}.visualstudio.com/{project}/_git/{repo}` → `("{org}.visualstudio.com", org)`+fn parse_web_url(web_url: Option<&str>) -> Option<(String, String)> {+ let url = web_url?;+ let rest = url+ .strip_prefix("https://")+ .or_else(|| url.strip_prefix("http://"))?;+ let (host, path) = rest.split_once('/')?;+ let host_lower = host.to_ascii_lowercase();+ if host_lower == "dev.azure.com" {+ let org = path.split('/').next().filter(|s| !s.is_empty())?;+ Some((host.to_string(), org.to_string()))+ } else if host_lower.ends_with(".visualstudio.com") {+ let org = host.split('.').next().filter(|s| !s.is_empty())?;+ Some((host.to_string(), org.to_string()))+ } else {+ None+ }+}++fn fetch_pr_info(pr_number: u32, repo: &Repository) -> anyhow::Result<RemoteRefInfo> {+ let repo_root = repo.repo_path()?;+ let pr_id = pr_number.to_string();++ let mut args = vec![+ "repos",+ "pr",+ "show",+ "--id",+ pr_id.as_str(),+ "--output",+ "json",+ ];++ // Auto-detect organization from the primary Azure DevOps remote so+ // contributors don't have to pass `--org` explicitly.+ let target = detect_azure_target(repo);+ let org_url = target.as_ref().map(|(host, org)| az_org_url(host, org));+ if let Some(org_url) = &org_url {+ args.extend(["--org", org_url]);+ }++ let output = super::run_cli_api(CliApiRequest {+ tool: "az",+ args: &args,+ repo_root,+ prompt_env: ("AZURE_CORE_NO_COLOR", "true"),+ install_hint: "Azure CLI (az) not installed; install from https://aka.ms/installazurecli",+ run_context: "Failed to run az repos pr show",+ })?;++ if !output.status.success() {+ let stderr = String::from_utf8_lossy(&output.stderr).trim().to_string();+ let stdout_str = String::from_utf8_lossy(&output.stdout).trim().to_string();++ if stderr.contains("does not exist") || stdout_str.contains("does not exist") {+ bail!("Azure DevOps PR #{} not found", pr_number);+ }+ if stderr.contains("login") || stderr.contains("authenticate") {+ bail!("Azure CLI not authenticated; run az login");+ }+ if stderr.contains("azure-devops") && stderr.contains("extension") {+ bail!(+ "Azure DevOps CLI extension not installed; \+ run: az extension add --name azure-devops"+ );+ }++ return Err(cli_api_error(+ RefType::Pr,+ format!("az repos pr show failed for PR #{}", pr_number),+ &output,+ ));+ }++ let response: AzPrResponse = serde_json::from_slice(&output.stdout).with_context(|| {+ format!(+ "Failed to parse Azure DevOps API response for PR #{}. \+ This may indicate an az CLI version issue.",+ pr_number+ )+ })?;++ // Strip refs/heads/ prefix from branch names+ let source_branch = response+ .source_ref_name+ .strip_prefix("refs/heads/")+ .unwrap_or(&response.source_ref_name)+ .to_string();++ let is_cross_repo = response.fork_source.is_some();++ let fork_push_url = response.fork_source.as_ref().and_then(|fork| {+ fork.repository+ .ssh_url+ .clone()+ .or_else(|| fork.repository.remote_url.clone())+ });++ let project = response.repository.project.name.clone();+ let repo_name = response.repository.name.clone();++ // Prefer the API response's web_url; fall back to whatever we detected from+ // local remotes. Never invent the org from the project name — Azure orgs+ // and projects share a namespace, so a collision produces a URL that 404s+ // in a hard-to-debug way.+ let (host, organization) = parse_web_url(response.repository.web_url.as_deref())+ .or_else(|| target.clone())+ .with_context(|| {+ format!(+ "Could not determine Azure DevOps org/host for PR #{}: \+ response had no web_url and no local Azure remote is configured.",+ pr_number+ )+ })?;++ let pr_url = pr_web_url(&host, &organization, &project, &repo_name, pr_number);++ Ok(RemoteRefInfo {+ ref_type: RefType::Pr,+ number: pr_number,+ title: response.title,+ author: response.created_by.unique_name,+ state: response.status,+ draft: response.is_draft,+ source_branch,+ is_cross_repo,+ url: pr_url,+ fork_push_url,+ platform_data: PlatformData::AzureDevOps {+ host,+ organization,+ project,+ repo_name,+ },+ })+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn test_ref_path() {+ let provider = AzureDevOpsProvider;+ assert_eq!(provider.ref_path(550), "pull/550/head");+ assert_eq!(provider.tracking_ref(550), "refs/pull/550/head");+ }++ #[test]+ fn test_ref_type() {+ let provider = AzureDevOpsProvider;+ assert_eq!(provider.ref_type(), RefType::Pr);+ }++ #[test]+ fn test_parse_web_url_dev_azure() {+ let parsed = parse_web_url(Some("https://dev.azure.com/myorg/myproject/_git/myrepo"));+ assert_eq!(+ parsed,+ Some(("dev.azure.com".to_string(), "myorg".to_string()))+ );+ }++ #[test]+ fn test_parse_web_url_visualstudio() {+ // Legacy *.visualstudio.com URLs encode the org in the hostname.+ let parsed = parse_web_url(Some("https://myorg.visualstudio.com/myproject/_git/myrepo"));+ assert_eq!(+ parsed,+ Some(("myorg.visualstudio.com".to_string(), "myorg".to_string()))+ );+ }++ #[test]+ fn test_parse_web_url_missing_or_unknown() {+ assert_eq!(parse_web_url(None), None);+ assert_eq!(parse_web_url(Some("https://github.com/owner/repo")), None);+ assert_eq!(parse_web_url(Some("not-a-url")), None);+ }++ #[test]+ fn test_fork_remote_url_format() {+ // dev.azure.com gets the canonical {host}/{org}/{project}/_git/{repo} layout.+ assert_eq!(+ fork_remote_url("dev.azure.com", "myorg", "myproject", "myrepo"),+ "https://dev.azure.com/myorg/myproject/_git/myrepo"+ );+ // *.visualstudio.com URLs omit the org (it's already in the hostname).+ assert_eq!(+ fork_remote_url("myorg.visualstudio.com", "myorg", "myproject", "myrepo"),+ "https://myorg.visualstudio.com/myproject/_git/myrepo"+ );+ }++ #[test]+ fn test_pr_web_url_format() {+ assert_eq!(+ pr_web_url("dev.azure.com", "myorg", "myproject", "myrepo", 42),+ "https://dev.azure.com/myorg/myproject/_git/myrepo/pullrequest/42"+ );+ assert_eq!(+ pr_web_url("myorg.visualstudio.com", "myorg", "myproject", "myrepo", 42),+ "https://myorg.visualstudio.com/myproject/_git/myrepo/pullrequest/42"+ );+ }++ #[test]+ fn test_az_org_url_format() {+ assert_eq!(+ az_org_url("dev.azure.com", "myorg"),+ "https://dev.azure.com/myorg"+ );+ assert_eq!(+ az_org_url("myorg.visualstudio.com", "myorg"),+ "https://myorg.visualstudio.com"+ );+ // ssh.dev.azure.com is the API's cloud host — still routes through dev.azure.com.+ assert_eq!(+ az_org_url("ssh.dev.azure.com", "myorg"),+ "https://dev.azure.com/myorg"+ );+ }+}diff --git a/src/git/remote_ref/gitea.rs b/src/git/remote_ref/gitea.rsindex 5ccc86082..8dda7476f 100644--- a/src/git/remote_ref/gitea.rs+++ b/src/git/remote_ref/gitea.rs@@ -29,6 +29,10 @@ impl RemoteRefProvider for GiteaProvider {RefType::Pr}+ fn platform_label(&self) -> &'static str {+ "gitea"+ }+fn fetch_info(&self, number: u32, repo: &Repository) -> anyhow::Result<RemoteRefInfo> {fetch_pr_info(number, repo)}diff --git a/src/git/remote_ref/github.rs b/src/git/remote_ref/github.rsindex 87d7a4a51..cf6233ecd 100644--- a/src/git/remote_ref/github.rs+++ b/src/git/remote_ref/github.rs@@ -23,6 +23,10 @@ impl RemoteRefProvider for GitHubProvider {RefType::Pr}+ fn platform_label(&self) -> &'static str {+ "github"+ }+fn fetch_info(&self, number: u32, repo: &Repository) -> anyhow::Result<RemoteRefInfo> {fetch_pr_info(number, repo)}diff --git a/src/git/remote_ref/gitlab.rs b/src/git/remote_ref/gitlab.rsindex 220a2fa9b..361aeb37c 100644--- a/src/git/remote_ref/gitlab.rs+++ b/src/git/remote_ref/gitlab.rs@@ -41,6 +41,10 @@ impl RemoteRefProvider for GitLabProvider {RefType::Mr}+ fn platform_label(&self) -> &'static str {+ "gitlab"+ }+fn fetch_info(&self, number: u32, repo: &Repository) -> anyhow::Result<RemoteRefInfo> {let repo_root = repo.repo_path()?;fetch_mr_info(number, repo_root)diff --git a/src/git/remote_ref/info.rs b/src/git/remote_ref/info.rsindex 9411541c8..f3c66b9d4 100644--- a/src/git/remote_ref/info.rs+++ b/src/git/remote_ref/info.rs@@ -6,7 +6,7 @@ use crate::git::{RefContext, RefType};/// Platform-specific data for a remote ref.///-/// Contains fields that differ between GitHub and GitLab.+/// Contains fields that differ between GitHub, GitLab, and Azure DevOps.#[derive(Debug, Clone)]pub enum PlatformData {/// GitHub-specific data.@@ -48,6 +48,17 @@ pub enum PlatformData {/// Target project ID (used for deferred URL fetching).target_project_id: u64,},+ /// Azure DevOps-specific data.+ AzureDevOps {+ /// Azure DevOps host (e.g., "dev.azure.com", "myorg.visualstudio.com").+ host: String,+ /// Azure DevOps organization name.+ organization: String,+ /// Azure DevOps project name.+ project: String,+ /// Repository name.+ repo_name: String,+ },}/// Unified information about a PR or MR.@@ -128,6 +139,10 @@ impl RefContext for RemoteRefInfo {}self.source_branch.clone()}+ PlatformData::AzureDevOps { .. } => {+ // Azure DevOps fork PRs are uncommon; just show branch name+ self.source_branch.clone()+ }}} else {self.source_branch.clone()@@ -139,13 +154,13 @@ impl RemoteRefInfo {/// Generate a prefixed local branch name for when the unprefixed name conflicts.////// Returns `<owner>/<branch>` (e.g., `contributor/main`).- /// Used for GitHub/Gitea fork PRs; GitLab doesn't support this pattern.+ /// Used for GitHub/Gitea fork PRs; GitLab and Azure DevOps don't support this pattern.pub fn prefixed_local_branch_name(&self) -> Option<String> {match &self.platform_data {PlatformData::GitHub { head_owner, .. } | PlatformData::Gitea { head_owner, .. } => {Some(format!("{}/{}", head_owner, self.source_branch))}- PlatformData::GitLab { .. } => None,+ PlatformData::GitLab { .. } | PlatformData::AzureDevOps { .. } => None,}}}@@ -406,6 +421,52 @@ mod tests {);}+ #[test]+ fn test_source_ref_azure_same_repo() {+ let info = RemoteRefInfo {+ ref_type: RefType::Pr,+ number: 550,+ title: "Add ACH mandate support".to_string(),+ author: "crogers".to_string(),+ state: "active".to_string(),+ draft: false,+ source_branch: "crogers/ACHMandate".to_string(),+ is_cross_repo: false,+ url: "https://dev.azure.com/myorg/myproject/_git/myrepo/pullrequest/550".to_string(),+ fork_push_url: None,+ platform_data: PlatformData::AzureDevOps {+ host: "dev.azure.com".to_string(),+ organization: "myorg".to_string(),+ project: "myproject".to_string(),+ repo_name: "myrepo".to_string(),+ },+ };+ assert_eq!(info.source_ref(), "crogers/ACHMandate");+ }++ #[test]+ fn test_prefixed_local_branch_name_azure() {+ let info = RemoteRefInfo {+ ref_type: RefType::Pr,+ number: 550,+ title: "Test".to_string(),+ author: "crogers".to_string(),+ state: "active".to_string(),+ draft: false,+ source_branch: "main".to_string(),+ is_cross_repo: true,+ url: "https://dev.azure.com/myorg/myproject/_git/myrepo/pullrequest/550".to_string(),+ fork_push_url: None,+ platform_data: PlatformData::AzureDevOps {+ host: "dev.azure.com".to_string(),+ organization: "myorg".to_string(),+ project: "myproject".to_string(),+ repo_name: "myrepo".to_string(),+ },+ };+ assert_eq!(info.prefixed_local_branch_name(), None);+ }+#[test]fn test_extract_namespace_from_url_invalid() {assert_eq!(extract_namespace_from_url("invalid-url"), None);diff --git a/src/git/remote_ref/mod.rs b/src/git/remote_ref/mod.rsindex 8417f6c5e..0c824f384 100644--- a/src/git/remote_ref/mod.rs+++ b/src/git/remote_ref/mod.rs@@ -1,7 +1,7 @@//! Unified PR/MR reference resolution.//!-//! This module provides a trait-based architecture for resolving GitHub/Gitea PRs and GitLab MRs-//! to local branches. Both platforms follow the same workflow:+//! This module provides a trait-based architecture for resolving GitHub PRs, Gitea PRs,+//! GitLab MRs, and Azure DevOps PRs to local branches. All platforms follow the same workflow://!//! 1. Parse `pr:<number>` or `mr:<number>` syntax//! 2. Fetch metadata from the platform API@@ -36,12 +36,20 @@//! `{owner}`/`{repo}` template expansion depends on local repo context, so the//! provider resolves owner/repo from the primary remote URL and passes a//! pre-expanded path.+//!+//! ## Azure DevOps+//!+//! Uses `az repos pr show --id <number> --output json`. Auto-detects the organisation+//! from configured Azure DevOps remotes. Requires the `azure-devops` extension+//! (`az extension add --name azure-devops`).+pub mod azure;pub mod gitea;pub mod github;pub mod gitlab;mod info;+pub use azure::AzureDevOpsProvider;pub use gitea::GiteaProvider;pub use github::GitHubProvider;pub use gitlab::GitLabProvider;@@ -59,12 +67,19 @@ use crate::shell_exec::Cmd;/// Provider trait for platform-specific PR/MR operations.///-/// Each platform (GitHub, GitLab) implements this trait to provide-/// unified access to PR/MR metadata and ref paths.+/// Each platform (GitHub, GitLab, Azure DevOps) implements this trait to+/// provide unified access to PR/MR metadata and ref paths.pub trait RemoteRefProvider {/// The reference type this provider handles.fn ref_type(&self) -> RefType;+ /// Short, stable identifier for the platform — `"github"`, `"gitlab"`, or+ /// `"azure-devops"`. Useful for diagnostic logging and for tests that need+ /// to verify which provider was selected (the other trait methods don't+ /// distinguish GitHub from Azure DevOps — both use `RefType::Pr` and+ /// `pull/{N}/head`).+ fn platform_label(&self) -> &'static str;+/// Fetch ref information from the platform API.////// # Errors@@ -157,7 +172,10 @@ pub(super) fn cli_config_value(tool: &str, key: &str) -> Option<String> {/// The suggested URL in the error respects each platform's configured git/// protocol (SSH vs HTTPS).pub fn find_remote(repo: &Repository, info: &RemoteRefInfo) -> Result<String, GitError> {- let (owner, repo_name) = match &info.platform_data {+ // Azure DevOps URLs don't fit the host/owner/repo shape that `find_remote_for_repo`+ // assumes (the parser stores `{org}/{project}/_git` in owner). Use the dedicated+ // Azure matcher for that platform; GitHub, Gitea, and GitLab share the owner/repo match.+ let (matched, owner, repo_name) = match &info.platform_data {PlatformData::GitHub {base_owner,base_repo,@@ -172,37 +190,56 @@ pub fn find_remote(repo: &Repository, info: &RemoteRefInfo) -> Result<String, Gibase_owner,base_repo,..- } => (base_owner.as_str(), base_repo.as_str()),+ } => (+ repo.find_remote_for_repo(None, base_owner, base_repo),+ base_owner.as_str(),+ base_repo.as_str(),+ ),+ PlatformData::AzureDevOps {+ organization,+ project,+ repo_name,+ ..+ } => (+ repo.find_remote_for_azure(organization, project, repo_name),+ organization.as_str(),+ repo_name.as_str(),+ ),};- repo.find_remote_for_repo(None, owner, repo_name)- .ok_or_else(|| {- let suggested_url = match &info.platform_data {- PlatformData::GitHub {- host,- base_owner,- base_repo,- ..- } => github::fork_remote_url(host, base_owner, base_repo),- PlatformData::Gitea {- host,- base_owner,- base_repo,- ..- } => gitea::fork_remote_url(host, base_owner, base_repo),- PlatformData::GitLab {- host,- base_owner,- base_repo,- ..- } => gitlab::fork_remote_url(host, base_owner, base_repo),- };- GitError::NoRemoteForRepo {- owner: owner.to_string(),- repo: repo_name.to_string(),- suggested_url,- }- })+ matched.ok_or_else(|| {+ let suggested_url = match &info.platform_data {+ PlatformData::GitHub {+ host,+ base_owner,+ base_repo,+ ..+ } => github::fork_remote_url(host, base_owner, base_repo),+ PlatformData::Gitea {+ host,+ base_owner,+ base_repo,+ ..+ } => gitea::fork_remote_url(host, base_owner, base_repo),+ PlatformData::GitLab {+ host,+ base_owner,+ base_repo,+ ..+ } => gitlab::fork_remote_url(host, base_owner, base_repo),+ PlatformData::AzureDevOps {+ host,+ organization,+ project,+ repo_name,+ } => azure::fork_remote_url(host, organization, project, repo_name),+ };+ GitError::NoRemoteForRepo {+ owner: owner.to_string(),+ repo: repo_name.to_string(),+ suggested_url,+ }+ })}/// Check if a local branch is tracking a specific remote ref.diff --git a/src/git/repository/remotes.rs b/src/git/repository/remotes.rsindex d32dfdce7..da95cd2c0 100644--- a/src/git/repository/remotes.rs+++ b/src/git/repository/remotes.rs@@ -210,6 +210,48 @@ impl Repository {None}+ /// Find a remote that points to the given Azure DevOps project + repo.+ ///+ /// Azure DevOps URLs do not fit the standard `host/owner/repo` shape that+ /// [`find_remote_for_repo`](Self::find_remote_for_repo) assumes — for+ /// `https://dev.azure.com/{org}/{project}/_git/{repo}` the parser stores+ /// `{org}/{project}/_git` in `owner`, and the SSH variant stores `v3/{org}/{project}`.+ /// Match by `azure_organization()` + `azure_project()` + `repo()` instead, so+ /// two projects in the same org with the same repo name don't collide.+ pub fn find_remote_for_azure(+ &self,+ organization: &str,+ project: &str,+ repo_name: &str,+ ) -> Option<String> {+ let matches = |url: &str| -> bool {+ let Some(parsed) = GitRemoteUrl::parse(url) else {+ return false;+ };+ parsed+ .azure_organization()+ .is_some_and(|o| o.eq_ignore_ascii_case(organization))+ && parsed+ .azure_project()+ .is_some_and(|p| p.eq_ignore_ascii_case(project))+ && parsed.repo().eq_ignore_ascii_case(repo_name)+ };++ for (remote_name, raw_url) in self.all_remote_urls() {+ if matches(&raw_url) {+ return Some(remote_name);+ }+ if let Some(effective_url) = self.effective_remote_url(&remote_name)+ && effective_url != raw_url+ && matches(&effective_url)+ {+ return Some(remote_name);+ }+ }++ None+ }+/// Find a remote that points to the same project as the given URL.////// Parses the URL to extract host/owner/repo, then searches configured remotes.@@ -369,3 +411,118 @@ impl Repository {.map(|r| r.local_name.clone())}}++#[cfg(test)]+mod tests {+ use crate::testing::TestRepo;++ #[test]+ fn test_find_remote_for_azure_dev_azure() {+ let t = TestRepo::new();+ t.run_git(&[+ "remote",+ "add",+ "origin",+ "https://dev.azure.com/myorg/myproject/_git/myrepo",+ ]);++ // Matching org/project/repo finds the remote.+ assert_eq!(+ t.repo.find_remote_for_azure("myorg", "myproject", "myrepo"),+ Some("origin".to_string())+ );++ // Wrong project — Azure orgs can hold many projects with the same repo name.+ assert_eq!(+ t.repo+ .find_remote_for_azure("myorg", "wrong-project", "myrepo"),+ None+ );++ // Wrong repo.+ assert_eq!(+ t.repo+ .find_remote_for_azure("myorg", "myproject", "wrong-repo"),+ None+ );++ // Wrong org.+ assert_eq!(+ t.repo+ .find_remote_for_azure("other-org", "myproject", "myrepo"),+ None+ );++ // Case-insensitive across all three components.+ assert_eq!(+ t.repo.find_remote_for_azure("MYORG", "MyProject", "MyRepo"),+ Some("origin".to_string())+ );+ }++ #[test]+ fn test_find_remote_for_azure_ssh_form() {+ // SSH form: [email protected]:v3/{org}/{project}/{repo}+ let t = TestRepo::new();+ t.run_git(&[+ "remote",+ "add",+ "origin",+ "[email protected]:v3/myorg/myproject/myrepo",+ ]);++ assert_eq!(+ t.repo.find_remote_for_azure("myorg", "myproject", "myrepo"),+ Some("origin".to_string())+ );+ }++ #[test]+ fn test_find_remote_for_azure_visualstudio() {+ // Legacy *.visualstudio.com form: org is in the hostname.+ let t = TestRepo::new();+ t.run_git(&[+ "remote",+ "add",+ "origin",+ "https://myorg.visualstudio.com/myproject/_git/myrepo",+ ]);++ assert_eq!(+ t.repo.find_remote_for_azure("myorg", "myproject", "myrepo"),+ Some("origin".to_string())+ );+ }++ #[test]+ fn test_find_remote_for_azure_multiple_remotes() {+ // A repo with both an Azure DevOps fork and a GitHub mirror — the Azure+ // matcher must skip the GitHub remote without false-positive matching.+ let t = TestRepo::new();+ t.run_git(&[+ "remote",+ "add",+ "origin",+ "https://dev.azure.com/myorg/myproject/_git/myrepo",+ ]);+ t.run_git(&["remote", "add", "github", "https://github.com/myorg/myrepo"]);++ assert_eq!(+ t.repo.find_remote_for_azure("myorg", "myproject", "myrepo"),+ Some("origin".to_string())+ );+ }++ #[test]+ fn test_find_remote_for_azure_no_azure_remote() {+ // GitHub-only repo: Azure matcher should find nothing.+ let t = TestRepo::new();+ t.run_git(&["remote", "add", "origin", "https://github.com/myorg/myrepo"]);++ assert_eq!(+ t.repo+ .find_remote_for_azure("myorg", "anyproject", "myrepo"),+ None+ );+ }+}diff --git a/src/git/url.rs b/src/git/url.rsindex fbaa103df..b4a68793e 100644--- a/src/git/url.rs+++ b/src/git/url.rs@@ -165,6 +165,53 @@ impl GitRemoteUrl {pub fn is_gitea(&self) -> bool {self.host.to_ascii_lowercase().contains("gitea")}++ /// Check if this URL points to an Azure DevOps host.+ ///+ /// Matches `dev.azure.com`, `ssh.dev.azure.com`, and legacy `*.visualstudio.com` hosts.+ pub fn is_azure_devops(&self) -> bool {+ let host = self.host.to_ascii_lowercase();+ host.contains("dev.azure.com") || host.contains("visualstudio.com")+ }++ /// Extract the Azure DevOps organization from the URL.+ ///+ /// Azure DevOps URLs do not fit the standard `host/owner/repo` shape:+ /// - `https://dev.azure.com/{org}/{project}/_git/{repo}` — owner is `{org}/{project}/_git`+ /// - `[email protected]:v3/{org}/{project}/{repo}` — owner is `v3/{org}/{project}`+ /// - `https://{org}.visualstudio.com/{project}/_git/{repo}` — org is in the hostname+ pub fn azure_organization(&self) -> Option<&str> {+ if !self.is_azure_devops() {+ return None;+ }+ let parts: Vec<&str> = self.owner.split('/').collect();+ let host = self.host.to_ascii_lowercase();+ if host.contains("ssh.dev.azure.com") {+ parts.get(1).copied()+ } else if host.contains("dev.azure.com") {+ parts.first().copied()+ } else {+ self.host.split('.').next()+ }+ }++ /// Extract the Azure DevOps project from the URL.+ ///+ /// See [`azure_organization`](Self::azure_organization) for URL shape details.+ pub fn azure_project(&self) -> Option<&str> {+ if !self.is_azure_devops() {+ return None;+ }+ let parts: Vec<&str> = self.owner.split('/').collect();+ let host = self.host.to_ascii_lowercase();+ if host.contains("ssh.dev.azure.com") {+ parts.get(2).copied()+ } else if host.contains("dev.azure.com") {+ parts.get(1).copied()+ } else {+ parts.first().copied()+ }+ }}/// Extract owner and repository name from a git remote URL.@@ -987,4 +1034,52 @@ mod tests {identifiers);}++ #[test]+ fn test_is_azure_devops() {+ // HTTPS dev.azure.com+ let url = GitRemoteUrl::parse("https://dev.azure.com/myorg/myproject/_git/myrepo").unwrap();+ assert!(url.is_azure_devops());+ assert!(!url.is_github());+ assert!(!url.is_gitlab());++ // SSH ssh.dev.azure.com+ let url = GitRemoteUrl::parse("[email protected]:v3/myorg/myproject/myrepo").unwrap();+ assert!(url.is_azure_devops());++ // Legacy *.visualstudio.com+ let url =+ GitRemoteUrl::parse("https://myorg.visualstudio.com/myproject/_git/myrepo").unwrap();+ assert!(url.is_azure_devops());++ // GitHub and GitLab should not match+ let url = GitRemoteUrl::parse("https://github.com/owner/repo").unwrap();+ assert!(!url.is_azure_devops());+ let url = GitRemoteUrl::parse("https://gitlab.com/owner/repo").unwrap();+ assert!(!url.is_azure_devops());+ }++ #[test]+ fn test_azure_organization_and_project() {+ // HTTPS dev.azure.com — owner is "{org}/{project}/_git"+ let url = GitRemoteUrl::parse("https://dev.azure.com/myorg/myproject/_git/myrepo").unwrap();+ assert_eq!(url.azure_organization(), Some("myorg"));+ assert_eq!(url.azure_project(), Some("myproject"));++ // SSH ssh.dev.azure.com — owner is "v3/{org}/{project}"+ let url = GitRemoteUrl::parse("[email protected]:v3/myorg/myproject/myrepo").unwrap();+ assert_eq!(url.azure_organization(), Some("myorg"));+ assert_eq!(url.azure_project(), Some("myproject"));++ // Legacy *.visualstudio.com — org is in the hostname+ let url =+ GitRemoteUrl::parse("https://myorg.visualstudio.com/myproject/_git/myrepo").unwrap();+ assert_eq!(url.azure_organization(), Some("myorg"));+ assert_eq!(url.azure_project(), Some("myproject"));++ // Non-Azure URL returns None+ let url = GitRemoteUrl::parse("https://github.com/owner/repo").unwrap();+ assert_eq!(url.azure_organization(), None);+ assert_eq!(url.azure_project(), None);+ }}diff --git a/src/testing/mod.rs b/src/testing/mod.rsindex 093479406..7fe73bc31 100644--- a/src/testing/mod.rs+++ b/src/testing/mod.rs@@ -1947,6 +1947,90 @@ impl TestRepo {self.mock_bin_path = Some(mock_bin);}+ /// Setup mock `az` that returns configurable PR/pipeline data for Azure DevOps.+ ///+ /// Use this for testing Azure DevOps CI status parsing. The mock handles:+ /// - `az repos pr list` → returns `pr_list_json` (array of PR entries)+ /// - `az pipelines runs list` → returns `runs_json` (array of pipeline runs)+ ///+ /// `az repos pr list` is queried per branch (with `--source-branch`), so the+ /// same `pr_list_json` is returned for every branch — mirroring how the+ /// `glab mr list` mock behaves.+ ///+ /// # Arguments+ /// * `pr_list_json` - JSON for `az repos pr list --output json`. Each entry+ /// should include `pullRequestId`, optionally `mergeStatus`,+ /// `lastMergeSourceCommit.commitId`, and `repository.{name,project.name}`.+ /// * `runs_json` - JSON for `az pipelines runs list --output json`. Each entry+ /// should include `id`, optionally `status`, `result`, and `sourceVersion`.+ pub fn setup_mock_az_with_ci_data(&mut self, pr_list_json: &str, runs_json: &str) {+ let mock_bin = self.temp_dir.path().join("mock-bin");+ std::fs::create_dir_all(&mock_bin).unwrap();++ std::fs::write(mock_bin.join("az_pr_list.json"), pr_list_json).unwrap();+ std::fs::write(mock_bin.join("az_runs.json"), runs_json).unwrap();++ MockConfig::new("az")+ .version("azure-cli 2.60.0 (mock)")+ .command("account", MockResponse::exit(0))+ .command("repos pr list", MockResponse::file("az_pr_list.json"))+ .command("pipelines runs list", MockResponse::file("az_runs.json"))+ .command("_default", MockResponse::exit(1))+ .write(&mock_bin);++ // gh/glab mocks fail — platform detection is URL-based, but keep these+ // present-but-useless so a real gh/glab on PATH can't interfere.+ MockConfig::new("gh")+ .command("_default", MockResponse::exit(1))+ .write(&mock_bin);+ MockConfig::new("glab")+ .command("_default", MockResponse::exit(1))+ .write(&mock_bin);++ self.mock_bin_path = Some(mock_bin);+ }++ /// Setup mock `az` where `az repos pr list` and/or `az pipelines runs list`+ /// fail with the given stderr (exit code 1).+ ///+ /// Used to exercise the `is_retriable_error` branches in `detect_azure_pr`+ /// and `detect_azure_pipeline`. A `None` argument makes that command return+ /// an empty JSON array instead of failing.+ pub fn setup_mock_az_with_detection_errors(+ &mut self,+ pr_list_stderr: Option<&str>,+ runs_stderr: Option<&str>,+ ) {+ let mock_bin = self.temp_dir.path().join("mock-bin");+ std::fs::create_dir_all(&mock_bin).unwrap();++ let pr_list_response = match pr_list_stderr {+ Some(stderr) => MockResponse::stderr(stderr).with_exit_code(1),+ None => MockResponse::output("[]"),+ };+ let runs_response = match runs_stderr {+ Some(stderr) => MockResponse::stderr(stderr).with_exit_code(1),+ None => MockResponse::output("[]"),+ };++ MockConfig::new("az")+ .version("azure-cli 2.60.0 (mock)")+ .command("account", MockResponse::exit(0))+ .command("repos pr list", pr_list_response)+ .command("pipelines runs list", runs_response)+ .command("_default", MockResponse::exit(1))+ .write(&mock_bin);++ MockConfig::new("gh")+ .command("_default", MockResponse::exit(1))+ .write(&mock_bin);+ MockConfig::new("glab")+ .command("_default", MockResponse::exit(1))+ .write(&mock_bin);++ self.mock_bin_path = Some(mock_bin);+ }+/// Configure a command to use mock gh/glab commands////// Must call `setup_mock_gh()` first. Prepends the mock bin directory to PATHdiff --git a/tests/integration_tests/ci_status.rs b/tests/integration_tests/ci_status.rsindex 369c137dc..0830188df 100644--- a/tests/integration_tests/ci_status.rs+++ b/tests/integration_tests/ci_status.rs@@ -863,3 +863,169 @@ fn test_list_full_with_gitlab_ci_rate_limit(mut repo: TestRepo) {assert_cmd_snapshot!("gitlab_ci_rate_limit", cmd);});}++// =============================================================================+// Azure DevOps CI status tests+// =============================================================================++/// Set up a repo with an Azure DevOps remote and a `feature` worktree.+/// Returns the `feature` branch HEAD SHA.+fn setup_azure_repo_with_feature(repo: &mut TestRepo) -> String {+ repo.run_git(&[+ "remote",+ "set-url",+ "origin",+ "https://dev.azure.com/myorg/myproject/_git/test-repo",+ ]);+ repo.add_worktree("feature");+ setup_tracking_for_all_branches(repo, "origin");+ branch_sha(repo, "feature")+}++/// Run an Azure DevOps CI status test with the given `az repos pr list` and+/// `az pipelines runs list` mock responses.+fn run_azure_ci_status_test(+ repo: &mut TestRepo,+ snapshot_name: &str,+ pr_list_json: &str,+ runs_json: &str,+) {+ repo.setup_mock_az_with_ci_data(pr_list_json, runs_json);++ let settings = setup_snapshot_settings(repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(repo, "list", &["--full"], None);+ repo.configure_mock_commands(&mut cmd);+ assert_cmd_snapshot!(snapshot_name, cmd);+ });+}++/// An active PR with `mergeStatus: "conflicts"` surfaces as a Conflicts+/// indicator (exercises `detect_azure_pr`).+#[rstest]+fn test_list_full_with_azure_pr_conflicts(mut repo: TestRepo) {+ let head_sha = setup_azure_repo_with_feature(&mut repo);++ let pr_list_json = format!(+ r#"[{{+ "pullRequestId": 7,+ "mergeStatus": "conflicts",+ "lastMergeSourceCommit": {{"commitId": "{}"}},+ "repository": {{"name": "test-repo", "project": {{"name": "myproject"}}}}+ }}]"#,+ head_sha+ );++ run_azure_ci_status_test(&mut repo, "azure_pr_conflicts", &pr_list_json, "[]");+}++/// An active PR with `mergeStatus: "queued"` surfaces as a Running indicator.+#[rstest]+fn test_list_full_with_azure_pr_queued(mut repo: TestRepo) {+ let head_sha = setup_azure_repo_with_feature(&mut repo);++ let pr_list_json = format!(+ r#"[{{+ "pullRequestId": 7,+ "mergeStatus": "queued",+ "lastMergeSourceCommit": {{"commitId": "{}"}},+ "repository": {{"name": "test-repo", "project": {{"name": "myproject"}}}}+ }}]"#,+ head_sha+ );++ run_azure_ci_status_test(&mut repo, "azure_pr_queued", &pr_list_json, "[]");+}++/// No PR for the branch falls back to the latest pipeline run+/// (exercises `detect_azure_pipeline` via `parse_azure_pipeline_status`).+#[rstest]+#[case::passed("completed", "succeeded", "azure_pipeline_passed")]+#[case::failed("completed", "failed", "azure_pipeline_failed")]+#[case::running("inProgress", "null", "azure_pipeline_running")]+fn test_list_full_with_azure_pipeline_status(+ mut repo: TestRepo,+ #[case] status: &str,+ #[case] result: &str,+ #[case] snapshot_name: &str,+) {+ let head_sha = setup_azure_repo_with_feature(&mut repo);++ let runs_json = format!(+ r#"[{{+ "id": 4242,+ "status": "{}",+ "result": {},+ "sourceVersion": "{}"+ }}]"#,+ status,+ if result == "null" {+ "null".to_string()+ } else {+ format!(r#""{}""#, result)+ },+ head_sha+ );++ run_azure_ci_status_test(&mut repo, snapshot_name, "[]", &runs_json);+}++/// A pipeline run from a different SHA than local HEAD is marked stale (dimmed).+#[rstest]+fn test_list_full_with_azure_stale_pipeline(mut repo: TestRepo) {+ setup_azure_repo_with_feature(&mut repo);++ let runs_json = r#"[{+ "id": 4242,+ "status": "completed",+ "result": "succeeded",+ "sourceVersion": "0000000000000000000000000000000000000000"+ }]"#;++ run_azure_ci_status_test(&mut repo, "azure_stale_pipeline", "[]", runs_json);+}++/// No PR and no pipeline runs → no CI indicator.+#[rstest]+fn test_list_full_with_azure_no_ci(mut repo: TestRepo) {+ setup_azure_repo_with_feature(&mut repo);+ run_azure_ci_status_test(&mut repo, "azure_no_ci", "[]", "[]");+}++/// A retriable error from `az repos pr list` (e.g., HTTP 429) surfaces as an+/// error indicator rather than NoCI (exercises the `is_retriable_error` branch+/// in `detect_azure_pr`).+#[rstest]+fn test_list_full_with_azure_pr_list_retriable_error(mut repo: TestRepo) {+ setup_azure_repo_with_feature(&mut repo);+ repo.setup_mock_az_with_detection_errors(+ Some("ERROR: HTTP error 429: Too Many Requests"),+ None,+ );++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "list", &["--full"], None);+ repo.configure_mock_commands(&mut cmd);+ assert_cmd_snapshot!("azure_pr_list_retriable_error", cmd);+ });+}++/// A retriable error from `az pipelines runs list` surfaces as an error+/// indicator (exercises the `is_retriable_error` branch in+/// `detect_azure_pipeline`, reached when no PR exists for the branch).+#[rstest]+fn test_list_full_with_azure_pipeline_retriable_error(mut repo: TestRepo) {+ setup_azure_repo_with_feature(&mut repo);+ repo.setup_mock_az_with_detection_errors(+ None,+ Some("ERROR: HTTP error 429: Too Many Requests"),+ );++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "list", &["--full"], None);+ repo.configure_mock_commands(&mut cmd);+ assert_cmd_snapshot!("azure_pipeline_retriable_error", cmd);+ });+}diff --git a/tests/integration_tests/switch.rs b/tests/integration_tests/switch.rsindex a34e2352c..0a7a3fa79 100644--- a/tests/integration_tests/switch.rs+++ b/tests/integration_tests/switch.rs@@ -4130,6 +4130,494 @@ fn test_switch_pr_gitea_forbidden(#[from(repo_with_remote)] repo: TestRepo) {});}+// ============================================================================+// PR Syntax Tests on Azure DevOps remotes+//+// These exercise `pr:<N>` against an Azure DevOps remote. Host detection picks+// the `az` provider (provider selection is in choose_pr_provider). The remote+// URLs use `dev.azure.com` / `*.visualstudio.com` so `GitRemoteUrl::is_azure_devops()`+// matches and the ambiguous fallback is skipped — the runtime calls only the+// mock `az`, not real `gh`.+// ============================================================================++/// Helper to set up mock `az` for Azure DevOps PR tests with a custom+/// `az repos pr show` response.+///+/// Returns the path to the mock bin directory; pass it to+/// `configure_mock_cli_env`.+fn setup_mock_az(repo: &TestRepo, az_pr_response: Option<&str>) -> std::path::PathBuf {+ let mock_bin = repo.root_path().join("mock-bin");+ fs::create_dir_all(&mock_bin).unwrap();++ copy_mock_binary(&mock_bin, "az");++ if let Some(response) = az_pr_response {+ fs::write(mock_bin.join("az_pr_response.json"), response).unwrap();++ MockConfig::new("az")+ .version("azure-cli 2.60.0 (mock)")+ .command("repos pr show", MockResponse::file("az_pr_response.json"))+ .command("_default", MockResponse::exit(1))+ .write(&mock_bin);+ }++ mock_bin+}++/// Point `origin` at an Azure DevOps URL and redirect that URL to the local+/// bare remote via `url.insteadOf`, so `git fetch` still works.+fn set_azure_remote_url(repo: &TestRepo, azure_url: &str) {+ let bare_url = String::from_utf8_lossy(+ &repo+ .git_command()+ .args(["config", "remote.origin.url"])+ .run()+ .unwrap()+ .stdout,+ )+ .trim()+ .to_string();++ repo.run_git(&["remote", "set-url", "origin", azure_url]);+ repo.run_git(&["config", &format!("url.{}.insteadOf", bare_url), azure_url]);+}++#[rstest]+fn test_switch_pr_azure_create_conflict(#[from(repo_with_remote)] repo: TestRepo) {+ repo.run_git(&[+ "remote",+ "set-url",+ "origin",+ "https://dev.azure.com/myorg/myproject/_git/test-repo",+ ]);++ let az_response = r#"{+ "title": "Fix authentication bug in login flow",+ "createdBy": {"uniqueName": "[email protected]"},+ "status": "active",+ "isDraft": false,+ "sourceRefName": "refs/heads/feature-auth",+ "repository": {+ "name": "test-repo",+ "project": {"name": "myproject"},+ "webUrl": "https://dev.azure.com/myorg/myproject/_git/test-repo"+ },+ "forkSource": null+ }"#;++ let mock_bin = setup_mock_az(&repo, Some(az_response));++ let settings = setup_snapshot_settings(&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_azure_create_conflict", cmd);+ });+}++#[rstest]+fn test_switch_pr_azure_base_conflict(#[from(repo_with_remote)] repo: TestRepo) {+ repo.run_git(&[+ "remote",+ "set-url",+ "origin",+ "https://dev.azure.com/myorg/myproject/_git/test-repo",+ ]);++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "switch", &["--base", "main", "pr:101"], None);+ assert_cmd_snapshot!("switch_pr_azure_base_conflict", cmd);+ });+}++#[rstest]+fn test_switch_pr_azure_same_repo(#[from(repo_with_remote)] mut repo: TestRepo) {+ repo.add_worktree("feature-auth");+ repo.run_git(&["push", "origin", "feature-auth"]);++ set_azure_remote_url(+ &repo,+ "https://dev.azure.com/myorg/myproject/_git/test-repo",+ );++ let az_response = r#"{+ "title": "Fix authentication bug in login flow",+ "createdBy": {"uniqueName": "[email protected]"},+ "status": "active",+ "isDraft": false,+ "sourceRefName": "refs/heads/feature-auth",+ "repository": {+ "name": "test-repo",+ "project": {"name": "myproject"},+ "webUrl": "https://dev.azure.com/myorg/myproject/_git/test-repo"+ },+ "forkSource": null+ }"#;++ let mock_bin = setup_mock_az(&repo, Some(az_response));++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "switch", &["pr:101"], None);+ configure_mock_cli_env(&mut cmd, &mock_bin);+ assert_cmd_snapshot!("switch_pr_azure_same_repo", cmd);+ });+}++/// Legacy `*.visualstudio.com` remotes encode the org in the hostname — exercises+/// the `*.visualstudio.com` branches of the Azure URL helpers end to end.+#[rstest]+fn test_switch_pr_azure_visualstudio_host(#[from(repo_with_remote)] mut repo: TestRepo) {+ repo.add_worktree("feature-auth");+ repo.run_git(&["push", "origin", "feature-auth"]);++ set_azure_remote_url(+ &repo,+ "https://myorg.visualstudio.com/myproject/_git/test-repo",+ );++ let az_response = r#"{+ "title": "Fix authentication bug in login flow",+ "createdBy": {"uniqueName": "[email protected]"},+ "status": "active",+ "isDraft": false,+ "sourceRefName": "refs/heads/feature-auth",+ "repository": {+ "name": "test-repo",+ "project": {"name": "myproject"},+ "webUrl": "https://myorg.visualstudio.com/myproject/_git/test-repo"+ },+ "forkSource": null+ }"#;++ let mock_bin = setup_mock_az(&repo, Some(az_response));++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "switch", &["pr:101"], None);+ configure_mock_cli_env(&mut cmd, &mock_bin);+ assert_cmd_snapshot!("switch_pr_azure_visualstudio_host", cmd);+ });+}++#[rstest]+fn test_switch_pr_azure_fork(#[from(repo_with_remote)] repo: TestRepo) {+ repo.run_git(&["checkout", "-b", "azure-pr-source"]);+ fs::write(+ repo.root_path().join("azure-pr-file.txt"),+ "Azure PR content",+ )+ .unwrap();+ repo.run_git(&["add", "azure-pr-file.txt"]);+ repo.run_git(&["commit", "-m", "Azure PR commit"]);++ let commit_sha = repo+ .git_command()+ .args(["rev-parse", "HEAD"])+ .run()+ .unwrap();+ let sha = String::from_utf8_lossy(&commit_sha.stdout)+ .trim()+ .to_string();++ repo.run_git(&["push", "origin", &format!("{}:refs/pull/42/head", sha)]);+ repo.run_git(&["checkout", "main"]);++ set_azure_remote_url(+ &repo,+ "https://dev.azure.com/myorg/myproject/_git/test-repo",+ );++ let az_response = r#"{+ "title": "Add feature fix for edge case",+ "createdBy": {"uniqueName": "[email protected]"},+ "status": "active",+ "isDraft": false,+ "sourceRefName": "refs/heads/feature-fix",+ "repository": {+ "name": "test-repo",+ "project": {"name": "myproject"},+ "webUrl": "https://dev.azure.com/myorg/myproject/_git/test-repo"+ },+ "forkSource": {+ "repository": {+ "remoteUrl": "https://dev.azure.com/myorg/myproject/_git/test-repo-fork",+ "sshUrl": "[email protected]:v3/myorg/myproject/test-repo-fork"+ }+ }+ }"#;++ let mock_bin = setup_mock_az(&repo, Some(az_response));++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "switch", &["pr:42"], None);+ configure_mock_cli_env(&mut cmd, &mock_bin);+ assert_cmd_snapshot!("switch_pr_azure_fork", cmd);+ });+}++/// `az repos pr show` reporting "does not exist" hits the dedicated+/// not-found bail in `azure::fetch_pr_info`.+#[rstest]+fn test_switch_pr_azure_not_found(#[from(repo_with_remote)] repo: TestRepo) {+ repo.run_git(&[+ "remote",+ "set-url",+ "origin",+ "https://dev.azure.com/myorg/myproject/_git/test-repo",+ ]);++ let mock_bin = repo.root_path().join("mock-bin");+ fs::create_dir_all(&mock_bin).unwrap();+ copy_mock_binary(&mock_bin, "az");++ MockConfig::new("az")+ .version("azure-cli 2.60.0 (mock)")+ .command(+ "repos pr show",+ MockResponse::stderr(+ "TF401174: The requested pull request was not found, or it does not exist.\n",+ )+ .with_exit_code(1),+ )+ .command("_default", MockResponse::exit(1))+ .write(&mock_bin);++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "switch", &["pr:9999"], None);+ configure_mock_cli_env(&mut cmd, &mock_bin);+ assert_cmd_snapshot!("switch_pr_azure_not_found", cmd);+ });+}++/// `az` not installed: with an Azure remote, dispatch routes to the Azure+/// provider, which bails with the install hint when `az` isn't on PATH.+#[rstest]+fn test_switch_pr_azure_az_not_installed(#[from(repo_with_remote)] repo: TestRepo) {+ repo.run_git(&[+ "remote",+ "set-url",+ "origin",+ "https://dev.azure.com/myorg/myproject/_git/test-repo",+ ]);++ let Some(minimal_bin) = setup_minimal_bin_without_cli(&repo) else {+ eprintln!("Skipping test: symlinks not available on this system");+ return;+ };++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "switch", &["pr:101"], None);+ configure_cli_not_installed_env(&mut cmd, &minimal_bin);+ assert_cmd_snapshot!("switch_pr_azure_az_not_installed", cmd);+ });+}++/// `forge.platform = "azure-devops"` overrides remote-URL detection. With a+/// non-Azure URL, the override picks the Azure provider directly.+#[rstest]+fn test_switch_pr_azure_forge_platform_override(#[from(repo_with_remote)] repo: TestRepo) {+ // Non-Azure-looking URL — without the override we'd default to GitHub.+ repo.run_git(&[+ "remote",+ "set-url",+ "origin",+ "https://git.internal.example.com/owner/test-repo.git",+ ]);++ let project_config = repo.root_path().join(".config/wt.toml");+ fs::create_dir_all(project_config.parent().unwrap()).unwrap();+ fs::write(&project_config, "[forge]\nplatform = \"azure-devops\"\n").unwrap();++ let az_response = r#"{+ "title": "Override test",+ "createdBy": {"uniqueName": "[email protected]"},+ "status": "active",+ "isDraft": false,+ "sourceRefName": "refs/heads/feature-auth",+ "repository": {+ "name": "test-repo",+ "project": {"name": "myproject"},+ "webUrl": "https://dev.azure.com/myorg/myproject/_git/test-repo"+ },+ "forkSource": null+ }"#;++ let mock_bin = setup_mock_az(&repo, Some(az_response));++ let settings = setup_snapshot_settings(&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_azure_forge_platform_override", cmd);+ });+}++/// `az repos pr show` returning malformed JSON hits the parse-error path+/// in `azure::fetch_pr_info`.+#[rstest]+fn test_switch_pr_azure_invalid_json(#[from(repo_with_remote)] repo: TestRepo) {+ repo.run_git(&[+ "remote",+ "set-url",+ "origin",+ "https://dev.azure.com/myorg/myproject/_git/test-repo",+ ]);++ let mock_bin = setup_mock_az(&repo, Some("not json {"));++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "switch", &["pr:101"], None);+ configure_mock_cli_env(&mut cmd, &mock_bin);+ assert_cmd_snapshot!("switch_pr_azure_invalid_json", cmd);+ });+}++/// `az repos pr show` failing with a generic (non-auth, non-not-found) error+/// exercises the `cli_api_error` fallback in `azure::fetch_pr_info`.+#[rstest]+fn test_switch_pr_azure_server_error(#[from(repo_with_remote)] repo: TestRepo) {+ repo.run_git(&[+ "remote",+ "set-url",+ "origin",+ "https://dev.azure.com/myorg/myproject/_git/test-repo",+ ]);++ let mock_bin = repo.root_path().join("mock-bin");+ fs::create_dir_all(&mock_bin).unwrap();+ copy_mock_binary(&mock_bin, "az");++ MockConfig::new("az")+ .version("azure-cli 2.60.0 (mock)")+ .command(+ "repos pr show",+ MockResponse::stderr("az: TF400898: An internal error occurred.\n").with_exit_code(1),+ )+ .command("_default", MockResponse::exit(1))+ .write(&mock_bin);++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "switch", &["pr:101"], None);+ configure_mock_cli_env(&mut cmd, &mock_bin);+ assert_cmd_snapshot!("switch_pr_azure_server_error", cmd);+ });+}++/// `az repos pr show` reporting a login error hits the dedicated auth bail.+#[rstest]+fn test_switch_pr_azure_auth_error(#[from(repo_with_remote)] repo: TestRepo) {+ repo.run_git(&[+ "remote",+ "set-url",+ "origin",+ "https://dev.azure.com/myorg/myproject/_git/test-repo",+ ]);++ let mock_bin = repo.root_path().join("mock-bin");+ fs::create_dir_all(&mock_bin).unwrap();+ copy_mock_binary(&mock_bin, "az");++ MockConfig::new("az")+ .version("azure-cli 2.60.0 (mock)")+ .command(+ "repos pr show",+ MockResponse::stderr("Please run 'az login' to setup account.\n").with_exit_code(1),+ )+ .command("_default", MockResponse::exit(1))+ .write(&mock_bin);++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "switch", &["pr:101"], None);+ configure_mock_cli_env(&mut cmd, &mock_bin);+ assert_cmd_snapshot!("switch_pr_azure_auth_error", cmd);+ });+}++/// `az repos pr show` failing because the `azure-devops` extension is missing+/// hits the dedicated extension-install bail.+#[rstest]+fn test_switch_pr_azure_extension_not_installed(#[from(repo_with_remote)] repo: TestRepo) {+ repo.run_git(&[+ "remote",+ "set-url",+ "origin",+ "https://dev.azure.com/myorg/myproject/_git/test-repo",+ ]);++ let mock_bin = repo.root_path().join("mock-bin");+ fs::create_dir_all(&mock_bin).unwrap();+ copy_mock_binary(&mock_bin, "az");++ MockConfig::new("az")+ .version("azure-cli 2.60.0 (mock)")+ .command(+ "repos pr show",+ MockResponse::stderr(+ "ERROR: 'repos' is misspelled or not recognized by the system. \+ The command requires the azure-devops extension.\n",+ )+ .with_exit_code(2),+ )+ .command("_default", MockResponse::exit(1))+ .write(&mock_bin);++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "switch", &["pr:101"], None);+ configure_mock_cli_env(&mut cmd, &mock_bin);+ assert_cmd_snapshot!("switch_pr_azure_extension_not_installed", cmd);+ });+}++/// When the API response has no `webUrl` and no local Azure remote is+/// configured, `fetch_pr_info` can't determine the org/host and bails with a+/// clear error rather than inventing one.+#[rstest]+fn test_switch_pr_azure_org_undeterminable(#[from(repo_with_remote)] repo: TestRepo) {+ // Non-Azure remote → detect_azure_target returns None.+ repo.run_git(&[+ "remote",+ "set-url",+ "origin",+ "https://git.internal.example.com/owner/test-repo.git",+ ]);++ let project_config = repo.root_path().join(".config/wt.toml");+ fs::create_dir_all(project_config.parent().unwrap()).unwrap();+ fs::write(&project_config, "[forge]\nplatform = \"azure-devops\"\n").unwrap();++ // Response omits `repository.webUrl` → parse_web_url returns None.+ let az_response = r#"{+ "title": "No web URL",+ "createdBy": {"uniqueName": "[email protected]"},+ "status": "active",+ "isDraft": false,+ "sourceRefName": "refs/heads/feature-auth",+ "repository": {+ "name": "test-repo",+ "project": {"name": "myproject"}+ },+ "forkSource": null+ }"#;++ let mock_bin = setup_mock_az(&repo, Some(az_response));++ let settings = setup_snapshot_settings(&repo);+ settings.bind(|| {+ let mut cmd = make_snapshot_cmd(&repo, "switch", &["pr:101"], None);+ configure_mock_cli_env(&mut cmd, &mock_bin);+ assert_cmd_snapshot!("switch_pr_azure_org_undeterminable", cmd);+ });+}+// ============================================================================// MR Syntax Tests (mr:<number>) - GitLab// ============================================================================diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_no_ci.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_no_ci.snapnew file mode 100644index 000000000..0ea7a403b--- /dev/null+++ b/tests/snapshots/integration__integration_tests__ci_status__azure_no_ci.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 -----+ [1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mRemote⇅[0m [1mCI[0m [1mPath[0m [1mCommit[0m [1mAge[0m [1mMessage+@ main [2m^[22m[2m|[22m [2m|[0m . [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ [2mfeature[0m [2m_[22m[2m|[22m [2m|[0m [2m../repo.feature[0m [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ feature-a [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m ../repo.feature-a [2m1b87d473[0m [2m16h[0m [2mAdd feature-a file++ feature-b [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m ../repo.feature-b [2mf62940fc[0m [2m16h[0m [2mAdd feature-b file++ feature-c [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m ../repo.feature-c [2m345c7c93[0m [2m16h[0m [2mAdd feature-c file++[2m○[22m [2mShowing 5 worktrees, 3 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_failed.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_failed.snapnew file mode 100644index 000000000..d48e2e1ee--- /dev/null+++ b/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_failed.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 -----+ [1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mRemote⇅[0m [1mCI[0m [1mPath[0m [1mCommit[0m [1mAge[0m [1mMessage+@ main [2m^[22m[2m|[22m [2m|[0m [31m●[0m . [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ [2mfeature[0m [2m_[22m[2m|[22m [2m|[0m [31m●[0m [2m../repo.feature[0m [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ feature-a [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[31m●[0m ../repo.feature-a [2m1b87d473[0m [2m16h[0m [2mAdd feature-a file++ feature-b [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[31m●[0m ../repo.feature-b [2mf62940fc[0m [2m16h[0m [2mAdd feature-b file++ feature-c [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[31m●[0m ../repo.feature-c [2m345c7c93[0m [2m16h[0m [2mAdd feature-c file++[2m○[22m [2mShowing 5 worktrees, 3 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_passed.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_passed.snapnew file mode 100644index 000000000..299e31a71--- /dev/null+++ b/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_passed.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 -----+ [1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mRemote⇅[0m [1mCI[0m [1mPath[0m [1mCommit[0m [1mAge[0m [1mMessage+@ main [2m^[22m[2m|[22m [2m|[0m [32m●[0m . [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ [2mfeature[0m [2m_[22m[2m|[22m [2m|[0m [32m●[0m [2m../repo.feature[0m [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ feature-a [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[32m●[0m ../repo.feature-a [2m1b87d473[0m [2m16h[0m [2mAdd feature-a file++ feature-b [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[32m●[0m ../repo.feature-b [2mf62940fc[0m [2m16h[0m [2mAdd feature-b file++ feature-c [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[32m●[0m ../repo.feature-c [2m345c7c93[0m [2m16h[0m [2mAdd feature-c file++[2m○[22m [2mShowing 5 worktrees, 3 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_retriable_error.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_retriable_error.snapnew file mode 100644index 000000000..90f6d7614--- /dev/null+++ b/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_retriable_error.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 -----+ [1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mRemote⇅[0m [1mCI[0m [1mPath[0m [1mCommit[0m [1mAge[0m [1mMessage+@ main [2m^[22m[2m|[22m [2m|[0m [33m⚠[0m . [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ [2mfeature[0m [2m_[22m[2m|[22m [2m|[0m [33m⚠[0m [2m../repo.feature[0m [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ feature-a [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [33m⚠[0m ../repo.feature-a [2m1b87d473[0m [2m16h[0m [2mAdd feature-a file++ feature-b [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [33m⚠[0m ../repo.feature-b [2mf62940fc[0m [2m16h[0m [2mAdd feature-b file++ feature-c [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [33m⚠[0m ../repo.feature-c [2m345c7c93[0m [2m16h[0m [2mAdd feature-c file++[2m○[22m [2mShowing 5 worktrees, 3 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_running.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_running.snapnew file mode 100644index 000000000..0030dcf5a--- /dev/null+++ b/tests/snapshots/integration__integration_tests__ci_status__azure_pipeline_running.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 -----+ [1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mRemote⇅[0m [1mCI[0m [1mPath[0m [1mCommit[0m [1mAge[0m [1mMessage+@ main [2m^[22m[2m|[22m [2m|[0m [34m●[0m . [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ [2mfeature[0m [2m_[22m[2m|[22m [2m|[0m [34m●[0m [2m../repo.feature[0m [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ feature-a [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[34m●[0m ../repo.feature-a [2m1b87d473[0m [2m16h[0m [2mAdd feature-a file++ feature-b [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[34m●[0m ../repo.feature-b [2mf62940fc[0m [2m16h[0m [2mAdd feature-b file++ feature-c [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[34m●[0m ../repo.feature-c [2m345c7c93[0m [2m16h[0m [2mAdd feature-c file++[2m○[22m [2mShowing 5 worktrees, 3 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_pr_conflicts.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_pr_conflicts.snapnew file mode 100644index 000000000..2a1969261--- /dev/null+++ b/tests/snapshots/integration__integration_tests__ci_status__azure_pr_conflicts.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 -----+ [1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mRemote⇅[0m [1mCI[0m [1mPath[0m [1mCommit[0m [1mAge[0m [1mMessage+@ main [2m^[22m[2m|[22m [2m|[0m [33m●[0m . [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ [2mfeature[0m [2m_[22m[2m|[22m [2m|[0m [33m●[0m [2m../repo.feature[0m [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ feature-a [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[33m●[0m ../repo.feature-a [2m1b87d473[0m [2m16h[0m [2mAdd feature-a file++ feature-b [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[33m●[0m ../repo.feature-b [2mf62940fc[0m [2m16h[0m [2mAdd feature-b file++ feature-c [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[33m●[0m ../repo.feature-c [2m345c7c93[0m [2m16h[0m [2mAdd feature-c file++[2m○[22m [2mShowing 5 worktrees, 3 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_pr_list_retriable_error.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_pr_list_retriable_error.snapnew file mode 100644index 000000000..90f6d7614--- /dev/null+++ b/tests/snapshots/integration__integration_tests__ci_status__azure_pr_list_retriable_error.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 -----+ [1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mRemote⇅[0m [1mCI[0m [1mPath[0m [1mCommit[0m [1mAge[0m [1mMessage+@ main [2m^[22m[2m|[22m [2m|[0m [33m⚠[0m . [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ [2mfeature[0m [2m_[22m[2m|[22m [2m|[0m [33m⚠[0m [2m../repo.feature[0m [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ feature-a [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [33m⚠[0m ../repo.feature-a [2m1b87d473[0m [2m16h[0m [2mAdd feature-a file++ feature-b [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [33m⚠[0m ../repo.feature-b [2mf62940fc[0m [2m16h[0m [2mAdd feature-b file++ feature-c [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [33m⚠[0m ../repo.feature-c [2m345c7c93[0m [2m16h[0m [2mAdd feature-c file++[2m○[22m [2mShowing 5 worktrees, 3 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_pr_queued.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_pr_queued.snapnew file mode 100644index 000000000..0030dcf5a--- /dev/null+++ b/tests/snapshots/integration__integration_tests__ci_status__azure_pr_queued.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 -----+ [1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mRemote⇅[0m [1mCI[0m [1mPath[0m [1mCommit[0m [1mAge[0m [1mMessage+@ main [2m^[22m[2m|[22m [2m|[0m [34m●[0m . [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ [2mfeature[0m [2m_[22m[2m|[22m [2m|[0m [34m●[0m [2m../repo.feature[0m [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ feature-a [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[34m●[0m ../repo.feature-a [2m1b87d473[0m [2m16h[0m [2mAdd feature-a file++ feature-b [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[34m●[0m ../repo.feature-b [2mf62940fc[0m [2m16h[0m [2mAdd feature-b file++ feature-c [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[34m●[0m ../repo.feature-c [2m345c7c93[0m [2m16h[0m [2mAdd feature-c file++[2m○[22m [2mShowing 5 worktrees, 3 ahead++----- stderr -----diff --git a/tests/snapshots/integration__integration_tests__ci_status__azure_stale_pipeline.snap b/tests/snapshots/integration__integration_tests__ci_status__azure_stale_pipeline.snapnew file mode 100644index 000000000..af95de865--- /dev/null+++ b/tests/snapshots/integration__integration_tests__ci_status__azure_stale_pipeline.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 -----+ [1mBranch[0m [1mStatus[0m [1mHEAD±[0m [1mmain↕[0m [1mmain…±[0m [1mRemote⇅[0m [1mCI[0m [1mPath[0m [1mCommit[0m [1mAge[0m [1mMessage+@ main [2m^[22m[2m|[22m [2m|[0m [2m[32m●[0m . [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ [2mfeature[0m [2m_[22m[2m|[22m [2m|[0m [2m[32m●[0m [2m../repo.feature[0m [2m05a4a45d[0m [2m16h[0m [2mInitial commit++ feature-a [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[32m●[0m ../repo.feature-a [2m1b87d473[0m [2m16h[0m [2mAdd feature-a file++ feature-b [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[32m●[0m ../repo.feature-b [2mf62940fc[0m [2m16h[0m [2mAdd feature-b file++ feature-c [2m↑[22m[2m|[22m [32m↑1[0m [32m+1[0m [2m|[0m [2m[32m●[0m ../repo.feature-c [2m345c7c93[0m [2m16h[0m [2mAdd feature-c file++[2m○[22m [2mShowing 5 worktrees, 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_platform_override.snapindex 441f2c6a6..6e2f95c5e 100644--- 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_platform_override.snap@@ -63,4 +63,4 @@ exit_code: 0----- stderr -----[33m▲[39m [33mProject config: [1m[ci][22m is deprecated in favor of [1m[forge][22m[39m[2m↳[22m [2mTo see details, run [4mwt config show[24m; to apply updates, run [4mwt config update[24m[22m-[2m[W][22m Invalid CI platform in config: 'invalid_platform'. Expected 'github' or 'gitlab'.+[2m[W][22m Invalid CI platform in config: 'invalid_platform'. Expected 'github', 'gitlab', or 'azure-devops'.diff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snapindex 4402dcf5e..9844c4263 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_command_not_found.snap@@ -69,7 +69,7 @@ exit_code: 0[107m [0m Invoked as: [1m[PROJECT_ROOT]/target/[BUILD_MODE]/wt[22m[36mDIAGNOSTICS[39m-[2m↳[22m [2mCI status requires GitHub or GitLab remote[22m+[2m↳[22m [2mCI status requires GitHub, GitLab, or Azure DevOps remote[22m[32m✓[39m [32mUp to date ([1m[VERSION][22m)[39m[31m✗[39m [31mCommit generation failed ([1mnonexistent-llm-command-12345 -m test-model[22m)[39m[107m [0m [31m✗[39m [31mCommit generation command failed[39mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snapindex 88a582e41..ca70da3be 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_not_configured.snap@@ -66,7 +66,7 @@ exit_code: 0[107m [0m Invoked as: [1m[PROJECT_ROOT]/target/[BUILD_MODE]/wt[22m[36mDIAGNOSTICS[39m-[2m↳[22m [2mCI status requires GitHub or GitLab remote[22m+[2m↳[22m [2mCI status requires GitHub, GitLab, or Azure DevOps remote[22m[32m✓[39m [32mUp to date ([1m[VERSION][22m)[39m[2m↳[22m [2mCommit generation not configured[22mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snapindex 0794dbf7b..168df7057 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_update_available.snap@@ -66,7 +66,7 @@ exit_code: 0[107m [0m Invoked as: [1m[PROJECT_ROOT]/target/[BUILD_MODE]/wt[22m[36mDIAGNOSTICS[39m-[2m↳[22m [2mCI status requires GitHub or GitLab remote[22m+[2m↳[22m [2mCI status requires GitHub, GitLab, or Azure DevOps remote[22m[2m○[22m Update available: [1m99.0.0[22m (current: [VERSION])[2m↳[22m [2mCommit generation not configured[22mdiff --git a/tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap b/tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snapindex 714a7b662..5cc720762 100644--- a/tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap+++ b/tests/snapshots/integration__integration_tests__config_show__config_show_full_version_check_unavailable.snap@@ -66,7 +66,7 @@ exit_code: 0[107m [0m Invoked as: [1m[PROJECT_ROOT]/target/[BUILD_MODE]/wt[22m[36mDIAGNOSTICS[39m-[2m↳[22m [2mCI status requires GitHub or GitLab remote[22m+[2m↳[22m [2mCI status requires GitHub, GitLab, or Azure DevOps remote[22m[2m↳[22m [2mVersion check unavailable[22m[2m↳[22m [2mCommit generation not configured[22mdiff --git a/tests/snapshots/integration__integration_tests__help__help_config_create.snap b/tests/snapshots/integration__integration_tests__help__help_config_create.snapindex 344926815..0624afd3c 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_create.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_create.snap@@ -359,7 +359,7 @@ With [2m--project[0m, creates [2m.config/wt.toml[0m in the current repositor[107m [0m [2m# Override platform detection for SSH aliases or self-hosted instances:[0m[107m [0m [2m#[0m[107m [0m [2m# [forge][0m-[107m [0m [2m# platform = "github" # or "gitea" (experimental), "gitlab"[0m+[107m [0m [2m# platform = "github" # or "gitlab", "gitea" (experimental), "azure-devops" (experimental)[0m[107m [0m [2m# hostname = "github.example.com" # Example: API host (GHE / self-hosted GitLab)[0m[107m [0m [2m#[0m[107m [0m [2m# ## Copy-ignored excludes[0mdiff --git a/tests/snapshots/integration__integration_tests__help__help_config_long.snap b/tests/snapshots/integration__integration_tests__help__help_config_long.snapindex b38d6c1ab..d7fd86c97 100644--- a/tests/snapshots/integration__integration_tests__help__help_config_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_config_long.snap@@ -398,7 +398,7 @@ URL column in [2mwt list[0m (dimmed when port not listening):Override platform detection for SSH aliases or self-hosted instances:[107m [0m [2m[36m[forge][0m-[107m [0m [2mplatform = [0m[2m[32m"github"[0m[2m [0m[2m# or "gitea" (experimental), "gitlab"[0m+[107m [0m [2mplatform = [0m[2m[32m"github"[0m[2m [0m[2m# or "gitlab", "gitea" (experimental), "azure-devops" (experimental)[0m[107m [0m [2mhostname = [0m[2m[32m"github.example.com"[0m[2m [0m[2m# Example: API host (GHE / self-hosted GitLab)[0m[1m[32mCopy-ignored excludes[0mdiff --git a/tests/snapshots/integration__integration_tests__help__help_list_long.snap b/tests/snapshots/integration__integration_tests__help__help_list_long.snapindex de1014f6d..1694cba4e 100644--- a/tests/snapshots/integration__integration_tests__help__help_list_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_list_long.snap@@ -19,13 +19,17 @@ info:WORKTRUNK_APPROVALS_PATH: /nonexistent/wt/approvals.tomlWORKTRUNK_CONFIG_PATH: /nonexistent/wt/config.tomlWORKTRUNK_SYSTEM_CONFIG_PATH: /etc/xdg/worktrunk/config.toml+ 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"---success: trueexit_code: 0diff --git a/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap b/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snapindex 7b08de82e..238c0e49d 100644--- a/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap+++ b/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap@@ -19,13 +19,17 @@ info:WORKTRUNK_APPROVALS_PATH: /nonexistent/wt/approvals.tomlWORKTRUNK_CONFIG_PATH: /nonexistent/wt/config.tomlWORKTRUNK_SYSTEM_CONFIG_PATH: /etc/xdg/worktrunk/config.toml+ 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"---success: trueexit_code: 0diff --git a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap b/tests/snapshots/integration__integration_tests__help__help_switch_long.snapindex eb5c33df3..c837d5ed1 100644--- a/tests/snapshots/integration__integration_tests__help__help_switch_long.snap+++ b/tests/snapshots/integration__integration_tests__help__help_switch_long.snap@@ -215,6 +215,8 @@ Requires [2mgh[0m (GitHub) or [2mglab[0m (GitLab) CLI to be installed and au[1mGitea (experimental):[0m [2mpr:[0m is also compatible with Gitea via the [2mtea[0m CLI. Set [2m[forge] platform = "gitea"[0m in [2m.config/wt.toml[0m to opt in; worktrunk also auto-detects Gitea when the remote host contains [2mgitea[0m or when [2mtea login add[0m has been run for the host.+[1mAzure DevOps (experimental):[0m [2mpr:[0m is also compatible with Azure DevOps via the [2maz[0m CLI (with the [2mazure-devops[0m extension). Set [2m[forge] platform = "azure-devops"[0m in [2m.config/wt.toml[0m to opt in; worktrunk also auto-detects Azure DevOps from [2mdev.azure.com[0m and [2m*.visualstudio.com[0m remotes.+[1m[32mWhen wt switch fails[0m- [1mBranch doesn't exist[0m — Use [2m--create[0m, or check [2mwt list --branches[0mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_auth_error.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_auth_error.snapnew file mode 100644index 000000000..27eabde05--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_auth_error.snap@@ -0,0 +1,57 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "pr:101"+ 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: false+exit_code: 1+----- stdout -----++----- stderr -----+[36m◎[39m [36mFetching PR #101...[39m+[31m✗[39m [31mAzure CLI not authenticated; run az login[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_az_not_installed.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_az_not_installed.snapnew file mode 100644index 000000000..635257116--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_az_not_installed.snap@@ -0,0 +1,57 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "pr:101"+ 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: false+exit_code: 1+----- stdout -----++----- stderr -----+[36m◎[39m [36mFetching PR #101...[39m+[31m✗[39m [31mAzure CLI (az) not installed; install from https://aka.ms/installazurecli[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_base_conflict.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_base_conflict.snapnew file mode 100644index 000000000..3356a4fbf--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_base_conflict.snap@@ -0,0 +1,59 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "--base"+ - main+ - "pr:101"+ 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: false+exit_code: 1+----- stdout -----++----- stderr -----+[31m✗[39m [31mCannot use [1m--base[22m with [1mpr:101[22m[39m+[2m↳[22m [2mPRs already have a base; remove [4m--base[24m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_create_conflict.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_create_conflict.snapnew file mode 100644index 000000000..82e925c7c--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_create_conflict.snap@@ -0,0 +1,61 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "--create"+ - "pr:101"+ 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: false+exit_code: 1+----- stdout -----++----- stderr -----+[36m◎[39m [36mFetching PR #101...[39m+[107m [0m [1mFix authentication bug in login flow[22m (#101)+[107m [0m by @[email protected] · active · feature-auth · [90mhttps://dev.azure.com/myorg/myproject/_git/test-repo/pullrequest/101[39m+[31m✗[39m [31mCannot create branch for [1mpr:101[22m — PR already has branch [1mfeature-auth[22m[39m+[2m↳[22m [2mTo switch to it: [4mwt switch pr:101[24m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_extension_not_installed.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_extension_not_installed.snapnew file mode 100644index 000000000..ebea6c473--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_extension_not_installed.snap@@ -0,0 +1,57 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "pr:101"+ 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: false+exit_code: 1+----- stdout -----++----- stderr -----+[36m◎[39m [36mFetching PR #101...[39m+[31m✗[39m [31mAzure DevOps CLI extension not installed; run: az extension add --name azure-devops[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_forge_platform_override.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_forge_platform_override.snapnew file mode 100644index 000000000..7f3722bf2--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_forge_platform_override.snap@@ -0,0 +1,61 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "--create"+ - "pr:101"+ 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: false+exit_code: 1+----- stdout -----++----- stderr -----+[36m◎[39m [36mFetching PR #101...[39m+[107m [0m [1mOverride test[22m (#101)+[107m [0m by @[email protected] · active · feature-auth · [90mhttps://dev.azure.com/myorg/myproject/_git/test-repo/pullrequest/101[39m+[31m✗[39m [31mCannot create branch for [1mpr:101[22m — PR already has branch [1mfeature-auth[22m[39m+[2m↳[22m [2mTo switch to it: [4mwt switch pr:101[24m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_fork.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_fork.snapnew file mode 100644index 000000000..4c02f01a1--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_fork.snap@@ -0,0 +1,62 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "pr:42"+ 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 -----++----- stderr -----+[36m◎[39m [36mFetching PR #42...[39m+[107m [0m [1mAdd feature fix for edge case[22m (#42)+[107m [0m by @[email protected] · active · feature-fix · [90mhttps://dev.azure.com/myorg/myproject/_git/test-repo/pullrequest/42[39m+[2m○[22m Push configured to fork: [[email protected]:v3/myorg/myproject/test-repo-fork[24m+[32m✓[39m [32mCreated branch [1mfeature-fix[22m (tracking [1mPR #42[22m) and worktree @ [1m_REPO_.feature-fix[22m[39m+[33m▲[39m [33mCannot change directory — shell integration not installed[39m+[2m↳[22m [2mTo enable automatic cd, run [4mwt config shell install[24m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_invalid_json.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_invalid_json.snapnew file mode 100644index 000000000..5bc5884a1--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_invalid_json.snap@@ -0,0 +1,58 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "pr:101"+ 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: false+exit_code: 1+----- stdout -----++----- stderr -----+[36m◎[39m [36mFetching PR #101...[39m+[31m✗[39m [31mFailed to parse Azure DevOps API response for PR #101. This may indicate an az CLI version issue.[39m+[107m [0m expected ident at line 1 column 2diff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_not_found.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_not_found.snapnew file mode 100644index 000000000..c0a7f67cd--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_not_found.snap@@ -0,0 +1,57 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "pr:9999"+ 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: false+exit_code: 1+----- stdout -----++----- stderr -----+[36m◎[39m [36mFetching PR #9999...[39m+[31m✗[39m [31mAzure DevOps PR #9999 not found[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_org_undeterminable.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_org_undeterminable.snapnew file mode 100644index 000000000..03a1ab50e--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_org_undeterminable.snap@@ -0,0 +1,57 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "pr:101"+ 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: false+exit_code: 1+----- stdout -----++----- stderr -----+[36m◎[39m [36mFetching PR #101...[39m+[31m✗[39m [31mCould not determine Azure DevOps org/host for PR #101: response had no web_url and no local Azure remote is configured.[39mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_same_repo.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_same_repo.snapnew file mode 100644index 000000000..fce1ee753--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_same_repo.snap@@ -0,0 +1,61 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "pr:101"+ 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 -----++----- stderr -----+[36m◎[39m [36mFetching PR #101...[39m+[107m [0m [1mFix authentication bug in login flow[22m (#101)+[107m [0m by @[email protected] · active · feature-auth · [90mhttps://dev.azure.com/myorg/myproject/_git/test-repo/pullrequest/101[39m+[36m◎[39m [36mFetching [1mfeature-auth[22m from origin...[39m+[33m▲[39m [33mWorktree for [1mfeature-auth[22m @ [1m_REPO_.feature-auth[22m, but cannot change directory — shell integration not installed[39m+[2m↳[22m [2mTo enable automatic cd, run [4mwt config shell install[24m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_server_error.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_server_error.snapnew file mode 100644index 000000000..81a951f40--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_server_error.snap@@ -0,0 +1,58 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "pr:101"+ 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: false+exit_code: 1+----- stdout -----++----- stderr -----+[36m◎[39m [36mFetching PR #101...[39m+[31m✗[39m [31maz repos pr show failed for PR #101[39m+[107m [0m az: TF400898: An internal error occurred.diff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_visualstudio_host.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_visualstudio_host.snapnew file mode 100644index 000000000..5050501a5--- /dev/null+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_azure_visualstudio_host.snap@@ -0,0 +1,61 @@+---+source: tests/integration_tests/switch.rs+info:+ program: wt+ args:+ - switch+ - "pr:101"+ 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 -----++----- stderr -----+[36m◎[39m [36mFetching PR #101...[39m+[107m [0m [1mFix authentication bug in login flow[22m (#101)+[107m [0m by @[email protected] · active · feature-auth · [90mhttps://myorg.visualstudio.com/myproject/_git/test-repo/pullrequest/101[39m+[36m◎[39m [36mFetching [1mfeature-auth[22m from origin...[39m+[33m▲[39m [33mWorktree for [1mfeature-auth[22m @ [1m_REPO_.feature-auth[22m, but cannot change directory — shell integration not installed[39m+[2m↳[22m [2mTo enable automatic cd, run [4mwt config shell install[24m[22mdiff --git a/tests/snapshots/integration__integration_tests__switch__switch_pr_forge_platform_invalid_bails.snap b/tests/snapshots/integration__integration_tests__switch__switch_pr_forge_platform_invalid_bails.snapindex 2aec7e705..7192eca01 100644--- a/tests/snapshots/integration__integration_tests__switch__switch_pr_forge_platform_invalid_bails.snap+++ b/tests/snapshots/integration__integration_tests__switch__switch_pr_forge_platform_invalid_bails.snap@@ -53,4 +53,4 @@ exit_code: 1----- stdout ---------- stderr ------[31m✗[39m [31mInvalid forge.platform value `bitbucket` in .config/wt.toml; expected one of: github, gitea, gitlab[39m+[31m✗[39m [31mInvalid forge.platform value `bitbucket` in .config/wt.toml; expected one of: github, gitlab, gitea, azure-devops[39m