Skip to content

feat: cli timeline <session_id> generates markdown session log#48

Open
jakduch wants to merge 5 commits into
josepe98:mainfrom
jakduch:feat/cli-timeline
Open

feat: cli timeline <session_id> generates markdown session log#48
jakduch wants to merge 5 commits into
josepe98:mainfrom
jakduch:feat/cli-timeline

Conversation

@jakduch
Copy link
Copy Markdown
Collaborator

@jakduch jakduch commented May 23, 2026

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

  • All calcCost() calls pass 6 arguments: (model, inp, out, cache_read, cache_creation, cache_1h)
  • JavaScript template literals use bare backticks (`), not escaped ones (\`)
  • No JS variables referenced before they are defined
  • No new third-party dependencies introduced

Tests

  • python3 -m unittest discover -s tests -v — all passing
  • python3 -m unittest tests.test_browser -v — all passing
  • New behaviour is covered by at least one test

Scope

  • This is a single concern — one feature or fix per PR
  • Only touches existing files (dashboard.py, scanner.py, cli.py, pricing.py, cowork.py, tests/) — or I've explained below why a new file is needed

tests/test_cli_timeline.py is a new file under tests/ covering the new cmd_timeline behaviour (unknown/ambiguous ids, header rendering, turn ordering, tool histogram, --out file writing). No production code lives outside the existing cli.py.

jakduch added 2 commits May 23, 2026 20:46
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.
@josepe98 josepe98 closed this May 25, 2026
@josepe98 josepe98 reopened this May 25, 2026
@josepe98 josepe98 closed this May 25, 2026
@josepe98 josepe98 reopened this May 25, 2026
@josepe98 josepe98 closed this May 25, 2026
@josepe98 josepe98 reopened this May 25, 2026
@josepe98 josepe98 closed this May 25, 2026
@josepe98 josepe98 reopened this May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants