fix: prevent NaN correction rate in export-timeline, add tests#293
Open
TerminalGravity wants to merge 4 commits intomainfrom
Open
fix: prevent NaN correction rate in export-timeline, add tests#293TerminalGravity wants to merge 4 commits intomainfrom
TerminalGravity wants to merge 4 commits intomainfrom
Conversation
Adds a ready-to-use CLAUDE.md template that makes Claude Code automatically run preflight_check on prompts. Users can copy it into their project to get preflight working without manual tool calls. Referenced from Quick Start in README and examples/README.
- CLI now responds to --help/-h with usage info, profiles, and links - CLI now responds to --version/-v with package version - Previously, any flag just launched the interactive wizard - Fixed README badge from Node 18+ to Node 20+ (matches engines field)
Adds a new export_timeline MCP tool that generates structured markdown reports from timeline data. Includes: - Summary stats (event counts, correction/error rates) - Daily activity breakdown - Commit log - Correction patterns analysis - Error listing - Optional full timeline Supports relative date ranges (7days, 2weeks), configurable sections, and all existing scope/project filters. Closes #5
…meline tests - computeStats divides correctionCount/promptCount without zero-check, producing NaN% in reports - Export parseRelativeDate, computeStats, generateMarkdownReport for testability - Add 11 tests covering parseRelativeDate, computeStats, and generateMarkdownReport - Total test count: 43 → 54
TerminalGravity
commented
Mar 19, 2026
Collaborator
Author
TerminalGravity
left a comment
There was a problem hiding this comment.
NaN guard on correction rate is a good catch. The export-timeline tool is well-structured: relative date parsing, type icons, markdown/JSON output. Tests are thorough. Minor: parseRelativeDate could handle plurals more explicitly but not blocking.
TerminalGravity
commented
Mar 20, 2026
Collaborator
Author
TerminalGravity
left a comment
There was a problem hiding this comment.
Good catch on the NaN correction rate — dividing by zero when there are no events is a classic edge case. Tests look solid.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
generateMarkdownReportdividescorrectionCount / promptCountwithout checking for zero, producingNaN%in reports with no prompt events.parseRelativeDate,computeStats, andgenerateMarkdownReport(54 total, up from 43).Why
Reports generated for commit-only or tool-only timelines showed
NaN% of promptsin the summary.