Commit Graph
22 Commits
Author SHA1 Message Date
kaitranntt 5c28935d1e refactor(cliproxy): modularize auth handler and binary
- extract 6 auth modules to auth/ directory (932 → 65 lines)

- oauth-handler, oauth-process, token-manager

- environment-detector, auth-types

- extract binary/ with downloader, verifier modules

Phase 3: Large Files Breakdown (auth-handler.ts)
2025-12-19 11:48:21 -05:00
kaitranntt a66abba174 feat(cliproxy): implement interactive project selection for OAuth flows
- Add ProjectSelectionHandler to parse and handle CLIProxy project prompts
- Integrate project selection into AuthHandler with UI-first support
- Add project selection API endpoints and WebSocket events
- Implement ProjectSelectionDialog and useProjectSelection hook in UI
- Fixes macOS OAuth timeout by handling interactive project selection via UI
2025-12-18 04:11:59 -05:00
kaitranntt e80c48c55f feat(oauth): enhance auth flow with detailed pre-flight checks and real-time progress 2025-12-14 23:07:03 -05:00
kaitranntt a6b95dbac5 fix(cliproxy): add SSH port forwarding instructions for headless OAuth
When running OAuth in headless mode (SSH/remote), users now see clear
instructions about port forwarding requirement before the OAuth URL.
Previously, CLIProxyAPI's instructions were captured but not displayed.

- Show [!] PORT FORWARDING REQUIRED warning
- Explain that localhost:8085 callback must be reachable
- Show ssh -L command with <USER>@<HOST> placeholders
- Emphasize running on LOCAL machine, not remote
2025-12-14 01:07:20 -05:00
kaitranntt 84484c06c3 fix(cliproxy): inherit stdin for OAuth interactive prompts
Change stdio from 'ignore' to 'inherit' for stdin in auth subprocess,
allowing CLIProxy to receive user input for email/alias prompts during
Qwen and other OAuth flows.

Fixes #91
2025-12-12 15:54:11 -05:00
kaitranntt d64115f91a feat(analytics): add 24H hourly chart with caching and UI improvements
- Add GitHub link button next to connection status for quick issue reporting
- Add 24H button on analytics page with hourly granularity chart
- Add /api/usage/hourly endpoint with date range filtering
- Add hourly data aggregation and caching (disk + memory)
- Fix timezone display: convert UTC hours to local time in chart
- Fix CLIProxy Stats card loading state synchronization
- Bump disk cache version to 3 (includes hourly data)
2025-12-12 15:33:22 -05:00
kaitranntt 4005f1c01c feat(cli): standardize UI output with ui.ts abstraction layer 2025-12-12 05:11:59 -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 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 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 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 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
20bf6266d2 feat(cliproxy): add iFlow OAuth provider support (#55)
Add iFlow as a new OAuth-based provider for CLIProxy.

Changes:
- Add config/base-iflow.settings.json with iFlow provider configuration
- Add iFlow to CLIProxyProvider type
- Add iFlow OAuth config (authUrl, scopes, authFlag)
- Add iFlow to provider display names, auth prefixes, and type values
- Update config-generator to support iFlow provider
- Update base-qwen.settings.json models (qwen3-coder-plus)

Co-authored-by: kaitranntt <kaitran.ntt@gmail.com>
2025-12-05 13:31:42 -05:00
kaitranntt af4d6cff89 fix(cliproxy): resolve windows auth browser not opening
- skip TTY check on Windows (process.stdin.isTTY returns undefined)
- Windows desktop environments always have browser capability
- also fix help-command version to read from package.json

Closes #42
2025-12-02 21:10:38 -05:00
kaitranntt 7e0b0feca8 fix(cliproxy): improve qwen oauth error handling
- Updated OAuth port documentation with correct flow types per provider
- Removed Qwen from port cleanup logic (Device Code Flow has no callback)
- Fixed Qwen error messages to show Device Code Flow troubleshooting tips

Fixes #29
2025-12-01 05:16:05 -05:00
Kai (Tam Nhu) TranandGitHub a3f1e52ac6 feat(cliproxy): add qwen code oauth provider support (#31)
Add 'qwen' as new CLIProxy OAuth provider with --qwen-login flag.
Support qwen3-coder model with base config at config/base-qwen.settings.json.
Register qwen OAuth endpoints and token prefix handling.
Update help documentation across all CLI entry points.

Implements issue #29
2025-12-01 03:51:47 -05:00
kaitranntt 4c81f28f0b fix(cliproxy): use double-dash flags for cliproxyapi auth (#24)
CLIProxyAPI updated from single-dash to double-dash CLI flags.
Changed -login to --login, -codex-login to --codex-login,
-antigravity-login to --antigravity-login, -config to --config,
and -no-browser to --no-browser.
2025-11-30 20:02:50 -05:00
kaitranntt 93b38d8550 fix(cliproxy): detect Gemini tokens by JSON type field
Root cause: CLIProxyAPI saves Gemini tokens without prefix
({email}-{projectID}.json), but CCS was only looking for
gemini-* files. Added content-based detection as fallback.

Changes:
- Added PROVIDER_TYPE_VALUES map for JSON type detection
- Added isTokenFileForProvider() for content-based detection
- Updated isAuthenticated() and getAuthStatus() with dual strategy
- Fixed triggerOAuth() success messaging and error hints
- Bumped patch version (3.0.8 -> 3.0.9)
2025-11-29 02:27:57 -05:00
kaitranntt e0df6aa900 fix(cliproxy): ensure provider-specific OAuth token detection
Fixes critical auth bug where checking any JSON file in the auth
directory would incorrectly mark providers as authenticated. Now
validates that token files match provider-specific prefixes (gemini-,
codex-, antigravity-) to prevent OAuth skipping across providers.

Updates help command examples to use placeholder syntax and updates
CHANGELOG to reflect Qwen -> Antigravity provider name change.
2025-11-28 20:53:20 -05:00
kaitranntt e54d401656 feat(cliproxy): refactor config loading and enhance base settings support
- Introduce `BaseConfigLoader` for centralized configuration management
- Add `base-agy.settings.json` configuration
- Refactor `ConfigGenerator` to utilize new loading patterns
- Update help command with improved documentation
- Clean up lint violations file
- Enhance postinstall script
2025-11-28 20:43:11 -05:00
kaitranntt efb966c96d feat(cliproxy): unified config for concurrent gemini/codex usage
- Add unified CLIProxy config supporting all providers concurrently
- Move CLIProxy files to ~/.ccs/cliproxy/ subdirectory
- Use flat auth directory structure for OAuth tokens
- Add provider-specific URL routing via /api/provider/{provider}
- Add base settings templates for gemini and codex
- Fix model registration with proper auth file discovery

Enables users to run `ccs gemini` and `ccs codex` concurrently
without config conflicts.
2025-11-28 19:41:28 -05:00
kaitranntt 5f71eba6f6 feat(cliproxy): add CLIProxyAPI integration for OAuth profiles
Complete integration of CLIProxyAPI for zero-config OAuth profiles.

New profiles:
- ccs gemini: Gemini via OAuth
- ccs chatgpt: ChatGPT via OAuth
- ccs qwen: Qwen via OAuth

Implementation:
- Phase 1: Binary infrastructure (download-on-demand)
- Phase 2: Proxy executor (spawn/kill pattern)
- Phase 3: OAuth integration (browser-based auth)
- Phase 4: Profile registration (routing + help text)
- Phase 5: Diagnostics (doctor command + errors)

Files added:
- src/cliproxy/*.ts (binary-manager, platform-detector, executor, auth-handler, config-generator, types, index)

Files modified:
- src/ccs.ts (CLIProxy routing)
- src/auth/profile-detector.ts (cliproxy profile type)
- src/commands/help-command.ts (new profiles in help)
- src/management/doctor.ts (CLIProxy health checks)
- src/utils/error-manager.ts (OAuth/port/download errors)
- CHANGELOG.md (v5.0.0 release notes)

Tests: 42/42 passed
2025-11-28 16:28:15 -05:00