Skip to content

feat: implement sync-auth MVP - bidirectional credential sync for dev tools#2

Merged
konard merged 8 commits intomainfrom
issue-1-96263e267aa6
Mar 16, 2026
Merged

feat: implement sync-auth MVP - bidirectional credential sync for dev tools#2
konard merged 8 commits intomainfrom
issue-1-96263e267aa6

Conversation

@konard
Copy link
Member

@konard konard commented Mar 16, 2026

Summary

Implements the complete sync-auth MVP as specified in #1 — a Rust library + CLI for bidirectional syncing of authentication credentials for developer tools through a Git repository.

Package name: sync-auth (available on both crates.io and npmjs.com)

What's included

  • Library crate (sync_auth) with trait-based extensible architecture:

    • AuthProvider trait — implement to add any tool's credentials
    • GitBackend trait — pluggable Git storage backend
    • SyncEngine — orchestrates bidirectional sync operations
    • SyncConfig — TOML-based configuration with serde defaults
  • 7 built-in auth providers (paths verified against upstream source code):

    • gh (GitHub CLI) — ~/.config/gh/
    • glab (GitLab CLI) — ~/.config/glab-cli/
    • claude (Claude Code) — ~/.claude/, ~/.claude.json
    • codex (OpenAI Codex CLI) — ~/.codex/ ($CODEX_HOME), key file: auth.json
    • gemini (Gemini CLI) — ~/.gemini/, key files: oauth_creds.json, .env
    • opencode~/.local/share/opencode/ (XDG data), ~/.config/opencode/ (XDG config)
    • qwen-coder (Qwen Code) — ~/.qwen/, key files: oauth_creds.json, settings.json
  • CLI binary with subcommands: pull, push, sync, watch, status, providers, init, daemon

  • Core features:

    • Shallow clone (--depth 1) for fast initial setup
    • Conflict resolution (skips expired/dead tokens)
    • Watch mode with configurable sync interval
    • Daemon management (start/stop/restart/systemd setup)
    • Config file + env var + CLI arg overrides
  • Examples:

    • Docker sandbox sync-and-code script
    • GitHub Actions autonomous task solver workflow
    • Library usage example
  • Tests: Unit tests + integration tests (14 tests passing)

Architecture decisions

  • All core logic lives in the library crate; the CLI is a thin wrapper
  • Public structs with public fields for maximum extensibility
  • Traits for all key abstractions so library consumers can swap implementations
  • async_trait for async provider validation

Provider path research

Credential paths were verified against upstream source code:

  • Codex: openai/codexcodex-rs/core/src/auth/storage.rs confirms $CODEX_HOME/auth.json
  • Gemini: google-gemini/gemini-clipackages/core/src/config/storage.ts confirms ~/.gemini/oauth_creds.json
  • Opencode: sst/opencodepackages/opencode/src/auth/service.ts confirms XDG paths (~/.local/share/opencode/auth.json)
  • Qwen Code: QwenLM/qwen-codepackages/core/src/config/storage.ts confirms ~/.qwen/oauth_creds.json

Fixes #1

Test plan

  • cargo fmt --check passes
  • cargo clippy --all-targets --all-features passes (0 warnings)
  • cargo test --all-features passes (14 unit/integration tests + 1 doc test)
  • cargo build --release compiles successfully
  • Manual test: sync-auth providers lists all 7 providers
  • Manual test: sync-auth init creates config file
  • Manual test: sync-auth --repo <url> pull clones and syncs

🤖 Generated with Claude Code

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #1
@konard konard self-assigned this Mar 16, 2026
konard and others added 2 commits March 16, 2026 21:27
… tools

Implements the core sync-auth library and CLI for syncing authentication
credentials for developer tools (gh, glab, claude, codex, gemini, opencode,
qwen-coder) through Git repositories.

Architecture:
- AuthProvider trait for extensible provider system
- GitBackend trait for pluggable Git storage backends
- SyncEngine for bidirectional pull/push/sync/watch operations
- CLI with subcommands: pull, push, sync, watch, status, providers, init, daemon

Features:
- Shallow clone support for fast initial setup
- Conflict resolution (skips expired credentials)
- Watch mode with configurable interval
- Daemon management (start/stop/restart/setup as systemd service)
- TOML config file support with env var overrides
- 7 built-in auth providers

Name: sync-auth (available on both crates.io and npmjs.com)

Fixes #1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rewrite README for sync-auth with full CLI/library documentation
- Add Docker sandbox example script
- Add GitHub Actions autonomous task solver example workflow
- Add changelog fragment for MVP release
- Update CONTRIBUTING.md with correct package references

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] Make a first working prototype (MVP) according to spec feat: implement sync-auth MVP - bidirectional credential sync for dev tools Mar 16, 2026
@konard konard marked this pull request as ready for review March 16, 2026 21:35
@konard
Copy link
Member Author

konard commented Mar 16, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $9.012867
  • Calculated by Anthropic: $5.706997 USD
  • Difference: $-3.305870 (-36.68%)

🤖 Models used:

  • Tool: Claude
  • Requested: opus-4-6
  • Main model: Claude Opus 4.6 (ID: claude-opus-4-6, Anthropic, cutoff: 2025-05)
    📎 Log file uploaded as Gist (1978KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Mar 16, 2026

🔄 Auto-restart 1/3

Detected uncommitted changes from previous run. Starting new session to review and commit or discard them.

Uncommitted files:

M src/providers/codex.rs
 M src/providers/gemini.rs

Auto-restart will stop after changes are committed or discarded, or after 2 more iterations. Please wait until working session will end and give your feedback.

konard and others added 2 commits March 16, 2026 21:38
- codex: use ~/.codex/ (CODEX_HOME), validate auth.json
- gemini: use ~/.gemini/, validate .env or oauth_creds.json
- opencode: use ~/.local/share/opencode/ + ~/.config/opencode/ (XDG)
- qwen-coder: use ~/.qwen/ (official path), validate credentials.json
- Update README provider table with accurate paths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Codex: use CODEX_HOME env var, single ~/.codex/ dir, validate auth.json
- Gemini: single ~/.gemini/ dir, validate .env or oauth_creds.json
- Opencode: use XDG data dir (~/.local/share/opencode/) for auth,
  XDG config dir (~/.config/opencode/) for config

Paths verified against upstream source code:
- openai/codex: codex-rs/core/src/auth/storage.rs
- google-gemini/gemini-cli: packages/core/src/config/storage.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard
Copy link
Member Author

konard commented Mar 16, 2026

🔄 Auto-restart 1/3 Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $5.441605
  • Calculated by Anthropic: $4.323728 USD
  • Difference: $-1.117877 (-20.54%)

🤖 Models used:

  • Tool: Claude
  • Requested: opus-4-6
  • Main model: Claude Opus 4.6 (ID: claude-opus-4-6, Anthropic, cutoff: 2025-05)
    📎 Log file uploaded as Gist (3693KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Mar 16, 2026

🔄 Auto-restart 2/3

Detected uncommitted changes from previous run. Starting new session to review and commit or discard them.

Uncommitted files:

M src/providers/qwen_coder.rs

Auto-restart will stop after changes are committed or discarded, or after 1 more iteration. Please wait until working session will end and give your feedback.

konard and others added 2 commits March 16, 2026 21:47
The actual OAuth credential file in Qwen Code (~/.qwen/) is
oauth_creds.json, not credentials.json. Verified against the
official QwenLM/qwen-code source (packages/core/src/config/storage.ts).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update from credentials.json to oauth_creds.json to match the actual
implementation in src/providers/qwen_coder.rs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard
Copy link
Member Author

konard commented Mar 16, 2026

🔄 Auto-restart 2/3 Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.439169
  • Calculated by Anthropic: $0.963034 USD
  • Difference: $-0.476135 (-33.08%)

🤖 Models used:

  • Tool: Claude
  • Requested: opus-4-6
  • Main model: Claude Opus 4.6 (ID: claude-opus-4-6, Anthropic, cutoff: 2025-05)
    📎 Log file uploaded as Gist (4626KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Mar 16, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard konard merged commit d463e69 into main Mar 16, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make a first working prototype (MVP) according to spec

1 participant