@42ailab/42cc 0.3.10 → 0.3.14

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.
Files changed (3) hide show
  1. package/README.md +49 -0
  2. package/bin/42cc.js +21 -0
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -58,6 +58,55 @@ bun remove -g @42ailab/42cc
58
58
  npm uninstall -g @42ailab/42cc
59
59
  ```
60
60
 
61
+ ## Troubleshooting
62
+
63
+ ### Version Not Updated After Install
64
+
65
+ If `42cc --version` shows an older version after installing, this is likely due to npm cache issues with optionalDependencies.
66
+
67
+ **Solution:**
68
+
69
+ ```bash
70
+ # Complete cleanup and reinstall
71
+ npm uninstall -g @42ailab/42cc
72
+ rm -rf ~/.npm
73
+ npm install -g @42ailab/42cc@latest
74
+
75
+ # If platform package still shows old version
76
+ npm install -g @42ailab/42cc-darwin-universal@latest # macOS
77
+ npm install -g @42ailab/42cc-win32-x64@latest # Windows
78
+ ```
79
+
80
+ **For bun users** (more reliable cache management):
81
+
82
+ ```bash
83
+ bun remove -g @42ailab/42cc
84
+ bun add -g @42ailab/42cc
85
+ ```
86
+
87
+ ### "Application is damaged" on macOS
88
+
89
+ If macOS shows a "damaged app" warning, this is due to quarantine attributes from npm/bun installation. The CLI automatically removes these attributes when launching. If the issue persists:
90
+
91
+ ```bash
92
+ # Manually remove quarantine attribute
93
+ xattr -cr ~/.nvm/versions/node/*/lib/node_modules/@42ailab/42cc-darwin-universal/42cc.app
94
+ ```
95
+
96
+ ### Verify Installation
97
+
98
+ ```bash
99
+ # Check installed version
100
+ 42cc --version
101
+
102
+ # Check all 42cc packages
103
+ npm list -g --depth=0 | grep 42cc
104
+
105
+ # Both packages should show the same version
106
+ # @42ailab/42cc@x.x.x
107
+ # @42ailab/42cc-darwin-universal@x.x.x (or 42cc-win32-x64)
108
+ ```
109
+
61
110
  ## Links
62
111
 
63
112
  - Homepage: https://42cc.42ailab.com
package/bin/42cc.js CHANGED
@@ -58,10 +58,22 @@ function getPlatformKey() {
58
58
  }
59
59
 
60
60
  function getPackageDir(pkgName) {
61
+ // 方法 1: 尝试 require.resolve (适用于嵌套安装)
61
62
  try {
62
63
  const pkgPath = require.resolve(`${pkgName}/package.json`);
63
64
  return path.dirname(pkgPath);
64
65
  } catch {
66
+ // 方法 2: 查找 sibling 目录 (适用于 npm flat 安装)
67
+ // 从当前包目录向上查找 @42ailab 目录
68
+ const currentPkgDir = path.dirname(__dirname); // @42ailab/42cc
69
+ const scopeDir = path.dirname(currentPkgDir); // @42ailab
70
+ const pkgShortName = pkgName.replace("@42ailab/", "");
71
+ const siblingPath = path.join(scopeDir, pkgShortName);
72
+
73
+ if (fs.existsSync(path.join(siblingPath, "package.json"))) {
74
+ return siblingPath;
75
+ }
76
+
65
77
  return null;
66
78
  }
67
79
  }
@@ -105,6 +117,15 @@ function launchApp() {
105
117
  process.exit(1);
106
118
  }
107
119
 
120
+ // 移除 quarantine 属性,避免 "已损坏" 弹窗
121
+ // npm/bun 安装时 .app 的签名属性可能丢失,需要清除 quarantine
122
+ const { execSync } = require("child_process");
123
+ try {
124
+ execSync(`xattr -cr "${appPath}"`, { stdio: "ignore" });
125
+ } catch {
126
+ // 忽略错误,可能没有 quarantine 属性
127
+ }
128
+
108
129
  const child = spawn("open", ["-a", appPath], {
109
130
  detached: true,
110
131
  stdio: "ignore",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@42ailab/42cc",
3
- "version": "0.3.10",
3
+ "version": "0.3.14",
4
4
  "description": "Claude Code model configuration tool - CLI launcher for the 42cc tray application",
5
5
  "bin": {
6
6
  "42cc": "./bin/42cc.js"
@@ -10,8 +10,8 @@
10
10
  "README.md"
11
11
  ],
12
12
  "optionalDependencies": {
13
- "@42ailab/42cc-darwin-universal": "0.3.10",
14
- "@42ailab/42cc-win32-x64": "0.3.10"
13
+ "@42ailab/42cc-darwin-universal": "0.3.14",
14
+ "@42ailab/42cc-win32-x64": "0.3.14"
15
15
  },
16
16
  "os": [
17
17
  "darwin",