Skip to content

Add comprehensive repository history visualization with timeline controls #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

mentatbot[bot]
Copy link
Contributor

@mentatbot mentatbot bot commented Jul 21, 2025

This PR implements the ability to visualize repository history over time, allowing users to select any commit SHA and see the repository state at that point, as well as animate the repository evolution.

Features Added

Backend Enhancements

  • Add branch support to CLI with --branch, --history-sample, and --max-commits parameters
  • Implement full repository snapshot creation at each timeline point
  • Enhanced schema with branch metadata, history range tracking, and file lifecycle information
  • Smart commit sampling for performance optimization

Frontend History Controls

  • Timeline scrubber to jump instantly to any commit
  • Play/pause animation controls with configurable speed (0.1x to 10x)
  • Branch information display and selection
  • File lifecycle indicators showing added (+), removed (-), and renamed (~) files
  • Keyboard shortcuts: Space (play/pause), arrow keys (navigate), Home/End (jump to extremes)
  • Current commit SHA overlay during playback

User Experience

  • Automatic detection of history data switches to enhanced history mode
  • Smooth transitions between timeline points
  • Visual feedback for file lifecycle changes
  • Intuitive timeline controls with progress indication

Usage

Generate repository data with history:

repo-visualizer . --branch main --history-sample 5 --max-commits 50

The frontend automatically detects when repository data contains timeline information and enables the history visualization mode.

Users can now:

  • Scrub through time to see any commit state
  • Play animations to watch repository evolution
  • See which files were added/removed at each commit
  • Navigate easily with keyboard shortcuts or UI controls

🤖 This PR was created with Mentat. See my steps and cost here

  • Wake on any new activity.

- Add branch support and enhanced timeline analysis to CLI and analyzer
- Create full repository snapshots at each timeline point with file lifecycle tracking
- Implement HistoryControls component with timeline scrubber, play/pause, and speed controls
- Add HistoryVisualization component to orchestrate history playback and animations
- Update schema and TypeScript types for enhanced timeline points and branch metadata
- Automatically detect and switch to history mode when timeline data is available
- Support keyboard shortcuts (Space, arrows, Home/End) for timeline navigation
- Add visual indicators for file lifecycle changes (added, removed, renamed)
- Include test history data for demonstration

Features implemented:
- Select any SHA and see repository state at that time
- Animate repository evolution over time with configurable speed
- Branch selection and information display
- Watch nodes appear/disappear as files are added/removed
- Smart commit sampling for performance (configurable via --history-sample)

Mentat precommit script failed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/d2d34371-8294-4113-8a7d-388882b846b6

Co-authored-by: jakethekoenig <[email protected]>
@mentatbot mentatbot bot requested a review from jakethekoenig July 21, 2025 16:27
mentatbot bot and others added 16 commits July 21, 2025 16:29
- Break up long lines in analyzer.py to fix Python linting errors
- Run prettier formatting on frontend TypeScript files
- Address all CI check failures for proper code formatting

Mentat precommit script failed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/c1beefcb-93d7-42ea-aae0-64e065b03190

Co-authored-by: jakethekoenig <[email protected]>
- Break up long comment line in analyzer.py to comply with line length limit
- This should resolve the last CI check failure

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/8a7e06e8-09aa-4263-8042-b297e54487b4

Co-authored-by: jakethekoenig <[email protected]>
- Update test mocks from analyze_repository function to RepositoryAnalyzer class
- Add test coverage for new CLI parameters (branch, history-sample, max-commits)
- Update assertions to verify proper RepositoryAnalyzer instantiation and method calls
- Fix failing test_cli.py tests that were expecting the old CLI interface

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/da3f9c33-ce73-43a8-93a3-fce19ff77ef7

Co-authored-by: jakethekoenig <[email protected]>
- Remove test_history.json (2.5MB) from repository - not needed in version control
- Add HISTORY_TESTING.md with comprehensive guide for testing history features
- Document CLI parameters for generating history data
- Provide examples and troubleshooting instructions
- Show expected data structure and frontend behavior

Users can now generate their own test history data as needed rather than having a large test file committed to the repo.

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/2acaf68a-7680-476e-8d3f-5ab224530801

Co-authored-by: jakethekoenig <[email protected]>
- Add enableTransitions to VisualizationConfig interface
- Remove unused TimelinePoint imports to fix TypeScript errors
- Remove unused isDragging state in HistoryControls
- Implement node position preservation across timeline transitions
- Initialize new nodes near existing positions, maintain spatial continuity
- Store and restore node positions to prevent jarring layout resets

This addresses the user's feedback about jarring transitions between commits by maintaining node positions across timeline changes.

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/dc5d3b6b-68f1-4435-a113-d095f5105923

Co-authored-by: jakethekoenig <[email protected]>
- comprehensive_history.json (12MB) should not be committed to version control
- Users can generate their own history data using the CLI as documented in HISTORY_TESTING.md
- Keeps repository size manageable

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/3ee61ec0-b6c1-49cf-ba99-443ba40a720c

Co-authored-by: jakethekoenig <[email protected]>
- Switch nodePositions from useState to useRef to prevent excessive re-renders during physics simulation
- Remove unused commits_up_to_this_point parameter from _create_repository_snapshot
- Simplify _determine_file_lifecycle to return empty list for renamed files directly
- Fix performance issue where setNodePositions was called on every physics tick

This addresses the auto-review feedback and improves rendering performance during timeline animations.

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/1eecf51d-6203-44e4-9090-16d146809a22

Co-authored-by: jakethekoenig <[email protected]>
- Reverse commit order so timeline animates chronologically forward (oldest→newest)
- Remove unused commits_up_to_this_point parameter from _create_repository_snapshot call
- Remove deprecated analyze_repository() function that was duplicating CLI logic
- Clean up extra whitespace

Timeline now properly "plays history forward" instead of backwards, and users can see repository evolution from beginning to present.

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/8769d08a-846a-47cd-9a38-14dedd056382

Co-authored-by: jakethekoenig <[email protected]>
- Remove unused commits_up_to_this_point parameter from _create_repository_snapshot signature
- Fix import in __init__.py to remove deleted analyze_repository function
- CLI now works properly with new enhanced history features

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/4bda7d54-40d5-4856-a20c-4447d7080d7f

Co-authored-by: jakethekoenig <[email protected]>
- Update README.md Python API examples to use new RepositoryAnalyzer class
- Remove deprecated analyze_repository function from test imports and tests
- Remove test for deleted analyze_repository convenience function
- API now supports history options (branch, history_sample, max_commits)

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/8b8e49c6-cc36-44b3-9d2e-242075dea084

Co-authored-by: jakethekoenig <[email protected]>
- Replace broken SVG icons with text symbols (←, ▶, ⏸, →) to fix rendering issues
- Create FloatingHistoryControls component as draggable floating window like other settings panels
- Fix branch dropdown by properly managing currentBranch state and using analyzedBranch as default
- Add toggle button to show/hide history controls
- Maintain all existing functionality while improving UI consistency

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/43c7eaea-5fe6-41a4-bda3-87c506a012f9

Co-authored-by: jakethekoenig <[email protected]>
- Fix floating history controls positioning (now actually floating at x:20, y:120)
- Add history detection logic to App.tsx to properly switch between views
- Restore UnifiedVisualizationControls for both regular and history views
- Update to use main branch data with 16 timeline points
- Fix duplicate hasHistory declarations in App.tsx

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/8bc6a414-8462-40ff-8482-10869d4ab5ed

Co-authored-by: jakethekoenig <[email protected]>
- Successfully merged main branch changes into mentat-48
- Resolved merge conflicts in App.tsx
- Maintained history visualization functionality
- App now uses main branch styling but keeps history features

Mentat precommit script failed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/c4928c1a-763a-4a49-805e-f78711c269b6

Co-authored-by: jakethekoenig <[email protected]>
- Fix merge conflict markers in App.tsx that were causing CI failures
- Restore proper App.tsx structure with history detection logic
- Ensure visualization controls are available for both regular and history views
- Use main branch data (16 timeline points) instead of feature branch

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/8e760e35-ba69-4d0b-b9f8-167c79ec709b

Co-authored-by: jakethekoenig <[email protected]>
- Make FloatingHistoryControls truly position:fixed with z-index 9999
- Move floating controls outside of flex layout to prevent interference
- Fix main container height to ensure canvas is visible (80vh)
- Ensure RepositoryGraph has proper space and positioning
- Main branch is already up to date (no merge needed)

Mentat precommit script passed. Log: https://mentat.ai/gh/AbanteAI/repo-visualizer/log/9c3360f0-198c-4ee4-a4df-5452e472266a

Co-authored-by: jakethekoenig <[email protected]>
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.

0 participants