Repository navigation
Conversation
`autter badge` prints the share of added lines written by AI over the last 90 days (or --since / --all-time) and a paste-ready Markdown snippet. The number is sum(ai_accepted) / sum(git_diff_added_lines) over commits with an authorship note, the same ratio each uploaded commit summary carries as ai_percent; commits without a note are counted so the output can report coverage. --json prints a shields.io endpoint payload (schemaVersion, label, message, color, plus the figures) and --write stores it, by default in .autter/badge.json, so a committed file can back the badge without an account. When the repository is linked to Autter and the user is signed in, the snippet uses the live badge behind POST /cli/repo-badge-link; otherwise it falls back to a static shields.io badge within 5s. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The backend mounts CLI routes under /api/cli, like every other CLI endpoint, so the badge link request goes there too. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
sagnik11
added a commit
that referenced
this pull request
Nov 3, 2026
Bumps the version to 3.0.0 in Cargo.toml, Cargo.lock and npm/package.json, and adds the 3.0.0 changelog section for `autter badge` (#83) and `autter wrapped` (#82), with the badge's feature doc. Merging tags v3.0.0 and the Release workflow publishes. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Closing: this code already shipped in autter 3.0.0 through #82, which merged this branch in. Every file here is identical on main. |
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.
What
A new
autter badgesubcommand that gives any repository a README badge readingAI-written | 72%.Metric definition
ai_percent = sum(ai_accepted) / sum(git_diff_added_lines)over the window, the same ratio each uploaded commit summary already carries asai_percent(upload_commit_authorship_summaryinpost_commit.rs).--since <date|duration>(anythinggit log --sinceaccepts) or--all-time.commits_with_authorship / commits), likeRangeAuthorshipStatsData..autter-ignoreand--ignore <pat>apply througheffective_ignore_patterns, as inautter stats.capped: true).Computation lives in
src/authorship/repo_share.rs; the command insrc/commands/badge.rs.Two snippet modes
POST /cli/repo-badge-linkwith{ "repo_url" }returns{ "token", "badge_url"?, "page_url"? }(ApiClient::create_repo_badge_link, mirroringupload_commit_authorship_summary). The snippet points at<api_base_url>/api/public/repos/<token>/badge.svgand links to the repo's Autter page. The lookup runs on a thread with a 5srecv_timeout, so it never blocks longer than that.--writeon a GitHub remote the snippet becomes a shields.ioendpoint?url=badge reading the committed.autter/badge.jsonfrom raw.githubusercontent.com, so it updates from the file.--jsonprints the payload below, directly usable as a shields.io endpoint;--write [path](default.autter/badge.json) stores it.{"schemaVersion":1,"label":"AI-written","message":"72%","color":"5b5bd6","ai_percent":72.04,"ai_accepted":912,"added_lines":1266,"commits":58,"commits_with_authorship":54,"since":"2026-08-05","capped":false}Colors (documented in
autter badge --help): no datalightgrey; under 25%74c0fc; 25-49%007ec6; 50-74%5b5bd6; 75% and up2ee6c5(Autter teal).Backend half (separate monorepo change, not in this PR)
POST /cli/repo-badge-link(authenticated, org-scoped) returning the token.GET /api/public/repos/:token/badge.svg: copyrenderBadgeSvgfrombackend/src/services/scan-passport.tsand the token-gated route pattern/public/scans/:token/badge.svgfrombackend/src/routes/public-scans.ts. Data source: thecommit_authorship_summariestable created inbackend/src/routes/cli-data-plane.ts, aggregated perrepo_urlwith the same ratio and color thresholds as above so both snippet modes match.Tests
tests/integration/badge.rs(explicitmock_ai/mock_known_humancheckpoints): all-AI repo, mixed repo, commits lacking notes (coverage),.autter-ignore, window flags and empty window,--writedefault and custom path, GitHub-remote endpoint snippet, help text; insta snapshot of the no-cloud Markdown output.percent.cargo fmt --check,cargo clippy --all-targets -D warnings, andcargo test badgeare clean locally.🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.