Warning
herdstatis work in progress and neither feature complete nor tested thoroughly.
herdstat is a tool for analyzing and visualizing metrics of Open Source projects hosted on GitHub. As of today its
functionality is limited to generate GitHub-style contribution graphs for individual repositories or whole GitHub
organisations.
herdstat is composed of the words herd, which means a group of people who usually have a common bond, and stat,
which is a well-known Linux command line utility that displays detailed information about files. So replacing file
with open source community (= herd) does the trick in understanding why we have chosen that name.
herdstat has an installer script that will download and install it locally.
You can fetch the script and execute it locally. It's well documented so that you can read through it and understand what it is doing before you run it.
BRANCH_OR_TAG=main
curl -fsSL "https://raw.githubusercontent.com/herdstat/herdstat/${BRANCH_OR_TAG}/scripts/get-herdstat.sh"
chmod 700 get-herdstat.sh
./get-herdstat.shFor available options run
./get-herdstat.sh --helpIf you want to live on the edge, you can run one of the following commands depending on the shell you are using:
BRANCH_OR_TAG=main
curl "https://raw.githubusercontent.com/herdstat/herdstat/${BRANCH_OR_TAG}/scripts/get-herdstat.sh" | bashBRANCH_OR_TAG=main
curl "https://raw.githubusercontent.com/herdstat/herdstat/${BRANCH_OR_TAG}/scripts/get-herdstat.sh" | zshYou can execute herdstat using Docker via
docker run herdstat/herdstat /herdstat -r herdstat contribution-graphAlternatively, you can use the herdstat GitHub action.
herdstat can be configured either by providing arguments to the CLI or by means of a configuration file via the global
--config CLI flag. The list of available configuration options is summarized in the following table:
| Aspect | Subcommand | Description | CLI Flag | Configuration Path |
|---|---|---|---|---|
| Configuration | - | Path to a configuration file (see reference). | --config, -c |
- |
| Source Repositories | - | The comma-delimited list of GitHub repositories to analyze. May be either single repositories or whole organizations. | --repositories, -r |
repositories |
| Github Token | - | Token used to access the GitHub API. | --github-token, -t |
github-token |
| Verbosity | - | Controls the verbosity of the herdstat CLI. |
--verbose, -v |
verbose |
| Analysis Period | contribution-graph | Controls the period of time to analyze by means of the last day of the 52 week period to look at. Note that only the day is considered. | --until, -u |
contribution-graph/until |
| Minification | contribution-graph | Whether to minify the generated SVG. | --minify, -m |
contribution-graph/minify |
| Output Filename | contribution-graph | The name of the file used to store the generated contribution graph. | --output-filename, -o |
contribution-graph/filename |
| Primary Color | contribution-graph | The primary color used for coloring daily contribution cells (hex-encoded RGB without leading '#'). | --color |
contribution-graph/color |
| Levels | contribution-graph | The number of color levels used in the contribution graph. | --levels |
contribution-graph/levels |
| Commit Filters | contribution-graph | Filters used to exclude commits. Uses expr filters on Commit structs. | --commit-filters |
contribution-graph/filters/commits |
You can build herdstat by invoking
git clone https://github.com/herdstat/herdstat.git
cd herdstat
go buildInstead of using golang tooling, you can build herdstat from its sources using Docker. To build the image invoke
docker build . -t herdstat-devYou can execute herdstat, e.g., on the herdstat GitHub organization, using
docker rm herdstat-dev || true
docker run --name herdstat-dev -it herdstat-dev /herdstat -r herdstat contribution-graphTo extract the generated contribution graph from the Docker container invoke
docker cp $(docker ps -aqf "name=herdstat-dev"):/contribution-graph.svg .To remote debug herdstat build the image with the ENV build variable set to debug
docker build -t herdstat-dev --build-arg ENV=debug .and start a container using
docker rm herdstat-dev || true
docker run --name herdstat-dev --security-opt="apparmor=unconfined" \
--cap-add=SYS_PTRACE -p 40000:40000 -it herdstat-dev \
/dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient exec /herdstat -- --verbose -r herdstat contribution-graphYou can then connect via your IDE or from the commandline on port 40000.