-
Notifications
You must be signed in to change notification settings - Fork 2.3k
move history txt to state dir #5410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
crates/goose-cli/src/session/mod.rs
Outdated
| // Migrate from old location if needed | ||
| let old_history_file = Paths::config_dir().join("history.txt"); | ||
| if old_history_file.exists() && !history_file.exists() { | ||
| if let Some(parent) = history_file.parent() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is duped code
| } | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the above seems more complicated than it should be. we already check if the history file exists. if we also check whether the old history exists we can then just load from old if new doesn't exist and delete old when new does exist
crates/goose-cli/src/session/mod.rs
Outdated
| |editor: &mut rustyline::Editor<GooseCompleter, rustyline::history::DefaultHistory>| { | ||
| if let Err(err) = editor.save_history(&history_file) { | ||
| eprintln!("Warning: Failed to save command history: {}", err); | ||
| } else if history_loaded && old_history_file.exists() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to check on history_loaded here I think
crates/goose-cli/src/session/mod.rs
Outdated
| true | ||
| } else { | ||
| false | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably go with something like:
let load_from = [&history_file, &old_history_file]
.iter()
.find(|f| f.exists());
if let Some(file) = load_from {
if let Err(err) = editor.load_history(file) {
eprintln!("Warning: Failed to load command history: {}", err);
}
}
* main: (30 commits) feat: add goose powered ai culinary innovation studio prompt to library (#5423) removing golang/temporal building testing tetrate with sonnet (#5428) Add Recipes Test Script (#5420) Don't die on strange chars (#5415) fix: allow subagent to run in parent --no-session mode (#5384) docs: analyze tool (#5418) fix: gracefully close goosed listening port (#5321) move history txt to state dir (#5410) Dont exit silently when storing api key fails (#5260) Make reply use the API (#5389) Fix/icon ii (#5413) Enable runtime access to provider name (#5399) fix: ensure trailing newline in files created by `text_editor` tool (#5336) docs: September 2025 Community All-Stars (#5411) make supports_cache_control async to avoid block in place (#5362) Send all the logs we output (#5363) Recipe variables (#5365) Feat/add mermaid chart rendering (#5377) Set up Datadog metrics for prompt injection detection (#5385) ...
* main: fix: corrected my name in data (#5414) feat: add goose powered ai culinary innovation studio prompt to library (#5423) removing golang/temporal building testing tetrate with sonnet (#5428) Add Recipes Test Script (#5420) Don't die on strange chars (#5415) fix: allow subagent to run in parent --no-session mode (#5384) docs: analyze tool (#5418) fix: gracefully close goosed listening port (#5321) move history txt to state dir (#5410)
Signed-off-by: Blair Allan <[email protected]>
Summary
move history txt to state dir
closes #2493