feat(maestro): nest sessions by live working directory, drop labels

Replace the freeform `metadata.label` session grouping with nesting derived
from each session's working directory. The daemon's activity watcher already
polls each tmux pane every tick, so it now also captures
`#{pane_current_path}` and surfaces it as a new `Session.current_cwd`
(serde-default, back-compat); `cwd` stays the spawn dir for worktree
inference, spawn-similar, and recents.

Web catalog builds the tree from `current_cwd ?? cwd`, collapses the home
dir to `~`, and folds single-child folder chains so `~/git/maestro` reads as
one node. CLI swaps its LABEL column for an abbreviated DIR; the spawn forms
(web + TUI) and `--label` flag are removed.

The pane format stays space-delimited (parser splits the first three tokens
and keeps the remainder as the path) so a cwd containing spaces survives.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-21 21:11:23 +00:00
co-authored by Claude Opus 4.8
parent 5602cf5fc8
commit 458c81094b
23 changed files with 280 additions and 167 deletions
+7 -8
View File
@@ -213,25 +213,24 @@ export function renderKit(): HTMLElement {
main.appendChild(el);
}
// --- session rows, nested by project label ---
// --- session rows, nested by working directory ---
{
const { el, body } = section(
"Session rows — nested by host, then project",
"Host is the first level of nesting; the project label nests beneath it, so the daemon no longer rides on each row. “Alive” is a faint row wash; exited rows recede with a badge; the open session is highlighted.",
"Session rows — nested by host, then directory",
"Host is the first level of nesting; the working directory (home collapsed to ~) nests beneath it, and single-child chains fold into one node like ~/git/maestro. “Alive” is a faint row wash; exited rows recede with a badge; the open session is highlighted.",
);
const list = h("div", "kit-tree");
list.append(
folderHeader("thinkpad", 3, 0),
folderHeader("maestro", 3, 1),
folderHeader("~/git/maestro", 3, 1),
folderHeader("web", 2, 2),
leafRow({ name: "redesign", daemon: "", cmd: "claude", status: "running", indent: 3 }),
leafRow({ name: "dev-server", daemon: "", cmd: "vite dev", status: "running", indent: 3, active: true }),
folderHeader("server", 1, 2),
folderHeader("crates/registry", 1, 2),
leafRow({ name: "registry-broker", daemon: "", cmd: "claude", status: "running", indent: 3 }),
folderHeader("tower", 2, 0),
folderHeader("work", 1, 1),
folderHeader("acme", 1, 2),
leafRow({ name: "billing-api", daemon: "", cmd: "claude", status: "running", indent: 3 }),
folderHeader("~/work/acme", 1, 1),
leafRow({ name: "billing-api", daemon: "", cmd: "claude", status: "running", indent: 2 }),
leafRow({ name: "scratch", daemon: "", cmd: "bash", status: "dead", indent: 1 }),
folderHeader("pi", 1, 0),
leafRow({ name: "monitor", daemon: "", cmd: "btop", status: "running", indent: 1 }),