Skip to content

Commit 11a2953

Browse files
authored
Add migration flow for desktop app (#909)
1 parent a641340 commit 11a2953

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

crates/fig_util/src/consts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ pub const RUNTIME_DIR_NAME: &str = "cwrun";
2727

2828
/// Data directory name used in paths like ~/.local/share/{DATA_DIR_NAME}
2929
#[cfg(unix)]
30-
pub const DATA_DIR_NAME: &str = "amazon-q";
30+
pub const DATA_DIR_NAME: &str = "kiro-cli";
3131
#[cfg(windows)]
32-
pub const DATA_DIR_NAME: &str = "AmazonQ";
32+
pub const DATA_DIR_NAME: &str = "KiroCli";
3333

3434
/// Backup directory name
3535
pub const BACKUP_DIR_NAME: &str = ".amazon-q.dotfiles.bak";

crates/fig_util/src/directories.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ pub fn config_dir() -> Result<PathBuf> {
133133
/// This should be removed at some point in the future, once all our users have migrated
134134
/// - MacOS: `$HOME/Library/Application Support/codewhisperer`
135135
pub fn old_fig_data_dir() -> Result<PathBuf> {
136-
Ok(dirs::data_local_dir()
137-
.ok_or(DirectoryError::NoHomeDirectory)?
138-
.join("codewhisperer"))
136+
Ok(dirs::data_local_dir().ok_or(DirectoryError::NoHomeDirectory)?.join("q"))
139137
}
140138

141139
/// The q data directory
@@ -448,11 +446,11 @@ pub fn bundle_metadata_path<Ctx: EnvProvider + PlatformProvider>(ctx: &Ctx) -> R
448446

449447
/// The path to the fig settings file
450448
///
451-
/// - Linux: `$HOME/.local/share/{data_dir}/settings.json`
452-
/// - MacOS: `$HOME/Library/Application Support/{data_dir}/settings.json`
453-
/// - Windows: `%LOCALAPPDATA%\{data_dir}\settings.json`
449+
/// - Linux: `$HOME/.aws/kiro-cli/settings.json`
450+
/// - MacOS: `$HOME/.aws/kiro-cli/settings.json`
451+
/// - Windows: `$HOME/.aws/kiro-cli/settings.json`
454452
pub fn settings_path() -> Result<PathBuf> {
455-
Ok(fig_data_dir()?.join("settings.json"))
453+
Ok(home_dir()?.join(".aws").join("kiro-cli").join("settings.json"))
456454
}
457455

458456
/// The path to the lock file used to indicate that the app is updating
@@ -691,7 +689,7 @@ mod tests {
691689
#[test]
692690
fn snapshot_fig_data_dir() {
693691
linux!(fig_data_dir(), @"$HOME/.local/share/amazon-q");
694-
macos!(fig_data_dir(), @"$HOME/Library/Application Support/amazon-q");
692+
macos!(fig_data_dir(), @"$HOME/Library/Application Support/kiro-cli");
695693
windows!(fig_data_dir(), @r"C:\Users\$USER\AppData\Local\AmazonQ");
696694
}
697695

@@ -747,15 +745,15 @@ mod tests {
747745
#[test]
748746
fn snapshot_settings_path() {
749747
linux!(settings_path(), @"$HOME/.local/share/amazon-q/settings.json");
750-
macos!(settings_path(), @"$HOME/Library/Application Support/amazon-q/settings.json");
748+
macos!(settings_path(), @"$HOME/.aws/kiro-cli/settings.json");
751749
windows!(settings_path(), @r"C:\Users\$USER\AppData\Local\AmazonQ\settings.json");
752750
}
753751

754752
#[test]
755753
fn snapshot_update_lock_path() {
756754
let ctx = Context::new();
757755
linux!(update_lock_path(&ctx), @"$HOME/.local/share/amazon-q/update.lock");
758-
macos!(update_lock_path(&ctx), @"$HOME/Library/Application Support/amazon-q/update.lock");
756+
macos!(update_lock_path(&ctx), @"$HOME/Library/Application Support/kiro-cli/update.lock");
759757
windows!(update_lock_path(&ctx), @r"C:\Users\$USER\AppData\Local\AmazonQ\update.lock");
760758
}
761759

crates/q_cli/src/cli/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,9 @@ impl Cli {
340340

341341
debug!(command =? std::env::args().collect::<Vec<_>>(), "Command ran");
342342

343+
// Run migration silently on startup (skips if already completed or locked)
344+
let _ = Self::execute_chat("chat", Some(vec!["migrate".to_owned(), "--yes".to_owned()]), false).await;
345+
343346
self.send_telemetry().await;
344347

345348
if self.help_all {

0 commit comments

Comments
 (0)