Skip to content

feat(workspace): accept repo@branch handle in worktree remove#746

Merged
chubes4 merged 1 commit into
mainfrom
worktree-remove-handle
Jun 16, 2026
Merged

feat(workspace): accept repo@branch handle in worktree remove#746
chubes4 merged 1 commit into
mainfrom
worktree-remove-handle

Conversation

@chubes4

@chubes4 chubes4 commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

workspace worktree remove was the odd one out on the workspace CLI surface: it only accepted the two-arg <repo> <branch> form and rejected the <repo>@<branch-slug> handle that list, show, path, finalize, mark-cleanup-eligible, and the cleanup dry-run output all print/accept. Copying a handle out of list/cleanup output and pasting it into remove failed every time:

$ wp datamachine-code workspace worktree remove agents-api@fix-host-loaded-channel-smokes --force
Error: Usage: worktree remove <repo> <branch> [--force]

This PR closes the gap (scoped to it — no command redesign).

Changes

  • The remove case of the worktree() dispatcher in inc/Cli/Commands/WorkspaceCommand.php now accepts a single <repo>@<branch-slug> handle as the first positional, in addition to the existing two-arg <repo> <branch> form (kept for backward compat).
  • When both positionals are present, the two-arg form wins and acts as the disambiguator. A lone first arg containing @ is split on the first @ into repo + branch-slug.
  • --force behavior is unchanged.
  • Updated the usage string and the @subcommand docblock examples so --help shows both forms.

The underlying ability (datamachine-code/workspace-worktree-removeWorkspaceWorktreeLifecycle::worktree_remove($repo, $branch, $force)) already calls slugify_branch() internally, so passing the already-slugified branch half of a handle is safe and idempotent.

Verification

  • php -l inc/Cli/Commands/WorkspaceCommand.php → no syntax errors.
  • Isolated arg-parsing unit test (7 cases, all pass) covering: two-arg form, handle form, multi-@ slug (data-machine@fix@weird → branch fix@weird), two-arg-wins-over-@, and the missing-arg / empty error paths. No real worktrees were removed during testing — only the arg-parsing path was exercised.

Closes #745

`workspace worktree remove` only accepted the two-arg `<repo> <branch>`
form and rejected the `<repo>@<branch-slug>` handle that the rest of the
workspace surface (list/show/path/finalize/cleanup output) prints and
accepts. Copying a handle from `list`/cleanup output and pasting it into
`remove` failed every time.

Accept a single `<repo>@<branch-slug>` handle as the first positional in
addition to the existing two-arg form. When both positionals are present
the two-arg form wins as the disambiguator; a lone first arg containing
`@` is split on the first `@`. The underlying ability already slugifies
the branch, so passing the slug half is safe and idempotent.

Closes #745
@homeboy-ci

homeboy-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Homeboy Results — data-machine-code

Lint

lint — passed

ℹ️ Full options: homeboy docs commands/lint
Deep dive: homeboy lint data-machine-code --changed-since d644e17

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-code-lint-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-code-lint-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine-code/actions/runs/27589160429

Test

test — passed

ℹ️ Auto-fix lint issues: homeboy refactor data-machine-code --from lint --write
ℹ️ Collect coverage: homeboy test data-machine-code --coverage
ℹ️ Save test baseline: homeboy test data-machine-code --baseline
ℹ️ Pass args to test runner: homeboy test -- [args]
ℹ️ Full options: homeboy docs commands/test
Deep dive: homeboy test data-machine-code --changed-since d644e17

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-code-test-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-code-test-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine-code/actions/runs/27589160429

Audit

audit — passed

  • audit — 15 finding(s)
  • Total: 15 finding(s)

Deep dive: homeboy audit data-machine-code --changed-since d644e17

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-code-audit-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-code-audit-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine-code/actions/runs/27589160429
Tooling versions
  • Homeboy CLI: homeboy 0.232.0+8fd2b92d870e+9d2ed8c
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: 082fd96b
  • Action: unknown@unknown

@chubes4 chubes4 merged commit 964b27f into main Jun 16, 2026
5 checks passed
@chubes4 chubes4 deleted the worktree-remove-handle branch June 16, 2026 02:13
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.

workspace worktree remove: accept <repo>@<branch> handle, not just two args

1 participant