@kaitranntt/ccs 7.13.0-dev.4 → 7.13.1-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitranntt/ccs",
3
- "version": "7.13.0-dev.4",
3
+ "version": "7.13.1-dev.1",
4
4
  "description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6",
5
5
  "keywords": [
6
6
  "cli",
@@ -72,6 +72,8 @@
72
72
  "test:npm": "bun test tests/npm/",
73
73
  "test:native": "bash tests/native/unix/edge-cases.sh",
74
74
  "dev": "bun run build:server && bun dist/ccs.js config --dev",
75
+ "dev:symlink": "bash scripts/dev-symlink.sh",
76
+ "dev:unlink": "bash scripts/dev-symlink.sh --restore",
75
77
  "ui:build": "cd ui && bun run build",
76
78
  "ui:preview": "cd ui && bun run preview",
77
79
  "ui:validate": "cd ui && bun run validate",
@@ -0,0 +1,115 @@
1
+ #!/bin/bash
2
+ # CCS Dev Symlink Setup
3
+ # Creates symlinks for testing dev version with 'ccs' command
4
+ #
5
+ # Usage: ./scripts/dev-symlink.sh [--restore]
6
+ #
7
+ # Without --restore: Creates symlink from global 'ccs' to dist/ccs.js
8
+ # With --restore: Restores original global 'ccs' from backup
9
+
10
+ set -euo pipefail
11
+
12
+ RESTORE=false
13
+
14
+ # Parse arguments
15
+ for arg in "$@"; do
16
+ case $arg in
17
+ --restore) RESTORE=true ;;
18
+ -h|--help)
19
+ echo "Usage: $0 [--restore]"
20
+ echo ""
21
+ echo "Create symlink for dev testing:"
22
+ echo " $0"
23
+ echo ""
24
+ echo "Restore original global ccs:"
25
+ echo " $0 --restore"
26
+ exit 0
27
+ ;;
28
+ *)
29
+ echo "[X] Unknown option: $arg"
30
+ echo "Use --help for usage"
31
+ exit 1
32
+ ;;
33
+ esac
34
+ done
35
+
36
+ # Get to the right directory
37
+ cd "$(dirname "$0")/.."
38
+
39
+ # Check if dist/ccs.js exists
40
+ if [ ! -f "dist/ccs.js" ]; then
41
+ echo "[X] ERROR: dist/ccs.js not found. Run 'bun run build' first."
42
+ exit 1
43
+ fi
44
+
45
+ # Get absolute path to dev ccs.js
46
+ DEV_CCS_PATH="$(pwd)/dist/ccs.js"
47
+
48
+ # Find global ccs installation
49
+ GLOBAL_CCS_PATH=$(which ccs 2>/dev/null || true)
50
+
51
+ if [ -z "$GLOBAL_CCS_PATH" ]; then
52
+ echo "[X] ERROR: No global 'ccs' installation found."
53
+ echo "Install CCS globally first: npm install -g @kaitranntt/ccs"
54
+ exit 1
55
+ fi
56
+
57
+ echo "[i] Found global ccs at: $GLOBAL_CCS_PATH"
58
+
59
+ if [ "$RESTORE" = true ]; then
60
+ # Restore original ccs from backup
61
+ BACKUP_PATH="${GLOBAL_CCS_PATH}.backup-dev"
62
+
63
+ if [ ! -f "$BACKUP_PATH" ] && [ ! -L "$BACKUP_PATH" ]; then
64
+ echo "[X] ERROR: No backup found at $BACKUP_PATH"
65
+ echo "Cannot restore - backup may have been deleted"
66
+ exit 1
67
+ fi
68
+
69
+ echo "[i] Restoring original ccs from backup..."
70
+ rm -f "$GLOBAL_CCS_PATH"
71
+ if [ -L "$BACKUP_PATH" ]; then
72
+ # Restore symlink
73
+ cp -P "$BACKUP_PATH" "$GLOBAL_CCS_PATH"
74
+ else
75
+ # Restore regular file
76
+ cp "$BACKUP_PATH" "$GLOBAL_CCS_PATH"
77
+ fi
78
+ chmod +x "$GLOBAL_CCS_PATH"
79
+ rm -f "$BACKUP_PATH"
80
+
81
+ echo "[OK] Restored original global ccs"
82
+ echo "Run 'ccs --version' to verify"
83
+ exit 0
84
+ fi
85
+
86
+ # Check if already symlinked to our dev version
87
+ if [ -L "$GLOBAL_CCS_PATH" ]; then
88
+ CURRENT_TARGET=$(readlink "$GLOBAL_CCS_PATH" 2>/dev/null || true)
89
+ if [ "$CURRENT_TARGET" = "$DEV_CCS_PATH" ]; then
90
+ echo "[OK] Already symlinked to dev version"
91
+ exit 0
92
+ fi
93
+ fi
94
+
95
+ # Create backup of current global ccs
96
+ BACKUP_PATH="${GLOBAL_CCS_PATH}.backup-dev"
97
+ if [ -f "$BACKUP_PATH" ] || [ -L "$BACKUP_PATH" ]; then
98
+ echo "[i] Backup already exists, skipping backup creation"
99
+ else
100
+ echo "[i] Creating backup of current global ccs..."
101
+ cp -P "$GLOBAL_CCS_PATH" "$BACKUP_PATH"
102
+ echo "[OK] Backup created at: $BACKUP_PATH"
103
+ fi
104
+
105
+ # Create symlink
106
+ echo "[i] Creating symlink to dev version..."
107
+ rm -f "$GLOBAL_CCS_PATH"
108
+ ln -s "$DEV_CCS_PATH" "$GLOBAL_CCS_PATH"
109
+
110
+ echo "[OK] Symlinked global 'ccs' to dev version"
111
+ echo ""
112
+ echo "Now you can test dev changes with: ccs <command>"
113
+ echo "To restore original: $0 --restore"
114
+ echo ""
115
+ echo "Test with: ccs --version"