Expand description
wt — a Git worktree and GitHub PR manager (library crate).
All real logic lives here so it is unit-testable and counted by coverage;
src/main.rs is a thin entry point. See spec.md for the full behavior
specification.
The single entry point is run, which takes the command-line arguments
and a Cx (injected I/O, environment, and working directory) and returns
the process exit code. Keeping the side-effecting handles in Cx makes the
whole dispatch path testable without touching the real terminal.
Re-exports§
Modules§
- agent
- The code-agent boundary (issue #11): detect installed agent CLIs and drive
them in their JSON output mode.
AgentClientisolates the subprocess work so callers can inject a fake;RealAgentspawns the real binaries. A missing binary yieldsError::AgentUnavailable; a non-zero exit yieldsError::Subprocess. - config
- Configuration loading and merging (spec §11).
- copy
- Copying Git-ignored local files into newly created worktrees (spec §8).
- cx
- Runtime context: injected I/O, environment, and working directory.
- error
- Typed error type for the
wtlibrary. - gh
- The GitHub boundary (spec §4): all pull-request operations shell out to the
ghCLI.GhClientisolates this so tests can inject a fake;RealGhspawns the real binary. A missing or unauthenticatedghyieldsError::GhUnavailablewith an actionable message (§12). - git
- The Git boundary (spec §4):
gixfor reads, thegitCLI for mutations and network operations. Submodules: - hooks
- Post-create and pre-remove hooks (spec §8). Hooks run via
sh -c(Unix) orcmd /C(Windows) with the new worktree as the working directory and theWT_*variables in the environment. - keys
- TUI key bindings (spec §10/§11): the action set, the default keymap, and
parsing/rendering of key strings such as
ctrl+uorf5. - model
- Domain model: the worktree row and its JSON schema (spec §7), plus the
sort and column enums used by
list/status. - output
- Output rendering: color decisions, paging, table layout, and the human
renderers. Submodules are added as the command surface grows; the
stdout/stderr discipline itself lives on
crate::cx::Cx. - query
- Query resolution (spec §7): match a query against a set of worktrees in a defined precedence order, reporting a unique match, ambiguity, or no match.
- slug
- Branch-slug normalization (spec §3).
- template
- Worktree-store path-template rendering (spec §6).
- time
- Time formatting for display (spec §7 “Display conventions”).
- tui
- The terminal UI (spec §10): a live dashboard and action center.
- util
- Shared utilities: fuzzy matching, filesystem helpers, and editor resolution.
- version
- Build and version metadata surfaced by
wt --version/wt -V.