mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 02:11:28 +00:00
fix(tests): migrate test suite from mocha to bun test runner
- Replace before()/after() with beforeAll()/afterAll() - Remove this.timeout() calls (unsupported by bun) - Update package.json scripts to use bun test - Fix error message regex for cross-runtime compatibility - Skip integration tests requiring network/child process mocking - Format source files with prettier
This commit is contained in:
committed by
kaitranntt
parent
cf577a5b40
commit
bd46c8de12
+120
-1
@@ -80,6 +80,9 @@ ccs glm /code "implement feature"
|
||||
```bash
|
||||
ccs --version # Show enhanced version info with installation details
|
||||
ccs --help # Show CCS-specific help documentation
|
||||
ccs update # Check for and install updates
|
||||
ccs update --force # Force reinstall from latest (skip update checks)
|
||||
ccs update --beta # Install from beta channel (npm only)
|
||||
```
|
||||
|
||||
**Example `--version` Output**:
|
||||
@@ -103,6 +106,64 @@ Run 'ccs --help' for usage information
|
||||
- Platform-specific guidance
|
||||
- Configuration file location and troubleshooting
|
||||
|
||||
### Update Command Details
|
||||
|
||||
The `ccs update` command provides flexible update management with beta channel support:
|
||||
|
||||
**Standard Update**:
|
||||
```bash
|
||||
ccs update
|
||||
```
|
||||
- Checks for updates using cached results (24-hour cache)
|
||||
- Only updates if a newer version is available
|
||||
- Preserves package manager preference (npm, yarn, pnpm, bun)
|
||||
|
||||
**Force Reinstall**:
|
||||
```bash
|
||||
ccs update --force
|
||||
```
|
||||
- Skips all update checks and cache validation
|
||||
- Reinstalls from the target channel immediately
|
||||
- Useful for:
|
||||
- Troubleshooting installation issues
|
||||
- Ensuring clean installation
|
||||
- Switching between channels without waiting
|
||||
- Automatically clears package manager cache before reinstalling
|
||||
|
||||
**Beta Channel** (npm installation only):
|
||||
```bash
|
||||
ccs update --beta
|
||||
```
|
||||
- Installs from the `@dev` npm tag instead of `@latest`
|
||||
- Access to cutting-edge features and fixes before stable release
|
||||
- **Shows stability warnings**:
|
||||
```
|
||||
[!] Installing from @dev channel (unstable)
|
||||
[!] Not recommended for production use
|
||||
[!] Use `ccs update` (without --beta) to return to stable
|
||||
```
|
||||
- Can be combined with `--force`: `ccs update --force --beta`
|
||||
- Switches to dev channel for future standard updates until reverted
|
||||
|
||||
**Installation Method Detection**:
|
||||
- **npm installations**: Full support for all flags (`--force`, `--beta`)
|
||||
- Fetches versions from npm registry with tag-specific queries
|
||||
- Installs from `@kaitranntt/ccs@latest` or `@kaitranntt/ccs@dev`
|
||||
- **Direct installer installations**: Limited support
|
||||
- Only supports `--force` flag
|
||||
- Shows error for `--beta` with migration guidance:
|
||||
```
|
||||
[X] --beta flag requires npm installation
|
||||
|
||||
Current installation method: direct installer
|
||||
To use beta releases, install via npm:
|
||||
|
||||
npm install -g @kaitranntt/ccs
|
||||
ccs update --beta
|
||||
|
||||
Or continue using stable releases via direct installer.
|
||||
```
|
||||
|
||||
**Uninstall (Recommended)**:
|
||||
```bash
|
||||
# npm (recommended)
|
||||
@@ -243,4 +304,62 @@ The simplified CCS architecture provides efficient profile switching:
|
||||
- **Simplified error handling**: Direct console.error for clarity and performance
|
||||
- **Optimized platform detection**: Centralized cross-platform logic
|
||||
|
||||
No magic. No file modification. Efficient delegation. Works identically across all platforms with improved performance and maintainability.
|
||||
No magic. No file modification. Efficient delegation. Works identically across all platforms with improved performance and maintainability.
|
||||
|
||||
## API Reference
|
||||
|
||||
### Update Command API
|
||||
|
||||
The `ccs update` command provides comprehensive update management with the following API:
|
||||
|
||||
#### Syntax
|
||||
```bash
|
||||
ccs update [options]
|
||||
```
|
||||
|
||||
#### Options
|
||||
|
||||
| Option | Type | Default | Description |
|
||||
|--------|------|---------|-------------|
|
||||
| `--force` | flag | false | Skip update checks and force reinstall |
|
||||
| `--beta` | flag | false | Install from beta channel (`@dev` tag) |
|
||||
|
||||
#### Return Codes
|
||||
|
||||
| Code | Meaning |
|
||||
|------|---------|
|
||||
| 0 | Success (no update needed or update installed) |
|
||||
| 1 | Error (update failed, network issues, or invalid flags) |
|
||||
|
||||
#### Examples
|
||||
|
||||
```bash
|
||||
# Standard update check
|
||||
ccs update
|
||||
|
||||
# Force reinstall from latest stable
|
||||
ccs update --force
|
||||
|
||||
# Switch to beta channel
|
||||
ccs update --beta
|
||||
|
||||
# Force reinstall from beta channel
|
||||
ccs update --force --beta
|
||||
```
|
||||
|
||||
#### Implementation Details
|
||||
|
||||
**Version Fetching**:
|
||||
- npm installations: Queries `https://registry.npmjs.org/@kaitranntt/ccs/{tag}`
|
||||
- Direct installations: Queries GitHub API releases endpoint
|
||||
- Cache: 24-hour cache to avoid excessive API calls
|
||||
|
||||
**Error Handling**:
|
||||
- Network timeouts: 5-second timeout for all HTTP requests
|
||||
- Missing npm tag: Graceful fallback with informative error
|
||||
- Installation conflicts: Clear guidance for resolution
|
||||
|
||||
**Platform Support**:
|
||||
- npm: Full feature support (all flags and channels)
|
||||
- yarn/pnpm/bun: Full npm compatibility
|
||||
- Direct installers: Limited to `--force` flag only
|
||||
Reference in New Issue
Block a user