Skip to content

feat(claude-trace): add --no-html flag to skip HTML generation#49

Open
JonKrone wants to merge 3 commits intobadlogic:mainfrom
JonKrone:feature/no-html-flag
Open

feat(claude-trace): add --no-html flag to skip HTML generation#49
JonKrone wants to merge 3 commits intobadlogic:mainfrom
JonKrone:feature/no-html-flag

Conversation

@JonKrone
Copy link

@JonKrone JonKrone commented Nov 6, 2025

Summary

Adds a --no-html CLI flag to disable HTML report generation while preserving JSONL logging. This is useful for reducing file size when archiving conversations or when HTML viewing is not needed.

Use Case

When using claude-trace for conversation archival over extended periods, HTML files consume ~60% more storage than JSONL files. For users who primarily need the raw data (JSONL) and rarely view the HTML reports, this flag enables significant storage savings.

Storage Impact Example:

  • Before: 10 GB total (5.8 GB HTML + 4.2 GB JSONL)
  • After (with --no-html): 4.2 GB total (58% reduction)

Implementation

Follows the existing --no-html pattern established by the --no-open flag:

  1. CLI flag parsing (cli.ts)

    • Added --no-html flag detection
    • Defaults to true (generate HTML) for backwards compatibility
    • Wired through CLAUDE_TRACE_GENERATE_HTML environment variable
  2. Interceptor config (interceptor.ts)

    • Read env var in constructor
    • Set enableRealTimeHTML config based on flag
    • Updated output messages to reflect HTML status

Changes

  • apps/claude-trace/src/cli.ts: Add flag parsing and help text
  • apps/claude-trace/src/interceptor.ts: Read env var and conditionally generate HTML

Diff stats: 2 files changed, 16 insertions(+), 3 deletions(-)

Testing

  • ✅ Code follows existing patterns (--no-open)
  • ✅ Backwards compatible (HTML enabled by default)
  • ✅ Clean, minimal diff

Example Usage

# Generate both JSONL and HTML (default behavior, unchanged)
claude-trace

# Generate JSONL only, skip HTML
claude-trace --no-html

# Use with other flags
claude-trace --no-html --no-open --log my-session

Documentation

Help text updated to include:

--no-html          Skip HTML generation (JSONL only)

Output message updated to show:

Logs will be written to:
  JSONL: /path/to/.claude-trace/log.jsonl

Add --no-html CLI flag to disable HTML report generation while
preserving JSONL logging. This is useful for reducing file size
when archiving conversations or when HTML viewing is not needed.

Implementation:
- Add --no-html flag parsing in cli.ts
- Wire flag through CLAUDE_TRACE_GENERATE_HTML env var
- Read env var in interceptor.ts constructor to set enableRealTimeHTML
- Update help text and output messages

Follows existing --no-open pattern for consistency.
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