Skip to content

feat(ccs): add CCS accounts registry configuration - #596

Merged
shunkakinoki merged 10 commits into
mainfrom
feat/ccs-accounts-config
Jan 17, 2026
Merged

feat(ccs): add CCS accounts registry configuration#596
shunkakinoki merged 10 commits into
mainfrom
feat/ccs-accounts-config

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Jan 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add home-manager configuration for CCS (Claude Code Switcher) accounts registry
  • Fixes the "No accounts configured" error when using ccs agy, ccs gemini, or ccs codex commands
  • Token files remain in ~/.ccs/cliproxy/auth/ (not managed here as they contain secrets)

Test plan

  • Run home-manager switch to apply configuration
  • Verify symlink exists: ls -la ~/.ccs/cliproxy/accounts.json
  • Test ccs agy --help works without "No accounts configured" error

🤖 Generated with Claude Code


Summary by cubic

Adds Home Manager config for the CCS accounts registry, symlinking accounts.json to ~/.ccs/cliproxy/accounts.json and fixing “No accounts configured” for ccs agy, gemini, and codex. Hydrates ~/.ccs/{provider}.settings.json (agy, gemini, codex) and ~/.ccs/config.yaml from CLIPROXY_API_KEY via templates, points cliproxyapi to ~/.cli-proxy-api/objectstore/auths, adds a Makefile restart target that pulls the latest image, and disables AMP on Linux to fix agy routing; token files remain in ~/.ccs/cliproxy/auth/.

  • Migration
    • Run home-manager switch (ensure .env sets CLIPROXY_API_KEY).
    • Restart cliproxyapi: make systemctl-cliproxyapi or make systemctl.
    • Verify ~/.ccs/cliproxy/accounts.json is a symlink, ~/.ccs/{agy,gemini,codex}.settings.json exist, and ~/.ccs/config.yaml exists.
    • Confirm ccs agy --help, ccs gemini --help, and ccs codex --help run without the error.

Written for commit c8350db. Summary will update on new commits.

Copilot AI review requested due to automatic review settings January 17, 2026 19:02
@coderabbitai

coderabbitai Bot commented Jan 17, 2026

Copy link
Copy Markdown

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added multi-provider account management system supporting multiple AI providers
    • Introduced provider settings configuration templates for streamlined setup
    • Added automated service restart capability for deployments
  • Chores

    • Updated provider configuration paths and defaults
    • Added settings hydration automation for environment-based configuration

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Adds CCS provider account/config templates and a hydration flow: new account data and provider settings templates, a hydration script and Nix activation to symlink and hydrate configs into $HOME, cliproxyapi auth path change, Makefile target to restart cliproxyapi, and a Linux-only AMP suppression step in the cliproxyapi start script.

Changes

Cohort / File(s) Summary
CCS account data
config/ccs/accounts.json
New JSON file declaring version 1 provider accounts (agy, gemini, codex) with per-account metadata (email, nickname, tokenFile, createdAt, lastUsedAt, tier for agy).
CCS templates & config schema
config/ccs/config.template.yaml, config/ccs/agy.settings.template.json, config/ccs/codex.settings.template.json, config/ccs/gemini.settings.template.json
New unified CCS config template and three provider settings templates exposing environment placeholders for provider base URLs, tokens, and default models.
Hydration script
config/ccs/hydrate.sh, spec/coverage_spec.sh
New hydrate.sh that loads ~/.dotfiles/.env, requires CLIPROXY_API_KEY, substitutes templates, and writes hydrated provider settings into $HOME/.ccs; test coverage list updated to include the script.
Nix / home-manager plumbing
config/ccs/default.nix, config/default.nix
New Nix module adding a dotfilesDir, a home.file." .ccs/cliproxy/accounts.json" out-of-store symlink, and home.activation.hydrateCcsSettings activation hook that runs the generated hydrate script; registers ./ccs in public config paths.
Cliproxy API config
config/cliproxyapi/config.yaml
Updated auth-dir path from ~/.cli-proxy-api to ~/.cli-proxy-api/objectstore/auths.
Makefile / service orchestration
Makefile
Adds systemctl-cliproxyapi target (pull image, restart user service) and includes it in systemctl prerequisites; declares .PHONY.
Home-manager cliproxyapi start script
home-manager/services/cliproxyapi/scripts/start.sh
Adds a Linux-only post-template step that comments out AMP-related keys (ampcode, upstream-url, upstream-api-key, restrict-management-to-localhost) in generated config to disable AMP routing on Linux.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Activation as home.activation.hydrateCcsSettings
  participant Dotfiles as dotfilesDir (repo)
  participant HydrateScript as config/ccs/hydrate.sh
  participant Home as $HOME/.ccs

  User->>Activation: activation runs after writeBoundary
  Activation->>Dotfiles: prepare hydrate script (replace vars)
  Activation->>HydrateScript: execute `${pkgs.bash}/bin/bash ${hydrateScript}`
  HydrateScript->>Dotfiles: read templates and `~/.dotfiles/.env`
  Dotfiles-->>HydrateScript: provide templates and env
  HydrateScript->>Home: write hydrated `config.yaml` and `*.settings.json`
  HydrateScript-->>Activation: exit (status logged)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

🐰
I nibbled templates in the night,
Sewed symlinks by soft moonlight,
Hydrated keys and tucked them near,
Cliproxy wakes — the burrow’s clear,
A hop, a patch, configs delight. 🌿

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(ccs): add CCS accounts registry configuration' clearly and concisely summarizes the main change—adding CCS accounts registry configuration via Home Manager.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose (fixing 'No accounts configured' error), what was added (accounts registry, hydration scripts, templates), and the test/migration plan.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/ccs-accounts-config

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mesa-dot-dev

mesa-dot-dev Bot commented Jan 17, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates the Claude Code Switcher (CCS) accounts registry into the home-manager configuration. By adding a new accounts.json file and a corresponding Nix module, it resolves the "No accounts configured" error for CCS commands. The change specifically symlinks the accounts.json file to the expected location, while maintaining the separation of sensitive token files from the managed configuration.

Highlights

  • CCS Accounts Registry Configuration: Introduces a new home-manager configuration for the Claude Code Switcher (CCS) accounts registry.
  • Error Resolution: Addresses and fixes the "No accounts configured" error encountered when using ccs agy, ccs gemini, or ccs codex commands.
  • Token File Management: Ensures that sensitive token files located in ~/.ccs/cliproxy/auth/ are explicitly not managed by home-manager, preserving their security.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Add home-manager configuration for CCS (Claude Code Switcher) accounts
registry. This fixes the "No accounts configured" error when using
ccs agy, gemini, or codex commands.

The accounts.json file maps OAuth token files to registered accounts
for cliproxy providers. Token files themselves are stored separately
in ~/.ccs/cliproxy/auth/ and contain secrets (not managed here).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds configuration for CCS to resolve an issue with account configuration. The approach of adding a static JSON file for accounts introduces a security concern by hardcoding personally identifiable information (PII) like your email address. My review provides a suggestion to dynamically generate this configuration file using Nix, which will remove the PII from your repository and make the configuration more maintainable by reusing existing values.

Comment thread config/ccs/accounts.json
Comment on lines +1 to +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-17T00:00:00.000Z",
"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"
}
}
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

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 config.accounts.email.accounts.Gmail.address). This file should be removed after applying the suggested change in config/ccs/default.nix.

Comment thread config/ccs/default.nix Outdated
Comment on lines +1 to +10
{ config, ... }:
{
# 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)
home.file.".ccs/cliproxy/accounts.json" = {
source = config.lib.file.mkOutOfStoreSymlink ./accounts.json;
force = true;
};
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

To avoid hardcoding personal information in a static JSON file, you can generate accounts.json dynamically. This makes your configuration more secure and easier to maintain by centralizing personal data. This approach uses builtins.toJSON to create the file content from a Nix attribute set. After this change, you can delete the config/ccs/accounts.json file.

As a further improvement, you could also dynamically construct the tokenFile names to remove the hardcoded email strings from them as well.

{ config, ... }:
let
  email = config.accounts.email.accounts.Gmail.address;
  # Consider making nickname configurable or deriving it from 'config.accounts.email.accounts.Gmail.realName'
  nickname = "shunkakinoki";
  accountsData = {
    version = 1;
    providers = {
      agy = {
        default = email;
        accounts."${email}" = {
          inherit email nickname;
          tokenFile = "antigravity-shunkakinoki_gmail_com.json";
          createdAt = "2026-01-17T00:00:00.000Z";
          lastUsedAt = "2026-01-17T00:00:00.000Z";
          tier = "paid";
        };
      };
      gemini = {
        default = email;
        accounts."${email}" = {
          inherit email nickname;
          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 = email;
        accounts."${email}" = {
          inherit email nickname;
          tokenFile = "codex-shunkakinoki@gmail.com.json";
          createdAt = "2025-12-18T00:00:00.000Z";
          lastUsedAt = "2025-12-18T00:00:00.000Z";
        };
      };
    };
  };
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)
  home.file.".ccs/cliproxy/accounts.json" = {
    text = builtins.toJSON accountsData;
    force = true;
  };
}

Previously auth-dir pointed to ~/.cli-proxy-api which caused cliproxyapi
to scan both root-level JSON files AND objectstore/auths/, resulting in
duplicate auth file detection (11 files instead of 6).

Now points to ~/.cli-proxy-api/objectstore/auths directly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

@mesa-dot-dev

mesa-dot-dev Bot commented Jan 17, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Adds Home Manager configuration for the Claude Code Switcher (CCS) accounts registry and settings, resolving the "No accounts configured" error by symlinking accounts.json and hydrating provider-specific settings from templates, alongside updates to cliproxyapi configuration and service management.

What changed?

  • CCS Configuration Integration:
    • config/default.nix: Included the new ccs configuration.
    • config/ccs/default.nix: Added new NixOS configuration to create a symbolic link for accounts.json and execute hydrate.sh for processing CCS setting templates using CLIPROXY_API_KEY.
    • config/ccs/accounts.json: Updated CCS account configurations.
  • CCS Settings and Templates:
    • config/ccs/hydrate.sh: New shell script to automate the hydration of CCS provider settings and configuration from templates using the CLIPROXY_API_KEY.
    • config/ccs/config.template.yaml: New template defining default settings for CCS Unified Configuration, including accounts, profiles, cliproxy providers, websearch providers, and global environment variables.
    • config/ccs/agy.settings.template.json: New configuration template for Anthropic API settings via the agy proxy.
    • config/ccs/codex.settings.template.json: New configuration template for Anthropic client settings via the codex proxy.
    • config/ccs/gemini.settings.template.json: New configuration template for Gemini model settings via a proxy.
  • cliproxyapi Service Management:
    • config/cliproxyapi/config.yaml: Updated the auth-dir configuration from ~/.cli-proxy-api to ~/.cli-proxy-api/objectstore/auths for better authentication file organization.
    • Makefile: Added a new systemctl-cliproxyapi target to pull the latest eceasy/cli-proxy-api:latest Docker image and restart the cliproxyapi.service, integrated into the main systemctl target.
    • home-manager/services/cliproxyapi/scripts/start.sh: Modified to disable AMP configuration on Linux systems by commenting out specific lines, addressing potential routing issues with the antigravity provider.

Description generated by Mesa. Update settings

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@config/cliproxyapi/config.yaml`:
- Around line 15-16: Update the project documentation to add explicit migration
guidance for legacy auth files referenced by the config key auth-dir (value
"~/.cli-proxy-api/objectstore/auths"): state whether this new directory is only
for fresh setups or required for all users, describe how to detect legacy files
at "~/.cli-proxy-api/" and provide a simple migration command sequence (e.g.,
move/backup into the new objectstore/auths subdirectory), and include any
post-migration steps or troubleshooting notes so users know how to verify the
migrated auth files work with the CLI proxy API.
♻️ Duplicate comments (1)
config/ccs/accounts.json (1)

1-42: Hardcoded PII should be generated dynamically from Nix config.

This file contains hardcoded personal information (email, nickname) repeated across all providers. As previously flagged, this should be generated dynamically using builtins.toJSON in the Nix module to centralize personal data and improve maintainability.

Additionally, per coding guidelines, keys should be sorted alphabetically when possible in configuration files.

🧹 Nitpick comments (1)
config/ccs/default.nix (1)

1-10: Well-documented module, but consider dynamic generation.

The comments clearly explain the purpose and security boundary (token files stored separately). However, this approach couples to the static accounts.json file containing PII.

Consider the previously suggested approach: use home.file.".ccs/cliproxy/accounts.json".text = builtins.toJSON accountsData; where accountsData is constructed dynamically using values from config.accounts.email.accounts.Gmail.address. This eliminates the static JSON file entirely.

♻️ Suggested dynamic generation approach
{ config, ... }:
let
  email = config.accounts.email.accounts.Gmail.address;
  nickname = "shunkakinoki"; # Or derive from config
  accountsData = {
    version = 1;
    providers = {
      agy = {
        default = email;
        accounts."${email}" = {
          inherit email nickname;
          tokenFile = "antigravity-shunkakinoki_gmail_com.json";
          createdAt = "2026-01-17T00:00:00.000Z";
          lastUsedAt = "2026-01-17T00:00:00.000Z";
          tier = "paid";
        };
      };
      # ... gemini and codex similarly
    };
  };
in
{
  # CCS (Claude Code Switcher) account registry
  home.file.".ccs/cliproxy/accounts.json" = {
    text = builtins.toJSON accountsData;
    force = true;
  };
}

Comment on lines +15 to +16
# Use objectstore/auths subdirectory to avoid duplicate scanning (root-level files are legacy)
auth-dir: "~/.cli-proxy-api/objectstore/auths"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 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 2

Repository: 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 2

Repository: shunkakinoki/dotfiles

Length of output: 3185


🏁 Script executed:

# Check the actual YAML file for context and formatting
cat -n config/cliproxyapi/config.yaml | head -30

Repository: 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_modules

Repository: shunkakinoki/dotfiles

Length of output: 47


Add migration guidance for legacy auth files.

The README documents that ~/.cli-proxy-api/objectstore/auths is the intended auth cache directory. However, your comment references "root-level files are legacy" without documenting how users with existing auth files at ~/.cli-proxy-api/ should migrate them. Add a note in the README or commit message clarifying the migration path, or confirm this is only for fresh setups.

🤖 Prompt for AI Agents
In `@config/cliproxyapi/config.yaml` around lines 15 - 16, Update the project
documentation to add explicit migration guidance for legacy auth files
referenced by the config key auth-dir (value
"~/.cli-proxy-api/objectstore/auths"): state whether this new directory is only
for fresh setups or required for all users, describe how to detect legacy files
at "~/.cli-proxy-api/" and provide a simple migration command sequence (e.g.,
move/backup into the new objectstore/auths subdirectory), and include any
post-migration steps or troubleshooting notes so users know how to verify the
migrated auth files work with the CLI proxy API.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds configuration for the CCS (Claude Code Switcher) accounts registry to fix the "No accounts configured" error when using CCS commands. The PR also updates the cliproxyapi auth directory path to use a more organized subdirectory structure.

Changes:

  • Add CCS module with accounts.json configuration for three providers (agy, gemini, codex)
  • Update cliproxyapi auth-dir to use objectstore/auths subdirectory
  • Register the new CCS module in the config imports

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
config/default.nix Adds ccs module to the list of imported configuration modules
config/cliproxyapi/config.yaml Updates auth-dir path to use objectstore/auths subdirectory structure
config/ccs/default.nix Creates new Nix module that symlinks accounts.json to ~/.ccs/cliproxy/
config/ccs/accounts.json Defines account registry with OAuth token mappings for three providers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +15 to +16
# Use objectstore/auths subdirectory to avoid duplicate scanning (root-level files are legacy)
auth-dir: "~/.cli-proxy-api/objectstore/auths"

Copilot AI Jan 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states "Use objectstore/auths subdirectory to avoid duplicate scanning (root-level files are legacy)", but this explanation is vague. Consider clarifying what "duplicate scanning" refers to and why root-level files are considered legacy. This would help future maintainers understand the rationale for this directory structure change.

Copilot uses AI. Check for mistakes.
Comment thread config/ccs/accounts.json
Comment on lines +10 to +23
"tokenFile": "antigravity-shunkakinoki_gmail_com.json",
"createdAt": "2026-01-17T00:00:00.000Z",
"lastUsedAt": "2026-01-17T00:00:00.000Z",
"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",

Copilot AI Jan 17, 2026

Copy link

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.

Copilot uses AI. Check for mistakes.
Comment thread config/ccs/accounts.json
Comment on lines +1 to +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-17T00:00:00.000Z",
"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"
}
}
}
}
}

Copilot AI Jan 17, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration file contains a personal email address (shunkakinoki@gmail.com) which appears to be developer-specific rather than a placeholder or example value. If this is meant to be a shared configuration template, consider using placeholder values like "user@example.com" or add documentation indicating that users need to replace these values with their own credentials. If this is personal configuration that should not be shared, it should not be committed to version control.

Copilot uses AI. Check for mistakes.
shunkakinoki and others added 5 commits January 17, 2026 19:15
The relative path ./accounts.json was being resolved within the Nix
store context. Using absolute path ${dotfilesDir}/config/ccs/accounts.json
ensures the symlink points to the actual dotfiles so CCS can write
to the file (updates lastUsedAt timestamps).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
cliproxyapi wasn't being restarted on `make switch`, causing config
changes (like auth-dir) to not take effect until manual restart.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Ensures cliproxyapi always runs the latest Docker image when
restarted via `make switch` or `make systemctl-cliproxyapi`.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
AMP integration causes antigravity (agy) provider requests to be
incorrectly routed through ampcode.com, returning 404 errors.

Disabling AMP on Linux allows antigravity OAuth to work directly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add template-based approach for managing CCS provider settings:
- Create agy.settings.template.json with __CLIPROXY_API_KEY__ placeholder
- Add home-manager activation script to hydrate template at switch time
- ANTHROPIC_AUTH_TOKEN is substituted from CLIPROXY_API_KEY in .env

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="config/ccs/default.nix">

<violation number="1" location="config/ccs/default.nix:32">
P1: Secret CLIPROXY_API_KEY is written to ~/.ccs/agy.settings.json without enforcing restrictive permissions, likely creating a world-readable secrets file.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread config/ccs/default.nix Outdated
if [ -n "$CLIPROXY_API_KEY" ]; then
${pkgs.gnused}/bin/sed \
-e "s|__CLIPROXY_API_KEY__|$CLIPROXY_API_KEY|g" \
"$TEMPLATE" > "$OUTPUT"

@cubic-dev-ai cubic-dev-ai Bot Jan 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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
Check if this issue is valid — if so, understand the root cause and fix it. At config/ccs/default.nix, line 32:

<comment>Secret CLIPROXY_API_KEY is written to ~/.ccs/agy.settings.json without enforcing restrictive permissions, likely creating a world-readable secrets file.</comment>

<file context>
@@ -11,4 +11,29 @@ in
+      if [ -n "$CLIPROXY_API_KEY" ]; then
+        ${pkgs.gnused}/bin/sed \
+          -e "s|__CLIPROXY_API_KEY__|$CLIPROXY_API_KEY|g" \
+          "$TEMPLATE" > "$OUTPUT"
+        $VERBOSE_ECHO "Hydrated CCS agy.settings.json with CLIPROXY_API_KEY"
+      else
</file context>
Fix with Cubic

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@config/ccs/default.nix`:
- Around line 28-33: The sed substitution for CLIPROXY_API_KEY must escape
characters that are special in sed replacement text (backslash and ampersand)
before running ${pkgs.gnused}/bin/sed; update the block that writes "$TEMPLATE"
-> "$OUTPUT" to first transform CLIPROXY_API_KEY (e.g., via POSIX shell
parameter expansion or a small helper) replacing '\' with '\\' and '&' with
'\&', then use that escaped variable in the sed -e
"s|__CLIPROXY_API_KEY__|$ESCAPED_CLIPROXY_API_KEY|g" invocation and keep the
existing '|' delimiter (so '/' need not be escaped); ensure you reference
CLIPROXY_API_KEY when creating ESCAPED_CLIPROXY_API_KEY and retain VERBOSE_ECHO
for the log message.
♻️ Duplicate comments (1)
config/ccs/accounts.json (1)

1-42: Avoid committing personal account data in a shared config.

This hardcodes PII (email/nickname/token filenames). Consider generating this file dynamically in Nix (e.g., builtins.toJSON) or using placeholders with activation-time hydration so personal data stays out of the repo.

🧹 Nitpick comments (1)
Makefile (1)

675-683: Guard the image pull when Docker isn’t available.

On Linux hosts without Docker, this target will emit errors (even with || true). Consider a lightweight guard to reduce noise.

♻️ Proposed tweak
 systemctl-cliproxyapi: ## Pull latest image and restart cliproxyapi systemd user service.
 	`@echo` "🔄 Pulling latest cliproxyapi image..."
-	`@docker` pull eceasy/cli-proxy-api:latest || true
+	`@if` command -v docker >/dev/null 2>&1; then \
+		docker pull eceasy/cli-proxy-api:latest || true; \
+	else \
+		echo "⚠️ docker not found; skipping image pull"; \
+	fi
 	`@echo` "🔄 Restarting cliproxyapi..."
 	`@systemctl` --user restart cliproxyapi.service || true
 	`@echo` "✅ cliproxyapi restarted"

Comment thread config/ccs/default.nix Outdated
Comment on lines +28 to +33
# 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"
$VERBOSE_ECHO "Hydrated CCS agy.settings.json with CLIPROXY_API_KEY"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the actual file and its context
cat -n config/ccs/default.nix | head -50

Repository: 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 3

Repository: shunkakinoki/dotfiles

Length of output: 7940


🏁 Script executed:

# Check the full script context in the file
sed -n '1,50p' config/ccs/default.nix

Repository: 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 -50

Repository: 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/null

Repository: shunkakinoki/dotfiles

Length of output: 49


🏁 Script executed:

# Look for similar sed escaping patterns in the codebase
rg "sed.*\\\$.*-e.*s\|" -A 2 -B 2

Repository: 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 & or \, the substitution will fail or produce incorrect JSON. However, the proposed fix is flawed—it attempts to escape / characters (unnecessary since the delimiter is |) using malformed syntax.

For sed replacement text, only & (which represents the matched string) and \ (escape char) need escaping. The correct approach:

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# 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"
$VERBOSE_ECHO "Hydrated CCS agy.settings.json with CLIPROXY_API_KEY"
# Substitute placeholder and write output
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__|${escaped_key}|g" \
"$TEMPLATE" > "$OUTPUT"
$VERBOSE_ECHO "Hydrated CCS agy.settings.json with CLIPROXY_API_KEY"
🤖 Prompt for AI Agents
In `@config/ccs/default.nix` around lines 28 - 33, The sed substitution for
CLIPROXY_API_KEY must escape characters that are special in sed replacement text
(backslash and ampersand) before running ${pkgs.gnused}/bin/sed; update the
block that writes "$TEMPLATE" -> "$OUTPUT" to first transform CLIPROXY_API_KEY
(e.g., via POSIX shell parameter expansion or a small helper) replacing '\' with
'\\' and '&' with '\&', then use that escaped variable in the sed -e
"s|__CLIPROXY_API_KEY__|$ESCAPED_CLIPROXY_API_KEY|g" invocation and keep the
existing '|' delimiter (so '/' need not be escaped); ensure you reference
CLIPROXY_API_KEY when creating ESCAPED_CLIPROXY_API_KEY and retain VERBOSE_ECHO
for the log message.

shunkakinoki and others added 3 commits January 17, 2026 19:58
- Move inline nix activation script to config/ccs/hydrate.sh
- Add templates for codex and gemini providers
- Process all *.settings.template.json files automatically
- Substitutes __CLIPROXY_API_KEY__ from .env at activation time

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add config.template.yaml with __CLIPROXY_API_KEY__ placeholder
- Update hydrate.sh to process both config.yaml and settings templates
- Auth token is now managed via template substitution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="spec/coverage_spec.sh">

<violation number="1" location="spec/coverage_spec.sh:108">
P2: New script config/ccs/hydrate.sh added to coverage list but missing corresponding spec-file assertion; coverage test won’t enforce a test exists for it.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread spec/coverage_spec.sh
# List of all shell scripts that should have tests
# Update this list when adding new shell scripts
covered_scripts="config/claude/notify.sh
covered_scripts="config/ccs/hydrate.sh

@cubic-dev-ai cubic-dev-ai Bot Jan 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: New script config/ccs/hydrate.sh added to coverage list but missing corresponding spec-file assertion; coverage test won’t enforce a test exists for it.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At spec/coverage_spec.sh, line 108:

<comment>New script config/ccs/hydrate.sh added to coverage list but missing corresponding spec-file assertion; coverage test won’t enforce a test exists for it.</comment>

<file context>
@@ -105,7 +105,8 @@ Describe 'no shell scripts are missing from coverage list'
 # List of all shell scripts that should have tests
 # Update this list when adding new shell scripts
-covered_scripts="config/claude/notify.sh
+covered_scripts="config/ccs/hydrate.sh
+config/claude/notify.sh
 config/claude/pushover.sh
</file context>
Fix with Cubic

@shunkakinoki
shunkakinoki merged commit 30f9da7 into main Jan 17, 2026
23 of 25 checks passed
@shunkakinoki
shunkakinoki deleted the feat/ccs-accounts-config branch January 17, 2026 20:19
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.

2 participants