Skip to content

Commit ed89f7e

Browse files
authored
fixes migration workflow not differentiating between home dir and cwd (#2245)
1 parent 5757089 commit ed89f7e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,16 @@ impl Agents {
329329
}
330330

331331
let mut local_agents = 'local: {
332+
// We could be launching from the home dir, in which case the global and local agents
333+
// are the same set of agents. If that is the case, we simply skip this.
334+
match (std::env::current_dir(), directories::home_dir(os)) {
335+
(Ok(cwd), Ok(home_dir)) if cwd == home_dir => break 'local Vec::<Agent>::new(),
336+
_ => {
337+
// noop, we keep going with the extraction of local agents (even if we have an
338+
// error retrieving cwd or home_dir)
339+
},
340+
}
341+
332342
let Ok(path) = directories::chat_local_agent_dir() else {
333343
break 'local Vec::<Agent>::new();
334344
};
@@ -361,6 +371,7 @@ impl Agents {
361371

362372
// Here we also want to make sure the example config is written to disk if it's not already
363373
// there.
374+
// Note that this config is not what q chat uses. It merely serves as an example.
364375
'example_config: {
365376
let Ok(path) = directories::example_agent_config(os) else {
366377
error!("Error obtaining example agent path.");

0 commit comments

Comments
 (0)