@42ailab/42cc 0.3.9 → 0.3.13

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 (2) hide show
  1. package/bin/42cc.js +21 -0
  2. package/package.json +3 -3
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.9",
3
+ "version": "0.3.13",
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.9",
14
- "@42ailab/42cc-win32-x64": "0.3.9"
13
+ "@42ailab/42cc-darwin-universal": "0.3.13",
14
+ "@42ailab/42cc-win32-x64": "0.3.13"
15
15
  },
16
16
  "os": [
17
17
  "darwin",