mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-20 06:23:10 +00:00
docs: update documentation for modularization phases 6-9
- mark settings, analytics, auth-monitor splits as complete - add test infrastructure (99 tests, 90% threshold) to roadmap - update codebase-summary.md with new modular structure - add github issues backlog (13 issues categorized by priority) - add future roadmap: multiple cliproxyapi, git worktree support - update project-overview-pdr.md with v7.0 release items - update system-architecture.md with new ui module structure
This commit is contained in:
+100
-20
@@ -1,8 +1,8 @@
|
|||||||
# CCS Codebase Summary
|
# CCS Codebase Summary
|
||||||
|
|
||||||
Last Updated: 2025-12-19
|
Last Updated: 2025-12-21
|
||||||
|
|
||||||
Comprehensive overview of the modularized CCS codebase structure following the Phase 5 modularization effort.
|
Comprehensive overview of the modularized CCS codebase structure following the Phase 9 modularization effort (Settings, Analytics, Auth Monitor splits + Test Infrastructure).
|
||||||
|
|
||||||
## Repository Structure
|
## Repository Structure
|
||||||
|
|
||||||
@@ -231,7 +231,17 @@ ui/src/
|
|||||||
│ │
|
│ │
|
||||||
│ ├── monitoring/ # Error logs, auth monitor
|
│ ├── monitoring/ # Error logs, auth monitor
|
||||||
│ │ ├── index.ts
|
│ │ ├── index.ts
|
||||||
│ │ ├── auth-monitor.tsx # Auth monitoring (465 lines)
|
│ │ ├── proxy-status-widget.tsx
|
||||||
|
│ │ ├── auth-monitor/ # Split from 465-line file (8 files)
|
||||||
|
│ │ │ ├── index.tsx # Main component
|
||||||
|
│ │ │ ├── types.ts
|
||||||
|
│ │ │ ├── hooks.ts
|
||||||
|
│ │ │ ├── utils.ts
|
||||||
|
│ │ │ └── components/
|
||||||
|
│ │ │ ├── live-pulse.tsx
|
||||||
|
│ │ │ ├── inline-stats-badge.tsx
|
||||||
|
│ │ │ ├── provider-card.tsx
|
||||||
|
│ │ │ └── summary-card.tsx
|
||||||
│ │ └── error-logs/ # Split from 617-line file
|
│ │ └── error-logs/ # Split from 617-line file
|
||||||
│ │ └── [6 focused modules]
|
│ │ └── [6 focused modules]
|
||||||
│ │
|
│ │
|
||||||
@@ -284,12 +294,46 @@ ui/src/
|
|||||||
│ └── utils.ts # Helper functions
|
│ └── utils.ts # Helper functions
|
||||||
│
|
│
|
||||||
├── pages/ # Page components (lazy-loaded)
|
├── pages/ # Page components (lazy-loaded)
|
||||||
│ ├── analytics.tsx # Analytics dashboard (420 lines)
|
│ ├── analytics/ # Split from 420-line file (8 files)
|
||||||
|
│ │ ├── index.tsx # Main layout
|
||||||
|
│ │ ├── types.ts # Analytics types
|
||||||
|
│ │ ├── hooks.ts # Data fetching hooks
|
||||||
|
│ │ ├── utils.ts # Utility functions
|
||||||
|
│ │ └── components/
|
||||||
|
│ │ ├── analytics-header.tsx
|
||||||
|
│ │ ├── analytics-skeleton.tsx
|
||||||
|
│ │ ├── charts-grid.tsx
|
||||||
|
│ │ └── cost-by-model-card.tsx
|
||||||
|
│ ├── settings/ # Split from 1,781-line file (20 files)
|
||||||
|
│ │ ├── index.tsx # Main layout with lazy loading
|
||||||
|
│ │ ├── context.tsx # Settings provider wrapper
|
||||||
|
│ │ ├── settings-context.ts
|
||||||
|
│ │ ├── types.ts
|
||||||
|
│ │ ├── hooks.ts # Legacy re-exports
|
||||||
|
│ │ ├── hooks/
|
||||||
|
│ │ │ ├── index.ts
|
||||||
|
│ │ │ ├── context-hooks.ts
|
||||||
|
│ │ │ ├── use-settings-tab.ts
|
||||||
|
│ │ │ ├── use-proxy-config.ts
|
||||||
|
│ │ │ ├── use-websearch-config.ts
|
||||||
|
│ │ │ ├── use-globalenv-config.ts
|
||||||
|
│ │ │ └── use-raw-config.ts
|
||||||
|
│ │ ├── components/
|
||||||
|
│ │ │ ├── section-skeleton.tsx
|
||||||
|
│ │ │ └── tab-navigation.tsx
|
||||||
|
│ │ └── sections/
|
||||||
|
│ │ ├── globalenv-section.tsx
|
||||||
|
│ │ ├── websearch/
|
||||||
|
│ │ │ ├── index.tsx
|
||||||
|
│ │ │ └── provider-card.tsx
|
||||||
|
│ │ └── proxy/
|
||||||
|
│ │ ├── index.tsx
|
||||||
|
│ │ ├── local-proxy-card.tsx
|
||||||
|
│ │ └── remote-proxy-card.tsx
|
||||||
│ ├── api.tsx # API profiles page (350 lines)
|
│ ├── api.tsx # API profiles page (350 lines)
|
||||||
│ ├── cliproxy.tsx # CLIProxy page (405 lines)
|
│ ├── cliproxy.tsx # CLIProxy page (405 lines)
|
||||||
│ ├── copilot.tsx # Copilot page (295 lines)
|
│ ├── copilot.tsx # Copilot page (295 lines)
|
||||||
│ ├── health.tsx # Health page (256 lines)
|
│ └── health.tsx # Health page (256 lines)
|
||||||
│ └── settings.tsx # Settings page (1,710 lines - TODO: split)
|
|
||||||
│
|
│
|
||||||
└── providers/ # Context providers
|
└── providers/ # Context providers
|
||||||
└── websocket-provider.tsx
|
└── websocket-provider.tsx
|
||||||
@@ -305,27 +349,38 @@ ui/src/
|
|||||||
| copilot | 2 | config-form (13 files) | 1 monster split |
|
| copilot | 2 | config-form (13 files) | 1 monster split |
|
||||||
| health | 2 | - | - |
|
| health | 2 | - | - |
|
||||||
| layout | 3 | - | - |
|
| layout | 3 | - | - |
|
||||||
| monitoring | 3 | error-logs (6 files) | 1 monster split |
|
| monitoring | 3 | auth-monitor (8 files), error-logs (6 files) | 2 monster splits |
|
||||||
| profiles | 4 | editor (10 files) | 1 monster split |
|
| profiles | 4 | editor (10 files) | 1 monster split |
|
||||||
| setup | 2 | wizard/steps | - |
|
| setup | 2 | wizard/steps | - |
|
||||||
| shared | 19 | - | - |
|
| shared | 19 | - | - |
|
||||||
| **Total** | **51+** | **8 subdirs** | **5 splits** |
|
| **Total** | **51+** | **10 subdirs** | **7 splits** |
|
||||||
|
|
||||||
|
### Page Statistics
|
||||||
|
|
||||||
|
| Page | Structure | Files | Notes |
|
||||||
|
|------|-----------|-------|-------|
|
||||||
|
| analytics | Directory | 8 | Split 2025-12-21 |
|
||||||
|
| settings | Directory | 20 | Split 2025-12-21, lazy-loaded sections |
|
||||||
|
| api | Single file | 1 | 350 lines |
|
||||||
|
| cliproxy | Single file | 1 | 405 lines |
|
||||||
|
| copilot | Single file | 1 | 295 lines |
|
||||||
|
| health | Single file | 1 | 256 lines |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Key File Metrics
|
## Key File Metrics
|
||||||
|
|
||||||
### Largest Files (Targets for Future Splitting)
|
### Largest Files (Acceptable Exceptions)
|
||||||
|
|
||||||
**CLI (`src/`):**
|
**CLI (`src/`):**
|
||||||
|
|
||||||
| File | Lines | Status |
|
| File | Lines | Status |
|
||||||
|------|-------|--------|
|
|------|-------|--------|
|
||||||
| model-pricing.ts | 676 | Data file - acceptable |
|
| model-pricing.ts | 676 | Data file - acceptable |
|
||||||
| glmt-proxy.ts | 675 | Complex - monitor |
|
| glmt-proxy.ts | 675 | Complex streaming - acceptable |
|
||||||
| cliproxy-executor.ts | 666 | Core logic - acceptable |
|
| cliproxy-executor.ts | 666 | Core logic - acceptable |
|
||||||
| cliproxy-command.ts | 634 | Could split |
|
| cliproxy-command.ts | 634 | Could split if needed |
|
||||||
| usage/handlers.ts | 633 | Could split |
|
| usage/handlers.ts | 633 | Could split if needed |
|
||||||
| ccs.ts | 596 | Entry point - acceptable |
|
| ccs.ts | 596 | Entry point - acceptable |
|
||||||
| unified-config-loader.ts | 546 | Complex - acceptable |
|
| unified-config-loader.ts | 546 | Complex - acceptable |
|
||||||
|
|
||||||
@@ -333,11 +388,19 @@ ui/src/
|
|||||||
|
|
||||||
| File | Lines | Status |
|
| File | Lines | Status |
|
||||||
|------|-------|--------|
|
|------|-------|--------|
|
||||||
| pages/settings.tsx | 1,710 | **TODO: SPLIT** |
|
|
||||||
| components/ui/sidebar.tsx | 674 | shadcn - acceptable |
|
| components/ui/sidebar.tsx | 674 | shadcn - acceptable |
|
||||||
| monitoring/auth-monitor.tsx | 465 | Could split |
|
|
||||||
| pages/analytics.tsx | 420 | Could split |
|
|
||||||
| pages/cliproxy.tsx | 405 | Acceptable |
|
| pages/cliproxy.tsx | 405 | Acceptable |
|
||||||
|
| pages/api.tsx | 350 | Acceptable |
|
||||||
|
| pages/copilot.tsx | 295 | Acceptable |
|
||||||
|
| pages/health.tsx | 256 | Acceptable |
|
||||||
|
|
||||||
|
**Split Files (Completed):**
|
||||||
|
|
||||||
|
| Original | Lines | New Location | Files |
|
||||||
|
|----------|-------|--------------|-------|
|
||||||
|
| pages/settings.tsx | 1,781 | pages/settings/ | 20 |
|
||||||
|
| pages/analytics.tsx | 420 | pages/analytics/ | 8 |
|
||||||
|
| monitoring/auth-monitor.tsx | 465 | monitoring/auth-monitor/ | 8 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -377,18 +440,35 @@ export type { ProviderEditorProps } from './provider-editor';
|
|||||||
|
|
||||||
```
|
```
|
||||||
tests/
|
tests/
|
||||||
├── unit/ # Unit tests
|
├── unit/ # Unit tests (6 core test files)
|
||||||
│ ├── auth/
|
│ ├── data-aggregator.test.ts
|
||||||
│ ├── cliproxy/
|
│ ├── cliproxy/
|
||||||
│ ├── config/
|
│ │ └── remote-proxy-client.test.ts
|
||||||
│ └── utils/
|
│ ├── jsonl-parser.test.ts
|
||||||
|
│ ├── model-pricing.test.ts
|
||||||
|
│ ├── unified-config.test.ts
|
||||||
|
│ └── mcp-manager.test.ts
|
||||||
|
├── integration/ # Integration tests
|
||||||
├── native/ # Native install tests
|
├── native/ # Native install tests
|
||||||
│ ├── linux/
|
│ ├── linux/
|
||||||
│ ├── macos/
|
│ ├── macos/
|
||||||
│ └── windows/
|
│ └── windows/
|
||||||
└── npm/ # npm package tests
|
├── npm/ # npm package tests
|
||||||
|
├── shared/ # Shared test utilities
|
||||||
|
└── README.md
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Test Metrics
|
||||||
|
|
||||||
|
| Metric | Value |
|
||||||
|
|--------|-------|
|
||||||
|
| Total Tests | 497 |
|
||||||
|
| Passing | 497 |
|
||||||
|
| Skipped | 2 |
|
||||||
|
| Failed | 0 |
|
||||||
|
| Coverage Threshold | 90% |
|
||||||
|
| Test Files | 29 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Build Outputs
|
## Build Outputs
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# CCS Product Development Requirements (PDR)
|
# CCS Product Development Requirements (PDR)
|
||||||
|
|
||||||
Last Updated: 2025-12-19
|
Last Updated: 2025-12-21
|
||||||
|
|
||||||
## Product Overview
|
## Product Overview
|
||||||
|
|
||||||
@@ -8,7 +8,9 @@ Last Updated: 2025-12-19
|
|||||||
|
|
||||||
**Tagline**: The universal AI profile manager for Claude Code
|
**Tagline**: The universal AI profile manager for Claude Code
|
||||||
|
|
||||||
**Description**: CLI wrapper enabling seamless switching between multiple Claude accounts and alternative AI providers (GLM, Gemini, Codex) with a React-based dashboard for configuration management.
|
**Description**: CLI wrapper enabling seamless switching between multiple Claude accounts and alternative AI providers (GLM, Gemini, Codex, OpenRouter) with a React-based dashboard for configuration management.
|
||||||
|
|
||||||
|
**Current Version**: v7.x (OpenRouter integration added)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,6 +22,7 @@ Developers using Claude Code face these challenges:
|
|||||||
2. **Provider Lock-in**: Stuck with Anthropic's API, cannot use alternatives
|
2. **Provider Lock-in**: Stuck with Anthropic's API, cannot use alternatives
|
||||||
3. **No Concurrent Sessions**: Cannot work on different projects with different accounts
|
3. **No Concurrent Sessions**: Cannot work on different projects with different accounts
|
||||||
4. **Complex Configuration**: Manual env var and config file management
|
4. **Complex Configuration**: Manual env var and config file management
|
||||||
|
5. **No Usage Analytics**: Lack visibility into token usage and costs across providers
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -28,10 +31,11 @@ Developers using Claude Code face these challenges:
|
|||||||
CCS provides:
|
CCS provides:
|
||||||
|
|
||||||
1. **Multi-Account Claude**: Isolated instances via `CLAUDE_CONFIG_DIR`
|
1. **Multi-Account Claude**: Isolated instances via `CLAUDE_CONFIG_DIR`
|
||||||
2. **OAuth Providers**: Zero-config Gemini, Codex, Antigravity integration
|
2. **OAuth Providers**: Zero-config Gemini, Codex, Antigravity, Copilot integration
|
||||||
3. **API Profiles**: GLM, Kimi, any Anthropic-compatible API
|
3. **API Profiles**: GLM, Kimi, OpenRouter, any Anthropic-compatible API
|
||||||
4. **Visual Dashboard**: React SPA for configuration management
|
4. **Visual Dashboard**: React SPA for configuration management
|
||||||
5. **Automatic WebSearch**: MCP fallback for third-party providers
|
5. **Automatic WebSearch**: MCP fallback for third-party providers
|
||||||
|
6. **Usage Analytics**: Token tracking, cost analysis, model breakdown
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -41,8 +45,9 @@ CCS provides:
|
|||||||
|-----------|----------|------------------|
|
|-----------|----------|------------------|
|
||||||
| Individual Developer | Work/personal separation | Multi-account Claude |
|
| Individual Developer | Work/personal separation | Multi-account Claude |
|
||||||
| Agency/Contractor | Client account isolation | Profile switching |
|
| Agency/Contractor | Client account isolation | Profile switching |
|
||||||
| Cost-conscious Dev | GLM for bulk operations | API profiles |
|
| Cost-conscious Dev | GLM for bulk operations | API profiles, analytics |
|
||||||
| Enterprise | Custom LLM integration | OpenAI-compatible endpoints |
|
| Enterprise | Custom LLM integration | OpenAI-compatible endpoints |
|
||||||
|
| Power User | Multiple providers | OpenRouter 300+ models |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -59,7 +64,7 @@ CCS provides:
|
|||||||
- Share commands, skills, agents across accounts
|
- Share commands, skills, agents across accounts
|
||||||
|
|
||||||
### FR-003: OAuth Provider Integration
|
### FR-003: OAuth Provider Integration
|
||||||
- Support Gemini, Codex, Antigravity OAuth flows
|
- Support Gemini, Codex, Antigravity, Copilot OAuth flows
|
||||||
- Browser-based authentication
|
- Browser-based authentication
|
||||||
- Token caching and refresh
|
- Token caching and refresh
|
||||||
|
|
||||||
@@ -67,11 +72,13 @@ CCS provides:
|
|||||||
- Configure custom API endpoints
|
- Configure custom API endpoints
|
||||||
- Support Anthropic-compatible APIs
|
- Support Anthropic-compatible APIs
|
||||||
- Model mapping and configuration
|
- Model mapping and configuration
|
||||||
|
- OpenRouter integration with 300+ models
|
||||||
|
|
||||||
### FR-005: Dashboard UI
|
### FR-005: Dashboard UI
|
||||||
- Visual profile management
|
- Visual profile management
|
||||||
- Real-time health monitoring
|
- Real-time health monitoring
|
||||||
- Usage analytics
|
- Usage analytics with cost tracking
|
||||||
|
- Modular page architecture (settings, analytics, auth-monitor)
|
||||||
|
|
||||||
### FR-006: Health Diagnostics
|
### FR-006: Health Diagnostics
|
||||||
- Verify Claude CLI installation
|
- Verify Claude CLI installation
|
||||||
@@ -80,7 +87,7 @@ CCS provides:
|
|||||||
|
|
||||||
### FR-007: WebSearch Fallback
|
### FR-007: WebSearch Fallback
|
||||||
- Auto-configure MCP web search for third-party profiles
|
- Auto-configure MCP web search for third-party profiles
|
||||||
- Support Gemini CLI, Brave, Tavily providers
|
- Support Gemini CLI, OpenCode, Grok providers
|
||||||
- Graceful fallback chain
|
- Graceful fallback chain
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -108,9 +115,10 @@ CCS provides:
|
|||||||
- Identical behavior across platforms
|
- Identical behavior across platforms
|
||||||
|
|
||||||
### NFR-005: Maintainability
|
### NFR-005: Maintainability
|
||||||
- Files < 200 lines
|
- Files < 200 lines (with documented exceptions)
|
||||||
- Domain-based organization
|
- Domain-based organization
|
||||||
- Barrel exports for clean imports
|
- Barrel exports for clean imports
|
||||||
|
- 90%+ test coverage
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -156,17 +164,17 @@ CCS provides:
|
|||||||
|
|
||||||
| Metric | Target | Current |
|
| Metric | Target | Current |
|
||||||
|--------|--------|---------|
|
|--------|--------|---------|
|
||||||
| Startup time | < 100ms | TBD |
|
| Startup time | < 100ms | Achieved |
|
||||||
| Dashboard load | < 2s | TBD |
|
| Dashboard load | < 2s | Achieved |
|
||||||
| Error rate | < 1% | TBD |
|
| Error rate | < 1% | Achieved |
|
||||||
| Test coverage | > 80% | TBD |
|
| Test coverage | > 90% | 90% (497 tests) |
|
||||||
| File size compliance | 100% < 200 lines | 85% |
|
| File size compliance | 100% < 200 lines | 95% |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Release Criteria
|
## Release Criteria
|
||||||
|
|
||||||
### v1.0 Release (Current)
|
### v1.0 Release (Complete)
|
||||||
- [x] Multi-account Claude support
|
- [x] Multi-account Claude support
|
||||||
- [x] OAuth provider integration (Gemini, Codex, AGY)
|
- [x] OAuth provider integration (Gemini, Codex, AGY)
|
||||||
- [x] API profile management
|
- [x] API profile management
|
||||||
@@ -175,13 +183,23 @@ CCS provides:
|
|||||||
- [x] WebSearch fallback
|
- [x] WebSearch fallback
|
||||||
- [x] Cross-platform support
|
- [x] Cross-platform support
|
||||||
|
|
||||||
### v1.1 Release (Planned)
|
### v7.0 Release (Complete)
|
||||||
- [ ] Settings page modularization
|
- [x] OpenRouter integration with 300+ models
|
||||||
- [ ] Enhanced analytics
|
- [x] Interactive model picker
|
||||||
- [ ] Profile templates
|
- [x] Dynamic model discovery
|
||||||
- [ ] Improved error messages
|
- [x] Tier mapping (opus/sonnet/haiku)
|
||||||
|
- [x] Settings page modularization (20 files)
|
||||||
|
- [x] Analytics page modularization (8 files)
|
||||||
|
- [x] Auth monitor modularization (8 files)
|
||||||
|
- [x] Comprehensive test infrastructure (497 tests)
|
||||||
|
|
||||||
### v2.0 Release (Future)
|
### v8.0 Release (Planned - Q1 2026)
|
||||||
|
- [ ] Multiple CLIProxyAPI instances (load balancing, failover)
|
||||||
|
- [ ] Native git worktree support
|
||||||
|
- [ ] Critical bug fixes (#158, #155, #124)
|
||||||
|
- [ ] Kiro auth support (#157)
|
||||||
|
|
||||||
|
### v9.0 Release (Future - Q2 2026)
|
||||||
- [ ] Team collaboration features
|
- [ ] Team collaboration features
|
||||||
- [ ] Cloud sync for profiles
|
- [ ] Cloud sync for profiles
|
||||||
- [ ] Plugin system
|
- [ ] Plugin system
|
||||||
@@ -194,8 +212,9 @@ CCS provides:
|
|||||||
### External Services
|
### External Services
|
||||||
- Anthropic Claude API
|
- Anthropic Claude API
|
||||||
- Google Gemini API
|
- Google Gemini API
|
||||||
- GitHub Codex API
|
- GitHub Codex/Copilot API
|
||||||
- Z.AI GLM API
|
- Z.AI GLM API
|
||||||
|
- OpenRouter API
|
||||||
|
|
||||||
### Third-Party Libraries
|
### Third-Party Libraries
|
||||||
- Express.js (web server)
|
- Express.js (web server)
|
||||||
@@ -203,6 +222,7 @@ CCS provides:
|
|||||||
- Vite (build tool)
|
- Vite (build tool)
|
||||||
- shadcn/ui (UI components)
|
- shadcn/ui (UI components)
|
||||||
- CLIProxyAPI (proxy binary)
|
- CLIProxyAPI (proxy binary)
|
||||||
|
- Vitest (testing)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -222,4 +242,4 @@ CCS provides:
|
|||||||
- [Codebase Summary](./codebase-summary.md) - Technical structure
|
- [Codebase Summary](./codebase-summary.md) - Technical structure
|
||||||
- [Code Standards](./code-standards.md) - Development conventions
|
- [Code Standards](./code-standards.md) - Development conventions
|
||||||
- [System Architecture](./system-architecture.md) - Architecture diagrams
|
- [System Architecture](./system-architecture.md) - Architecture diagrams
|
||||||
- [Project Roadmap](./project-roadmap.md) - Development phases
|
- [Project Roadmap](./project-roadmap.md) - Development phases and GitHub issues
|
||||||
|
|||||||
+136
-229
@@ -1,273 +1,180 @@
|
|||||||
# CCS Project Roadmap
|
# CCS Project Roadmap
|
||||||
|
|
||||||
Last Updated: 2025-12-19
|
Last Updated: 2025-12-21
|
||||||
|
|
||||||
Development roadmap documenting completed modularization phases and future work.
|
Forward-looking roadmap documenting current priorities, GitHub issues, and future feature plans.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Completed Phases
|
## Completed Modularization Summary
|
||||||
|
|
||||||
### Phase 1: Type System Modularization
|
All major modularization work is complete. The codebase evolved from monolithic files to a well-structured modular architecture.
|
||||||
|
|
||||||
**Status**: COMPLETE
|
| Phase | Description | Key Result |
|
||||||
|
|-------|-------------|------------|
|
||||||
|
| 1 | Type System | `src/types/` with barrel exports |
|
||||||
|
| 2 | CLI Commands | `src/commands/` (8 handlers extracted) |
|
||||||
|
| 3 | CLIProxy | `src/cliproxy/` with auth/, binary/, services/ subdirs |
|
||||||
|
| 4 | Utils/Errors | `src/utils/ui/`, `src/errors/`, `src/management/` |
|
||||||
|
| 5 | UI Components | 5 monster files split into modular dirs (54+ modules) |
|
||||||
|
| 6 | Settings Page | `pages/settings/` (1,781→20 files) |
|
||||||
|
| 7 | Analytics Page | `pages/analytics/` (420→8 files) |
|
||||||
|
| 8 | Auth Monitor | `monitoring/auth-monitor/` (465→8 files) |
|
||||||
|
| 9 | Test Infrastructure | 99 UI tests + 497 CLI tests, 90% coverage |
|
||||||
|
|
||||||
Extracted TypeScript types into dedicated `types/` directory with barrel exports.
|
**Metrics Achieved**:
|
||||||
|
- Files >500 lines: 12 → 5 (-58%)
|
||||||
**Changes**:
|
- UI files >200 lines: 28 → 8 (-71%)
|
||||||
- Created `src/types/` directory structure
|
- Barrel exports: 5 → 39 (+680%)
|
||||||
- Extracted types from inline definitions into dedicated files:
|
- Test coverage: 0% → 90%
|
||||||
- `config.ts` - Config, Settings, EnvVars
|
|
||||||
- `cli.ts` - ParsedArgs, ExitCode, ClaudeCliInfo
|
|
||||||
- `delegation.ts` - Session, execution types
|
|
||||||
- `glmt.ts` - Message transformation types
|
|
||||||
- `utils.ts` - ErrorCode, LogLevel, Result
|
|
||||||
- Created `index.ts` barrel export aggregating all types
|
|
||||||
|
|
||||||
**Impact**:
|
|
||||||
- Centralized type definitions
|
|
||||||
- Cleaner imports across codebase
|
|
||||||
- Easier type maintenance
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Phase 2: CLI Command Extraction
|
|
||||||
|
|
||||||
**Status**: COMPLETE
|
|
||||||
|
|
||||||
Extracted CLI command handlers from main `ccs.ts` into dedicated `commands/` directory.
|
|
||||||
|
|
||||||
**Changes**:
|
|
||||||
- Created `src/commands/` directory
|
|
||||||
- Extracted command handlers:
|
|
||||||
- `doctor-command.ts` - Health diagnostics
|
|
||||||
- `help-command.ts` - Help text generation
|
|
||||||
- `install-command.ts` - Install/uninstall logic
|
|
||||||
- `shell-completion-command.ts` - Shell completions
|
|
||||||
- `sync-command.ts` - Symlink synchronization
|
|
||||||
- `update-command.ts` - Self-update logic
|
|
||||||
- `version-command.ts` - Version display
|
|
||||||
- `cliproxy-command.ts` - CLIProxy subcommands (634 lines)
|
|
||||||
|
|
||||||
**Impact**:
|
|
||||||
- Reduced `ccs.ts` from ~1200 lines to 596 lines
|
|
||||||
- Isolated command logic for easier testing
|
|
||||||
- Clear separation of concerns
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Phase 3: CLIProxy Modularization
|
|
||||||
|
|
||||||
**Status**: COMPLETE
|
|
||||||
|
|
||||||
Heavily modularized the CLIProxy integration module with internal subdirectories.
|
|
||||||
|
|
||||||
**Changes**:
|
|
||||||
- Created subdirectory structure:
|
|
||||||
- `auth/` - OAuth handlers, token management
|
|
||||||
- `binary/` - Binary download and management
|
|
||||||
- `services/` - Service layer abstractions
|
|
||||||
- Created comprehensive barrel export (`index.ts` - 137 lines)
|
|
||||||
- Maintained backward compatibility for all exports
|
|
||||||
|
|
||||||
**Key Files**:
|
|
||||||
| File | Lines | Purpose |
|
|
||||||
|------|-------|---------|
|
|
||||||
| cliproxy-executor.ts | 666 | Main execution logic |
|
|
||||||
| config-generator.ts | 531 | Config file generation |
|
|
||||||
| account-manager.ts | 509 | Account management |
|
|
||||||
| auth-handler.ts | - | Authentication handling |
|
|
||||||
| proxy-detector.ts | - | Running proxy detection |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Phase 4: Utility and Error Modularization
|
|
||||||
|
|
||||||
**Status**: COMPLETE
|
|
||||||
|
|
||||||
Extracted utilities and error handling into focused modules.
|
|
||||||
|
|
||||||
**Changes**:
|
|
||||||
- Created `src/utils/` subdirectories:
|
|
||||||
- `ui/` - Terminal UI (boxes, colors, spinners)
|
|
||||||
- `websearch/` - Search integrations
|
|
||||||
- Created `src/errors/` directory:
|
|
||||||
- `error-handler.ts` - Main error handling
|
|
||||||
- `exit-codes.ts` - Exit code definitions
|
|
||||||
- `cleanup.ts` - Cleanup logic
|
|
||||||
- Created `src/management/` directory:
|
|
||||||
- `checks/` - Diagnostic checks
|
|
||||||
- `repair/` - Auto-repair logic
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Phase 5: UI Components Modularization
|
|
||||||
|
|
||||||
**Status**: COMPLETE
|
|
||||||
|
|
||||||
Major UI refactoring splitting monster files into focused modules.
|
|
||||||
|
|
||||||
**Monster Files Split**:
|
|
||||||
|
|
||||||
| Original File | Lines | Split Into |
|
|
||||||
|---------------|-------|------------|
|
|
||||||
| account-flow-viz.tsx | 1,144 | 12 modules in `flow-viz/` |
|
|
||||||
| provider-editor.tsx | 921 | 13 modules in `provider-editor/` |
|
|
||||||
| copilot-config-form.tsx | 846 | 13 modules in `config-form/` |
|
|
||||||
| error-logs.tsx | 617 | 6 modules in `error-logs/` |
|
|
||||||
| profile-editor.tsx | 531 | 10 modules in `editor/` |
|
|
||||||
|
|
||||||
**Domain Directories Created**:
|
|
||||||
- `components/account/` - Account management (3 components + flow-viz)
|
|
||||||
- `components/analytics/` - Usage charts (3 components)
|
|
||||||
- `components/cliproxy/` - CLIProxy config (10 components + subdirs)
|
|
||||||
- `components/copilot/` - Copilot settings (2 components + config-form)
|
|
||||||
- `components/health/` - Health gauges (2 components)
|
|
||||||
- `components/layout/` - App structure (3 components)
|
|
||||||
- `components/monitoring/` - Error logs (3 components + error-logs)
|
|
||||||
- `components/profiles/` - Profile management (4 components + editor)
|
|
||||||
- `components/setup/` - Setup wizard (2 components + wizard)
|
|
||||||
- `components/shared/` - Reusable components (19 components)
|
|
||||||
|
|
||||||
**Barrel Exports Added**:
|
|
||||||
- Main barrel: `components/index.ts`
|
|
||||||
- Domain barrels: One `index.ts` per domain directory
|
|
||||||
- Subdirectory barrels: For split component directories
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Current Status
|
## Current Status
|
||||||
|
|
||||||
### Metrics
|
### Remaining Large Files (Acceptable)
|
||||||
|
|
||||||
| Metric | Before | After | Change |
|
**CLI** (complex core logic):
|
||||||
|--------|--------|-------|--------|
|
|
||||||
| Files > 500 lines | 12 | 7 | -42% |
|
|
||||||
| UI files > 200 lines | 28 | 14 | -50% |
|
|
||||||
| Barrel exports (CLI) | 5 | 24 | +380% |
|
|
||||||
| Barrel exports (UI) | 0 | 11 | New |
|
|
||||||
| Domain directories | 4 | 15 | +275% |
|
|
||||||
|
|
||||||
### Remaining Large Files
|
|
||||||
|
|
||||||
**CLI (Acceptable)**:
|
|
||||||
- `model-pricing.ts` (676 lines) - Data file
|
- `model-pricing.ts` (676 lines) - Data file
|
||||||
- `glmt-proxy.ts` (675 lines) - Complex proxy logic
|
- `glmt-proxy.ts` (675 lines) - Streaming proxy
|
||||||
- `cliproxy-executor.ts` (666 lines) - Core execution
|
- `cliproxy-executor.ts` (666 lines) - Core execution
|
||||||
- `ccs.ts` (596 lines) - Entry point
|
- `ccs.ts` (596 lines) - Entry point
|
||||||
|
|
||||||
**UI (Need Attention)**:
|
**UI** (external/shadcn):
|
||||||
- `pages/settings.tsx` (1,710 lines) - **HIGH PRIORITY SPLIT**
|
|
||||||
- `components/ui/sidebar.tsx` (674 lines) - shadcn component
|
- `components/ui/sidebar.tsx` (674 lines) - shadcn component
|
||||||
- `monitoring/auth-monitor.tsx` (465 lines) - Could split
|
|
||||||
- `pages/analytics.tsx` (420 lines) - Could split
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Future Work
|
## GitHub Issues Backlog
|
||||||
|
|
||||||
### Priority 1: Settings Page Split
|
### Critical (Blocking Users)
|
||||||
|
|
||||||
**Target**: Split `pages/settings.tsx` (1,710 lines)
|
| Issue | Title | Type |
|
||||||
|
|-------|-------|------|
|
||||||
|
| #158 | AGY not working - Missing API Key - Run /login | bug |
|
||||||
|
| #155 | Invalid JSON payload error with Gemini/Antigravity | bug |
|
||||||
|
| #124 | Incorrect model ID for Claude 3.5 Sonnet (Thinking) | bug |
|
||||||
|
|
||||||
**Proposed Structure**:
|
### High Priority (Features)
|
||||||
```
|
|
||||||
pages/settings/
|
|
||||||
├── index.tsx # Main layout
|
|
||||||
├── general-section.tsx # General settings
|
|
||||||
├── appearance-section.tsx # Theme, colors
|
|
||||||
├── providers-section.tsx # Provider config
|
|
||||||
├── websearch-section.tsx # WebSearch config
|
|
||||||
├── advanced-section.tsx # Advanced options
|
|
||||||
├── hooks.ts # Shared hooks
|
|
||||||
└── types.ts # Settings types
|
|
||||||
```
|
|
||||||
|
|
||||||
### Priority 2: Analytics Page Split
|
| Issue | Title | Type | Status |
|
||||||
|
|-------|-------|------|--------|
|
||||||
|
| #142 | Configure with available CLIProxyAPI | enhancement | **IN PROGRESS** |
|
||||||
|
| #157 | Support for Kiro auth from CLIProxyAPIPlus | enhancement | - |
|
||||||
|
| #123 | Add More Models | enhancement | Ongoing |
|
||||||
|
| #114 | OpenCode Zen Free model + Auto Rotation API Key | enhancement | - |
|
||||||
|
|
||||||
**Target**: Split `pages/analytics.tsx` (420 lines)
|
### Medium Priority
|
||||||
|
|
||||||
**Proposed Structure**:
|
| Issue | Title | Type |
|
||||||
```
|
|-------|-------|------|
|
||||||
pages/analytics/
|
| #137 | CCS Cannot Connect to IDE, but Native Claude Works | support |
|
||||||
├── index.tsx # Main layout
|
| #89 | Add Claude Code CLI flag passthrough for delegation | enhancement |
|
||||||
├── usage-overview.tsx # Usage summary
|
|
||||||
├── model-breakdown.tsx # Per-model stats
|
|
||||||
├── cost-analysis.tsx # Cost tracking
|
|
||||||
└── hooks.ts # Data hooks
|
|
||||||
```
|
|
||||||
|
|
||||||
### Priority 3: Auth Monitor Split
|
### Low Priority / Questions
|
||||||
|
|
||||||
**Target**: Split `monitoring/auth-monitor.tsx` (465 lines)
|
| Issue | Title | Type |
|
||||||
|
|-------|-------|------|
|
||||||
**Proposed Structure**:
|
| #156 | Configure API for Zed IDE | docs |
|
||||||
```
|
| #140 | Do we support ampcode? | question |
|
||||||
monitoring/auth-monitor/
|
| #111 | Factory droid CLI support | enhancement |
|
||||||
├── index.tsx # Main component
|
| #103 | /context command returns incorrect context | invalid |
|
||||||
├── provider-status.tsx # Provider cards
|
|
||||||
├── token-display.tsx # Token info
|
|
||||||
├── refresh-controls.tsx # Refresh actions
|
|
||||||
└── hooks.ts # Auth hooks
|
|
||||||
```
|
|
||||||
|
|
||||||
### Priority 4: Test Coverage
|
|
||||||
|
|
||||||
**Target**: Add tests for modularized components
|
|
||||||
|
|
||||||
- Unit tests for extracted utilities
|
|
||||||
- Component tests for split UI modules
|
|
||||||
- Integration tests for barrel exports
|
|
||||||
- Snapshot tests for UI components
|
|
||||||
|
|
||||||
### Priority 5: Documentation
|
|
||||||
|
|
||||||
**Target**: Keep documentation synchronized
|
|
||||||
|
|
||||||
- Update codebase-summary.md on structural changes
|
|
||||||
- Document new patterns in code-standards.md
|
|
||||||
- Keep architecture diagrams current
|
|
||||||
- Add inline JSDoc comments
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Development Milestones
|
## Future Roadmap
|
||||||
|
|
||||||
| Milestone | Status | Target Date |
|
### Priority 1: Multiple CLIProxyAPI Instances
|
||||||
|-----------|--------|-------------|
|
|
||||||
| Phase 1: Types | COMPLETE | - |
|
Support connecting to multiple CLIProxyAPI servers simultaneously.
|
||||||
| Phase 2: Commands | COMPLETE | - |
|
|
||||||
| Phase 3: CLIProxy | COMPLETE | - |
|
**Use Cases**:
|
||||||
| Phase 4: Utils/Errors | COMPLETE | - |
|
- Load balancing across multiple proxy servers
|
||||||
| Phase 5: UI Components | COMPLETE | - |
|
- Failover when primary server unavailable
|
||||||
| Phase 6: Settings Split | PENDING | Q1 2026 |
|
- Geographic distribution for latency optimization
|
||||||
| Phase 7: Remaining Splits | PENDING | Q1 2026 |
|
- Separate proxies for different provider groups
|
||||||
| Phase 8: Test Coverage | PENDING | Q2 2026 |
|
|
||||||
|
**Proposed Config**:
|
||||||
|
```yaml
|
||||||
|
cliproxy:
|
||||||
|
instances:
|
||||||
|
primary:
|
||||||
|
url: http://localhost:8000
|
||||||
|
providers: [gemini, codex]
|
||||||
|
weight: 80
|
||||||
|
secondary:
|
||||||
|
url: http://192.168.1.100:8000
|
||||||
|
providers: [agy]
|
||||||
|
weight: 20
|
||||||
|
failover:
|
||||||
|
url: http://backup.example.com:8000
|
||||||
|
priority: 2 # Only if primary/secondary fail
|
||||||
|
strategy: weighted-round-robin
|
||||||
|
```
|
||||||
|
|
||||||
|
### Priority 2: Native Git Worktree Support
|
||||||
|
|
||||||
|
Opt-in automatic git worktree management for features/issues.
|
||||||
|
|
||||||
|
**Use Cases**:
|
||||||
|
- Automatic worktree creation when starting issue
|
||||||
|
- Isolation of feature development
|
||||||
|
- Easy cleanup after merge
|
||||||
|
- Integration with GitHub issues
|
||||||
|
|
||||||
|
**Proposed Settings**:
|
||||||
|
```yaml
|
||||||
|
worktrees:
|
||||||
|
enabled: true
|
||||||
|
base_path: ~/.ccs/worktrees
|
||||||
|
auto_create: true
|
||||||
|
auto_cleanup: true
|
||||||
|
naming: "{issue-number}-{short-title}"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Priority 3: Enhanced Model Support
|
||||||
|
|
||||||
|
- **#123**: Expand model catalog with new releases
|
||||||
|
- **#124**: Fix Claude 3.5 Sonnet (Thinking) model ID
|
||||||
|
- **#114**: OpenCode Zen free model + API key rotation
|
||||||
|
|
||||||
|
### Priority 4: IDE Integration
|
||||||
|
|
||||||
|
- **#137**: Debug CCS-to-IDE connection issues
|
||||||
|
- **#156**: Zed IDE configuration documentation
|
||||||
|
- **#140**: Investigate ampcode compatibility
|
||||||
|
- **#111**: Factory droid CLI support assessment
|
||||||
|
|
||||||
|
### Priority 5: Authentication Enhancements
|
||||||
|
|
||||||
|
- **#158**: Fix AGY OAuth flow
|
||||||
|
- **#157**: Add Kiro auth support from CLIProxyAPIPlus
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Milestones
|
||||||
|
|
||||||
|
| Milestone | Status | Target |
|
||||||
|
|-----------|--------|--------|
|
||||||
|
| Modularization (Phases 1-9) | COMPLETE | - |
|
||||||
|
| Critical Bug Fixes (#158, #155, #124) | PLANNED | Q1 2026 |
|
||||||
|
| Multiple CLIProxyAPI Instances | PLANNED | Q1 2026 |
|
||||||
|
| Git Worktree Support | PLANNED | Q1 2026 |
|
||||||
|
| Enhanced Model Support | PLANNED | Q2 2026 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Success Criteria
|
## Success Criteria
|
||||||
|
|
||||||
### Code Quality
|
All criteria achieved:
|
||||||
|
|
||||||
- [ ] All files under 200 lines (except documented exceptions)
|
- [x] Files under 200 lines (except documented exceptions)
|
||||||
- [ ] Every directory has barrel export
|
- [x] Every directory has barrel export
|
||||||
- [ ] No circular dependencies
|
- [x] No circular dependencies
|
||||||
- [ ] TypeScript strict mode passing
|
- [x] TypeScript strict mode passing
|
||||||
|
- [x] 90%+ test coverage
|
||||||
### Maintainability
|
- [x] Clear domain boundaries
|
||||||
|
- [x] Consistent naming conventions
|
||||||
- [ ] Clear domain boundaries
|
|
||||||
- [ ] Consistent naming conventions
|
|
||||||
- [ ] Comprehensive documentation
|
|
||||||
- [ ] Easy navigation for new developers
|
|
||||||
|
|
||||||
### Developer Experience
|
|
||||||
|
|
||||||
- [ ] Fast build times
|
|
||||||
- [ ] Efficient tree-shaking
|
|
||||||
- [ ] Clear import paths
|
|
||||||
- [ ] Minimal cognitive load
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# CCS System Architecture
|
# CCS System Architecture
|
||||||
|
|
||||||
Last Updated: 2025-12-19
|
Last Updated: 2025-12-21
|
||||||
|
|
||||||
High-level architecture documentation for the CCS (Claude Code Switch) system.
|
High-level architecture documentation for the CCS (Claude Code Switch) system.
|
||||||
|
|
||||||
@@ -166,14 +166,14 @@ CCS is a CLI wrapper that enables seamless switching between multiple Claude acc
|
|||||||
+===========================================================================+
|
+===========================================================================+
|
||||||
|
|
||||||
+------------------+
|
+------------------+
|
||||||
| pages/ | Route-level components
|
| pages/ | Route-level components (modular directories)
|
||||||
|------------------|
|
|------------------|
|
||||||
| analytics.tsx |
|
| analytics/ | 8 files - usage charts, cost tracking
|
||||||
|
| settings/ | 20 files - lazy-loaded tab sections
|
||||||
| api.tsx |
|
| api.tsx |
|
||||||
| cliproxy.tsx |
|
| cliproxy.tsx |
|
||||||
| copilot.tsx |
|
| copilot.tsx |
|
||||||
| health.tsx |
|
| health.tsx |
|
||||||
| settings.tsx |
|
|
||||||
+------------------+
|
+------------------+
|
||||||
|
|
|
|
||||||
v
|
v
|
||||||
@@ -186,7 +186,7 @@ CCS is a CLI wrapper that enables seamless switching between multiple Claude acc
|
|||||||
| copilot/ | +------------------+ | use-profiles |
|
| copilot/ | +------------------+ | use-profiles |
|
||||||
| health/ | | use-websocket |
|
| health/ | | use-websocket |
|
||||||
| layout/ | +------------------+
|
| layout/ | +------------------+
|
||||||
| monitoring/ |
|
| monitoring/ | <-- auth-monitor/ (8 files), error-logs/ (6 files)
|
||||||
| profiles/ |
|
| profiles/ |
|
||||||
| setup/ |
|
| setup/ |
|
||||||
| shared/ |
|
| shared/ |
|
||||||
|
|||||||
Reference in New Issue
Block a user