Skip to content

extoci/theseus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-of-theseus

(a typescript port of Erik Bernhardsson's git-of-theseus)

this port only exists because i really, really dislike python and i wanted to run git-of-theseus.

usage

run with bun:

bunx git-of-theseus

to launch the interactive cli

it will ask what repo you want to analyze, write the data into .theseus/, then ask if you want plots from the data it just made.

requirements

  • bun installed
  • git installed and available in your PATH
  • the target repo needs to have actual commits, because this is powered by git history/blame

what it makes

analysis writes json files into .theseus/ by default:

  • cohorts.json – lines grouped by when they were originally added
  • authors.json – lines grouped by author
  • exts.json – lines grouped by file extension
  • dirs.json – lines grouped by top-level directory
  • domains.json – lines grouped by author email domain
  • survival.json – line survival data used for the survival plot

plots are svg files, also in .theseus/ by default.

commands

interactive mode is the intended path:

bunx git-of-theseus

scriptable commands exist too:

bunx git-of-theseus analyze ~/code/my-repo --branch main
bunx git-of-theseus stack-plot .theseus/cohorts.json --outfile .theseus/stack_plot.svg
bunx git-of-theseus line-plot .theseus/authors.json --normalize --outfile .theseus/authors.svg
bunx git-of-theseus survival-plot .theseus/survival.json --outfile .theseus/survival.svg

useful flags

  • --outdir .theseus – change where analysis data is saved
  • --branch main – pick the branch/ref to analyze
  • --interval 604800 – sample commits at least this many seconds apart
  • --procs 4 – run more blame jobs in parallel
  • --all-filetypes – include everything, not just common code extensions
  • --ignore 'dist/**' – skip paths
  • --only 'src/**' – only include paths
  • --ignore-whitespace – pass -w to git blame

quick examples

analyze a repo and use the interactive plot prompt:

bunx git-of-theseus

analyze another repo from here:

bunx git-of-theseus analyze ~/code/my-repo --branch main

only look at source files in one directory:

bunx git-of-theseus analyze ~/code/my-repo --branch main --only 'src/**'

make an author share plot after analysis:

bunx git-of-theseus line-plot .theseus/authors.json --normalize --outfile .theseus/authors.svg

troubleshooting

  • Not a git repository check the path you entered. ~ is supported, but the final path still has to be a git repo.
  • Branch/ref "master" was not found a lot of repos use main. pass --branch main or choose main in the interactive cli.
  • analysis is slow yeah. git blame over history is not exactly a spa day. try increasing --interval, adding --only 'src/**', or excluding generated folders with --ignore 'dist/**'.
  • plots look empty make sure the analyzed files matched the default code extension list, or rerun with --all-filetypes.

notes

this uses isomorphic-git for repo traversal and the installed git binary for blame, because git already knows how to be git.

acknowledgements

original idea and python implementation by Erik Bernhardsson. code vibed by gpt-5.5.

About

a typescript port of Erik Bernhardsson's git-of-theseus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors