Skip to content

Commit 00e7964

Browse files
committed
add debug logs in migrate flow
1 parent 881e409 commit 00e7964

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

crates/chat-cli/src/cli/migrate.rs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use serde_json::{
1818
Value,
1919
};
2020
use tokio::fs;
21+
use tracing::debug;
2122

2223
use crate::os::Os;
2324
use crate::util::paths::GlobalPaths;
@@ -39,19 +40,10 @@ pub struct MigrateArgs {
3940

4041
impl MigrateArgs {
4142
pub async fn execute(self, os: &mut Os) -> Result<ExitCode> {
42-
// Try to acquire migration lock
43-
let _lock = match acquire_migration_lock()? {
44-
Some(lock) => lock,
45-
None => {
46-
println!("Migration already in progress by another process");
47-
return Ok(ExitCode::SUCCESS);
48-
},
49-
};
50-
5143
let status = detect_migration(os).await?;
5244

5345
if !self.force && matches!(status, MigrationStatus::Completed) {
54-
println!("✓ Migration already completed");
46+
debug!("✓ Migration already completed");
5547
return Ok(ExitCode::SUCCESS);
5648
}
5749

@@ -62,7 +54,7 @@ impl MigrateArgs {
6254
new_settings,
6355
} = status
6456
else {
65-
println!("✓ No migration needed (fresh install)");
57+
debug!("✓ No migration needed (fresh install)");
6658
return Ok(ExitCode::SUCCESS);
6759
};
6860

@@ -81,27 +73,36 @@ impl MigrateArgs {
8173
}
8274
}
8375

76+
// Try to acquire migration lock
77+
let _lock = match acquire_migration_lock()? {
78+
Some(lock) => lock,
79+
None => {
80+
debug!("Migration already in progress by another process");
81+
return Ok(ExitCode::SUCCESS);
82+
},
83+
};
84+
8485
// Migrate database
8586
let db_result = migrate_database(&old_db, &new_db, self.dry_run).await?;
86-
println!("✓ Database: {}", db_result.message);
87+
debug!("✓ Database: {}", db_result.message);
8788

8889
// Migrate settings
8990
let settings_result = migrate_settings(&old_settings, &new_settings, self.dry_run).await?;
90-
println!("✓ Settings: {}", settings_result.message);
91+
debug!("✓ Settings: {}", settings_result.message);
9192
if !settings_result.transformations.is_empty() {
92-
println!(" Transformations applied:");
93+
debug!(" Transformations applied:");
9394
for t in &settings_result.transformations {
94-
println!(" - {t}");
95+
debug!(" - {t}");
9596
}
9697
}
9798

9899
if !self.dry_run {
99100
os.database = crate::database::Database::new().await?;
100101
os.database.set_kiro_migration_completed()?;
101102

102-
println!("\n✓ Migration completed successfully!");
103+
debug!("\n✓ Migration completed successfully!");
103104
} else {
104-
println!("\n(Dry run - no changes made)");
105+
debug!("\n(Dry run - no changes made)");
105106
}
106107

107108
Ok(ExitCode::SUCCESS)

0 commit comments

Comments
 (0)