@ak9024/openclaude 0.1.8
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 +29 -0
- package/README.md +291 -0
- package/bin/import-specifier.mjs +13 -0
- package/bin/import-specifier.test.mjs +13 -0
- package/bin/openclaude +32 -0
- package/dist/cli.mjs +558485 -0
- package/package.json +153 -0
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,291 @@
|
|
|
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, Ollama, Atomic Chat, and other supported backends while keeping one terminal-first workflow: prompts, tools, agents, MCP, slash commands, and streaming output.
|
|
6
|
+
|
|
7
|
+
[](https://github.com/Gitlawb/openclaude/actions/workflows/pr-checks.yml)
|
|
8
|
+
[](https://github.com/Gitlawb/openclaude/tags)
|
|
9
|
+
[](https://github.com/Gitlawb/openclaude/discussions)
|
|
10
|
+
[](SECURITY.md)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
|
|
13
|
+
[Quick Start](#quick-start) | [Setup Guides](#setup-guides) | [Providers](#supported-providers) | [Source Build](#source-build-and-local-development) | [VS Code Extension](#vs-code-extension) | [Community](#community)
|
|
14
|
+
|
|
15
|
+
## Why OpenClaude
|
|
16
|
+
|
|
17
|
+
- Use one CLI across cloud APIs and local model backends
|
|
18
|
+
- Save provider profiles inside the app with `/provider`
|
|
19
|
+
- Run with OpenAI-compatible services, Gemini, GitHub Models, Codex, Ollama, Atomic Chat, and other supported providers
|
|
20
|
+
- Keep coding-agent workflows in one place: bash, file tools, grep, glob, agents, tasks, MCP, and web tools
|
|
21
|
+
- Use the bundled VS Code extension for launch integration and theme support
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
### Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g @gitlawb/openclaude
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If the install later reports `ripgrep not found`, install ripgrep system-wide and confirm `rg --version` works in the same terminal before starting OpenClaude.
|
|
32
|
+
|
|
33
|
+
### Start
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
openclaude
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Inside OpenClaude:
|
|
40
|
+
|
|
41
|
+
- run `/provider` for guided provider setup and saved profiles
|
|
42
|
+
- run `/onboard-github` for GitHub Models onboarding
|
|
43
|
+
|
|
44
|
+
### Fastest OpenAI setup
|
|
45
|
+
|
|
46
|
+
macOS / Linux:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
export CLAUDE_CODE_USE_OPENAI=1
|
|
50
|
+
export OPENAI_API_KEY=sk-your-key-here
|
|
51
|
+
export OPENAI_MODEL=gpt-4o
|
|
52
|
+
|
|
53
|
+
openclaude
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Windows PowerShell:
|
|
57
|
+
|
|
58
|
+
```powershell
|
|
59
|
+
$env:CLAUDE_CODE_USE_OPENAI="1"
|
|
60
|
+
$env:OPENAI_API_KEY="sk-your-key-here"
|
|
61
|
+
$env:OPENAI_MODEL="gpt-4o"
|
|
62
|
+
|
|
63
|
+
openclaude
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Fastest local Ollama setup
|
|
67
|
+
|
|
68
|
+
macOS / Linux:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
export CLAUDE_CODE_USE_OPENAI=1
|
|
72
|
+
export OPENAI_BASE_URL=http://localhost:11434/v1
|
|
73
|
+
export OPENAI_MODEL=qwen2.5-coder:7b
|
|
74
|
+
|
|
75
|
+
openclaude
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Windows PowerShell:
|
|
79
|
+
|
|
80
|
+
```powershell
|
|
81
|
+
$env:CLAUDE_CODE_USE_OPENAI="1"
|
|
82
|
+
$env:OPENAI_BASE_URL="http://localhost:11434/v1"
|
|
83
|
+
$env:OPENAI_MODEL="qwen2.5-coder:7b"
|
|
84
|
+
|
|
85
|
+
openclaude
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Setup Guides
|
|
89
|
+
|
|
90
|
+
Beginner-friendly guides:
|
|
91
|
+
|
|
92
|
+
- [Non-Technical Setup](docs/non-technical-setup.md)
|
|
93
|
+
- [Windows Quick Start](docs/quick-start-windows.md)
|
|
94
|
+
- [macOS / Linux Quick Start](docs/quick-start-mac-linux.md)
|
|
95
|
+
|
|
96
|
+
Advanced and source-build guides:
|
|
97
|
+
|
|
98
|
+
- [Advanced Setup](docs/advanced-setup.md)
|
|
99
|
+
- [Android Install](ANDROID_INSTALL.md)
|
|
100
|
+
|
|
101
|
+
## Supported Providers
|
|
102
|
+
|
|
103
|
+
| Provider | Setup Path | Notes |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
| OpenAI-compatible | `/provider` or env vars | Works with OpenAI, OpenRouter, DeepSeek, Groq, Mistral, LM Studio, and other compatible `/v1` servers |
|
|
106
|
+
| Gemini | `/provider` or env vars | Supports API key, access token, or local ADC workflow on current `main` |
|
|
107
|
+
| GitHub Models | `/onboard-github` | Interactive onboarding with saved credentials |
|
|
108
|
+
| Codex | `/provider` | Uses existing Codex credentials when available |
|
|
109
|
+
| Ollama | `/provider` or env vars | Local inference with no API key |
|
|
110
|
+
| Atomic Chat | advanced setup | Local Apple Silicon backend |
|
|
111
|
+
| Bedrock / Vertex / Foundry | env vars | Additional provider integrations for supported environments |
|
|
112
|
+
|
|
113
|
+
## What Works
|
|
114
|
+
|
|
115
|
+
- **Tool-driven coding workflows**: Bash, file read/write/edit, grep, glob, agents, tasks, MCP, and slash commands
|
|
116
|
+
- **Streaming responses**: Real-time token output and tool progress
|
|
117
|
+
- **Tool calling**: Multi-step tool loops with model calls, tool execution, and follow-up responses
|
|
118
|
+
- **Images**: URL and base64 image inputs for providers that support vision
|
|
119
|
+
- **Provider profiles**: Guided setup plus saved `.openclaude-profile.json` support
|
|
120
|
+
- **Local and remote model backends**: Cloud APIs, local servers, and Apple Silicon local inference
|
|
121
|
+
|
|
122
|
+
## Provider Notes
|
|
123
|
+
|
|
124
|
+
OpenClaude supports multiple providers, but behavior is not identical across all of them.
|
|
125
|
+
|
|
126
|
+
- Anthropic-specific features may not exist on other providers
|
|
127
|
+
- Tool quality depends heavily on the selected model
|
|
128
|
+
- Smaller local models can struggle with long multi-step tool flows
|
|
129
|
+
- Some providers impose lower output caps than the CLI defaults, and OpenClaude adapts where possible
|
|
130
|
+
|
|
131
|
+
For best results, use models with strong tool/function calling support.
|
|
132
|
+
|
|
133
|
+
## Agent Routing
|
|
134
|
+
|
|
135
|
+
OpenClaude can route different agents to different models through settings-based routing. This is useful for cost optimization or splitting work by model strength.
|
|
136
|
+
|
|
137
|
+
Add to `~/.claude/settings.json`:
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"agentModels": {
|
|
142
|
+
"deepseek-chat": {
|
|
143
|
+
"base_url": "https://api.deepseek.com/v1",
|
|
144
|
+
"api_key": "sk-your-key"
|
|
145
|
+
},
|
|
146
|
+
"gpt-4o": {
|
|
147
|
+
"base_url": "https://api.openai.com/v1",
|
|
148
|
+
"api_key": "sk-your-key"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"agentRouting": {
|
|
152
|
+
"Explore": "deepseek-chat",
|
|
153
|
+
"Plan": "gpt-4o",
|
|
154
|
+
"general-purpose": "gpt-4o",
|
|
155
|
+
"frontend-dev": "deepseek-chat",
|
|
156
|
+
"default": "gpt-4o"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
When no routing match is found, the global provider remains the fallback.
|
|
162
|
+
|
|
163
|
+
> **Note:** `api_key` values in `settings.json` are stored in plaintext. Keep this file private and do not commit it to version control.
|
|
164
|
+
|
|
165
|
+
## Web Search and Fetch
|
|
166
|
+
|
|
167
|
+
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.
|
|
168
|
+
|
|
169
|
+
> **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.
|
|
170
|
+
|
|
171
|
+
For Anthropic-native backends and Codex responses, OpenClaude keeps the native provider web search behavior.
|
|
172
|
+
|
|
173
|
+
`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.
|
|
174
|
+
|
|
175
|
+
Set a [Firecrawl](https://firecrawl.dev) API key if you want Firecrawl-powered search/fetch behavior:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
export FIRECRAWL_API_KEY=your-key-here
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
With Firecrawl enabled:
|
|
182
|
+
|
|
183
|
+
- `WebSearch` can use Firecrawl's search API while DuckDuckGo remains the default free path for non-Claude models
|
|
184
|
+
- `WebFetch` uses Firecrawl's scrape endpoint instead of raw HTTP, handling JS-rendered pages correctly
|
|
185
|
+
|
|
186
|
+
Free tier at [firecrawl.dev](https://firecrawl.dev) includes 500 credits. The key is optional.
|
|
187
|
+
|
|
188
|
+
## Source Build And Local Development
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
bun install
|
|
192
|
+
bun run build
|
|
193
|
+
node dist/cli.mjs
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Helpful commands:
|
|
197
|
+
|
|
198
|
+
- `bun run dev`
|
|
199
|
+
- `bun test`
|
|
200
|
+
- `bun run test:coverage`
|
|
201
|
+
- `bun run smoke`
|
|
202
|
+
- `bun run doctor:runtime`
|
|
203
|
+
- `bun run verify:privacy`
|
|
204
|
+
- focused `bun test ...` runs for the areas you touch
|
|
205
|
+
|
|
206
|
+
## Testing And Coverage
|
|
207
|
+
|
|
208
|
+
OpenClaude uses Bun's built-in test runner for unit tests.
|
|
209
|
+
|
|
210
|
+
Run the full unit suite:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
bun test
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Generate unit test coverage:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
bun run test:coverage
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Open the visual coverage report:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
open coverage/index.html
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
If you already have `coverage/lcov.info` and only want to rebuild the UI:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
bun run test:coverage:ui
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Use focused test runs when you only touch one area:
|
|
235
|
+
|
|
236
|
+
- `bun run test:provider`
|
|
237
|
+
- `bun run test:provider-recommendation`
|
|
238
|
+
- `bun test path/to/file.test.ts`
|
|
239
|
+
|
|
240
|
+
Recommended contributor validation before opening a PR:
|
|
241
|
+
|
|
242
|
+
- `bun run build`
|
|
243
|
+
- `bun run smoke`
|
|
244
|
+
- `bun run test:coverage` for broader unit coverage when your change affects shared runtime or provider logic
|
|
245
|
+
- focused `bun test ...` runs for the files and flows you changed
|
|
246
|
+
|
|
247
|
+
Coverage output is written to `coverage/lcov.info`, and OpenClaude also generates a git-activity-style heatmap at `coverage/index.html`.
|
|
248
|
+
|
|
249
|
+
## Repository Structure
|
|
250
|
+
|
|
251
|
+
- `src/` - core CLI/runtime
|
|
252
|
+
- `scripts/` - build, verification, and maintenance scripts
|
|
253
|
+
- `docs/` - setup, contributor, and project documentation
|
|
254
|
+
- `python/` - standalone Python helpers and their tests
|
|
255
|
+
- `vscode-extension/openclaude-vscode/` - VS Code extension
|
|
256
|
+
- `.github/` - repo automation, templates, and CI configuration
|
|
257
|
+
- `bin/` - CLI launcher entrypoints
|
|
258
|
+
|
|
259
|
+
## VS Code Extension
|
|
260
|
+
|
|
261
|
+
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.
|
|
262
|
+
|
|
263
|
+
## Security
|
|
264
|
+
|
|
265
|
+
If you believe you found a security issue, see [SECURITY.md](SECURITY.md).
|
|
266
|
+
|
|
267
|
+
## Community
|
|
268
|
+
|
|
269
|
+
- Use [GitHub Discussions](https://github.com/Gitlawb/openclaude/discussions) for Q&A, ideas, and community conversation
|
|
270
|
+
- Use [GitHub Issues](https://github.com/Gitlawb/openclaude/issues) for confirmed bugs and actionable feature work
|
|
271
|
+
|
|
272
|
+
## Contributing
|
|
273
|
+
|
|
274
|
+
Contributions are welcome.
|
|
275
|
+
|
|
276
|
+
For larger changes, open an issue first so the scope is clear before implementation. Helpful validation commands include:
|
|
277
|
+
|
|
278
|
+
- `bun run build`
|
|
279
|
+
- `bun run test:coverage`
|
|
280
|
+
- `bun run smoke`
|
|
281
|
+
- focused `bun test ...` runs for touched areas
|
|
282
|
+
|
|
283
|
+
## Disclaimer
|
|
284
|
+
|
|
285
|
+
OpenClaude is an independent community project and is not affiliated with, endorsed by, or sponsored by Anthropic.
|
|
286
|
+
|
|
287
|
+
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.
|
|
288
|
+
|
|
289
|
+
## License
|
|
290
|
+
|
|
291
|
+
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
|
+
}
|