mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-02 06:21:53 +00:00
Implements the user-facing surface for ccsx auth profile management. After `ccsx auth create work` (auto-spawns codex login with CODEX_HOME pinned per D11), users can `eval "$(ccsx auth use work)"` in any shell to scope all subsequent codex invocations to that profile — letting two terminals run two different Codex accounts concurrently. - codex-auth-router: dispatches argv to subcommand handlers - create: idempotent, --force re-links config.toml preserving auth.json (D9), then auto-spawns codex login with CODEX_HOME pinned (D11); filesystem ops happen before registry write to avoid registry orphans on EACCES/ENOSPC - login: standalone re-auth for an existing profile - switch: persistent default in YAML registry - use: STDOUT-DISCIPLINED — emits only shell-evalable exports; bash/zsh/fish/PowerShell/cmd syntaxes via shell-detect; sets CCS_NO_PRE_DISPATCH=1 at module load to suppress recovery/migration banners that would otherwise contaminate eval (C2) - show: list (active(missing) row at top per D14) + detail views - remove: default-profile guard, active-shell warn, --yes / --force - ASCII-only output, NO_COLOR honored, all errors to stderr via exitWithError - pre-dispatch.ts: early-return when CCS_NO_PRE_DISPATCH=1, placed before autoMigrate which is itself a stdout writer 57 unit tests, all green. Help text cross-references the ccsxp/ccsx distinction since the binaries differ by one character (H5).
CCS Test Suite
Organization
tests/
├── unit/ # Module unit tests (Mocha)
│ ├── glmt/ # Legacy GLMT transformer/internal compatibility 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 + smoke tests
└── 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 + integration + npm)
bun run test:unit # Unit tests only
bun run test:npm # npm package tests
bun run test:native # Native Unix tests (bash)
Test Categories
Unit Tests (unit/)
Module-level tests using Mocha framework:
unit/glmt/- Legacy transformer internals kept for Cursor translation compatibilityunit/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/)
Integration and smoke coverage for scenarios that exercise multiple layers:
- Automated
*.test.tsfiles run as part ofbun run test:alland CI - Shell and standalone probe scripts remain on-demand for targeted debugging
cursor-daemon-lifecycle.test.ts- local daemon process + HTTP smoke coverageimage-analyzer-hook.test.ts- hook integration coverageglmt-integration-test.sh- legacy GLMT compatibility smoke probesymlink-chain-test.sh- Symlink chain handlingux-integration-test.sh- CLI UX integration
Adding New Tests
- Unit tests: Add to
unit/<module>/for isolated module behavior - npm tests: Add to
npm/for package behavior - Native tests: Add to
native/unix/ornative/windows/ - Integration tests: Add automated cross-layer smoke coverage to
integration/*.test.ts