mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-17 06:17:09 +00:00
* feat(cliproxy): add HTTPS tunnel for remote proxy mode Claude Code doesn't support HTTPS in ANTHROPIC_BASE_URL directly (undici limitation). This adds an HTTP→HTTPS tunnel proxy for remote CLIProxyAPI connections. Changes: - Add HttpsTunnelProxy: local HTTP server tunneling to remote HTTPS - Add CodexReasoningProxy HTTPS support and path prefix stripping - Remote mode now uses root paths (/v1/messages) not provider-prefixed - Add remote token uploader for syncing OAuth tokens to remote server - Auto-upload tokens after OAuth auth when remote mode is enabled Flow for remote HTTPS: Claude CLI → CodexReasoningProxy → HttpsTunnel → Remote HTTPS Built with [OnSteroids](https://onsteroids.ai) Co-Authored-By: OnSteroids <built@onsteroids.ai> * fix: address PR review issues for HTTPS tunnel proxy - Add connection tracking with activeConnections Set for proper cleanup - Add port validation after start() to reject port 0 - Add Authorization header fallback injection in buildForwardHeaders() - Handle client disconnect (premature close) and request errors - Improve error handling in uploadTokenToRemoteAsync (log instead of silent catch) - Add comprehensive tests for HttpsTunnelProxy (97% coverage) - Add integration tests for remote-token-uploader - Add stripPathPrefix unit tests for remote mode Built with [OnSteroids](https://onsteroids.ai) Co-Authored-By: OnSteroids <built@onsteroids.ai> * fix: bump Node.js engine requirement to >=18.0.0 FormData and Blob APIs used in remote-token-uploader require Node.js 18+. Addresses coderabbit review comment about Node.js engine compatibility. Built [OnSteroids](https://onsteroids.ai) Co-Authored-By: OnSteroids <built@onsteroids.ai> * fix: address remaining PR suggestions - Add verbose parameter to registerAccountFromToken for proper propagation - Improve stripPathPrefix with path normalization (double slashes, leading slash) - Add edge case tests for path normalization Built [OnSteroids](https://onsteroids.ai) Co-Authored-By: OnSteroids <built@onsteroids.ai> * fix: add timeout to flaky npm CLI tests Tests 'handles empty arguments gracefully' and 'handles very long argument' were missing timeout option in execSync, causing occasional timeouts when bun test's 5000ms limit was reached before CLI completed. Built [OnSteroids](https://onsteroids.ai) Co-Authored-By: OnSteroids <built@onsteroids.ai> * fix: address new PR review feedback - Add path segment boundary check to prevent partial matches (/codex vs /codextra) - Add hostname validation in HttpsTunnelProxy constructor - Add race condition protection with 'starting' flag in start() - Sanitize error messages (detailed only in verbose mode) - Update comments for clarity (regex behavior) - Add comprehensive tests for all edge cases Built [OnSteroids](https://onsteroids.ai) Co-Authored-By: OnSteroids <built@onsteroids.ai> --------- Co-authored-by: OnSteroids <built@onsteroids.ai>
CCS Test Suite
Organization
tests/
├── unit/ # Module unit tests (Mocha)
│ ├── glmt/ # GLMT transformer tests
│ └── delegation/ # Delegation module tests
├── npm/ # npm package tests (Mocha)
├── native/ # Native installation tests (bash/PowerShell)
│ ├── unix/ # Unix/Linux/macOS tests
│ └── windows/ # Windows PowerShell tests
├── integration/ # Integration tests (manual execution)
└── shared/ # Shared utilities
├── fixtures/ # Test configuration and environment
├── unit/ # Helper function tests
├── helpers.sh # Bash test utilities
└── test-data.js # Test data for npm tests
Running Tests
bun run test # All automated tests (unit + npm)
bun run test:unit # Unit tests only (Mocha)
bun run test:npm # npm package tests (Mocha)
bun run test:native # Native Unix tests (bash)
Test Categories
Unit Tests (unit/)
Module-level tests using Mocha framework:
unit/glmt/- GLMT transformer, SSE parser, delta accumulatorunit/delegation/- Permission mode, session manager, result formatter
npm Tests (npm/)
npm package functionality tests using Mocha:
postinstall.test.js- Postinstall behaviorcli.test.js- CLI argument parsingcross-platform.test.js- Cross-platform compatibilityspecial-commands.test.js- Integration tests
Native Tests (native/)
Installation tests for curl|bash (Unix) and irm|iex (Windows):
native/unix/edge-cases.sh- Unix edge case testsnative/windows/edge-cases.ps1- Windows edge case tests
Integration Tests (integration/)
Manual execution tests for specific scenarios:
token-counting-test.js- Token counting validationz-ai-streaming-test.js- Z.AI streamingglmt-integration-test.sh- GLMT integrationsymlink-chain-test.sh- Symlink chain handlingux-integration-test.sh- CLI UX integration
Adding New Tests
- Unit tests: Add to
unit/<module>/using Mocha + Node.js assert - npm tests: Add to
npm/using Mocha - Native tests: Add to
native/unix/ornative/windows/ - Integration tests: Add to
integration/