diff --git a/crates/sandcage/src/docker.rs b/crates/sandcage/src/docker.rs index d011d9b..40a6fb2 100644 --- a/crates/sandcage/src/docker.rs +++ b/crates/sandcage/src/docker.rs @@ -291,6 +291,7 @@ pub fn resolve_agent_home(sandcage_home: &Path, profile: Option<&str>) -> PathBu eprintln!("sandcage: warning: failed to create home profile '{name}': {e}"); } else { eprintln!("sandcage: created home profile '{name}'"); + seed_zshrc(&agent_home); } } @@ -301,6 +302,16 @@ pub fn resolve_agent_home(sandcage_home: &Path, profile: Option<&str>) -> PathBu agent_home } +pub fn seed_zshrc(agent_home: &Path) { + let zshrc = agent_home.join(".zshrc"); + if !zshrc.exists() { + let _ = std::fs::write(&zshrc, concat!( + "PROMPT='%F{blue}%~%f %# '\n", + "alias ls='ls --color=auto'\n", + )); + } +} + fn migrate_legacy_home(legacy: &Path, homes_dir: &Path) -> std::result::Result<(), std::io::Error> { let default_dir = homes_dir.join("default"); std::fs::create_dir_all(homes_dir)?; diff --git a/crates/sandcage/src/init.rs b/crates/sandcage/src/init.rs index 32f9bbd..17729c8 100644 --- a/crates/sandcage/src/init.rs +++ b/crates/sandcage/src/init.rs @@ -77,6 +77,9 @@ pub fn preseed_with_home(home: &Path) -> Result<()> { .map_err(|e| InitError::WriteFileFailed(justfile.clone(), e))?; } + // 7. Seed .zshrc to suppress zsh-newuser-install wizard + crate::docker::seed_zshrc(&agent_home); + Ok(()) }