$ show initialcommit-com/git-sim
git-sim is a CLI tool that generates visualizations of Git operations from within a local repository. It uses the Manim animation library to render commit graphs, branches, tags, and file states as either static images (JPG/PNG) or animated videos (MP4/WEBM). The architecture is built around a base class `GitSimBaseCommand` that extends Manim's `MovingCameraScene` and provides common drawing methods for commits, refs, arrows, and zone tables. Each Git subcommand (add, branch, checkout, merge, etc.) is implemented as a separate Python class that inherits from this base class and overrides the `construct()` method to build the specific scene. The CLI interface is defined using Typer, and the application reads the current Git repository state via GitPython. The animation output is handled by a dedicated `handle_animations` function that manages rendering, format conversion, and file output. The codebase is well-organized, with clean separation between command logic, animation rendering, and configuration management via Pydantic settings. It demonstrates effective use of the Manim library for non-trivial graphics and provides a robust framework for simulating Git commands.
The LLM identified 2 files worth highlighting for reuse:
This module contains the `handle_animations` function that takes a Manim Scene, renders it, and handles output file generation. It supports both static image (JPG/PNG with optional transparent background) and video (MP4/WEBM via ffmpeg conversion) output. It also handles writing to stdout, suppressing output, and auto-opening the file. The function is isolated from the rest of the git-sim logic and can be reused in any Manim project that needs similar output management.
This module defines a `Settings` class using Pydantic's `BaseSettings` to manage all configuration parameters for git-sim. It supports environment variable overrides with a `git_sim_` prefix, defaults for all options, and type validation. This pattern is cleanly reusable for any Python application that needs structured configuration with environment variable support.