From b6ebef7636a0d0112ad78ddae31b5585c10f0769 Mon Sep 17 00:00:00 2001 From: Savin Angel-Mario Date: Mon, 16 Nov 2026 22:50:41 +0200 Subject: [PATCH] Move recent sessions to a list at the bottom of the sidebar, attach items from any repository, and notify when a session finishes The sidebar keeps the running sessions in its main list and puts the rest in a RECENT list above the account. The list opens to at most 40% of the window and scrolls. It replaces the OLDER group. attach_github and detach_github take an optional repo (owner/name). Claudiu reads the title and state of such an item from that repository, and a click opens it in a GitHub pane for that repository. That pane hides Ask Claude and Check out locally. A session that finishes or asks a question while the window is in the background sends a system notification (notify-rust) instead of flashing the taskbar button or bouncing the dock icon. Fixes: - An attached pull request opened in a pane that didn't know its repository yet never loaded. The pane now loads it once the repository is known. - Text deleted on the loading screen came back once Claude Code started: the backspaces went through the path that drops input while loading. - A session with no conversation closed itself when Claudiu restarted, because claude --resume found nothing. It now starts over under its own id. --- Cargo.lock | 55 ++++++++++++++++- Cargo.toml | 4 +- README.md | 6 +- src/app/attached_sync.rs | 37 +++++++----- src/app/background.rs | 35 +++++++++-- src/app/github_pane.rs | 40 +++++++++++-- src/app/headless.rs | 118 ++++++++++++++++++++++++++++++++++-- src/app/lifecycle.rs | 2 +- src/app/links.rs | 32 +++++----- src/app/mod.rs | 6 +- src/app/sessions.rs | 24 +++++--- src/claude/mcp.rs | 65 ++++++++++++++------ src/github/cli.rs | 6 ++ src/github/ui/detail.rs | 12 ++-- src/github/ui/popup.rs | 4 +- src/github/view/load.rs | 36 ++++++++--- src/github/view/mod.rs | 6 +- src/panels/inspector.rs | 21 ++++--- src/panels/sidebar.rs | 123 +++++++++++++++++++++----------------- src/platform.rs | 38 +++--------- src/store.rs | 19 +++++- src/terminal/view/mod.rs | 35 ++++++++++- web/src/pages/index.astro | 2 +- 23 files changed, 534 insertions(+), 192 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d1f699f..aec7791 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -617,9 +617,9 @@ dependencies = [ "libc", "lsp-types", "notify", + "notify-rust", "objc2 0.6.5", "objc2-app-kit 0.3.2", - "raw-window-handle", "rune", "rune-kit", "serde", @@ -1899,6 +1899,20 @@ dependencies = [ "serde_repr", ] +[[package]] +name = "mac-notification-sys" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd604973958ddcc11b561193c0fb96ba146506ef2f231ef2e7c35fd2cbc9beca" +dependencies = [ + "cc", + "log", + "objc2 0.6.5", + "objc2-foundation 0.3.2", + "time", + "uuid", +] + [[package]] name = "memchr" version = "2.8.3" @@ -2097,6 +2111,20 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "notify-rust" +version = "4.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57da5b5d3b7809bf71858da5a2818c3404ca4688c02c8abecdda0fcdec235df3" +dependencies = [ + "futures-lite", + "log", + "mac-notification-sys", + "serde", + "tauri-winrt-notification", + "zbus 6.2.1", +] + [[package]] name = "notify-types" version = "2.2.0" @@ -2439,6 +2467,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ "bitflags 2.13.2", + "block2 0.6.2", + "libc", "objc2 0.6.5", "objc2-core-foundation", ] @@ -3862,6 +3892,17 @@ dependencies = [ "smallvec", ] +[[package]] +name = "tauri-winrt-notification" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f37a6c354fd28fc9e322ed9bd47e3959576dad28c9d58ea1cf888cce1c7ccb36" +dependencies = [ + "thiserror 2.0.21", + "windows", + "windows-version", +] + [[package]] name = "tempfile" version = "3.27.0" @@ -5040,6 +5081,15 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-version" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631" +dependencies = [ + "windows-link", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" @@ -5606,6 +5656,9 @@ checksum = "23ef5ed7d628cdf0af82f93dfe03330a8e37383bf7422a1d3d6eb72326680be5" dependencies = [ "futures-core", "futures-io", + "rustix 1.1.5", + "socket2", + "windows-sys 0.61.2", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 2addf8d..1feba7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,8 @@ anyhow = "1.0.104" directories = "6.0.0" dunce = "1.0.5" futures = "0.3.34" +# A system notification when a session finishes while the window is in the background (`platform::notify`). +notify-rust = "4.19.0" # Editor mode's file tree follows its folder on disk. notify = "8.2.0" git2 = { version = "0.21.0", default-features = false } @@ -64,8 +66,6 @@ codegen-units = 4 strip = true [target."cfg(windows)".dependencies] -# The main window's handle, to flash its taskbar button (`platform::request_attention`). -raw-window-handle = "0.6" junction = "2.1.0" windows-sys = { version = "0.61", features = ["Win32_UI_WindowsAndMessaging", "Win32_Foundation", "Win32_Security", "Win32_System_DataExchange", "Win32_System_Memory", "Win32_System_Registry", "Win32_System_Threading"] } diff --git a/README.md b/README.md index 8ab65ec..01ec3f9 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ Claudiu is a native desktop app, written in Rust with [Rune](https://github.com/ ## What it does -Each session is your own `claude` process in a real pseudo-terminal, so Claude Code's keys, mouse and paste work unchanged. Claudiu has no API keys and never calls the Anthropic API. Sign-in stays with Claude Code. The first launch opens a setup window that checks for `claude` (required) and `gh` (optional), links to their install pages and installs nothing. It also has an optional switch that turns off six Claude Code features that add tokens to every request and that coding rarely uses, such as Artifacts and bundled skills. Settings → Claude Code tools shows each switch as high, medium or low savings. Settings has a Check setup button to open it again. A sidebar lists your projects and sessions. Settings → Projects adds, renames, reorders and removes projects. Removing one keeps its sessions, and the notice that follows has an Undo button. Ended sessions resume through `claude --resume`, and sessions that were running come back at the next start. +Each session is your own `claude` process in a real pseudo-terminal, so Claude Code's keys, mouse and paste work unchanged. Claudiu has no API keys and never calls the Anthropic API. Sign-in stays with Claude Code. The first launch opens a setup window that checks for `claude` (required) and `gh` (optional), links to their install pages and installs nothing. It also has an optional switch that turns off six Claude Code features that add tokens to every request and that coding rarely uses, such as Artifacts and bundled skills. Settings → Claude Code tools shows each switch as high, medium or low savings. Settings has a Check setup button to open it again. A sidebar lists your running sessions, with the rest in a Recent list at its bottom that opens and scrolls. Settings → Projects adds, renames, reorders and removes projects. Removing one keeps its sessions, and the notice that follows has an Undo button. Ended sessions resume through `claude --resume`, and sessions that were running come back at the next start. -Around the terminal, Claudiu adds an editor mode (Ctrl+Shift+E) with files, tabs, search, Git change marks and language-server diagnostics, definitions and completion. It also adds usage and context meters, a GitHub pane for issues and pull requests through your `gh` login, defaults for the model, effort and permission mode of new sessions, and extra Claude accounts that share one configuration. When a reply needs a table, chart or diagram, Claude draws it as a card inside the terminal, under the tool call, and the card scrolls with the transcript. Cards can hold buttons that send a message for you, collapsible sections, tabs and charts, and they come back when you reopen a session. A session can move between git worktrees the way it switches branches, so several agents work on separate branches at once: the worktree button in the top bar switches the shown session into another worktree, or into a new one that Claudiu makes on a branch you name, and its conversation continues there (a session that has no conversation yet starts over in the new folder). Claude can switch the session itself with the `switch_worktree` tool, after you approve it and once its turn ends. In the menu, the hover x removes a worktree, the branch button's x deletes a local branch after telling you which commits would be lost, and ending the last session in a worktree offers to remove it. Claudiu keeps the worktrees it makes in its own data folder, outside your repositories, so they never show up in `git status`; Settings has a Worktrees page that lists them to show in the file manager or remove. Settings lists the rest. +Around the terminal, Claudiu adds an editor mode (Ctrl+Shift+E) with files, tabs, search, Git change marks and language-server diagnostics, definitions and completion. It also adds usage and context meters, a GitHub pane for issues and pull requests through your `gh` login (Claude attaches the ones it works on to the right sidebar, from this project or another repository), defaults for the model, effort and permission mode of new sessions, and extra Claude accounts that share one configuration. When a reply needs a table, chart or diagram, Claude draws it as a card inside the terminal, under the tool call, and the card scrolls with the transcript. Cards can hold buttons that send a message for you, collapsible sections, tabs and charts, and they come back when you reopen a session. A session can move between git worktrees the way it switches branches, so several agents work on separate branches at once: the worktree button in the top bar switches the shown session into another worktree, or into a new one that Claudiu makes on a branch you name, and its conversation continues there (a session that has no conversation yet starts over in the new folder). Claude can switch the session itself with the `switch_worktree` tool, after you approve it and once its turn ends. In the menu, the hover x removes a worktree, the branch button's x deletes a local branch after telling you which commits would be lost, and ending the last session in a worktree offers to remove it. Claudiu keeps the worktrees it makes in its own data folder, outside your repositories, so they never show up in `git status`; Settings has a Worktrees page that lists them to show in the file manager or remove. Settings lists the rest. Ctrl+Shift (Cmd+Shift on macOS) plus a letter drives the app. Everything else reaches Claude Code. Editor mode finds `rust-analyzer`, `tsc --lsp` and `gleam` on your PATH and installs nothing. -To reduce background rendering, an inactive window updates streaming terminal output at most four times a second, with a final update when output stops. Returning to the window restores the normal frame rate. Busy sidebar icons stop animating while the window is inactive, the sidebar is hidden, or editor mode hides it. +To reduce background rendering, an inactive window updates streaming terminal output at most four times a second, with a final update when output stops. Returning to the window restores the normal frame rate. Busy sidebar icons stop animating while the window is inactive, the sidebar is hidden, or editor mode hides it. When a session finishes or asks a question while the window is in the background, Claudiu sends a system notification. ## What it touches diff --git a/src/app/attached_sync.rs b/src/app/attached_sync.rs index 2a36a00..e9999a4 100644 --- a/src/app/attached_sync.rs +++ b/src/app/attached_sync.rs @@ -26,8 +26,8 @@ fn retry_wait(failures: u32) -> Duration { RETRY_EVERY.saturating_mul(2u32.saturating_pow(failures)).min(REFRESH_EVERY) } -/// One answer: the session, which item, and what GitHub said. -type Answer = (Id, bool, u32, String, State); +/// One answer: the session, which item (its repository, whether it is a pull request, its number), and what GitHub said. +type Answer = (Id, Option, bool, u32, String, State); impl Sync { fn due(&self, some_unanswered: bool) -> bool { @@ -36,8 +36,8 @@ impl Sync { } } -/// A session, its folder, and the items attached to it (`true` for a pull request) to ask GitHub about. -type Ask = (Id, PathBuf, Vec<(bool, u32)>); +/// A session, its folder, and the items attached to it (repository, `true` for a pull request, number) to ask GitHub about. +type Ask = (Id, PathBuf, Vec<(Option, bool, u32)>); impl Workspace { pub(super) fn sync_attached(&mut self) { @@ -47,7 +47,7 @@ impl Workspace { .sessions .iter() .filter_map(|s| { - let items: Vec<_> = s.claude.as_ref()?.attached.iter().map(|a| (a.pull, a.number)).collect(); + let items: Vec<_> = s.claude.as_ref()?.attached.iter().map(|a| (a.repo.clone(), a.pull, a.number)).collect(); // A session whose folder is gone cannot be asked about (and would never be answered). Checked last: // it asks the disk, from the UI thread, and most sessions have nothing attached. (!items.is_empty() && s.cwd.is_dir()).then(|| (s.id.clone(), s.cwd.clone(), items)) @@ -63,8 +63,8 @@ impl Workspace { move || { ask_github(asks) }, move |ws: &mut Workspace, answers| { ws.attached_sync.running = false; - let changed = answers.into_iter().fold(false, |c, (id, pull, number, title, state)| { - ws.edit_attached(&id, |list| links::set_status(list, pull, number, &title, state)) | c + let changed = answers.into_iter().fold(false, |c, (id, repo, pull, number, title, state)| { + ws.edit_attached(&id, |list| links::set_status(list, repo.as_deref(), pull, number, &title, state)) | c }); ws.attached_sync.failures = if ws.unanswered_items() { ws.attached_sync.failures + 1 } else { 0 }; if changed { @@ -88,14 +88,21 @@ fn ask_github(asks: Vec) -> Vec { let mut repos: HashMap> = HashMap::new(); let mut answers = vec![]; for (id, cwd, items) in asks { - let found = repos.entry(cwd.clone()).or_insert_with(|| { - let gh = Gh::new(exe.clone(), cwd); - gh.repo().ok().map(|repo| (gh, repo)) - }); - let Some((gh, repo)) = found else { continue }; - for (pull, number) in items { - if let Ok((title, state)) = gh.item_status(repo, number) { - answers.push((id.clone(), pull, number, title, state)); + for (named, pull, number) in items { + // An item of another repository needs no GitHub folder; the folder's own repository is looked up once. + let status = match named.as_deref().and_then(RepoRef::on_github) { + Some(repo) => Gh::new(exe.clone(), cwd.clone()).item_status(&repo, number), + None => { + let found = repos.entry(cwd.clone()).or_insert_with(|| { + let gh = Gh::new(exe.clone(), cwd.clone()); + gh.repo().ok().map(|repo| (gh, repo)) + }); + let Some((gh, repo)) = found else { continue }; + gh.item_status(repo, number) + } + }; + if let Ok((title, state)) = status { + answers.push((id.clone(), named, pull, number, title, state)); } } } diff --git a/src/app/background.rs b/src/app/background.rs index ce81b39..0857eed 100644 --- a/src/app/background.rs +++ b/src/app/background.rs @@ -14,6 +14,16 @@ fn next_activity(working: bool, waiting: bool, before: Option, viewing } } +/// What the system notification says when a session stops working while the window is in the background: it +/// finished its turn, or it asks something. Nothing for any other change. +fn notice(before: Option, now: Option, window_active: bool) -> Option<&'static str> { + match (window_active, before, now) { + (false, Some(Activity::Working), Some(Activity::Attention)) => Some("Claude finished."), + (false, Some(Activity::Working), Some(Activity::Waiting)) => Some("Claude is waiting for your answer."), + _ => None, + } +} + impl Workspace { /// Startup reconciliation: scan Claude Code's records off the UI thread, then merge. pub fn start_scan(&mut self) { @@ -58,7 +68,7 @@ impl Workspace { /// Once a second: derive each Claude session's `Activity` from its terminal output. When one stops working /// while the user isn't looking at it, mark it for attention, and if the whole window is in the - /// background as well, flash the taskbar icon / bounce the dock icon. + /// background as well, send a system notification. pub(super) fn start_activity_poll(&mut self) { self.rt.after_quietly(Duration::from_secs(1), |ws: &mut Workspace| { let mut seen = std::mem::take(&mut ws.status_files); @@ -90,7 +100,7 @@ impl Workspace { let window_active = self.window_active; let shown = self.active_id().cloned(); let mut next: HashMap = HashMap::new(); - let mut flash = false; + let mut notices = vec![]; for l in &self.live { let is_claude = self.store.session(&l.id).is_some_and(|r| r.kind == SessionKind::Claude); let view = &l.view; @@ -103,7 +113,9 @@ impl Workspace { let waiting = status.is_some_and(|s| s == "waiting"); let before = self.activity.get(&l.id).copied(); let now = next_activity(working, waiting, before, viewing); - flash |= !window_active && before == Some(Activity::Working) && matches!(now, Some(Activity::Attention | Activity::Waiting)); + if let Some(body) = notice(before, now, window_active) { + notices.push((self.store.session(&l.id).map(|r| r.display_title().to_string()).unwrap_or_default(), body)); + } if let Some(now) = now { next.insert(l.id.clone(), now); } @@ -112,8 +124,8 @@ impl Workspace { self.activity = next; self.rt.dirty = true; } - if flash && let Some(window) = lifecycle::main_window() { - platform::request_attention(&window); + for (title, body) in notices { + platform::notify(title, body); } self.sync_claude_names(); } @@ -262,7 +274,18 @@ fn spin_visible(working: bool, active: bool, sidebar: bool) -> bool { #[cfg(test)] mod tests { - use super::{Activity, next_activity, spin_visible}; + use super::{Activity, next_activity, notice, spin_visible}; + + #[test] + fn a_notification_says_a_background_session_finished_or_asks() { + use Activity::*; + assert_eq!(notice(Some(Working), Some(Attention), false), Some("Claude finished.")); + assert_eq!(notice(Some(Working), Some(Waiting), false), Some("Claude is waiting for your answer.")); + assert_eq!(notice(Some(Working), Some(Attention), true), None, "the window is in front"); + assert_eq!(notice(Some(Attention), Some(Attention), false), None, "already told"); + assert_eq!(notice(Some(Waiting), Some(Working), false), None, "it started working"); + assert_eq!(notice(None, Some(Waiting), false), None, "it never worked meanwhile"); + } #[test] fn spin_only_runs_for_a_visible_busy_sidebar() { diff --git a/src/app/github_pane.rs b/src/app/github_pane.rs index 86e528b..5841107 100644 --- a/src/app/github_pane.rs +++ b/src/app/github_pane.rs @@ -37,6 +37,10 @@ impl Workspace { /// Show the project's GitHub view in the right sidebar and move the keyboard into it. pub fn open_github(&mut self, cwd: PathBuf) { let id = self.github_pane(cwd); + self.show_github(id); + } + + fn show_github(&mut self, id: Id) { self.right_gh = Some(id.clone()); self.store.data.layout.right_hidden = false; self.store.mark_dirty(); @@ -45,10 +49,23 @@ impl Workspace { self.blur = true; } - /// An attached issue or pull request was clicked: show it in the GitHub view of the shown session's project. - pub fn open_attached(&mut self, pull: bool, number: u32) { + /// An attached issue or pull request was clicked: show it in the GitHub view of the shown session's project, or of + /// the repository it names. + pub fn open_attached(&mut self, repo: Option<&str>, pull: bool, number: u32) { let cwd = self.active_cwd(); - self.open_github(cwd); + // Claude may name the project's own repository; its own pane shows that, with every action. + let project_repo = { + let id = self.github_pane(cwd.clone()); + self.gh_pane(&id).and_then(|p| p.view.repo.as_ref()).map(|r| r.full()) + }; + let repo = repo.filter(|full| !project_repo.is_some_and(|own| own.eq_ignore_ascii_case(full))); + match repo { + Some(full) => { + let id = self.named_github_pane(cwd, full); + self.show_github(id); + } + None => self.open_github(cwd), + } let kind = if pull { crate::github::model::Kind::Pull } else { crate::github::model::Kind::Issue }; if let Some(id) = self.right_gh.clone() && let Some(p) = self.gh.iter_mut().find(|p| p.id == id) @@ -74,7 +91,7 @@ impl Workspace { let project = self.store.project_for_cwd(&cwd).and_then(|id| self.store.project(&id)).cloned(); let root = project.as_ref().map(|p| p.path.clone()).unwrap_or(cwd); let key = platform::path_key(&root); - match self.gh.iter().find(|p| platform::path_key(&p.cwd) == key) { + match self.gh.iter().find(|p| p.view.named.is_none() && platform::path_key(&p.cwd) == key) { Some(p) => p.id.clone(), None => { let name = project @@ -83,13 +100,26 @@ impl Workspace { .unwrap_or_else(|| "GitHub".into()); let id = new_id(); let gh = crate::github::cli::locate().map(|exe| crate::github::cli::Gh::new(exe, root.clone())); - let view = GithubView::new(id.clone(), self.rt.mailbox(), root.clone(), name.clone(), gh); + let view = GithubView::new(id.clone(), self.rt.mailbox(), root.clone(), name.clone(), None, gh); self.gh.push(GhPane { id: id.clone(), cwd: root, project: name, view }); id } } } + /// The GitHub view of the repository `full` (`owner/name`), which has no project here, created on first use. + /// `cwd` is only where its `gh` runs. + fn named_github_pane(&mut self, cwd: PathBuf, full: &str) -> Id { + if let Some(p) = self.gh.iter().find(|p| p.view.named.as_deref().is_some_and(|n| n.eq_ignore_ascii_case(full))) { + return p.id.clone(); + } + let id = new_id(); + let gh = crate::github::cli::locate().map(|exe| crate::github::cli::Gh::new(exe, cwd.clone())); + let view = GithubView::new(id.clone(), self.rt.mailbox(), cwd.clone(), full.to_string(), Some(full.to_string()), gh); + self.gh.push(GhPane { id: id.clone(), cwd, project: full.to_string(), view }); + id + } + /// Run what a GitHub pane asked for. pub(crate) fn on_gh_event(&mut self, pane: &str, ev: &GhEvent) { let Some(cwd) = self.gh_pane(pane).map(|p| p.cwd.clone()) else { return }; diff --git a/src/app/headless.rs b/src/app/headless.rs index 61d4f34..a4e3eb0 100644 --- a/src/app/headless.rs +++ b/src/app/headless.rs @@ -466,6 +466,51 @@ fn a_process_that_ends_closes_the_session_and_leaves_its_worktree() { assert!(toast.as_deref().is_some_and(|t| t.starts_with("Could not start Missing:")), "{toast:?}"); } +/// A new session that was open, with no conversation yet, comes back when Claudiu starts again and stays up: +/// `claude --resume` would find nothing and end at once. +#[test] +fn a_new_session_without_a_conversation_comes_back_after_a_restart() { + let mut h = Harness::new(|_| vec![]); + // Like `claude`, the stand-in ends when asked to resume a conversation it doesn't have. + let fake = h.work.join(if cfg!(windows) { "claude-resume.cmd" } else { "claude-resume" }); + let script = if cfg!(windows) { + "@echo off\r\necho %* | find \"--resume\" >nul && exit /b 1\r\necho ready\r\nping -n 60 127.0.0.1 >nul\r\n" + } else { + "#!/bin/sh\ncase \"$*\" in *--resume*) echo 'No conversation found'; exit 1 ;; esac\necho ready\nsleep 60\n" + }; + std::fs::write(&fake, script).unwrap(); + #[cfg(unix)] + std::fs::set_permissions(&fake, std::os::unix::fs::PermissionsExt::from_mode(0o755)).unwrap(); + let id = new_id(); + let record = SessionRecord { + id: id.clone(), + kind: SessionKind::Claude, + title: "New session".into(), + custom_title: None, + auto_title: None, + project_id: None, + cwd: h.work.clone(), + created_at: now(), + last_active: now(), + exit_code: None, + hidden: false, + claude: Some(ClaudeMeta { session_id: new_id(), ..Default::default() }), + }; + std::fs::write(datadir::data_dir().join("running.json"), serde_json::json!([id]).to_string()).unwrap(); + h.step(|ws| { + ws.claude_exe = Some(fake); + ws.store.data.sessions.push(record); + ws.restore_open(); + }); + h.wait("the session to start", |ws| ws.live_view(&id).is_some_and(|v| v.tail_text(200).contains("ready") || !v.is_running())); + let start = Instant::now(); + while start.elapsed() < Duration::from_secs(1) { + h.pump(); + std::thread::sleep(Duration::from_millis(50)); + } + assert!(h.ws().is_running(&id), "the session closed itself after the restart"); +} + /// The worktree dialog and the switch of a session between worktrees. What Claude Code does in the new folder is not /// checked: the stand-in only prints a line. #[test] @@ -780,9 +825,10 @@ fn quitting_asks_first_only_while_a_session_is_working() { assert!(h.ws().modal.is_none()); } -/// Hundreds of sessions: the list scrolls under the wheel and keeps drawing rows where it brings them. +/// Hundreds of recent sessions: the RECENT list at the bottom opens to part of the window, scrolls under the wheel and +/// keeps drawing rows where it brings them; its header closes it. #[test] -fn the_session_list_draws_rows_where_scrolling_brings_them() { +fn the_recent_list_stays_short_and_draws_rows_where_scrolling_brings_them() { let mut h = Harness::new(|_| vec![]); h.step(|ws| { for i in 0..300 { @@ -802,12 +848,15 @@ fn the_session_list_draws_rows_where_scrolling_brings_them() { claude: None, }); } - ws.store.data.layout.older_open = true; }); h.settle(); + let (list, _) = h.rt.presented("recent-scroll").expect("the RECENT list starts open"); + assert!(list[3] <= 900.0 * 0.4 + 1.0, "the open list is {}pt tall, more than its share of the window", list[3]); + let (footer, _) = h.rt.presented("account-switcher").unwrap(); + assert!((0.0..20.0).contains(&(footer[1] - (list[1] + list[3]))), "the list sits at the bottom, above the account: {list:?}, account at {footer:?}"); let row_y = |h: &Harness, n: usize| h.keys().into_iter().find(|k| k.starts_with("row-") && k.ends_with(&format!("s{n:03}"))).and_then(|k| h.rt.find(&k)).map(|p| p.1); let top = row_y(&h, 0).expect("the first row draws"); - let (x, y) = h.rt.find("sidebar-scroll").expect("the list draws"); + let (x, y) = h.rt.find("recent-scroll").expect("the list draws"); h.rt.pointer_move(x, y); h.rt.wheel(x, y, -1200.0); h.settle(); @@ -815,6 +864,9 @@ fn the_session_list_draws_rows_where_scrolling_brings_them() { assert!(moved.is_none_or(|m| m < top - 600.0), "the list did not scroll: the first row went from {top} to {moved:?}"); let shown = (1..300).filter(|n| row_y(&h, *n).is_some_and(|y| (0.0..900.0).contains(&y))).count(); assert!(shown > 10, "only {shown} rows are drawn where the list scrolled to"); + h.click("recent-header"); + h.settle(); + assert!(h.rt.find("recent-scroll").is_none() && h.ws().store.data.layout.recent_closed, "the header closes the list"); } /// Cmd on macOS, Ctrl elsewhere: the modifier of the app's shortcuts. @@ -1734,6 +1786,43 @@ mod github { } } + /// A stand-in for `gh` with no login: `o/r` is the folder's repository, and it has no issues or pull requests. The + /// repository is on an Enterprise host, so a github.com login another test left in `gh`'s token cache never sends + /// its requests past the stand-in. + fn fake_gh(dir: &Path) -> PathBuf { + let repo = r#"{"nameWithOwner":"o/r","url":"https://ghe.invalid/o/r"}"#; + let data = r#"{"data":{"repository":{"id":"R","issueOrPullRequest":null}}}"#; + let fake = dir.join(if cfg!(windows) { "gh.cmd" } else { "gh" }); + let script = if cfg!(windows) { + format!("@echo off\r\nif \"%1\"==\"auth\" exit /b 1\r\nif \"%1\"==\"repo\" goto repo\r\necho {data}\r\nexit /b 0\r\n:repo\r\necho {repo}\r\n") + } else { + format!("#!/bin/sh\ncase \"$1\" in\n auth) exit 1 ;;\n repo) echo '{repo}' ;;\n *) echo '{data}' ;;\nesac\n") + }; + std::fs::write(&fake, script).unwrap(); + #[cfg(unix)] + std::fs::set_permissions(&fake, std::os::unix::fs::PermissionsExt::from_mode(0o755)).unwrap(); + fake + } + + /// A click on an attached pull request opens it in a pane that is still looking its repository up; the item loads + /// once the repository is known. + #[test] + fn an_item_opened_before_the_repository_is_known_still_loads() { + let mut h = Harness::new(|_| vec![]); + let work = h.work.clone(); + let gh = Gh::new(fake_gh(&work), work.clone()); + let pane = new_id(); + let id = pane.clone(); + h.step(move |ws| { + let view = GithubView::new(id.clone(), ws.rt.mailbox(), work.clone(), "p".into(), None, Some(gh)); + ws.gh.push(crate::app::GhPane { id: id.clone(), cwd: work, project: "p".into(), view }); + ws.right_gh = Some(id.clone()); + ws.gh_view_mut(&id).unwrap().open_item(Kind::Pull, 7); + }); + h.wait("the pull request's answer", |ws| ws.gh_pane(&pane).and_then(|p| p.view.detail.as_ref()).is_some_and(|d| !d.loading)); + assert_eq!(h.pane(&pane).detail.as_ref().unwrap().error.as_deref(), Some("This item could not be found.")); + } + #[test] fn opening_a_pull_request_selects_the_pull_requests_tab() { let mut h = Harness::new(|_| vec![]); @@ -1745,6 +1834,27 @@ mod github { } } + /// An attached item of another repository opens in that repository's own pane, not the project's. + #[test] + fn an_item_of_another_repository_opens_in_its_own_pane() { + let mut h = Harness::new(|_| vec![]); + let shown = h.ws().active_cwd(); + let project = h.open_github_pane(&shown); + h.step(|ws| ws.open_attached(Some("octocat/hello-world"), true, 9)); + let other = h.ws().right_gh.clone().unwrap(); + assert_ne!(other, project); + let v = h.pane(&other); + assert_eq!(v.named.as_deref(), Some("octocat/hello-world")); + assert_eq!(v.detail.as_ref().map(|d| (d.kind, d.number)), Some((Kind::Pull, 9))); + h.step(|ws| ws.open_attached(Some("Octocat/Hello-World"), false, 2)); + assert_eq!(h.ws().right_gh.as_ref(), Some(&other), "the same repository reuses its pane"); + h.step(|ws| ws.open_attached(None, false, 3)); + assert_eq!(h.ws().right_gh.as_ref(), Some(&project), "an item of the project opens in the project's pane"); + h.with_pane(&project, |v| v.repo = RepoRef::on_github("o/r")); + h.step(|ws| ws.open_attached(Some("O/R"), false, 4)); + assert_eq!(h.ws().right_gh.as_ref(), Some(&project), "the project's own repository, named, opens in the project's pane"); + } + /// Draws the pane in every state, at two widths, with real GitHub data, to catch panics in `github/ui`. Only /// reads from GitHub. Needs a signed-in `gh`: `cargo test -- --ignored pane_draws_every_state`. #[test] diff --git a/src/app/lifecycle.rs b/src/app/lifecycle.rs index c7f5594..6ed1387 100644 --- a/src/app/lifecycle.rs +++ b/src/app/lifecycle.rs @@ -157,7 +157,7 @@ impl Workspace { let mut back = vec![]; for id in saved { if self.store.session(&id).is_some_and(|s| s.kind == SessionKind::Claude && !s.hidden) { - self.resume(&id); + self.bring_back(&id); back.push(id); } } diff --git a/src/app/links.rs b/src/app/links.rs index 2c9ffe2..cd87467 100644 --- a/src/app/links.rs +++ b/src/app/links.rs @@ -26,9 +26,9 @@ impl Workspace { } /// Take an attached item away from a session. - pub fn detach(&mut self, id: &str, pull: bool, number: u32) { + pub fn detach(&mut self, id: &str, repo: Option<&str>, pull: bool, number: u32) { self.edit_attached(id, |l| { - l.retain(|x| !(x.pull == pull && x.number == number)); + l.retain(|x| !x.is(repo, pull, number)); true }); self.store.mark_dirty(); @@ -46,8 +46,8 @@ impl Workspace { self.unlink(&me, &other); true } - Detach { pull, number } => { - self.detach(&me, pull, number); + Detach { repo, pull, number } => { + self.detach(&me, repo.as_deref(), pull, number); true } } @@ -87,8 +87,8 @@ fn remove_id(list: &mut Vec, id: &str) -> bool { } /// What GitHub says about an attached item. True when the title or state differs from what is kept. -pub(super) fn set_status(list: &mut [Attached], pull: bool, number: u32, title: &str, state: crate::github::model::State) -> bool { - let Some(have) = list.iter_mut().find(|a| a.pull == pull && a.number == number) else { return false }; +pub(super) fn set_status(list: &mut [Attached], repo: Option<&str>, pull: bool, number: u32, title: &str, state: crate::github::model::State) -> bool { + let Some(have) = list.iter_mut().find(|a| a.is(repo, pull, number)) else { return false }; if have.title.as_deref() == Some(title) && have.state == Some(state) { return false; } @@ -102,7 +102,7 @@ const MAX_ATTACHED: usize = 20; /// Add an attached item unless it is there already. True when anything changed. pub(super) fn attach(list: &mut Vec, item: Attached) -> bool { - if list.iter().any(|a| a.pull == item.pull && a.number == item.number) { + if list.iter().any(|a| a.is(item.repo.as_deref(), item.pull, item.number)) { return false; } list.push(item); @@ -125,7 +125,7 @@ mod attach_tests { } fn item(pull: bool, number: u32) -> Attached { - Attached { pull, number, title: None, state: None } + Attached { repo: None, pull, number, title: None, state: None } } #[test] @@ -134,18 +134,22 @@ mod attach_tests { assert!(attach(&mut list, item(false, 5))); assert!(!attach(&mut list, item(false, 5)), "same item again"); assert!(attach(&mut list, item(true, 5)), "a pull request is not the issue with that number"); - assert_eq!(list, [item(false, 5), item(true, 5)]); + let elsewhere = Attached { repo: Some("o/r".into()), ..item(false, 5) }; + assert!(attach(&mut list, elsewhere.clone()), "nor is the issue with that number in another repository"); + assert!(!attach(&mut list, Attached { repo: Some("O/R".into()), ..item(false, 5) }), "repository names ignore case"); + assert_eq!(list, [item(false, 5), item(true, 5), elsewhere]); } #[test] fn github_status_updates_only_what_changed() { use crate::github::model::State; let mut list = vec![item(false, 5)]; - assert!(set_status(&mut list, false, 5, "Fix it", State::Open)); - assert!(!set_status(&mut list, false, 5, "Fix it", State::Open), "same answer again"); - assert!(set_status(&mut list, false, 5, "Fix it properly", State::Open), "renamed on GitHub"); - assert!(set_status(&mut list, false, 5, "Fix it properly", State::Closed), "closed on GitHub"); - assert!(!set_status(&mut list, true, 5, "Other", State::Open), "no such pull request attached"); + assert!(set_status(&mut list, None, false, 5, "Fix it", State::Open)); + assert!(!set_status(&mut list, None, false, 5, "Fix it", State::Open), "same answer again"); + assert!(set_status(&mut list, None, false, 5, "Fix it properly", State::Open), "renamed on GitHub"); + assert!(set_status(&mut list, None, false, 5, "Fix it properly", State::Closed), "closed on GitHub"); + assert!(!set_status(&mut list, None, true, 5, "Other", State::Open), "no such pull request attached"); + assert!(!set_status(&mut list, Some("o/r"), false, 5, "Other", State::Open), "no such issue in that repository"); assert_eq!(list[0].title.as_deref(), Some("Fix it properly")); assert_eq!(list[0].state, Some(State::Closed)); } diff --git a/src/app/mod.rs b/src/app/mod.rs index 35d331c..524792a 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -178,7 +178,7 @@ pub enum Act { CancelProjectRename, /// Move a project one place up (true) or down the list. MoveProject(Id, bool), - ToggleOlder, + ToggleRecent, ConfirmQuit, ConfirmInstallUpdate, Dismiss, @@ -876,9 +876,9 @@ impl Workspace { self.store.data.layout.project_filter = id; self.store.mark_dirty(); } - Act::ToggleOlder => { + Act::ToggleRecent => { let l = &mut self.store.data.layout; - l.older_open = !l.older_open; + l.recent_closed = !l.recent_closed; self.store.mark_dirty(); } Act::ConfirmQuit => { diff --git a/src/app/sessions.rs b/src/app/sessions.rs index f4a1691..10712eb 100644 --- a/src/app/sessions.rs +++ b/src/app/sessions.rs @@ -319,13 +319,7 @@ impl Workspace { let Some(meta) = rec.claude.as_ref() else { return; }; - if meta.external != ExternalState::Unknown || meta.transcript.is_some() { - return; - } - let has_transcript = claude::claude_home() - .and_then(|h| claude::find_transcript(&h, &meta.session_id)) - .is_some(); - if !has_transcript { + if !has_conversation(meta) { self.store.data.sessions.retain(|s| s.id != id); if self.selected.as_deref() == Some(id) { self.selected = None; @@ -334,6 +328,14 @@ impl Workspace { } } + /// Bring a Claude session back after a restart: resume its conversation, or start it over when it has none yet. + pub(super) fn bring_back(&mut self, id: &str) { + match self.store.session(id).and_then(|s| s.claude.as_ref()) { + Some(meta) if !has_conversation(meta) => self.relaunch_empty(id), + _ => self.resume(id), + } + } + pub(super) fn remember(&mut self, id: &Id) { self.recent.retain(|r| r != id); self.recent.push(id.clone()); @@ -480,6 +482,14 @@ impl Workspace { } } +/// Whether Claude Code has a conversation for the session: one it listed on a scan, or a transcript on disk. A +/// session nobody has written to has none, and `claude --resume` ends at once on it. +fn has_conversation(meta: &ClaudeMeta) -> bool { + meta.external != ExternalState::Unknown + || meta.transcript.is_some() + || claude::claude_home().and_then(|h| claude::find_transcript(&h, &meta.session_id)).is_some() +} + #[cfg(test)] mod tests { use super::numbered; diff --git a/src/claude/mcp.rs b/src/claude/mcp.rs index a12c663..0073892 100644 --- a/src/claude/mcp.rs +++ b/src/claude/mcp.rs @@ -268,12 +268,13 @@ fn own_tools(off: &[&str]) -> Vec { }); let attach = json!({ "name": "attach_github", - "description": "Show a GitHub issue or pull request of this session's project in Claudiu's sidebar. Call it once per item, before your next command, whenever you read, open, comment on, create or push to one, or the user names or asks to see one. Not for every result of a list or search. It changes nothing on GitHub.", + "description": "Show a GitHub issue or pull request in Claudiu's sidebar: of this session's project, or of another repository named in `repo`. Call it once per item, before your next command, whenever you read, open, comment on, create or push to one, or the user names or asks to see one. Not for every result of a list or search. It changes nothing on GitHub.", "inputSchema": { "type": "object", "properties": { "kind": { "type": "string", "enum": ["issue", "pull"], "description": "issue or pull (a pull request)" }, "number": { "type": "integer", "description": "The issue or pull request number" }, + "repo": { "type": "string", "description": "owner/name, only when the item is in another repository than this session's project" }, }, "required": ["kind", "number"], }, @@ -286,6 +287,7 @@ fn own_tools(off: &[&str]) -> Vec { "properties": { "kind": { "type": "string", "enum": ["issue", "pull"], "description": "issue or pull (a pull request)" }, "number": { "type": "integer", "description": "The issue or pull request number" }, + "repo": { "type": "string", "description": "owner/name, only when the item is in another repository than this session's project" }, }, "required": ["kind", "number"], }, @@ -402,18 +404,18 @@ fn set_title(params: &Value, session: &str, dir: &Path) -> Value { /// Keyed by Claudiu's own record id, which (unlike Claude's session id) survives `/clear`. fn attach_github(params: &Value, record: &str, dir: &Path) -> Value { let args = ¶ms["arguments"]; - let (pull, number) = match github_item(args, record) { + let (repo, pull, number) = match github_item(args, record) { Ok(item) => item, Err(e) => return e, }; - match write_line(dir, record, &json!({ "pull": pull, "number": number })) { - Ok(()) => reply(&format!("{} #{number} attached.", if pull { "Pull request" } else { "Issue" }), false), + match write_line(dir, record, &json!({ "repo": repo, "pull": pull, "number": number })) { + Ok(()) => reply(&format!("{} {}#{number} attached.", if pull { "Pull request" } else { "Issue" }, repo.unwrap_or_default()), false), Err(e) => reply(&format!("could not attach: {e}"), true), } } -/// The kind and number of an issue or pull request named in a tool call. -fn github_item(args: &Value, record: &str) -> Result<(bool, u32), Value> { +/// The repository (`None`: the session's project), kind and number of an issue or pull request named in a tool call. +fn github_item(args: &Value, record: &str) -> Result<(Option, bool, u32), Value> { let pull = match args["kind"].as_str() { Some("issue") => false, Some("pull") => true, @@ -422,20 +424,37 @@ fn github_item(args: &Value, record: &str) -> Result<(bool, u32), Value> { let Some(number) = args["number"].as_u64().and_then(|n| u32::try_from(n).ok()).filter(|&n| n > 0) else { return Err(reply("number must be a positive integer", true)); }; + // Left out, null or empty all mean the session's project. + let repo = match &args["repo"] { + Value::Null => None, + Value::String(r) if r.trim().is_empty() => None, + v => match v.as_str().map(str::trim).filter(|r| is_repo_name(r)) { + Some(r) => Some(r.to_string()), + None => return Err(reply("repo must be owner/name, like octocat/hello-world", true)), + }, + }; if record.is_empty() { return Err(reply("not running inside Claudiu", true)); } - Ok((pull, number)) + Ok((repo, pull, number)) +} + +/// `owner/name` as GitHub allows them. It ends up in API paths and cache file names, so nothing else gets through. +fn is_repo_name(s: &str) -> bool { + let Some((owner, name)) = s.split_once('/') else { return false }; + let owner_ok = (1..=39).contains(&owner.len()) && owner.chars().all(|c| c.is_ascii_alphanumeric() || c == '-'); + let name_ok = (1..=100).contains(&name.len()) && name != "." && name != ".." && name.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '-' | '_' | '.')); + owner_ok && name_ok } /// Take an issue or pull request off the session again. fn detach_github(params: &Value, record: &str, dir: &Path) -> Value { - let (pull, number) = match github_item(¶ms["arguments"], record) { + let (repo, pull, number) = match github_item(¶ms["arguments"], record) { Ok(item) => item, Err(e) => return e, }; - match write_line(dir, record, &json!({ "detach": { "pull": pull, "number": number } })) { - Ok(()) => reply(&format!("{} #{number} detached.", if pull { "Pull request" } else { "Issue" }), false), + match write_line(dir, record, &json!({ "detach": { "repo": repo, "pull": pull, "number": number } })) { + Ok(()) => reply(&format!("{} {}#{number} detached.", if pull { "Pull request" } else { "Issue" }, repo.unwrap_or_default()), false), Err(e) => reply(&format!("could not detach: {e}"), true), } } @@ -526,7 +545,7 @@ pub enum Attachment { Link(String), Unlink(String), /// Take an issue or pull request off again. - Detach { pull: bool, number: u32 }, + Detach { repo: Option, pull: bool, number: u32 }, } /// `(record id stem, item)` for everything attached since the last call. @@ -562,7 +581,8 @@ fn parse_attachment(line: &str) -> Option { return Some(Attachment::Unlink(id.to_string())); } if let Some(d) = v.get("detach") { - return Some(Attachment::Detach { pull: d.get("pull")?.as_bool()?, number: u32::try_from(d.get("number")?.as_u64()?).ok()? }); + let repo = d.get("repo").and_then(Value::as_str).map(str::to_string); + return Some(Attachment::Detach { repo, pull: d.get("pull")?.as_bool()?, number: u32::try_from(d.get("number")?.as_u64()?).ok()? }); } serde_json::from_value(v).ok().map(Attachment::Github) } @@ -698,16 +718,24 @@ mod tests { call(json!({"kind":"commit","number":1})), call(json!({"kind":"issue","number":0})), call(json!({"kind":"issue","number":-3})), + call(json!({"kind":"pull","number":9,"repo":" octo-cat/hello.world "})), + call(json!({"kind":"pull","number":9,"repo":"../../etc"})), + call(json!({"kind":"pull","number":9,"repo":"octocat"})), + call(json!({"kind":"pull","number":9,"repo":"a/b/c"})), + call(json!({"kind":"pull","number":9,"repo":"octocat/.."})), + call(json!({"kind":"issue","number":11,"repo":" "})), ], "s1", tmp.path(), ); let errors: Vec<_> = r.iter().map(|x| x["result"]["isError"].as_bool().unwrap()).collect(); - assert_eq!(errors, [false, false, true, true, true]); + assert_eq!(errors, [false, false, true, true, true, false, true, true, true, true, false]); let items: Vec = read_attached_in(&tmp.path().join("attach")).into_iter().map(|(_, a)| a).collect(); - assert_eq!(items.len(), 2); - assert!(items.contains(&Attachment::Github(Attached { pull: false, number: 52, title: None, state: None }))); - assert!(items.contains(&Attachment::Github(Attached { pull: true, number: 7, title: None, state: None }))); + assert_eq!(items.len(), 4); + assert!(items.contains(&Attachment::Github(Attached { repo: None, pull: false, number: 11, title: None, state: None })), "an empty repo is the project's"); + assert!(items.contains(&Attachment::Github(Attached { repo: Some("octo-cat/hello.world".into()), pull: true, number: 9, title: None, state: None }))); + assert!(items.contains(&Attachment::Github(Attached { repo: None, pull: false, number: 52, title: None, state: None }))); + assert!(items.contains(&Attachment::Github(Attached { repo: None, pull: true, number: 7, title: None, state: None }))); assert_eq!(talk(&[call(json!({"kind":"issue","number":1}))], "", tmp.path())[0]["result"]["isError"], true); assert!(allowed_tools(&[]).contains(&"mcp__claudiu__attach_github".to_string())); } @@ -750,9 +778,10 @@ mod tests { let errors: Vec<_> = r.iter().map(|x| x["result"]["isError"].as_bool().unwrap()).collect(); assert_eq!(errors, [false, true, true, true, true], "bad ids and a link to itself are refused"); assert_eq!(read_attached_in(&tmp.path().join("attach")), [("s1".to_string(), Attachment::Link("abc-123".into()))]); - assert_eq!(parse_attachment(r#"{"pull":true,"number":7,"title":null}"#), Some(Attachment::Github(Attached { pull: true, number: 7, title: None, state: None }))); + assert_eq!(parse_attachment(r#"{"pull":true,"number":7,"title":null}"#), Some(Attachment::Github(Attached { repo: None, pull: true, number: 7, title: None, state: None }))); assert_eq!(parse_attachment(r#"{"unlink":"x"}"#), Some(Attachment::Unlink("x".into()))); - assert_eq!(parse_attachment(r#"{"detach":{"pull":false,"number":3}}"#), Some(Attachment::Detach { pull: false, number: 3 })); + assert_eq!(parse_attachment(r#"{"detach":{"pull":false,"number":3}}"#), Some(Attachment::Detach { repo: None, pull: false, number: 3 })); + assert_eq!(parse_attachment(r#"{"detach":{"repo":"o/r","pull":true,"number":3}}"#), Some(Attachment::Detach { repo: Some("o/r".into()), pull: true, number: 3 })); assert_eq!(parse_attachment(r#"{"detach":{"number":3}}"#), None); assert_eq!(parse_attachment("nonsense"), None); } diff --git a/src/github/cli.rs b/src/github/cli.rs index ccccf60..e49c0eb 100644 --- a/src/github/cli.rs +++ b/src/github/cli.rs @@ -92,6 +92,12 @@ pub struct RepoRef { } impl RepoRef { + /// A repository on github.com named `owner/name`. + pub fn on_github(full: &str) -> Option { + let (owner, name) = full.split_once('/')?; + Some(Self { owner: owner.into(), name: name.into(), url: format!("https://github.com/{full}"), host: None }) + } + pub fn full(&self) -> String { format!("{}/{}", self.owner, self.name) } diff --git a/src/github/ui/detail.rs b/src/github/ui/detail.rs index 2293b09..48b52c6 100644 --- a/src/github/ui/detail.rs +++ b/src/github/ui/detail.rs @@ -65,12 +65,12 @@ impl GithubView { let url = it.url.clone(); let ask = button_leading(&icons::SPARKLES, "Ask Claude", true).child(icon(&icons::CHEVRON_DOWN, 12.0, 0x17100d)); - let mut actions = row() - .w_full() - .flex_wrap() - .center_y() - .gap(6.0) - .child(popup_trigger(ask, &self.id, "gh-claude".into(), PopKind::Claude)) + let mut actions = row().w_full().flex_wrap().center_y().gap(6.0); + // Claude would work in the folder, which is not a clone of a repository named from elsewhere. + if self.named.is_none() { + actions = actions.child(popup_trigger(ask, &self.id, "gh-claude".into(), PopKind::Claude)); + } + actions = actions .child(button_leading(&icons::EXTERNAL_LINK, "Open on GitHub", false).key("gh-open-web").on_press_tx(go(&self.id, GhAct::OpenWeb(url)))) .child(popup_trigger(icon_button(&icons::ELLIPSIS), &self.id, "gh-more-menu".into(), PopKind::More)); if ds.loading { diff --git a/src/github/ui/popup.rs b/src/github/ui/popup.rs index d1a05c7..d391a66 100644 --- a/src/github/ui/popup.rs +++ b/src/github/ui/popup.rs @@ -170,7 +170,9 @@ impl GithubView { out.push(item("Copy link", GhAct::Copy(it.url.clone()))); out.push(item(format!("Copy #{}", it.number), GhAct::Copy(format!("#{}", it.number)))); if it.kind == Kind::Pull { - out.push(item("Check out locally", GhAct::Checkout)); + if self.named.is_none() { + out.push(item("Check out locally", GhAct::Checkout)); + } if it.state == State::Open && (d.mine || self.info.as_ref().is_some_and(|i| i.can_write())) { out.push(if it.draft { item("Ready for review", GhAct::Ready) } else { item("Convert to draft", GhAct::ToDraft) }); } diff --git a/src/github/view/load.rs b/src/github/view/load.rs index bbd49ee..d932235 100644 --- a/src/github/view/load.rs +++ b/src/github/view/load.rs @@ -4,7 +4,15 @@ use super::*; impl GithubView { pub(super) fn cache_file(&self) -> PathBuf { - crate::datadir::data_dir().join("github-cache").join(format!("{}.json", crate::datadir::safe_file_stem(&self.cwd.to_string_lossy()))) + crate::datadir::data_dir().join("github-cache").join(format!("{}.json", self.cache_stem())) + } + + /// What the cache files are named after: the folder, or the named repository (kept apart from the folder's own). + fn cache_stem(&self) -> String { + match &self.named { + Some(full) => crate::datadir::safe_file_stem(&format!("repo-{full}")), + None => crate::datadir::safe_file_stem(&self.cwd.to_string_lossy()), + } } /// Fill the lists from the last run so the pane is populated before `gh` answers; only the default query is cached. @@ -27,7 +35,7 @@ impl GithubView { /// file (`safe_file_stem` never produces a dot). pub(super) fn detail_file(&self, number: u32) -> PathBuf { let dir = crate::datadir::data_dir().join("github-cache"); - dir.join(format!("{}.{number}.json", crate::datadir::safe_file_stem(&self.cwd.to_string_lossy()))) + dir.join(format!("{}.{number}.json", self.cache_stem())) } /// Write the first page of each list after a fresh load (skipped while a search is active). Written off the UI thread. @@ -75,14 +83,17 @@ impl GithubView { let cached = self.repo.clone(); if cached.is_some() { self.phase = Phase::Ready; - self.load_list(Kind::Issue, false); - self.load_list(Kind::Pull, false); + self.load_shown(); } else { self.phase = Phase::Loading; } + let named = self.named.clone(); self.spawn( - |gh, _| -> Result<(RepoRef, RepoInfo, Gh), cli::Error> { - let repo = gh.repo()?; + move |gh, _| -> Result<(RepoRef, RepoInfo, Gh), cli::Error> { + let repo = match named.as_deref().and_then(RepoRef::on_github) { + Some(repo) => repo, + None => gh.repo()?, + }; let mut gh = gh; gh.host = repo.host.clone(); let data = gh.graphql(cli::REPO_QUERY, json!({"owner": repo.owner, "name": repo.name}))?; @@ -97,8 +108,7 @@ impl GithubView { v.info = Some(info); v.phase = Phase::Ready; if cached.as_ref() != v.repo.as_ref() { - v.load_list(Kind::Issue, false); - v.load_list(Kind::Pull, false); + v.load_shown(); } } Err(e) => { @@ -114,6 +124,16 @@ impl GithubView { ); } + /// Load both lists, and the item opened before the repository was known (a click on an attached item opens it + /// in a pane that is still looking its repository up). + fn load_shown(&mut self) { + self.load_list(Kind::Issue, false); + self.load_list(Kind::Pull, false); + if self.detail.is_some() { + self.fetch_detail(None); + } + } + /// Reload what is on screen every 90 seconds so the pane follows what teammates do. Skipped while busy or editing. pub(super) fn start_refresh_loop(&mut self) { let (id, mailbox) = (self.id.clone(), self.mailbox.clone()); diff --git a/src/github/view/mod.rs b/src/github/view/mod.rs index ad99952..e7d4348 100644 --- a/src/github/view/mod.rs +++ b/src/github/view/mod.rs @@ -217,6 +217,9 @@ pub struct GithubView { mailbox: Mailbox, pub cwd: PathBuf, pub project: String, + /// `owner/name` when the pane shows a repository other than the folder's (an item attached from there); it has + /// no local clone then, so nothing in it runs in the folder. + pub named: Option, gh: Option, pub phase: Phase, pub repo: Option, @@ -274,12 +277,13 @@ fn is_web(url: &str) -> bool { } impl GithubView { - pub fn new(id: String, mailbox: Mailbox, cwd: PathBuf, project: String, gh: Option) -> Self { + pub fn new(id: String, mailbox: Mailbox, cwd: PathBuf, project: String, named: Option, gh: Option) -> Self { let mut view = Self { id, mailbox, cwd, project, + named, phase: if gh.is_some() { Phase::Loading } else { Phase::NoCli }, gh, repo: None, diff --git a/src/panels/inspector.rs b/src/panels/inspector.rs index ec58672..118b0e2 100644 --- a/src/panels/inspector.rs +++ b/src/panels/inspector.rs @@ -228,21 +228,24 @@ impl Workspace { for a in attached { let (pull, number) = (a.pull, a.number); let owner = id.cloned(); - let key = format!("attached-{pull}-{number}"); + let key = format!("attached-{}-{pull}-{number}", a.repo.as_deref().unwrap_or_default()); + // An item of another repository says which one. + let name = format!("{}#{number}", a.repo.as_deref().unwrap_or_default()); let title = match (a.title, a.state) { - (None, _) => pending_title(number), - (Some(t), Some(State::Closed)) => label(format!("#{number} {t} (closed)"), 12.5, theme::TEXT_DIM).truncate().shrink(), - (Some(t), Some(State::Merged)) => label(format!("#{number} {t} (merged)"), 12.5, theme::TEXT_DIM).truncate().shrink(), - (Some(t), _) => label(format!("#{number} {t}"), 12.5, theme::TEXT).truncate().shrink(), + (None, _) => pending_title(&name), + (Some(t), Some(State::Closed)) => label(format!("{name} {t} (closed)"), 12.5, theme::TEXT_DIM).truncate().shrink(), + (Some(t), Some(State::Merged)) => label(format!("{name} {t} (merged)"), 12.5, theme::TEXT_DIM).truncate().shrink(), + (Some(t), _) => label(format!("{name} {t}"), 12.5, theme::TEXT).truncate().shrink(), }; + let (open_repo, detach_repo) = (a.repo.clone(), a.repo); rows = rows.child(removable_row( key, if pull { &icons::GIT_PULL_REQUEST } else { &icons::CIRCLE_DOT }, title, - move |ws| ws.open_attached(pull, number), + move |ws| ws.open_attached(open_repo.as_deref(), pull, number), move |ws| { if let Some(id) = &owner { - ws.detach(id, pull, number); + ws.detach(id, detach_repo.as_deref(), pull, number); } }, )); @@ -393,8 +396,8 @@ fn group(title: &str, body: El) -> El { } /// `#12` with a grey bar where the title will be, until GitHub answers. -fn pending_title(number: u32) -> El { - hbox().center_y().gap(8.0).child(label(format!("#{number}"), 12.5, theme::TEXT)).child(el().h(8.0).w(96.0).radius(4.0).fill(rgb(0x1f1f21))) +fn pending_title(name: &str) -> El { + hbox().center_y().gap(8.0).child(label(name.to_string(), 12.5, theme::TEXT)).child(el().h(8.0).w(96.0).radius(4.0).fill(rgb(0x1f1f21))) } fn base_row(key: &str, glyph: &'static rune::Icon, title: impl Into, color: u32) -> El { diff --git a/src/panels/sidebar.rs b/src/panels/sidebar.rs index c4ebd89..f19c112 100644 --- a/src/panels/sidebar.rs +++ b/src/panels/sidebar.rs @@ -1,5 +1,5 @@ -//! Left sidebar: one list of Claude Code sessions (running first, then recent, then older), a project filter, and -//! the account usage meters. +//! Left sidebar: the running Claude Code sessions, a project filter, the recent ones in a list that opens at the +//! bottom, and the account usage meters. use rune::tok::motion; use rune::{Color, Cursor, El, Phase, PointerButton, ScrollSpec, Transition, Tx, col, el, row, text, text_input}; @@ -14,15 +14,14 @@ use crate::store::{ExternalState, Id, Project, SessionKind, SessionRecord, now}; pub const SIDEBAR_W: f32 = 284.0; pub const SIDEBAR_MIN: f32 = 220.0; pub const SIDEBAR_MAX: f32 = 520.0; -/// Entries shown under RECENT before the rest go behind OLDER. -const RECENT_LIMIT: usize = 12; +/// The open RECENT list takes at most this share of the window's height, and scrolls. +const RECENT_SHARE: f32 = 0.4; /// Heights of the list's rows. A running session's row has three lines: project, title and branch. const ROW_H: f32 = 25.0; const RUNNING_ROW_H: f32 = 60.0; const HEADER_H: f32 = 20.0; const NOTE_H: f32 = 24.0; -const SPACER_H: f32 = 10.0; const LIST_GAP: f32 = 2.0; /// Height of a running session's row plus the gap between rows: how far a dragged row moves to pass one. const ROW_PITCH: f32 = RUNNING_ROW_H + LIST_GAP; @@ -74,19 +73,16 @@ enum Item { Header(&'static str, Option), /// A line of text standing in for rows that aren't there. Note(&'static str), - Spacer, /// A session; `reorder` lets it be dragged among the others (the running ones). Session { row: Row, reorder: bool }, - Older { count: usize, open: bool }, } impl Item { #[cfg(test)] fn height(&self) -> f32 { match self { - Item::Header(..) | Item::Older { .. } => HEADER_H, + Item::Header(..) => HEADER_H, Item::Note(_) => NOTE_H, - Item::Spacer => SPACER_H, Item::Session { row, .. } if row.running => RUNNING_ROW_H, Item::Session { .. } => ROW_H, } @@ -211,15 +207,10 @@ impl Workspace { self.store.data.layout.project_filter.as_ref().and_then(|id| self.store.project(id)) } - /// One list of Claude Code sessions: what is running first (in the order you arranged them), then the most - /// recent, with the rest behind "Older". The project filter narrows all of it. Rows behind a closed "Older" are - /// counted, not built. + /// The running Claude Code sessions, in the order you arranged them, narrowed by the search and project filter. fn list_items(&self) -> Vec { let q = self.search.text.trim().to_lowercase(); - let searching = !q.is_empty(); let filter = self.project_filter().map(|p| p.id.clone()); - - // ---- RUNNING let numbered = self.running_ids(); let running: Vec = numbered .iter() @@ -236,42 +227,74 @@ impl Workspace { row }) .collect(); + let mut items = vec![Item::Header("RUNNING", Some(running.len().to_string()))]; + if running.is_empty() { + items.push(Item::Note(if !q.is_empty() || filter.is_some() { "Nothing running matches" } else { "Nothing running. Start a session." })); + } + items.extend(running.into_iter().map(|row| Item::Session { row, reorder: true })); + items + } - // ---- RECENT: everything else, newest first + /// The Claude Code sessions that aren't running, newest first, narrowed like the running ones. Archived ones only + /// show up in a search. + fn recent_rows(&self) -> Vec { + let q = self.search.text.trim().to_lowercase(); + let filter = self.project_filter().map(|p| p.id.clone()); + let running = self.running_ids(); let mut recent: Vec<&SessionRecord> = self .store .data .sessions .iter() - .filter(|s| s.kind == SessionKind::Claude && (searching || !s.hidden) && !numbered.contains(&s.id) && self.listed(&q, filter.as_ref(), s)) + .filter(|s| s.kind == SessionKind::Claude && (!q.is_empty() || !s.hidden) && !running.contains(&s.id) && self.listed(&q, filter.as_ref(), s)) .collect(); recent.sort_by_key(|r| std::cmp::Reverse(r.last_active)); - let older = recent.split_off(recent.len().min(if searching { usize::MAX } else { RECENT_LIMIT })); - let history = |rec: &SessionRecord| { - let mut row = self.row_for(rec, false); - row.scope = "rec"; - Item::Session { row, reorder: false } - }; + recent + .into_iter() + .map(|rec| { + let mut row = self.row_for(rec, false); + row.scope = "rec"; + row + }) + .collect() + } - let mut items = vec![Item::Header("RUNNING", Some(running.len().to_string()))]; - if running.is_empty() { - items.push(Item::Note(if searching || filter.is_some() { "Nothing running matches" } else { "Nothing running. Start a session." })); + /// RECENT at the bottom of the sidebar: a header that opens a list of the sessions that aren't running. The list + /// takes at most `RECENT_SHARE` of the window and scrolls. A search opens it, so what matches shows. Hidden when + /// there are no such sessions and nothing is searched. + fn recent_section(&self, spin: bool) -> Option { + let rows = self.recent_rows(); + let searching = !self.search.text.trim().is_empty(); + if rows.is_empty() && !searching && self.project_filter().is_none() { + return None; } - items.extend(running.into_iter().map(|row| Item::Session { row, reorder: true })); - if !recent.is_empty() || !older.is_empty() { - items.extend([Item::Spacer, Item::Header("RECENT", None)]); - items.extend(recent.into_iter().map(history)); - } else if searching || filter.is_some() { - items.push(Item::Note("No sessions match")); - } - if !older.is_empty() { - let open = self.store.data.layout.older_open; - items.push(Item::Older { count: older.len(), open }); - if open { - items.extend(older.into_iter().map(history)); + let open = searching || !self.store.data.layout.recent_closed; + let header = row() + .key("recent-header") + .h(HEADER_H + 8.0) + .center_y() + .gap(5.0) + .px(14.0) + .cursor(Cursor::Pointer) + .role("button") + .hover(Color::WHITE.alpha(0.035)) + .on_press_tx(|ws: &mut Workspace, tx: &mut Tx| act(ws, Act::ToggleRecent, tx)) + .child(icon(&icons::CHEVRON_RIGHT, 12.0, theme::TEXT_FAINT).rotate(if open { 90.0 } else { 0.0 }).motion(motion::SNAP)) + .child(section_label("RECENT")) + .child(label(rows.len().to_string(), 10.5, theme::TEXT_FAINT)); + let mut section = col().key("recent-section").w_full().border_sides([1.0, 0.0, 0.0, 0.0], rgb(theme::BORDER)).child(header); + if open { + let mut list = col().key("recent-list").w_full().gap(LIST_GAP).pb(6.0); + if rows.is_empty() { + list = list.child(self.list_item(Item::Note("No sessions match"), spin)); } + for r in rows { + list = list.child(self.session_row(r, false, spin)); + } + let max = (self.window_size.1 * RECENT_SHARE).max(ROW_H * 4.0); + section = section.child(col().key("recent-scroll").w_full().max_h(max).scroll(ScrollSpec { stick_bottom: false }).child(list)); } - items + Some(section) } /// The running rows shown, in order: what a dragged row moves among. @@ -312,7 +335,7 @@ impl Workspace { list = list.child(self.list_item(item, spin)); } let scroll = col().key("sidebar-scroll").w_full().grow(1.0).shrink().min_h(0.0).scroll(ScrollSpec { stick_bottom: false }).child(list); - let panel = col() + let mut panel = col() .key("sidebar-panel") .w(width) .h_full() @@ -321,8 +344,11 @@ impl Workspace { .border(1.0, rgb(theme::PANEL_BORDER)) .fill(rgb(theme::SIDEBAR_BG)) .child(self.sidebar_header()) - .child(scroll) - .child(self.sidebar_footer()); + .child(scroll); + if let Some(recent) = self.recent_section(spin) { + panel = panel.child(recent); + } + let panel = panel.child(self.sidebar_footer()); // The right edge is the drag handle: it fills the gutter with a small visible grip. let handle = row() .key("left-resize") @@ -357,20 +383,7 @@ impl Workspace { match item { Item::Header(label, count) => section_header(label, count), Item::Note(t) => row().key(format!("note-{t}")).h(NOTE_H).center_y().px(14.0).child(label(t, 12.0, theme::TEXT_FAINT)), - Item::Spacer => el().key("spacer").h(SPACER_H), Item::Session { row, reorder } => self.session_row(row, reorder, spin), - Item::Older { count, open } => row() - .key("older-header") - .h(HEADER_H) - .center_y() - .gap(5.0) - .px(14.0) - .cursor(Cursor::Pointer) - .role("button") - .on_press_tx(|ws: &mut Workspace, tx: &mut Tx| act(ws, Act::ToggleOlder, tx)) - .child(icon(&icons::CHEVRON_RIGHT, 12.0, theme::TEXT_FAINT).rotate(if open { 90.0 } else { 0.0 }).motion(motion::SNAP)) - .child(section_label("OLDER")) - .child(label(count.to_string(), 10.5, theme::TEXT_FAINT)), } } diff --git a/src/platform.rs b/src/platform.rs index 3787490..cefc42d 100644 --- a/src/platform.rs +++ b/src/platform.rs @@ -377,35 +377,15 @@ pub fn take_quit_key(ours: &str) -> bool { } } -/// Ask the OS to draw attention to the app while it is in the background: taskbar flash (Windows, until the -/// window is focused) or a dock bounce (macOS). Call only when the window is not active. -pub fn request_attention(window: &rune::WindowHandle) { - let _ = window; - #[cfg(target_os = "windows")] - { - use raw_window_handle::RawWindowHandle; - use windows_sys::Win32::UI::WindowsAndMessaging::{FLASHW_TIMERNOFG, FLASHW_TRAY, FLASHWINFO, FlashWindowEx}; - let _ = window.with_raw_handle(|handle| { - let RawWindowHandle::Win32(h) = handle.as_raw() else { return }; - let info = FLASHWINFO { - cbSize: size_of::() as u32, - hwnd: h.hwnd.get() as _, - dwFlags: FLASHW_TRAY | FLASHW_TIMERNOFG, - uCount: 0, - dwTimeout: 0, - }; - // SAFETY: `info` is fully initialised and outlives the call; the HWND is our own window. - unsafe { FlashWindowEx(&info) }; - }); - } - #[cfg(target_os = "macos")] - { - use objc2::MainThreadMarker; - use objc2_app_kit::{NSApplication, NSRequestUserAttentionType}; - if let Some(mtm) = MainThreadMarker::new() { - NSApplication::sharedApplication(mtm).requestUserAttention(NSRequestUserAttentionType::InformationalRequest); - } - } +/// A system notification, for when the window is in the background. Shown from another thread: on Linux it waits for +/// the notification server. A failure (no notification server, notifications turned off) is left silent. +pub fn notify(title: String, body: &'static str) { + std::thread::spawn(move || { + // Notification Center files notifications under an app; the installed one is ours, a dev build has none. + #[cfg(target_os = "macos")] + let _ = notify_rust::set_application("com.m4rocks.claudiu"); + let _ = notify_rust::Notification::new().appname("Claudiu").summary(&title).body(body).show(); + }); } /// macOS's emoji and symbols palette, which types what is picked into the focused text, as Ctrl+Cmd+Space opened it diff --git a/src/store.rs b/src/store.rs index 3a940c2..f3e2a7b 100644 --- a/src/store.rs +++ b/src/store.rs @@ -42,6 +42,9 @@ pub enum ExternalState { /// A GitHub issue or pull request Claude attached to a session. #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct Attached { + /// `owner/name` of a repository other than the session's project; `None` is the project's own. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub repo: Option, pub pull: bool, pub number: u32, /// Both come from GitHub (`app/attached_sync.rs`), never from the model. @@ -51,6 +54,18 @@ pub struct Attached { pub state: Option, } +impl Attached { + /// Whether this is that item. GitHub's repository names ignore case. + pub fn is(&self, repo: Option<&str>, pull: bool, number: u32) -> bool { + let same_repo = match (self.repo.as_deref(), repo) { + (None, None) => true, + (Some(a), Some(b)) => a.eq_ignore_ascii_case(b), + _ => false, + }; + same_repo && self.pull == pull && self.number == number + } +} + #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub struct ClaudeMeta { pub session_id: String, @@ -233,9 +248,9 @@ pub struct Layout { pub sidebar_visible: bool, /// No longer used (the "Other sessions" group is gone); still written because older Claudiu versions require it. pub other_collapsed: bool, - /// The sidebar's OLDER group is expanded. + /// The sidebar's RECENT list is closed (stored negated so it starts open). #[serde(default)] - pub older_open: bool, + pub recent_closed: bool, /// The project the sidebar list is filtered to. #[serde(default)] pub project_filter: Option, diff --git a/src/terminal/view/mod.rs b/src/terminal/view/mod.rs index f4ad82b..21c8302 100644 --- a/src/terminal/view/mod.rs +++ b/src/terminal/view/mod.rs @@ -459,7 +459,8 @@ impl TerminalView { h.waiting = Some((marker, before, Instant::now() + patience)); } } - Step::Erase(n) => self.send(vec![0x7f; n]), + // Straight to the program: `send` drops input while the skeleton is up. + Step::Erase(n) => self.write_input(vec![0x7f; n]), Step::Image(path, _) => { if h.clipboard.is_none() { // Keep the user's clipboard to put back; the image goes on it first, so it waits for the read. @@ -583,4 +584,36 @@ mod redraw_tests { } assert!(redraw_due(true, true, Some(start), start), "activation and typing do not wait for the background limit"); } + + /// Everything written to the program so far; a terminal that never started keeps it queued. + fn written(v: &TerminalView) -> Vec { + match &*v.terminal.link.lock().unwrap() { + crate::terminal::Link::Starting(queue) => queue + .iter() + .filter_map(|m| match m { + alacritty_terminal::event_loop::Msg::Input(b) => Some(b.to_vec()), + _ => None, + }) + .flatten() + .collect(), + _ => vec![], + } + } + + #[test] + fn text_deleted_while_handing_the_draft_over_is_erased_in_claude_code_too() { + let (mut v, _listener) = view(); + v.loading = true; + v.draft.insert("hello world"); + v.handing = Some(Handing { steps: Default::default(), waiting: None, patience: Duration::from_secs(10), clipboard: None }); + v.hand_over_step(); + assert_eq!(written(&v), b"hello world"); + // It arrived; meanwhile the user deletes a word of it on the skeleton. + v.handing.as_mut().unwrap().waiting = None; + for _ in 0.."world".len() { + v.draft.backspace(); + } + v.hand_over_step(); + assert_eq!(written(&v), b"hello world\x7f\x7f\x7f\x7f\x7f", "the backspaces reach Claude Code's prompt"); + } } diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro index 86b07c9..920c23d 100644 --- a/web/src/pages/index.astro +++ b/web/src/pages/index.astro @@ -110,7 +110,7 @@ const calls = [ -
ClaudiuFig. 2 · the parts, in order

1 One list. Every session.

Running first, recent below, older folded away. Projects are a filter, not a tree.

Running
Fix the flaky sync testpilotist
Review PR 62giolt
Recent
Redesignwebsite
Older · 23

7 Several accounts, each with its own limits.

Each account's 5-hour and 7-day limits stay in view. Alt accounts keep their own login and share your settings. Use only accounts you own.

5 hour67% · resets in 2h 14m
7 day34% · resets in 4d 8h

2 The real Claude Code.

One real terminal per session. Claudiu keeps only a few keys; the rest go to Claude Code.

Ctrl JShell under the session
Ctrl Shift ]Keyboard between Claude and shell
Ctrl Shift EEditor beside the terminal
Ctrl Shift RRight sidebar

3 A shell under each session.

A plain shell in the session's folder. It ends with its session.

4 Status, without spending tokens.

Context, cache, auto-compact and advisor, from Claude Code itself.

Context28k of 167k
Auto-compactOn
AdvisorOpus

5 Claude draws inside the terminal.

Markdown, charts and HTML, drawn natively under the tool call. No scripts.

Roadmapdrawing…
{[["Q1", "90%"], ["Q2", "55%"], ["Q3", "20%"]].map(([q, v]) => (
{q}
))}

6 Issues and PRs, beside the work.

The project's issues and pull requests. Claude attaches the ones it works on.

#59Resizable sidebars
#61Floating panels
PR 62Fix session status settings

8 Sessions can reach each other.

Read another session, search projects, start one elsewhere. Only when you ask.

+
ClaudiuFig. 2 · the parts, in order

1 One list. Every session.

Running sessions on top, the rest in a Recent list at the bottom. Projects are a filter, not a tree.

Running
Fix the flaky sync testpilotist
Review PR 62giolt
Recent
Redesignwebsite

7 Several accounts, each with its own limits.

Each account's 5-hour and 7-day limits stay in view. Alt accounts keep their own login and share your settings. Use only accounts you own.

5 hour67% · resets in 2h 14m
7 day34% · resets in 4d 8h

2 The real Claude Code.

One real terminal per session. Claudiu keeps only a few keys; the rest go to Claude Code.

Ctrl JShell under the session
Ctrl Shift ]Keyboard between Claude and shell
Ctrl Shift EEditor beside the terminal
Ctrl Shift RRight sidebar

3 A shell under each session.

A plain shell in the session's folder. It ends with its session.

4 Status, without spending tokens.

Context, cache, auto-compact and advisor, from Claude Code itself.

Context28k of 167k
Auto-compactOn
AdvisorOpus

5 Claude draws inside the terminal.

Markdown, charts and HTML, drawn natively under the tool call. No scripts.

Roadmapdrawing…
{[["Q1", "90%"], ["Q2", "55%"], ["Q3", "20%"]].map(([q, v]) => (
{q}
))}

6 Issues and PRs, beside the work.

The project's issues and pull requests. Claude attaches the ones it works on.

#59Resizable sidebars
#61Floating panels
PR 62Fix session status settings

8 Sessions can reach each other.

Read another session, search projects, start one elsewhere. Only when you ask.

Claudiu · editor modeFig. 3 · files beside the terminal