Skip to content

Add macterm tab move to reorder tabs from the CLI - #233

Merged
thdxg merged 1 commit into
mainfrom
claude/macterm-tab-move-ea977f
Aug 7, 2026
Merged

Add macterm tab move to reorder tabs from the CLI#233
thdxg merged 1 commit into
mainfrom
claude/macterm-tab-move-ea977f

Conversation

@thdxg

@thdxg thdxg commented Aug 7, 2026

Copy link
Copy Markdown
Owner

What

A new macterm tab move <tab> <slot> verb that reorders a tab within its project — tab move tab:4 2 makes tab 4 second. The tab selector takes the usual forms (title, UUID, index, tab:N), and --project scopes it exactly like tab list.

Why

Scripts that clean/organize tabs had no way to change tab order — the one workspace mutation the CLI couldn't reach, with no workaround.

Closes #224

How

  • slot is the tab's final 1-based position in tab list order, in both directions. That's the contract worth reviewing: the existing Workspace.moveTab (which backs sidebar drag-reorder) speaks SwiftUI's pre-removal drop-offset coordinates, where a move toward the end lands one slot before the number you pass. ControlHandler.tabMove converts (slot > fromIndex ? slot : slot - 1) and then delegates to the same AppState.reorderTab the sidebar uses — no new reorder or persistence logic anywhere.
  • Out-of-range slots are a typed bad_request, never a silent clamp — the same up-front rejection pane resize-split applies to its ratio bounds.
  • Wire-wise: a new tab.move command plus an additive optional slot field on ControlArgs, so old and new clients stay compatible per the protocol's additive-field convention.
  • Same-slot moves are an ok no-op; selection keys on the tab's UUID, so the active tab follows the move.

Verified

  • mise run format, mise run lint, and mise run test all pass
  • mise run e2e passes, including a new test_tab_move_places_tab_at_its_final_slot that swaps two live tabs back and forth through the real app and asserts the out-of-range refusal
  • Added or updated tests for new model / persistence / palette / hotkey logic — three new ControlHandlerTests cover both move directions (the toward-end direction is the one that would regress if the coordinate conversion were dropped), the same-slot no-op, and selector/slot validation

Notes for reviewers

Docs updated in the CLI reference table (website/docs/pages/80-cli.md) and AGENTS.md's verb list.

Scripts that organize tabs had no way to change their order. The new
verb speaks final positions — `tab move tab:4 2` makes the tab second
in `tab list` order — because a drop-offset coordinate space (what
Workspace.moveTab takes, where a move toward the end lands one slot
short of the number you pass) is drag-and-drop plumbing no caller
should have to know about. The handler converts and delegates to the
same AppState.reorderTab the sidebar drag uses.

Out-of-range slots are a typed bad_request, never a silent clamp,
matching pane resize-split's up-front ratio validation.
@thdxg thdxg added the enhancement New feature or request label Aug 7, 2026
@github-actions github-actions Bot added area:tests Test changes area:docs Documentation labels Aug 7, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
macterm 898d0d3 Commit Preview URL

Branch Preview URL
Aug 07 2026, 10:04 AM

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Window-state benchmark

State Metric main@1a30a21e8 this branch Δ
focused CPU % 1.30 1.30 +0%
Memory (RSS MB) 109.3 109.5 +0%
CPU ms/s (powermetrics) 12.9 11.8 -9%
Wakeups/s (powermetrics) 142.2 183.0 +29%
workload-focused CPU % 2.80 2.40 -14%
Memory (RSS MB) 165.7 166.5 +0%
CPU ms/s (powermetrics) 26.9 23.6 -12%
Wakeups/s (powermetrics) 253.1 286.3 +13%
workload-unfocused CPU % 2.70 2.40 -11%
Memory (RSS MB) 169.1 169.5 +0%
CPU ms/s (powermetrics) 26.5 23.5 -11%
Wakeups/s (powermetrics) 262.2 285.3 +9%

Reported value is the median of 3×10s windows per state (splitting the window and taking the median keeps one co-scheduled spike from skewing a state); CPU % is the process CPU-time delta over a window. Runs land on different shared runners, so treat small deltas as noise — 🔺/🔻 marks changes ≥25% that also clear the metric's absolute noise floor (CPU % ≥0.5, Memory (RSS MB) ≥25, CPU ms/s ≥5, Wakeups/s ≥50); CPU deltas off a noise-dominated baseline aren't flagged (CPU % baseline ≥1.5, CPU ms/s baseline ≥15). The benchmark:regression / benchmark:improvement label needs corroboration — ≥2 flagged metrics in the same direction, at least one under workload — so a lone noisy cell shows its arrow here without tagging the PR.

@thdxg
thdxg merged commit 5ac902e into main Aug 7, 2026
11 checks passed
@thdxg
thdxg deleted the claude/macterm-tab-move-ea977f branch August 7, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentation area:tests Test changes enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to re-order tabs via the CLI

1 participant