claude-code-log 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- claude_code_log-0.1.0/.claude/settings.local.json +29 -0
- claude_code_log-0.1.0/.github/workflows/ci.yml +39 -0
- claude_code_log-0.1.0/.gitignore +176 -0
- claude_code_log-0.1.0/CHANGELOG.md +73 -0
- claude_code_log-0.1.0/CLAUDE.md +78 -0
- claude_code_log-0.1.0/LICENSE +21 -0
- claude_code_log-0.1.0/PKG-INFO +212 -0
- claude_code_log-0.1.0/README.md +194 -0
- claude_code_log-0.1.0/claude_code_log/__init__.py +1 -0
- claude_code_log-0.1.0/claude_code_log/cli.py +147 -0
- claude_code_log-0.1.0/claude_code_log/converter.py +709 -0
- claude_code_log-0.1.0/claude_code_log/models.py +154 -0
- claude_code_log-0.1.0/claude_code_log/py.typed +0 -0
- claude_code_log-0.1.0/claude_code_log/templates/index.html +126 -0
- claude_code_log-0.1.0/claude_code_log/templates/transcript.html +309 -0
- claude_code_log-0.1.0/justfile +21 -0
- claude_code_log-0.1.0/pyproject.toml +72 -0
- claude_code_log-0.1.0/scripts/generate_style_guide.py +517 -0
- claude_code_log-0.1.0/scripts/style_guide_output/index.html +103 -0
- claude_code_log-0.1.0/scripts/style_guide_output/index_style_guide.html +159 -0
- claude_code_log-0.1.0/scripts/style_guide_output/transcript_style_guide.html +334 -0
- claude_code_log-0.1.0/test/README.md +161 -0
- claude_code_log-0.1.0/test/__init__.py +0 -0
- claude_code_log-0.1.0/test/test_command_handling.py +66 -0
- claude_code_log-0.1.0/test/test_data/combined_transcripts.html +565 -0
- claude_code_log-0.1.0/test/test_data/edge_cases.html +437 -0
- claude_code_log-0.1.0/test/test_data/edge_cases.jsonl +12 -0
- claude_code_log-0.1.0/test/test_data/representative_messages.html +472 -0
- claude_code_log-0.1.0/test/test_data/representative_messages.jsonl +12 -0
- claude_code_log-0.1.0/test/test_data/session_b.jsonl +3 -0
- claude_code_log-0.1.0/test/test_date_filtering.py +173 -0
- claude_code_log-0.1.0/test/test_filtering.py +150 -0
- claude_code_log-0.1.0/test/test_markdown_rendering.py +56 -0
- claude_code_log-0.1.0/test/test_message_filtering.py +182 -0
- claude_code_log-0.1.0/test/test_message_types.py +67 -0
- claude_code_log-0.1.0/test/test_path_conversion.py +38 -0
- claude_code_log-0.1.0/test/test_template_data.py +329 -0
- claude_code_log-0.1.0/test/test_template_rendering.py +316 -0
- claude_code_log-0.1.0/test/test_template_utils.py +246 -0
- claude_code_log-0.1.0/uv.lock +435 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(python test:*)",
|
|
5
|
+
"Bash(uv sync:*)",
|
|
6
|
+
"Bash(uv run:*)",
|
|
7
|
+
"Bash(mkdir:*)",
|
|
8
|
+
"Bash(mv:*)",
|
|
9
|
+
"Bash(ruff check:*)",
|
|
10
|
+
"Bash(ruff format:*)",
|
|
11
|
+
"Bash(cat:*)",
|
|
12
|
+
"Bash(grep:*)",
|
|
13
|
+
"Bash(jq:*)",
|
|
14
|
+
"Bash(open test_tool_example.html)",
|
|
15
|
+
"Bash(uv lock:*)",
|
|
16
|
+
"Bash(source:*)",
|
|
17
|
+
"Bash(pytest:*)",
|
|
18
|
+
"Bash(rm:*)",
|
|
19
|
+
"Bash(uv pip install:*)",
|
|
20
|
+
"Bash(uv add:*)",
|
|
21
|
+
"Bash(python:*)",
|
|
22
|
+
"Bash(ls:*)",
|
|
23
|
+
"Bash(chmod:*)",
|
|
24
|
+
"Bash(rg:*)",
|
|
25
|
+
"Bash(act:*)"
|
|
26
|
+
],
|
|
27
|
+
"deny": []
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [ main ]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
python-version: ["3.12", "3.13"]
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- name: Install uv
|
|
19
|
+
uses: astral-sh/setup-uv@v4
|
|
20
|
+
with:
|
|
21
|
+
enable-cache: true
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
run: uv python install ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: uv sync --all-extras --dev
|
|
28
|
+
|
|
29
|
+
- name: Run tests
|
|
30
|
+
run: uv run pytest
|
|
31
|
+
|
|
32
|
+
- name: Run linting
|
|
33
|
+
run: uv run ruff check
|
|
34
|
+
|
|
35
|
+
- name: Run formatting check
|
|
36
|
+
run: uv run ruff format --check
|
|
37
|
+
|
|
38
|
+
- name: Run type checking
|
|
39
|
+
run: uv run pyright
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
|
|
110
|
+
# pdm
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
112
|
+
#pdm.lock
|
|
113
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
114
|
+
# in version control.
|
|
115
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
116
|
+
.pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
121
|
+
__pypackages__/
|
|
122
|
+
|
|
123
|
+
# Celery stuff
|
|
124
|
+
celerybeat-schedule
|
|
125
|
+
celerybeat.pid
|
|
126
|
+
|
|
127
|
+
# SageMath parsed files
|
|
128
|
+
*.sage.py
|
|
129
|
+
|
|
130
|
+
# Environments
|
|
131
|
+
.env
|
|
132
|
+
.venv
|
|
133
|
+
env/
|
|
134
|
+
venv/
|
|
135
|
+
ENV/
|
|
136
|
+
env.bak/
|
|
137
|
+
venv.bak/
|
|
138
|
+
|
|
139
|
+
# Spyder project settings
|
|
140
|
+
.spyderproject
|
|
141
|
+
.spyproject
|
|
142
|
+
|
|
143
|
+
# Rope project settings
|
|
144
|
+
.ropeproject
|
|
145
|
+
|
|
146
|
+
# mkdocs documentation
|
|
147
|
+
/site
|
|
148
|
+
|
|
149
|
+
# mypy
|
|
150
|
+
.mypy_cache/
|
|
151
|
+
.dmypy.json
|
|
152
|
+
dmypy.json
|
|
153
|
+
|
|
154
|
+
# Pyre type checker
|
|
155
|
+
.pyre/
|
|
156
|
+
|
|
157
|
+
# pytype static type analyzer
|
|
158
|
+
.pytype/
|
|
159
|
+
|
|
160
|
+
# Cython debug symbols
|
|
161
|
+
cython_debug/
|
|
162
|
+
|
|
163
|
+
# PyCharm
|
|
164
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
165
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
166
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
167
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
168
|
+
#.idea/
|
|
169
|
+
|
|
170
|
+
# Ruff stuff:
|
|
171
|
+
.ruff_cache/
|
|
172
|
+
|
|
173
|
+
# PyPI configuration file
|
|
174
|
+
.pypirc
|
|
175
|
+
|
|
176
|
+
.examples
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to claude-code-log will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Summary Message Support**: Added support for `summary` type messages in JSONL transcripts
|
|
13
|
+
- Summary messages are displayed with green styling and "Summary:" prefix
|
|
14
|
+
- Includes special CSS class `.summary` for custom styling
|
|
15
|
+
|
|
16
|
+
- **System Command Visibility**: System commands (like `init`) are now shown instead of being filtered out
|
|
17
|
+
- Commands appear in expandable `<details>` elements
|
|
18
|
+
- Shows command name in the summary (e.g., "Command: init")
|
|
19
|
+
- Full command content is revealed when expanded
|
|
20
|
+
- Uses orange styling with `.system` CSS class
|
|
21
|
+
|
|
22
|
+
- **Markdown Rendering Support**: Automatic client-side markdown rendering
|
|
23
|
+
- Uses marked.js ESM module loaded from CDN
|
|
24
|
+
- Supports GitHub Flavored Markdown (GFM)
|
|
25
|
+
- Renders headers, emphasis, code blocks, lists, links, and images
|
|
26
|
+
- Preserves existing HTML content when present
|
|
27
|
+
|
|
28
|
+
- **Enhanced CSS Styling**: New styles for better visual organization
|
|
29
|
+
- Added styles for `.summary` messages (green theme)
|
|
30
|
+
- Added styles for `.system` messages (orange theme)
|
|
31
|
+
- Added styles for `<details>` elements with proper spacing and cursor behavior
|
|
32
|
+
- Improved overall visual hierarchy
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- **System Message Filtering**: Modified system message handling logic
|
|
37
|
+
- System messages with `<command-name>` tags are no longer filtered out
|
|
38
|
+
- Added `extract_command_name()` function to parse command names
|
|
39
|
+
- Updated `is_system_message()` function to handle command messages differently
|
|
40
|
+
- Other system messages (stdout, caveats) are still filtered as before
|
|
41
|
+
|
|
42
|
+
- **Message Type Support**: Extended message type handling in `load_transcript()`
|
|
43
|
+
- Now accepts `"summary"` type in addition to `"user"` and `"assistant"`
|
|
44
|
+
- Updated message processing logic to handle different content structures
|
|
45
|
+
|
|
46
|
+
### Technical
|
|
47
|
+
|
|
48
|
+
- **Dependencies**: No new Python dependencies added
|
|
49
|
+
- marked.js is loaded via CDN for client-side rendering
|
|
50
|
+
- Maintains existing minimal dependency approach
|
|
51
|
+
|
|
52
|
+
- **Testing**: Added comprehensive test coverage
|
|
53
|
+
- New test file `test_new_features.py` with tests for:
|
|
54
|
+
- Summary message type support
|
|
55
|
+
- System command message handling
|
|
56
|
+
- Markdown script inclusion
|
|
57
|
+
- System message filtering behavior
|
|
58
|
+
- Tests use anonymized fixtures based on real transcript data
|
|
59
|
+
|
|
60
|
+
- **Code Quality**: Improved type hints and function documentation
|
|
61
|
+
- Added proper docstrings for new functions
|
|
62
|
+
- Enhanced error handling for edge cases
|
|
63
|
+
- Maintained backward compatibility with existing functionality
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
|
|
67
|
+
- **Message Processing**: Improved robustness of message content extraction
|
|
68
|
+
- Better handling of mixed content types in transcript files
|
|
69
|
+
- More reliable text extraction from complex message structures
|
|
70
|
+
|
|
71
|
+
## Previous Versions
|
|
72
|
+
|
|
73
|
+
Earlier versions focused on basic JSONL to HTML conversion with session demarcation and date filtering capabilities.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Claude Code Log
|
|
2
|
+
|
|
3
|
+
A Python CLI tool that converts Claude transcript JSONL files into readable HTML format.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
This tool processes Claude Code transcript files (stored as JSONL) and generates clean, minimalist HTML pages showing user prompts chronologically. It's designed to create a readable log of your Claude interactions.
|
|
8
|
+
|
|
9
|
+
## Key Features
|
|
10
|
+
|
|
11
|
+
- **Single File or Directory Processing**: Convert individual JSONL files or entire directories
|
|
12
|
+
- **Chronological Ordering**: All messages sorted by timestamp across sessions
|
|
13
|
+
- **Session Demarcation**: Clear visual separators between different transcript sessions
|
|
14
|
+
- **User-Focused**: Shows only user messages by default (assistant responses filtered out)
|
|
15
|
+
- **Date Range Filtering**: Filter messages by date range using natural language (e.g., "today", "yesterday", "last week")
|
|
16
|
+
- **Space-Efficient Layout**: Compact design optimized for content density
|
|
17
|
+
- **CLI Interface**: Simple command-line tool using Click
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Single file
|
|
23
|
+
claude-code-log transcript.jsonl
|
|
24
|
+
|
|
25
|
+
# Entire directory
|
|
26
|
+
claude-code-log /path/to/transcript/directory
|
|
27
|
+
|
|
28
|
+
# Custom output location
|
|
29
|
+
claude-code-log /path/to/directory -o combined_transcripts.html
|
|
30
|
+
|
|
31
|
+
# Open in browser after conversion
|
|
32
|
+
claude-code-log /path/to/directory --open-browser
|
|
33
|
+
|
|
34
|
+
# Filter by date range (supports natural language)
|
|
35
|
+
claude-code-log /path/to/directory --from-date "yesterday" --to-date "today"
|
|
36
|
+
claude-code-log /path/to/directory --from-date "last week"
|
|
37
|
+
claude-code-log /path/to/directory --to-date "2025-06-01"
|
|
38
|
+
claude-code-log /path/to/directory --from-date "3 days ago" --to-date "yesterday"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## File Structure
|
|
42
|
+
|
|
43
|
+
- `claude_code_log/converter.py` - Core conversion logic
|
|
44
|
+
- `claude_code_log/cli.py` - Command-line interface
|
|
45
|
+
- `pyproject.toml` - Project configuration with Click dependency
|
|
46
|
+
|
|
47
|
+
## Development
|
|
48
|
+
|
|
49
|
+
The project uses:
|
|
50
|
+
|
|
51
|
+
- Python 3.12+
|
|
52
|
+
- Click for CLI
|
|
53
|
+
- dateparser for natural language date parsing
|
|
54
|
+
- Standard library for JSON/HTML processing
|
|
55
|
+
|
|
56
|
+
## Development Commands
|
|
57
|
+
|
|
58
|
+
### Testing
|
|
59
|
+
|
|
60
|
+
Run tests with:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
uv run pytest
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Code Quality
|
|
67
|
+
|
|
68
|
+
- **Format code**: `ruff format`
|
|
69
|
+
- **Lint and fix**: `ruff check --fix`
|
|
70
|
+
- **Type checking**: `uv run pyright`
|
|
71
|
+
|
|
72
|
+
### Testing & Style Guide
|
|
73
|
+
|
|
74
|
+
- **Unit Tests**: See [test/README.md](test/README.md) for comprehensive testing documentation
|
|
75
|
+
- **Visual Style Guide**: `uv run python scripts/generate_style_guide.py`
|
|
76
|
+
- **Manual Testing**: Use representative test data in `test/test_data/`
|
|
77
|
+
|
|
78
|
+
Test with Claude transcript JSONL files typically found in `~/.claude/projects/` directories.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Daniel Demmel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: claude-code-log
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Convert Claude transcript JSONL files to HTML
|
|
5
|
+
Project-URL: Homepage, https://github.com/daaain/claude-code-log
|
|
6
|
+
Project-URL: Issues, https://github.com/daaain/claude-code-log/issues
|
|
7
|
+
Author-email: Daniel Demmel <hello@danieldemmel.me>, "Edward Z. Yang" <ezyang@mit.edu>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: >=3.12
|
|
13
|
+
Requires-Dist: click>=8.0.0
|
|
14
|
+
Requires-Dist: dateparser>=1.0.0
|
|
15
|
+
Requires-Dist: jinja2>=3.0.0
|
|
16
|
+
Requires-Dist: pydantic>=2.0.0
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# Claude Code Log
|
|
20
|
+
|
|
21
|
+
A Python CLI tool that converts Claude transcript JSONL files into readable HTML format.
|
|
22
|
+
|
|
23
|
+
## Project Overview
|
|
24
|
+
|
|
25
|
+
This tool processes Claude Code transcript files (stored as JSONL) and generates clean, minimalist HTML pages showing user prompts chronologically. It's designed to create a readable log of your Claude interactions with support for both individual files and entire project hierarchies.
|
|
26
|
+
|
|
27
|
+
## Key Features
|
|
28
|
+
|
|
29
|
+
- **Project Hierarchy Processing**: Process entire `~/.claude/projects/` directory with linked index page
|
|
30
|
+
- **Single File or Directory Processing**: Convert individual JSONL files or specific directories
|
|
31
|
+
- **Chronological Ordering**: All messages sorted by timestamp across sessions
|
|
32
|
+
- **Session Demarcation**: Clear visual separators between different transcript sessions
|
|
33
|
+
- **User-Focused**: Shows only user messages by default (assistant responses filtered out)
|
|
34
|
+
- **Date Range Filtering**: Filter messages by date range using natural language (e.g., "today", "yesterday", "last week")
|
|
35
|
+
- **Summary Support**: Display summary messages with highlighted formatting
|
|
36
|
+
- **System Command Visibility**: Show system commands (like `init`) in expandable details
|
|
37
|
+
- **Markdown Rendering**: Automatic markdown rendering in message content using marked.js
|
|
38
|
+
- **Project Navigation**: Master index page with project statistics and quick navigation
|
|
39
|
+
- **Space-Efficient Layout**: Compact design optimized for content density
|
|
40
|
+
- **CLI Interface**: Simple command-line tool using Click
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
### Default Behavior (Process All Projects)
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Process all projects in ~/.claude/projects/ (default behavior)
|
|
48
|
+
claude-code-log
|
|
49
|
+
|
|
50
|
+
# Explicitly process all projects
|
|
51
|
+
claude-code-log --all-projects
|
|
52
|
+
|
|
53
|
+
# Process all projects and open in browser
|
|
54
|
+
claude-code-log --open-browser
|
|
55
|
+
|
|
56
|
+
# Process all projects with date filtering
|
|
57
|
+
claude-code-log --from-date "yesterday" --to-date "today"
|
|
58
|
+
claude-code-log --from-date "last week"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This creates:
|
|
62
|
+
|
|
63
|
+
- `~/.claude/projects/index.html` - Master index with project cards and statistics
|
|
64
|
+
- `~/.claude/projects/project-name/combined_transcripts.html` - Individual project pages
|
|
65
|
+
|
|
66
|
+
### Single File or Directory Processing
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Single file
|
|
70
|
+
claude-code-log transcript.jsonl
|
|
71
|
+
|
|
72
|
+
# Specific directory
|
|
73
|
+
claude-code-log /path/to/transcript/directory
|
|
74
|
+
|
|
75
|
+
# Custom output location
|
|
76
|
+
claude-code-log /path/to/directory -o combined_transcripts.html
|
|
77
|
+
|
|
78
|
+
# Open in browser after conversion
|
|
79
|
+
claude-code-log /path/to/directory --open-browser
|
|
80
|
+
|
|
81
|
+
# Filter by date range (supports natural language)
|
|
82
|
+
claude-code-log /path/to/directory --from-date "yesterday" --to-date "today"
|
|
83
|
+
claude-code-log /path/to/directory --from-date "3 days ago" --to-date "yesterday"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## File Structure
|
|
87
|
+
|
|
88
|
+
- `claude_code_log/converter.py` - Core conversion logic and hierarchy processing
|
|
89
|
+
- `claude_code_log/cli.py` - Command-line interface with project discovery
|
|
90
|
+
- `claude_code_log/models.py` - Pydantic models for transcript parsing
|
|
91
|
+
- `pyproject.toml` - Project configuration with dependencies
|
|
92
|
+
|
|
93
|
+
## Development
|
|
94
|
+
|
|
95
|
+
The project uses:
|
|
96
|
+
|
|
97
|
+
- Python 3.12+ with uv package management
|
|
98
|
+
- Click for CLI interface and argument parsing
|
|
99
|
+
- Pydantic for robust data modeling and validation
|
|
100
|
+
- dateparser for natural language date parsing
|
|
101
|
+
- Standard library for JSON/HTML processing
|
|
102
|
+
- Minimal dependencies for portability
|
|
103
|
+
- marked.js (CDN) for client-side markdown rendering
|
|
104
|
+
|
|
105
|
+
## Development Commands
|
|
106
|
+
|
|
107
|
+
### Testing
|
|
108
|
+
|
|
109
|
+
Run tests with:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
uv run pytest
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Comprehensive Testing & Style Guide**: The project includes extensive testing infrastructure and visual documentation. See [test/README.md](test/README.md) for details on:
|
|
116
|
+
|
|
117
|
+
- **Unit Tests**: Template rendering, message type handling, edge cases
|
|
118
|
+
- **Visual Style Guide**: Interactive documentation showing all message types
|
|
119
|
+
- **Representative Test Data**: Real-world JSONL samples for development
|
|
120
|
+
- **Style Guide Generation**: Create visual documentation with `uv run python scripts/generate_style_guide.py`
|
|
121
|
+
|
|
122
|
+
### Code Quality
|
|
123
|
+
|
|
124
|
+
- **Format code**: `ruff format`
|
|
125
|
+
- **Lint and fix**: `ruff check --fix`
|
|
126
|
+
- **Type checking**: `uv run pyright`
|
|
127
|
+
|
|
128
|
+
### All Commands
|
|
129
|
+
|
|
130
|
+
- **Test**: `uv run pytest`
|
|
131
|
+
- **Format**: `ruff format`
|
|
132
|
+
- **Lint**: `ruff check --fix`
|
|
133
|
+
- **Type Check**: `uv run pyright`
|
|
134
|
+
- **Generate Style Guide**: `uv run python scripts/generate_style_guide.py`
|
|
135
|
+
|
|
136
|
+
Test with Claude transcript JSONL files typically found in `~/.claude/projects/` directories.
|
|
137
|
+
|
|
138
|
+
## Project Hierarchy Output
|
|
139
|
+
|
|
140
|
+
When processing all projects, the tool generates:
|
|
141
|
+
|
|
142
|
+
```sh
|
|
143
|
+
~/.claude/projects/
|
|
144
|
+
├── index.html # Master index with project cards
|
|
145
|
+
├── project1/
|
|
146
|
+
│ └── combined_transcripts.html # Individual project page
|
|
147
|
+
├── project2/
|
|
148
|
+
│ └── combined_transcripts.html
|
|
149
|
+
└── ...
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Index Page Features
|
|
153
|
+
|
|
154
|
+
- **Project Cards**: Each project shown as a clickable card with statistics
|
|
155
|
+
- **Summary Statistics**: Total projects, transcript files, and message counts
|
|
156
|
+
- **Recent Activity**: Projects sorted by last modification date
|
|
157
|
+
- **Quick Navigation**: One-click access to any project's detailed transcript
|
|
158
|
+
- **Clean URLs**: Readable project names converted from directory names
|
|
159
|
+
|
|
160
|
+
## Message Types Supported
|
|
161
|
+
|
|
162
|
+
- **User Messages**: Regular user inputs and prompts
|
|
163
|
+
- **Assistant Messages**: Claude's responses (when not filtered)
|
|
164
|
+
- **Summary Messages**: Session summaries with special formatting
|
|
165
|
+
- **System Commands**: Commands like `init` shown in expandable details
|
|
166
|
+
- **Tool Use**: Tool invocations and results with proper formatting
|
|
167
|
+
|
|
168
|
+
## HTML Output Features
|
|
169
|
+
|
|
170
|
+
- **Responsive Design**: Works on desktop and mobile
|
|
171
|
+
- **Syntax Highlighting**: Code blocks properly formatted
|
|
172
|
+
- **Markdown Support**: Full markdown rendering including:
|
|
173
|
+
- Headers, lists, emphasis
|
|
174
|
+
- Code blocks and inline code
|
|
175
|
+
- Links and images
|
|
176
|
+
- GitHub Flavored Markdown features
|
|
177
|
+
- **Session Navigation**: Clear visual breaks between transcript sessions
|
|
178
|
+
- **Command Visibility**: System commands shown with context but not cluttering the main view
|
|
179
|
+
- **Tool Interactions**: Tool use and results displayed in collapsible sections
|
|
180
|
+
|
|
181
|
+
## Installation
|
|
182
|
+
|
|
183
|
+
Install using pip (coming soon to PyPI):
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
pip install claude-code-log
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Or install from source:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
git clone https://github.com/your-username/claude-code-log.git
|
|
193
|
+
cd claude-code-log
|
|
194
|
+
uv sync
|
|
195
|
+
uv run claude-code-log
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## TODO
|
|
199
|
+
|
|
200
|
+
- ✅ **Project Hierarchy Processing**: Process entire `~/.claude/projects/` with linked navigation
|
|
201
|
+
- ✅ **Master Index Page**: Project cards with statistics and quick navigation
|
|
202
|
+
- **Enhanced UI**: Make it look even nicer with improved styling
|
|
203
|
+
- **GitHub Action CI**: Automated testing and deployment
|
|
204
|
+
- ✅ **Template Refactoring**: Move HTML templates into separate files (use Jinja or similar)
|
|
205
|
+
- Handle thinking tokens
|
|
206
|
+
- Handle pasted images (and text?)
|
|
207
|
+
- **Tool Use Preview**: Show first few lines of tool use and other collapsed details
|
|
208
|
+
- **Rich Metadata**: Render timestamps, durations, token usage, etc.
|
|
209
|
+
- **Session Navigation**: Navigation between sessions within page
|
|
210
|
+
- **In-page Filtering**: Client-side filtering and search
|
|
211
|
+
- **PyPI Publishing**: Push to PyPI with secure token
|
|
212
|
+
- **TodoWrite Rendering**: Render TodoWrite as actual todo list with checkboxes
|