feat: cli timeline <session_id> generates markdown session log#48
Open
jakduch wants to merge 5 commits into
Open
feat: cli timeline <session_id> generates markdown session log#48jakduch wants to merge 5 commits into
jakduch wants to merge 5 commits into
Conversation
Adds a new `python3 cli.py timeline <session_id> [--out FILE]` command that produces a markdown report for a single session: - H1 header with project, branch, dates, and totals (turns, tokens, cost) - Per-turn list: timestamp, model, tool, in/out tokens, cost - Tool histogram at the bottom Accepts an 8-char (or longer) session-id prefix; clear error on unknown or ambiguous ids. Writes to stdout by default, or to --out FILE. Tests cover stdout output, file output, unknown-id error, and the tool histogram.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this add and why do you believe it belongs in this dashboard?
Adds
python3 cli.py timeline <session_id> [--out FILE], a one-shot generator that replays a single Claude Code session as a time-ordered Markdown log: header (project, branch, full UUID, first/last timestamps, turn count, totals, cost), a chronological list of turns (HH:MM:SS · model · tool · in/out tokens → cost), and a tool histogram. Accepts any unique session-id prefix (4+ chars), errors clearly on unknown or ambiguous ids, and writes to stdout by default or to a file with--out.The dashboard is great for grazing across all sessions, but when something goes wrong in one session you want a flat, greppable, shareable artifact — not a screenshot of a webview. This gives you exactly that with zero new dependencies: a postmortem document you can paste into a GitHub issue, attach to a bug report, diff between two runs, or feed back into Claude when asking "what did I do here?". It also makes the existing turn-level data the scanner already collects directly addressable from the CLI, which is the natural home for ad-hoc, scriptable workflows.
Checklist
Code correctness
calcCost()calls pass 6 arguments:(model, inp, out, cache_read, cache_creation, cache_1h)`), not escaped ones (\`)Tests
python3 -m unittest discover -s tests -v— all passingpython3 -m unittest tests.test_browser -v— all passingScope
dashboard.py,scanner.py,cli.py,pricing.py,cowork.py,tests/) — or I've explained below why a new file is neededtests/test_cli_timeline.pyis a new file undertests/covering the newcmd_timelinebehaviour (unknown/ambiguous ids, header rendering, turn ordering, tool histogram,--outfile writing). No production code lives outside the existingcli.py.