feat(cli): add a read-only --list-workspaces command showing the leased parallel workspaces with branch and state (#232)#233
Merged
Conversation
…ed parallel workspaces with branch and state (#232) Provisioning (#50), integration (#228), and cancellation (#230) of parallel workspaces existed, but there was no single view of which leased workspaces exist and what state they are in, so operators had to inspect git worktrees by hand. Add collectWorktreeGraph plus an opt-in --list-workspaces command that enumerates the leased worktrees under the lease root and reports each one's redacted path, branch, abbreviated head, and clean/dirty state, bounded and available as JSON or text. Strictly read-only (never mutates), fails closed on a non-repository, and reports an empty graph (not an error) when there are no leases.
Owner
Author
E2E verification
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in (
--list-workspaces) read-only command that lists the leased parallel workspaces with their branch and state, decomposed from roadmap #39 (isolated parallel agents).Provisioning (#50), integration (#228), and cancellation (#230) of parallel workspaces existed, but there was no single view of which leased workspaces exist and what state they are in, so operators had to inspect git worktrees by hand.
Design
src/worktree-lease.ts: newcollectWorktreeGraph({ repo, worktreeRoot? })(reusing the module's git/identity helpers) plusformatWorktreeGraph. It enumerates the worktrees under the lease worktree root viagit worktree list --porcelainand reports each one's redacted path, branch, abbreviated head, and clean/dirty state, bounded (100 entries) and redacted (home paths collapsed). Strictly read-only; fails closed on a non-repository; an empty lease set is an empty graph, not an error.src/index.ts: opt-in--list-workspaceswired as a read-only mode (JSON + text), exiting 0 on success and 2 on a usage error or non-repository target.Testing
tests/unit/workspace-graph.test.ts(7 tests): empty graph, listing with branch/head/clean state, clean/dirty classification, no-mutation proof, non-repository refusal, and formatting (empty + populated).tests/integration/workspace-graph.test.ts(3 tests): CLI lists two leased workspaces with correct clean/dirty state (JSON) read-only, reports an empty graph (text), and exits 2 on a non-repository target.Gates: typecheck, build, unit (1654), integration (458 + desktop), smoke (51) all pass.
Closes #232