Commit Graph
762 Commits
Author SHA1 Message Date
kaitranntt a106aa2ee6 refactor(ui): organize health components into health/ directory
- move health-card, health-gauge, health-check-item

- move health-group-section, health-stats-bar

- add barrel export in health/index.ts
2025-12-19 19:42:24 -05:00
kaitranntt 81196b0ff1 refactor(ui): split quick-setup-wizard into setup/wizard/ directory
- extract 541-line component into step modules

- wrap accounts in useMemo for stable deps

- add barrel export in setup/index.ts
2025-12-19 19:41:51 -05:00
kaitranntt 6778c4d637 refactor(ui): split profile-editor into profiles/editor/ directory
- extract 531-line component into 10 focused modules

- move profile dialogs, card, deck, table to profiles/

- fix react-hook-form watch() using useWatch for compiler compat

- add barrel export in profiles/index.ts
2025-12-19 19:41:17 -05:00
kaitranntt 946030c836 refactor(ui): split error-logs-monitor into monitoring/error-logs/ directory
- extract 617-line component into 6 focused modules

- move auth-monitor, proxy-status-widget to monitoring/

- add barrel export in monitoring/index.ts
2025-12-19 19:40:43 -05:00
kaitranntt 1b1015cf50 refactor(ui): split copilot-config-form into copilot/config-form/ directory
- extract 846-line component into 13 focused modules

- add barrel export in copilot/index.ts
2025-12-19 19:40:06 -05:00
kaitranntt 4bea5a3346 refactor(ui): split provider-editor into cliproxy/provider-editor/ directory
- extract 921-line component into 13 focused modules

- move cliproxy-dialog, cliproxy-table, cliproxy-stats-overview

- add barrel export in cliproxy/index.ts
2025-12-19 19:39:32 -05:00
kaitranntt 8fd35c8dd6 refactor(ui): split account-flow-viz into account/flow-viz/ directory
- extract 1,144-line monster file into 12 focused modules

- add hooks.ts, types.ts, utils.ts for reusable logic

- create backward-compatible re-export shim

- add barrel export in account/index.ts
2025-12-19 19:38:58 -05:00
kaitranntt 4a5b832a6e refactor: remove unused deprecated code
- remove hasMcpWebSearch(), getMcpConfigPath() from websearch-manager

- delete deprecated web-server/routes.ts (no imports)
2025-12-19 16:02:39 -05:00
kaitranntt bae323c0d3 refactor(web-server): extract usage module to usage/ directory
- create web-server/usage/ with 7 focused modules

- extract: types, disk-cache, data-aggregator, aggregator, handlers, routes

- original files now re-export for backward compatibility

- slim routes.ts (49 lines) delegates to handlers.ts (489 lines)
2025-12-19 16:02:18 -05:00
kaitranntt c1e5ec70b5 refactor(utils): modularize ui.ts into ui/ directory
- split 647-line ui.ts into 10 focused modules (<115 lines each)

- extract: colors, indicators, boxes, tables, text, spinner, tasks

- add init.ts for shared state and types.ts for interfaces

- ui.ts now re-exports from ui/index.ts for backward compat
2025-12-19 16:01:50 -05:00
kaitranntt 6372b3d303 refactor: add barrel exports to api/, glmt/, management/
- src/api/index.ts: re-export services module

- src/glmt/index.ts: export all GLMT transformers and pipeline

- src/management/index.ts: export doctor, managers, diagnostics, checks, repair
2025-12-19 16:01:22 -05:00
kaitranntt 99afb3e011 refactor(utils): remove deprecated color and error functions from helpers.ts
- remove getColors(), colors, colored(), getTerminalInfo()

- keep error(), expandPath(), levenshteinDistance(), findSimilarStrings()

- reduce file from 155 to 92 lines (-63 lines)
2025-12-19 15:40:04 -05:00
kaitranntt e1f135a93a refactor(utils): extract formatRelativeTime to utils/time.ts
- create utils/time.ts for centralized time formatting

- remove duplicate from auth/commands/types.ts

- re-export for backward compatibility

- export from utils/index.ts
2025-12-19 15:39:40 -05:00
kaitranntt 18424cba89 refactor(utils): use canonical ValidationResult from types/utils
- import ValidationResult from types/utils

- create DelegationValidationResult extending base type

- standardize on 'valid' property naming
2025-12-19 15:39:19 -05:00
kaitranntt a8f7dad4e3 refactor(websearch): unify CLI status types with ComponentStatus
- replace GeminiCliStatus, GrokCliStatus, OpenCodeCliStatus with type aliases

- use ComponentStatus from types/utils as single source of truth

- fix null vs undefined for optional fields
2025-12-19 15:38:57 -05:00
kaitranntt 6c78b63908 refactor(types): add generic types and consolidate ExecutionResult
- add OperationResult<T> for success/failure patterns

- add ComponentStatus for CLI tool statuses

- add ValidationResult for validation patterns

- remove duplicate ExecutionResult, re-export from executor/types
2025-12-19 15:38:31 -05:00
kaitranntt 50c427d339 refactor: add barrel exports for commands and utils directories
- src/commands/index.ts exports all command handlers

- src/utils/index.ts exports common utilities
2025-12-19 12:36:43 -05:00
kaitranntt 0341f4f86f refactor(auth): modularize auth-commands into commands/ directory
- extract create, list, show, remove, default command handlers

- extract types.ts with CommandContext and parseArgs

- slim auth-commands.ts from 725 to 235 lines (68% reduction)

- add barrel exports at commands/index.ts and auth/index.ts
2025-12-19 12:36:24 -05:00
kaitranntt c3baaa8251 refactor(delegation): modularize headless-executor into executor/ directory
- extract types, stream-parser, result-aggregator

- consolidate ExecutionResult to executor/types.ts (DRY)

- slim headless-executor.ts from 729 to 391 lines (46% reduction)

- add barrel exports at executor/index.ts and delegation/index.ts
2025-12-19 12:35:59 -05:00
kaitranntt 5e4fa200df refactor(utils): modularize websearch-manager into websearch/ directory
- extract gemini-cli, grok-cli, opencode-cli providers

- extract hook-config, hook-env, hook-installer, status, types

- slim websearch-manager.ts from 867 to 103 lines (88% reduction)

- add barrel export at websearch/index.ts
2025-12-19 12:35:37 -05:00
kaitranntt c1f30ae800 refactor(web-server): modularize health-service into health/ directory
- extract system, environment, config, profile, symlink checks

- extract cliproxy, oauth, websearch checks and types

- slim health-service.ts from 901 to 146 lines (84% reduction)

- add barrel export at health/index.ts
2025-12-19 12:35:13 -05:00
kaitranntt d3c94fe6a2 refactor(cliproxy): modularize binary-manager into binary/ directory
- extract types, version-checker, lifecycle, updater, installer

- extract downloader (verifier), extractors (tar, zip), version-cache

- slim binary-manager.ts from 1080 to 137 lines (87% reduction)

- add barrel export at binary/index.ts
2025-12-19 12:34:48 -05:00
kaitranntt b49b7d17b2 refactor(cliproxy): extract service layer from cliproxy-command
- create cliproxy/services/ with 6 modules (1179 → 634 lines)

- variant-service, variant-settings, variant-config-adapter

- proxy-lifecycle-service, binary-service

- separate CLI parsing from business logic

Phase 5: Command Refactor (cliproxy-command.ts)
2025-12-19 11:48:45 -05:00
kaitranntt ecb6bb448a refactor(api): extract service layer from api-command
- create api/services/ with 5 modules (800 → 426 lines)

- validation-service, profile-types, profile-reader, profile-writer

- separate CLI parsing from business logic

Phase 5: Command Refactor (api-command.ts)
2025-12-19 11:48:33 -05:00
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 cd107e354c refactor(glmt): modularize transformer pipeline
- extract 7 pipeline modules (1122 → 206 lines)

- request-transformer, stream-parser, response-builder

- tool-call-handler, content-transformer

- shared types.ts for pipeline interfaces

Phase 3: Large Files Breakdown (glmt-transformer.ts)
2025-12-19 11:48:07 -05:00
kaitranntt 0eb2030dc2 refactor(management): modularize doctor health checks
- extract 9 check modules to checks/ directory (1260 → 186 lines)

- add repair/ directory with auto-repair extraction

- system, env, config, profile, cliproxy, oauth, symlink checks

- shared types.ts for check result interfaces

Phase 3: Large Files Breakdown (doctor.ts)
2025-12-19 11:47:55 -05:00
kaitranntt 22dbfd91c5 refactor(errors): centralize error handling infrastructure
- add errors/ directory with error types, handler, cleanup registry

- extract claude-spawner.ts from auth modules

- update imports across auth, ccs, web-server

Phase 2 & 4: Error handling consolidation
2025-12-19 11:47:43 -05:00
kaitranntt 9346ff2be9 refactor(web-server): extract usage aggregator service
- extract usage-aggregator.ts from usage-routes.ts (883 → 188 lines)

- add services/ directory with barrel export

- separate data aggregation logic from route handlers

Phase 2: Duplicate Extraction
2025-12-19 11:47:30 -05:00
kaitranntt a12c3d800a refactor(web-server): modularize routes into dedicated files
- extract 14 route modules from monolithic routes.ts (2198 → 49 lines)

- add route-helpers.ts for shared utilities

- add index.ts barrel export for clean imports

- health, profile, config, settings, provider, copilot routes

- variant, proxy, cliproxy-auth, cliproxy-stats, websearch, misc routes

Phase 1: Routes Modularization
2025-12-19 11:47:19 -05:00
semantic-release-bot ae07ea5d70 chore(release): 6.7.0 [skip ci]
## [6.7.0](https://github.com/kaitranntt/ccs/compare/v6.6.1...v6.7.0) (2025-12-19)

### Features

* **cliproxy:** auto-apply default preset when adding first account ([4036c42](https://github.com/kaitranntt/ccs/commit/4036c42687c0e5124825998350431f17ce617442))
* **env:** add debug logging for global env injection ([68eab56](https://github.com/kaitranntt/ccs/commit/68eab562ce404ac1933c76520e5597327348bff2))
* **recovery:** add lazy initialization for bun/pnpm users ([2d2cd3e](https://github.com/kaitranntt/ccs/commit/2d2cd3eca21a49af04ca0b1c1d549e62b6ff5cc9))

### Bug Fixes

* **ci:** use built-in GITHUB_TOKEN for release comments ([cff38ac](https://github.com/kaitranntt/ccs/commit/cff38ac53d392317325e2cbf5281956ff59174be))
* **cliproxy:** include BASE_URL and AUTH_TOKEN when applying presets ([598454c](https://github.com/kaitranntt/ccs/commit/598454c931267082ba80c4ef426d0ef2c0370f55))
* **cliproxy:** prevent port race condition with unified detection and startup lock ([96f17e3](https://github.com/kaitranntt/ccs/commit/96f17e3afba93288b041f6c2883753692b4e9ca1))
* **cliproxy:** prevent variant names matching reserved provider names ([7ea64bd](https://github.com/kaitranntt/ccs/commit/7ea64bdb4392d8cd41bc871892466d30c50b58fd))
* **remote-proxy:** fix TypeError and make port optional with protocol defaults ([03aea4e](https://github.com/kaitranntt/ccs/commit/03aea4eac233caf00736ceec80b4cc841bce948a)), closes [#142](https://github.com/kaitranntt/ccs/issues/142)
* **update-checker:** resolve dev channel update and duplicate comments ([b6b1817](https://github.com/kaitranntt/ccs/commit/b6b18173cc41788328ef1c8831de9527898f06a1))
* **web-server:** add comprehensive reserved name validation ([2373100](https://github.com/kaitranntt/ccs/commit/2373100c177654910922c6ef0e5ffc7cfe087b26))
2025-12-19 16:29:29 +00:00
Kai (Tam Nhu) TranandGitHub e46c1d0c1e Merge pull request #154 from kaitranntt/dev
feat: CCS v6.7.0 release
2025-12-19 11:28:30 -05:00
semantic-release-bot cc725975e9 chore(release): 6.7.0-dev.5 [skip ci]
## [6.7.0-dev.5](https://github.com/kaitranntt/ccs/compare/v6.7.0-dev.4...v6.7.0-dev.5) (2025-12-19)

### Features

* **cliproxy:** auto-apply default preset when adding first account ([4036c42](https://github.com/kaitranntt/ccs/commit/4036c42687c0e5124825998350431f17ce617442))
2025-12-19 16:27:37 +00:00
kaitranntt 4036c42687 feat(cliproxy): auto-apply default preset when adding first account
- Add presetMapping to Gemini, Antigravity, Codex models
- Auto-apply preset when adding first account (Add/QuickSetup)
- Extract applyDefaultPreset to preset-utils.ts (DRY)
- Add warning toast on preset failure
- Extract port 8317 to CLIPROXY_PORT constant
2025-12-19 11:26:17 -05:00
semantic-release-bot aacff0343d chore(release): 6.7.0-dev.4 [skip ci]
## [6.7.0-dev.4](https://github.com/kaitranntt/ccs/compare/v6.7.0-dev.3...v6.7.0-dev.4) (2025-12-19)

### Bug Fixes

* **cliproxy:** prevent port race condition with unified detection and startup lock ([96f17e3](https://github.com/kaitranntt/ccs/commit/96f17e3afba93288b041f6c2883753692b4e9ca1))
2025-12-19 15:55:15 +00:00
Kai (Tam Nhu) TranandGitHub af814aeee8 Merge pull request #153 from kaitranntt/kai/fix/cliproxy-port-race
fix(cliproxy): prevent port race condition with unified detection and startup lock
2025-12-19 10:54:11 -05:00
semantic-release-bot 96103f3d93 chore(release): 6.7.0-dev.3 [skip ci]
## [6.7.0-dev.3](https://github.com/kaitranntt/ccs/compare/v6.7.0-dev.2...v6.7.0-dev.3) (2025-12-19)

### Features

* **recovery:** add lazy initialization for bun/pnpm users ([2d2cd3e](https://github.com/kaitranntt/ccs/commit/2d2cd3eca21a49af04ca0b1c1d549e62b6ff5cc9))
2025-12-19 15:53:05 +00:00
kaitranntt 2d2cd3eca2 feat(recovery): add lazy initialization for bun/pnpm users
Bun and pnpm block postinstall scripts by default for security.
This causes ~/.ccs/ directory to not be created on fresh install.

Added lazy initialization in RecoveryManager that mirrors postinstall.js:
- ensureSharedDirectories() - creates ~/.ccs/shared/ subdirs
- ensureGlmSettings() - creates glm.settings.json with defaults
- ensureGlmtSettings() - creates glmt.settings.json with thinking mode
- ensureKimiSettings() - creates kimi.settings.json with k2-thinking-turbo
- ensureShellCompletions() - installs completion files
- Fixed config.json to include glmt profile, removed deprecated default

Now any ccs command will auto-create full ~/.ccs/ structure on first run.

Fixes: bun add -g @kaitranntt/ccs not creating ~/.ccs/
2025-12-19 10:50:52 -05:00
kaitranntt 96f17e3afb fix(cliproxy): prevent port race condition with unified detection and startup lock
Add proxy-detector.ts for unified detection with multiple fallbacks:
- HTTP health check (most reliable)
- Session lock file check
- Port process detection with HTTP retry (handles Windows PID-XXXXX)

Add startup-lock.ts for file-based mutex:
- 10s timeout with 20 retries at 250ms intervals
- Stale lock detection via PID check
- Cross-platform support

Update cliproxy-executor.ts and service-manager.ts to use new modules.

Fixes race conditions when running simultaneous ccs commands.
2025-12-19 10:50:25 -05:00
semantic-release-bot 282ed70dfc chore(release): 6.7.0-dev.2 [skip ci]
## [6.7.0-dev.2](https://github.com/kaitranntt/ccs/compare/v6.7.0-dev.1...v6.7.0-dev.2) (2025-12-19)

### Bug Fixes

* **cliproxy:** include BASE_URL and AUTH_TOKEN when applying presets ([598454c](https://github.com/kaitranntt/ccs/commit/598454c931267082ba80c4ef426d0ef2c0370f55))
* **cliproxy:** prevent variant names matching reserved provider names ([7ea64bd](https://github.com/kaitranntt/ccs/commit/7ea64bdb4392d8cd41bc871892466d30c50b58fd))
* **web-server:** add comprehensive reserved name validation ([2373100](https://github.com/kaitranntt/ccs/commit/2373100c177654910922c6ef0e5ffc7cfe087b26))
2025-12-19 14:59:38 +00:00
Kai (Tam Nhu) TranandGitHub c827a8d9ac Merge pull request #151 from kaitranntt/kai/fix/preset-missing-base-config
fix(cliproxy): include BASE_URL and AUTH_TOKEN when applying presets
2025-12-19 09:58:38 -05:00
kaitranntt 2373100c17 fix(web-server): add comprehensive reserved name validation
- Import isReservedName from centralized reserved-names module
- Add validation to POST /api/profiles endpoint
- Add validation to POST /api/cliproxy/openai-compat endpoint
- Refactor hardcoded arrays to use centralized isReservedName()
- Fixes DRY violation and ensures consistent validation across all endpoints
2025-12-19 09:55:27 -05:00
kaitranntt 7ea64bdb43 fix(cliproxy): prevent variant names matching reserved provider names
Added validation to reject variant names that match reserved CLIProxy
provider names (gemini, codex, agy, qwen, iflow). Also protected reserved
provider settings files from being deleted when deleting variants.

This prevents accidental deletion of default provider configurations when
users create variants with conflicting names.
2025-12-19 09:49:05 -05:00
kaitranntt 598454c931 fix(cliproxy): include BASE_URL and AUTH_TOKEN when applying presets
Presets now always include ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN
when applied to provider settings. This ensures CLIProxy routing works
correctly for Gemini, Codex, and Agy providers.

Also fixes settings save failing for new profiles by changing PUT
/api/settings/:profile to upsert behavior (create if not exists).
2025-12-19 09:44:14 -05:00
semantic-release-bot 4db2a4915e chore(release): 6.7.0-dev.1 [skip ci]
## [6.7.0-dev.1](https://github.com/kaitranntt/ccs/compare/v6.6.2-dev.3...v6.7.0-dev.1) (2025-12-19)

### Features

* **env:** add debug logging for global env injection ([68eab56](https://github.com/kaitranntt/ccs/commit/68eab562ce404ac1933c76520e5597327348bff2))
2025-12-19 14:42:37 +00:00
kaitranntt 68eab562ce feat(env): add debug logging for global env injection
- log injected global env var names in debug mode (CCS_DEBUG)

- log when telemetry/reporting env vars are applied in CLIProxy
2025-12-19 07:58:19 -05:00
semantic-release-bot c76a4dd825 chore(release): 6.6.2-dev.3 [skip ci]
## [6.6.2-dev.3](https://github.com/kaitranntt/ccs/compare/v6.6.2-dev.2...v6.6.2-dev.3) (2025-12-19)

### Bug Fixes

* **update-checker:** resolve dev channel update and duplicate comments ([b6b1817](https://github.com/kaitranntt/ccs/commit/b6b18173cc41788328ef1c8831de9527898f06a1))
2025-12-19 09:51:15 +00:00
kaitranntt b6b18173cc fix(update-checker): resolve dev channel update and duplicate comments
Fixes tag-agnostic cache issue causing 'ccs update --dev' to require
force. Implements tag-specific caching (dev_version vs latest_version)
to correctly detect updates across channels. Disables duplicate bot
comments on dev releases in .releaserc.cjs.
2025-12-19 04:50:09 -05:00
semantic-release-bot 7786b39aa5 chore(release): 6.6.2-dev.2 [skip ci]
## [6.6.2-dev.2](https://github.com/kaitranntt/ccs/compare/v6.6.2-dev.1...v6.6.2-dev.2) (2025-12-19)

### Bug Fixes

* **remote-proxy:** fix TypeError and make port optional with protocol defaults ([03aea4e](https://github.com/kaitranntt/ccs/commit/03aea4eac233caf00736ceec80b4cc841bce948a)), closes [#142](https://github.com/kaitranntt/ccs/issues/142)
2025-12-19 09:28:15 +00:00
Kai (Tam Nhu) TranandGitHub e7847384a2 Merge pull request #150 from kaitranntt/kai/feat/remote-proxy-config
fix(remote-proxy): fix TypeError and make port optional with protocol defaults
2025-12-19 04:27:16 -05:00