This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
go install ./cmd/workbenchworkbench share --project "$PWD" --output test.html
open test.htmlThis is a Claude Code plugin that exports conversation threads to shareable HTML files.
-
Session Discovery (
internal/parser/jsonl.go): Locates JSONL session files in~/.claude/projects/{encoded-project-path}/. Project paths are encoded by replacing/and.with-. -
JSONL Parsing (
internal/parser/jsonl.go): Parses Claude Code session files. Each line contains a JSON object with type, uuid, timestamp, and message fields. Content blocks can be text, thinking, tool_use, or tool_result. -
HTML Conversion (
internal/converter/html.go): Converts parsed messages to HTML. Handles:- Tool result merging (inserts results after their corresponding tool_use)
- Markdown rendering (headers, bold, code blocks, lists, links)
- Tool-specific rendering (WebFetch/WebSearch show URLs, Read shows file paths, Bash shows commands with descriptions, Edit shows diffs)
-
Template (
internal/template/template.go): Self-contained HTML template with inline CSS and Prism.js for syntax highlighting.
When multiple Claude Code sessions run in parallel, the plugin uses a SessionStart hook (.claude-plugin/scripts/capture-session.sh) to capture the session ID. The /share slash command (commands/share.md) passes $CLAUDE_SESSION_ID to ensure the correct session is exported.
parser.Message: Parsed message with ID, Role, Timestamp, and Blocksparser.ContentBlock: Content block with Type, Content, ToolName, ToolUseID, ToolInput, IsErrorconverter.Config: HTML generation config with Title, Username, UserInitials, ProjectPath
- do not comment code unless abosolutely necessary
- use
anyinsteadinterface{} - do not use json tags in every struct, create separate struct for marshaling/unmarshaling