Expand description
SessionStore: layout under <session-root>/<sid>/.
Two materialization modes, both produce the same on-disk record:
- Auto (
create(.., None, ..)):<root>/<sid>/session.jsonplus<root>/<sid>/logs/. - Explicit (
create(.., Some(dir), ..)): writes to<dir>/session.jsondirectly and creates<root>/<sid>as a symlink to<dir>sooutrig lsfinds it uniformly.
Structs§
- Session
- On-disk session record. Mirrors
doc/usage/sessions.md’ssession.json.link_targetis in-memory only – populated bylist/get_by_idwhen the entry under<root>/<sid>is a symlink, never written to disk. - Session
Id - Stable, sortable session id. Format:
yyyymmddTHHMMSS-rrrr(UTC, four hex digits of randomness). Lexicographic order matches chronological order modulo collisions, so listings can sort by string. - Session
Store
Functions§
- format_
duration Mm SSsfor sub-hour,Hh MMmfor an hour or more. Matches the example indoc/usage/sessions.md(0m44s,2m18s,6m02s,1h05m).- format_
started_ at 2026-05-01 14:19:07(UTC). Display-only; the on-disk format is ISO 8601 viaiso_systime. Returns?if the timestamp can’t be converted (only happens for SystemTimes outside jiff’s representable range – effectively never in practice).- resolve_
session_ root - Cascade: CLI flag > config’s
session-root> caller-supplied default. The default itself is computed once at the call site (seedefault_session_root); passing it in keeps this function pure and unit-testable without env-var manipulation. - resolve_
session_ root_ for_ cli - Same cascade as
resolve_session_root, but suitable for read-only session commands (ls,logs,discard) that may run outside any repo. Skips the validation+merge thatConfig::loadperforms (we only need thesession-rootkey) and degrades silently when the repo or global config file is missing – the user might have neither and just want the XDG default.