feat(v0.8.44): one-time config migration from ~/.deepseek/ to ~/.codewhale/

migrate_config_if_needed() copies config.toml on first launch.
Called in run_interactive after config creation. Non-fatal,
never overwrites an existing primary config.
This commit is contained in:
Hunter Bown
2026-05-24 16:25:17 -05:00
parent 1a311c591f
commit 93ee76810b
2 changed files with 34 additions and 0 deletions
+28
View File
@@ -1550,6 +1550,34 @@ pub fn default_config_path() -> Result<PathBuf> {
Ok(primary)
}
/// v0.8.44: one-time migration from `~/.deepseek/config.toml` to
/// `~/.codewhale/config.toml`. Called on first launch after the config
/// is loaded; copies the legacy file if the primary doesn't exist yet.
/// Never overwrites an existing primary config.
pub fn migrate_config_if_needed() -> Result<()> {
let primary = codewhale_home()?.join(CONFIG_FILE_NAME);
if primary.exists() {
return Ok(());
}
let legacy = legacy_deepseek_home()?.join(CONFIG_FILE_NAME);
if !legacy.exists() {
return Ok(());
}
// Copy the config to the new home.
if let Some(parent) = primary.parent() {
std::fs::create_dir_all(parent)
.context("failed to create codewhale config directory")?;
}
std::fs::copy(&legacy, &primary)
.context("failed to migrate config from deepseek to codewhale home")?;
tracing::info!(
"Migrated config from {} to {}",
legacy.display(),
primary.display()
);
Ok(())
}
fn parse_bool(raw: &str) -> Result<bool> {
match raw.trim().to_ascii_lowercase().as_str() {
"1" | "true" | "yes" | "on" | "enabled" => Ok(true),
+6
View File
@@ -4741,6 +4741,12 @@ async fn run_interactive(
}
}
// v0.8.44: migrate config from ~/.deepseek/ to ~/.codewhale/ on first
// launch. Non-fatal — existing installs keep working either way.
if let Err(err) = codewhale_config::migrate_config_if_needed() {
logging::warn(format!("Config migration skipped: {err}"));
}
let model = config.default_model();
let max_subagents = cli.max_subagents.map_or_else(
|| config.max_subagents(),