Description
The --index command hangs when trying to call Claude CLI to generate conversation summaries.
Steps to Reproduce
- Have existing
.claude-trace/*.jsonl log files from previous Claude CLI sessions
- Run
claude-trace --index to generate summaries
- Process hangs indefinitely at "Calling Claude CLI for summarization..."
Root Cause
In apps/claude-trace/src/index-generator.ts line 239-241, the code spawns the Claude CLI process with stdin set to "pipe":
const child = spawn("claude", ["-p", prompt], {
stdio: ["pipe", "pipe", "pipe"],
});
When stdin is set to "pipe", the Claude CLI waits for input on stdin even though the prompt is passed as a command-line argument, resulting in an indefinite hang.
Fix
Change stdin from "pipe" to "ignore":
const child = spawn("claude", ["-p", prompt], {
stdio: ["ignore", "pipe", "pipe"], // ignore stdin, pipe stdout/stderr
});
Testing
After this change, claude-trace --index completes successfully and generates the summary files and index.html.
Environment
- OS: macOS Sequoia 15.6.1
- Machine: MacBook Pro (M2 Max)
- Shell: zsh
- Node.js: v22.20.0
- npm: 10.9.3
- Claude CLI: 2.0.14 (Claude Code)
- Claude CLI Location:
/opt/homebrew/bin/claude
Description
The
--indexcommand hangs when trying to call Claude CLI to generate conversation summaries.Steps to Reproduce
.claude-trace/*.jsonllog files from previous Claude CLI sessionsclaude-trace --indexto generate summariesRoot Cause
In
apps/claude-trace/src/index-generator.tsline 239-241, the code spawns the Claude CLI process with stdin set to"pipe":When stdin is set to
"pipe", the Claude CLI waits for input on stdin even though the prompt is passed as a command-line argument, resulting in an indefinite hang.Fix
Change stdin from
"pipe"to"ignore":Testing
After this change,
claude-trace --indexcompletes successfully and generates the summary files and index.html.Environment
/opt/homebrew/bin/claude