Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,30 @@ and listed with their assets on the

## [Unreleased]

### Added

- **Worktrees show at once, and a stopped stack's lanes too**
([ADR-0078](docs/adr/0078-the-hub-follows-every-stacks-worktrees.md)):
the hub follows every stack's worktrees and tells the dashboard when one
is added, removed or switches branch, so the sidebar shows it without
opening its stack first. A stack that does not run lists its worktrees
as lanes not started; one opens a start card, and *Start here* or *Start
in the pool* brings its daemon up and starts the lane, the main working
tree's services left stopped. A lane the branch picker makes for a
stopped stack opens there.
- **A stack's dot in the sidebar sums up its trees**: folded, it shows the
worst of its trees' dots (a failed start first); unfolded it has none, as
its trees show theirs. The main working tree's and a lane's dot are red
when one of their services fails (as last seen), yellow for trouble on a
lane's node. A stack whose daemon runs
but nothing of it says `idle`, as one without a daemon says `offline`.
- **The sidebar keeps its order**: stacks by name, and a stack's trees
with the main working tree first, then by name; a start or a stop no
longer moves anything.
- **The tab follows you**: opening another stack or lane keeps the tab
shown (Infrastructure, Commands, Usage, Activity), also coming back from
the pool area, instead of going back to Overview.

### Fixed

- **`devstack up --on` moves a started lane**: a lane started on a node
Expand Down Expand Up @@ -77,6 +101,9 @@ since not showing, and dashboard details.
- **A lane not started shows no tabs**: its start options stand in for its
views, so Overview, Infrastructure and the others no longer all led to
the same start page.
- **A tree not started says so first**: a dashed box across the page
above its start options, which no running tree shows; the stack's
offline banner no longer repeats it.
- **The pool's devstack column** no longer shows a stray "–" after a
node's version when no update runs.
- **A GitHub skill set names its commit**: the set showed
Expand Down
2 changes: 1 addition & 1 deletion crates/devstack-daemon/src/lanes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ pub fn worktree_of(repo: &Path, path: &Path) -> Option<PathBuf> {

/// What changes in `<git common dir>/worktrees` when a worktree is added or
/// removed or checks out another branch: its entries and their `HEAD`s.
fn fingerprint(dir: &Path) -> Vec<(std::ffi::OsString, Option<std::time::SystemTime>)> {
pub fn fingerprint(dir: &Path) -> Vec<(std::ffi::OsString, Option<std::time::SystemTime>)> {
let mut out: Vec<_> = std::fs::read_dir(dir)
.into_iter()
.flatten()
Expand Down
2 changes: 1 addition & 1 deletion crates/devstack-hub/src/branches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fn git_with(
}

/// The repository's git directory shared by its worktrees.
fn common_dir(repo: &Path) -> Result<PathBuf, String> {
pub(crate) fn common_dir(repo: &Path) -> Result<PathBuf, String> {
let d = git(repo, &["rev-parse", "--git-common-dir"], LOCAL)?;
Ok(repo.join(d.trim()))
}
Expand Down
12 changes: 11 additions & 1 deletion crates/devstack-hub/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ mod stdio;
mod summary;
pub mod tray;
pub mod upstreams;
mod worktrees;
mod ws;

pub const VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down Expand Up @@ -451,6 +452,8 @@ pub fn serve() -> Result<(), String> {
// The pools, followed over their coordinators' streams (ADR-0073):
// their guest lanes and MCP upstreams (ADR-0069 option B).
poolfeed::start(state.upstreams.clone(), state.skills.clone());
// Every stack's worktrees, its daemon running or not (ADR-0078).
worktrees::start();
tray::start_quietly();
let app = router(state);
if let Some(v6) = v6 {
Expand Down Expand Up @@ -532,10 +535,14 @@ fn router(state: AppState) -> axum::Router {
.route("/hub/stacks/add", post(stack_add))
.route("/hub/stacks/scan", post(stack_scan))
.route("/hub/stacks/{id}/up", post(stack_up))
.route("/hub/stacks/{id}/lanes/start", post(worktrees::start_lane))
.route("/hub/stacks/{id}/down", post(stack_down))
.route("/hub/stacks/{id}", delete(forget))
.route("/hub/stacks/{id}/branches", get(stack_branches))
.route("/hub/stacks/{id}/worktrees", post(worktree_add))
.route(
"/hub/stacks/{id}/worktrees",
get(worktrees::list).post(worktree_add),
)
.route("/hub/stacks/{id}/worktrees/remove", post(worktree_remove))
.route("/hub/stacks/{id}/fetch", post(stack_fetch))
// No route writes a file of a repository (ADR-0071).
Expand Down Expand Up @@ -1506,6 +1513,8 @@ fn hub_events(s: &AppState) -> impl tokio_stream::Stream<Item = serde_json::Valu
.map(|guests| serde_json::json!({ "type": "guests", "guests": guests }));
let pools = tokio_stream::wrappers::WatchStream::new(poolfeed::subscribe())
.map(|pools| serde_json::json!({ "type": "pools", "pools": pools }));
let trees = tokio_stream::wrappers::WatchStream::new(worktrees::subscribe())
.map(|w| serde_json::json!({ "type": "worktrees", "worktrees": w }));
let skills = tokio_stream::wrappers::WatchStream::new(s.skills.subscribe())
.map(|skills| serde_json::json!({ "type": "skills", "skills": skills }));
// A dashboard that fell behind misses a toast, nothing it shows.
Expand All @@ -1518,6 +1527,7 @@ fn hub_events(s: &AppState) -> impl tokio_stream::Stream<Item = serde_json::Valu
.merge(guests)
.merge(pools)
.merge(skills)
.merge(trees)
.merge(notices)
}

Expand Down
Loading
Loading