I’m a hardcore atuin lover since I installed it about a year ago (the last tool that had as much impact on my terminal workflow was fzf).
I think “atuin-as-a-history-search-replacement” is great, but I suspect the database can be used for a broader usage.
Some weeks ago I implemented a little zsh widget based on atuin db + sqlite + fzf + eza to display a searchable list of the most recently used working directories from the atuin db, along with a preview of the directory including last few commands and a colored eza preview.
The widget has 2 behaviors :
on an empty zsh line it will cd into the selected directory.
on a non-empty zsh line it will insert the selected directory into the command line
I’ve tailored it to my needs to keep it simple (for example: no gentle fallback if the fzf version is not supported or if eza is not found). Since I use it I’ve almost stopped using the cd command directly, and insta-pasting a previously used directory into the cli is such a pleasure.
This “idea” post is not a feature request. It’s a description of an usage for the atuin database improving my workflow I wanted to share along with a POC implementation.
this is so cool! thank you for sharing!! is there anything we could have done to make building on top of atuin easier?
the only feedback I would give, is that using the atuin command (history list or history search) would be better for long term stability vs using the database. we might change the database schema at any time, but the command interface should remain stable.
I am really proud that you found my work “so cool!”.
to be honest I never use the atuin cli to search the database.
the first time I ran a query against the sqlite db was when a colleague asked me which apt repo I had used to install docker.
no problem: ctrl+r, “install docker” => I had the “what” and the “when”, but what I needed was the list of commands that preceded it.
so I opened the atuin database in dbeaver to find the session id of the command and display all the commands from that session in chronological order.
it’s quite rare for me to run sql queries directly against atuin, but when I do it’s for a very specific question that can be answered with a relatively simple sql query. the flexibility of the sql language makes that very easy. as dbeaver maintains a history of queries, it’s basically: copy/paste an older query and adapt it to my current needs.
using the atuin cli would require me to learn another dsl, and most of the time, I suspect I’d need several commands to get the specific answer.
atuin-cd was born from the idea of extracting cwd from the database. with some quick’n’dirty fzf/zsh hacks, it became a small but really useful addition to my shell workflow.
like most of the shell tools I love, it is powerful yet simple enough to quickly become muscle memory. after a few days it became almost invisible.
so, to answer your question: “is there anything we could have done to make building on top of atuin easier?”, I think it would be a stable sql interface.
I know you want to add a plugin system to atuin. IMHO being able to run (read-only) sql queries against the db is a must-have. even if the database schema changes, I think you should provide a stable sql view for third-party tools, and a way for plugins to run sql against that view.