Skip to content

v0.6.1: show project + session id in the UI header#5

Merged
lroolle merged 1 commit into
mainfrom
feat/header-run-identity
Jul 10, 2026
Merged

v0.6.1: show project + session id in the UI header#5
lroolle merged 1 commit into
mainfrom
feat/header-run-identity

Conversation

@lroolle

@lroolle lroolle commented Jul 10, 2026

Copy link
Copy Markdown
Member

What

The page never said which run you were looking at — with two live UIs open or a folder of snapshots, telling them apart meant reading URLs out of pair rows. The header now carries the run identity:

  • Project name — the directory cctrace ran in (basename, full path on hover). Injected as PageMeta by the live server and the exit-snapshot writer; cctrace view rebuilds pass no meta (the original cwd is not recorded in the trace) and degrade to session-only.
  • Current Claude session id — extracted client-side from the pairs (newest live pair wins over prior-run merges), short form with the full id on hover, click to copy.
  • Tab title becomes <project> · cctrace so multiple live UIs are tellable apart in the tab bar.

How

  • extractSessionId joins the summarize.ts inline set (same toString() pattern as the rest — unit-tested once, identical live and in snapshots).
  • META goes through jsonForScript, so a hostile cwd (</script> in a path) cannot break out of the script tag — regression-tested.
  • getLiveHtml(port, meta) / renderSnapshot(pairs, meta) — both optional, {} keeps old behavior.

Tests

  • 4 new tests (META embed, {} default, script-tag escape, inline presence): 146/146 pass.
  • Smoke against the compiled binary: live page and exit snapshot both embed the project META; extractSessionId inlining survives bun build --compile; a stubbed-DOM run of the emitted page script renders cctrace · 365ad98d with the live pair winning over prior-run pairs.

🤖 Generated with Claude Code

The page never said which run you were looking at — with two live UIs or
a folder of snapshots, telling them apart meant reading URLs out of pair
rows. The header now carries the run identity:

- project name = the directory cctrace ran in (basename; full path on
  hover), injected as PageMeta by the live server and the exit-snapshot
  writer. `cctrace view` rebuilds pass no meta — the original cwd is not
  recorded in the trace.
- current Claude session id, extracted client-side from the pairs
  (newest live pair wins over prior-run merges), short form with the
  full id on hover and click-to-copy.
- tab title becomes `<project> · cctrace` so multiple live UIs are
  tellable apart in the tab bar.

extractSessionId joins the summarize.ts inline set, so snapshots get the
same header without drift; META goes through jsonForScript (a hostile
cwd can't close the script tag — regression-tested).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lroolle lroolle merged commit 2158c61 into main Jul 10, 2026
1 check passed
@lroolle lroolle deleted the feat/header-run-identity branch July 10, 2026 11:02
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.

1 participant