feat(auth): add generic per-host git connections via token (#368)#393
feat(auth): add generic per-host git connections via token (#368)#393konard wants to merge 3 commits into
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: ProverCoderAI#368
|
Warning Review limit reached
More reviews will be available in 39 minutes and 41 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (29)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Implements issue ProverCoderAI#368: connect to git hosts other than github.com/ gitlab.com (Gitea, Bitbucket, self-hosted, ...) by supplying a token, and lets github/gitlab be configured non-interactively with --token. - CLI: auth git login/status/logout --host/--token/--user - API: GET/POST /auth/git/status|login|logout (token never returned) - Container: HTTPS credential helper resolves per-host GIT_AUTH_TOKEN__<HOST> first, then github/gitlab defaults; host-scoped creds exported to login/SSH - Split entrypoint git template renderers under the 50-line limit - Tests: lib usecase, parser, api service, template render Tokens are stored in the shared env file and never logged.
Working session summaryThe work on issue #368 is complete. Here's a summary of what was accomplished this session and the final state. ResolutionI cleared the two remaining lint blockers, then finalized and verified the PR. 1. jscpd duplications (
2. Verification (all local, green)
PR #393 finalized
PR: #393 The feature delivers both halves of the issue: a generic This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $23.410767📊 Context and tokens usage:Claude Opus 4.8: (6 sub-sessions)
Total: (98.8K new + 702.1K cache writes + 25.2M cache reads) input tokens, 224.0K output tokens, $23.083574 cost Claude Haiku 4.5:
Total: (164 new + 77.4K cache writes + 1.8M cache reads) input tokens, 9.1K output tokens, $0.327193 cost 🤖 Models used:
📎 Log file uploaded as Gist (10685KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
Что и зачем
Закрывает #368.
Два запроса из issue:
--token).Решение
Добавлен универсальный провайдер
git, который настраивает подключениепарой «хост + токен». Токены сохраняются в общий env-файл как host-scoped
ключи
GIT_AUTH_TOKEN__<HOST>/GIT_AUTH_USER__<HOST>, а внутриконтейнера git credential helper по HTTPS сам подбирает нужный токен по хосту.
CLI
API
GET /auth/git/status— возвращает только host и HTTPS-пользователя.POST /auth/git/login—{ host, token, user? }.POST /auth/git/logout—{ host }.Контейнер
docker-git-credential-helperдля HTTPS-remote сначала резолвитper-host токен
GIT_AUTH_TOKEN__<HOST_KEY>(нормализация хоста совпадает сCLI/web: uppercase, не-alphanumeric →
_, обрезка_), затем падает надефолты github.com/gitlab.com и глобальный
GIT_AUTH_TOKEN. Host-scopedкреды также экспортируются в login/SSH-шеллы, чтобы
clone/pushработали вне entrypoint.
Безопасность
Значения токенов никогда не логируются и не возвращаются API —
statusпоказывает только хост и имя пользователя.
Как воспроизвести / проверить
Тесты
packages/lib/tests/usecases/auth-git.test.ts— login/status/logout, дефолтпользователя
x-access-token, типизированныйAuthErrorпри пустом хосте,чистые хелперы (
normalizeGitHost,buildGitTokenKey,gitHostFromKey,listGitConnections).packages/api/tests/auth.test.ts— API login/status/logout без утечки токена.packages/app/tests/docker-git/parser-auth.test.ts— парсинг CLI (host/token/user обязательны/опциональны,
--scopesотклоняется).packages/lib/tests/core/templates.test.ts— рендер per-host credential helperи экспорт host-scoped env.
Локально зелёные:
bun run lint(0 ошибок, 0 дубликатов),bun run check,bun run lint:effect,bun run test(lib 289),bun run api:test(187).Fixes #368