Commit Graph
111 Commits
Author SHA1 Message Date
Kai (Tam Nhu) Tranandkaitranntt 2671b97039 fix(completion): improve shell completion UI/UX and fix mkdir errors (#10)
* fix(shell-completion): resolve ENOTDIR error when parent path is a file

Fixes issue where `--shell-completion` fails with ENOTDIR error when
a file exists where a directory should be created (e.g., ~/.zsh exists
as a file instead of a directory).

Changes:
- Added ensureDirectory() helper that safely creates directories
- Validates parent paths are directories, not files
- Provides clear error message when file conflicts occur
- Applied to all shell installers (bash, zsh, fish, powershell)
- Maintains idempotent behavior (safe to call multiple times)

Before: mkdir with recursive:true fails silently with ENOTDIR
After: Clear error message guides user to resolve file conflict

* chore: bump version to 4.1.4

* feat(completion): improve UI/UX with descriptions and grouping

Improves shell completion UI/UX across all shells (bash, zsh, fish,
PowerShell) with better organization and clearer descriptions.

Changes:
- Zsh: Added descriptions for all profiles and grouped by category
  - Commands: "auth", "doctor" with descriptions
  - Model profiles: glm, glmt, kimi, etc. with descriptions
  - Account profiles: Dynamic with "Account-based profile" label
  - Used _alternative for visual grouping
- Fish: Added explicit completions with descriptions for known profiles
  - Replaced generic profile listing with specific entries
  - Each profile now shows clear description (e.g., "GLM-4.6 (cost-optimized)")
- Bash: Added --shell-completion flag and subflags completion
- PowerShell: Added --shell-completion flag and subflags completion
- All shells: Added completion for --shell-completion subflags

Before (zsh):
  ccs
  auth     -- Manage multiple Claude accounts
  doctor   -- Run health check and diagnostics
  default  glm      glmt     kimi     max

After (zsh):
  commands
    auth    -- Manage multiple Claude accounts
    doctor  -- Run health check and diagnostics
  model profiles
    default -- Default Claude Sonnet 4.5
    glm     -- GLM-4.6 (cost-optimized)
    glmt    -- GLM-4.6 with thinking mode
    kimi    -- Kimi for Coding (long-context)
    max     -- Claude Opus (maximum capability)
  account profiles
    work    -- Account-based profile
    personal -- Account-based profile

Consistent, organized, and informative completion across all shells.

* fix(completion): handle custom profiles and fix zsh syntax errors

Fixes two issues:
1. Zsh syntax errors with _describe -t flag in _alternative
2. Adds general handling for custom settings profiles (e.g., m2)

Changes:
- Zsh: Fixed _alternative syntax (removed -t tag from _describe calls)
  - Error was: "_describe:21: bad option: -M"
  - Cause: Tag is auto-derived in _alternative, don't specify with -t
- Fish: Added __fish_ccs_get_custom_settings_profiles function
  - Dynamically loads non-hardcoded profiles from config.json
  - Shows "Settings-based profile" description for custom profiles
- Removed 'max' from hardcoded known profiles
  - 'max' is user's account-based profile, not a default setting

Now supports any custom settings profile (e.g., m2.settings.json for
Minimax M2) without hardcoding. Custom profiles show with generic
"Settings-based profile" description.

Installation properly overwrites:
- fs.copyFileSync overwrites completion files by default
- RC files only modified if marker not already present

* fix(zsh): simplify completion to avoid _alternative syntax issues

Replaced _alternative with multiple _describe calls to fix persistent
zsh completion errors.

The _alternative approach was causing:
- '_describe:21: bad option: -M'
- '(eval):1: bad substitution'
- Unwanted variable expansion in completion menu

New approach uses sequential _describe calls which zsh handles correctly.
Simpler, more reliable, and still shows grouped completion with
descriptions.

Before: _alternative with complex nested _describe calls (broken)
After: Three simple _describe calls (works correctly)

* feat(zsh): add colors and improved formatting to completion

Enhances zsh completion UI/UX with colors and better spacing:

Colors:
- Blue: commands (auth, doctor)
- Green: model profiles (default, glm, glmt, kimi, custom)
- Yellow: account profiles
- Gray: descriptions

Formatting:
- Wider separator (  --  ) for better readability
- Group headers in bold cyan
- Menu selection enabled for navigation
- list-rows-first for better column layout

Before:
  auth    -- Manage multiple Claude accounts
  default  -- Default Claude Sonnet 4.5
  doctor  -- Run health check and diagnostics
  glm      -- GLM-4.6 (cost-optimized)

After:
  commands (cyan header)
  auth    --  Manage multiple Claude accounts  (blue)
  doctor  --  Run health check and diagnostics (blue)

  model profiles (cyan header)
  default  --  Default Claude Sonnet 4.5       (green)
  glm      --  GLM-4.6 (cost-optimized)        (green)
  glmt     --  GLM-4.6 with thinking mode      (green)
  kimi     --  Kimi for Coding (long-context)  (green)

  account profiles (cyan header)
  max  --  Account-based profile              (yellow)

Table-like appearance with colors matching --help output style.

* feat(fish): add colors to completion descriptions

Adds color-coded descriptions to Fish completion matching zsh style:

Colors:
- Blue: commands (auth, doctor)
- Green: model profiles (default, glm, glmt, kimi, custom)
- Yellow: account profiles

Fish has excellent native color support via set_color, making this
straightforward to implement.

Before:
  auth       Manage multiple Claude accounts
  default    Default Claude Sonnet 4.5
  glm        GLM-4.6 (cost-optimized)
  max        Account profile

After:
  auth       Manage multiple Claude accounts       (blue)
  default    Default Claude Sonnet 4.5            (green)
  glm        GLM-4.6 (cost-optimized)             (green)
  max        Account profile                      (yellow)

Consistent color scheme across zsh and fish shells.

* fix(zsh): correct color application for commands vs descriptions

Fixed color codes being applied backwards - commands were gray while
descriptions were colorful.

Issue:
- Used '1;34' format which zsh misinterpreted
- Commands appeared gray (unreadable)
- Descriptions appeared in color

Fix:
- Simplified color codes from '1;34' to '34' (just the color, no style prefix)
- Pattern now: =(#b)(command)(-- description)=34=90
  - First group (command): color 34 (blue/green/yellow)
  - Second group (description): color 90 (gray)

Before:
  auth    --  Manage multiple Claude accounts  (gray) (blue)

After:
  auth    --  Manage multiple Claude accounts  (blue) (gray)

Commands now properly colored, descriptions muted.

* feat(zsh): improve section header visibility with separators

Makes section headers more distinct and recognizable as dividers:

Before:
  commands
  auth    --  ...

After:

  ── commands ──
  auth    --  ...

Changes:
- Added blank line before headers ($'\n')
- Bold yellow with decorative separators (── text ──)
- Clearly distinguishes section headers from actual commands

Now it's obvious that 'commands', 'model profiles', and 'account
profiles' are just section labels, not completable items.

* fix(zsh): use full ANSI color codes to fix reversed colors

The issue was using shorthand color codes (34, 90) instead of full
ANSI format (0;34, 2;37). Zsh was misinterpreting the shorthand,
causing colors to be applied to wrong groups.

Fixed:
- Commands: 0;34 (normal blue) - was appearing gray
- Model profiles: 0;32 (normal green) - was appearing gray
- Account profiles: 0;33 (normal yellow) - was appearing gray
- Descriptions: 2;37 (dim white) - was appearing colorful

Color codes must be escaped as 0\;34 in zsh strings.

Before fix:
  auth      (gray) --  description (blue)

After fix:
  auth      (blue) --  description (dim gray)

* fix(zsh): swap color order for completion groups

Zsh may apply colors in reverse order to capture groups on some systems.
Swapped color order: group 2 first, then group 1.

Pattern: (command)(separator + description)
Was: =blue=dim_white (applied as: blue to cmd, dim to desc)
Now: =dim_white=blue (applied as: dim to desc, blue to cmd)

Testing if this resolves the reversed color issue.

* fix(zsh): add empty leading color to fix reversed coloring

ROOT CAUSE: Zsh list-colors apply first color to WHOLE match, then
override with subsequent colors for each group. Without an empty
leading color, the whole match color leaks to groups without overrides.

Pattern behavior:
  =(#b)(cmd)(desc)=BLUE=DIM
    → Whole: BLUE, Group1: DIM (override), Group2: BLUE (no override)
    → Result: cmd=dim, desc=BLUE (REVERSED!)

  =(#b)(cmd)(desc)==BLUE=DIM
    → Whole: none, Group1: BLUE, Group2: DIM
    → Result: cmd=BLUE, desc=dim (CORRECT!)

The '==' at start means 'no whole-match color', preventing color bleed.

Now commands will be colorful (blue/green/yellow) and descriptions dim.

* refactor(help): remove specific account examples and generalize description

Removed deterministic account examples (work, personal, team) to make
the help text more generic and less prescriptive.

Changes:
- Removed 'ccs work' and 'ccs personal' example lines
- Removed 'Multi-account workflow' examples section
- Updated description from 'multiple Claude accounts (work, personal, team)'
  to 'multiple Claude accounts and alternative models'
- Changed to 'Run different Claude CLI sessions concurrently'
- Applied consistently across Node.js (bin/ccs.js), bash (lib/ccs),
  and PowerShell (lib/ccs.ps1)

This makes the help text more flexible and doesn't imply specific
use cases or account naming conventions.

* refactor(help): clarify delegation section and remove non-existent command

Updated delegation section in help text across all implementations:

Changes:
- Renamed section from 'Delegation (Token Optimization)' to
  'Delegation (inside Claude Code CLI)' to clarify context
- Removed non-existent '/ccs:create m2' command
- Simplified description to focus on cost savings
- Updated command descriptions:
  - '/ccs:glm' now 'for simple tasks' (clearer use case)
  - '/ccs:kimi' unchanged (already clear)
- Added delegation section to PowerShell help (was missing)
- Consistent messaging across Node.js, bash, and PowerShell

The new section makes it immediately clear that delegation commands
are used within Claude Code CLI sessions, not as standalone commands.

---------
2025-11-18 01:19:28 -05:00
kaitranntt ae03e85730 chore: update changelog for v4.1.3 release 2025-11-16 20:35:31 -05:00
Kai (Tam Nhu) TranandGitHub bdcdd6acc4 fix(doctor): resolve delegation check false positive (v4.1.3) (#9)
The 'ccs doctor' command was incorrectly checking for delegation commands
in ~/.ccs/shared/commands/ccs/ instead of ~/.ccs/.claude/commands/ccs/,
causing false "not installed" warnings even after successful installation.

Changes:
- Fix delegation check to look in correct directory (~/.ccs/.claude/)
- Remove check for non-existent create.md file
- Bump version to 4.1.3
2025-11-16 20:31:53 -05:00
kaitranntt d3559279a2 fix(kimi): resolve API 401 errors from deprecated model fields
- Remove 5 deprecated model fields from Kimi settings causing auth failures
- Update config/base-kimi.settings.json template with clean configuration
- Add automatic migration in scripts/postinstall.js to remove deprecated fields
- Preserve user API keys and custom settings during migration
- Update CHANGELOG.md with v4.1.1 and v4.1.2 entries
- Bump version to 4.1.2 across all files and installers

Fixes authentication issues with Moonshot AI (Kimi) API due to deprecated
model parameters that are now rejected by the service.
2025-11-16 07:01:09 -05:00
kaitranntt d8645c71e4 fix(.claude/): resolve npm install failure for claude-dir-installer
Fixes issue where npm install -g or ccs update would fail to copy
.claude/ directory to ~/.ccs/.claude/, causing symlink installation
errors. ClaudeDirInstaller now ensures source exists before
ClaudeSymlinkManager attempts linking.
2025-11-16 06:48:39 -05:00
kaitranntt fb3deeff38 fix(delegation): handle undefined totalCost in timeout error formatting
Add defensive checks in result-formatter, headless-executor, and session-manager
to prevent TypeError when delegated sessions timeout without emitting a result.
Includes 4 comprehensive unit tests for undefined/null totalCost scenarios.

Fixes formatting error that prevented timeout messages from displaying.
2025-11-16 06:40:31 -05:00
Kai (Tam Nhu) TranandGitHub 4df5a7d357 feat!: delegation system overhaul and .claude/ shipping (v4.1.0) (#8)
## 🚀 Release v4.1.0 - Major Update

**Breaking changes from v3.5.0**. This release includes the complete v4.0.0 delegation overhaul plus v4.1.0 architecture improvements.

---

## 🎯 v4.0.0: Delegation System Overhaul

**Complete rewrite of the delegation infrastructure with enhanced decision-making and streaming support.**

### New Delegation Features

**Stream-JSON Communication Protocol:**
- Real-time token streaming with `{type: "content", data: "..."}` format
- Progress indicators during delegation execution
- Clean separation: stdout for data, stderr for errors
- Handles tool calls, thinking blocks, and text content

**Enhanced Decision Framework:**
- `/ccs:glm` and `/ccs:kimi` slash commands with auto-enhancement
- `[AUTO ENHANCE]` prompts for better model understanding
- Context-aware task delegation with clear boundaries
- Continuation support: `/ccs:glm:continue` and `/ccs:kimi:continue`

**Robust Error Handling:**
- Graceful degradation when profiles unconfigured
- Clear error messages with actionable fixes
- Signal handling (SIGINT/SIGTERM) for clean child process termination
- Session state recovery on interruption

**Performance & Reliability:**
- Headless mode (`-p` flag) for background execution
- Slash command detection and auto-routing
- Validation system with `DelegationValidator`
- Profile readiness checks in `ccs --version`

### Delegation Components

**New Files:**
- `bin/delegation/delegation-handler.js` - Core delegation orchestrator
- `bin/delegation/stream-processor.js` - Real-time output handling
- `bin/utils/delegation-validator.js` - Profile validation
- `.claude/commands/ccs/*.md` - Slash command definitions
- `.claude/skills/ccs-delegation/` - AI decision framework
- `.claude/agents/ccs-delegator.md` - Proactive delegation agent

**Documentation:**
- Complete delegation workflows with mermaid diagrams
- Troubleshooting guides for common issues
- Headless execution patterns

---

##  v4.1.0: Selective Symlinking Architecture

**Single source of truth for CCS items with automatic propagation.**

### New Architecture

**Ship .claude/ Directory:**
- CCS items now ship with npm/sh/ps1 packages
- Selective item-level symlinks: `~/.ccs/.claude/` → `~/.claude/`
- Auto-propagation on `npm update` - zero manual sync
- Backward compatible with existing `~/.ccs/shared/` mechanism

**Symlink Chain:**
```
~/.ccs/.claude/ (source) 
    ↓ selective symlinks
~/.claude/ (CCS items installed here)
    ↑ symlinked by
~/.ccs/shared/
    ↑ symlinked by  
profiles (work, personal, team)
```

### New Commands

**Maintenance Tools:**
- `ccs update` - Re-install CCS symlinks to ~/.claude/
- `ccs doctor` - Added Check 9: CCS symlinks health verification

**Safe Installation:**
- Automatic conflict backup before symlinking
- Idempotent operations (safe to run multiple times)
- Health monitoring and recovery

### New Components

- `bin/utils/claude-symlink-manager.js` - Manages selective symlinks
- Updated all 3 installers (npm postinstall, install.sh, install.ps1)
- Enhanced `ccs doctor` with symlink health checks

---

## 💥 Breaking Changes

**From v3.5.0 → v4.x:**

1. **Delegation commands moved**: 
   - Old: User manually created in `~/.claude/commands/`
   - New: Auto-shipped in `~/.ccs/.claude/`, symlinked to `~/.claude/commands/ccs/`

2. **Slash command format**:
   - New: `/ccs:glm`, `/ccs:kimi`, `/ccs:glm:continue`
   - Old custom commands may need migration

3. **Profile validation**:
   - Placeholders (`YOUR_API_KEY_HERE`) now detected and marked invalid
   - Must configure real API keys for delegation to work

4. **Stream output format**:
   - Headless mode (`-p`) now uses stream-JSON protocol
   - Old text output replaced with structured `{type, data}` format
2025-11-16 06:31:55 -05:00
Kai (Tam Nhu) TranandGitHub f40e9647ec feat(cli): comprehensive UX improvements for v3.5.0 (#7)
Implements 6-phase CLI UX improvement plan with comprehensive error handling, 
interactive features, and cross-platform consistency.

### Added
- Shell auto-completion (bash, zsh, PowerShell, Fish)
- Error codes (E101-E901) with documentation URLs
- Fuzzy matching "Did you mean?" suggestions (Levenshtein distance)
- Progress indicators (doctor [n/9] counter, GLMT proxy spinner)
- Interactive confirmation prompts with --yes/-y automation flag
- JSON output format (--json) for auth commands
- Impact display (session count, paths) before destructive operations
- Comprehensive test suite (15 tests, 100% pass rate)
- Complete error documentation in docs/errors/
- Cross-platform `--shell-completion` command

### Changed
- Error boxes: Unicode (╔═╗) → ASCII (===) for compatibility
- JSON output uses CCS version instead of schema version
- Help text includes EXAMPLES section across platforms
- Test suite properly counts test cases (not assertions)

### Fixed
- --yes flag bug (returned false instead of true)
- Help text consistency (added Uninstall section to bash)
- Test pass rate calculation (excludes skipped tests)
- Help section comparison (locale-specific sort)

### Testing
- 13/13 tests passing (2 legitimately skipped)
- Cross-platform verified (Node.js, bash, PowerShell)
- All error codes documented and tested
2025-11-15 01:26:50 -05:00
kaitranntt 01cff1114b docs: restructure README files with parallel workflow messaging and user path guidance 2025-11-13 21:59:14 -05:00
kaitranntt f4cd32baf0 docs: update README files with improved structure and GLMT experimental warnings
- Reorganized README structure with collapsible sections for better readability
- Added comprehensive GLMT experimental warnings and troubleshooting guides
- Updated installation instructions with traditional vs npm options
- Added parallel workflow examples and detailed feature comparisons
- Enhanced documentation with proper acknowledgments and security limits
- Standardized language and formatting across all README variants
2025-11-13 21:29:17 -05:00
kaitranntt 3e26937945 docs: update README files with GLMT sections and translations
- Move GLMT section to proper position in English README
- Add missing npm badge to Vietnamese README
- Add GLMT and Architecture sections to all translations
- Update configuration examples with glmt profile
- Add Windows Developer Mode support documentation
- Fix documentation links across all language versions
2025-11-12 13:31:15 -05:00
kaitranntt 844baa997a chore: update to v3.4.6 with reasoning enforcer and GLMT improvements 2025-11-12 00:19:17 -05:00
kaitranntt 7bb2fb92c8 docs: add honest GLMT production warnings and experimental status
- Add prominent NOT PRODUCTION READY warning for GLMT
- Update GLM vs GLMT comparison to reflect experimental nature
- Tone down overconfident marketing language in tool support
- Add honest failure rates for streaming functionality
- Reference CCR hustle with Transformer of Bedolla as alternative
- Update thinking keywords to reflect inconsistent behavior
2025-11-11 22:49:37 -05:00
kaitranntt c113b874f3 docs: streamline CLAUDE.md with concise development guidance
Condensed comprehensive documentation into essential development guidance with:
- Simplified project overview and core principles
- Consolidated technical implementation details
- Streamlined GLMT debugging and troubleshooting section
- Focused development workflows and checklists
- Removed redundant sections and verbose explanations

Maintained all critical constraints and code standards while improving readability for developers.
2025-11-11 22:18:10 -05:00
kaitranntt 66e25b4cc9 refactor(glmt): remove deprecated environment variables
Remove references to deprecated CCS_GLMT_FORCE_ENGLISH, CCS_GLMT_THINKING_BUDGET, and CCS_GLMT_STREAMING environment variables that were removed in v3.4.3.

Changes:
- README.md: Update GLMT environment variable documentation to reflect current intelligent control system
- tests/unit/glmt/locale-enforcer.test.js: Remove outdated test scenario for removed environment variable
- docs/glmt-controls.md: Rewrite documentation to describe new automatic control mechanisms

The GLMT component now uses intelligent, automatic controls instead of manual environment variable configuration.
2025-11-11 22:10:56 -05:00
kaitranntt 513e5b693f fix(glmt): resolve thinking block signature timing race
- guard against empty content in _createSignatureDeltaEvent()

- consolidate debug flags: CCS_DEBUG_LOG, CCS_GLMT_DEBUG → CCS_DEBUG

- add 6 regression tests for signature race condition

- update docs with simplified debug flag usage
2025-11-11 21:47:41 -05:00
kaitranntt 4e3592d711 fix(postinstall): correct shared-manager require path
- update require path from '../bin/shared-manager' to '../bin/management/shared-manager'

- fixes symlink creation failure in postinstall

- bump version to 3.4.4
2025-11-11 18:47:13 -05:00
kaitranntt d3e6be171f refactor(glmt)!: simplify with keyword-based thinking control (v3.4.3)
YAGNI/KISS/DRY refactor removing 926 LOC of unused complexity:

- Replace budget-calculator + task-classifier with 40 LOC keyword detection

- Add 4-tier thinking: think < think hard < think harder < ultrathink

- Remove env vars: CCS_GLMT_THINKING_BUDGET, CCS_GLMT_STREAMING, CCS_GLMT_FORCE_ENGLISH

- Add streaming auto-fallback on error

- Rename CCS_DEBUG_LOG → CCS_DEBUG (backward compatible)

- Fix ultrathink effort: high → max

- Fix GLMT proxy path after restructure

Test coverage: 27 → 35 tests, all passing

Net change: +251, -1177 lines (-926 LOC, 78% reduction)

BREAKING CHANGE: Removed CCS_GLMT_THINKING_BUDGET, CCS_GLMT_STREAMING, CCS_GLMT_FORCE_ENGLISH env vars
2025-11-11 18:14:05 -05:00
kaitranntt 9b9182d418 chore: add package-lock.json for development consistency 2025-11-11 15:46:21 -05:00
kaitranntt c3f0c39e51 chore: bump version to 3.4.2 2025-11-11 15:40:24 -05:00
kaitranntt 5fae92ac07 feat(glmt): add streaming with real-time thinking blocks
- reorganize bin/ into auth/, glmt/, management/, utils/
- add budget calculator and locale enforcer
- enhance test coverage with unit/integration separation
2025-11-11 15:39:00 -05:00
kaitranntt 80f9cc644e feat: add GLMT streaming with real-time thinking blocks
- SSEParser/DeltaAccumulator for streaming state

- TTFB 5-20x faster (<500ms vs 2-10s)

- DoS protection: buffer limits, 120s timeout

- 51/51 tests passing (+25 streaming tests)
2025-11-11 03:47:30 -05:00
kaitranntt 657f99bfe8 feat: add GLMT proxy and transformer tools
- Add GLMT proxy server for GLM model routing
- Add GLMT transformer for output format conversion
- Update CLI with new proxy and transformer commands
- Add comprehensive test suite for new functionality
- Update documentation and architecture guides
- Bump version and update changelog
2025-11-11 03:08:56 -05:00
kaitranntt daf075dc69 feat(core)!: refactor to symlink-based shared data architecture (v3.2.0)
BREAKING CHANGE: Shared data architecture refactored from copy-based to symlink-based.

Architecture Change:

- OLD: ~/.claude/ → [COPY 500ms] → ~/.ccs/shared/ → [SYMLINK] → instance/

- NEW: ~/.claude/ → [SYMLINK <1ms] → ~/.ccs/shared/ → [SYMLINK] → instance/

Performance Improvements:

- Install time: 500ms → 100ms (60% faster)

- Symlink creation: <1ms per directory (500x faster than copy)

- Zero data duplication between profiles

- Live updates: instant propagation across all profiles

Implementation Changes:

- bin/shared-manager.js: Added circular symlink detection, v3.1.1→v3.2.0 migration

- installers/install.sh: Replaced copy logic with symlink creation

- installers/install.ps1: Replaced copy logic with symlink creation + Developer Mode check

- scripts/postinstall.js: Updated to call migrateFromV311()

- tests/: Added symlink chain validation tests (bash + PowerShell)

Migration:

- Automatic upgrade from v3.1.1

- User customizations preserved in ~/.claude/

- No manual action required

Testing:

- All integration tests passed (6/6)

- Symlink chain validated on Linux

- Migration with data preservation validated

- Windows fallback logic preserved for non-Developer Mode
2025-11-10 21:57:44 -05:00
kaitranntt 70471af1f8 fix(migration): run migration during install, not on first execution (v3.1.1)
Fixed:

- Migration now runs during installation across all methods (npm, bash, PowerShell)

- Guarantees ~/.ccs/shared/ populated immediately with ~/.claude/ content

- Users no longer need to run ccs command to trigger migration

Changed:

- Refactored SharedManager with _needsMigration() and _performMigration() methods

- _copyDirectory() returns {copied, skipped} stats and preserves existing files

- Shows detailed migration output: '[OK] Migrated 5 commands, 19 skills'

- Removed lazy migration from bin/ccs.js, lib/ccs, lib/ccs.ps1

Implementation:

- npm: Migration in scripts/postinstall.js

- bash: Migration in installers/install.sh (migrate_shared_data function)

- PowerShell: Migration in installers/install.ps1 (Invoke-SharedDataMigration)

- Fixed arithmetic expansion with set -e (changed ((var++)) to var=$((var + 1)))

Cross-platform parity maintained across all installation methods.
2025-11-10 21:05:55 -05:00
kaitranntt d925dfc169 feat(shared): implement shared data architecture (v3.1.0)
Phase 1: Multi-profile shared data via symlinks

Added:

- SharedManager class for symlink orchestration (bin/shared-manager.js)

- Auto-migration from ~/.claude/ to ~/.ccs/shared/ on first run

- Shared directories: commands/, skills/, agents/

- Windows fallback: copies dirs if symlinks fail

Fixed:

- Migration logic now detects empty directories

- Previously skipped migration when postinstall created empty dirs

- Now properly copies from ~/.claude/ when shared dirs are empty

Changed:

- Instance initialization symlinks to shared dirs instead of copying

- Postinstall creates ~/.ccs/shared/ structure automatically

- All implementations (Node.js, bash, PowerShell) updated for consistency

- Help text includes agents/ in shared data section

Technical:

- Profile-specific data remains isolated (settings, sessions, todolists, logs)

- Migration is idempotent: safe to run multiple times

- Cross-platform symlink support with graceful fallback

Closes #4
2025-11-10 20:45:21 -05:00
kaitranntt df549ddf4b docs: add changelog entries for v3.0.0, v3.0.1, and v3.0.2 2025-11-10 18:07:48 -05:00
kaitranntt 5428773e3d fix: improve default profile behavior and simplify help text (v3.0.2)
This release fixes default profile behavior and streamlines help output.

Breaking Changes:
- Profile creation NO LONGER auto-sets as default
- Users must explicitly run `ccs auth default <profile>` to set default
- Without explicit default, `ccs` uses implicit default from ~/.claude/

Auth Default Behavior:
- Removed auto-set default logic in profile-registry.js
- Removed auto-set default in bash register_profile() function
- Removed auto-set default in PowerShell Register-Profile function
- Implicit 'default' profile always exists (uses ~/.claude/)
- Enhanced success messages guide users to set explicit default
- Updated auth help with examples and note about default behavior

Help Text Simplification:
- Removed lengthy Examples section from main help (~40% shorter)
- Condensed Account Management section to `ccs auth --help`
- Kept detailed examples in `ccs auth --help` where relevant
- Consistent across npm, bash, and PowerShell implementations

Files Changed:
- bin/profile-registry.js: Removed auto-default logic
- bin/auth-commands.js: Updated help and success messages
- bin/ccs.js: Simplified main help text
- lib/ccs: Fixed bash implementation + simplified help
- lib/ccs.ps1: Fixed PowerShell implementation + simplified help
- VERSION, package.json, installers/*: Version bump to 3.0.2

Fixes #TBD
2025-11-10 18:05:49 -05:00
kaitranntt f65b87c123 feat: implement v3.0.1 - fix silent postinstall failures with auto-recovery
- Add auto-recovery mechanisms for missing/corrupted configuration files
- Implement comprehensive health check command (`ccs doctor`)
- Enhance error messages with context-aware diagnostics and recovery commands
- Fix silent postinstall failures - now exits with proper error codes
- Add RecoveryManager class for automatic config restoration
- Add ErrorManager class for structured, helpful error messages
- Update postinstall script to validate created files and auto-create ~/.claude/settings.json
- Add doctor command support to bash and npm implementations
- Implement atomic file operations to prevent corruption
- Add comprehensive testing scenarios and validation

Fixes critical issue where npm install succeeded but CCS failed on first run.
Enhances user experience with automatic recovery and clear error guidance.

BREAKING CHANGE: Postinstall now exits with error code 1 on critical failures
2025-11-10 17:39:17 -05:00
Tam Nhu (Kai) TranandGitHub f034c25a61 feat: implement native multi-account switching with isolated instances (#3)
* feat: implement native multi-account switching with isolated instances

Add account-based profile management system that enables users to run
multiple Claude accounts concurrently with complete isolation.

Key features:
- Profile registry (~/.ccs/profiles.json) tracks account profiles
- Instance isolation (~/.ccs/instances/<profile>/) for each account
- Auth commands: create, list, show, remove, default
- Backward compatible with settings-based profiles (GLM, Kimi)
- Auto-copies global .claude configs to new instances

Implementation:
- Phase 1: Profile detection logic (account vs settings-based)
- Phase 2: Instance management (initialization, validation)
- Phase 3: Auth CLI commands
- Phase 4: Profile registry CRUD operations
- Phase 5: Execution routing based on profile type

Both lib/ccs (bash) and lib/ccs.ps1 (PowerShell) updated for
cross-platform support.

* fix(ci): add pull_request trigger to satisfy branch protection

The branch protection rule requires "Deploy ccs-installer to CloudFlare"
status check to pass, but the workflow only ran on push to main branch.
This caused PRs to wait indefinitely for a status that never reported.

Changes:
- Add pull_request trigger with same path filters
- Split deployment into conditional steps:
  - PR mode: dry-run validation only (--dry-run flag)
  - Production: actual deployment (push to main only)
- Keeps same job name to satisfy branch protection requirement

Security:
- No deployment from PR branches (dry-run only)
- Production deploy only when push to main AND ref check
- Secrets used safely in both contexts

This fixes PR #3 which was stuck waiting for status.

* fix(ci): remove path filter from pull_request trigger

The path filter prevented workflow from running on PRs that don't
modify worker/installer files, causing required status check to
never report. This blocked PR #3 indefinitely.

Changes:
- Remove paths filter from pull_request trigger
- Keep paths filter on push to main (optimize deployments)
- Workflow now runs on ALL PRs to satisfy branch protection

Trade-off:
- PRs changing non-worker files will trigger unnecessary dry-run
- But this ensures required status check always reports
- Small cost for reliability and simpler configuration

Alternatives considered:
- Path-aware required checks: Not supported by GitHub
- Remove required check: Loses CI validation
- Add all paths to filter: Makes config brittle
2025-11-09 18:26:49 -05:00
kaitranntt 9aa2f96e6a docs(contributing): update guide for v3.0 and npm package 2025-11-09 17:19:16 -05:00
kaitranntt 96701a4992 docs: streamline READMEs and update project documentation
- Streamline Features section (65% shorter, bullet points only)
- Remove redundant 'Why CCS' table column
- Fix 'Sub-Account' → 'Multiple Accounts' terminology
- Update tagline to highlight v3.0 multi-account capabilities
- Merge duplicate sections (Concurrent Sessions)
- Remove unrealistic usage examples
- Fix weird formatting and stray content
- Streamline Uninstall section with package managers grouped
- Create root-level CONTRIBUTING.md (GitHub standard)
- Remove duplicate docs/en/contributing.md and docs/vi/contributing.vi.md
- Update all README links to point to root CONTRIBUTING.md
- Refactor CLAUDE.md for v3.0 architecture
  - Update project overview to highlight multiple Claude accounts
  - Add v3.0 technical details (CLAUDE_CONFIG_DIR, profiles.json, instances/)
  - Remove redundant high-level flow (now in README)
  - Add Node.js code standards
  - Document two profile types (settings vs account-based)
  - Update testing requirements for v3.0

Total reduction: 46 lines across all READMEs
Cross-language consistency: EN/VI/JA fully synchronized
2025-11-09 17:11:58 -05:00
Tam Nhu (Kai) TranandGitHub 7c93cadf95 docs: add Japanese README, pull request #2 from eltociear/add-ja-doc 2025-11-09 15:01:09 -05:00
kaitranntt d61a2cf59f chore: bump version to 3.0.0 2025-11-09 05:44:43 -05:00
kaitranntt 00cc50428f Merge feat/switch-account: v3.0.0 simplification 2025-11-09 05:43:25 -05:00
kaitranntt 7b25d5d437 feat!: v3.0.0 simplification - login-per-profile model
BREAKING CHANGE: Remove vault/encryption, implement login-per-profile

- Remove vault-manager.js, credential-reader.js, credential-injector.js (~642 lines)
- Implement login-per-profile (no credential copying)
- Rename 'auth save' to 'auth create'
- Fix profile schema (remove vault/subscription/email fields)
- Remove macOS credential switcher (CLAUDE_CONFIG_DIR works everywhere)
- Auto-create missing instance directories
- Maintain GLM/Kimi backward compatibility (settings profiles)

Performance: 50-120ms faster (no decryption overhead)
Code reduction: ~600 lines deleted (40% simpler)

Migration required: Users must recreate profiles with 'ccs auth create'
2025-11-09 05:43:09 -05:00
Ikko Ashimine 014ec48fdd docs: add Japanese README 2025-11-09 16:29:43 +09:00
kaitranntt 5a0209e346 fix(kimi): add ANTHROPIC_SMALL_FAST_MODEL support
- Add ANTHROPIC_SMALL_FAST_MODEL to all Kimi configuration templates
- Update installation scripts (npm, Unix, Windows) to include SMALL_FAST_MODEL
- Ensure Kimi API configuration matches official documentation format
- Bump version to 2.5.1 with updated changelog

Files updated:
- config/base-kimi.settings.json: Add SMALL_FAST_MODEL
- installers/install.sh: Update Unix template creation
- installers/install.ps1: Update PowerShell template creation
- scripts/postinstall.js: Update npm postinstall script
- All version files: Bump to 2.5.1
2025-11-07 02:08:12 -05:00
kaitranntt 385572dc47 feat(kimi): add Kimi for Coding integration as third LLM provider
- Add kimi profile support alongside existing glm and default profiles
- Create base-kimi.settings.json configuration template
- Update all installation methods (npm, Unix, Windows) to auto-create Kimi settings
- Enhance documentation with Kimi examples and API setup instructions
- Update version to 2.5.0 with comprehensive changelog
- Add Kimi detection logic in install scripts for seamless migration
- Maintain backward compatibility with existing GLM and Claude profiles
2025-11-07 01:45:29 -05:00
kaitranntt be958e992d chore(docs): remove Vietnamese documentation and outdated development files 2025-11-06 07:01:20 -05:00
kaitranntt 50ecb0e46b fix: resolve DEP0190 warning with proper shell argument handling
Use string concatenation (not args array) when shell is needed to avoid
Node.js DEP0190 deprecation warning. Restores previous working approach
with conditional shell usage based on file extension.

Key changes:
- Added escapeShellArg() helper for proper argument escaping
- Conditional shell: only for .cmd/.bat/.ps1 files on Windows
- When shell needed: concatenate args into single escaped string
- When no shell: use array form (faster, no overhead)

Benefits:
- No deprecation warning
- Proper security (escaped arguments)
- Better performance (no shell on Unix or for .exe files)
- Matches previous stable implementation

Version: 2.4.9
2025-11-05 17:38:29 -05:00
kaitranntt 56295fee00 fix: remove Node.js DEP0190 deprecation warning
Use platform-specific shell option (Windows only) instead of shell: true
to avoid deprecation warning in Node.js v22.9.0+.

Changes:
- bin/ccs.js: Change shell: true to shell: process.platform === 'win32'
- CHANGELOG.md: Document fix for v2.4.8
- VERSION: Bump to 2.4.8
- package.json: Bump to 2.4.8

Benefits:
- No deprecation warning on Windows
- Better performance on Unix (no shell overhead)
- Maintains Windows .cmd/.bat compatibility
2025-11-05 17:20:47 -05:00
kaitranntt 9c88c9f66b fix: enable shell for Windows .cmd/.bat execution
Fixes EINVAL spawn error on Windows PowerShell by adding shell: true
to spawn options. Cross-platform compatible (Windows/macOS/Linux).

Changes:
- bin/ccs.js: Add shell: true to execClaude spawn options
- CHANGELOG.md: Document fix for v2.4.7
- VERSION: Bump to 2.4.7
- package.json: Bump to 2.4.7
- installers: Update version references

Security: No injection risk (array-based args, controlled inputs)
Performance: Negligible overhead (~10-20ms)
2025-11-05 17:16:29 -05:00
kaitranntt 2b35bf419f chore: release v2.4.6 with improved npm compatibility and fixes
- fix color detection for cross-platform TTY compatibility
- enhance help command with npm-specific content and npx examples
- remove --install/--uninstall flags pending .claude/ integration testing
- update version across all files and documentation
- preserve implementation code for future release readiness
2025-11-05 16:51:30 -05:00
kaitranntt 966a43f0f9 chore: release v2.4.5 with comprehensive testing and documentation updates 2025-11-05 16:10:03 -05:00
kaitranntt 7e2ee14f6f ci(npm): fix github release parameter name 2025-11-05 11:35:29 -05:00
kaitranntt c32c23e5ed feat: add npm postinstall config creation and restructure test suite
Configuration Management:
- Add npm postinstall script to auto-create ~/.ccs/ directory and config files
- Create config.json with default profile mappings (glm, default)
- Create glm.settings.json template with GLM API configuration
- Ensure idempotent postinstall behavior (safe to run multiple times)
- Fix config-manager.js to handle missing config.json gracefully

Test Suite Restructure:
- Reorganize tests by installation method (native vs npm)
- Move 37 native Unix tests to tests/native/unix/
- Move Windows tests to tests/native/windows/
- Move 39 npm package tests to tests/npm/
- Move shared utilities to tests/shared/
- Add comprehensive test documentation and README
- Implement master orchestrators for backward compatibility
- Increase test coverage from 41 to 83+ tests (100% increase)
- Add mocha framework for npm tests with better assertions

New Test Commands:
- npm run test:npm (npm package tests only)
- npm run test:native (native tests only)
- npm run test:unit (unit tests only)
- npm run test:all (all tests)

Backward Compatibility:
- npm test (runs all tests)
- bash tests/edge-cases.sh (master orchestrator)
- All existing workflows unchanged

Version: 2.4.4
2025-11-05 11:26:01 -05:00
kaitranntt f8e9bb6cfc feat: restructure test suite by installation method
BREAKING CHANGE: Reorganize tests into native/ and npm/ directories

- Move 37 native Unix tests to tests/native/unix/
- Move Windows tests to tests/native/windows/
- Move 39 npm package tests to tests/npm/
- Move shared utilities to tests/shared/
- Add comprehensive test documentation
- Implement master orchestrators for backward compatibility
- Increase test coverage from 41 to 83+ tests (100% increase)
- Add mocha framework for npm tests
- Clean up old test files and directory structure

New test commands:
- npm run test:npm (npm package tests only)
- npm run test:native (native tests only)
- npm run test:unit (unit tests only)
- npm run test:all (all tests)

Backward compatibility maintained:
- npm test (runs all tests)
- bash tests/edge-cases.sh (master orchestrator)
- All existing workflows unchanged
2025-11-05 11:19:46 -05:00
kaitranntt af415af54c fix: finalize CCS test restructure implementation
- Update .gitignore to exclude node_modules and include Node.js patterns
  - Update package.json with final test scripts and structure
  - Complete test restructure: 83 tests across native, npm, and unit suites
  - All tests passing with 100% success rate
  - Backward compatibility maintained
2025-11-05 11:16:16 -05:00
kaitranntt a03b7307aa docs: update tests README.md with final structure
- Document final test organization with accurate test counts
- Update to reflect integration tests moved to npm/ directory
- Include detailed file listings and test counts
- Clarify backward compatibility and migration benefits
- Final counts: 37 native + 39 npm + 7 unit = 83 total tests
2025-11-05 11:16:16 -05:00