Commit Graph
21 Commits
Author SHA1 Message Date
kaitranntt 13d13dab51 fix(auth): prevent default profile from using stale glm env vars
Issue #37: When running `ccs` (default profile), users were unknowingly
using GLM API instead of their Claude subscription because:

1. config.json had `default: '~/.claude/settings.json'` entry
2. ProfileDetector treated this as settings-based profile
3. CCS passed `--settings ~/.claude/settings.json` flag to Claude
4. Any stale ANTHROPIC_* env vars in that file got applied

Fix (3-pronged approach):
- Remove `default` entry from new config.json template
- Add migration to remove existing `default: ~/.claude/settings.json`
- Add ProfileDetector safety net: if default points to ~/.claude/settings.json,
  treat as pass-through to Claude's native auth (no --settings flag)

Now `ccs` (no profile) correctly uses Claude's native OAuth authentication
without loading potentially polluted env vars from previous sessions.

Closes #37
2025-12-02 15:55:10 -05:00
kaitranntt e54d401656 feat(cliproxy): refactor config loading and enhance base settings support
- Introduce `BaseConfigLoader` for centralized configuration management
- Add `base-agy.settings.json` configuration
- Refactor `ConfigGenerator` to utilize new loading patterns
- Update help command with improved documentation
- Clean up lint violations file
- Enhance postinstall script
2025-11-28 20:43:11 -05:00
kaitranntt 49150dc24f fix(tests): isolate tests from user ~/.ccs directory
Problem: Test suite was directly modifying user's personal ~/.ccs/
directory, causing configuration interference during development.

Solution:
- Add test-environment.js fixture with CCS_HOME env var support
- Update postinstall.js to respect CCS_HOME for test isolation
- Update config-manager.ts with getCcsHome() helper
- Update postinstall.test.js and cli.test.js to use isolated env
- Remove auto-install of .claude/ symlinks from postinstall
  (users can run "ccs sync" to opt-in)

Benefits:
- Tests run in temp directories, no user config affected
- Users control when .claude/ items are installed via "ccs sync"
- All 39 tests passing with proper isolation
2025-11-26 20:25:35 -05:00
kaitranntt 1c3c4aade0 chore: complete TypeScript migration (Phase 05-06)
Phase 05: Migrate test imports from bin/ to dist/
- Update 19 test files to import from dist/ instead of bin/
- Update CLI path in cli.test.js and special-commands.test.js
- Update cross-platform.test.js to check dist/ directory

Phase 06: Cleanup & validation
- Remove bin/ directory (32 JS files)
- Fix ClaudeSymlinkManager import in doctor.ts
- Update postinstall.js to use dist/ modules
- Regenerate package-lock.json (now points to dist/ccs.js)

All 39 tests passing. TypeScript migration complete.
2025-11-26 20:20:54 -05:00
kaitranntt 739895a29e feat(config): introduce shared settings.json across profiles 2025-11-23 20:31:39 -05:00
Kai (Tam Nhu) TranandGitHub e2e432837e feat: add plugin support to shared directories (v4.3.6) (#15)
* feat(shared): add plugin support to shared directories

Add Claude Code plugins to the .ccs/shared/ symlink architecture,
enabling plugin sharing across all CCS profiles (GLM, GLMT, Kimi, etc).

Changes:
- SharedManager: Add 'plugins' to sharedDirs array
- Help text: Update all three implementations (Node.js, bash, PowerShell)
- Postinstall: Create ~/.ccs/shared/plugins/ directory on install

Architecture:
~/.claude/plugins/ <- ~/.ccs/shared/plugins/ <- instance/plugins/

This follows the existing pattern for commands/skills/agents and
maintains cross-platform compatibility with Windows fallback support.

* chore: bump version to 4.3.6

* docs: update CHANGELOG for v4.3.6
2025-11-22 19:27:04 -05:00
kaitranntt ebb33b7843 feat(installer): add deprecated agent cleanup logic 2025-11-22 13:24:13 -05:00
kaitranntt 31a21d13ad fix(sync): update 'ccs update' references to 'ccs sync' across codebase 2025-11-18 01:19:28 -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
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 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 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 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
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 64925d57ca checkpoint: before test restructure migration 2025-11-05 10:16:18 -05:00