fix(cliproxyapi): improve legacy service configuration and documentation

Merged
SH
10mo ago
+324-10

Summary

This PR enhances the cliproxyapi service with comprehensive documentation and improves the start script with proper rsync path variable substitution. It refactors the authentication file syncing to remove unnecessary root directory sync while preserving OAuth token functionality.

Changes

  • Documentation: Add comprehensive README for cliproxyapi service configuration and management
  • Start Script: Add rsync path to variable substitution in start.sh for proper environment variable handling
  • Auth Syncing: Remove root auths directory sync to eliminate redundant OAuth token syncing
  • Config Updates: Refactor API key structure and add model mappings to config.yaml
  • Backup Script: Enhance backup script with improved auth file syncing from R2 storage

Files Modified

  • config/cliproxyapi/config.yaml - Enhanced API configuration
  • home-manager/services/cliproxyapi/README.md - New comprehensive documentation
  • home-manager/services/cliproxyapi/default.nix - Updated module configuration
  • home-manager/services/cliproxyapi/scripts/backup-auth.sh - Enhanced backup logic
  • home-manager/services/cliproxyapi/scripts/start.sh - Added rsync path substitution

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation update
  • Configuration refinement

[!NOTE]
Strengthens cliproxyapi’s auth handling and docs with objectstore-centric workflows and safer sync.

  • Auth sync overhaul: start.sh now pulls auths from R2 (auths/ + backup/auths/) before launch and bootstraps from dotfiles only if empty; backup script stops reading from dotfiles to avoid loops and still merges CCS tokens
  • File watching: Removes dotfiles from launchd WatchPaths, preventing circular sync; watchers now monitor only objectstore/auths and ~/.ccs/cliproxy/auth
  • Config: Switches provider keys to api-key-entries in config.yaml; adds commented ampcode.model-mappings example
  • Nix module: Injects rsync path for scripts; updates PATHs accordingly
  • Docs: Adds comprehensive README.md describing architecture, flows, and recovery

Written by Cursor Bugbot for commit fe285e8a7843e9d57669413a987edf7a48be7a1e. Configure here.


Summary by cubic

Improves cliproxyapi reliability and docs. Startup now pulls auth files from R2, removes circular sync loops, and keeps OAuth tokens working.

  • Bug Fixes

    • Sync auth files from R2 (auths and backup/auths) before start; bootstrap from dotfiles only if empty.
    • Read auth only from objectstore/auths when object storage is enabled; remove root auths sync.
    • Exclude dotfiles from WatchPaths and disable dotfiles→cache sync to prevent infinite loops.
    • Add rsync path substitution in start.sh for correct env path handling.
  • New Features

    • Add comprehensive README covering setup, OAuth, backups, and recovery.
    • Update config: switch api-keys to api-key-entries and add optional model-mappings example.