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
8 changes: 4 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Claudiu is a native Rust + GPUI desktop app that manages sessions around the use
GitHub issues hold intent, one issue per feature with a checklist in its body; the code and the maintainer decide what is true.
Check off items the code already does. Add entries for requests that aren't listed, and for problems you notice outside the task, rather than fixing those in passing, so every diff stays reviewable. Order is a suggestion: if a request seems to depend on unfinished work, say so in one line and continue.

Care about the project's long-term health, not just the request in front of you. When a request would harm it, say so plainly and early, give your own recommendation, and don't agree just to be agreeable. Hold your position if the pushback brings no new information. Once the maintainer decides, follow the decision and note your disagreement.
Care about the project's long-term health and whether the maintainer's problem actually goes away, not just the request in front of you. Suggest what they haven't asked for but will need. When a request would harm the project, say so plainly and early, give your own recommendation, and don't agree just to be agreeable. Hold your position if the pushback brings no new information. Once the maintainer decides, follow the decision and note your disagreement.

Ask the maintainer about product direction, scope, and anything irreversible or outward-facing, such as pushing, deleting data, adding a dependency or closing issues, unless the settings above allow it. Ask through the harness's structured question tool when it has one, recommended option first; otherwise ask one question per message with numbered options. Decide everything reversible yourself and report it. Ask a question only when you can't continue without a decision. Finishing a change is not such a point: report it in a line or two and stop, and leave committing and pushing to the settings or the maintainer's word.
Ask the maintainer about product direction, scope, and anything irreversible or outward-facing, such as pushing, deleting data, adding a dependency or closing issues, unless the settings above allow it. Ask through the harness's structured question tool when it has one, recommended option first; otherwise ask one question per message with numbered options. The maintainer is the source of truth and decides everything; don't guess. Every real choice, including scope, behavior, wording and design, goes to them with your recommendation and the reason, and so does anything they'd want to know, such as a gap or a better approach, when you find it. What the repo already answers, such as how similar code is built, is a fact rather than a choice: follow it and say what you followed. Finishing a change is not such a point: report it in a line or two and stop, and leave committing and pushing to the settings or the maintainer's word.

The maintainer can override any setting for a single request, for example "go autonomous, commit and push everything" or "ask before each commit"; the override lasts until that request is done.

Expand All @@ -32,9 +32,9 @@ Work inline; spawn subagents only as the settings allow, except the plan review

People who don't use agents read and maintain this code, so aim for code that is obviously correct to a newcomer. Rank choices by correctness, then how easily the code reads and tests, then size; a one-liner that needs decoding is not simple.

Build only what was asked: features, options and configuration nobody requested wait until someone needs them. How the requested thing is built is open. For non-trivial logic, weigh more than one shape and pick the one whose correctness is most obvious, even if it is unconventional. Before writing new code, look for it in this repo, then the standard library and platform, then installed dependencies.
Build only what was asked: features, options and configuration nobody requested wait until someone needs them. New code takes the shape of the existing code that does something similar: its file layout, naming, error handling, state, UI and tests, and its helpers rather than new ones. When that shape doesn't fit, or more than one design is reasonable, recommend the one whose correctness is most obvious and ask. Before writing new code, look for it in this repo, then the standard library and platform, then installed dependencies.

Before editing, find every place the change must reach (callers, tests, fixtures, config, exports) and finish all of them. When a better structure would make the task simpler, use it in this change; when it is bigger than the task, do the task and add the redesign to the tracker with a one-line reason. Keep validation of untrusted input, error handling that prevents data loss, security and accessibility, including in code you move.
Before editing, find every place the change must reach (callers, tests, fixtures, config, exports) and finish all of them. When a better structure would make the task simpler, propose it; when it is bigger than the task, recommend doing the task and adding the redesign to the tracker with a one-line reason. Keep validation of untrusted input, error handling that prevents data loss, security and accessibility, including in code you move.

Comments explain why something non-obvious is true, such as a known limit and when it will matter. When code needs a comment to say what it does, rename or restructure it instead. Leave existing comments in code you don't change. New logic that can break quietly (branches, parsers, money, security, data writes, bug fixes) ships with a test that fails when it breaks.

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ strip = true

[target."cfg(windows)".dependencies]
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_Threading"] }
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"] }

[target.'cfg(unix)'.dependencies]
libc = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Claudiu is a native desktop app, written in Rust with [GPUI](https://gpui.rs), t

## 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. A sidebar lists your projects and sessions. 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. Settings has a Check setup button to open it again. A sidebar lists your projects and sessions. 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. Settings lists the rest.

Expand Down
43 changes: 23 additions & 20 deletions src/app/github_pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,29 @@ impl Workspace {
cx,
);
}
GhEvent::SignIn => {
let Some(exe) = crate::github::cli::locate() else { return };
let home = platform::home_dir().unwrap_or_else(|| PathBuf::from("."));
let spec = SpawnSpec { program: exe.to_string_lossy().into_owned(), args: vec!["auth".into(), "login".into()], cwd: Some(home.clone()), ..Default::default() };
let record = SessionRecord {
id: new_id(),
kind: SessionKind::Shell,
title: "GitHub sign in".into(),
custom_title: None,
auto_title: None,
project_id: None,
cwd: home,
created_at: now(),
last_active: now(),
exit_code: None,
hidden: false,
claude: None,
};
self.start(record, spec, true, window, cx);
}
GhEvent::SignIn => self.sign_in_to_github(window, cx),
}
}

/// `gh auth login` in a terminal tab.
pub(super) fn sign_in_to_github(&mut self, window: &mut Window, cx: &mut Context<Self>) {
let Some(exe) = crate::github::cli::locate() else { return };
let home = platform::home_dir().unwrap_or_else(|| PathBuf::from("."));
let spec = SpawnSpec { program: exe.to_string_lossy().into_owned(), args: vec!["auth".into(), "login".into()], cwd: Some(home.clone()), ..Default::default() };
let record = SessionRecord {
id: new_id(),
kind: SessionKind::Shell,
title: "GitHub sign in".into(),
custom_title: None,
auto_title: None,
project_id: None,
cwd: home,
created_at: now(),
last_active: now(),
exit_code: None,
hidden: false,
claude: None,
};
self.start(record, spec, true, window, cx);
}
}
31 changes: 31 additions & 0 deletions src/app/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1220,3 +1220,34 @@ fn the_session_list_draws_rows_where_scrolling_brings_them() {
let after = row_under_pointer(&mut cx);
assert!(after > before + 20, "row {before} before scrolling, {after} after");
}

/// With no `claude` found, starting a session says so and offers the setup window; asking for it twice shows one.
#[test]
#[ignore]
fn a_missing_claude_offers_the_setup_window() {
let data = tempfile::tempdir().unwrap();
unsafe { std::env::set_var("CLAUDIU_DATA_DIR", data.path()) };
let work = tempfile::tempdir().unwrap();
let mut cx = TestAppContext::single();
cx.update(|app| {
gpui_kit::init(app);
gpui_kit::component::Theme::change(gpui_kit::component::ThemeMode::Dark, None, app);
});
let (window, ws) = cx.update(|app| gpui_kit::open_window(Default::default(), app, |window, app| app.new(|cx| Workspace::new(window, vec![], cx)))).unwrap();

cx.update_window(window, |_, window, app| {
ws.update(app, |ws, cx| {
ws.claude_exe = None;
ws.new_claude(work.path().to_path_buf(), window, cx);
})
})
.unwrap();
let action = ws.read_with(&cx, |ws, _| ws.toast.as_ref().and_then(|t| t.action.as_ref().map(|(label, act)| (label.clone(), matches!(act, Act::OpenSetup)))));
assert_eq!(action, Some(("Check setup".to_string(), true)), "the toast offers the setup window");

for _ in 0..2 {
cx.update_window(window, |_, window, app| ws.update(app, |ws, cx| ws.act(Act::OpenSetup, window, cx))).unwrap();
cx.run_until_parked();
}
assert_eq!(cx.update(|app| app.windows().len()), 2, "the workspace and one setup window");
}
8 changes: 8 additions & 0 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ mod repo;
mod selection_reference;
mod sessions;
mod settings;
mod setup;
mod titles;
mod visuals;

Expand All @@ -64,6 +65,7 @@ pub use lifecycle::saved_window_bounds;
pub use editor_mode::EditorCommand;
pub use file_ops::NameFor;
pub use settings::SettingsPage;
pub use setup::{Mode as SetupMode, SetupEvent, SetupView, window_options as setup_window_options};

actions!(
claudiu,
Expand Down Expand Up @@ -129,6 +131,8 @@ pub enum Act {
OpenEditor(Editor, PathBuf),
ImportProject,
OpenSettings,
/// The setup window again, from Settings or the missing-`claude` toast (see `setup.rs`).
OpenSetup,
/// A choice in the Settings dialog's effort or permission-mode picker (None = Claude Code's default); kept in the
/// dialog until Save.
PickEffort(Option<Effort>),
Expand Down Expand Up @@ -459,6 +463,8 @@ pub struct Workspace {
pub git_busy: Option<GitOp>,
/// What Commit & Push would do in the shown session's folder, as last read; `None` until it has been.
pub pending: Option<(PathBuf, crate::git::commit::Pending)>,
/// The setup window while it is open, so a second request shows it instead of opening another.
setup_window: Option<gpui::AnyWindowHandle>,
}

impl Workspace {
Expand Down Expand Up @@ -554,6 +560,7 @@ impl Workspace {
activity: HashMap::new(),
git_busy: None,
pending: None,
setup_window: None,
store,
};
// Everything from a previous run is history until clicked. Keep the highlight only if it still exists.
Expand Down Expand Up @@ -692,6 +699,7 @@ impl Workspace {
}
}
}
Act::OpenSetup => self.open_setup(window, cx),
Act::OpenSettings => {
let s = &self.store.data.settings;
let (shell_t, claude_t) = (
Expand Down
2 changes: 1 addition & 1 deletion src/app/sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl Workspace {
/// `--allowedTools` / `--mcp-config` flags, or they would swallow it.
pub(super) fn new_claude_with(&mut self, cwd: PathBuf, mut leading: Vec<String>, by: Starter, window: &mut Window, cx: &mut Context<Self>) {
let Some(exe) = self.claude_exe.clone() else {
self.toast("Could not find the `claude` CLI. Install Claude Code, or set its path in Settings.", true, cx);
self.show_toast("Could not find the `claude` CLI. Install Claude Code, or set its path in Settings.".into(), true, Some(("Check setup".into(), Act::OpenSetup)), cx);
return;
};
let session_id = new_id();
Expand Down
Loading
Loading