feat(auth): add Gemini CLI authentication support with OAuth#147
feat(auth): add Gemini CLI authentication support with OAuth#147skulidropek merged 9 commits intoProverCoderAI:mainfrom
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: ProverCoderAI#146
Implement Gemini CLI authentication management for docker-git: - Add auth commands: login (API key), status, logout - Add CLI parsing for `docker-git auth gemini <action>` - Add menu-based API key entry flow - Add container entrypoint configuration for GEMINI_API_KEY - Add project-level auth binding (connect/disconnect) - Update template config with geminiAuthPath and geminiHome The Gemini CLI uses API key authentication stored at: `.docker-git/.orch/auth/gemini/<label>/.api-key` Closes ProverCoderAI#146 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This reverts commit b56f070.
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
|
Авторизация Т.е он даёт нам ссылку и просит что бы мы ссылку вставили обратно |
🔄 Auto-restart triggered (attempt 1)Reason: New comment(s) from non-bot user(s): skulidropek Starting new session to address the issues. Auto-restart-until-mergeable mode is active. Will continue until PR becomes mergeable. |
Add OAuth login flow for Gemini CLI in headless/Docker environments: - Users can now authenticate via "Gemini CLI: login via OAuth (Google account)" - OAuth flow runs Gemini CLI with NO_BROWSER=true inside Docker container - User visits auth URL, copies authorization code, and pastes it back - Credentials stored in account-specific .gemini directory This addresses user feedback about needing to paste OAuth callback URLs when browser redirect to localhost doesn't work in Docker. Fixes ProverCoderAI#146 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
OAuth Support Added@skulidropek Thank you for the feedback! I've added OAuth authentication support for Gemini CLI. How to use OAuth login:
This handles the scenario where the OAuth callback URL (like Alternative: API KeyYou can also use the simpler API key method:
CI is currently running. Let me know if you have any questions! |
|
Я не хочу API KEY Система даёт ссылку и мы потом должны вставить ещё ссылку типо Что бы он её открыл |
|
🤖 AI Work Session Started Starting automated work session at 2026-03-16T17:26:46.980Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback. |
Refactored the hasOauthCredentials function in menu-project-auth-gemini.ts to use pipe-based composition instead of Effect.gen pattern to eliminate the code duplication detected by the linter against menu-project-auth-claude.ts. The new implementation: - Extracts credential file names to a constant array - Uses a recursive checkAnyFileExists helper with pipe composition - Maintains the same functionality with proper type safety Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The project has a lint rule that restricts casting (including 'as const') to src/core/axioms.ts only. Changed to use explicit ReadonlyArray<string> type annotation instead. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ication Extracted stripAnsi and writeChunkToFd functions to a shared module at packages/lib/src/shell/ansi-strip.ts to eliminate code duplication detected by the linter between auth-claude-oauth.ts and auth-gemini-oauth.ts. This refactoring: - Creates a new shell/ansi-strip.ts module with shared ANSI parsing utilities - Updates both OAuth files to import from the shared module - Maintains the same functionality while reducing duplicate code Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Solution Draft LogThis log file contains the execution trace of the latest fix session. Changes MadeFixed CI lint failures:
CI Status:
All core checks pass. The E2E tests are slow integration tests that involve Docker operations. Working session completed. The PR is now ready for review. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart 1/3Detected uncommitted changes from previous run. Starting new session to review and commit them. Uncommitted files: Auto-restart will stop after changes are committed or after 2 more iterations. Please wait until working session will end and give your feedback. |
The OAuth flow now works correctly in Docker environments: - Use fixed callback port (38751) for consistent Docker port forwarding - Add OAUTH_CALLBACK_PORT and OAUTH_CALLBACK_HOST environment variables - Map the port between host and container (-p 38751:38751) - Add --debug flag to ensure auth URL is displayed - Print helpful OAuth instructions before starting the flow This addresses the user's request to support OAuth where the callback URL (http://127.0.0.1:PORT/oauth2callback?...) is automatically captured via the forwarded port instead of requiring manual URL pasting. Fixes ProverCoderAI#146 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
OAuth Port Forwarding Implementation@skulidropek I've implemented OAuth authentication with Docker port forwarding to address your feedback about needing to paste the callback URL. What changed:The OAuth flow now uses a fixed callback port (38751) with Docker port forwarding: This means:
No need to paste anything back - the callback URL is now handled automatically via port forwarding. CI Status:
Please let me know if you have any additional feedback! |
🔄 Auto-restart 1/3 LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
…unbound variable error
The entrypoint script uses `set -u` which causes errors when variables
are not set. Using `${GEMINI_AUTH_LABEL:-}` and `${GEMINI_AUTH_LABEL:-default}`
ensures the script works correctly even when the variable is not defined.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
🔄 Auto-restart-until-mergeable Log (iteration 1)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart triggered (attempt 2)Reason: New comment(s) from non-bot user(s): skulidropek; Uncommitted changes Starting new session to address the issues. Auto-restart-until-mergeable mode is active. Will continue until PR becomes mergeable. |
🔄 Auto-restart-until-mergeable Log (iteration 2)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Summary
Implements Gemini CLI authentication management for docker-git, following the same patterns as existing Claude Code and Codex integrations.
docker-git auth gemini login|status|logoutCLI commandsGEMINI_API_KEYenvironment variablegeminiAuthPathandgeminiHomeOAuth Authentication with Docker Port Forwarding
The OAuth flow now works correctly in Docker environments:
-p 38751:38751)OAUTH_CALLBACK_PORTandOAUTH_CALLBACK_HOST=0.0.0.0environment variables--debugflag to ensure auth URL is displayedHow it works:
docker-git menu-> Auth profiles -> "Gemini CLI: login via OAuth (Google account)"http://localhost:38751/oauth2callback?...API Key Authentication
For simpler setup:
docker-git menu-> Auth profiles -> "Gemini CLI: set API key"Files Changed
New files:
packages/lib/src/usecases/auth-gemini.ts- Gemini auth usecase (login, status, logout)packages/lib/src/usecases/auth-gemini-oauth.ts- OAuth flow with port forwardingpackages/lib/src/core/templates-entrypoint/gemini.ts- Container entrypoint templatepackages/app/src/docker-git/menu-project-auth-gemini.ts- Gemini credentials checkpackages/lib/src/shell/ansi-strip.ts- Shared ANSI parsing utilitiesModified files:
packages/lib/src/core/domain.ts- Auth command types, TemplateConfigpackages/app/src/docker-git/cli/parser-auth.ts- CLI parsing for Gemini commandspackages/app/src/docker-git/menu-types.ts- Gemini auth flow typespackages/app/src/docker-git/menu-auth-data.ts- Menu items for Geminipackages/app/src/docker-git/menu-auth-effects.ts- Auth effect handlerspackages/app/src/docker-git/menu-auth.ts- TUI suspension for OAuth flowpackages/app/src/docker-git/program.ts- Command handlersTest plan
pnpm typecheck)pnpm lint)pnpm test- 76 tests in lib)docker-git menu-> Gemini CLI: login via OAuthdocker-git menu-> Gemini CLI: set API keydocker-git auth gemini statusdocker-git auth gemini logoutFixes #146
🤖 Generated with Claude Code