feat: add git ai fetch-notes command for synchronous notes fetch#987
Merged
svarlamov merged 5 commits intogit-ai-project:mainfrom Apr 8, 2026
Conversation
8e2c0a2 to
7ff0847
Compare
Adds a user-facing `git ai fetch-notes` command that synchronously fetches AI authorship notes from a remote. This complements the existing async notes fetch that runs in the background during `git fetch`/`git pull`. Closes git-ai-project#966
… coverage - Reject duplicate remote specifications (positional + --remote flag) - Include remote name in JSON error output when available - Add tests for --remote missing value, duplicate remote, and JSON error paths
In --json mode, success responses go to stdout but error responses were written to stderr via print_json_error. This meant programmatic consumers capturing stdout got an empty string on error. Change eprintln! to println! so all JSON output uses a single predictable stream, with exit code indicating the outcome.
a7d80a6 to
405e69f
Compare
The test harness error path returned only stderr, discarding any structured output (e.g. JSON) written to stdout before a non-zero exit. This caused test_fetch_notes_json_error_includes_remote to panic because the JSON error object was on stdout. Align the error path with the success path by combining both streams in git_ai_from_working_dir, git_ai_with_env, and git_ai_with_stdin.
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.
Summary
git ai fetch-notescommand that synchronously fetches AI authorship notes from a remotegit ai fetch-notes upstream),--remote <name>flag, and auto-detection of default remote--jsonoutput mode for programmatic use and--helpfor usage documentationgit ai helpoutput alongside existing commandsDetails
Currently, notes fetching runs asynchronously in the background during
git fetchandgit pullhooks. This command provides a way to force a synchronous fetch of authorship notes, useful for:--jsonoutputTest plan
--remoteflag--jsonoutput with no notes on remote--jsonoutput with notes found--helpflagcargo fmt -- --checkpassescargo clippy --all-targets -- -D warningspassesRUSTDOCFLAGS="-D warnings" cargo doc --no-depspassesCloses #966