Skip to content

feat: add export_timeline tool for markdown reports (closes #5) - #258

Open
TerminalGravity wants to merge 4 commits into
mainfrom
feat/export-timeline-report-v2
Open

feat: add export_timeline tool for markdown reports (closes #5)#258
TerminalGravity wants to merge 4 commits into
mainfrom
feat/export-timeline-report-v2

Conversation

@TerminalGravity

Copy link
Copy Markdown
Collaborator

What

New export_timeline MCP tool that generates structured markdown reports from timeline data.

Formats

  • summary — stats table + activity breakdown by type
  • detailed — full daily breakdown with timestamps and event-level detail
  • weekly — week-over-week trend with visual bar charts

Features

  • Relative date parsing (7days, 2weeks, etc.)
  • Optional save_to parameter to write reports to disk
  • Works with all search scopes (current/related/all)

Tests

6 tests covering all formats, type breakdowns, empty states, and no-project edge case.

Closes #5

Shows 4 concrete scenarios: vague prompt clarification, multi-step
scoping, correction pattern matching, and cross-service awareness.
Each example includes the prompt, triage classification, and the
actual output users can expect.
The README and examples/README.md referenced examples/.preflight/
but the actual config files didn't exist. Added:

- config.yml — profile, related projects, thresholds, embeddings
- triage.yml — keyword rules and strictness settings
- contracts/api.yml — manual contract definition examples

All files are heavily commented so users can copy them into their
project root and customize without needing to reference the docs.
Adds a new MCP tool that generates structured markdown reports from
timeline data. Supports three formats:
- summary: stats and activity breakdown by type
- detailed: full daily breakdown with event-level detail
- weekly: week-over-week trend visualization

Includes optional save_to parameter for writing reports to disk.
6 tests covering all formats and edge cases.

@TerminalGravity TerminalGravity left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — looks good. Three export formats cover the main use cases well, relative date parsing is a nice touch. Minor thought: might want to validate the save_to path to prevent writes outside the project root. Could see a json format being useful for CI integrations later. Tests are solid.

- Add 'json' format option for CI/machine-readable export
- Validate save_to resolves within project root (prevents path traversal)
- Add 3 new tests: JSON output, field inclusion, path escape rejection
@TerminalGravity

Copy link
Copy Markdown
Collaborator Author

Addressed review feedback:

  • Path validation: save_to now resolves relative to project root and rejects paths that escape it
  • JSON format: Added format: 'json' for CI/machine-readable output — includes stats, period, and full event array with commit hashes + tool names
  • 3 new tests covering both changes (9 total, all passing)

@TerminalGravity TerminalGravity left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — this closes #5 nicely. The export tool is well-structured. A few minor notes:

  1. computeStats — if events is empty, firstEvent/lastEvent are empty strings and formatSummarySection will .slice(0,10) on them, producing ugly output. Maybe short-circuit with 'No events found'.
  2. content.slice(0, 200) truncation doesn't add an ellipsis — could confuse on long entries cut mid-word.
  3. The README walkthrough additions are excellent — way more approachable for new users.

None are blockers. Ready to merge.

@TerminalGravity TerminalGravity left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice feature — three report formats cover the main use cases well. Relative date parsing is a good UX touch. Thoughts:

  1. Worth documenting save_to path resolution (relative to cwd vs project root?)
  2. Visual bar charts in weekly format are great for terminal output
  3. 6 tests cover happy paths — timezone edge cases could be a follow-up

Overlapping files with #265 on examples dir — coordinate merge order. LGTM.

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.

Export timeline to markdown/PDF reports

1 participant