Commit Graph
1012 Commits
Author SHA1 Message Date
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
kaitranntt 0c69740694 fix(dashboard): support unified config.yaml in web server routes
Add loadConfigSafe() function that handles both unified (config.yaml) and
legacy (config.json) config formats. Uses throwable errors instead of
process.exit() so try/catch blocks work properly in web server routes.

Updated files to use loadConfigSafe():
- overview-routes.ts: Dashboard overview API
- route-helpers.ts: readConfigSafe() helper
- profile-reader.ts: API profile reading
- profile-writer.ts: API profile writing
- variant-config-adapter.ts: CLIProxy variant config

Fixes #206 (Problem 2: config.json not found when user has config.yaml)
2025-12-26 13:37:54 -05:00
semantic-release-bot e89a79f357 chore(release): 7.8.0 [skip ci]
## [7.8.0](https://github.com/kaitranntt/ccs/compare/v7.7.1...v7.8.0) (2025-12-26)

### Features

* **api:** add auth tokens REST endpoints ([ffd4996](https://github.com/kaitranntt/ccs/commit/ffd499698e03f1849a0deef3d289c08079a0951e))
* **cli:** add tokens command for auth token management ([0c6491c](https://github.com/kaitranntt/ccs/commit/0c6491c9d27a3bfb1ecc8c1627d1e1a70f59220a))
* **cliproxy:** add customizable auth token manager ([c4f0916](https://github.com/kaitranntt/ccs/commit/c4f09168ff35e52c8613a3181a86e4e4e5392dfc))
* **cliproxy:** add variant port isolation for concurrent proxy instances ([0bcaf4b](https://github.com/kaitranntt/ccs/commit/0bcaf4bc681e26bd13485678c88b55f4ac471eed))
* **ui:** add auth tokens settings tab ([71335a6](https://github.com/kaitranntt/ccs/commit/71335a61935971c7621fefcef973cc2b42e313fd))
* **ui:** add Settings link to control panel key hint ([7a6341f](https://github.com/kaitranntt/ccs/commit/7a6341f0d9a8dffdcbb318cf34f3dbbfbea70cb5))

### Bug Fixes

* **cliproxy:** use auth inheritance in stats-fetcher and config-generator ([133aeba](https://github.com/kaitranntt/ccs/commit/133aebaabc2295b75c13a14a448c2cc60d471363))
* **dashboard:** read accounts from unified config ([8d7845d](https://github.com/kaitranntt/ccs/commit/8d7845d67fb156671713888726d631415d0f4f9c)), closes [#203](https://github.com/kaitranntt/ccs/issues/203)
* **dashboard:** support unified config across health checks and settings ([9722e19](https://github.com/kaitranntt/ccs/commit/9722e1905dd25b9dd4d602e860ba36586db043b9)), closes [#203](https://github.com/kaitranntt/ccs/issues/203)
* **dashboard:** support unified config in overview and file watcher ([25f0ddb](https://github.com/kaitranntt/ccs/commit/25f0ddb9ddb19f9eb75c880b7c878d840cb2a494)), closes [#203](https://github.com/kaitranntt/ccs/issues/203)
* **doctor:** comprehensive health check fixes ([ac74550](https://github.com/kaitranntt/ccs/commit/ac745503e2a1644b2cb3542b917dbce5e6109200))
* **doctor:** prefer config.yaml and make settings files optional ([4fca7d1](https://github.com/kaitranntt/ccs/commit/4fca7d16edc6985d14422a21d45dccd619ef9aba))
* **ui:** initialize colors early for consistent status output ([e38af6a](https://github.com/kaitranntt/ccs/commit/e38af6ad6e2f65a73b4d16f6b4f0cead2eb7374d)), closes [#201](https://github.com/kaitranntt/ccs/issues/201)
* **ui:** simplify config header and add explicit save button ([7e031b5](https://github.com/kaitranntt/ccs/commit/7e031b5097b49f0cfc07334d31b83af41fac9669))
* **ui:** use effective management secret in control panel embed ([a762563](https://github.com/kaitranntt/ccs/commit/a762563f1b1fa8d984b7c9abf6b3b3c7f8ab6f97))

### Tests

* **cliproxy:** add comprehensive auth token test suite ([ed6776a](https://github.com/kaitranntt/ccs/commit/ed6776aadcf06c0c8572babe1ddc1de4e0902a17))
* **cliproxy:** add integration tests for variant port isolation ([8f120b5](https://github.com/kaitranntt/ccs/commit/8f120b515f0b71a2730c7affb50c9b148c00e502)), closes [#184](https://github.com/kaitranntt/ccs/issues/184)
2025-12-26 18:35:37 +00:00
Kai (Tam Nhu) TranandGitHub eeff3f48e5 Merge pull request #209 from kaitranntt/dev
feat: auth tokens, variant port isolation, and health check improvements
2025-12-26 10:34:34 -08:00
kaitranntt 29f19308e6 fix(cliproxy): ensure version sync after binary update
- Add SIGKILL escalation after 3s SIGTERM timeout in session-tracker
- Auto-stop running proxy before binary update in binary-manager
- Add waitForPortFree utility to port-utils
- Detect version mismatch on startup and auto-restart outdated proxy
- Store and expose version in session lock for detection

Fixes issue where old proxy version continues running after update,
causing UI to show different version than actually running.
2025-12-26 13:31:27 -05:00
github-actions[bot] 2093ae2cc8 chore(sync): merge main into dev after release [skip ci]
# Conflicts:
#	package.json
2025-12-26 18:09:54 +00:00
semantic-release-bot 8b9da926f2 chore(release): 7.7.1 [skip ci]
## [7.7.1](https://github.com/kaitranntt/ccs/compare/v7.7.0...v7.7.1) (2025-12-26)

### Bug Fixes

* **health:** correct CLIProxy port detection on macOS/Linux ([d1a0ebe](https://github.com/kaitranntt/ccs/commit/d1a0ebee61b8987df85c328d359967e46d1e5226))
* **health:** use prefix matching for Linux process name truncation ([91e7b9f](https://github.com/kaitranntt/ccs/commit/91e7b9f93787e5b2d45bffdaed75e75c151281e4))
2025-12-26 18:09:26 +00:00
Kai (Tam Nhu) TranandGitHub 3a95c0625f Merge pull request #207 from shunkakinoki/fix/cliproxy-port-detection
fix(health): correct CLIProxy port detection on macOS/Linux
2025-12-26 10:08:20 -08:00
github-actions[bot] 32690460d1 chore(release): 7.7.0-dev.5 [skip ci] 2025-12-26 18:06:16 +00:00
Kai (Tam Nhu) TranandGitHub ad4cfdc1a7 Merge pull request #208 from kaitranntt/fix/config-check-outdated-file-requirements
fix(doctor): prefer config.yaml and make settings files optional
2025-12-26 10:05:14 -08:00
kaitranntt 91e7b9f937 fix(health): use prefix matching for Linux process name truncation
Linux kernel truncates process names to 15 chars, causing
'cli-proxy-api-plus' to appear as 'cli-proxy-api-p' in lsof output.
Switch from exact whitelist to prefix matching for robust detection.
2025-12-26 12:57:56 -05:00
kaitranntt ac745503e2 fix(doctor): comprehensive health check fixes
- profile-check.ts: check config.yaml first, fallback to config.json
- recovery-manager.ts: remove dead code (ensureGlm/Glmt/Kimi methods)
- 4 files: use os.homedir() for cross-platform compatibility

Fixes:
- ProfilesChecker now respects unified config format (yaml)
- Removed ~100 lines of dead code that contradicted install policy
- Windows compatibility for home directory detection

Files modified:
- src/management/checks/profile-check.ts
- src/management/recovery-manager.ts
- src/cliproxy/model-config.ts
- src/cliproxy/services/variant-service.ts
- src/web-server/health/config-checks.ts
- src/web-server/routes/settings-routes.ts
2025-12-26 12:54:54 -05:00
kaitranntt 4fca7d16ed fix(doctor): prefer config.yaml and make settings files optional
- Check config.yaml first (v2 format), fallback to config.json (legacy)
- Make glm.settings.json and kimi.settings.json optional
- Only validate settings files if they exist
- Fix false positives: postinstall no longer creates these files

Fixes health check reporting errors for missing files that are now
optional and created on-demand when user configures a profile.
2025-12-26 12:45:12 -05:00
github-actions[bot] aa5c3a1242 chore(release): 7.7.0-dev.4 [skip ci] 2025-12-26 17:36:24 +00:00
Kai (Tam Nhu) TranandGitHub 3a6e3cf6b6 Merge pull request #205 from kaitranntt/kai/feat/customizable-auth-tokens
feat(cliproxy): customizable auth tokens for CLIProxyAPI
2025-12-26 09:35:21 -08:00
kaitranntt 7a6341f0d9 feat(ui): add Settings link to control panel key hint
Adds a gear icon link next to the masked key hint that navigates
to Settings > Auth, improving UX for users who need to manage
their auth tokens.
2025-12-26 12:23:24 -05:00
github-actions[bot] 14d69d1477 chore(release): 7.7.0-dev.3 [skip ci] 2025-12-26 17:21:01 +00:00
Kai (Tam Nhu) TranandGitHub 90134de28b Merge pull request #204 from kaitranntt/kai/fix/203-dashboard-accounts-unified-config
fix(dashboard): read accounts from unified config
2025-12-26 09:20:02 -08:00
Shun KakinokiandClaude Opus 4.5 d1a0ebee61 fix(health): correct CLIProxy port detection on macOS/Linux
Two bugs caused the health check to incorrectly report "Proxy not running":

1. lsof command used mutually exclusive flags (-t and -F)
   - Removed -t flag since -F already provides structured output

2. isCLIProxyProcess whitelist was missing common binary names
   - Added: cliproxyapi, cli-proxy-api-plus (and .exe variants)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 19:42:23 +09:00
kaitranntt a762563f1b fix(ui): use effective management secret in control panel embed
- Fetch auth tokens from /api/settings/auth/tokens/raw
- Use effective management secret for local mode auto-login
- Remove hardcoded CCS_CONTROL_PANEL_SECRET constant
- Key hint now shows correct secret (custom or default)
2025-12-25 17:15:00 -05:00
kaitranntt 7e031b5097 fix(ui): simplify config header and add explicit save button
- Reduce config.yaml header from 26 lines to 2 lines
- Replace auto-save on blur with explicit Save button in Auth section
- Add hasChanges detection to enable/disable Save button
- Remove unused saveApiKey and saveSecret functions
2025-12-25 17:02:14 -05:00
kaitranntt 9722e1905d fix(dashboard): support unified config across health checks and settings
- health-service.ts: respect isUnifiedMode() in fixHealthIssue()
- config-checks.ts: check config.yaml in unified mode
- profile-checks.ts: read profiles from unified config
- settings-routes.ts: use atomic writes (temp+rename) for presets
- profile-registry.ts: add DRY helpers getAllProfilesMerged(), getDefaultResolved()

Closes #203
2025-12-25 16:50:55 -05:00
kaitranntt ed6776aadc test(cliproxy): add comprehensive auth token test suite
- auth-token-manager.test.js: token generation, masking, inheritance (35 tests)
- tokens-command.test.js: CLI parsing and flag handling (24 tests)
- settings-routes-auth.test.js: API endpoint responses (22 tests)
- Total: 81 new tests covering all auth token functionality
2025-12-25 16:43:39 -05:00
kaitranntt 133aebaabc fix(cliproxy): use auth inheritance in stats-fetcher and config-generator
- Replace hardcoded CCS_CONTROL_PANEL_SECRET with getEffectiveManagementSecret()
- Replace hardcoded CCS_INTERNAL_API_KEY with getEffectiveApiKey()
- Ensures custom tokens work across entire CLIProxy integration
2025-12-25 14:37:53 -05:00
kaitranntt 71335a6193 feat(ui): add auth tokens settings tab
- Add AuthSection component with API key and management secret inputs
- Show/hide toggle, copy to clipboard, regenerate secret button
- Reset to defaults action with disabled state when using defaults
- Add Auth tab to settings navigation with KeyRound icon
- Update SettingsTab type to include 'auth'
2025-12-25 14:37:03 -05:00
kaitranntt ffd499698e feat(api): add auth tokens REST endpoints
- GET /api/settings/auth/tokens - masked token status
- GET /api/settings/auth/tokens/raw - unmasked (Cache-Control: no-store)
- PUT /api/settings/auth/tokens - update API key or management secret
- POST /api/settings/auth/tokens/regenerate-secret - generate secure secret
- POST /api/settings/auth/tokens/reset - reset to defaults
2025-12-25 14:36:34 -05:00
kaitranntt 0c6491c9d2 feat(cli): add tokens command for auth token management
- Add ccs tokens command with subcommands:
  --show, --api-key, --secret, --regenerate-secret, --reset, --variant
- Integrate tokens command into main CLI (ccs.ts)
- Display masked tokens by default, --show for unmasked
- Auto-regenerate CLIProxy config on token changes
2025-12-25 14:36:11 -05:00
kaitranntt c4f09168ff feat(cliproxy): add customizable auth token manager
- Add CLIProxyAuthConfig type with api_key and management_secret fields
- Implement auth-token-manager.ts with inheritance chain:
  variant auth → global auth → default constants
- Add secure token generation using crypto.randomBytes (256-bit entropy)
- Export auth functions from cliproxy barrel (index.ts)
- Bump UNIFIED_CONFIG_VERSION to 6
2025-12-25 14:35:43 -05:00
kaitranntt 25f0ddb9dd fix(dashboard): support unified config in overview and file watcher
- overview-routes: Use ProfileRegistry for account count, merge both
  legacy and unified sources
- file-watcher: Add config.yaml to watch list for real-time updates
  in unified mode

Related to #203
2025-12-25 14:35:31 -05:00
kaitranntt 8d7845d67f fix(dashboard): read accounts from unified config
Dashboard accounts page was only reading from profiles.json, ignoring
accounts stored in config.yaml when in unified mode. This caused
accounts created via CLI to be invisible in the dashboard.

- Use ProfileRegistry instead of direct file access
- Merge legacy and unified accounts (unified takes precedence)
- Set default via unified config when in unified mode

Fixes #203
2025-12-25 14:25:40 -05:00
github-actions[bot] af071cd467 chore(release): 7.7.0-dev.2 [skip ci] 2025-12-25 10:20:06 +00:00