fix(onboard): persist custom workspace selection across sessions

This commit is contained in:
Chummy 2026-02-18 00:33:56 +08:00
parent e2e431d9e7
commit cba7d1a14b
2 changed files with 232 additions and 4 deletions

View file

@ -147,6 +147,7 @@ pub fn run_wizard() -> Result<Config> {
);
config.save()?;
persist_workspace_selection(&config.config_path)?;
// ── Final summary ────────────────────────────────────────────
print_summary(&config);
@ -202,6 +203,7 @@ pub fn run_channels_repair_wizard() -> Result<Config> {
print_step(1, 1, "Channels (How You Talk to ZeroClaw)");
config.channels_config = setup_channels()?;
config.save()?;
persist_workspace_selection(&config.config_path)?;
println!();
println!(
@ -351,6 +353,7 @@ pub fn run_quick_setup(
};
config.save()?;
persist_workspace_selection(&config.config_path)?;
// Scaffold minimal workspace files
let default_ctx = ProjectContext {
@ -1287,6 +1290,18 @@ fn print_bullet(text: &str) {
println!(" {} {}", style("").cyan(), text);
}
fn persist_workspace_selection(config_path: &Path) -> Result<()> {
let config_dir = config_path
.parent()
.context("Config path must have a parent directory")?;
crate::config::schema::persist_active_workspace_config_dir(config_dir).with_context(|| {
format!(
"Failed to persist active workspace selection for {}",
config_dir.display()
)
})
}
// ── Step 1: Workspace ────────────────────────────────────────────
fn setup_workspace() -> Result<(PathBuf, PathBuf)> {