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