mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-21 21:39:33 +01:00
feat(desktop): add a coding agent once Codeman is installed
The agent chooser only appeared during the install, and only on a Mac with no agent. After "Skip for now", or with Codeman already installed, there was no screen for it. The same chooser now works after the install: "Add a coding agent" on the This Mac tab, "Add a Coding Agent to This Mac..." in the app menu (it also works from a Codeman page), and after a Skip the app says Codeman has no agent yet before it opens Codeman. `install.sh agent <id>` installs one agent and nothing else. It checks that THAT agent landed: install_offered_cli is fatal only when no CLI is left, so with another one present a failed install would have reported success. The app runs it as a run of its own (`gui_install::Run::Agent`), in its own temporary folder, so `ps` never reads it as "Codeman is being installed". It may run next to a live server, which an install must refuse, and stops only for another run. `--no-admin` goes to both `preflight` and `agent`: it decides what counts as installable, so the two must agree. CI: the bash 3.2 preflight check never tested anything. Its child run inherited CODEMAN_INSTALL_SH_LIB and stopped at the sourcing guard, and a false [[ ]] does not trip set -e on bash 3.2. Both are fixed for that check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b51632e54b
commit
dd07126dd8
12 files changed
+1016
-124
No files matched your search
@@ -350,7 +350,7 @@ pub fn install_in_progress(command: &str) -> Option<Option<u16>> {
|
||||
}) {
|
||||
return Some(None);
|
||||
}
|
||||
if words.iter().any(|w| name(w).starts_with("codeman-install.")) || gui_install::is_install_run(command) {
|
||||
if words.iter().any(|w| name(w).starts_with("codeman-install.")) || gui_install::Run::Codeman.matches(command) {
|
||||
let port = words
|
||||
.iter()
|
||||
.position(|w| *w == "--port")
|
||||
@@ -361,15 +361,6 @@ pub fn install_in_progress(command: &str) -> Option<Option<u16>> {
|
||||
None
|
||||
}
|
||||
|
||||
/// The process of the graphical install running on this Mac, if one does. It
|
||||
/// leads its process group.
|
||||
pub fn install_in_app() -> Option<u32> {
|
||||
list_processes()
|
||||
.into_iter()
|
||||
.find(|(_, command)| gui_install::is_install_run(command))
|
||||
.map(|(pid, _)| pid)
|
||||
}
|
||||
|
||||
fn codeman_servers(procs: &[(u32, String)]) -> Vec<u32> {
|
||||
procs
|
||||
.iter()
|
||||
@@ -491,6 +482,9 @@ pub struct LocalStatus {
|
||||
/// That install is the graphical one, not a Terminal window: the page can
|
||||
/// show it (gui_install::follow), also after the app was quit.
|
||||
pub install_in_app: bool,
|
||||
/// A coding agent is being added the same way. Not an install: it says
|
||||
/// nothing about Codeman, which may well be running.
|
||||
pub agent_install_in_app: bool,
|
||||
/// For RunningElsewhere: the addresses that Codeman listens on.
|
||||
pub elsewhere: Vec<String>,
|
||||
/// The probe's outcome, for the connect page's explanations.
|
||||
@@ -517,7 +511,8 @@ pub fn inspect(depth: Depth) -> LocalStatus {
|
||||
let servers = codeman_servers(&procs);
|
||||
let found = listeners(&servers);
|
||||
let install = procs.iter().find_map(|(_, c)| install_in_progress(c));
|
||||
let install_in_app = procs.iter().any(|(_, c)| gui_install::is_install_run(c));
|
||||
let install_in_app = procs.iter().any(|(_, c)| gui_install::Run::Codeman.matches(c));
|
||||
let agent_install_in_app = procs.iter().any(|(_, c)| gui_install::Run::Agent.matches(c));
|
||||
|
||||
// The login goes only to this user's own Codeman on that port.
|
||||
let auth = if serves_loopback_port(&found, url.port_or_known_default().unwrap_or(0)) {
|
||||
@@ -611,6 +606,7 @@ pub fn inspect(depth: Depth) -> LocalStatus {
|
||||
install_running: install.is_some(),
|
||||
install_port: install.flatten(),
|
||||
install_in_app,
|
||||
agent_install_in_app,
|
||||
elsewhere,
|
||||
outcome,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user