Skip to content

Conversation

@zanesq
Copy link
Collaborator

@zanesq zanesq commented Oct 28, 2025

Summary

move history txt to state dir

closes #2493

@zanesq zanesq requested review from DOsinga and jamadeo October 28, 2025 16:36
// 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() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is duped code

}
}
}

Copy link
Collaborator

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

|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() {
Copy link
Collaborator

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

true
} else {
false
};
Copy link
Collaborator

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);
}
}

@zanesq zanesq merged commit 5377b6d into main Oct 28, 2025
14 checks passed
@zanesq zanesq deleted the zane/history-txt branch October 28, 2025 20:57
michaelneale added a commit that referenced this pull request Oct 29, 2025
* 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)
  ...
wpfleger96 added a commit that referenced this pull request Oct 29, 2025
* 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)
BlairAllan pushed a commit to BlairAllan/goose that referenced this pull request Nov 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

history.txt should be stored in ~/.local/share (XDG_DATA_HOME or XDG_STATE_HOME)

3 participants