Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
06ceebe
Add ANSI escape code sanitization and content-block array rendering
ShlomoStept Dec 31, 2025
2f0fcd9
Add copy buttons to code blocks and tool results
ShlomoStept Dec 31, 2025
509c98f
Add syntax highlighting with Pygments for code blocks
ShlomoStept Dec 31, 2025
c4f3d92
Update TASKS.md and AGENTS.md with comprehensive documentation
ShlomoStept Dec 31, 2025
5e9574c
Render content-block arrays fully
ShlomoStept Dec 31, 2025
27db54a
Harden ANSI escape sanitization
ShlomoStept Dec 31, 2025
78cd6d5
Pair tool_use with tool_result
ShlomoStept Dec 31, 2025
89fa8c7
Format code and update snapshots after merge
ShlomoStept Dec 31, 2025
6abe6cd
Start Phase 2: collapsible cells and tool markdown
ShlomoStept Jan 1, 2026
b2223ce
Add Markdown rendering for tool descriptions and JSON string values
ShlomoStept Jan 1, 2026
8318701
Add collapsible cell structure for assistant messages
ShlomoStept Jan 1, 2026
e56875e
Add per-cell copy buttons for collapsible sections
ShlomoStept Jan 1, 2026
e88c1c7
Add UI improvements for collapsible cells and tool rendering
ShlomoStept Jan 1, 2026
4925817
Implement comprehensive UI improvements for Phase 2
ShlomoStept Jan 1, 2026
4113031
Fix JSON display mode and tabs alignment regressions
ShlomoStept Jan 1, 2026
3208326
Implement Phase 2 remaining items: metadata subsection and tool icons
ShlomoStept Jan 1, 2026
7cbfbba
Fix duplicate test method by renaming to unique name
ShlomoStept Jan 6, 2026
a3076ee
Refactor _github_repo to thread-safe contextvars
ShlomoStept Jan 6, 2026
ff4df78
Add Clipboard API fallback for older browsers
ShlomoStept Jan 6, 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
162 changes: 154 additions & 8 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,161 @@
Uses uv. Run tests like this:
# Development Guide

uv run pytest
This guide covers everything needed to contribute to claude-code-transcripts.

Run the development version of the tool like this:
## Quick Start

uv run claude-code-transcripts --help
```bash
# Clone and setup
git clone https://github.com/simonw/claude-code-transcripts.git
cd claude-code-transcripts

Always practice TDD: write a faliing test, watch it fail, then make it pass.
# Install uv if not already installed
# See: https://docs.astral.sh/uv/

Commit early and often. Commits should bundle the test, implementation, and documentation changes together.
# Install dependencies
uv sync --group dev

Run Black to format code before you commit:
# Run tests
uv run pytest

uv run black .
# Run the development version
uv run claude-code-transcripts --help
```

## Project Structure

```
claude-code-transcripts/
├── src/claude_code_transcripts/
│ ├── __init__.py # Main implementation
│ └── templates/ # Jinja2 templates
│ ├── macros.html # Reusable macros
│ ├── page.html # Page template
│ ├── index.html # Index template
│ ├── base.html # Base template
│ └── search.js # Client-side search
├── tests/
│ ├── test_generate_html.py # Main test suite
│ ├── test_all.py # Batch command tests
│ ├── sample_session.json # Test fixture (JSON)
│ ├── sample_session.jsonl # Test fixture (JSONL)
│ └── __snapshots__/ # Snapshot test outputs
├── TASKS.md # Implementation roadmap
├── AGENTS.md # This file
└── pyproject.toml # Package configuration
```

## Running Tests

```bash
# Run all tests
uv run pytest

# Run specific test file
uv run pytest tests/test_generate_html.py

# Run specific test class
uv run pytest tests/test_generate_html.py::TestRenderContentBlock

# Run specific test
uv run pytest tests/test_generate_html.py::TestRenderContentBlock::test_text_block -v

# Run with verbose output
uv run pytest -v

# Run with stdout capture disabled (for debugging)
uv run pytest -s
```

## Code Formatting

Format code with Black before committing:

```bash
uv run black .
```

Check formatting without making changes:

```bash
uv run black . --check
```

## Test-Driven Development (TDD)

Always practice TDD: write a failing test, watch it fail, then make it pass.

1. Write a failing test for your change
2. Run tests to confirm it fails: `uv run pytest`
3. Implement the feature to make the test pass
4. Format your code: `uv run black .`
5. Run all tests to ensure nothing broke
6. Commit with a descriptive message

## Snapshot Testing

This project uses `syrupy` for snapshot testing. Snapshots are stored in `tests/__snapshots__/`.

Update snapshots when intentionally changing output:

```bash
uv run pytest --snapshot-update
```

## Making Changes

### Commit Guidelines

Commit early and often. Each commit should bundle:
- The test
- The implementation
- Documentation changes (if applicable)

Example commit message:
```
Add support for filtering sessions by date

- Add --since and --until flags to local command
- Filter sessions by modification time
- Add tests for date filtering
```

### Before Submitting a PR

1. All tests pass: `uv run pytest`
2. Code is formatted: `uv run black .`
3. Documentation updated if adding user-facing features
4. TASKS.md updated if completing a tracked task

## Key Files Reference

| File | Purpose |
|------|---------|
| `src/claude_code_transcripts/__init__.py` | Main implementation (~1300 lines) |
| `src/claude_code_transcripts/templates/macros.html` | Jinja2 macros for rendering |
| `tests/test_generate_html.py` | Main test suite |
| `tests/sample_session.json` | Test fixture data |
| `TASKS.md` | Implementation roadmap and status |

## Debugging Tips

```bash
# See full assertion output
uv run pytest -vv

# Stop on first failure
uv run pytest -x

# Run only failed tests from last run
uv run pytest --lf

# Run tests matching a pattern
uv run pytest -k "test_ansi"
```

## Architecture Notes

- CSS and JavaScript are embedded as string constants in `__init__.py`
- Templates use Jinja2 with autoescape enabled
- The `_macros` module exposes macros from `macros.html`
- Tool rendering follows the pattern: Python function → Jinja2 macro → HTML
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies = [
"httpx",
"jinja2",
"markdown",
"pygments>=2.17.0",
"questionary",
]

Expand All @@ -32,6 +33,7 @@ build-backend = "uv_build"

[dependency-groups]
dev = [
"black>=24.0.0",
"pytest>=9.0.2",
"pytest-httpx>=0.35.0",
"syrupy>=5.0.0",
Expand Down
Loading
Loading