Skip to content

Add --atuin-db to load history from an atuin SQLite database#564

Closed
Copilot wants to merge 1 commit intomasterfrom
copilot/add-atuin-db-setting
Closed

Add --atuin-db to load history from an atuin SQLite database#564
Copilot wants to merge 1 commit intomasterfrom
copilot/add-atuin-db-setting

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 23, 2026

Adds a --atuin-db <PATH> flag that, when set, loads history from an atuin SQLite database instead of parsing bash history. Implemented without the atuin crate, using the lightweight sqlite wrapper with bundled libsqlite3.

Changes

  • CLI / Settings: new --atuin-db <PATH> flag plumbed through Settings::atuin_db_path.
  • History source switch: in HistoryManager::new, when atuin_db_path is set, atuin entries replace the bash entries; --load-zsh-history still merges on top unchanged.
  • Atuin reader (history.rs): opens the DB read-only and runs:
    SELECT timestamp, command FROM history
     WHERE deleted_at IS NULL
     ORDER BY timestamp ASC
    Atuin's nanosecond timestamps are converted to seconds. Missing file / open / decode errors degrade to an empty history with a logged warning, matching the existing zsh-history error UX.
  • Dependency: sqlite = "0.37" with the bundled feature — no system libsqlite3 required, no atuin transitive deps. Advisory DB checked: clean.
  • Tests: unit tests covering the happy path (in-memory atuin-shaped DB written to a temp file; verifies ordering, deleted_at filtering, and ns→s conversion) and the missing-file path.

--release libflyline.so size

bytes ~MiB
before 4,177,544 3.98
after 5,619,728 5.36
Δ +1,442,184 +1.38

Increase is essentially the statically-linked bundled libsqlite3.

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.

2 participants