Skip to content

feat(list): add repo_url to JSON output - #2941

Merged
max-sixty merged 2 commits into
max-sixty:mainfrom
bendrucker:repo-url
Jun 1, 2026
Merged

max-sixty merged 2 commits into
max-sixty:mainfrom
bendrucker:repo-url

Conversation

@bendrucker

Copy link
Copy Markdown
Contributor

Adds a top-level repo_url to wt list --format=json and wt list statusline --format=json, derived locally from the primary remote. Consumers that want a link to the repository itself (not the PR) currently shell out to git remote get-url and convert SSH to HTTPS by hand; repo_url does that from the already-parsed remote.

Also adds ci.repo_url: the repository a PR/MR targets, derived from ci.url. In a fork checkout the primary remote is the contributor's fork while the PR lives upstream, so the two can differ — repo_url names the local repo, ci.repo_url names the PR target. I kept them as separate fields so neither has to guess which one the consumer meant.

Notes

  • GitRemoteUrl::web_url() owns the per-forge shape, including the Azure dev.azure.com / *.visualstudio.com split; it calls azure::fork_remote_url rather than duplicating the format.
  • repo_url_from_ref_url() shares a tokenizer with the existing parse_ref_url, so PR/MR URL shapes live in one place.
  • Both derive from local state — no network access, consistent with the local-first policy.

Add a top-level `repo_url` field to `wt list --format=json` and
`wt list statusline --format=json`, derived locally from the primary
remote (`GitRemoteUrl::web_url` / `Repository::repo_web_url`). This
converts SSH remotes to their HTTPS web URL so consumers stop shelling
out to `git remote get-url` plus a hand-rolled SSH->HTTPS conversion.

Also add `ci.repo_url`: the repository a PR/MR targets, derived from
`ci.url` via `repo_url_from_ref_url`. In a fork checkout the primary
remote points at the contributor's fork, while the PR lives on the
upstream; keeping these as two fields lets a consumer pick the local
repo (`repo_url`) or the PR's target repo (`ci.repo_url`) without either
field lying.

`web_url` feeds the parsed Azure org/project into the canonical
`azure::fork_remote_url` builder, and `repo_url_from_ref_url` shares a
tokenizer with `parse_ref_url`, so the per-forge URL shapes live in one
place each.
@max-sixty

Copy link
Copy Markdown
Owner

looks good @bendrucker , thanks!

@worktrunk-bot anything we need to look over in particular? is Azure treated differently from others? is there a way to totally abstract out of the specific forge here?

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Is Azure treated differently? Yes, materially — and it has to be. Azure URLs don't fit the standard host/owner/repo shape; they carry an {org}/{project}/_git/{repo} path. The parser deals with that by stuffing {org}/{project}/_git into the owner field, so every code path that wants to write an Azure URL has to (a) detect Azure via is_azure_devops(), (b) re-decode via azure_organization() / azure_project(), then (c) dispatch to a per-shape formatter (azure::fork_remote_url, pr_web_url, build_web_url). The new web_url() here follows that pattern (src/git/url.rs:235-262), and it's the same pattern as the existing find_remote() Azure branch.

Could the forge dispatch be abstracted away? Partially. The natural shape is a Forge enum (GitHub { host, owner, repo }, Azure { host, org, project, repo }, …) constructed once at parse time; web_url() becomes a match over the enum, the is_azure_devops() gate disappears, azure_organization()/azure_project() stop re-parsing owner, and src/git/url.rs stops cross-calling into crate::git::remote_ref::azure. That would also let repo_url_from_ref_url() collapse into Forge::parse_ref_url() → Forge, so there's one reverse-derivation path instead of two. But the per-forge knowledge (Gitea's pulls, GitLab's /-/, Azure's _git, pr:/mr: shortcuts) doesn't go away — it just moves from if/else chains into enum variants. And we'd want to think about how it sits next to the existing RemoteRefProvider trait (which already encodes per-platform PR/MR API behaviour). Worth doing the next time a fifth forge or a third Azure-shaped wart shows up; the current containment is small enough that it doesn't pay for itself today.

One concrete thing worth a look in this PR: there are now two independent paths from "the same PR" to a repo web URL — GitRemoteUrl::web_url() (from the local primary remote) and repo_url_from_ref_url() (from the PR's URL). For a non-fork PR they should produce the same string; for a fork PR web_url() names the fork and repo_url_from_ref_url() names the upstream — that's the design and the PR description spells it out. There's no test that pins the "non-fork → identical string" invariant, so a future tweak to either formatter (a trailing .git, a case change) wouldn't get caught. A small parametric test crossing the two would be cheap insurance.

Otherwise the shape looks right — local-only derivation, shared tokenizer in parse_ref_url_parts, and the Azure *.visualstudio.com vs dev.azure.com host handling matches what fork_remote_url already does.

@max-sixty
max-sixty enabled auto-merge (squash) June 1, 2026 16:49
@max-sixty

Copy link
Copy Markdown
Owner

thank you @bendrucker !

merging as experimental, haven't done quite enough checking but trust you!

@max-sixty
max-sixty merged commit f414934 into max-sixty:main Jun 1, 2026
33 checks passed
@bendrucker

Copy link
Copy Markdown
Contributor Author

If there are going to be edge cases I tend to assume they're most likely with the Azure repos. If any bugs come up, happy to work on them.

@bendrucker

Copy link
Copy Markdown
Contributor Author

Was going to follow up with accepting URL on switch only to find #2898 🙌🏻

@max-sixty

Copy link
Copy Markdown
Owner

Was going to follow up with accepting URL on switch only to find #2898 🙌🏻

yes nice!

(though would it need a change for the Azure format?)

@max-sixty max-sixty mentioned this pull request Jun 2, 2026
max-sixty added a commit that referenced this pull request Jun 2, 2026
v0.56.0.

`cargo semver-checks` reports a breaking library API change: the config-deprecation refactor (#2946) replaced the public `Deprecations` struct with a `Vec<DeprecationKind>` alias, removing the struct shape. Not intentional public API, but it forces a minor bump pre-1.0.

## CHANGELOG

### Improved

- **`wt list` JSON output includes `repo_url`**: Each item now carries `repo_url`, the repository's web URL derived from the primary remote (absent when there's no parseable forge remote). It's the local checkout's repo — distinct from `ci.repo_url`, which is the repo a PR/MR targets. ([#2941](#2941), thanks @bendrucker)

### Fixed

- **Bare-repo prompts**: Two UX fixes. `wt config create --project` run in a bare repo with no linked worktrees now explains the next step (`wt switch <branch>` first, then create from inside the worktree) instead of failing with a generic "no worktree found". And the bare-repo worktree-path prompt no longer fires for symbolic identifiers (`-`, `@`, `^`, `pr:`/`mr:`), where the example paths would be misleading — it waits for the next switch to a concrete branch name. ([#2951](#2951), thanks @ammachado)

- **Context gauge spacing in the Claude Code statusline**: The context-gauge moon emoji rendered flush against the percent (`🌕42%`). Most terminals draw the emoji double-width and bleed it into the next cell, so the moon collided with the digits; it now carries a trailing space (`🌕 42%`). ([#2944](#2944))

- **Console storm on Windows**: Detached background hook processes were created with `DETACHED_PROCESS`, which could flash a burst of console windows. They now use `CREATE_NO_WINDOW` and spawn fully hidden. ([#2959](#2959), thanks @nathanbabcock)

### Documentation

- **Codex commit-generation model bumped to `gpt-5.4-mini`**: The recommended `[commit.generation]` command for Codex — shown by `wt config create` and in the LLM-commits docs — now uses `gpt-5.4-mini` (was `gpt-5.1-codex-mini`). ([#2949](#2949))

### Internal

- **Config-deprecation layer refactor**: The deprecation detector now returns a `Vec<DeprecationKind>` instead of a struct of per-field flags, and the per-section config-table walks collapse into two combinators. Behavior-neutral — warning text and migration output are byte-for-byte unchanged. ([#2946](#2946))

> _This was written by Claude Code on behalf of max_
social4hyq pushed a commit to social4hyq/homebrew-core that referenced this pull request Sep 20, 2026
worktrunk 0.56.0

Created-by: HarmonybrewBot
Commit-by: HarmonybrewBot
Merged-by: HarmonybrewBot
Description: Created by `brew bump`

---

Created with `brew bump-formula-pr`.<details>
  <summary>release notes</summary>
  <pre>## Release Notes

### Improved

- **`wt list` JSON output includes `repo_url`**: Each item now carries `repo_url`, the repository's web URL derived from the primary remote (absent when there's no parseable forge remote). It's the local checkout's repo — distinct from `ci.repo_url`, which is the repo a PR/MR targets. ([#2941](max-sixty/worktrunk#2941), thanks @bendrucker)

### Fixed

- **Bare-repo prompts**: Two UX fixes. `wt config create --project` run in a bare repo with no linked worktrees now explains the next step (`wt switch <branch>` first, then create from inside the worktree) instead of failing with a generic "no worktree found". And the bare-repo worktree-path prompt no longer fires for symbolic identifiers (`-`, `@`, `^`, `pr:`/`mr:`), where the example paths would be misleading — it waits for the next switch to a concrete branch name. ([#2951](max-sixty/worktrunk#2951), thanks @ammachado)

- **Context gauge spacing in the Claude Code statusline**: The context-gauge moon emoji rendered flush against the percent (`🌕42%`). Most terminals draw the emoji double-width and bleed it into the next cell, so the moon collided with the digits; it now carries a trailing space (`🌕 42%`). ([#2944](max-sixty/worktrunk#2944))

- **Console storm on Windows**: Detached background hook processes were created with `DETACHED_PROCESS`, which could flash a burst of console windows. They now use `CREATE_NO_WINDOW` and spawn fully hidden. ([#2959](max-sixty/worktrunk#2959), thanks @nathanbabcock)

### Documentation

- **Codex commit-generation model bumped to `gpt-5.4-mini`**: The recommended `[commit.generation]` command for Codex — shown by `wt config create` and in the LLM-commits docs — now uses `gpt-5.4-mini` (was `gpt-5.1-codex-mini`). ([#2949](max-sixty/worktrunk#2949))

### Internal

- **Config-deprecation layer refactor**: The deprecation detector now returns a `Vec<DeprecationKind>` instead of a struct of per-field flags, and the per-section config-table walks collapse into two combinators. Behavior-neutral — warning text and migration output are byte-for-byte unchanged. ([#2946](max-sixty/worktrunk#2946))

## Install worktrunk 0.56.0

### Install prebuilt binaries via shell script

```sh
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/max-sixty/worktrunk/releases/download/v0.56.0/worktrunk-installer.sh | sh && wt config shell install
```

### Install prebuilt binaries via powershell script

```sh
powershell -ExecutionPolicy Bypass -c "irm https://github.com/max-sixty/worktrunk/releases/download/v0.56.0/worktrunk-installer.ps1 | iex"; git-wt config shell install
```

### Install prebuilt binaries via Homebrew

```sh
brew install worktrunk && wt config shell install
```

## Download worktrunk 0.56.0

|  File  | Platform | Checksum |
|--------|----------|----------|
| [worktrunk-aarch64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.56.0/worktrunk-aarch64-apple-darwin.tar.xz) | Apple Silicon macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.56.0/worktrunk-aarch64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-apple-darwin.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.56.0/worktrunk-x86_64-apple-darwin.tar.xz) | Intel macOS | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.56.0/worktrunk-x86_64-apple-darwin.tar.xz.sha256) |
| [worktrunk-x86_64-pc-windows-msvc.zip](https://github.com/max-sixty/worktrunk/releases/download/v0.56.0/worktrunk-x86_64-pc-windows-msvc.zip) | x64 Windows | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.56.0/worktrunk-x86_64-pc-windows-msvc.zip.sha256) |
| [worktrunk-aarch64-unknown-linux-musl.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.56.0/worktrunk-aarch64-unknown-linux-musl.tar.xz) | ARM64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.56.0/worktrunk-aarch64-unknown-linux-musl.tar.xz.sha256) |
| [worktrunk-x86_64-unknown-linux-musl.tar.xz](https://github.com/max-sixty/worktrunk/releases/download/v0.56.0/worktrunk-x86_64-unknown-linux-musl.tar.xz) | x64 MUSL Linux | [checksum](https://github.com/max-sixty/worktrunk/releases/download/v0.56.0/worktrunk-x86_64-unknown-linux-musl.tar.xz.sha256) |



### Install via Cargo

```sh
cargo install worktrunk && wt config shell install
```

### Install via Winget (Windows)

```sh
winget install max-sixty.worktrunk && git-wt config shell install
```

### Install via AUR (Arch Linux)

```sh
paru worktrunk-bin && wt config shell install
```
</pre>
  <p>View the full release notes at <a href="https://github.com/max-sixty/worktrunk/releases/tag/v0.56.0">https://github.com/max-sixty/worktrunk/releases/tag/v0.56.0</a>.</p>
</details>
<hr>

See merge request: Harmonybrew/homebrew-core!10277
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants