install-hooks: prompt to confirm author identity when an API key is set - #2227
Open
svarlamov-git-ai wants to merge 2 commits into
Open
install-hooks: prompt to confirm author identity when an API key is set#2227svarlamov-git-ai wants to merge 2 commits into
svarlamov-git-ai wants to merge 2 commits into
Conversation
On interactive, non-dry-run installs where an API key is configured (hosted usage) and no git-ai author override exists yet, prompt the user to confirm or override the author name/email used for AI-authorship attribution, defaulting to the git committer identity. The confirmed values are saved to ~/.git-ai/config.json so the prompt never reappears. The prompt is best-effort: it skips on non-TTY stdin/stdout, when the GIT_AI_NO_AUTHOR_PROMPT env var is set, and after 15 seconds without input (via read_line_with_timeout), and it never fails the install. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
svarlamov-git-ai
marked this pull request as ready for review
August 26, 2026 19:15
- Default the prompt from the explicit global git config identity instead of `git var GIT_COMMITTER_IDENT`, which fabricates user@hostname on unconfigured machines and would have been persisted on Enter. - Re-load the file config after the prompt completes so saving cannot clobber a concurrent config change made while waiting on input. - Treat GIT_AI_NO_AUTHOR_PROMPT="", "0", "false" as not opted out, matching the repo's boolean env convention. - Derive the auto-skip seconds in the banner from AUTHOR_PROMPT_TIMEOUT and clarify the timeout applies per prompt. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
svarlamov
force-pushed
the
feat/install-hooks-author-prompt
branch
from
August 27, 2026 15:14
3df96ee to
3a67516
Compare
svarlamov-git-ai
force-pushed
the
feat/install-hooks-author-prompt
branch
from
August 27, 2026 15:56
3a67516 to
3df96ee
Compare
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
On
git-ai install-hooks, interactively prompt the user to confirm or override the author name/email used for AI-authorship attribution, and persist it to~/.git-ai/config.json(author.name/author.email) so the prompt never reappears.The prompt only fires when ALL of these hold — otherwise it skips silently:
GIT_AI_TEST_FORCE_TTYoverrides for tests),author.nameorauthor.emailis set, skip),GIT_AI_API_KEYenv, configapi_key, or the--api-key/API_KEYvalue persisted by this install run) — OSS installs are never prompted,--dry-run,GIT_AI_NO_AUTHOR_PROMPTis not set (hard opt-out for scripts/CI).UX: two line prompts (name, then email), each pre-filled from the git committer identity (
git var GIT_COMMITTER_IDENTvia the existingcurrent_git_committer_identity_resolution()); Enter accepts the default. No input for 15s (viaread_line_with_timeoutfrom the PR below) aborts the prompt entirely and the install continues.The prompt runs after
persist_install_config_with_values(so a just-passed--api-keycounts) and beforeasync_run_install(so it never interleaves with spinner output). It is best-effort and can never fail the install.Notes / risks
run(&[])from a dev machine with a real TTY, an API key, and no author config could hit the prompt locally; the 15s timeout self-heals andGIT_AI_NO_AUTHOR_PROMPTis a hard escape hatch. CI is unaffected (non-TTY stdin).git varspawn only on the interactive prompt path of this one-shot command — not on any daemon/ingestion path.Tests (TDD)
should_prompt_for_authortruth table;prompt_author_identityvia injected scripted reader/writer (confirm defaults, override, mixed, timeout on first/second prompt, all-empty, bracketed defaults in output).authorto config.json; pre-set author skips; no API key skips;--dry-runskips.🤖 Generated with Claude Code