Metadata-Version: 2.5
Name: gitsaga
Version: 0.1.0
Summary: The story of your repo in 60 seconds: a narrated, animated timeline of a git history with automatic milestone detection. One self-contained HTML file, optional GIF/MP4.
Project-URL: Homepage, https://github.com/rampangeni/gitsaga
Project-URL: Issues, https://github.com/rampangeni/gitsaga/issues
Author: Ram Pangeni
License: MIT
License-File: LICENSE
Keywords: animation,git,gource,history,repository,timeline,visualization
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Software Development :: Version Control :: Git
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Provides-Extra: video
Requires-Dist: pillow>=10; extra == 'video'
Requires-Dist: playwright>=1.45; extra == 'video'
Description-Content-Type: text/markdown

# gitsaga

**The story of your repo in 60 seconds.** One command turns `git log` into a
self-contained, animated, *narrated* timeline: directories grow as a tree,
contributors fly in to touch files, and captions call out the moments that
mattered — first commit, releases, new contributors, big refactors, long
silences, the day the language mix flipped.

![gitsaga on Flask](docs/demo.gif)

```console
$ pip install gitsaga
$ cd my-project
$ gitsaga --open
```

That writes `story.html`: a single file with no network access, no CDN and no
dependencies. Email it, attach it to a release, drop it in a PR.

## Why not Gource?

Gource draws a beautiful swarm but never tells you *what happened*. gitsaga
detects milestones from the history and narrates them with a rule-based
caption track — no LLM, no API key, nothing leaves your machine.

| | gitsaga | Gource |
|---|---|---|
| Output | one HTML file, scrubbable | realtime OpenGL window |
| Narration of milestones | yes | no |
| Needs a GPU / desktop | no | yes |
| Share it | send the file | screen-record |
| GIF / MP4 | built in (optional extra) | via ffmpeg pipe |

## What gets detected

First commit · semver releases (from tags) · the Nth contributor and the top
authors joining · new top-level areas · the biggest changes · refactors (25+
renames in one commit) · the busiest 30 days · silences of 6+ months ·
language leadership shifts · round commit counts · "Today".
Milestones are scored and spaced so 12 captions cover the whole arc.

## Ownership view: who knows this code?

```console
$ gitsaga --view ownership --open
```

Same animation, but every directory is coloured by **who owns it right now**. Press `o` (or the button) to
flip between languages and owners at any moment.

![ownership view](docs/ownership.gif)

- A **red ring** marks an area with a bus factor of 1 (one person accounts for most of its recent changes).
- A **dashed amber ring** marks an area whose owner has not committed anywhere for 12+ months.
- The HUD shows the repo-wide **bus factor** over time, and captions call out the moments that matter:
  *"extreview/ loses its owner"*, *"Markus takes over tests/"*, *"The bus factor falls to 1"*.

Ownership is recency-weighted: a change counts for its directory and every parent, and its weight halves every
18 months, so the owner is whoever worked there most *recently and often*, not whoever wrote it a decade ago.
The bus factor is the fewest people who account for half of that weight. No network, no blame, no file contents —
only who touched which directory and when.

## Usage

```console
gitsaga [REPO] [-o story.html] [--open]
         [--gif FILE] [--mp4 FILE] [--duration SECS]
         [--theme dark|light] [--view language|ownership] [--rev REV] [--since DATE] [--milestones N] [--title TEXT]
         [--depth N] [--max-dirs N] [--max-commits N]
         [--include-bots] [--include-vendor] [--list]
```

- `gitsaga --since "1 year ago"` — just the last year.
- `gitsaga --rev v2.0.0` — the story up to a tag.
- `gitsaga --list` — print the detected milestones without rendering.
- Bots (dependabot, renovate…) and noise (lock files, vendored and minified
  files) are skipped by default; `--include-bots` / `--include-vendor` keep them.

- `gitsaga --theme light` — light player (and light GIF/MP4); the URL also accepts `?theme=light`.

Player keys: `space` play/pause, `←`/`→` step, `n`/`p` next/previous caption,
click the scrubber to seek. Add `?t=12000` to the URL to open at 12 s.

## GIF and MP4

```console
$ pip install 'gitsaga[video]'
$ playwright install chromium
$ gitsaga --gif story.gif            # 30 s, 800x450
$ gitsaga --mp4 story.mp4            # 60 s, 1280x720 (needs ffmpeg)
```

Frames are rendered deterministically by stepping the player's clock in
headless Chromium, so output is identical run to run.

## Privacy

gitsaga only runs `git log`/`git tag` locally. The HTML embeds commit
subjects, author names and file paths from the history — review it before
sharing a private repo's story publicly.

## Notes

- Shallow clones lose history; gitsaga warns. Use `git fetch --unshallow`.
- Very large repos: use `--max-commits` or `--since`. Commits are bucketed
  into at most 360 animation steps.

## Development

```console
pip install -e ".[dev]"
ruff check . && pytest
```

MIT licensed.
