Commit Graph
80 Commits
Author SHA1 Message Date
Tam Nhu Tran 6c7d215ecc feat(websearch): add real provider chain 2026-03-23 15:26:05 -04:00
Kai (Tam Nhu) TranandGitHub 3c7b352656 Merge pull request #680 from 0xble/fix/image-analyzer-thinking-blocks
fix(hooks): handle thinking blocks in image analyzer response parsing
2026-03-07 02:58:39 -05:00
Tam Nhu Tran 50973752ba test(hooks): add image analyzer regression coverage 2026-03-07 14:50:39 +07:00
Tam Nhu Tran 2be5c5a706 fix: sync error code docs links 2026-03-07 09:56:35 +07:00
Brian Le 0060c77c25 fix(hooks): handle thinking blocks in image analyzer response parsing
When models have thinking enabled (e.g. codex with thinking: auto), the
API returns content as [{ type: 'thinking', thinking: '...' }, { type:
'text', text: '...' }]. The hook reads content[0].text which is
undefined for thinking blocks, causing 'No text content in response'
errors that block the Read tool (exit 2).

Also fix cross-provider model fallback: getModelsToTry() unconditionally
appends DEFAULT_MODEL (gemini-2.5-flash) as retry, which 502s on
non-gemini provider routes (e.g. codex). Only use DEFAULT_MODEL when no
provider-specific model is configured.

Fixes: content[0].text -> content.find(b => b.type === 'text')
Fixes: cross-provider retry causing 'unknown provider' 502
Ref: #511
2026-03-04 00:29:17 -05:00
Tam Nhu Tran 0d09604bb9 fix(websearch): support Gemini positional prompt mode 2026-02-26 22:12:16 +07:00
Kai (Tam Nhu) TranGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
051805074e feat: account safety, quota monitoring, and stability fixes (#530)
* fix(cliproxy): migrate deprecated gemini-claude-* model names to upstream claude-* names (#515)

* fix(cliproxy): migrate deprecated gemini-claude-* model names to upstream claude-* names

CLIProxyAPI registry no longer recognizes the gemini-claude-* prefix convention.
Model names in catalog, base config, and user settings are migrated to upstream
claude-* names. Auto-migration in env-builder rewrites existing user settings on
load and persists the change.

Closes #513

* fix: address code review feedback — sync UI layer and add migration tests

- Sync UI isNativeGeminiModel() with backend (remove gemini-claude- exclusion)
- Update UI model catalog agy entries from gemini-claude-* to claude-*
- Update CI/CD workflow and code-reviewer default model names
- Add unit tests for migrateDeprecatedModelNames() logic

* fix(hooks): isolate image type check before error-prone processing (#514)

* fix(hooks): isolate image type check before error-prone processing

Restructure processHook() into two phases so non-image Read calls
never see hook error messages. Phase 1 defensively checks tool name
and file extension, exiting 0 silently on any failure. Phase 2 only
runs for confirmed image/PDF files where errors are relevant.

Closes #511

* fix(hooks): sync image analyzer hook file on every profile launch

Add installImageAnalyzerHook() call to cliproxy executor, matching
the existing installWebSearchHook() pattern. This ensures the .cjs
file in ~/.ccs/hooks/ gets refreshed from the npm package on every
launch, so users receive hook updates after npm update.

* chore(release): 7.41.0-dev.1 [skip ci]

* fix(cliproxy): add fork:true for Claude model aliases in config generator (#523)

Config generator now outputs fork:true for Claude model alias entries,
ensuring both upstream (claude-*) and aliased (gemini-claude-*) model
names appear in /v1/models listings. Also preserves fork flag when
parsing user-added aliases during config regeneration.

Bumps config version to v7 to trigger regeneration on next ccs doctor.

Closes #522

* chore(release): 7.41.0-dev.2 [skip ci]

* feat(cliproxy): add account safety guards to prevent Google account bans (#516)

* feat(cliproxy): add account safety guards to prevent Google account bans

Implements cross-provider isolation to prevent Google from flagging
concurrent OAuth usage across different client IDs (ref: #509, #512).

Three pillars:
1. Auto-pause enforcement at session launch — conflicting accounts in
   other Google OAuth providers are paused so CLIProxyAPI can't use them,
   restored on session exit with crash recovery via auto-paused.json
2. Ban/disable detection — error responses matching Google ban patterns
   auto-pause the affected account to prevent further damage
3. Cross-provider conflict warnings during OAuth registration

Key design decisions:
- PID-based session tracking for crash recovery (dead PID = restore)
- Timestamp comparison prevents restoring ban-paused accounts on exit
- Schema validation on auto-paused.json prevents corrupted state
- Falls back to warn-only when another session is managing isolation

* fix(cliproxy): address code review feedback (attempt 1/5)

- Re-read auto-paused.json before write in enforceProviderIsolation to
  reduce concurrent write race window
- Use actual email from registry for display instead of raw accountId
- Export maskEmail for testability
- Add 27 unit tests covering ban detection, email masking,
  cross-provider duplicate detection, enforcement lifecycle,
  crash recovery, and timestamp-guarded restore

* fix(cliproxy): address remaining review feedback (attempt 2/5)

- Add handleBanDetection test verifying account pause on ban error
- Add warnCrossProviderDuplicates tests (true/false/non-Google)
- Document PID reuse limitation in isPidAlive JSDoc comment

* chore(release): 7.41.0-dev.3 [skip ci]

* feat(cliproxy): runtime quota monitoring during active sessions (#529)

* feat(cliproxy): add runtime quota monitoring during active sessions

Adds adaptive background quota polling to detect and respond to quota
exhaustion during active CLIProxy sessions. Prevents rate-limit-driven
account bans by auto-cooling exhausted accounts and switching defaults.

- Adaptive polling: 300s normal, 60s at 20% threshold, stops at 0%
- Stderr warnings at 20%, boxed exhaustion alerts at 0%
- Cooldown + default switch on exhaustion (existing patterns)
- Configurable via quota_management.runtime_monitor in config.yaml
- Timer.unref() prevents blocking process exit
- monitorStopped guard for in-flight poll safety

Closes #524

* fix: address code review feedback (attempt 1/5)

- M1: Round quotaPercent display with Math.round() to avoid ugly floats
- M2: Rename exhaust_threshold -> exhaustion_threshold for consistency
  with existing auto.exhaustion_threshold config field
- M3: Replace async not.toThrow() with direct await assertion pattern

* fix: address code review feedback (attempt 2/5)

- Remove .claude/agent-memory/ from tracking and add to .gitignore
- Unify cooldown_minutes default to 5 (was 10 in runtime_monitor, 5 in auto)
- Add threshold validation in startQuotaMonitor (warn > exhaustion)
- Document intentional post-switch monitoring gap in code comment

* chore(release): 7.41.0-dev.4 [skip ci]

* fix(cliproxy): mask email in ban detection and fix JSDoc default

- Use maskEmail() in handleBanDetection output for consistency
- Fix cooldown_minutes JSDoc: default is 5, not 10

* chore(release): 7.41.0-dev.5 [skip ci]

* fix(cliproxy): address all review feedback (Low + informational)

- Add sync constraint comment on process.exit handler (executor)
- Add TOCTOU race acceptability comment (account-safety)
- Mask email in handleQuotaExhaustion reason string
- Use realistic exhaustion_threshold (5) in test configs

* chore(release): 7.41.0-dev.6 [skip ci]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-02-12 00:48:29 +07:00
kaitranntt 1201b4bb4b fix(hooks): add network errors to noRetryPatterns, update E2E test
- Add ENOTFOUND, ENETUNREACH, EAI_AGAIN to noRetryPatterns to prevent
  infinite retries on network errors
- Update E2E test to expect exit code 2 (block) when CLIProxy unavailable
- Fix debug message expectation in test
2026-02-04 00:59:10 -05:00
kaitranntt 51b719ef34 refactor(hooks): deprecate block-image-read, add CLIProxy fallback
- Remove redundant block-image-read.cjs hook (image-analyzer handles all)
- Add fallback blocking when CLIProxy unavailable (prevents context overflow)
- Simplify fallback message to prevent context pollution/hallucination
- Remove image-read-block-hook-env.ts and related exports
- Update comments per PR #442 review suggestions
- Add defensive check for empty models array

Closes #426
2026-02-04 00:49:52 -05:00
kaitranntt ae3eb282b4 feat(hooks): add ANTHROPIC_MODEL fallback for image analysis
Model resolution priority:
1. provider_models[current_provider]
2. ANTHROPIC_MODEL from profile settings
3. DEFAULT_MODEL (gemini-2.5-flash)

Allows users to override vision model via profile's ANTHROPIC_MODEL.
2026-02-04 00:19:51 -05:00
kaitranntt cb8de2c8e8 fix(hooks): improve error handling and edge cases for image analysis
- Add empty model string validation in config command

- Add --enable/--disable conflict detection

- Truncate long model names in display (>40 chars)

- Add EACCES/EPERM file permission error handler

- Add filesystem error classification (ENOSPC, EROFS)

- Log config upgrade save failures instead of silent catch
2026-02-03 22:32:49 -05:00
kaitranntt 2b0717ed53 feat(hooks): add UX improvements for image analysis hook
Add comprehensive UX enhancements for the image analysis CLIProxy hook:

- Add `ccs config image-analysis` CLI command for managing settings
  - Enable/disable toggle
  - Timeout configuration (10-600s)
  - Per-provider model configuration
  - Status display with provider models

- Add specialized error handlers with actionable messages
  - File too large (with compression hints)
  - CLIProxy unavailable (with start instructions)
  - Auth failure (with re-auth commands)
  - Timeout (with increase timeout hint)
  - Rate limit (with retry guidance)
  - API error (with response body parsing)

- Add comprehensive debug output (CCS_DEBUG=1)
  - Provider name and model
  - File size and media type
  - Timeout and endpoint
  - Skip reasons with context

- Add help text updates
  - `ccs --help` includes Image Analysis section
  - `ccs config --help` lists image-analysis subcommand

- Add doctor integration
  - Validates image_analysis config
  - Checks enabled status, providers, timeout
  - Warns if CLIProxy not running

- Add unit tests for new config command
2026-02-03 22:14:52 -05:00
kaitranntt 0e7b9c9190 fix(hooks): add edge case validation in image analyzer
- Empty model validation: check `model.trim()` before using
- 10MB boundary: use `>=` instead of `>` for consistent messaging
- Timeout clamping: ensure timeout is between 1-600 seconds
- Response stream error: add error handler for network failures
- Empty response validation: check before JSON.parse to prevent crashes
2026-02-03 21:44:44 -05:00
kaitranntt 40caff13ad refactor(hooks): use provider_models mapping for image analysis
Changes ImageAnalysisConfig from providers array to provider_models
mapping for granular vision model control per CLIProxy provider.

Breaking change: config.yaml image_analysis section now uses
provider_models instead of providers/model fields.

Provider-to-model mappings:
- agy → gemini-2.5-flash
- gemini → gemini-2.5-flash
- codex → gpt-5.1-codex-mini
- kiro → kiro-claude-haiku-4-5
- ghcp → claude-haiku-4.5
- claude → claude-haiku-4-5-20251001

Hook checks CCS_CURRENT_PROVIDER against provider_models and skips
if no vision model configured for that provider.
2026-02-03 21:32:19 -05:00
kaitranntt 70caaa00a0 fix(hooks): improve image analysis output format
Match websearch transformer format:
- Header: [Image Analysis via CLIProxy]
- Metadata: File name, size in KB, model used
- Separator lines for better readability
- Footer instruction for Claude
2026-02-03 20:58:05 -05:00
kaitranntt d5f2acaa6e feat(hooks): add image/PDF analysis via CLIProxy transformer
Intercept Read tool calls for image/PDF files and route through CLIProxy
with gemini-2.5-flash for vision analysis. Returns text descriptions
instead of blocking, enabling Claude to "see" images via proxy.

Key changes:
- Add image-analyzer-transformer.cjs hook script
- Add ImageAnalysisConfig type and loader
- Add hook installer and profile injector
- Add prompt templates for analysis customization
- Add e2e test suite (excluded from normal CI runs)
- Configure test:e2e script for manual testing

Environment variables:
- CCS_IMAGE_ANALYSIS_ENABLED: Enable/disable (default: 1)
- CCS_IMAGE_ANALYSIS_MODEL: Vision model (default: gemini-2.5-flash)
- CCS_IMAGE_ANALYSIS_TIMEOUT: Timeout in seconds (default: 60)
- CCS_CLIPROXY_API_KEY: API key for CLIProxy auth
- CCS_CLIPROXY_PORT: CLIProxy port (default: 8317)

Closes #426
2026-02-03 20:34:05 -05:00
kaitranntt 9f3edc5daf fix(hooks): enable image-read blocking by default for third-party profiles
Match WebSearch hook pattern:
- ENABLED by default for settings/cliproxy profiles
- DISABLED for native Claude accounts (account/default)
- User can override via config: hooks.block_image_read.enabled: false

This ensures CCS CLI users get context protection out-of-the-box
while native Claude subscription users are unaffected.
2026-02-02 19:00:46 -05:00
kaitranntt 38eb74043c feat(hooks): add block-image-read hook to prevent context overflow
Add PreToolUse hook that intercepts Read tool calls on image files
(.png, .jpg, .webp, etc.) and blocks them with helpful message.

This prevents context exhaustion when image generation skills
produce multiple files and the agent tries to read them (each
image can consume 100K+ tokens).

Configuration:
- Enable via config.yaml: hooks.block_image_read.enabled: true
- Or env var: CCS_BLOCK_IMAGE_READ=1

Hook integration:
- lib/hooks/block-image-read.cjs - the hook script
- src/utils/hooks/image-read-block-hook-env.ts - config loader
- Integrated into all spawn locations (ccs.ts, shell-executor,
  cliproxy-executor)

Closes #426
2026-02-02 17:28:21 -05:00
ruan-catandCursor 3c534f48cb fix(websearch): add shell option for Windows spawnSync compatibility
On Windows, globally installed CLI tools via npm/pnpm are .cmd/.bat
batch files, not real .exe executables. Node.js spawnSync() without
the shell option cannot execute these files and returns ENOENT error.

Changes:
- Extract isWindows as a global constant at file top
- Add shell: isWindows to all CLI execution spawnSync calls
- Remove duplicate isWindows declaration in isCliAvailable()

Fixes #378

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-28 02:45:22 +08:00
kaitranntt e03d9b7743 fix(websearch): use 'where' command on Windows for CLI detection
Fixes #273

The websearch-transformer hook used hardcoded 'which' command which doesn't
exist on Windows. Now uses process.platform detection to choose 'where' on
Windows and 'which' on Unix systems.
2026-01-05 12:38:01 -05:00
kaitranntt 98c21efb5a fix(websearch): detect Gemini CLI auth status before showing Ready
Previously, WebSearch status showed "Ready (Gemini)" when the CLI binary
was installed, misleading users who hadn't authenticated yet.

Changes:
- Add isGeminiAuthenticated() to check ~/.gemini/oauth_creds.json
- Add 'needs_auth' state to WebSearchReadiness type
- Show warning "[!] Gemini: run 'gemini' to login" when not authenticated
- Fix incorrect 'gemini auth login' references (no such command exists)
- Update docs with correct npm install and authentication instructions
2025-12-18 03:24:59 -05:00
kaitranntt 6bd1f420d9 fix(websearch): pass through to native WebSearch for account profiles
WebSearch hook was blocking native Claude accounts (ccs ck, default)
with "No Providers Enabled" message instead of passing through to
server-side WebSearch.

Changes:
- Add shouldSkipHook() detection for account/default profile types
- Fix blocking bug: exit(0) when no providers enabled instead of blocking
- Pass CCS_PROFILE_TYPE and CCS_WEBSEARCH_SKIP env vars for profile-aware behavior
- Add profile type signals to settings, cliproxy, account, and default execution paths
2025-12-18 00:27:40 -05:00
kaitranntt 14c53d575f feat(websearch): add model config + improve hook UX
- Add model field to Gemini/OpenCode WebSearch providers
- Config.yaml now explicitly stores model (gemini-2.5-flash, opencode/grok-code)
- UI: blur-to-save for model inputs (no save on every keystroke)
- UI: collapsible install hints inside provider cards
- UI: left accent border for enabled providers (better light theme contrast)
- Hook: use systemMessage for info-styled confirmation
- Hook: cleaner result format without defensive "NOT an error" language
2025-12-17 00:16:03 -05:00
kaitranntt d33fefd133 feat(websearch): dynamic hook timeout from config + grok-code default
- Hook timeout now computed from max provider timeout + 30s buffer
- Removes hardcoded HOOK_TIMEOUT_SECONDS constant
- ensureHookConfig() now updates timeout when it changes
- Default OpenCode model changed from gpt-5-nano to grok-code
- Default OpenCode timeout changed from 60s to 90s
- Single source of truth: config.yaml controls all timeouts
2025-12-16 23:07:11 -05:00
kaitranntt cbc2022ed1 refactor(websearch): consolidate prompts with shared instructions + provider overrides
- Add SHARED_INSTRUCTIONS constant with 7 quality guidelines applied to ALL providers
- Refactor PROVIDER_CONFIG to use toolInstruction (provider-specific) and quirks (optional)
- Add buildPrompt() function to combine shared + provider-specific instructions
- Gemini: google_web_search tool instruction
- OpenCode: built-in capabilities instruction
- Grok: web search + X/Twitter quirk for real-time events

DRY improvement: shared guidelines now maintained in one place
2025-12-16 22:47:53 -05:00
kaitranntt e71cb6227c feat(websearch): respect config provider settings and consolidate prompts
Major refactor of WebSearch hook to:

1. **Respect config.yaml settings**: Hook now reads CCS_WEBSEARCH_GEMINI,
   CCS_WEBSEARCH_OPENCODE, CCS_WEBSEARCH_GROK env vars to determine which
   providers to use. Only enabled AND installed providers are tried.

2. **Consolidate prompts/models**: Added PROVIDER_CONFIG section at top of
   hook file for easy prompt engineering:
   - gemini: model + prompt template
   - opencode: model (overridable via env) + prompt template
   - grok: model + prompt template

3. **Pass provider states via env**: Updated getWebSearchHookEnv() to pass
   individual provider enabled states as env vars.

Breaking change: Hook no longer falls back to all installed CLIs. It now
strictly respects config.yaml settings.
2025-12-16 22:30:37 -05:00
kaitranntt e6aa8ac453 feat(websearch): implement fallback chain for CLI providers
Add automatic fallback chain (Gemini -> OpenCode -> Grok) when multiple
WebSearch CLI providers are available. The hook now tries each provider
in order until one succeeds.

Changes:
- Update websearch-transformer.cjs with tryOpenCodeSearch() and tryGrokSearch()
- Implement fallback chain logic in processHook()
- Add outputAllFailedMessage() for when all providers fail
- Update outputNoToolsMessage() with all three install options
- Update config.yaml comments to document OpenCode and fallback behavior
2025-12-16 21:42:49 -05:00
kaitranntt c0938e1c82 feat(websearch): add Grok CLI support and improve install guidance
- Add Grok CLI detection (grok-4-cli by lalomorales22) alongside Gemini CLI
- Add WebSearch health check group to health-service.ts
- Update settings UI to show both Gemini and Grok CLI providers
- Add detailed install hints when no WebSearch CLI is installed
- Update API routes to return grokCli status
- Both CLI and dashboard users now see clear installation guidance

Providers:
- Gemini CLI: FREE tier (1000 req/day), no API key needed
- Grok CLI: Requires xAI API key (XAI_API_KEY), web + X search
2025-12-16 21:00:35 -05:00
kaitranntt f7a1a40b42 feat(websearch): enhance Gemini CLI integration, package manager detection, and WebSearch status
- Improve Gemini CLI integration in websearch hook: use gemini-2.5-flash & --yolo.
- Update `dev-install.sh` for better package manager (npm/bun) auto-detection.
- Introduce `displayWebSearchStatus` for improved user experience.
- Refactor `mcp-manager.ts` to track CCS-managed MCP servers.
2025-12-16 04:18:40 -05:00
kaitranntt fd99ebca98 feat(websearch): add MCP fallback and Gemini CLI hook for third-party profiles
- Add Gemini CLI transformer hook (websearch-gemini-transformer.cjs)
- Implement MCP auto-configuration with web-search-prime, brave, tavily fallback
- Add installWebSearchHook() to activate hook on profile launch
- Update settings.tsx to clarify web-search-prime requires z.ai subscription
- Add WebSearch config types and loader support
- Create implementation plan for WebSearch UX enhancement (startup status, dashboard)

Third-party profiles (gemini, agy, codex, qwen, glm, kimi) now have WebSearch
capability via Gemini CLI primary + MCP fallback chain.
2025-12-16 02:49:07 -05:00
kaitranntt 071ec041ed feat(websearch): add multi-tier MCP fallback for third-party profiles
Implements CCS WebSearch Native Infrastructure (Phases 1-3):

Phase 1 - Multi-tier MCP Fallback:
- Add mcp-manager.ts with ensureMcpWebSearch() for auto-configuration
- Support web-search-prime (primary), Brave Search, and Tavily MCPs
- Case-insensitive detection of existing web search MCPs
- Block-websearch hook for optional native WebSearch blocking

Phase 2 - User Configuration:
- Add WebSearchConfig interface to unified-config-types.ts
- Add getWebSearchConfig() to unified-config-loader.ts
- Support configurable webSearchPrimeUrl for security
- Add GET/PUT /api/websearch endpoints in routes.ts
- Add WebSearch settings UI in settings.tsx dashboard

Phase 3 - Documentation & Testing:
- Add WebSearch section to README.md
- Create comprehensive docs/websearch.md guide
- Add 23 unit tests for MCP manager logic

Enables web search for gemini, codex, agy, qwen, glm, kimi profiles
that cannot access Anthropic's native WebSearch API.
2025-12-16 00:42:13 -05:00
kaitranntt 046a37b2a9 feat: implement bootstrap conversion and installer updates (Phase 1-3)
Phase 1 - Bootstrap Scripts:
- Convert lib/ccs to 32-line bootstrap (was 1919 lines)
- Convert lib/ccs.ps1 to 39-line bootstrap (was 1826 lines)
- Delegate all functionality to Node.js via npx

Phase 2 - Help Text Updates:
- Add Requirements section to Node.js help (lines 172-175)
- Bootstrap scripts delegate --help to npx

Phase 3 - Installer Updates:
- Add Node.js 14+ detection with clear warning messages
- Remove deprecated shell deps (bootstrap handles all)
- Update completion messages with Requirements/First Run sections
- Update docs with new architecture

Total code reduction: 3745 → 71 lines (98.1%)
2025-11-27 10:24:37 -05:00
kaitranntt d56df0a95e chore: bump version to 4.5.0 2025-11-27 09:34:58 -05:00
kaitranntt fd8fec20d7 refactor(powershell): standardize placeholders and improve error handling 2025-11-24 10:45:43 -05:00
kaitranntt 739895a29e feat(config): introduce shared settings.json across profiles 2025-11-23 20:31:39 -05:00
Kai (Tam Nhu) TranandGitHub 0f82b0cb06 fix: clear package manager cache during update to ensure fresh downloads (v4.3.10) (#19)
* fix: clear package manager cache during update to ensure fresh downloads (v4.3.10)

Resolves issue where 'ccs update' would report success but serve cached package versions, requiring manual 'npm cache clean --force'.

Changes:
- Node.js (bin/ccs.js): Added cache clearing for npm, yarn, pnpm before update
- Bash (lib/ccs): Added 'npm cache clean --force' before npm update
- PowerShell (lib/ccs.ps1): Added 'npm cache clean --force' before npm update
- Updated manual fallback commands to include cache clearing
- Non-blocking: continues with update even if cache clearing fails

Version bumped to 4.3.10

* docs: update CHANGELOG for v4.3.10
2025-11-22 20:57:54 -05:00
Kai (Tam Nhu) TranandGitHub e148373c62 fix: resolve missing commands/ccs.md symlink during npm install (v4.3.9) (#18)
* fix: add missing commands/ccs.md symlink during npm install

Previously, the ClaudeSymlinkManager only created symlinks for the
commands/ccs directory and skills/ccs-delegation directory, but missed
the commands/ccs.md file. This resulted in an incomplete symlink structure
where users would see the ccs folder symlinked but not the ccs.md file.

Added commands/ccs.md to the ccsItems array to ensure all CCS components
are properly symlinked during installation.

Fixes: npm install now creates complete symlink structure for all CCS items

* chore: bump version to 4.3.9
2025-11-22 20:18:57 -05:00
Kai (Tam Nhu) TranandGitHub 7ea4448abf fix: missing ~/.ccs/.claude/ directory and ora v9 compatibility (v4.3.8) (#17)
* fix(postinstall): make ora dependency optional to fix missing ~/.ccs/.claude/ directory

The root cause was that `ora` module was not available during `npm install`
when the postinstall script runs, causing both:
- .claude/ directory copy to fail (ClaudeDirInstaller)
- Symlink creation to fail (ClaudeSymlinkManager)

This resulted in the ~/.ccs/.claude/ directory not being created.

Changes:
- Made ora import optional in ClaudeDirInstaller
- Made ora import optional in ClaudeSymlinkManager
- Both classes now gracefully fallback to console.log when ora is unavailable
- Postinstall now successfully creates ~/.ccs/.claude/ and symlinks

Tested: Clean install now properly creates all directories and symlinks

* chore: bump version to 4.3.7

Version 4.3.7 - Postinstall Fix Release

Changes:
- Fixed missing ~/.ccs/.claude/ directory during npm install
- Made ora dependency optional in installer utilities
- Added CHANGELOG entry documenting the fix

Files updated:
- VERSION: 4.3.6 -> 4.3.7
- package.json: version updated
- lib/ccs: version string updated
- lib/ccs.ps1: version string updated
- installers/install.sh: version string updated
- installers/install.ps1: version string updated
- CHANGELOG.md: added 4.3.7 release notes

* fix: handle ora v9 ES module compatibility

ora v9.0.0 is now an ES module, which requires using .default when
importing with CommonJS require(). This was causing "ora is not a
function" errors in doctor.js and installer utilities.

Changes:
- Updated ora import to use oraModule.default || oraModule
- Added fallback spinner implementation for when ora is unavailable
- Ensures compatibility with both ES and CommonJS module systems
- Fixes ccs doctor command and postinstall script

Tested:
- ccs doctor now works correctly with spinners
- postinstall successfully creates ~/.ccs/.claude/ and symlinks
- Fallback console.log works when ora is unavailable

* chore: update package-lock.json

* chore: bump version to 4.3.8

Version 4.3.8 - ora v9 Compatibility Release

Changes:
- Fixed ora v9 ES module compatibility issues
- Updated CHANGELOG with 4.3.8 release notes

Files updated:
- VERSION: 4.3.7 -> 4.3.8
- package.json: version updated
- lib/ccs: version string updated
- lib/ccs.ps1: version string updated
- installers/install.sh: version string updated
- installers/install.ps1: version string updated
- CHANGELOG.md: added 4.3.8 release notes
2025-11-22 20:07:15 -05:00
Kai (Tam Nhu) TranandGitHub e97311cd3b fix: resolve missing ~/.ccs/.claude/ directory during npm install (v4.3.7) (#16)
* fix(postinstall): make ora dependency optional to fix missing ~/.ccs/.claude/ directory

The root cause was that `ora` module was not available during `npm install`
when the postinstall script runs, causing both:
- .claude/ directory copy to fail (ClaudeDirInstaller)
- Symlink creation to fail (ClaudeSymlinkManager)

This resulted in the ~/.ccs/.claude/ directory not being created.

Changes:
- Made ora import optional in ClaudeDirInstaller
- Made ora import optional in ClaudeSymlinkManager
- Both classes now gracefully fallback to console.log when ora is unavailable
- Postinstall now successfully creates ~/.ccs/.claude/ and symlinks

Tested: Clean install now properly creates all directories and symlinks

* chore: bump version to 4.3.7

Version 4.3.7 - Postinstall Fix Release

Changes:
- Fixed missing ~/.ccs/.claude/ directory during npm install
- Made ora dependency optional in installer utilities
- Added CHANGELOG entry documenting the fix

Files updated:
- VERSION: 4.3.6 -> 4.3.7
- package.json: version updated
- lib/ccs: version string updated
- lib/ccs.ps1: version string updated
- installers/install.sh: version string updated
- installers/install.ps1: version string updated
- CHANGELOG.md: added 4.3.7 release notes
2025-11-22 19:43:50 -05:00
kaitranntt 4d07471f44 fix(shared-dirs): add plugins directory to shared structure symlinks
Address PR #15 review comments by ensuring plugins directory is properly
handled in shared directory symlinking for both Bash and PowerShell
implementations. Adds plugins to directory creation and symlink loops.

Fixes:
- https://github.com/kaitranntt/ccs/pull/15#discussion_r2553557063
- https://github.com/kaitranntt/ccs/pull/15#discussion_r2553557078
2025-11-22 19:35:12 -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 ca8f7f0d61 fix(update): Automatically detect package manager for ccs update 2025-11-22 12:44:29 -05:00
kaitranntt 24a11e1051 refactor(delegation)!: consolidate commands with intelligent profile selection
BREAKING CHANGE: Replace 4 hardcoded commands with 2 intelligent commands:
- Old: /ccs:glm, /ccs:kimi, /ccs:glm:continue, /ccs:kimi:continue
- New: /ccs (auto-selects), /ccs:continue (auto-dects)
- Override with flags: /ccs --glm "task", /ccs --kimi "task"

This change:
- Adds intelligent profile selection based on task analysis
- Supports custom profiles without creating new commands
- Enhances session management with automatic profile detection
- Updates all help text, examples, and documentation
- Fixes CCS Doctor health checks for new command structure
2025-11-21 20:31:44 -05:00
kaitranntt d82bb8095b chore: bump version to 4.3.2 2025-11-18 20:40:34 -05:00
Kai (Tam Nhu) TranandGitHub e770200cb4 feat(completion): improve fish shell completion with category prefixes (#14)
* feat(completion): improve fish shell completion with category prefixes

- Remove problematic inline set_color commands that prevented descriptions from displaying
- Add [cmd], [model], and [account] prefixes to visually group completions
- Update file header to document categorization features

This brings fish completion quality closer to zsh by making categories
clear and ensuring descriptions actually display to users.

Fixes issue where fish completions showed no descriptions.

* chore: bump version to 4.3.1
2025-11-18 02:52:48 -05:00
Kai (Tam Nhu) Tranandkaitranntt 67dbd3f259 feat: improve UX for ccs doctor and sync commands (#13)
* feat: enhance UX for 'ccs sync' and 'ccs doctor' commands

- Add ora spinners for real-time progress feedback
- Add cli-table3 for structured health check summary table
- Display detailed component information in doctor report
- Show file/directory counts during sync operations
- Improve visual hierarchy and readability
- Fix Unicode checkmark violation (replaced with [OK])

Breaking changes: None
Dependencies added: ora@^5.4.1, cli-table3@^0.6.5

Version bumped to 4.3.0

* fix: match doctor summary header width to table width

* feat: improve settings validation to check API keys, not just endpoints

- Check if API keys are configured or still placeholders
- Show 'Key configured' vs 'Placeholder key (not configured)'
- Previous message 'Valid (API: api.z.ai)' was misleading
- Now users can clearly see which profiles need API key configuration
- Warnings shown for placeholder keys (yellow [!])

* feat: add category grouping and alignment to doctor checks

- Group checks into logical categories: System, Configuration, Profiles & Delegation, System Health
- Add consistent padding (26 chars) for aligned columns
- Add 2-space indent for better visual hierarchy
- Separate categories with blank lines for better readability
- Much cleaner and easier to scan than before

* fix: perfect alignment for all doctor check output

- Use .padEnd(26) consistently for all component names
- Remove extra space before status icons
- Now all status icons [OK]/[X]/[!]/[i] align perfectly
- All component names pad to exactly 26 characters
2025-11-18 01:19:28 -05:00
Kai (Tam Nhu) Tranandkaitranntt d34dbcac1f feat: add 'ccs update' command with smart update notifications
Add comprehensive update functionality with intelligent notification system.
Supports manual update checking, automatic notifications every 24h, and works
across npm and direct installations with proper error handling.

Closes #12
2025-11-18 01:19:28 -05:00
kaitranntt 31a21d13ad fix(sync): update 'ccs update' references to 'ccs sync' across codebase 2025-11-18 01:19:28 -05:00
Kai (Tam Nhu) Tranandkaitranntt fe4ff882b0 feat(cli): enhance version and help display formatting (#11)
* feat: add -sc short flag for --shell-completion

Add -sc as a short flag alias for --shell-completion,
matching the pattern of -h for --help and -v for --version.

Changes:
- bin/ccs.js: Add -sc support in help text and flag detection
- lib/ccs: Add -sc support in help text and flag detection
- lib/ccs.ps1: Add -sc support in help text and flag detection

* chore: bump version to 4.1.4

* chore: bump version to 4.1.5

* feat: emphasize concurrent account usage in auth help text

Update all auth-related help messages to emphasize the ability
to run multiple Claude accounts concurrently.

Changes:
- bin/ccs.js: "Run multiple Claude accounts concurrently"
- bin/auth/auth-commands.js: "CCS Concurrent Account Management"
- lib/ccs: Updated both main help and auth_help function
- lib/ccs.ps1: Updated both main help and Show-AuthHelp function

* feat: implement ccs update command across all platforms

Add cross-platform ccs update command to sync delegation commands
and skills from ~/.ccs/.claude/ to ~/.claude/. Replaces vague
"CCS items" wording with specific "delegation commands and skills".

Changes:
- bin/ccs.js: Add update command handler and update help text
- bin/utils/claude-symlink-manager.js: Update user-facing messages
- lib/ccs: Implement update_run() function with symlink logic
- lib/ccs.ps1: Implement Update-Run function with Junction/SymbolicLink support

Features:
- Automatically backs up existing files before symlinking
- Skips items that are already correctly symlinked
- Reports installed vs up-to-date counts
- Handles Windows permissions gracefully (suggests Admin/Developer Mode)

Cross-platform parity: bash, PowerShell, and Node.js now all support ccs update

* refactor: rename ccs update to ccs sync for clarity

Rename the update command to sync across all platforms to avoid
confusion with updating the CCS tool itself. The sync command
clearly communicates syncing delegation features from the CCS
package to ~/.claude/.

Changes:
- bin/ccs.js: Rename handleUpdateCommand → handleSyncCommand
- bin/utils/claude-symlink-manager.js: Rename update() → sync()
- lib/ccs: Rename update_run() → sync_run()
- lib/ccs.ps1: Rename Update-Run → Sync-Run
- All: Update help text "update" → "sync"
- All: Update messages "Updating" → "Syncing"

Command usage: ccs sync or ccs --sync

* fix: update GitHub documentation links to stable permalink

Update broken #usage anchor links to stable /blob/main/README.md
permalink format. This matches the format already used in PowerShell
version and ensures links always work.

Changes:
- bin/ccs.js: Update link from #usage to /blob/main/README.md
- lib/ccs: Update link from #usage to /blob/main/README.md
- Now consistent with lib/ccs.ps1 which already used this format

Old: https://github.com/kaitranntt/ccs#usage
New: https://github.com/kaitranntt/ccs/blob/main/README.md

* feat: add sync command and -sc flag to shell completions

Update all shell completion scripts to include the newly added
sync command and -sc short flag for --shell-completion.

Changes across all completion scripts (bash, zsh, fish, PowerShell):
- Add 'sync' command to completion suggestions
- Add '-sc' as short flag for '--shell-completion'
- Update fish to handle both -sc and --shell-completion for subflags
- Update PowerShell to recognize -sc for shell completion flags
- Add sync command description: "Sync delegation commands and skills"

This ensures tab completion discovers the sync command and users
can use both -sc and --shell-completion interchangeably.

* fix: standardize help text across all implementations

Fix inconsistencies in help text that appeared after merge from main.
Ensures all three implementations (bash, PowerShell, Node.js) display
identical help messages.

Changes:
- lib/ccs: Update "Delegation (Token Optimization)" → "Delegation (inside Claude Code CLI)"
- lib/ccs: Remove redundant /ccs:create line, simplify description
- lib/ccs.ps1: Add missing Delegation section
- All: Now use consistent messaging about delegation features

This ensures users see the same information regardless of which
platform they're using (Linux/macOS bash, Windows PowerShell, or npm).

* fix: update description text to emphasize concurrent sessions

Update outdated description in lib/ccs and lib/ccs.ps1 to match
the improved wording already in bin/ccs.js. The new description
better emphasizes running concurrent Claude CLI sessions.

Changes:
- lib/ccs: Update description to emphasize "Run different Claude CLI sessions concurrently"
- lib/ccs.ps1: Update description to match bash and Node.js versions
- Remove "(work, personal, team)" examples to keep description cleaner
- Emphasize "Run different Claude CLI sessions concurrently" over vague "Concurrent sessions"

Old: "Switch between multiple Claude accounts (work, personal, team) and
      alternative models (GLM, Kimi) instantly. Concurrent sessions with
      auto-recovery. Zero downtime."

New: "Switch between multiple Claude accounts and alternative models
      (GLM, Kimi) instantly. Run different Claude CLI sessions concurrently
      with auto-recovery. Zero downtime."

All three implementations now show identical, clearer description text.

* feat(cli): enhance version display formatting and delegation status

---------
2025-11-18 01:19:28 -05:00