Commit Graph
106 Commits
Author SHA1 Message Date
kaitranntt 8897e711de style: fix prettier formatting in stats-fetcher and doctor 2025-12-11 02:16:44 -05:00
kaitranntt a94c3d6600 feat(cliproxy): add stats fetcher and OpenAI-compatible model manager
- Add stats-fetcher.ts for CLIProxy analytics integration
- Add openai-compat-manager.ts for model discovery and listing
- Add CLIProxy stats routes to web-server for real-time metrics
- Create cliproxy-stats-card component for analytics dashboard
- Add use-cliproxy-stats hook for data fetching
- Extend doctor.ts with CLIProxy health checks
- Update analytics page with CLIProxy usage metrics
2025-12-11 02:12:39 -05:00
kaitranntt 83570050ef feat(api-profile-ux): Implement API & UI for profile management 2025-12-10 21:36:11 -05:00
kaitranntt 2b1a3b4879 feat(dashboard): add code editor for raw JSON settings editing
- Add GET/PUT /api/file endpoints for generic file access with security validation
- Add GET /api/files endpoint to list editable JSON files in ~/.ccs/
- Create CodeEditor component with JSON syntax highlighting (prism-react-renderer)
- Add "Raw JSON" tab to SettingsDialog for direct JSON editing
- Support conflict detection, atomic writes, and automatic backups
- Lazy load editor to minimize initial bundle impact (~31KB gzipped)

Closes #73
2025-12-10 21:09:38 -05:00
kaitranntt f83051be40 feat(api): improve create UX with URL validation and model mapping
- Add URL warning for common mistakes (e.g., /chat/completions endpoint)
- Add optional model mapping prompt for Opus/Sonnet/Haiku backends
- Show edit hint after profile creation for modifying settings
- Support custom model configurations in unified config mode

Closes #72
2025-12-10 20:56:32 -05:00
kaitranntt 790ac3c862 fix(cache): use ~/.ccs/cache/ for usage and update-check files
- usage-disk-cache.ts: usage-cache.json → cache/usage.json
- update-checker.ts: update-check.json → cache/update-check.json
- Both ensure cache directory exists before writing
- Update tests to use new cache paths
2025-12-10 18:32:35 -05:00
kaitranntt 0aa9131642 fix(migrate): include backup path in rollback command 2025-12-10 18:24:26 -05:00
kaitranntt c09cc35352 style(migrate): use boxed UI for migration success message 2025-12-10 18:21:45 -05:00
kaitranntt 05a6199d83 fix(migrate): skip autoMigrate when running migrate command
Prevents double migration message when user explicitly runs
'ccs migrate --dry-run' - autoMigrate was triggering real migration
before the migrate command handler ran.
2025-12-10 18:19:37 -05:00
kaitranntt 0d70708658 feat(cliproxy): implement --nickname flag for account management
- Add renameAccount function to account-manager.ts with validation
- Support --nickname <name> to rename current default account
- Support --nickname with --auth --add to set nickname during OAuth
- Add getDefaultAccount import for nickname operations
- Filter --nickname flag from Claude CLI args
2025-12-10 18:13:17 -05:00
kaitranntt 1dbd7229a5 refactor(config): use settings file references instead of inline env
Changes config.yaml to store references to *.settings.json files
instead of inlining env vars. This matches Claude's ~/.claude/settings.json
pattern and gives users familiar editing experience.

Changes:
- ProfileConfig now stores 'settings' path instead of 'env' object
- CLIProxyVariantConfig uses 'settings' instead of 'model'/'env'
- Migration preserves existing *.settings.json files, only stores references
- Updated config.yaml comments to explain settings file pattern
- Create/remove commands now manage settings files alongside config.yaml

Benefits:
- Users edit familiar *.settings.json format
- config.yaml stays clean (just references)
- No confusion about where to make changes
2025-12-10 17:53:00 -05:00
kaitranntt b621b8e47b feat(config): add unified YAML config with migration support
Implements unified config.yaml format consolidating:
- config.json (API profiles)
- profiles.json (account metadata)
- *.settings.json (env vars)

Features:
- Auto-migration from v1 JSON to v2 YAML with backup
- Secrets separation into secrets.yaml (chmod 600)
- Enhanced YAML output with section comments
- CLIProxy OAuth settings migration with env var support
- Feature flag for gradual rollout (CCS_UNIFIED_CONFIG=1)
- Rollback support via ccs migrate --rollback

New commands:
- ccs migrate - Run migration
- ccs migrate --dry-run - Preview changes
- ccs migrate --rollback <path> - Restore from backup
- ccs migrate --list-backups - List available backups

Closes #75
2025-12-10 17:42:40 -05:00
kaitranntt d81a5e6266 feat(usage-analytics): implement token cost breakdown and anomaly detection 2025-12-10 02:36:43 -05:00
kaitranntt 49b4065186 feat(usage): add internal data aggregation and cost tracking 2025-12-09 23:41:47 -05:00
kaitranntt 8f6684f948 feat(cliproxy): add --use and --accounts flags for multi-account switching
- Add findAccountByQuery() to search accounts by nickname/email/id
- Add --accounts flag to list all accounts for a provider
- Add --use <name> flag to switch between accounts
- Filter CCS-specific flags from Claude CLI args
- Update help documentation with new multi-account commands
2025-12-09 17:28:41 -05:00
kaitranntt d868dc4c32 feat(cliproxy): add multi-account support phases 02-03
Phase 02 - CLI Account Selector in Variant Wizard:
- Add --account flag to cliproxy create command
- Implement inline OAuth flow when no accounts exist
- Add account selector for multiple accounts
- Auto-select single account

Phase 03 - Dashboard Quick Setup Wizard:
- Create quick-setup-wizard.tsx component
- Add step-by-step wizard: Provider → Auth → Account → Variant → Success
- Add Quick Setup button to CLIProxy page
2025-12-09 16:27:31 -05:00
kaitranntt 493492fa7e feat(cliproxy): add --add flag and nickname support for multi-account auth
- Add `--add` flag to skip confirm prompt when adding accounts
- Add confirm prompt when accounts exist and --add not specified
- Add nickname field to AccountInfo (auto-generated from email prefix)
- Add generateNickname() and validateNickname() utility functions
- Update triggerOAuth() to accept add option
- Update registerAccountFromToken() to pass nickname
- Update help text with --add flag documentation
2025-12-09 16:14:28 -05:00
kaitranntt 1e11d2e40a feat(analytics): aggregate usage from all CCS auth profiles
Add multi-instance support to usage analytics. The dashboard now
aggregates usage data from ~/.claude/ AND all CCS instances in
~/.ccs/instances/<profile>/.

- Add getInstancePaths() to discover CCS instances with usage data
- Add loadInstanceData() to load data from specific instance
- Add merge functions for daily/monthly/session data with deduplication
- Modify refreshFromSource() to aggregate from all instances sequentially
- Merge by date/sessionId to avoid double-counting overlapping usage
2025-12-09 15:15:55 -05:00
kaitranntt 96d9fc68e9 feat(dashboard): add Environment and OAuth Readiness groups to health page
Bring OAuth diagnostics from ccs doctor to web dashboard:

- Add Environment group showing platform, SSH, TTY, browser capability
- Add OAuth Readiness group showing port availability (8085, 1455, 51121)
- Reuse existing environment-diagnostics and oauth-port-diagnostics modules

The dashboard health page now has 7 groups matching ccs doctor output.
2025-12-09 13:00:04 -05:00
kaitranntt 92007d7c04 feat(doctor): add OAuth diagnostics for Windows headless false positives
Add environment and OAuth port diagnostics to help troubleshoot
authentication issues reported by Windows users:

- Add ENVIRONMENT section showing platform, SSH, TTY, browser capability
- Add OAUTH READINESS section with pre-flight port availability checks
- Fix Windows headless false positive (isTTY undefined on npm wrappers)
- Add pre-flight OAuth check before auth attempt to fail fast

New files:
- src/management/environment-diagnostics.ts
- src/management/oauth-port-diagnostics.ts

Case study: Vietnamese Windows users reported "command hangs" because
Windows terminal wrappers don't set isTTY correctly, triggering
headless mode when browser should be available.
2025-12-09 12:50:38 -05:00
kaitranntt abb156d9f4 perf(analytics): instant dashboard loading with disk cache persistence
- Add React lazy loading for heavy pages (Analytics, Settings, etc.)
- Remove blocking prewarmUsageCache() from server startup
- Add disk cache module for persistent usage data storage
- Fix disk cache not being created on first Analytics visit
- Write cache immediately when daily data available (don't wait for all 3 types)

Dashboard now loads in <10ms from disk cache instead of waiting for
better-ccusage library on every visit.
2025-12-09 01:07:42 -05:00
kaitranntt 1475adb616 feat(cliproxy): promote thinking models as default for agy provider
- Remove deprecated flag from Claude Opus 4.5 Thinking and Sonnet 4.5 Thinking
- Reorder models with thinking models at top (Opus → Sonnet Thinking → Sonnet → Gemini)
- Change default model to gemini-claude-opus-4-5-thinking
- Update tests to reflect new ordering and non-deprecated status
2025-12-08 23:21:17 -05:00
kaitranntt 69e6a32224 perf(analytics): add cache pre-warming and SWR pattern for instant page load
- Add server-side cache pre-warming on startup (non-blocking)
- Implement stale-while-revalidate pattern (1hr stale window)
- Add /api/usage/status endpoint for cache status
- Remove full-page blocking skeleton, use per-component loading
- Add "Updated X ago" timestamp indicator in UI header
- Export AnalyticsSkeleton component for potential future use
2025-12-08 23:09:01 -05:00
kaitranntt a721af3cf3 feat(analytics): add usage analytics page with caching layer
- Add Analytics page with usage trends, model breakdown, sessions table
- Add server-side caching layer for better-ccusage data (TTL-based)
- Add request coalescing to prevent duplicate concurrent API calls
- Add /api/usage/refresh endpoint to manually clear cache
- Add date-range filter, summary cards, trend charts components
- Fix API parameter mismatch (since/until in YYYYMMDD format)
- Wire up Refresh button with loading state animation
2025-12-08 21:47:36 -05:00
kaitranntt efb42ba8f6 fix(security): improve API key detection patterns to prevent false positives
- Change from substring to pattern-based matching for sensitive keys
- Prevents ANTHROPIC_MAX_TOKENS from being incorrectly censored
- Synchronize backend and UI detection logic for consistency
2025-12-08 16:32:52 -05:00
kaitranntt 13194fecbe fix(web): correct skill detection to look for SKILL.md instead of prompt.md
The Skills page was only showing 4 skills instead of 38 because it was
looking for prompt.md files instead of SKILL.md files in the skills
directory. Updated the detection logic to check for SKILL.md for skills
and prompt.md for agents.
2025-12-08 16:14:30 -05:00
kaitranntt 8aae0db7da feat(ui): redesign health dashboard to match ccs doctor output
- Rewrite health-service.ts with 20+ comprehensive checks in 5 groups
  (System, Configuration, Profiles & Delegation, System Health, CLIProxy)
- Add async support for port checking functionality
- Create new health-check-item.tsx component with collapsible design
- Redesign health.tsx with professional grouped layout, hero section,
  summary stats, and issues panel with actionable fix commands
- Update use-health.ts with HealthGroup type support
- Add development server documentation to CLAUDE.md
2025-12-08 15:00:07 -05:00
kaitranntt cc1655624c feat(ui): Enhance web overview with new components and data 2025-12-08 14:11:44 -05:00
kaitranntt d77f07e093 feat(cli): Introduce version utility and command updates 2025-12-08 14:11:11 -05:00
kaitranntt 17caf804ba fix(cliproxy): map token type values to provider names for account discovery 2025-12-08 00:40:03 -05:00
kaitranntt 4dc17fac4f feat(cliproxy): add multi-account support for CLIProxy providers
- Implement account-manager.ts for managing multiple OAuth accounts per provider
- Add account selector in UI dialog with dropdown for authenticated accounts
- Extend auth-handler.ts to support account registration and multi-account authentication
- Update web-server routes with account management endpoints (GET/POST/DELETE)
- Add account badges and management UI in cliproxy page
- Support account field in CLIProxy variant configuration
- Add Badge component from shadcn/ui for UI styling
- Enable default account selection and account removal functionality
2025-12-08 00:16:49 -05:00
kaitranntt e17a068a58 fix(glmt): pass env vars to proxy subprocess
The spawn() call was missing the env option, so ANTHROPIC_AUTH_TOKEN
and ANTHROPIC_BASE_URL were not being passed to the proxy subprocess.
This caused 401 Unauthorized errors.
2025-12-07 23:09:06 -05:00
kaitranntt 077a406df6 fix(glmt): add bearer prefix for openai-compatible endpoints
OpenAI-compatible endpoints like /chat/completions require Authorization header
with 'Bearer ' prefix. Previously the token was sent without prefix, causing
401 Unauthorized errors.

Auto-detects endpoint type based on URL path and formats header accordingly.

Fixes #61
2025-12-07 22:52:31 -05:00
kaitranntt db68cf06af style(cliproxy): fix formatting in cli command and ui page 2025-12-07 20:33:28 -05:00
kaitranntt a283f942a9 feat(cliproxy): add authentication status display to web dashboard
- Add auth status endpoint to show built-in profiles authentication state
- Display auth status in UI with visual indicators for authenticated state
- Show last authentication date and token file count
- Update CLI command to better differentiate between built-in profiles and custom variants
- Improve UI layout to separate built-in profiles from custom variants
2025-12-07 20:32:00 -05:00
kaitranntt e078f15297 feat(web): update shared routes and home page for dashboard 2025-12-07 20:00:01 -05:00
kaitranntt 6e2da6458a feat(web): enhance dashboard functionality and ui components 2025-12-07 19:56:26 -05:00
kaitranntt 23a33820c0 feat(web-dashboard): add dev mode with hmr and optimize build 2025-12-07 16:44:34 -05:00
kaitranntt 59758024c9 feat(web-dashboard): complete settings, health, shared data and build integration
- Settings editor with API key masking and conflict detection
- Health dashboard with status cards and one-click fixes
- Home dashboard with stats and quick actions
- Shared data viewer for commands/skills/agents
- Build scripts for UI + server bundle
- Bundle size verification (<500KB gzipped)
- Pre-release checklist script
2025-12-07 14:23:56 -05:00
kaitranntt 56502ab6a8 feat(web-dashboard): add rest api and real-time sync
REST API & CRUD:
- Add REST API routes for profiles, cliproxy, accounts
- Integrate React Query with data fetching hooks
- Create API client wrapper with TypeScript types
- Add shadcn/ui components (dialog, input, label, table)
- Build profiles table with edit/delete actions
- Create profile form dialog with zod validation
- Mount QueryClientProvider in App

Real-time Sync & WebSocket:
- Implement file watcher with chokidar for config changes
- Create WebSocket server with broadcast capability
- Add client auto-reconnect with exponential backoff
- Integrate React Query cache invalidation on WS messages
- Add connection status indicator in header
- Implement heartbeat keepalive (30s interval)
- Add graceful cleanup on server shutdown
- Show toast notifications for external config changes

Dependencies:
- Add @tanstack/react-query, react-table, react-hook-form, zod
- Add chokidar for file watching
2025-12-07 12:00:56 -05:00
kaitranntt 6a6f2a2463 feat(web-dashboard): add express server and react ui scaffolding 2025-12-07 11:37:28 -05:00
kaitranntt 98fd1bedb9 feat(doctor): improve port detection with process identification
- Add port-utils.ts module to detect which process occupies CLIProxy port
- Enhance doctor command to show specific process (PID/name) using port
- Distinguish between CLIProxy process vs other conflicting processes
- Support cross-platform detection (Windows netstat, Unix lsof)
- Provide actionable guidance when port conflict detected

This helps users identify if CLIProxy is already running or if another
application needs to be terminated to free up the port.
2025-12-07 08:29:53 -05:00
kaitranntt 63b3ca7760 feat(cliproxy): deprecate claude thinking models in agy provider
Deprecated 2 Claude thinking models:
- gemini-claude-opus-4-5-thinking
- gemini-claude-sonnet-4-5-thinking

These models have compatibility issues with Antigravity.
A new deprecation system was added with badges and warnings in the UI.
2025-12-06 08:44:09 -05:00
kaitranntt 59a2f2b717 feat(completions): enhance cliproxy help and update shell completion scripts
- Styled cliproxy help output with UI primitives and added status hint
- Added cliproxy --help reference to main help command
- Updated bash, zsh, fish, and PowerShell completions with:
  - Missing commands (api, cliproxy)
  - CLIProxy OAuth profiles (gemini, codex, agy, qwen)
  - Provider flags and update command flags
2025-12-06 02:28:34 -05:00
kaitranntt 6427ecf5af feat(cliproxy): add crud commands for variant profiles
- Add `ccs cliproxy create/list/remove` commands for variant management
- Interactive wizard with provider/model selection from catalog
- Settings file auto-generated with all 6 ANTHROPIC_* env fields
- Fix `ccs api create` to include all 4 model fields (was missing 3)
- Fix `--config` flag to save to correct variant settings file
- Remove paid tier badge from AGY models (all free via Antigravity)
- Add settings file format example to README for CLIProxy variants
- Add 22 unit tests for cliproxy command validation and config handling
2025-12-05 21:44:41 -05:00
kaitranntt 6decd157e5 fix(agy): remove max_thinking_tokens when switching to non-claude model
Cleans up the thinking token limit setting when user switches from
a Claude model to a Gemini model via ccs agy --config.
2025-12-05 17:41:41 -05:00
kaitranntt 6f19440472 fix(agy): enable claude model thinking via antigravity profile
- Removed broken: true and issueUrl from Claude thinking models
- Added MAX_THINKING_TOKENS=8191 for Antigravity-proxied Claude models
- Removed alwaysThinkingEnabled:false requirement
- Updated info message explaining thinking token limit

Claude models now work with extended thinking when using Antigravity
proxy (MAX_THINKING_TOKENS < 8192 is required).
2025-12-05 17:37:19 -05:00
kaitranntt ace5ba8750 fix(cliproxy): consolidate download ui to single spinner
Use single spinner with update() instead of multiple spinners.
Prevents UI jumping during download/verify/extract phases.
2025-12-05 17:24:12 -05:00
kaitranntt 47700474a4 fix(cliproxy): only remove provider-specific auth files on logout
Previously --logout cleared all files in shared auth directory.
Now filters by provider prefix or JSON type field to preserve other providers.
2025-12-05 17:23:28 -05:00
kaitranntt f5c31dab55 fix(agy): preserve user settings during model switch
Model configuration now uses selective merge instead of full replacement:
- Preserves all user customizations (includeCoAuthoredBy, MAX_TOKENS, etc.)
- Only updates CCS-controlled fields (model selection, base URL, auth token)
- Still enforces alwaysThinkingEnabled: false for Claude models
2025-12-05 17:02:19 -05:00