plugin_gitstat is a single zero-dependency C99 binary that answers one question
about a machine: **which of my repositories have uncommitted work, and how far
are they from their upstream?**
It walks a fixed set of allowlisted roots, finds every working tree with a .git
entry, and asks git itself — status --porcelain=v2 --branch, log -1,
stash list — through argv-only child processes. No shell, no popen, no
parsing of .git/index by hand.

| 1440 light | 1024 dark |
|---|---|
| ![]() |
| 390 dark | 390 light |
|---|---|
| ![]() |
| Invocation | Output |
|---|---|
plugin_gitstat --meta (or SX_PLUGIN_META=1) | {"name":"git","desc":"Repo status"} — unauthenticated, so discovery works |
GET ?action=repos | Every repository found, plus per-root counts and a summary |
GET ?action=repo&path=<abs> | One repository: 500 changed files max, 20 recent commits |
POST ?action=fetch&path=<abs> | git fetch --prune, 30 s timeout, only when GITSTAT_ALLOW_FETCH=1 |
GET (default) | The responsive HTML board |
Every action except --meta sits behind require_node_auth(): X-Bot-Password,
Authorization: Bearer, or ?pwd=, and it is a no-op only when BOT_PASSWORD
is unset.
| Platform | Defaults |
|---|---|
| Linux | /workspace, /codebases, $HOME, plus GITSTAT_ROOTS (:-separated) |
| macOS | same |
| Windows | %USERPROFILE%, D:\codebases and C:\codebases when present, plus GITSTAT_ROOTS (;-separated) |
Two environment knobs:
GITSTAT_ONLY_ROOTS=1 makes GITSTAT_ROOTS the complete list instead of anaddition. Useful on a node that wants an explicit allowlist, and it is what the
test suite uses so a developer machine full of checkouts cannot change the
result.
GITSTAT_ALLOW_FETCH=1 enables the single write-ish action. Without it the plugin is strictly read-only and POST ?action=fetch answers 403-style
{"ok":false,...} explaining the switch.
Discovery is depth-limited to 4 and budgeted per root (20 000 entries each,
1 200 repositories in the table), because one shared budget lets the first root
consume the whole walk and the second root report zero.
{
"ok": true,
"action": "repos",
"count": 4,
"table_capped": false,
"summary": {"dirty": 1, "ahead": 1, "behind": 0, "stashes": 1, "detached": 1},
"checked_at": "2026-11-12T09:31:06Z",
"roots": [{"root": "/codebases", "exists": true, "count": 4, "truncated": false}],
"repos": [{
"path": "/codebases/portal-web",
"name": "portal-web",
"root": "/codebases",
"branch": "main",
"upstream": "origin/main",
"remote": "https://git.example.net/team/portal-web.git",
"ahead": 2, "behind": 0,
"dirty": 3, "untracked": 1, "staged": 1, "conflicted": 0,
"stash": 1,
"detached": false, "no_upstream": false, "unborn": false,
"last_commit": {
"hash": "…", "short": "7746dc67", "ct": 1794475861,
"at": "2026-11-12T09:31:01Z",
"subject": "Cap the retry backoff at thirty seconds"
}
}]
}
?action=repo&path= adds changed (code + path, max 500), changed_count,
changed_truncated and commits (max 20). A path is accepted only when it
canonicalises to somewhere under an allowlisted root and that directory
carries a .git entry; anything else, including a .. traversal, is 403.
execvp / CreateProcessA. A path with a ; or a backtick in it is a path,
not a command.
git fetch --prune is the only operation that touches a remote, it needs GITSTAT_ALLOW_FETCH=1, and it is capped at 30
seconds. Nothing ever runs pull, checkout, reset or clean.
GIT_TERMINAL_PROMPT=0, an empty GIT_ASKPASS, and stdin from /dev/null, so a repository with a dead remote can never hang the
node behind a password prompt.
of https://user:token@host/x.git shows as https://host/x.git in the board,
the JSON and anything a caller pipes it into.
fetch actions re-check the canonical path on every request.
make # native
make musl # static musl x86_64 (universal Linux)
make arm64 # static aarch64
make win64 # MinGW-w64 static PE
make macos # Apple clang (run on macOS)
make test # build + 110 offline assertions
python3 tests/e2e.py # Playwright 1440/1024/390, dark + light
make clean
src/ui.html is the page; tools/gen_ui.py compiles it into src/ui_html.h
with two control-byte placeholders that the C side expands into the bot's theme
macros, so the plugin can never drift away from the bot palette. make ui
regenerates it, and python3 tools/gen_ui.py --check fails when it is stale.
Pre-built artifacts for six targets live at
https://dist.scorpiox.net/bot-plugins/gitstat/1.0.0/. Drop the right one into
~/.scorpiox/plugins/plugin_gitstat (or /workspace/.scorpiox/plugins/ on a
BotCloud container) — scorpiox-server discovers it live, with no restart.
Or build it from source, which is the point of the marketplace:
Clone https://plugingit.scorpiox.net/scorpiox-bot-plugin-gitstat.git, read
src/plugin_gitstat.c, customise the root list for this machine, compile it
withmake, check--meta, and install it to~/.scorpiox/plugins/.
MIT. See LICENSE.