@kaitranntt/ccs 5.20.0-dev.1 → 5.20.0-dev.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 5.20.0-dev.1
1
+ 5.20.0-dev.2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitranntt/ccs",
3
- "version": "5.20.0-dev.1",
3
+ "version": "5.20.0-dev.2",
4
4
  "description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6",
5
5
  "keywords": [
6
6
  "cli",
@@ -50,6 +50,7 @@
50
50
  ],
51
51
  "preferGlobal": true,
52
52
  "scripts": {
53
+ "preinstall": "node scripts/preinstall.js",
53
54
  "build": "tsc && node scripts/add-shebang.js",
54
55
  "build:watch": "tsc --watch",
55
56
  "build:server": "tsc && node scripts/add-shebang.js",
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /**
5
+ * CCS Preinstall Script
6
+ * Installs dependencies in ui/ folder before main install
7
+ *
8
+ * Runs when: bun install, npm install, yarn install
9
+ * Skips when: CI environment or global install (npm -g)
10
+ */
11
+
12
+ const { execSync } = require('child_process');
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+
16
+ // Skip in CI environments or global installs
17
+ if (process.env.CI || process.env.npm_config_global === 'true') {
18
+ process.exit(0);
19
+ }
20
+
21
+ const uiDir = path.join(__dirname, '..', 'ui');
22
+ const uiPackageJson = path.join(uiDir, 'package.json');
23
+
24
+ // Skip if ui/ folder or package.json doesn't exist
25
+ if (!fs.existsSync(uiPackageJson)) {
26
+ process.exit(0);
27
+ }
28
+
29
+ // Detect package manager (prefer bun > npm)
30
+ function getPackageManager() {
31
+ // Check if running via bun
32
+ if (process.env.npm_execpath?.includes('bun') || process.env._?.includes('bun')) {
33
+ return 'bun';
34
+ }
35
+ // Check if bun is available
36
+ try {
37
+ execSync('bun --version', { stdio: 'ignore' });
38
+ return 'bun';
39
+ } catch {
40
+ return 'npm';
41
+ }
42
+ }
43
+
44
+ const pm = getPackageManager();
45
+
46
+ console.log(`[i] Installing ui/ dependencies with ${pm}...`);
47
+
48
+ try {
49
+ execSync(`${pm} install`, {
50
+ cwd: uiDir,
51
+ stdio: 'inherit',
52
+ env: { ...process.env, npm_config_global: undefined }
53
+ });
54
+ console.log('[OK] ui/ dependencies installed');
55
+ } catch (err) {
56
+ console.error('[!] Failed to install ui/ dependencies:', err.message);
57
+ console.error(' You can manually install: cd ui && bun install');
58
+ // Don't fail the main install - ui is optional for CLI usage
59
+ }