@makerbi/openclaude 0.13.0

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/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ NOTICE
2
+
3
+ This repository contains code derived from Anthropic's Claude Code CLI.
4
+
5
+ The original Claude Code source is proprietary software:
6
+ Copyright (c) Anthropic PBC. All rights reserved.
7
+ Subject to Anthropic's Commercial Terms of Service.
8
+
9
+ Modifications and additions by OpenClaude contributors are offered under
10
+ the MIT License where legally permissible:
11
+
12
+ MIT License
13
+ Copyright (c) 2026 OpenClaude contributors (modifications only)
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining
16
+ a copy of the modifications made by OpenClaude contributors, to deal
17
+ in those modifications without restriction, including without limitation
18
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
19
+ and/or sell copies, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included
22
+ in all copies or substantial portions of the modifications.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
25
+
26
+ The underlying derived code remains subject to Anthropic's copyright.
27
+ This project does not have Anthropic's authorization to distribute
28
+ their proprietary source. Users and contributors should evaluate their
29
+ own legal position.
package/README.md ADDED
@@ -0,0 +1,373 @@
1
+ # OpenClaude
2
+
3
+ OpenClaude is an open-source coding-agent CLI for cloud and local model providers.
4
+
5
+ Use OpenAI-compatible APIs, Gemini, GitHub Models, Codex OAuth, Codex, Ollama, Atomic Chat, and other supported backends while keeping one terminal-first workflow: prompts, tools, agents, MCP, slash commands, and streaming output.
6
+
7
+ [![PR Checks](https://github.com/Gitlawb/openclaude/actions/workflows/pr-checks.yml/badge.svg?branch=main)](https://github.com/Gitlawb/openclaude/actions/workflows/pr-checks.yml)
8
+ [![Release](https://img.shields.io/github/v/tag/Gitlawb/openclaude?label=release&color=0ea5e9)](https://github.com/Gitlawb/openclaude/tags)
9
+ [![Discussions](https://img.shields.io/badge/discussions-open-7c3aed)](https://github.com/Gitlawb/openclaude/discussions)
10
+ [![Security Policy](https://img.shields.io/badge/security-policy-0f766e)](SECURITY.md)
11
+ [![License](https://img.shields.io/badge/license-MIT-2563eb)](LICENSE)
12
+
13
+ OpenClaude is also mirrored to GitLawb:
14
+ [gitlawb.com/node/repos/z6MkqDnb/openclaude](https://gitlawb.com/node/repos/z6MkqDnb/openclaude)
15
+
16
+ [Quick Start](#quick-start) | [Setup Guides](#setup-guides) | [Providers](#supported-providers) | [Source Build](#source-build-and-local-development) | [VS Code Extension](#vs-code-extension) | [Sponsors](#sponsors) | [Community](#community)
17
+
18
+ ## Sponsors
19
+
20
+ <table align="center">
21
+ <tr>
22
+ <td align="center" width="150" height="80">
23
+ <a href="https://gitlawb.com">
24
+ <img src="https://gitlawb.com/logo.png" alt="GitLawb logo" width="72">
25
+ </a>
26
+ </td>
27
+ <td align="center" width="150" height="80">
28
+ <a href="https://bankr.bot">
29
+ <img src="https://bankr.bot/favicon.svg" alt="Bankr.bot logo" width="72">
30
+ </a>
31
+ </td>
32
+ <td align="center" width="150" height="80">
33
+ <a href="https://atomic.chat/">
34
+ <img src="docs/assets/atomic-chat-logo.png" alt="Atomic Chat logo" width="72">
35
+ </a>
36
+ </td>
37
+ <td align="center" width="150" height="80">
38
+ <a href="https://api.xiaomimimo.com/v1">
39
+ <img src="https://mimo.xiaomi.com/mimo-v2-pro/assets/logo.svg" alt="Xiaomi MiMo logo" width="136">
40
+ </a>
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <td align="center"><a href="https://gitlawb.com"><strong>GitLawb</strong></a></td>
45
+ <td align="center"><a href="https://bankr.bot"><strong>Bankr.bot</strong></a></td>
46
+ <td align="center"><a href="https://atomic.chat/"><strong>Atomic Chat</strong></a></td>
47
+ <td align="center"><a href="https://api.xiaomimimo.com/v1"><strong>Xiaomi MiMo</strong></a></td>
48
+ </tr>
49
+ </table>
50
+
51
+ ## Star History
52
+
53
+ [![Star History Chart](https://api.star-history.com/chart?repos=gitlawb/openclaude&type=date&legend=top-left)](https://www.star-history.com/?repos=gitlawb%2Fopenclaude&type=date&legend=top-left)
54
+
55
+ ## Why OpenClaude
56
+
57
+ - Use one CLI across cloud APIs and local model backends
58
+ - Save provider profiles inside the app with `/provider`
59
+ - Run with OpenAI-compatible services, Gemini, GitHub Models, Codex OAuth, Codex, Ollama, Atomic Chat, and other supported providers
60
+ - Keep coding-agent workflows in one place: bash, file tools, grep, glob, agents, tasks, MCP, and web tools
61
+ - Use the bundled VS Code extension for launch integration and theme support
62
+
63
+ ## Quick Start
64
+
65
+ ### Install
66
+
67
+ ```bash
68
+ npm install -g @gitlawb/openclaude
69
+ ```
70
+
71
+ If the install later reports `ripgrep not found`, install ripgrep system-wide and confirm `rg --version` works in the same terminal before starting OpenClaude.
72
+
73
+ ### Start
74
+
75
+ ```bash
76
+ openclaude
77
+ ```
78
+
79
+ Inside OpenClaude:
80
+
81
+ - run `/provider` for guided provider setup and saved profiles
82
+ - run `/onboard-github` for GitHub Models onboarding
83
+
84
+ ### Fastest OpenAI setup
85
+
86
+ macOS / Linux:
87
+
88
+ ```bash
89
+ export CLAUDE_CODE_USE_OPENAI=1
90
+ export OPENAI_API_KEY=sk-your-key-here
91
+ export OPENAI_MODEL=gpt-4o
92
+
93
+ openclaude
94
+ ```
95
+
96
+ Windows PowerShell:
97
+
98
+ ```powershell
99
+ $env:CLAUDE_CODE_USE_OPENAI="1"
100
+ $env:OPENAI_API_KEY="sk-your-key-here"
101
+ $env:OPENAI_MODEL="gpt-4o"
102
+
103
+ openclaude
104
+ ```
105
+
106
+ ### Fastest local Ollama setup
107
+
108
+ macOS / Linux:
109
+
110
+ ```bash
111
+ export CLAUDE_CODE_USE_OPENAI=1
112
+ export OPENAI_BASE_URL=http://localhost:11434/v1
113
+ export OPENAI_MODEL=qwen2.5-coder:7b
114
+
115
+ openclaude
116
+ ```
117
+
118
+ Windows PowerShell:
119
+
120
+ ```powershell
121
+ $env:CLAUDE_CODE_USE_OPENAI="1"
122
+ $env:OPENAI_BASE_URL="http://localhost:11434/v1"
123
+ $env:OPENAI_MODEL="qwen2.5-coder:7b"
124
+
125
+ openclaude
126
+ ```
127
+
128
+ ## Setup Guides
129
+
130
+ Beginner-friendly guides:
131
+
132
+ - [Non-Technical Setup](docs/non-technical-setup.md)
133
+ - [Windows Quick Start](docs/quick-start-windows.md)
134
+ - [macOS / Linux Quick Start](docs/quick-start-mac-linux.md)
135
+
136
+ Advanced and source-build guides:
137
+
138
+ - [Advanced Setup](docs/advanced-setup.md)
139
+ - [Android Install](ANDROID_INSTALL.md)
140
+
141
+ ## Supported Providers
142
+
143
+ | Provider | Setup Path | Notes |
144
+ | --- | --- | --- |
145
+ | OpenAI-compatible | `/provider` or env vars | Works with OpenAI, OpenRouter, DeepSeek, Groq, Mistral, LM Studio, and other compatible `/v1` servers |
146
+ | Hicap | `/provider` or OpenAI-compatible env vars | Uses `api-key` auth, discovers models from unauthenticated `/models`, and supports Responses mode for `gpt-` models |
147
+ | Gemini | `/provider` or env vars | Supports API key only |
148
+ | GitHub Models | `/onboard-github` | Interactive onboarding with saved credentials |
149
+ | Codex OAuth | `/provider` | Opens ChatGPT sign-in in your browser and stores Codex credentials securely |
150
+ | Codex | `/provider` | Uses existing Codex CLI auth, OpenClaude secure storage, or env credentials |
151
+ | Gitlawb Opengateway | `/provider` or zero-config fallback | Free smart gateway at `https://opengateway.gitlawb.com/v1`; routes Xiaomi MiMo and GMI Cloud partner models by `OPENAI_MODEL` |
152
+ | Xiaomi MiMo | `/provider` or env vars | OpenAI-compatible API at `https://api.xiaomimimo.com/v1`; uses `MIMO_API_KEY` and defaults to `mimo-v2.5-pro` |
153
+ | Ollama | `/provider` or env vars | Local inference with no API key |
154
+ | Atomic Chat | `/provider`, env vars, or `bun run dev:atomic-chat` | Local Model Provider; auto-detects loaded models |
155
+ | Bedrock / Vertex / Foundry | env vars | Additional provider integrations for supported environments |
156
+
157
+ ## What Works
158
+
159
+ - **Tool-driven coding workflows**: Bash, file read/write/edit, grep, glob, agents, tasks, MCP, and slash commands
160
+ - **Streaming responses**: Real-time token output and tool progress
161
+ - **Tool calling**: Multi-step tool loops with model calls, tool execution, and follow-up responses
162
+ - **Images**: URL and base64 image inputs for providers that support vision
163
+ - **Provider profiles**: Guided setup plus saved user-level provider profile support
164
+ - **Local and remote model backends**: Cloud APIs, local servers, and Apple Silicon local inference
165
+
166
+ ## Provider Notes
167
+
168
+ OpenClaude supports multiple providers, but behavior is not identical across all of them.
169
+
170
+ - Anthropic-specific features may not exist on other providers
171
+ - Tool quality depends heavily on the selected model
172
+ - Smaller local models can struggle with long multi-step tool flows
173
+ - Some providers impose lower output caps than the CLI defaults, and OpenClaude adapts where possible
174
+ - Gitlawb Opengateway uses one OpenAI-compatible base URL. Switch between `mimo-*` and `google/gemini-3.1-flash-lite-preview` with `/model`; do not pin the base URL to `/v1/xiaomi-mimo`.
175
+ - Xiaomi MiMo uses `api-key` header auth on the direct OpenAI-compatible route and currently does not support `/usage` reporting in OpenClaude
176
+
177
+ For best results, use models with strong tool/function calling support.
178
+
179
+ ## Agent Routing
180
+
181
+ OpenClaude can route different agents to different models through settings-based routing. This is useful for cost optimization or splitting work by model strength.
182
+
183
+ Add to `~/.openclaude.json`:
184
+
185
+ ```json
186
+ {
187
+ "agentModels": {
188
+ "deepseek-v4-flash": {
189
+ "base_url": "https://api.deepseek.com/v1",
190
+ "api_key": "sk-your-key"
191
+ },
192
+ "gpt-4o": {
193
+ "base_url": "https://api.openai.com/v1",
194
+ "api_key": "sk-your-key"
195
+ }
196
+ },
197
+ "agentRouting": {
198
+ "Explore": "deepseek-v4-flash",
199
+ "Plan": "gpt-4o",
200
+ "general-purpose": "gpt-4o",
201
+ "frontend-dev": "deepseek-v4-flash",
202
+ "default": "gpt-4o"
203
+ }
204
+ }
205
+ ```
206
+
207
+ When no routing match is found, the global provider remains the fallback.
208
+
209
+ > **Note:** `api_key` values in `settings.json` are stored in plaintext. Keep this file private and do not commit it to version control.
210
+
211
+ ## Web Search and Fetch
212
+
213
+ By default, `WebSearch` works on non-Anthropic models using DuckDuckGo. This gives GPT-4o, DeepSeek, Gemini, Ollama, and other OpenAI-compatible providers a free web search path out of the box.
214
+
215
+ > **Note:** DuckDuckGo fallback works by scraping search results and may be rate-limited, blocked, or subject to DuckDuckGo's Terms of Service. If you want a more reliable supported option, configure Firecrawl.
216
+
217
+ For Anthropic-native backends and Codex responses, OpenClaude keeps the native provider web search behavior.
218
+
219
+ `WebFetch` works, but its basic HTTP plus HTML-to-markdown path can still fail on JavaScript-rendered sites or sites that block plain HTTP requests.
220
+
221
+ Set a [Firecrawl](https://firecrawl.dev) API key if you want Firecrawl-powered search/fetch behavior:
222
+
223
+ ```bash
224
+ export FIRECRAWL_API_KEY=your-key-here
225
+ ```
226
+
227
+ With Firecrawl enabled:
228
+
229
+ - `WebSearch` can use Firecrawl's search API while DuckDuckGo remains the default free path for non-Claude models
230
+ - `WebFetch` uses Firecrawl's scrape endpoint instead of raw HTTP, handling JS-rendered pages correctly
231
+
232
+ Free tier at [firecrawl.dev](https://firecrawl.dev) includes 500 credits. The key is optional.
233
+
234
+ ---
235
+
236
+ ## Headless gRPC Server
237
+
238
+ OpenClaude can be run as a headless gRPC service, allowing you to integrate its agentic capabilities (tools, bash, file editing) into other applications, CI/CD pipelines, or custom user interfaces. The server uses bidirectional streaming to send real-time text chunks, tool calls, and request permissions for sensitive commands.
239
+
240
+ ### 1. Start the gRPC Server
241
+
242
+ Start the core engine as a gRPC service on `localhost:50051`:
243
+
244
+ ```bash
245
+ npm run dev:grpc
246
+ ```
247
+
248
+ #### Configuration
249
+
250
+ | Variable | Default | Description |
251
+ |-----------|-------------|------------------------------------------------|
252
+ | `GRPC_PORT` | `50051` | Port the gRPC server listens on |
253
+ | `GRPC_HOST` | `localhost` | Bind address. Use `0.0.0.0` to expose on all interfaces (not recommended without authentication) |
254
+
255
+ ### 2. Run the Test CLI Client
256
+
257
+ We provide a lightweight CLI client that communicates exclusively over gRPC. It acts just like the main interactive CLI, rendering colors, streaming tokens, and prompting you for tool permissions (y/n) via the gRPC `action_required` event.
258
+
259
+ In a separate terminal, run:
260
+
261
+ ```bash
262
+ npm run dev:grpc:cli
263
+ ```
264
+
265
+ *Note: The gRPC definitions are located in `src/proto/openclaude.proto`. You can use this file to generate clients in Python, Go, Rust, or any other language.*
266
+
267
+ ---
268
+
269
+ ## Source Build And Local Development
270
+
271
+ ```bash
272
+ bun install
273
+ bun run build
274
+ node dist/cli.mjs
275
+ ```
276
+
277
+ Helpful commands:
278
+
279
+ - `bun run dev`
280
+ - `bun test`
281
+ - `bun run test:coverage`
282
+ - `bun run security:pr-scan -- --base origin/main`
283
+ - `bun run smoke`
284
+ - `bun run doctor:runtime`
285
+ - `bun run verify:privacy`
286
+ - focused `bun test ...` runs for the areas you touch
287
+
288
+ ## Testing And Coverage
289
+
290
+ OpenClaude uses Bun's built-in test runner for unit tests.
291
+
292
+ Run the full unit suite:
293
+
294
+ ```bash
295
+ bun test
296
+ ```
297
+
298
+ Generate unit test coverage:
299
+
300
+ ```bash
301
+ bun run test:coverage
302
+ ```
303
+
304
+ Open the visual coverage report:
305
+
306
+ ```bash
307
+ open coverage/index.html
308
+ ```
309
+
310
+ If you already have `coverage/lcov.info` and only want to rebuild the UI:
311
+
312
+ ```bash
313
+ bun run test:coverage:ui
314
+ ```
315
+
316
+ Use focused test runs when you only touch one area:
317
+
318
+ - `bun run test:provider`
319
+ - `bun run test:provider-recommendation`
320
+ - `bun test path/to/file.test.ts`
321
+
322
+ Recommended contributor validation before opening a PR:
323
+
324
+ - `bun run build`
325
+ - `bun run smoke`
326
+ - `bun run test:coverage` for broader unit coverage when your change affects shared runtime or provider logic
327
+ - focused `bun test ...` runs for the files and flows you changed
328
+
329
+ Coverage output is written to `coverage/lcov.info`, and OpenClaude also generates a git-activity-style heatmap at `coverage/index.html`.
330
+ ## Repository Structure
331
+
332
+ - `src/` - core CLI/runtime
333
+ - `scripts/` - build, verification, and maintenance scripts
334
+ - `docs/` - setup, contributor, and project documentation
335
+ - `python/` - standalone Python helpers and their tests
336
+ - `vscode-extension/openclaude-vscode/` - VS Code extension
337
+ - `.github/` - repo automation, templates, and CI configuration
338
+ - `bin/` - CLI launcher entrypoints
339
+
340
+ ## VS Code Extension
341
+
342
+ The repo includes a VS Code extension in [`vscode-extension/openclaude-vscode`](vscode-extension/openclaude-vscode) for OpenClaude launch integration, provider-aware control-center UI, and theme support.
343
+
344
+ ## Security
345
+
346
+ If you believe you found a security issue, see [SECURITY.md](SECURITY.md).
347
+
348
+ ## Community
349
+
350
+ - Use [GitHub Discussions](https://github.com/Gitlawb/openclaude/discussions) for Q&A, ideas, and community conversation
351
+ - Use [GitHub Issues](https://github.com/Gitlawb/openclaude/issues) for confirmed bugs and actionable feature work
352
+
353
+ ## Contributing
354
+
355
+ Contributions are welcome.
356
+
357
+ For larger changes, open an issue first so the scope is clear before implementation. Helpful validation commands include:
358
+
359
+ - `bun run build`
360
+ - `bun run test:coverage`
361
+ - `bun run smoke`
362
+ - focused `bun test ...` runs for files and flows you changed
363
+
364
+
365
+ ## Disclaimer
366
+
367
+ OpenClaude is an independent community project and is not affiliated with, endorsed by, or sponsored by Anthropic.
368
+
369
+ OpenClaude originated from the Claude Code codebase and has since been substantially modified to support multiple providers and open use. "Claude" and "Claude Code" are trademarks of Anthropic PBC. See [LICENSE](LICENSE) for details.
370
+
371
+ ## License
372
+
373
+ See [LICENSE](LICENSE).
@@ -0,0 +1,13 @@
1
+ import { join, win32 } from 'path'
2
+ import { pathToFileURL } from 'url'
3
+
4
+ export function getDistImportSpecifier(baseDir) {
5
+ if (/^[A-Za-z]:\\/.test(baseDir)) {
6
+ const distPath = win32.join(baseDir, '..', 'dist', 'cli.mjs')
7
+ return `file:///${distPath.replace(/\\/g, '/')}`
8
+ }
9
+
10
+ const joinImpl = join
11
+ const distPath = joinImpl(baseDir, '..', 'dist', 'cli.mjs')
12
+ return pathToFileURL(distPath).href
13
+ }
@@ -0,0 +1,13 @@
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
3
+
4
+ import { getDistImportSpecifier } from './import-specifier.mjs'
5
+
6
+ test('builds a file URL import specifier for dist/cli.mjs', () => {
7
+ const specifier = getDistImportSpecifier('C:\\repo\\bin')
8
+
9
+ assert.equal(
10
+ specifier,
11
+ 'file:///C:/repo/dist/cli.mjs',
12
+ )
13
+ })
package/bin/openclaude ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * OpenClaude — Claude Code with any LLM
5
+ *
6
+ * If dist/cli.mjs exists (built), run that.
7
+ * Otherwise, tell the user to build first or use `bun run dev`.
8
+ */
9
+
10
+ import { existsSync } from 'fs'
11
+ import { join, dirname } from 'path'
12
+ import { fileURLToPath, pathToFileURL } from 'url'
13
+
14
+ const __dirname = dirname(fileURLToPath(import.meta.url))
15
+ const distPath = join(__dirname, '..', 'dist', 'cli.mjs')
16
+
17
+ if (existsSync(distPath)) {
18
+ await import(pathToFileURL(distPath).href)
19
+ } else {
20
+ console.error(`
21
+ openclaude: dist/cli.mjs not found.
22
+
23
+ Build first:
24
+ bun run build
25
+
26
+ Or run directly with Bun:
27
+ bun run dev
28
+
29
+ See README.md for setup instructions.
30
+ `)
31
+ process.exit(1)
32
+ }