Draft
feat(scripts): add rolling 28-day commit statistics tool#1
Conversation
Agent-Logs-Url: https://github.com/ralf003/zeroclaw/sessions/0e4bc609-b2cf-40b2-9fc4-8c9dda3271da Co-authored-by: ralf003 <206904126+ralf003@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add reusable commit statistics script for the last 28 days
feat(scripts): add rolling 28-day commit statistics tool
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
scripts/commit_stats.py— a zero-dependency Python script that buckets the last 28 days of commits on any branch into four 7-day rolling windows and prints a Markdown table (Week Range, Commits, Authors, Top10 author:count).Summary
masterscripts/commit_stats.py— GitHub REST API mode (paginated) + localgit logfallback; author identity prefers GitHub login, falls back tocommit.author.name/email; CLI:--repo,--token/$GITHUB_TOKEN,--ref,--days,--top,--localscripts/tests/test_commit_stats.py— 21 unit tests (fixed sample data, no network) covering window generation, stat bucketing, table rendering, CLI parsingdocs/commit-stats.md— usage referencedocs/SUMMARY.md— link added under OperationsLabel Snapshot (required)
risk: lowsize: Sscripts,docsChange Metadata
featuredocsLinked Issue
Supersede Attribution (required when
Supersedes #is used)Co-authored-bytrailers added: NoNo: no prior PR superseded.Validation Evidence (required)
cargo fmt/clippy/test— zero Rust changesSecurity Impact (required)
api.github.com/repos/.../commits) gated behind explicit--repoflag; no calls when--localis usedGITHUB_TOKENor--tokenflag; never logged or storedAuthorization: Bearerheader only; truncated in error messages to_ERROR_BODY_MAXchars to avoid accidental secret leakage in logsPrivacy and Data Hygiene (required)
passalice,bob,charlie)Compatibility / Migration
i18n Follow-Through (required when docs or user-facing wording changes)
docs/commit-stats.mdadded and linked indocs/SUMMARY.mdcommit-stats.mdis a self-contained operational reference, not a locale-parity surface (analogous tocargo-slicer-speedup.md). No follow-up issue required.Human Verification (required)
--local --ref HEADon shallow clone produces correct 4-row table;--days 14produces 2-row table; invalid--days 10exits with error—in Top10 column;--top 5with 20 authors caps correctly; missing--repo/--localexits with clear error messageSide Effects / Blast Radius
Agent Collaboration Notes (recommended)
scripts/andpython/patterns → authored script + tests + docs in one pass → ranparallel_validation→ addressed review feedback (consistent error truncation constant, named EOD constants, Python version accuracy in docs, test helper rename)AGENTS.md+CONTRIBUTING.md✅Rollback Plan (required)
git revert <commit>— touches only new files, zero blast radiusRisks and Mitigations
docs/commit-stats.md; unauthenticated use typically requires 1–5 pages per run, well under limit;$GITHUB_TOKENinjection is the recommended CI pathOriginal prompt
This pull request was created from Copilot chat.