[PR #14] [MERGED] stats-delta command #211

Closed
opened 2026-03-02 04:12:57 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/git-ai-project/git-ai/pull/14
Author: @acunniffe
Created: 8/4/2025
Status: Merged
Merged: 8/4/2025
Merged by: @acunniffe

Base: mainHead: git-ai-stats-command


📝 Commits (7)

📊 Changes

9 files changed (+255 additions, -188 deletions)

View changed files

📝 Cargo.lock (+1 -1)
📝 Cargo.toml (+1 -1)
meesa.txt (+0 -5)
📝 src/commands/mod.rs (+1 -1)
src/commands/stats.rs (+0 -179)
src/commands/stats_delta.rs (+193 -0)
📝 src/git/post_commit.rs (+7 -1)
📝 src/git/refs.rs (+16 -0)
📝 src/main.rs (+36 -0)

📄 Description

Implemented for an agent vendor to help them collect authorship logs without requiring users to install + alias git-ai.

How it works: Instead of compacting working logs into authorship logs in the post_commit hook, this command will find all working logs for non-HEAD commits that haven't been processed into authorship logs. It's running the same logic as the post_commit hook, but on commits with > 0 children. This should result in eventually-accurate logs + stats.

Usage

  • Package the binary with your agent CLI
  • Call ./git-ai checkpoint before and after patching files in the repo
  • On a regular basis (ie when users start new threads) call ./git-ai stats-delta. This will create authorship logs for recent commits and list one ref per line:
ai/authorship/{commit_sha_1}
ai/authorship/{commit_sha_2}
ai/authorship/{commit_sha_3}

If you want the contents to be returned include the --json flag:

{"a1c4fcd68b4df1b2312dcc08891b3bad6e69fa15":{"files":{"src/commands/stats_delta.rs":{"file":"src/commands/stats_delta.rs","authors":[{"author":"Aidan Cunniffe","lines":[9,91,[128,133],[140,145]],"agent_metadata":null}]},"src/main.rs":{"file":"src/main.rs","authors":[{"author":"Aidan Cunniffe","lines":[205,[178,195]],"agent_metadata":null}]}},"schema_version":"authorship/0.0.1"}}

Note for large repos: This command will only traverse the last 500 commits (very quick). Setting an arbitrary limit makes this safe for larger repos.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/git-ai-project/git-ai/pull/14 **Author:** [@acunniffe](https://github.com/acunniffe) **Created:** 8/4/2025 **Status:** ✅ Merged **Merged:** 8/4/2025 **Merged by:** [@acunniffe](https://github.com/acunniffe) **Base:** `main` ← **Head:** `git-ai-stats-command` --- ### 📝 Commits (7) - [`7947aba`](https://github.com/git-ai-project/git-ai/commit/7947aba4b719069f37576c3f9afbfbf07d15b560) wip stats - [`e309c23`](https://github.com/git-ai-project/git-ai/commit/e309c23ea57274df58f9d8ef342cff91b86440ab) remove comments - [`660fdee`](https://github.com/git-ai-project/git-ai/commit/660fdee7c05556313d122b812db6386452e20b45) updates - [`04d0388`](https://github.com/git-ai-project/git-ai/commit/04d03884a394309996bce9d042d411a0c25feb38) update - [`a1c4fcd`](https://github.com/git-ai-project/git-ai/commit/a1c4fcd68b4df1b2312dcc08891b3bad6e69fa15) logs - [`06e2f8d`](https://github.com/git-ai-project/git-ai/commit/06e2f8dabaace91d75dc503187e909d12e246847) delete working logs in post_commit - [`44e1dc6`](https://github.com/git-ai-project/git-ai/commit/44e1dc617fcf6203be1ddb7b237f36f683378a26) bump version ### 📊 Changes **9 files changed** (+255 additions, -188 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -1) 📝 `Cargo.toml` (+1 -1) ➖ `meesa.txt` (+0 -5) 📝 `src/commands/mod.rs` (+1 -1) ➖ `src/commands/stats.rs` (+0 -179) ➕ `src/commands/stats_delta.rs` (+193 -0) 📝 `src/git/post_commit.rs` (+7 -1) 📝 `src/git/refs.rs` (+16 -0) 📝 `src/main.rs` (+36 -0) </details> ### 📄 Description Implemented for an agent vendor to help them collect authorship logs without requiring users to install + alias git-ai. How it works: Instead of compacting working logs into authorship logs in the post_commit hook, this command will find all working logs for non-HEAD commits that haven't been processed into authorship logs. It's running the same logic as the post_commit hook, but on commits with > 0 children. This should result in eventually-accurate logs + stats. Usage - Package the binary with your agent CLI - Call `./git-ai checkpoint` before and after patching files in the repo - On a regular basis (ie when users start new threads) call `./git-ai stats-delta`. This will create authorship logs for recent commits and list one ref per line: ``` ai/authorship/{commit_sha_1} ai/authorship/{commit_sha_2} ai/authorship/{commit_sha_3} ``` If you want the contents to be returned include the `--json` flag: ``` {"a1c4fcd68b4df1b2312dcc08891b3bad6e69fa15":{"files":{"src/commands/stats_delta.rs":{"file":"src/commands/stats_delta.rs","authors":[{"author":"Aidan Cunniffe","lines":[9,91,[128,133],[140,145]],"agent_metadata":null}]},"src/main.rs":{"file":"src/main.rs","authors":[{"author":"Aidan Cunniffe","lines":[205,[178,195]],"agent_metadata":null}]}},"schema_version":"authorship/0.0.1"}} ``` Note for large repos: This command will only traverse the last 500 commits (very quick). Setting an arbitrary limit makes this safe for larger repos. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 04:12:57 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#211
No description provided.