diff options
| author | Ellie Huxtable <ellie@atuin.sh> | 2026-02-25 19:10:58 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-25 19:10:58 -0800 |
| commit | 9fe7d10fcf73570767ba7b4eabaa95f65958821b (patch) | |
| tree | ed9705225db8e5bbe2f3c689ba5d1c9908b75eb1 /crates/atuin-client/src/history/builder.rs | |
| parent | feat: Generate commands or ask questions with `atuin ai` (#3199) (diff) | |
| download | atuin-9fe7d10fcf73570767ba7b4eabaa95f65958821b.zip | |
feat: Add history author/intent metadata and v1 record version (#3205)
<!-- Thank you for making a PR! Bug fixes are always welcome, but if
you're adding a new feature or changing an existing one, we'd really
appreciate if you open an issue, post on the forum, or drop in on
Discord -->
## Checks
- [x] I am happy for maintainers to push small adjustments to this PR,
to speed up the review cycle
- [x] I have checked that there are no existing pull requests for the
same thing
Adds `author` and `intent` to client history records and DB persistence,
including migration/backfill and CLI/daemon propagation.
Introduces V2 record-store history version `v1` while retaining read
compatibility for legacy `v0` records.
Adds `--author` and `--intent` flags to `atuin history start`, plus
`{author}` and `{intent}` format keys for listing/history output.
Updates shell-integration docs for `ATUIN_HISTORY_AUTHOR` and
`ATUIN_HISTORY_INTENT`, and updates related tests/fixtures.
Validated with `cargo test -p atuin-client --lib`, `cargo test -p
atuin-daemon --tests`, `cargo test -p atuin search::inspector`, and
`cargo fmt --check`.
Diffstat (limited to 'crates/atuin-client/src/history/builder.rs')
| -rw-r--r-- | crates/atuin-client/src/history/builder.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/atuin-client/src/history/builder.rs b/crates/atuin-client/src/history/builder.rs index 2b28339f..72a505fd 100644 --- a/crates/atuin-client/src/history/builder.rs +++ b/crates/atuin-client/src/history/builder.rs @@ -20,6 +20,10 @@ pub struct HistoryImported { session: Option<String>, #[builder(default, setter(strip_option, into))] hostname: Option<String>, + #[builder(default, setter(strip_option, into))] + author: Option<String>, + #[builder(default, setter(strip_option, into))] + intent: Option<String>, } impl From<HistoryImported> for History { @@ -32,6 +36,8 @@ impl From<HistoryImported> for History { imported.duration, imported.session, imported.hostname, + imported.author, + imported.intent, None, ) } @@ -49,6 +55,10 @@ pub struct HistoryCaptured { command: String, #[builder(setter(into))] cwd: String, + #[builder(default, setter(strip_option, into))] + author: Option<String>, + #[builder(default, setter(strip_option, into))] + intent: Option<String>, } impl From<HistoryCaptured> for History { @@ -61,6 +71,8 @@ impl From<HistoryCaptured> for History { -1, None, None, + captured.author, + captured.intent, None, ) } @@ -79,6 +91,8 @@ pub struct HistoryFromDb { duration: i64, session: String, hostname: String, + author: String, + intent: Option<String>, deleted_at: Option<time::OffsetDateTime>, } @@ -93,6 +107,8 @@ impl From<HistoryFromDb> for History { duration: from_db.duration, session: from_db.session, hostname: from_db.hostname, + author: from_db.author, + intent: from_db.intent, deleted_at: from_db.deleted_at, } } @@ -114,6 +130,10 @@ pub struct HistoryDaemonCapture { session: String, #[builder(setter(into))] hostname: String, + #[builder(default, setter(strip_option, into))] + author: Option<String>, + #[builder(default, setter(strip_option, into))] + intent: Option<String>, } impl From<HistoryDaemonCapture> for History { @@ -126,6 +146,8 @@ impl From<HistoryDaemonCapture> for History { -1, Some(captured.session), Some(captured.hostname), + captured.author, + captured.intent, None, ) } |
