Skip to content

Commit 4ea010a

Browse files
committed
Fix PR comments
1 parent 7fae602 commit 4ea010a

File tree

1 file changed

+35
-36
lines changed

1 file changed

+35
-36
lines changed

crates/chat-cli/src/util/paths.rs

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Hierarchical path management for the application
22
3-
#[cfg(test)]
4-
use std::collections::HashSet;
53
use std::env::VarError;
64
use std::path::{
75
PathBuf,
@@ -85,32 +83,6 @@ impl FileSystemChecker for RealFileSystem {
8583
}
8684
}
8785

88-
/// Test filesystem implementation
89-
#[cfg(test)]
90-
struct TestFileSystem {
91-
existing_paths: HashSet<PathBuf>,
92-
}
93-
94-
#[cfg(test)]
95-
impl TestFileSystem {
96-
fn new() -> Self {
97-
Self {
98-
existing_paths: HashSet::new(),
99-
}
100-
}
101-
102-
fn add_path(&mut self, path: impl Into<PathBuf>) {
103-
self.existing_paths.insert(path.into());
104-
}
105-
}
106-
107-
#[cfg(test)]
108-
impl FileSystemChecker for TestFileSystem {
109-
fn exists(&self, path: &std::path::Path) -> bool {
110-
self.existing_paths.contains(path)
111-
}
112-
}
113-
11486
fn resolve_migrated_path_with_fs(
11587
fs: &dyn FileSystemChecker,
11688
home_dir: &std::path::Path,
@@ -155,11 +127,11 @@ fn resolve_migrated_path_with_fs(
155127
},
156128
(true, true) => {
157129
warn!(
158-
"Config conflict: Both .amazonq and .kiro {} configs exist, using .amazonq at: {}",
130+
"Config conflict: Both .amazonq and .kiro {} configs exist, using .kiro at: {}",
159131
scope,
160-
amazonq_base.display()
132+
kiro_base.display()
161133
);
162-
amazonq_base.join(subpath)
134+
kiro_base.join(subpath)
163135
},
164136
(false, false) => {
165137
debug!(
@@ -461,10 +433,37 @@ impl<'a> GlobalPaths<'a> {
461433

462434
#[cfg(test)]
463435
mod migration_tests {
464-
use std::path::Path;
436+
use std::collections::HashSet;
437+
use std::path::{
438+
Path,
439+
PathBuf,
440+
};
465441

466442
use super::*;
467443

444+
/// Test filesystem implementation
445+
struct TestFileSystem {
446+
existing_paths: HashSet<PathBuf>,
447+
}
448+
449+
impl TestFileSystem {
450+
fn new() -> Self {
451+
Self {
452+
existing_paths: HashSet::new(),
453+
}
454+
}
455+
456+
fn add_path(&mut self, path: impl Into<PathBuf>) {
457+
self.existing_paths.insert(path.into());
458+
}
459+
}
460+
461+
impl FileSystemChecker for TestFileSystem {
462+
fn exists(&self, path: &std::path::Path) -> bool {
463+
self.existing_paths.contains(path)
464+
}
465+
}
466+
468467
#[test]
469468
fn test_kiro_only_workspace() {
470469
let mut fs = TestFileSystem::new();
@@ -499,8 +498,8 @@ mod migration_tests {
499498
let current = Path::new("/current");
500499

501500
let path = resolve_migrated_path_with_fs(&fs, home, current, false, "cli-agents");
502-
// Should prefer .amazonq when both exist
503-
assert_eq!(path, Path::new("/current/.amazonq/cli-agents"));
501+
// Should prefer .kiro when both exist
502+
assert_eq!(path, Path::new("/current/.kiro/cli-agents"));
504503
}
505504

506505
#[test]
@@ -549,8 +548,8 @@ mod migration_tests {
549548
let current = Path::new("/current");
550549

551550
let path = resolve_migrated_path_with_fs(&fs, home, current, true, "cli-agents");
552-
// Should prefer .amazonq when both exist
553-
assert_eq!(path, Path::new("/home/user/.aws/amazonq/cli-agents"));
551+
// Should prefer .kiro when both exist
552+
assert_eq!(path, Path::new("/home/user/.aws/kiro/cli-agents"));
554553
}
555554

556555
#[test]

0 commit comments

Comments
 (0)