Expand description
§Public API
Small pure helpers shared by every cmd_* handler. Stable
contract for downstream W5 closers.
§Surface
ⓘ
pub fn id_short(id: &str) -> &str;
pub fn auto_namespace() -> String;
pub fn human_age(iso: &str) -> String;All three are pure with respect to the DB. auto_namespace calls
git remote get-url origin and reads current_dir, which makes it
environment-dependent — tests should not assume a specific value, only
that the result is non-empty.
Functions§
- auto_
namespace - Best-effort namespace resolver:
- human_
age - Format an RFC3339 timestamp as a short relative age (“just now”, “5m ago”, “3h ago”, “2d ago”, “4mo ago”). Returns the input verbatim if parsing fails — never panics, never throws.
- id_
short - Truncate an ID to the first 8 bytes, snapping back to the nearest UTF-8 char boundary so multi-byte chars never split.