Commit Graph
1792 Commits
Author SHA1 Message Date
github-actions[bot] a24ae6ab3b chore(release): 7.11.1-dev.2 [skip ci] 2025-12-30 21:05:27 +00:00
Kai (Tam Nhu) TranandGitHub 5cb4209762 Merge pull request #230 from kaitranntt/kai/fix/remote-proxy-default-port
fix(cliproxy): use correct default port for remote HTTP connections
2025-12-30 13:04:33 -08:00
kaitranntt 76aab09616 fix(cliproxy): use correct default port (8317) for remote HTTP connections
Root cause: Inconsistent default port logic across code paths.
- Test Connection used 8317 (correct)
- Actual API calls used 80 (wrong)

Changes:
- Add centralized getRemoteDefaultPort() helper in config-generator.ts
- Fix proxy-target-resolver.ts to use shared helper
- Fix rewriteLocalhostUrls() and getRemoteEnvVars() in config-generator.ts
- Update remote-proxy-client.ts to use shared helper (DRY)

Fixes all 3 reported issues:
1. Port empty → now correctly uses :8317 instead of :80
2. BASEURL construction → now includes correct port
3. CLIProxy Plus auth → now fetches from remote on correct port
2025-12-30 16:03:09 -05:00
github-actions[bot] 59928c106b chore(release): 7.11.1-dev.1 [skip ci] 2025-12-30 18:42:08 +00:00
Kai (Tam Nhu) TranandGitHub ae40e4c42f Merge pull request #229 from kaitranntt/fix/228-variant-port-not-passed
fix(cliproxy): pass variant port to executor for isolation
2025-12-30 10:41:14 -08:00
kaitranntt 2625389120 fix(cliproxy): propagate port in unified config and UI preset handlers
Edge case fixes identified in codebase review:
- Unified config variant detection: add settingsPath and port fields
- Provider editor: use variant port in handleApplyPreset/handleCustomPresetApply
- preset-utils: add optional port parameter to applyDefaultPreset()
2025-12-30 13:12:54 -05:00
kaitranntt e58afd7790 fix(cliproxy): pass variant port to executor for isolation
Variants configured with dedicated ports (8318-8417) were not using
their assigned port. The executor always defaulted to 8317.

Changes:
- Add port field to ProfileDetectionResult interface
- Pass variant.port from profile-detector to ccs.ts
- Forward port to execClaudeWithCLIProxy options
- Update executor priority: CLI flags > variant port > config.yaml > default

Closes #228
2025-12-30 12:42:54 -05:00
semantic-release-bot cf83425bcf chore(release): 7.11.1 [skip ci]
## [7.11.1](https://github.com/kaitranntt/ccs/compare/v7.11.0...v7.11.1) (2025-12-29)

### Bug Fixes

* validate required config fields before save ([#225](https://github.com/kaitranntt/ccs/issues/225)) ([388428b](https://github.com/kaitranntt/ccs/commit/388428bba935393f7619b9c682cf43c3dfb966af)), closes [#224](https://github.com/kaitranntt/ccs/issues/224) [#224](https://github.com/kaitranntt/ccs/issues/224)
2025-12-29 22:17:03 +00:00
Kai (Tam Nhu) TranandGitHub 6bdcc00d92 Merge pull request #226 from kaitranntt/dev
feat(release): promote dev to main
2025-12-29 14:15:58 -08:00
github-actions[bot] 98a1d0898d chore(release): 7.11.0-dev.1 [skip ci] 2025-12-29 22:10:21 +00:00
Kai (Tam Nhu) TranandGitHub 388428bba9 fix: validate required config fields before save (#225)
* fix(ui): validate BASE_URL and AUTH_TOKEN before save

- Add validation in use-provider-editor to block save when required
  env vars (ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN) are missing
- Show warning banner in raw editor when required fields are absent
- Always apply default preset on account add (not just first account)

This implements defense-in-depth: validation UI prevents confusion,
save-time validation prevents broken configs, auto-preset ensures
new providers start with working configuration.

Fixes #224

* fix: add validation to remaining settings routes and UI hooks

Backend:
- settings-routes.ts: Validate ANTHROPIC_BASE_URL and AUTH_TOKEN on PUT
- profile-routes.ts: Validate baseUrl/apiKey not empty on update
- variant-routes.ts: Require model field for variant creation

Frontend:
- use-profile-editor.ts: Add required field validation + error handling
- use-copilot-config-form.ts: Add required field validation + error handling

Both hooks now expose missingRequiredFields for UI warnings.

Ref #224

* feat(ux): auto-fill missing BASE_URL/AUTH_TOKEN from defaults at runtime

Instead of blocking saves when required env vars are missing, the system now:
- Runtime fills missing values from getClaudeEnvVars() defaults
- Backend returns warning in response (not 400 error)
- UI shows informational toast instead of blocking error
- Yellow warning banner still shown for user awareness

This provides better UX for CLIProxy users - saves always work, and
missing fields automatically use sensible defaults (local proxy URL
and global API key).

* fix(api): validate settings object before write to prevent undefined file content

Add validation to PUT /api/settings/:profile to return 400 if settings
object is undefined/null. Previously JSON.stringify(undefined) would
write literal "undefined" string to settings file.

* fix: add port validation and pre-save warning UI

- Add validatePort() helper (1-65535 range) to config-generator.ts
- Add missing field warning banner to copilot/config-form UI
- Add missing field warning banner to profiles/editor UI
- Wire missingRequiredFields prop through components
2025-12-29 14:09:27 -08:00
semantic-release-bot 68835aee8e chore(release): 7.11.0 [skip ci]
## [7.11.0](https://github.com/kaitranntt/ccs/compare/v7.10.0...v7.11.0) (2025-12-29)

### Features

* **cliproxy:** add --proxy-timeout CLI option ([#220](https://github.com/kaitranntt/ccs/issues/220)) ([4cd9bec](https://github.com/kaitranntt/ccs/commit/4cd9bec9e1b88ebd6b83c6faf9c01399865c639b))
2025-12-29 20:59:21 +00:00
Shun KakinokiandGitHub 4cd9bec9e1 feat(cliproxy): add --proxy-timeout CLI option (#220)
Add configurable timeout for remote proxy connection checks.

- Add --proxy-timeout <ms> CLI flag (100-60000ms range)
- Add CCS_PROXY_TIMEOUT environment variable support
- Update help documentation for new option
- Default remains 2000ms for backward compatibility
2025-12-29 12:58:19 -08:00
semantic-release-bot 14df54b60b chore(release): 7.10.0 [skip ci]
## [7.10.0](https://github.com/kaitranntt/ccs/compare/v7.9.0...v7.10.0) (2025-12-29)

### Features

* **cliproxy:** add account quota display for Antigravity provider ([205b5ab](https://github.com/kaitranntt/ccs/commit/205b5ab71fe560cdc8eed046ae133d40343df156))
* **error-logs:** extract model and quota reset info from error logs ([e3a71fc](https://github.com/kaitranntt/ccs/commit/e3a71fc89372e81af3c425c5bf8e42630b4c1b6b))
* **quota:** add OAuth token refresh for independent quota fetching ([4be8e92](https://github.com/kaitranntt/ccs/commit/4be8e927a08bbdcca02d000a9780e8466f0fc1f0))
* **quota:** implement proactive token refresh (5-min lead time) ([00597b3](https://github.com/kaitranntt/ccs/commit/00597b335887b9280b22d78d522146ee65e7037e))
* **ui:** replace misleading token expiry with runtime-based status ([6ccf6c5](https://github.com/kaitranntt/ccs/commit/6ccf6c5e138f6fdc847d47ef885dde39bc7aeeb1))

### Bug Fixes

* **cliproxy:** resolve merge conflicts and add edge case fixes ([7861b63](https://github.com/kaitranntt/ccs/commit/7861b63a5d977921bb0d726e7954b5c10cf74c1f))
* **error-logs:** fix endpoint regex for v1/messages URL format ([19550b2](https://github.com/kaitranntt/ccs/commit/19550b28f0087ec81925076d10205ce333c37799))
* **quota,error-logs:** match CLIProxyAPI headers and enhance error log display ([ac6f382](https://github.com/kaitranntt/ccs/commit/ac6f382f6a6cd64aa3fa0727d11bcf498aae28fc))
* **quota:** add unprovisioned account detection with actionable message ([ecfdcde](https://github.com/kaitranntt/ccs/commit/ecfdcdef782c429e2e125598d11ef7d974e68ae2))
* **quota:** remove misleading token expiration check in quota fetcher ([739270a](https://github.com/kaitranntt/ccs/commit/739270aac40f23239bd85a07dab30c20a3fab80a))
* **ui:** remove duplicate provider prop in ModelConfigTab ([3531991](https://github.com/kaitranntt/ccs/commit/3531991b5ddeb9678927c140383c1588a3898d16))
* **ui:** replace misleading 'Expires' with 'Last used' in credential health ([4233415](https://github.com/kaitranntt/ccs/commit/4233415095d7a56ebd98cb0f76a95e37ce25ddea))
2025-12-29 20:53:13 +00:00
Kai (Tam Nhu) TranandGitHub b09d8fbe9f Merge pull request #223 from kaitranntt/dev
feat(cliproxy): account quota integration with enhanced error log display
2025-12-29 12:52:10 -08:00
github-actions[bot] d7bac2391b chore(release): 7.9.0-dev.1 [skip ci] 2025-12-29 20:51:35 +00:00
Kai (Tam Nhu) TranandGitHub 5be0d9bf22 Merge pull request #222 from kaitranntt/feat/account-quota-integration
feat(cliproxy): add account quota display for Antigravity provider
2025-12-29 12:50:38 -08:00
kaitranntt ac6f382f6a fix(quota,error-logs): match CLIProxyAPI headers and enhance error log display
Quota fetcher:
- loadCodeAssist headers now match antigravity.go exactly
- fetchAvailableModels uses empty body {} and correct User-Agent
- Prevents accounts being flagged for anomalous requests

Error logs:
- Extract status code from end of log (RESPONSE section)
- Display full model names instead of abbreviated
- Show status badges (500/429/4xx) with color coding
- Add provider icons with white background
2025-12-29 15:48:37 -05:00
kaitranntt 00597b3358 feat(quota): implement proactive token refresh (5-min lead time)
- Refresh token 5 minutes before expiry (matches CLIProxyAPIPlus)
- Only refresh when: expired, no expiry info, or expiring within 5 min
- Reduces unnecessary OAuth API calls when token is still valid
2025-12-29 13:57:21 -05:00
kaitranntt 19550b28f0 fix(error-logs): fix endpoint regex for v1/messages URL format 2025-12-29 13:53:24 -05:00
kaitranntt ecfdcdef78 fix(quota): add unprovisioned account detection with actionable message
- Add isUnprovisioned flag to QuotaResult interface
- Detect when account is authenticated but lacks project ID
- Show actionable message: "Sign in to Antigravity app to activate quota."
- Refactor getProjectId retry logic for cleaner error propagation
2025-12-29 13:48:56 -05:00
kaitranntt e3a71fc893 feat(error-logs): extract model and quota reset info from error logs
- Add model, quotaResetDelay, quotaResetTimestamp fields to ParsedErrorLog
- Extract model from requestBody JSON
- Parse quota reset delay/timestamp from 429 response bodies
- Display model prominently in Overview tab with violet highlight
- Show quota reset countdown for rate limit errors
- Improve actionable suggestions with color-coded error types
2025-12-29 13:40:17 -05:00
kaitranntt 4be8e927a0 feat(quota): add OAuth token refresh for independent quota fetching
CCS can now fetch quota independently of CLIProxyAPI by refreshing
access tokens using the refresh_token stored in auth files.

- Add refreshAccessToken() using Google OAuth token endpoint
- Use public Antigravity OAuth credentials (from CLIProxyAPIPlus)
- Proactively refresh token before API calls to avoid stale tokens
- Fallback retry on auth errors

This fixes quota showing "Access token expired" for accounts whose
file-based access_token is stale (CLIProxyAPI refreshes at runtime
but doesn't persist to disk).
2025-12-29 13:25:14 -05:00
kaitranntt 739270aac4 fix(quota): remove misleading token expiration check in quota fetcher
Backend was returning 'Token expired' error based on stale file state
without attempting API call. CLIProxyAPIPlus refreshes tokens at runtime
but intentionally doesn't persist to disk, making file-based expiration
checks always misleading.

Now quota fetcher attempts API call regardless of file expiration state.
If token is truly invalid, API returns 401 which is handled properly.
2025-12-29 13:18:02 -05:00
kaitranntt 4233415095 fix(ui): replace misleading 'Expires' with 'Last used' in credential health
- credential-health-list.tsx showed 'Expires: Expired' based on stale
  file state (CLIProxyAPIPlus intentionally doesn't persist refreshed
  token expiry to disk)
- Now shows runtime-based 'Last used: Xm/h/d ago' from useCliproxyStats
- Consistent with account-item.tsx changes from previous commit
2025-12-29 13:15:51 -05:00
kaitranntt 6ccf6c5e13 feat(ui): replace misleading token expiry with runtime-based status
- Remove "Token expired" warning (showed stale file state, not runtime)
- Add "Active/Last used" status based on CLIProxyAPI runtime stats
- Show green checkmark for recently used accounts (within 1h)
- Show "Not used yet" for accounts without usage stats
- Remove expired warning from flow-viz account cards
- Add model quota sorting (Claude > Gemini > GPT > other)
- Add quota reset time display in tooltips
- Fix re-auth button to use correct CCS endpoint
- Reduce quota cache staleness (30s stale, 1m refresh)

CLIProxyAPI intentionally doesn't persist refreshed tokens to disk
(to prevent refresh loops), so file-based expiry was misleading.
Dashboard now shows truthful operational state from runtime stats.
2025-12-29 13:03:37 -05:00
kaitranntt 3531991b5d fix(ui): remove duplicate provider prop in ModelConfigTab 2025-12-29 10:07:45 -05:00
kaitranntt 7861b63a5d fix(cliproxy): resolve merge conflicts and add edge case fixes
Merge changes from dev:
- Kiro incognito toggle feature
- Auth profile management
- Setup wizard updates

Edge case fixes:
- Add fs.existsSync check before readdirSync in quota-fetcher
- Add isFinite check for quota values
- Clamp percentage to 0-100 range
- Wrap error response JSON parsing in try-catch
2025-12-29 09:56:55 -05:00
kaitranntt 205b5ab71f feat(cliproxy): add account quota display for Antigravity provider
- Add quota-fetcher.ts for Google Cloud Code API integration
- Add REST endpoint GET /api/cliproxy/quota/:provider/:accountId
- Add useAccountQuota hook with React Query caching
- Display quota bar in AccountItem with per-model tooltip
- Create reusable Progress component
- Consolidate quota types in api-client.ts
2025-12-28 19:24:12 -05:00
semantic-release-bot e0eb05986d chore(release): 7.9.0 [skip ci]
## [7.9.0](https://github.com/kaitranntt/ccs/compare/v7.8.0...v7.9.0) (2025-12-27)

### Features

* **dashboard:** add Import from Kiro IDE button ([5f59d71](https://github.com/kaitranntt/ccs/commit/5f59d710a687aa23b22f470114fc763bf1412fbd))
* **ui:** add auth profile management to Dashboard ([fa8830e](https://github.com/kaitranntt/ccs/commit/fa8830e1ce97b6f0bb5f89c93325414a15412369))

### Bug Fixes

* **cliproxy:** ensure version sync after binary update ([29f1930](https://github.com/kaitranntt/ccs/commit/29f19308e627f46a5144521f8f2c75e9ff746f6a))
* **config:** use safe inline logic in getSettingsPath() legacy fallback ([a4a473a](https://github.com/kaitranntt/ccs/commit/a4a473ac93a3adf9b51a0e9371bbd48fa7363157))
* **dashboard:** support unified config.yaml in web server routes ([0c69740](https://github.com/kaitranntt/ccs/commit/0c697406947ef37f194db26e31d5822cc7e12463)), closes [#206](https://github.com/kaitranntt/ccs/issues/206)
* improve type safety and error handling in config-manager ([8a3c5a4](https://github.com/kaitranntt/ccs/commit/8a3c5a446beb197148a132900a88f09043cbab55)), closes [#215](https://github.com/kaitranntt/ccs/issues/215)
* **kiro:** add fallback import from Kiro IDE when OAuth callback redirects ([add4aa5](https://github.com/kaitranntt/ccs/commit/add4aa55c752be54164b42b0c108f54c24944570)), closes [#212](https://github.com/kaitranntt/ccs/issues/212)
* run RecoveryManager before early-exit commands and improve config handling ([0be3977](https://github.com/kaitranntt/ccs/commit/0be397784525275d0bbcc94877942f8963ca3d33)), closes [#214](https://github.com/kaitranntt/ccs/issues/214)
* **test:** remove redundant build from beforeAll hook ([67a48a8](https://github.com/kaitranntt/ccs/commit/67a48a8305125959ecab468f117cc9de0badddd5))
* **tests:** update test files for renamed getCliproxyConfigPath function ([ec2ee0a](https://github.com/kaitranntt/ccs/commit/ec2ee0a36d8498fb596d2e3ef793ce89a9f254f8))
* wrap RecoveryManager in try-catch to prevent blocking CLI commands ([2fff770](https://github.com/kaitranntt/ccs/commit/2fff770b6bc67616e855cc8dc940751bd1267a67)), closes [#215](https://github.com/kaitranntt/ccs/issues/215)

### Documentation

* update design principles and add feature interface requirements ([c200334](https://github.com/kaitranntt/ccs/commit/c20033473b150689ff4c581d5b4b2a6e12adb758))
2025-12-27 21:46:49 +00:00
Kai (Tam Nhu) TranandGitHub db4249ff50 Merge pull request #217 from kaitranntt/dev
feat: auth profile management, Kiro import, and config recovery
2025-12-27 13:45:48 -08:00
github-actions[bot] 886c8e4397 chore(release): 7.8.0-dev.4 [skip ci] 2025-12-27 21:40:35 +00:00
Kai (Tam Nhu) TranandGitHub d386ea7c3d Merge pull request #216 from kaitranntt/feat/dashboard-parity-auth-crud
feat(ui): add auth profile management to Dashboard
2025-12-27 13:39:39 -08:00
github-actions[bot] d515c49f5d chore(release): 7.8.0-dev.3 [skip ci] 2025-12-27 21:32:45 +00:00
Kai (Tam Nhu) TranandGitHub 0b0959314c Merge pull request #215 from kaitranntt/fix/214-config-recovery-before-commands
fix: run RecoveryManager before early-exit commands and improve config handling
2025-12-27 13:31:51 -08:00
kaitranntt 67a48a8305 fix(test): remove redundant build from beforeAll hook
CI already runs bun run build:all before validate step.
Duplicate build in test hook was causing timeout in CI.
2025-12-27 16:30:25 -05:00
kaitranntt 8a3c5a446b fix: improve type safety and error handling in config-manager
- Wrap JSON.parse in try-catch with clear error message for malformed JSON
- Add iflow, kiro, ghcp providers to CLIProxyVariantConfig type
- Make settings optional in CLIProxyVariantConfig (was required with empty string fallback)
- Remove unsafe type cast in loadConfigSafe()

Addresses additional edge cases from PR #215 code review.
2025-12-27 12:28:59 -05:00
github-actions[bot] 8cea17d5f3 chore(release): 7.8.0-dev.2 [skip ci] 2025-12-27 17:26:14 +00:00
kaitranntt 2fff770b6b fix: wrap RecoveryManager in try-catch to prevent blocking CLI commands
Recovery failures (permission errors, disk full) no longer block
--version/--help commands. Recovery is best-effort - warns on failure
but allows basic CLI functionality to continue.

Fixes edge case identified in PR #215 code review.
2025-12-27 12:25:59 -05:00
Kai (Tam Nhu) TranandGitHub 969d595285 Merge pull request #213 from kaitranntt/kai/fix/kiro-callback-fallback
fix(kiro): add fallback import from Kiro IDE when OAuth callback redirects
2025-12-27 09:25:11 -08:00
kaitranntt 5f59d710a6 feat(dashboard): add Import from Kiro IDE button
Add "Import from IDE" button to Dashboard AddAccountDialog for Kiro provider:
- POST /api/cliproxy/auth/kiro/import endpoint using tryKiroImport()
- useKiroImport() React Query hook with cache invalidation
- UI button shown alongside OAuth authenticate for Kiro only
- Applies default preset when importing first account
- Fix UI typecheck script (remove incompatible --build flag)
2025-12-27 12:04:52 -05:00
github-actions[bot] 716122f35b chore(release): 7.8.0-dev.1 [skip ci] 2025-12-27 16:59:31 +00:00
kaitranntt c20033473b docs: update design principles and add feature interface requirements 2025-12-27 11:54:08 -05:00
kaitranntt fa8830e1ce feat(ui): add auth profile management to Dashboard
- Add create profile dialog with CLI command copy-paste
- Add delete profile with confirmation dialog
- Add reset to CCS default button
- Add DELETE endpoints for /accounts/:name and /accounts/reset-default
- Achieve CLI/Dashboard parity per design philosophy

Refs: plans/251227-0114-ccs-cli-dashboard-parity-audit
2025-12-27 11:20:10 -05:00
kaitranntt ec2ee0a36d fix(tests): update test files for renamed getCliproxyConfigPath function
Update tests to use renamed function after refactoring getConfigPath
to getCliproxyConfigPath in cliproxy/config-generator.ts

Files updated:
- tests/unit/cliproxy/config-generator-port.test.js
- tests/unit/cliproxy/config-generator.test.js
2025-12-27 01:14:54 -05:00
kaitranntt 0be3977845 fix: run RecoveryManager before early-exit commands and improve config handling
Fixes #214 - Fresh install fails with 'Config not found' when running
ccs config before RecoveryManager runs.

Changes:
- Move RecoveryManager.recoverAll() before all early-exit commands in ccs.ts
- Fix loadConfigSafe() to return empty config instead of throwing in legacy mode
- Add getActiveConfigPath() for mode-aware config path resolution
- Rename cliproxy getConfigPath() to getCliproxyConfigPath() to avoid confusion
- Update help-command.ts to show correct config path based on mode

This ensures all commands benefit from auto-recovery on fresh installs,
and gracefully handles missing config files in all code paths.
2025-12-27 00:05:31 -05:00
kaitranntt add4aa55c7 fix(kiro): add fallback import from Kiro IDE when OAuth callback redirects
When Kiro OAuth callback redirects to Kiro IDE instead of CLI, this fix:
- Auto-attempts token import from Kiro IDE storage
- Adds --import flag for manual import (ccs kiro --import)
- Shows clear instructions if import fails

Fixes #212
2025-12-27 00:01:40 -05:00
Kai (Tam Nhu) TranandGitHub 8833a5a77f Merge pull request #211 from kaitranntt/fix/206-dashboard-unified-config
fix(dashboard): support unified config.yaml in web server routes
2025-12-26 10:53:08 -08:00
kaitranntt a4a473ac93 fix(config): use safe inline logic in getSettingsPath() legacy fallback
The try/catch around loadConfig() in getSettingsPath() was ineffective
because process.exit() cannot be caught by try/catch - it terminates
the process immediately.

Replace with inline safe logic that:
1. Checks if config.json exists with fs.existsSync()
2. Reads and parses JSON manually
3. Uses isConfig() type guard for validation
4. Properly catches JSON parse errors

This ensures unified mode users don't crash when falling back to check
legacy config.json for profiles not found in config.yaml.
2025-12-26 13:47:17 -05:00
Kai (Tam Nhu) TranandGitHub 7d1525b75c Merge pull request #210 from kaitranntt/fix/cliproxy-version-sync-restart
fix(cliproxy): ensure version sync after binary update
2025-12-26 10:41:11 -08:00