@gaburieuru/claudio 0.24.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 +29 -0
- package/README.md +424 -0
- package/bin/claudio +124 -0
- package/bin/import-specifier.mjs +13 -0
- package/bin/import-specifier.test.mjs +13 -0
- package/bin/openclaude +124 -0
- package/dist/cli.mjs +11188 -0
- package/dist/sdk.mjs +274613 -0
- package/docs/windows-aliases-and-launchers.md +162 -0
- package/package.json +211 -0
- package/scripts/windows/openclaude-aliases.ps1 +206 -0
- package/src/entrypoints/sdk/coreTypes.generated.ts +2385 -0
- package/src/entrypoints/sdk.d.ts +601 -0
- package/vendor/node-domexception-shim/index.js +3 -0
- package/vendor/node-domexception-shim/package.json +8 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Windows aliases and launchers
|
|
2
|
+
|
|
3
|
+
This page documents optional PowerShell helper functions for launching Claudio on Windows after a global npm install.
|
|
4
|
+
|
|
5
|
+
These helpers are designed for the installed package workflow:
|
|
6
|
+
|
|
7
|
+
~~~powershell
|
|
8
|
+
npm install -g @gitlawb/openclaude
|
|
9
|
+
~~~
|
|
10
|
+
|
|
11
|
+
The helpers use the installed `openclaude` CLI command. They do not require a source checkout and do not call source-only `bun run scripts/*.ts` entrypoints.
|
|
12
|
+
|
|
13
|
+
## One-time setup
|
|
14
|
+
|
|
15
|
+
Run this once in PowerShell:
|
|
16
|
+
|
|
17
|
+
~~~powershell
|
|
18
|
+
$packageRoot = Join-Path (npm root -g) "@gitlawb/openclaude"
|
|
19
|
+
$aliases = Join-Path $packageRoot "scripts\windows\openclaude-aliases.ps1"
|
|
20
|
+
|
|
21
|
+
if (-not (Test-Path $aliases)) {
|
|
22
|
+
throw "Alias script not found at $aliases. Update or reinstall @gitlawb/openclaude."
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (-not (Test-Path $PROFILE)) {
|
|
26
|
+
New-Item -ItemType File -Path $PROFILE -Force | Out-Null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
$profileLine = ". `"$aliases`""
|
|
30
|
+
|
|
31
|
+
if (-not (Select-String -Path $PROFILE -Pattern ([regex]::Escape($profileLine)) -Quiet)) {
|
|
32
|
+
Add-Content -Path $PROFILE -Value "`n$profileLine"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
. $aliases
|
|
36
|
+
oc-help
|
|
37
|
+
~~~
|
|
38
|
+
|
|
39
|
+
Open a new PowerShell window after setup, or dot-source the profile:
|
|
40
|
+
|
|
41
|
+
~~~powershell
|
|
42
|
+
. $PROFILE
|
|
43
|
+
~~~
|
|
44
|
+
|
|
45
|
+
## Daily commands
|
|
46
|
+
|
|
47
|
+
### Launch Claudio using the installed CLI
|
|
48
|
+
|
|
49
|
+
~~~powershell
|
|
50
|
+
oc
|
|
51
|
+
~~~
|
|
52
|
+
|
|
53
|
+
You can pass normal CLI arguments through `oc`:
|
|
54
|
+
|
|
55
|
+
~~~powershell
|
|
56
|
+
oc --version
|
|
57
|
+
oc --help
|
|
58
|
+
~~~
|
|
59
|
+
|
|
60
|
+
### Launch with local Ollama/OpenAI-compatible environment hints
|
|
61
|
+
|
|
62
|
+
~~~powershell
|
|
63
|
+
oc-local
|
|
64
|
+
~~~
|
|
65
|
+
|
|
66
|
+
By default, this uses local Ollama through the OpenAI-compatible API:
|
|
67
|
+
|
|
68
|
+
~~~text
|
|
69
|
+
CLAUDE_CODE_USE_OPENAI=1
|
|
70
|
+
OPENAI_BASE_URL=http://localhost:11434/v1
|
|
71
|
+
OPENAI_MODEL=llama3.1:8b
|
|
72
|
+
~~~
|
|
73
|
+
|
|
74
|
+
To use a different local model for that invocation:
|
|
75
|
+
|
|
76
|
+
~~~powershell
|
|
77
|
+
oc-local -Model "qwen2.5-coder:7b"
|
|
78
|
+
~~~
|
|
79
|
+
|
|
80
|
+
The environment overrides are scoped to that single `openclaude` invocation. A later plain `oc` call returns to normal installed CLI behavior and saved-provider-profile behavior.
|
|
81
|
+
|
|
82
|
+
### Launch with low-latency local defaults
|
|
83
|
+
|
|
84
|
+
~~~powershell
|
|
85
|
+
oc-fast
|
|
86
|
+
~~~
|
|
87
|
+
|
|
88
|
+
To use a different model:
|
|
89
|
+
|
|
90
|
+
~~~powershell
|
|
91
|
+
oc-fast -Model "qwen2.5-coder:7b"
|
|
92
|
+
~~~
|
|
93
|
+
|
|
94
|
+
Like `oc-local`, the environment overrides are scoped to that single invocation.
|
|
95
|
+
|
|
96
|
+
### Open the provider manager
|
|
97
|
+
|
|
98
|
+
~~~powershell
|
|
99
|
+
oc-provider
|
|
100
|
+
~~~
|
|
101
|
+
|
|
102
|
+
This opens the provider manager through the installed Claudio CLI.
|
|
103
|
+
|
|
104
|
+
### Check local Ollama state
|
|
105
|
+
|
|
106
|
+
~~~powershell
|
|
107
|
+
oc-check
|
|
108
|
+
~~~
|
|
109
|
+
|
|
110
|
+
To check a specific model:
|
|
111
|
+
|
|
112
|
+
~~~powershell
|
|
113
|
+
oc-check -Model "qwen2.5-coder:7b"
|
|
114
|
+
~~~
|
|
115
|
+
|
|
116
|
+
### Pull/check a local model, then launch local mode
|
|
117
|
+
|
|
118
|
+
~~~powershell
|
|
119
|
+
oc-init
|
|
120
|
+
~~~
|
|
121
|
+
|
|
122
|
+
To choose a model:
|
|
123
|
+
|
|
124
|
+
~~~powershell
|
|
125
|
+
oc-init -Model "qwen2.5-coder:7b"
|
|
126
|
+
~~~
|
|
127
|
+
|
|
128
|
+
To skip pulling the model and only check/launch:
|
|
129
|
+
|
|
130
|
+
~~~powershell
|
|
131
|
+
oc-init -Model "qwen2.5-coder:7b" -SkipModelPull
|
|
132
|
+
~~~
|
|
133
|
+
|
|
134
|
+
`oc-init` does not save a provider profile. It pulls/checks the local Ollama model and then launches `oc-local`.
|
|
135
|
+
|
|
136
|
+
### Show quick help
|
|
137
|
+
|
|
138
|
+
~~~powershell
|
|
139
|
+
oc-help
|
|
140
|
+
~~~
|
|
141
|
+
|
|
142
|
+
## Command summary
|
|
143
|
+
|
|
144
|
+
| Command | Purpose |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `oc` | Launch Claudio using the installed CLI and saved/default behavior |
|
|
147
|
+
| `oc-local` | Launch once with local Ollama/OpenAI-compatible environment hints |
|
|
148
|
+
| `oc-fast` | Launch once with local Ollama/OpenAI-compatible low-latency hints |
|
|
149
|
+
| `oc-provider` | Open the provider manager |
|
|
150
|
+
| `oc-check` | Show local Ollama install/listening/model state |
|
|
151
|
+
| `oc-init` | Pull/check a local Ollama model, then launch local mode |
|
|
152
|
+
| `oc-help` | Show quick command help |
|
|
153
|
+
|
|
154
|
+
## Notes
|
|
155
|
+
|
|
156
|
+
These helpers are intentionally global-install oriented. They use the installed CLI instead of source-checkout development scripts.
|
|
157
|
+
|
|
158
|
+
For advanced provider setup, use the built-in provider manager:
|
|
159
|
+
|
|
160
|
+
~~~powershell
|
|
161
|
+
oc-provider
|
|
162
|
+
~~~
|
package/package.json
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gaburieuru/claudio",
|
|
3
|
+
"version": "0.24.0",
|
|
4
|
+
"description": "Claudio — Claude Code–style coding agent CLI with any LLM",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"claudio": "./bin/claudio"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
"./package.json": "./package.json",
|
|
11
|
+
"./dist/cli.mjs": "./dist/cli.mjs",
|
|
12
|
+
"./sdk": {
|
|
13
|
+
"types": "./src/entrypoints/sdk.d.ts",
|
|
14
|
+
"import": "./dist/sdk.mjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"bin/",
|
|
19
|
+
"dist/cli.mjs",
|
|
20
|
+
"dist/sdk.mjs",
|
|
21
|
+
"src/entrypoints/sdk.d.ts",
|
|
22
|
+
"src/entrypoints/sdk/coreTypes.generated.ts",
|
|
23
|
+
"scripts/windows/openclaude-aliases.ps1",
|
|
24
|
+
"vendor/node-domexception-shim/",
|
|
25
|
+
"docs/windows-aliases-and-launchers.md",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "bun run scripts/build.ts",
|
|
30
|
+
"integrations:generate": "bun run scripts/generate-integrations-artifacts.ts",
|
|
31
|
+
"integrations:check": "bun run scripts/generate-integrations-artifacts.ts --check",
|
|
32
|
+
"dev": "bun run build && node bin/claudio",
|
|
33
|
+
"dev:profile": "bun run scripts/provider-launch.ts",
|
|
34
|
+
"dev:profile:fast": "bun run scripts/provider-launch.ts auto --fast --bare",
|
|
35
|
+
"dev:codex": "bun run scripts/provider-launch.ts codex",
|
|
36
|
+
"dev:openai": "bun run scripts/provider-launch.ts openai",
|
|
37
|
+
"dev:gemini": "bun run scripts/provider-launch.ts gemini",
|
|
38
|
+
"dev:ollama": "bun run scripts/provider-launch.ts ollama",
|
|
39
|
+
"dev:ollama:fast": "bun run scripts/provider-launch.ts ollama --fast --bare",
|
|
40
|
+
"dev:atomic-chat": "bun run scripts/provider-launch.ts atomic-chat",
|
|
41
|
+
"profile:init": "bun run scripts/provider-bootstrap.ts",
|
|
42
|
+
"profile:recommend": "bun run scripts/provider-recommend.ts",
|
|
43
|
+
"profile:auto": "bun run scripts/provider-recommend.ts --apply",
|
|
44
|
+
"profile:codex": "bun run profile:init -- --provider codex --model codexplan",
|
|
45
|
+
"profile:fast": "bun run profile:init -- --provider ollama --model llama3.2:3b",
|
|
46
|
+
"profile:code": "bun run profile:init -- --provider ollama --model qwen2.5-coder:7b",
|
|
47
|
+
"dev:fast": "bun run profile:fast && bun run dev:ollama:fast",
|
|
48
|
+
"dev:code": "bun run profile:code && bun run dev:profile",
|
|
49
|
+
"dev:grpc": "bun run scripts/start-grpc.ts",
|
|
50
|
+
"dev:grpc:cli": "bun run scripts/grpc-cli.ts",
|
|
51
|
+
"start": "node bin/claudio",
|
|
52
|
+
"web:dev": "bun run --cwd web dev",
|
|
53
|
+
"web:build": "bun run --cwd web build",
|
|
54
|
+
"web:preview": "bun run --cwd web preview",
|
|
55
|
+
"web:typecheck": "bun run --cwd web typecheck",
|
|
56
|
+
"test": "bun test --feature=UNATTENDED_RETRY --max-concurrency=1",
|
|
57
|
+
"test:full": "bun test --feature=UNATTENDED_RETRY --max-concurrency=1",
|
|
58
|
+
"test:coverage": "bun test --feature=UNATTENDED_RETRY --coverage --coverage-reporter=lcov --coverage-dir=coverage --max-concurrency=1 && bun run scripts/render-coverage-heatmap.ts",
|
|
59
|
+
"test:coverage:ui": "bun run scripts/render-coverage-heatmap.ts",
|
|
60
|
+
"security:pr-scan": "bun run scripts/pr-intent-scan.ts",
|
|
61
|
+
"test:provider-recommendation": "bun test src/utils/providerRecommendation.test.ts src/utils/providerProfile.test.ts",
|
|
62
|
+
"typecheck": "tsc --noEmit",
|
|
63
|
+
"typecheck:type-tests": "bun run scripts/typecheck-type-tests.ts",
|
|
64
|
+
"smoke": "bun run build && node dist/cli.mjs --version",
|
|
65
|
+
"deadcode": "knip --include files,dependencies",
|
|
66
|
+
"check": "bun run smoke && bun run deadcode && bun run test:full",
|
|
67
|
+
"verify:privacy": "bun run scripts/verify-no-phone-home.ts",
|
|
68
|
+
"build:verified": "bun run build && bun run verify:privacy",
|
|
69
|
+
"test:provider": "bun test --feature=UNATTENDED_RETRY --max-concurrency=1 src/services/api/*.test.ts src/utils/context.test.ts",
|
|
70
|
+
"doctor:runtime": "bun run scripts/system-check.ts",
|
|
71
|
+
"doctor:runtime:json": "bun run scripts/system-check.ts --json",
|
|
72
|
+
"doctor:report": "bun run scripts/system-check.ts --out reports/doctor-runtime.json",
|
|
73
|
+
"hardening:check": "bun run smoke && bun run doctor:runtime",
|
|
74
|
+
"hardening:strict": "bun run typecheck && bun run hardening:check",
|
|
75
|
+
"prepack": "npm run build"
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@orama/orama": "^3.1.18",
|
|
79
|
+
"@orama/plugin-data-persistence": "^3.1.18",
|
|
80
|
+
"@vscode/ripgrep": "^1.17.1"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@alcalzone/ansi-tokenize": "0.3.0",
|
|
84
|
+
"@anthropic-ai/bedrock-sdk": "0.29.1",
|
|
85
|
+
"@anthropic-ai/foundry-sdk": "0.2.3",
|
|
86
|
+
"@anthropic-ai/sandbox-runtime": "0.0.55",
|
|
87
|
+
"@anthropic-ai/sdk": "0.94.0",
|
|
88
|
+
"@aws-sdk/client-bedrock": "3.1047.0",
|
|
89
|
+
"@aws-sdk/client-sts": "3.1047.0",
|
|
90
|
+
"@aws-sdk/credential-provider-node": "3.972.41",
|
|
91
|
+
"@azure/identity": "^4.13.1",
|
|
92
|
+
"@commander-js/extra-typings": "12.1.0",
|
|
93
|
+
"@grpc/grpc-js": "^1.14.3",
|
|
94
|
+
"@grpc/proto-loader": "^0.8.0",
|
|
95
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
96
|
+
"@smithy/core": "3.24.3",
|
|
97
|
+
"@smithy/node-http-handler": "4.7.3",
|
|
98
|
+
"@types/bun": "1.3.11",
|
|
99
|
+
"@types/node": "25.5.0",
|
|
100
|
+
"@types/react": "19.2.14",
|
|
101
|
+
"ajv": "8.18.0",
|
|
102
|
+
"auto-bind": "5.0.1",
|
|
103
|
+
"axios": "1.16.0",
|
|
104
|
+
"bidi-js": "1.0.3",
|
|
105
|
+
"chalk": "5.6.2",
|
|
106
|
+
"chokidar": "4.0.3",
|
|
107
|
+
"cli-boxes": "3.0.0",
|
|
108
|
+
"cli-highlight": "2.1.11",
|
|
109
|
+
"commander": "12.1.0",
|
|
110
|
+
"cross-spawn": "7.0.6",
|
|
111
|
+
"diff": "8.0.3",
|
|
112
|
+
"duck-duck-scrape": "^2.2.7",
|
|
113
|
+
"emoji-regex": "10.6.0",
|
|
114
|
+
"env-paths": "3.0.0",
|
|
115
|
+
"execa": "9.6.1",
|
|
116
|
+
"fflate": "0.8.2",
|
|
117
|
+
"figures": "6.1.0",
|
|
118
|
+
"fuse.js": "7.1.0",
|
|
119
|
+
"graphology": "0.26.0",
|
|
120
|
+
"get-east-asian-width": "1.5.0",
|
|
121
|
+
"google-auth-library": "10.6.2",
|
|
122
|
+
"https-proxy-agent": "7.0.6",
|
|
123
|
+
"ignore": "7.0.5",
|
|
124
|
+
"graphology-metrics": "2.4.0",
|
|
125
|
+
"indent-string": "5.0.0",
|
|
126
|
+
"js-tiktoken": "1.0.21",
|
|
127
|
+
"jsonc-parser": "3.3.1",
|
|
128
|
+
"knip": "^6.16.1",
|
|
129
|
+
"lodash-es": "4.18.1",
|
|
130
|
+
"lru-cache": "11.2.7",
|
|
131
|
+
"marked": "15.0.12",
|
|
132
|
+
"p-map": "7.0.4",
|
|
133
|
+
"picomatch": "4.0.4",
|
|
134
|
+
"proper-lockfile": "4.1.2",
|
|
135
|
+
"qrcode": "1.5.4",
|
|
136
|
+
"react": "19.2.4",
|
|
137
|
+
"react-compiler-runtime": "1.0.0",
|
|
138
|
+
"react-reconciler": "0.33.0",
|
|
139
|
+
"semver": "7.7.4",
|
|
140
|
+
"sharp": "^0.34.5",
|
|
141
|
+
"shell-quote": "1.8.4",
|
|
142
|
+
"signal-exit": "4.1.0",
|
|
143
|
+
"supports-hyperlinks": "3.2.0",
|
|
144
|
+
"tree-kill": "1.2.2",
|
|
145
|
+
"tree-sitter-wasms": "0.1.13",
|
|
146
|
+
"turndown": "7.2.2",
|
|
147
|
+
"type-fest": "4.41.0",
|
|
148
|
+
"typescript": "5.9.3",
|
|
149
|
+
"undici": "7.28.0",
|
|
150
|
+
"usehooks-ts": "3.1.1",
|
|
151
|
+
"web-tree-sitter": "0.25.10",
|
|
152
|
+
"vscode-languageserver-protocol": "3.17.5",
|
|
153
|
+
"wrap-ansi": "9.0.2",
|
|
154
|
+
"ws": "8.21.0",
|
|
155
|
+
"xss": "1.0.15",
|
|
156
|
+
"yaml": "2.8.3",
|
|
157
|
+
"zod": "3.25.76"
|
|
158
|
+
},
|
|
159
|
+
"peerDependencies": {
|
|
160
|
+
"@anthropic-ai/sdk": "^0.94.0",
|
|
161
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
162
|
+
"react": "^19.0.0",
|
|
163
|
+
"react-reconciler": "^0.33.0"
|
|
164
|
+
},
|
|
165
|
+
"peerDependenciesMeta": {
|
|
166
|
+
"@anthropic-ai/sdk": {
|
|
167
|
+
"optional": true
|
|
168
|
+
},
|
|
169
|
+
"@modelcontextprotocol/sdk": {
|
|
170
|
+
"optional": true
|
|
171
|
+
},
|
|
172
|
+
"react": {
|
|
173
|
+
"optional": true
|
|
174
|
+
},
|
|
175
|
+
"react-reconciler": {
|
|
176
|
+
"optional": true
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"engines": {
|
|
180
|
+
"node": ">=22.0.0"
|
|
181
|
+
},
|
|
182
|
+
"repository": {
|
|
183
|
+
"type": "git",
|
|
184
|
+
"url": "https://github.com/StillHue/claudio.git",
|
|
185
|
+
"directory": "openclaude-fork"
|
|
186
|
+
},
|
|
187
|
+
"keywords": [
|
|
188
|
+
"claude-code",
|
|
189
|
+
"openai",
|
|
190
|
+
"llm",
|
|
191
|
+
"cli",
|
|
192
|
+
"agent",
|
|
193
|
+
"deepseek",
|
|
194
|
+
"ollama",
|
|
195
|
+
"gemini"
|
|
196
|
+
],
|
|
197
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
198
|
+
"publishConfig": {
|
|
199
|
+
"access": "public"
|
|
200
|
+
},
|
|
201
|
+
"overrides": {
|
|
202
|
+
"ip-address": "10.2.0",
|
|
203
|
+
"google-auth-library": "10.6.2",
|
|
204
|
+
"lodash-es": "4.18.1",
|
|
205
|
+
"node-domexception": "file:vendor/node-domexception-shim"
|
|
206
|
+
},
|
|
207
|
+
"allowScripts": {
|
|
208
|
+
"protobufjs@7.6.4": true,
|
|
209
|
+
"sharp@0.34.5": true
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Set-StrictMode -Version Latest
|
|
2
|
+
|
|
3
|
+
function Test-ClaudioCommand {
|
|
4
|
+
[CmdletBinding()]
|
|
5
|
+
param(
|
|
6
|
+
[Parameter(Mandatory = $true)]
|
|
7
|
+
[string]$Name
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
return [bool](Get-Command -Name $Name -ErrorAction SilentlyContinue)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function Assert-ClaudioCommand {
|
|
14
|
+
[CmdletBinding()]
|
|
15
|
+
param(
|
|
16
|
+
[Parameter(Mandatory = $true)]
|
|
17
|
+
[string]$Name,
|
|
18
|
+
[Parameter(Mandatory = $true)]
|
|
19
|
+
[string]$InstallHint
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
if (-not (Test-ClaudioCommand -Name $Name)) {
|
|
23
|
+
throw "Required command '$Name' was not found. $InstallHint"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function Invoke-Claudio {
|
|
28
|
+
[CmdletBinding()]
|
|
29
|
+
param(
|
|
30
|
+
[Parameter(ValueFromRemainingArguments = $true)]
|
|
31
|
+
[string[]]$ClaudioArgs
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
Assert-ClaudioCommand -Name "openclaude" -InstallHint "Install with: npm install -g @gitlawb/openclaude"
|
|
35
|
+
|
|
36
|
+
& openclaude @ClaudioArgs
|
|
37
|
+
|
|
38
|
+
if ($LASTEXITCODE -ne 0) {
|
|
39
|
+
throw "openclaude failed with exit code $LASTEXITCODE."
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function Invoke-ClaudioWithEnvironment {
|
|
44
|
+
[CmdletBinding()]
|
|
45
|
+
param(
|
|
46
|
+
[Parameter(Mandatory = $true)]
|
|
47
|
+
[hashtable]$Environment,
|
|
48
|
+
[Parameter(ValueFromRemainingArguments = $true)]
|
|
49
|
+
[string[]]$ClaudioArgs
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
$previousValues = @{}
|
|
53
|
+
|
|
54
|
+
foreach ($name in $Environment.Keys) {
|
|
55
|
+
$previousValues[$name] = [Environment]::GetEnvironmentVariable($name, "Process")
|
|
56
|
+
Set-Item -Path "Env:$name" -Value $Environment[$name]
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
Invoke-Claudio @ClaudioArgs
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
foreach ($name in $Environment.Keys) {
|
|
64
|
+
if ($null -eq $previousValues[$name]) {
|
|
65
|
+
Remove-Item -Path "Env:$name" -ErrorAction SilentlyContinue
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
Set-Item -Path "Env:$name" -Value $previousValues[$name]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function Get-ClaudioQuickHelp {
|
|
75
|
+
[CmdletBinding()]
|
|
76
|
+
param()
|
|
77
|
+
|
|
78
|
+
@(
|
|
79
|
+
"Claudio quick commands:",
|
|
80
|
+
" oc [args...] -> launch Claudio using the installed CLI",
|
|
81
|
+
" oc-local [args...] -> launch Claudio with local/Ollama OpenAI-compatible environment hints for this invocation only",
|
|
82
|
+
" oc-fast [args...] -> launch Claudio with low-latency local defaults for this invocation only",
|
|
83
|
+
" oc-provider -> open the provider manager in Claudio",
|
|
84
|
+
" oc-check -> show Ollama install/listening/model state",
|
|
85
|
+
" oc-init -> pull/check the local model, then launch local/Ollama mode",
|
|
86
|
+
" oc-help -> show this help"
|
|
87
|
+
) -join [Environment]::NewLine
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function oc {
|
|
91
|
+
[CmdletBinding()]
|
|
92
|
+
param(
|
|
93
|
+
[Parameter(ValueFromRemainingArguments = $true)]
|
|
94
|
+
[string[]]$ClaudioArgs
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
Invoke-Claudio @ClaudioArgs
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function oc-local {
|
|
101
|
+
[CmdletBinding()]
|
|
102
|
+
param(
|
|
103
|
+
[string]$Model = "llama3.1:8b",
|
|
104
|
+
[Parameter(ValueFromRemainingArguments = $true)]
|
|
105
|
+
[string[]]$ClaudioArgs
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
Invoke-ClaudioWithEnvironment `
|
|
109
|
+
-Environment @{
|
|
110
|
+
CLAUDE_CODE_USE_OPENAI = "1"
|
|
111
|
+
OPENAI_BASE_URL = "http://localhost:11434/v1"
|
|
112
|
+
OPENAI_MODEL = $Model
|
|
113
|
+
} `
|
|
114
|
+
@ClaudioArgs
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function oc-fast {
|
|
118
|
+
[CmdletBinding()]
|
|
119
|
+
param(
|
|
120
|
+
[string]$Model = "llama3.1:8b",
|
|
121
|
+
[Parameter(ValueFromRemainingArguments = $true)]
|
|
122
|
+
[string[]]$ClaudioArgs
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
Invoke-ClaudioWithEnvironment `
|
|
126
|
+
-Environment @{
|
|
127
|
+
CLAUDE_CODE_USE_OPENAI = "1"
|
|
128
|
+
OPENAI_BASE_URL = "http://localhost:11434/v1"
|
|
129
|
+
OPENAI_MODEL = $Model
|
|
130
|
+
OPENCLAUDE_FAST_MODE = "1"
|
|
131
|
+
} `
|
|
132
|
+
@ClaudioArgs
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function oc-provider {
|
|
136
|
+
[CmdletBinding()]
|
|
137
|
+
param()
|
|
138
|
+
|
|
139
|
+
Invoke-Claudio "/provider"
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function oc-check {
|
|
143
|
+
[CmdletBinding()]
|
|
144
|
+
param(
|
|
145
|
+
[string]$Model = "llama3.1:8b"
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
Assert-ClaudioCommand -Name "ollama" -InstallHint "Install Ollama from https://ollama.com/download/windows."
|
|
149
|
+
|
|
150
|
+
$version = & ollama --version 2>$null
|
|
151
|
+
$modelNames = (& ollama list 2>$null | Select-Object -Skip 1 | ForEach-Object {
|
|
152
|
+
($_ -split "\s+")[0]
|
|
153
|
+
}) | Where-Object { $_ }
|
|
154
|
+
|
|
155
|
+
$isModelAvailable = $modelNames -contains $Model
|
|
156
|
+
$probeSucceeded = $false
|
|
157
|
+
|
|
158
|
+
try {
|
|
159
|
+
$response = Invoke-RestMethod -Uri "http://localhost:11434/api/tags" -Method Get -TimeoutSec 3
|
|
160
|
+
if ($response.models) {
|
|
161
|
+
$probeSucceeded = $true
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
$probeSucceeded = $false
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
[PSCustomObject]@{
|
|
169
|
+
OllamaInstalled = $true
|
|
170
|
+
OllamaVersion = $version
|
|
171
|
+
OllamaListening = $probeSucceeded
|
|
172
|
+
Model = $Model
|
|
173
|
+
ModelAvailable = $isModelAvailable
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function oc-init {
|
|
178
|
+
[CmdletBinding()]
|
|
179
|
+
param(
|
|
180
|
+
[string]$Model = "llama3.1:8b",
|
|
181
|
+
[switch]$SkipModelPull
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
Assert-ClaudioCommand -Name "ollama" -InstallHint "Install Ollama from https://ollama.com/download/windows."
|
|
185
|
+
|
|
186
|
+
if (-not $SkipModelPull) {
|
|
187
|
+
& ollama pull $Model
|
|
188
|
+
if ($LASTEXITCODE -ne 0) {
|
|
189
|
+
throw "ollama pull $Model failed with exit code $LASTEXITCODE."
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
$health = oc-check -Model $Model
|
|
194
|
+
if (-not $health.OllamaListening) {
|
|
195
|
+
Write-Warning "Ollama is installed but API probe to localhost:11434 did not succeed. Start Ollama and retry."
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
oc-local -Model $Model
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function oc-help {
|
|
202
|
+
[CmdletBinding()]
|
|
203
|
+
param()
|
|
204
|
+
|
|
205
|
+
Get-ClaudioQuickHelp
|
|
206
|
+
}
|