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:
@@ -51,6 +51,13 @@ pub struct Session {
|
||||
/// from daemons that predate the field.
|
||||
#[serde(default = "epoch")]
|
||||
pub last_activity_at: DateTime<Utc>,
|
||||
/// The pane's *current* working directory (`#{pane_current_path}`) — distinct
|
||||
/// from [`Session::cwd`], the directory it was spawned in. The activity
|
||||
/// watcher refreshes it as the user `cd`s around; it drives the web UI's
|
||||
/// directory-based session tree. `None` until first observed, and on payloads
|
||||
/// from daemons that predate the field.
|
||||
#[serde(default)]
|
||||
pub current_cwd: Option<PathBuf>,
|
||||
}
|
||||
|
||||
/// Default for [`Session::last_activity_at`] when an older payload omits it.
|
||||
@@ -660,10 +667,7 @@ mod tests {
|
||||
cwd: PathBuf::from("/home/naps62/projects/maestro"),
|
||||
command: "claude".into(),
|
||||
env: HashMap::from([("FOO".into(), "bar".into())]),
|
||||
metadata: HashMap::from([
|
||||
("name".into(), Value::String("maestro-impl".into())),
|
||||
("label".into(), Value::String("personal/maestro".into())),
|
||||
]),
|
||||
metadata: HashMap::from([("name".into(), Value::String("maestro-impl".into()))]),
|
||||
status: SessionStatus::Running,
|
||||
created_at: DateTime::parse_from_rfc3339("2026-05-24T12:00:00Z")
|
||||
.unwrap()
|
||||
@@ -673,6 +677,7 @@ mod tests {
|
||||
last_activity_at: DateTime::parse_from_rfc3339("2026-05-24T12:05:00Z")
|
||||
.unwrap()
|
||||
.with_timezone(&Utc),
|
||||
current_cwd: Some(PathBuf::from("/home/naps62/projects/maestro/crates")),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,6 +697,7 @@ mod tests {
|
||||
assert!(s.foreground.is_none());
|
||||
assert_eq!(s.activity, ActivityState::Idle);
|
||||
assert_eq!(s.last_activity_at, epoch());
|
||||
assert!(s.current_cwd.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user