Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
58d542b
Add code viewer with git blame-style annotations
btucker Dec 27, 2025
1959dec
Fix JSON escaping in code viewer to prevent script injection
btucker Dec 27, 2025
d076aaf
Simplify code viewer to diff-only mode
btucker Dec 27, 2025
a27d922
Add progress indicator for large page rendering
btucker Dec 27, 2025
53cfbf7
Add three-pane code viewer with git-based blame and full transcript
btucker Dec 28, 2025
1f1c9ae
Simplify file detection with per-file git repo lookup
btucker Dec 28, 2025
4e78390
Add chunked rendering for transcript pane performance
btucker Dec 28, 2025
aecc019
Skip blame highlighting for pre-existing content
btucker Dec 28, 2025
d2404e8
Add overflow hidden to index item containers
btucker Dec 28, 2025
c2cfa01
Fix truncation for dynamically rendered messages
btucker Dec 28, 2025
c571051
Fix blame highlighting to only color actually changed lines
btucker Dec 28, 2025
183c9fa
Add tests for git-based blame attribution
btucker Dec 28, 2025
1592307
Add scrollbar minimap showing blame range locations
btucker Dec 28, 2025
ff535c6
currently non-functional codemirror state
btucker Dec 28, 2025
617ae5e
Extract code_view.py module from __init__.py
btucker Dec 28, 2025
13d5516
Apply DRY refactorings: CSS template, helpers for grouping and colors
btucker Dec 28, 2025
e44272e
Fix JSON escaping for script tag embedding
btucker Dec 28, 2025
a01b324
resolved issue when reconstructing file state from edit operations, i…
btucker Dec 28, 2025
97e5a00
include the prompt number in the code view
btucker Dec 28, 2025
5e2aa58
handling continuation messages properly
btucker Dec 28, 2025
11882a0
update readme
btucker Dec 28, 2025
e860505
Fix blame highlighting and strip common prefix from file tree
btucker Dec 28, 2025
e0a280c
Handle empty git repo in get_file_content_from_repo
btucker Dec 28, 2025
ca2bc04
Extract originalFile from tool results for remote session support
btucker Dec 28, 2025
a86705f
Fix JSONL parsing to preserve toolUseResult for remote sessions
btucker Dec 28, 2025
7ebad63
Add test for JSONL parsing preserving toolUseResult
btucker Dec 28, 2025
75b01da
Treat skill expansions (isMeta) as continuations for prompt numbering
btucker Dec 28, 2025
bf60b03
Add test for isMeta field preservation in JSONL parsing
btucker Dec 28, 2025
75c7035
Assign blame colors by prompt number, not by operation
btucker Dec 29, 2025
f0bf40d
Show assistant context in code viewer tooltips
btucker Dec 29, 2025
45bf3ac
Include thinking blocks in code viewer tooltips
btucker Dec 29, 2025
66a8fad
Fix thinking block persistence across messages in tooltips
btucker Dec 29, 2025
6386951
Add test coverage for build_msg_to_user_html tooltip generation
btucker Dec 29, 2025
0f6dd5b
Accumulate tooltip context blocks across messages
btucker Dec 29, 2025
c30d2c9
Keep only most recent thinking and text blocks in tooltips
btucker Dec 29, 2025
f210d2c
Color blame sections by assistant context message ID
btucker Dec 29, 2025
155f5c4
Fix edit resync using original_content when reconstruction diverges
btucker Dec 29, 2025
f63140b
Add transcript-to-code navigation and improve tooltip rendering
btucker Dec 29, 2025
2ce7e59
Add end-to-end tests for code view using Playwright
btucker Dec 29, 2025
8f034e5
Support local file:// access and add shared search header
btucker Dec 29, 2025
3fe65da
Externalize CSS and JS to reduce HTML file sizes
btucker Dec 29, 2025
bdb2521
Exclude code-data.json from gist to reduce API truncation
btucker Dec 29, 2025
7d89b20
Add two-gist strategy for large files to avoid API truncation
btucker Dec 29, 2025
9d95c00
Document two-gist strategy for large sessions in README
btucker Dec 29, 2025
a644582
Consolidate templates: move header into base.html, rename code_view.html
btucker Dec 29, 2025
103c8fb
Hide minimap when code doesn't need scrolling
btucker Dec 29, 2025
7503cf3
Add e2e tests for minimap visibility behavior
btucker Dec 29, 2025
a8c5fe2
Revert external CSS/JS to inline - simplifies with two-gist strategy
btucker Dec 29, 2025
1272af8
Escape style/script tags in markdown to prevent CSS injection
btucker Dec 29, 2025
afeaf02
Use nh3 HTML sanitizer for proper XSS protection in markdown
btucker Dec 29, 2025
d541b70
Fix JavaScript syntax error from HTML closing tags in embedded JSON
btucker Dec 29, 2025
890c5e1
Fix HTML comment sequences breaking embedded JSON parsing
btucker Dec 29, 2025
f741792
Add line anchor deep-linking support for code view
btucker Dec 29, 2025
c42734f
Add loading indicators for code view initialization and file switching
btucker Dec 29, 2025
1967b3b
Improve loading indicators and skip pinned updates during scrolling
btucker Dec 29, 2025
5d50a85
Always show loading indicator when switching files
btucker Dec 29, 2025
38dc582
Filter deleted files using git repo instead of pre-filtering
btucker Dec 29, 2025
4f2e249
Add failing test for relative paths in rm commands
btucker Dec 29, 2025
fb99c6d
Fix ValueError when rm commands use relative paths
btucker Dec 29, 2025
c2682b8
Add failing tests for filter_deleted_files function
btucker Dec 29, 2025
4e89ea4
Add --exclude-deleted-files flag for code viewer
btucker Dec 29, 2025
3e1a2ed
Document --exclude-deleted-files flag in README
btucker Dec 29, 2025
3f42ce4
Handle large sessions by splitting page data into separate JSON files
btucker Dec 29, 2025
7e86821
remove PR.md
btucker Dec 29, 2025
8c39fc0
Add batched gist uploads and descriptive gist names
btucker Dec 29, 2025
940f423
Add index-data.json for large session index content
btucker Dec 29, 2025
df4e7dc
Use templates to exclude content from HTML in large sessions
btucker Dec 29, 2025
151361f
Include content in HTML for local viewing, strip for gist upload
btucker Dec 29, 2025
0126082
Fix gist upload: add files one at a time instead of batching
btucker Dec 29, 2025
2622e65
Add retry logic and delays for gist file uploads
btucker Dec 29, 2025
628d818
Remove vestigial batching code from gist upload
btucker Dec 29, 2025
02ea004
Because of limitations in gistpreview we have to do some backflips to…
btucker Dec 29, 2025
01a2879
we don't need the fancy css/js loading if it's a small session on gis…
btucker Dec 30, 2025
14f31e3
Fix code view performance: don't auto-scroll transcript
btucker Dec 30, 2025
8034b65
Pre-compute prompt_num and color_index server-side for blame ranges
btucker Dec 30, 2025
6f25b95
Fix clicking blame blocks to scroll transcript to corresponding message
btucker Dec 30, 2025
66f5803
Implement windowed transcript rendering with teleportation
btucker Dec 30, 2025
d1e51f5
Add prompt numbers to user messages and improve pinned header behavior
btucker Dec 30, 2025
8c5f75b
Fix pinned user message flashing when overlapping next prompt
btucker Dec 30, 2025
d08694e
Move prompt number to pinned message label
btucker Dec 30, 2025
f7f93d9
Fix teleport to always render up to target message
btucker Dec 30, 2025
e35fe6c
Fix URL fragment navigation and use bright yellow highlight
btucker Dec 30, 2025
da3972a
Use consistent yellow highlight and skip initial blame highlight
btucker Dec 30, 2025
b7b39b1
Add progress output for code view generation
btucker Dec 30, 2025
ef27068
Clear progress line when switching phases
btucker Dec 30, 2025
ea2d6e6
Change user message heading to "User Prompt #X"
btucker Dec 30, 2025
5aba4e2
Fix prompt number mismatch between tooltip and pinned header
btucker Dec 30, 2025
e0978eb
Fix prompt number counting and pinned click after teleportation
btucker Dec 30, 2025
5114ad8
Use server-provided prompt_num instead of client-side counting
btucker Dec 30, 2025
b73dcf3
Compute all user prompt numbering at build
btucker Dec 30, 2025
607ce99
Code quality improvements to code_view.py
btucker Dec 30, 2025
cb3fe47
Merge upstream/main and adopt URL handling
btucker Dec 30, 2025
58f92a1
Switch from gistpreview to gisthost with simplified JS
claude Dec 31, 2025
c8e8bac
Remove two-gist strategy and page-data JSON generation
claude Dec 31, 2025
e439e24
Merge pull request #1 from btucker/claude/code-viewer-feature-l90XI
btucker Jan 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
__pycache__
uv.lock
.playwright-mcp/
tests/.fixture_cache/
43 changes: 39 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ All commands support these options:

- `-o, --output DIRECTORY` - output directory (default: writes to temp dir and opens browser)
- `-a, --output-auto` - auto-name output subdirectory based on session ID or filename
- `--repo OWNER/NAME` - GitHub repo for commit links (auto-detected from git push output if not specified)
- `--repo PATH|URL|OWNER/NAME` - Git repo for commit links and code viewer. Accepts a local path, GitHub URL, or owner/name format.
- `--open` - open the generated `index.html` in your default browser (default if no `-o` specified)
- `--gist` - upload the generated HTML files to a GitHub Gist and output a preview URL
- `--json` - include the original session file in the output directory
- `--code-view` - generate an interactive code viewer showing all files modified during the session

The generated output includes:
- `index.html` - an index page with a timeline of prompts and commits
- `page-001.html`, `page-002.html`, etc. - paginated transcript pages
- `code.html` - interactive code viewer (when `--code-view` is used)

### Local sessions

Expand Down Expand Up @@ -102,11 +104,11 @@ claude-code-transcripts json session.json --gist
This will output something like:
```
Gist: https://gist.github.com/username/abc123def456
Preview: https://gistpreview.github.io/?abc123def456/index.html
Preview: https://gisthost.github.io/?abc123def456/index.html
Files: /var/folders/.../session-id
```

The preview URL uses [gistpreview.github.io](https://gistpreview.github.io/) to render your HTML gist. The tool automatically injects JavaScript to fix relative links when served through gistpreview.
The preview URL uses [gisthost.github.io](https://gisthost.github.io/) to render your HTML gist. The tool automatically injects JavaScript to fix relative links when served through gisthost (also works with gistpreview.github.io for backward compatibility).

Combine with `-o` to keep a local copy:

Expand All @@ -116,6 +118,36 @@ claude-code-transcripts json session.json -o ./my-transcript --gist

**Requirements:** The `--gist` option requires the [GitHub CLI](https://cli.github.com/) (`gh`) to be installed and authenticated (`gh auth login`).

### Code viewer

Use `--code-view` to generate an interactive three-pane code viewer that shows all files modified during the session:

```bash
# Generate with code viewer from a local session
claude-code-transcripts --code-view

# Point to the actual repo for full file content and blame
claude-code-transcripts --code-view --repo /path/to/repo

# From a URL
claude-code-transcripts json https://example.com/session.jsonl --code-view
```

The code viewer (`code.html`) provides:
- **File tree**: Navigate all files that were written or edited during the session
- **File content**: View file contents with git blame-style annotations showing which prompt modified each line
- **Transcript pane**: Browse the full conversation with links to jump to specific file operations

When you provide `--repo` pointing to the local git repository that was being modified, the code viewer can show the complete file content with accurate blame attribution. Without a repo path, it shows a diff-only view of the changes.

Use `--exclude-deleted-files` to filter out files that no longer exist on disk:

```bash
claude-code-transcripts --code-view --exclude-deleted-files
```

This is useful when files were deleted after the session (either manually or by commands not captured in the transcript).

### Auto-naming output directories

Use `-a/--output-auto` to automatically create a subdirectory named after the session:
Expand Down Expand Up @@ -145,11 +177,14 @@ This is useful for archiving the source data alongside the HTML output.

### Converting from JSON/JSONL files

Convert a specific session file directly:
Convert a specific session file or URL directly:

```bash
claude-code-transcripts json session.json -o output-directory/
claude-code-transcripts json session.jsonl --open

# Fetch and convert from a URL
claude-code-transcripts json https://example.com/session.jsonl --open
```

When using [Claude Code for web](https://claude.ai/code) you can export your session as a `session.json` file using the `teleport` command.
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ requires-python = ">=3.10"
dependencies = [
"click",
"click-default-group",
"gitpython",
"httpx",
"jinja2",
"markdown",
"nh3>=0.3.2",
"questionary",
]

Expand Down
Loading