pi-treetime
v1.0.5
Published
/treetime: session tree navigation identical to /tree, with human-readable timestamps on every entry
Maintainers
Readme
pi-treetime
/treetime — session tree navigation for pi, identical to the built-in /tree, except every entry shows a human-readable timestamp. 中文
Features
- 100% identical to
/tree— same navigation, filters, search, folding, labels, copy, and branch summarization flow:↑/↓move,←/→pageCtrl+←/Ctrl+→(orAlt+←/Alt+→) fold branch / jump between branch segmentsEnterselect (with the same "Summarize branch?" prompt, honoring thebranchSummary.skipPromptsetting)Copy messagein the summary prompt: copies the selected message and closes directly, without navigating or touching session stateShift+Lset/clear a label,Shift+Ttoggle label timestampsCtrl+Xcopy the selected messageCtrl+Ocycle filters (default / no-tools / user-only / labeled-only / all), or jump directly withCtrl+D/T/U/L/A- Type to search
- Fires the standard
session_before_tree/session_treeextension hooks
- Timestamps on every entry, in a smart human-readable format:
- today →
HH:MM(e.g.10:30) - this year →
M/D HH:MM(e.g.8/5 16:20) - older →
YY/M/D HH:MM(e.g.25/12/30 09:01)
- today →
Install
pi install npm:pi-treetimeOr copy extensions/pi-treetime into ~/.pi/agent/extensions/ (or .pi/extensions/ for a project).
After installing, run /reload (or restart pi) to activate.
Local development
pi -e ~/.pi/dev/pi-treetime/extensions/pi-treetime/index.tsUsage
Inside pi, type:
/treetimeA session tree opens — the same interface as /tree, with a timestamp on every row. Navigate exactly as you would in /tree: Enter jumps to the selected point (optionally summarizing the abandoned branch), Esc closes.
How it works
- The tree rendering logic is a faithful port of pi's built-in
tree-selector.js(horizontal viewport clipping, folding, search, label editing, filter modes), withtheme/keybindingsinjected and timestamp rendering added. - Timestamps come from each session entry's own
timestampfield (Unix ms or ISO string), displayed in local time. - Since the extension API cannot modify the built-in
/treerendering, the extension draws an equivalent selector viactx.ui.custom()and navigates throughctx.navigateTree(), so branch summaries and event hooks behave exactly like the built-in. - Notifications (e.g. "Navigated to selected point") appear via the standard status UI.
License
MIT
