@zyzheal/ola-cc 0.1.2 → 0.3.12

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/README.md CHANGED
@@ -1,98 +1,163 @@
1
- # Ola-CC (Ola Claude Code)
1
+ # Ola CC (Ola Claude Code)
2
2
 
3
3
  AI 编码助手,运行在你的终端中。
4
4
 
5
- ## 安装
5
+ ## 快速开始
6
+
7
+ ### 安装
6
8
 
7
9
  ```bash
8
10
  npm install -g @zyzheal/ola-cc
9
11
  ```
10
12
 
11
- ## 使用
13
+ 安装完成后,终端中运行 `ola-cc` 即可启动。
12
14
 
13
- ```bash
14
- # 启动交互式会话
15
- ola-cc
15
+ ### 首次使用
16
16
 
17
- # 或使用 npx
18
- npx @zyzheal/ola-cc
19
- ```
17
+ 1. **配置 API 密钥** — 选择以下任一方式:
18
+
19
+ **方式 A:通过 session.json(推荐)**
20
+
21
+ 创建 `~/.claude/session.json`:
22
+
23
+ ```bash
24
+ mkdir -p ~/.claude
25
+ cat > ~/.claude/session.json << 'EOF'
26
+ {
27
+ "env": {
28
+ "OPENAI_API_KEY": "你的API密钥",
29
+ "OPENAI_BASE_URL": "https://api.openai.com/v1",
30
+ "OPENAI_MODEL": "gpt-4o"
31
+ }
32
+ }
33
+ EOF
34
+ ```
35
+
36
+ **方式 B:通过环境变量**
37
+
38
+ ```bash
39
+ export OPENAI_API_KEY="你的API密钥"
40
+ export OPENAI_BASE_URL="https://api.openai.com/v1"
41
+ export OPENAI_MODEL="gpt-4o"
42
+ ola-cc
43
+ ```
44
+
45
+ 2. **启动 Ola CC**
46
+
47
+ ```bash
48
+ ola-cc
49
+ ```
50
+
51
+ ## 架构说明
52
+
53
+ 本项目采用 **包装器 + 原生二进制分发** 模式:
54
+
55
+ - **主包** `@zyzheal/ola-cc` — 包含安装脚本和 Node.js 兼容的 JS bundle,安装时自动下载对应平台的原生二进制(macOS/Linux)或 JS bundle(Windows)
56
+ - **平台子包** `@zyzheal/ola-cc-darwin-arm64` 等 — 每个平台一个独立包
57
+
58
+ ### 平台运行方式
20
59
 
21
- ## 配置文件
60
+ | 平台 | 运行方式 | 说明 |
61
+ |------|----------|------|
62
+ | macOS | Bun 编译原生二进制 | 高性能,单进程 |
63
+ | Linux | Bun 编译原生二进制 | 高性能,单进程 |
64
+ | Windows | Node.js JS bundle | 稳定可靠,避免 Bun 编译二进制在 Windows 上的兼容性问题 |
22
65
 
23
- Ola-CC 的配置存储在 `~/.claude/` 目录中。
66
+ ### 支持的平台
67
+
68
+ | 平台包名 | 操作系统 | CPU |
69
+ |----------|----------|-----|
70
+ | `@zyzheal/ola-cc-darwin-arm64` | macOS | Apple Silicon (M1/M2/M3/M4) |
71
+ | `@zyzheal/ola-cc-darwin-x64` | macOS | Intel |
72
+ | `@zyzheal/ola-cc-linux-x64` | Linux | x64 (glibc) |
73
+ | `@zyzheal/ola-cc-linux-arm64` | Linux | ARM64 (glibc) |
74
+ | `@zyzheal/ola-cc-linux-x64-musl` | Linux | x64 (musl/Alpine) |
75
+ | `@zyzheal/ola-cc-linux-arm64-musl` | Linux | ARM64 (musl/Alpine) |
76
+ | `@zyzheal/ola-cc-win32-x64` | Windows | x64 |
77
+ | `@zyzheal/ola-cc-win32-arm64` | Windows | ARM64 |
78
+
79
+ ## 配置文件详解
80
+
81
+ Ola CC 的配置存储在 `~/.claude/` 目录中。
24
82
 
25
83
  ### 配置目录结构
26
84
 
27
85
  ```
28
86
  ~/.claude/
29
87
  ├── settings.json # 用户设置(MCP 服务器、偏好等)
30
- ├── session.json # 会话级环境配置(API 密钥、模型、环境变量)
88
+ ├── session.json # 会话级环境配置(API 密钥、模型、环境变量等)
31
89
  ├── CLAUDE.md # 项目级指令文件
32
90
  └── chrome/ # Chrome 扩展原生主机文件
33
91
  ├── chrome-native-host # Unix: 包装脚本
34
92
  └── chrome-native-host.bat # Windows: 包装脚本
35
93
  ```
36
94
 
37
- ### 读取优先级
95
+ ### 配置读取优先级
38
96
 
39
- 配置文件的读取优先级如下(从高到低):
97
+ | 优先级 | 来源 | 说明 |
98
+ |--------|------|------|
99
+ | 1 | 命令行参数 | 启动时 `--` 传入的参数 |
100
+ | 2 | 环境变量 | 当前 shell 环境中的变量 |
101
+ | 3 | `~/.claude/session.json` | 会话级配置(API 密钥、模型、环境变量等) |
102
+ | 4 | `~/.claude/settings.json` | 用户级持久化设置(MCP 服务器、偏好设置等) |
103
+ | 5 | `.claude/CLAUDE.md` | 项目级指令(仅影响当前项目) |
40
104
 
41
- 1. **命令行参数** — 启动时传入的 `--` 参数,优先级最高
42
- 2. **环境变量** — 当前 shell 环境中设置的变量
43
- 3. **`~/.claude/session.json`** — 会话级配置,包含 API 密钥、模型选择、环境变量等
44
- 4. **`~/.claude/settings.json`** — 用户级持久化设置,包含 MCP 服务器、偏好设置等
45
- 5. **项目根目录 `.claude/CLAUDE.md`** — 项目级指令,仅影响当前项目的行为
105
+ > 高优先级的配置会覆盖低优先级的同名设置。
46
106
 
47
- > **注意**:`session.json` 中的配置会覆盖 `settings.json` 中的同名设置,但不会覆盖命令行参数和系统环境变量。
107
+ ### session.json 配置(会话级)
48
108
 
49
- ### session.json 配置详解
109
+ `~/.claude/session.json` 用于配置会话级别的环境变量和模型设置。
50
110
 
51
- `~/.claude/session.json` 用于配置会话级别的环境变量和模型设置。典型结构如下:
111
+ #### 完整示例
52
112
 
53
113
  ```json
54
114
  {
55
115
  "env": {
56
- "ANTHROPIC_API_KEY": "sk-ant-api03-xxxxx...xxxxx",
57
- "API_BASE_URL": "http://127.0.0.1:11434",
116
+ "OPENAI_API_KEY": "sk-xxx",
117
+ "OPENAI_BASE_URL": "https://api.openai.com/v1",
118
+ "OPENAI_MODEL": "gpt-4o",
58
119
  "CLAUDE_CODE_FORCE_FULL_LOGO": "true"
59
120
  },
60
121
  "model": {
61
- "name": "qwen/qwen3-235b-a22b",
122
+ "name": "gpt-4o",
62
123
  "provider": "openai"
63
124
  }
64
125
  }
65
126
  ```
66
127
 
67
- #### env 字段
128
+ #### env 字段 — 环境变量注入
68
129
 
69
130
  `env` 对象中的键值对会在会话启动时注入为环境变量。常用配置:
70
131
 
71
- | 变量 | 说明 |
72
- |------|------|
73
- | `ANTHROPIC_API_KEY` | API 密钥(必填),使用远程代理时填代理服务的 key |
74
- | `API_BASE_URL` | API 代理地址,使用本地模型时指向本地代理端口 |
75
- | `CLAUDE_CODE_ENABLE_CFC` | 启用 Chrome 集成(1=启用,0=禁用) |
76
- | `CLAUDE_CHROME_HTTP` | 启用 Chrome HTTP 桥接模式(1=启用) |
77
- | `CLAUDE_CHROME_HTTP_PORT` | HTTP 服务器端口(默认 12306) |
78
-
79
- #### model 字段
132
+ | 变量 | 说明 | 必填 |
133
+ |------|------|------|
134
+ | `OPENAI_API_KEY` | API 密钥 | |
135
+ | `OPENAI_BASE_URL` | API 基础 URL | 是 |
136
+ | `OPENAI_MODEL` | 模型名称 | 推荐 |
137
+ | `CLAUDE_CODE_USE_OPENAI` | 启用 OpenAI 协议(设为 `1`) | 是 |
138
+ | `CLAUDE_CODE_ENABLE_CFC` | 启用 Chrome 集成(1=启用,0=禁用) | 否 |
139
+ | `CLAUDE_CHROME_HTTP` | 启用 Chrome HTTP 桥接(1=启用) | 否 |
140
+ | `CLAUDE_CHROME_HTTP_PORT` | HTTP 桥接端口(默认 12306) | 否 |
80
141
 
81
- `model` 对象用于指定使用的模型。使用本地模型代理时的参考配置:
142
+ #### model 字段 — 模型选择
82
143
 
83
144
  ```json
84
145
  {
85
146
  "model": {
86
- "name": "qwen/qwen3-235b-a22b",
147
+ "name": "gpt-4o",
87
148
  "provider": "openai"
88
149
  }
89
150
  }
90
151
  ```
91
152
 
92
- - **name** — 模型名称,格式取决于代理服务的 API。本地 Ollama 代理通常为 `qwen/qwen3-235b-a22b` 或 `llama3.1`
93
- - **provider** — 提供商类型,本地 OpenAI 兼容代理填 `openai`,也支持 `bedrock`、`vertex` 等
153
+ - **name** — 模型名称,取决于你的 API 服务
154
+ - **provider** — 提供商类型:`openai`、`bedrock`、`vertex` 等
155
+
156
+ ### settings.json 配置(用户级)
94
157
 
95
- ### settings.json 配置示例
158
+ `~/.claude/settings.json` 用于持久化用户设置。
159
+
160
+ #### MCP 服务器配置
96
161
 
97
162
  ```json
98
163
  {
@@ -109,81 +174,149 @@ Ola-CC 的配置存储在 `~/.claude/` 目录中。
109
174
  }
110
175
  ```
111
176
 
112
- ## MCP 服务器配置
113
-
114
- 在 `~/.claude/settings.json` 的 `mcpServers` 中添加 MCP 服务器:
177
+ #### 宠物(SprocketDudot)配置
115
178
 
116
179
  ```json
117
180
  {
118
- "mcpServers": {
119
- "filesystem": {
120
- "command": "npx",
121
- "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"]
122
- },
123
- "github": {
124
- "command": "npx",
125
- "args": ["-y", "@modelcontextprotocol/server-github"]
126
- }
181
+ "sprocketDudot": {
182
+ "enabled": true
127
183
  }
128
184
  }
129
185
  ```
130
186
 
131
- ## 环境变量
187
+ ### CLAUDE.md 配置(项目级)
132
188
 
133
- | 变量 | 说明 |
134
- |------|------|
135
- | `ANTHROPIC_API_KEY` | API 密钥 |
136
- | `CLAUDE_CODE_ENABLE_CFC` | 启用 Chrome 集成(1=启用,0=禁用) |
137
- | `CLAUDE_CHROME_HTTP` | 启用 Chrome HTTP 桥接模式(1=启用) |
138
- | `CLAUDE_CHROME_HTTP_PORT` | HTTP 服务器端口(默认 12306) |
139
- | `ENABLE_TOOL_SEARCH` | 工具搜索模式:`tst`(默认)、`tst-auto`、`standard` |
140
- | `CLAUDE_CODE_EXTRA_BODY` | API 请求的额外 body 参数 |
189
+ 在项目根目录创建 `.claude/CLAUDE.md`,用于定义项目特定的指令和行为:
141
190
 
142
- ## 开启"宠物"功能
191
+ ```markdown
192
+ # 项目指令
143
193
 
144
- "宠物"(SprocketDudot)是 Ola-CC 的伴随功能。开启方式:
194
+ 你正在协助开发一个 Node.js 项目。请遵循以下规则:
145
195
 
146
- 1. **通过 session.json 配置**:
196
+ - 使用 TypeScript
197
+ - 遵循 ESLint 规范
198
+ - 编写单元测试
199
+ ```
147
200
 
148
- `~/.claude/session.json` 的 `env` 中添加:
201
+ ## OpenAI 协议支持
149
202
 
150
- ```json
151
- {
152
- "env": {
153
- "SPROCKET_DUDOT_ENABLED": "1"
154
- }
155
- }
156
- ```
203
+ 当设置 `CLAUDE_CODE_USE_OPENAI=1` 时,CLI 使用 OpenAI 兼容协议与 API 通信。
157
204
 
158
- 2. **通过环境变量**:
205
+ ### 支持的 API 端点
159
206
 
160
- 在启动 Ola-CC 前设置环境变量:
207
+ | 服务 | OPENAI_BASE_URL | 说明 |
208
+ |------|----------------|------|
209
+ | OpenAI 官方 | `https://api.openai.com/v1` | GPT-4o、o1 等 |
210
+ | 阿里云百炼 DashScope | `https://coding.dashscope.aliyuncs.com/v1` | 通义千问系列 |
211
+ | Ollama (本地) | `http://127.0.0.1:11434/v1` | 本地开源模型 |
212
+ | vLLM | `http://localhost:8000/v1` | 兼容 OpenAI 格式 |
161
213
 
162
- ```bash
163
- export SPROCKET_DUDOT_ENABLED=1
164
- ola-cc
165
- ```
214
+ ### 使用示例
166
215
 
167
- 3. **通过 settings.json 配置**:
216
+ ```bash
217
+ # OpenAI 官方 API
218
+ OPENAI_API_KEY="sk-xxx" OPENAI_BASE_URL="https://api.openai.com/v1" OPENAI_MODEL="gpt-4o" ola-cc
168
219
 
169
- `~/.claude/settings.json` 中添加:
220
+ # 阿里云百炼
221
+ OPENAI_API_KEY="your-key" OPENAI_BASE_URL="https://coding.dashscope.aliyuncs.com/v1" OPENAI_MODEL="qwen3.6-plus" ola-cc
170
222
 
171
- ```json
172
- {
173
- "sprocketDudot": {
174
- "enabled": true
175
- }
176
- }
177
- ```
223
+ # Ollama 本地模型
224
+ OPENAI_BASE_URL="http://127.0.0.1:11434/v1" OPENAI_MODEL="llama3.1" ola-cc
225
+ ```
226
+
227
+ ### 模型选择优先级
228
+
229
+ | 优先级 | 来源 |
230
+ |--------|------|
231
+ | 1 | `/model` 命令(会话中动态切换) |
232
+ | 2 | `--model` 启动参数 |
233
+ | 3 | `ANTHROPIC_MODEL` 环境变量 |
234
+ | 4 | `OPENAI_MODEL` 环境变量 |
235
+ | 5 | `~/.claude/settings.json` 中的 `model` 字段 |
236
+ | 6 | 内置默认值 |
237
+
238
+ ## 环境变量总览
239
+
240
+ | 变量 | 说明 |
241
+ |------|------|
242
+ | `OPENAI_API_KEY` | OpenAI API 密钥 |
243
+ | `OPENAI_BASE_URL` | OpenAI 兼容 API 基础 URL |
244
+ | `OPENAI_MODEL` | 模型名称 |
245
+ | `CLAUDE_CODE_USE_OPENAI` | 启用 OpenAI 协议(1=启用) |
246
+ | `ANTHROPIC_API_KEY` | Anthropic API 密钥(直连 Anthropic 时使用) |
247
+ | `CLAUDE_CODE_ENABLE_CFC` | 启用 Chrome 集成(1=启用) |
248
+ | `CLAUDE_CHROME_HTTP` | 启用 Chrome HTTP 桥接(1=启用) |
249
+ | `CLAUDE_CHROME_HTTP_PORT` | HTTP 桥接端口(默认 12306) |
250
+ | `CLAUDE_CODE_EXTRA_BODY` | API 请求的额外 body 参数 |
251
+ | `SPROCKET_DUDOT_ENABLED` | 开启宠物功能(1=启用) |
178
252
 
179
253
  ## Chrome 扩展(可选)
180
254
 
181
255
  浏览器自动化需要安装 Claude in Chrome 扩展:
182
256
 
183
- 1. Ola-CC 会自动安装原生主机清单
257
+ 1. Ola CC 会自动安装原生主机清单
184
258
  2. 从 Chrome 应用商店安装扩展
185
259
  3. 设置 `CLAUDE_CODE_ENABLE_CFC=1` 或使用 `--chrome` 参数
186
260
 
261
+ ## 构建
262
+
263
+ ```bash
264
+ # 构建包装器包
265
+ bun run build:bin:wrapper
266
+
267
+ # 构建平台二进制包(当前平台)
268
+ bun run build:bin:platform
269
+
270
+ # 完整构建(包装器 + 当前平台二进制)
271
+ bun run build:bin
272
+ ```
273
+
274
+ > **注意**:Windows 平台构建会使用 Node.js JS bundle 而非 Bun 编译二进制,以确保稳定性。
275
+
276
+ ## 故障排除
277
+
278
+ ### Windows 安装问题
279
+
280
+ 如果 Windows 安装后运行 `ola-cc` 出现问题:
281
+
282
+ **方案 1:检查 Node.js 版本**
283
+
284
+ 确保 Node.js >= 18:
285
+
286
+ ```bash
287
+ node --version
288
+ ```
289
+
290
+ **方案 2:手动启动 JS bundle**
291
+
292
+ 绕过 npm bin shim,直接运行 JS bundle:
293
+
294
+ ```bash
295
+ node "%APPDATA%\npm\node_modules\@zyzheal\ola-cc\cli.mjs"
296
+ ```
297
+
298
+ 或本地安装时:
299
+
300
+ ```bash
301
+ node node_modules/@zyzheal/ola-cc/cli.mjs
302
+ ```
303
+
304
+ **方案 3:使用降级启动器**
305
+
306
+ ```bash
307
+ node node_modules/@zyzheal/ola-cc/cli-wrapper.cjs
308
+ ```
309
+
310
+ ### macOS/Linux 原生二进制问题
311
+
312
+ 如果原生二进制无法运行:
313
+
314
+ ```bash
315
+ # 手动重新安装
316
+ cd node_modules/@zyzheal/ola-cc
317
+ node install.cjs
318
+ ```
319
+
187
320
  ## 许可证
188
321
 
189
322
  详见 LICENSE.md。
package/bin/ola-cc.js ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ 'use strict'
3
+ var path = require('path')
4
+ var fs = require('fs')
5
+ var childProcess = require('child_process')
6
+ var pkgDir = path.dirname(__dirname)
7
+ var binDir = path.join(pkgDir, 'bin')
8
+ var nativeBin = process.platform === 'win32' ? path.join(binDir, 'ola-cc.exe') : path.join(binDir, 'ola-cc')
9
+ if (fs.existsSync(nativeBin)) {
10
+ try { childProcess.execFileSync(nativeBin, process.argv.slice(2), { stdio: 'inherit' }); process.exit(0) }
11
+ catch (err) { if (err.code !== 'ENOENT') process.exit(err.status || 1) }
12
+ }
13
+ // Try JS bundle in the same bin directory (for JS bundle platforms like darwin-x64)
14
+ var localJs = path.join(binDir, 'cli.mjs')
15
+ if (fs.existsSync(localJs)) { childProcess.execFileSync(process.execPath, [localJs].concat(process.argv.slice(2)), { stdio: 'inherit' }); process.exit(0) }
16
+ // Fall back to JS bundle from optionalDependencies platform package
17
+ try {
18
+ var platKey = process.platform + '-' + process.arch
19
+ var platPkgName = '@zyzheal/ola-cc-' + platKey
20
+ var platPkg = require.resolve(platPkgName + '/package.json')
21
+ var platDir = path.dirname(platPkg)
22
+ // Try native binary from platform package first (postinstall may not have run)
23
+ var platBinFile = process.platform === 'win32' ? 'ola-cc.exe' : 'ola-cc'
24
+ var platBin = path.join(platDir, platBinFile)
25
+ if (fs.existsSync(platBin)) { childProcess.execFileSync(platBin, process.argv.slice(2), { stdio: 'inherit' }); process.exit(0) }
26
+ // Then JS bundle
27
+ var js = path.join(platDir, 'cli.mjs')
28
+ if (fs.existsSync(js)) { childProcess.execFileSync(process.execPath, [js].concat(process.argv.slice(2)), { stdio: 'inherit' }); process.exit(0) }
29
+ } catch (_) {}
30
+ console.error('Error: ola-cc not installed for this platform.')
31
+ process.exit(1)
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI wrapper — fallback bin entry when native binary is not installed.
4
+ * Delegates to cli.mjs (Node.js bundle) if available, otherwise prints error.
5
+ */
6
+
7
+ const { execSync } = require('child_process')
8
+ const { existsSync } = require('fs')
9
+ const { join, dirname } = require('path')
10
+
11
+ const pkgDir = dirname(require.resolve('./package.json'))
12
+ const cliMjs = join(pkgDir, 'cli.mjs')
13
+
14
+ if (existsSync(cliMjs)) {
15
+ // Re-spawn under Node.js to handle the ESM bundle
16
+ const node = process.execPath
17
+ try {
18
+ require('child_process').execFileSync(node, [cliMjs, ...process.argv.slice(2)], {
19
+ stdio: 'inherit',
20
+ env: { ...process.env },
21
+ })
22
+ process.exit(0)
23
+ } catch (err) {
24
+ process.exit(err.status || 1)
25
+ }
26
+ } else {
27
+ console.error('Error: ola-cc CLI bundle not found.')
28
+ console.error('Ensure the package was installed correctly: npm install @zyzheal/ola-cc')
29
+ process.exit(1)
30
+ }
package/install.cjs ADDED
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Postinstall script for the wrapper package.
4
+ *
5
+ * Detects the current platform and copies the native binary from the
6
+ * appropriate platform-specific optional dependency package.
7
+ *
8
+ * This is called automatically by npm during `npm install @zyzheal/ola-cc`.
9
+ */
10
+
11
+ const { existsSync, mkdirSync, cpSync, chmodSync } = require('fs')
12
+ const { join } = require('path')
13
+
14
+ const PACKAGE_NAME = '@zyzheal/ola-cc'
15
+
16
+ const PLATFORM_MAP = {
17
+ 'darwin-arm64': `${PACKAGE_NAME}-darwin-arm64`,
18
+ 'darwin-x64': `${PACKAGE_NAME}-darwin-x64`,
19
+ 'linux-x64': `${PACKAGE_NAME}-linux-x64`,
20
+ 'linux-arm64': `${PACKAGE_NAME}-linux-arm64`,
21
+ 'linux-x64-musl': `${PACKAGE_NAME}-linux-x64-musl`,
22
+ 'linux-arm64-musl': `${PACKAGE_NAME}-linux-arm64-musl`,
23
+ 'win32-x64': `${PACKAGE_NAME}-win32-x64`,
24
+ 'win32-arm64': `${PACKAGE_NAME}-win32-arm64`,
25
+ }
26
+
27
+ const pkgRoot = __dirname
28
+ const nodeModules = join(pkgRoot, '..', '..')
29
+ const binDir = join(pkgRoot, 'bin')
30
+
31
+ function detectPlatform() {
32
+ const platform = process.platform
33
+ const arch = process.arch
34
+
35
+ let isMusl = false
36
+ if (platform === 'linux') {
37
+ try {
38
+ const report = typeof process.report?.getReport === 'function'
39
+ ? process.report.getReport()
40
+ : null
41
+ isMusl = report != null && report.header?.glibcVersionRuntime === undefined
42
+ } catch {
43
+ try {
44
+ const ldd = require('child_process').execSync('ldd --version 2>&1', { encoding: 'utf8' })
45
+ isMusl = ldd.toLowerCase().includes('musl')
46
+ } catch {
47
+ // Assume glibc if we can't determine
48
+ }
49
+ }
50
+ }
51
+
52
+ return platform === 'linux'
53
+ ? `${platform}-${arch}${isMusl ? '-musl' : ''}`
54
+ : `${platform}-${arch}`
55
+ }
56
+
57
+ function main() {
58
+ const platformKey = detectPlatform()
59
+ const depName = PLATFORM_MAP[platformKey]
60
+
61
+ if (!depName) {
62
+ console.warn(`ola-cc: Unsupported platform ${process.platform} ${process.arch}.`)
63
+ return
64
+ }
65
+
66
+ const depPath = join(nodeModules, depName)
67
+
68
+ if (!existsSync(depPath)) {
69
+ console.warn(`ola-cc: Platform package ${depName} not installed.`)
70
+ return
71
+ }
72
+
73
+ const isWindows = process.platform === 'win32'
74
+ const binaryName = isWindows ? 'ola-cc.exe' : 'ola-cc'
75
+ const srcBinary = join(depPath, binaryName)
76
+
77
+ if (!existsSync(srcBinary)) {
78
+ // Fallback: JS bundle mode for platforms without native compilation (e.g. darwin-x64)
79
+ const jsBundle = join(depPath, 'cli.mjs')
80
+ if (existsSync(jsBundle)) {
81
+ mkdirSync(binDir, { recursive: true })
82
+ cpSync(jsBundle, join(binDir, 'cli.mjs'))
83
+ console.log(`ola-cc: Installed JS bundle (cli.mjs) for ${platformKey}`)
84
+ return
85
+ }
86
+ console.warn(`ola-cc: Binary not found at ${srcBinary}`)
87
+ return
88
+ }
89
+
90
+ mkdirSync(binDir, { recursive: true })
91
+ const destName = isWindows ? 'ola-cc.exe' : 'ola-cc'
92
+ const destBinary = join(binDir, destName)
93
+
94
+ cpSync(srcBinary, destBinary)
95
+ chmodSync(destBinary, 0o755)
96
+ console.log(`ola-cc: Installed native binary for ${platformKey}`)
97
+
98
+ // Copy vendor files if present (ripgrep, etc.)
99
+ const srcVendor = join(depPath, 'vendor')
100
+ if (existsSync(srcVendor)) {
101
+ const destVendor = join(pkgRoot, 'vendor')
102
+ try {
103
+ cpSync(srcVendor, destVendor, { recursive: true })
104
+ } catch {
105
+ // Best effort
106
+ }
107
+ }
108
+ }
109
+
110
+ try {
111
+ main()
112
+ } catch (err) {
113
+ console.error(`ola-cc postinstall error: ${err.message}`)
114
+ // Don't fail the install
115
+ process.exit(0)
116
+ }
package/package.json CHANGED
@@ -1,30 +1,39 @@
1
1
  {
2
2
  "name": "@zyzheal/ola-cc",
3
- "version": "0.1.2",
4
- "description": "Claude Code - AI coding assistant in your terminal",
3
+ "version": "0.3.12",
4
+ "description": "Ola CC - AI coding assistant in your terminal",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
- "type": "module",
6
+ "type": "commonjs",
7
7
  "bin": {
8
- "ola-cc": "./cli.js"
8
+ "ola-cc": "./bin/ola-cc.js"
9
+ },
10
+ "scripts": {
11
+ "postinstall": "node install.cjs",
12
+ "prepublishOnly": "node -e \"if (!process.env.AUTHORIZED) { console.error('ERROR: Direct publishing is not allowed.\\nPlease see the release workflow documentation to publish this package.'); process.exit(1); }\""
9
13
  },
10
14
  "repository": {
11
15
  "type": "git",
12
- "url": "https://github.com/anthropics/claude-code.git"
16
+ "url": "https://github.com/zyzheal/ola-cc.git"
13
17
  },
14
18
  "engines": {
15
- "bun": ">=1.3.5",
16
19
  "node": ">=18.0.0"
17
20
  },
18
- "dependencies": {
19
- "ws": "^8.18.0"
20
- },
21
+ "dependencies": {},
21
22
  "optionalDependencies": {
22
- "sharp": "*"
23
+ "@zyzheal/ola-cc-darwin-arm64": "0.3.12",
24
+ "@zyzheal/ola-cc-darwin-x64": "0.3.12",
25
+ "@zyzheal/ola-cc-linux-x64": "0.3.12",
26
+ "@zyzheal/ola-cc-linux-arm64": "0.3.12",
27
+ "@zyzheal/ola-cc-linux-x64-musl": "0.3.12",
28
+ "@zyzheal/ola-cc-linux-arm64-musl": "0.3.12",
29
+ "@zyzheal/ola-cc-win32-x64": "0.3.12",
30
+ "@zyzheal/ola-cc-win32-arm64": "0.3.12"
23
31
  },
24
32
  "files": [
25
- "cli.js",
33
+ "bin/ola-cc.js",
34
+ "install.cjs",
35
+ "cli-wrapper.cjs",
26
36
  "sdk-tools.d.ts",
27
- "vendor/",
28
37
  "README.md",
29
38
  "LICENSE.md"
30
39
  ]