Repository navigation
feat(ccs): add CCS accounts registry configuration #596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
52dae47
91dcbcb
2f96add
0503162
0cac924
48df057
caa22e4
a7b86e4
fea0cce
c8350db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| "version": 1, | ||
| "providers": { | ||
| "agy": { | ||
| "default": "shunkakinoki@gmail.com", | ||
| "accounts": { | ||
| "shunkakinoki@gmail.com": { | ||
| "email": "shunkakinoki@gmail.com", | ||
| "nickname": "shunkakinoki", | ||
| "tokenFile": "antigravity-shunkakinoki_gmail_com.json", | ||
| "createdAt": "2026-01-17T00:00:00.000Z", | ||
| "lastUsedAt": "2026-01-17T19:28:18.251Z", | ||
| "tier": "paid" | ||
| } | ||
| } | ||
| }, | ||
| "gemini": { | ||
| "default": "shunkakinoki@gmail.com", | ||
| "accounts": { | ||
| "shunkakinoki@gmail.com": { | ||
| "email": "shunkakinoki@gmail.com", | ||
| "nickname": "shunkakinoki", | ||
| "tokenFile": "gemini-shunkakinoki@gmail.com-gen-lang-client-0359793614.json", | ||
| "createdAt": "2026-01-12T00:00:00.000Z", | ||
| "lastUsedAt": "2026-01-12T00:00:00.000Z" | ||
| } | ||
| } | ||
| }, | ||
| "codex": { | ||
| "default": "shunkakinoki@gmail.com", | ||
| "accounts": { | ||
| "shunkakinoki@gmail.com": { | ||
| "email": "shunkakinoki@gmail.com", | ||
| "nickname": "shunkakinoki", | ||
| "tokenFile": "codex-shunkakinoki@gmail.com.json", | ||
| "createdAt": "2025-12-18T00:00:00.000Z", | ||
| "lastUsedAt": "2025-12-18T00:00:00.000Z" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+1
to
+42
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Committing a file with hardcoded personal information like your email address and nickname is a security risk, as it exposes Personally Identifiable Information (PII). It also makes the configuration harder to maintain and less portable. It's much better to generate this file dynamically from your Nix configuration, using variables that are already defined elsewhere (like
Comment on lines
+1
to
+42
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "env": { | ||
| "ANTHROPIC_BASE_URL": "http://127.0.0.1:8317/api/provider/agy", | ||
| "ANTHROPIC_AUTH_TOKEN": "__CLIPROXY_API_KEY__", | ||
| "ANTHROPIC_MODEL": "claude-opus-4-5-thinking", | ||
| "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-5-thinking", | ||
| "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-opus-4-5-thinking", | ||
| "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-sonnet-4-5" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,39 @@ | ||||||||||||||||||||||||||||
| { config, lib, pkgs, ... }: | ||||||||||||||||||||||||||||
| let | ||||||||||||||||||||||||||||
| dotfilesDir = "${config.home.homeDirectory}/dotfiles"; | ||||||||||||||||||||||||||||
| in | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| # CCS (Claude Code Switcher) account registry | ||||||||||||||||||||||||||||
| # Maps OAuth token files to registered accounts for cliproxy providers | ||||||||||||||||||||||||||||
| # Token files are stored separately in ~/.ccs/cliproxy/auth/ (not managed here as they contain secrets) | ||||||||||||||||||||||||||||
| # Note: Using mkOutOfStoreSymlink with absolute path so CCS can write to the file (updates lastUsedAt) | ||||||||||||||||||||||||||||
| home.file.".ccs/cliproxy/accounts.json" = { | ||||||||||||||||||||||||||||
| source = config.lib.file.mkOutOfStoreSymlink "${dotfilesDir}/config/ccs/accounts.json"; | ||||||||||||||||||||||||||||
| force = true; | ||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # Hydrate CCS settings templates with secrets from .env | ||||||||||||||||||||||||||||
| # ANTHROPIC_AUTH_TOKEN is substituted from CLIPROXY_API_KEY at activation time | ||||||||||||||||||||||||||||
| home.activation.hydrateCcsSettings = lib.hm.dag.entryAfter [ "writeBoundary" ] '' | ||||||||||||||||||||||||||||
| ENV_FILE="${dotfilesDir}/.env" | ||||||||||||||||||||||||||||
| TEMPLATE="${dotfilesDir}/config/ccs/agy.settings.template.json" | ||||||||||||||||||||||||||||
| OUTPUT="${config.home.homeDirectory}/.ccs/agy.settings.json" | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| if [ -f "$ENV_FILE" ] && [ -f "$TEMPLATE" ]; then | ||||||||||||||||||||||||||||
| # Source .env to get CLIPROXY_API_KEY | ||||||||||||||||||||||||||||
| set -a | ||||||||||||||||||||||||||||
| . "$ENV_FILE" | ||||||||||||||||||||||||||||
| set +a | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # Substitute placeholder and write output | ||||||||||||||||||||||||||||
| if [ -n "$CLIPROXY_API_KEY" ]; then | ||||||||||||||||||||||||||||
| ${pkgs.gnused}/bin/sed \ | ||||||||||||||||||||||||||||
| -e "s|__CLIPROXY_API_KEY__|$CLIPROXY_API_KEY|g" \ | ||||||||||||||||||||||||||||
| "$TEMPLATE" > "$OUTPUT" | ||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Secret CLIPROXY_API_KEY is written to ~/.ccs/agy.settings.json without enforcing restrictive permissions, likely creating a world-readable secrets file. Prompt for AI agents |
||||||||||||||||||||||||||||
| $VERBOSE_ECHO "Hydrated CCS agy.settings.json with CLIPROXY_API_KEY" | ||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's look at the actual file and its context
cat -n config/ccs/default.nix | head -50Repository: shunkakinoki/dotfiles Length of output: 1895 🏁 Script executed: # Search for CLIPROXY_API_KEY to understand its source and usage
rg "CLIPROXY_API_KEY" -B 3 -A 3Repository: shunkakinoki/dotfiles Length of output: 7940 🏁 Script executed: # Check the full script context in the file
sed -n '1,50p' config/ccs/default.nixRepository: shunkakinoki/dotfiles Length of output: 1622 🏁 Script executed: # Look for test cases or documentation about CLIPROXY_API_KEY format
rg "CLIPROXY_API_KEY.*=" -A 2 -B 2 | head -50Repository: shunkakinoki/dotfiles Length of output: 816 🏁 Script executed: # Check if there are any examples or documentation files
fd -e md -e txt | xargs grep -l CLIPROXY_API_KEY 2>/dev/nullRepository: shunkakinoki/dotfiles Length of output: 49 🏁 Script executed: # Look for similar sed escaping patterns in the codebase
rg "sed.*\\\$.*-e.*s\|" -A 2 -B 2Repository: shunkakinoki/dotfiles Length of output: 47 Escape special characters in CLIPROXY_API_KEY before sed substitution, but correct the escaping approach. The concern about sed special characters is valid: if the API key contains For sed replacement text, only Correct fix (escape & and backslash for sed replacement) if [ -n "$CLIPROXY_API_KEY" ]; then
+ escaped_key="$(printf '%s' "$CLIPROXY_API_KEY" | ${pkgs.gnused}/bin/sed -e 's/[&\]/\\&/g')"
${pkgs.gnused}/bin/sed \
- -e "s|__CLIPROXY_API_KEY__|$CLIPROXY_API_KEY|g" \
+ -e "s|__CLIPROXY_API_KEY__|${escaped_key}|g" \
"$TEMPLATE" > "$OUTPUT"Also confirm: what is the expected character set for CLIPROXY_API_KEY? Is it documented anywhere that it's restricted to alphanumeric characters and hyphens? 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||
| $VERBOSE_ECHO "Warning: CLIPROXY_API_KEY not set in .env, skipping agy.settings.json hydration" | ||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||
| ''; | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,8 @@ remote-management: | |
| # Disable the bundled management control panel asset download and HTTP route when true. | ||
| disable-control-panel: false | ||
| # Authentication directory (supports ~ for home directory). If you use Windows, please set the directory like this: `C:/cli-proxy-api/` | ||
| auth-dir: "~/.cli-proxy-api" | ||
| # Use objectstore/auths subdirectory to avoid duplicate scanning (root-level files are legacy) | ||
| auth-dir: "~/.cli-proxy-api/objectstore/auths" | ||
|
Comment on lines
+15
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Search for migration documentation or guides related to this change
rg -i "migration\|migrate" --type=md --type=txt -A 2 -B 2Repository: shunkakinoki/dotfiles Length of output: 47 🏁 Script executed: # Check for objectstore/auths references in documentation
rg "objectstore/auths|cli-proxy-api" --type=md --type=txt --type=nix -C 2Repository: shunkakinoki/dotfiles Length of output: 3185 🏁 Script executed: # Check the actual YAML file for context and formatting
cat -n config/cliproxyapi/config.yaml | head -30Repository: shunkakinoki/dotfiles Length of output: 1807 🏁 Script executed: # Look for README or migration guides in the repo
fd -t f -i "readme\|migration\|changelog" -E node_modulesRepository: shunkakinoki/dotfiles Length of output: 47 Add migration guidance for legacy auth files. The README documents that 🤖 Prompt for AI Agents
Comment on lines
+15
to
+16
|
||
| # API keys for client authentication (optional - leave commented for open access) | ||
| # api-keys: | ||
| # - "__CLIPROXY_API_KEY__" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| [ | ||
| ./amp | ||
| ./ccs | ||
| ./cliproxyapi | ||
| ./codex | ||
| ./crush | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The email address in the tokenFile is inconsistent with the format used in other providers. For the gemini provider, the tokenFile uses "@" symbol ("gemini-shunkakinoki@gmail.com-gen-lang-client-0359793614.json"), while for the agy provider it uses an underscore-separated format ("antigravity-shunkakinoki_gmail_com.json"). This inconsistency could lead to confusion when managing token files. Consider standardizing the token file naming convention across all providers.