Skip to content

Add mox recent and rework mox list into a single enriched table#2

Merged
bthall merged 5 commits into
mainfrom
feat/list-recents
Jul 6, 2026
Merged

Add mox recent and rework mox list into a single enriched table#2
bthall merged 5 commits into
mainfrom
feat/list-recents

Conversation

@bthall

@bthall bthall commented Jul 6, 2026

Copy link
Copy Markdown
Owner

mox list

One aligned, ANSI-aware table replacing the fixed-width Configured/Unmanaged sections: origin (mox/tmux), state (+attached), window count, relative last-activity, and a config-derived host summary per session. Degrades cleanly under NO_COLOR and non-TTY.

mox recent (alias: r)

New command showing the sessions you most recently created or attached to, newest first, with each one's current running/gone state. Backed by a small best-effort history file at $XDG_STATE_HOME/mox/recent.json — missing/corrupt/unwritable history never breaks a real operation. This is the only state mox persists; README's honest-defaults bullet updated accordingly.

Plumbing

  • tmux: ListSessionsDetailed() fetches windows/attached/activity in one list-sessions call
  • session: SessionInfo enriched; created/attached events recorded via an injected recorder (no-op in tests — they never touch disk)
  • config: Session.HostSummary() helper

Tests across all four layers; lint-clean under golangci-lint v2.

bthall and others added 5 commits July 6, 2026 15:56
Add a SessionDetail type and a ListSessionsDetailed() method that fetches
window count, attached state, and last-activity time in a single
list-sessions call, plus a pure parseSessionDetails helper. Extends the
Tmux interface and the test fake.
New internal/history package persists a small log of created/attached
sessions to $XDG_STATE_HOME/mox/recent.json (deduped by name, capped,
newest-first). Every operation is best-effort: missing, unwritable, or
corrupt history is treated as empty and never surfaces a blocking error.
List now joins ListSessionsDetailed output with the config so SessionInfo
carries window count, attached state, last activity, and a config-derived
host summary (new Session.HostSummary helper). CreateOrAttach and
CreateAdHoc record created/attached events through an injected recorder
(history.Record in production, a no-op default in tests).
Rewrite mox list as one aligned, ANSI-aware table (origin, state,
attached, window count, relative activity, host summary) with a Recent:
footer, replacing the fixed-width Configured/Unmanaged sections. Add the
mox recent command (alias r, -n/--limit) backed by the history store,
showing each recorded session's current running/gone state. Includes a
shared relative-time helper and column renderer; updates README and
CHANGELOG.
Use slices.Concat instead of cross-slice append in renderList, and
create the state directory 0o700 — it holds session names.
@bthall bthall merged commit fb34c60 into main Jul 6, 2026
5 checks passed
@bthall bthall deleted the feat/list-recents branch July 6, 2026 20:02
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.

1 participant