@xkei/openclaude 0.30.0-antigravity

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.
Files changed (37) hide show
  1. package/LICENSE +29 -0
  2. package/README.md +518 -0
  3. package/bin/import-specifier.mjs +13 -0
  4. package/bin/import-specifier.test.mjs +13 -0
  5. package/bin/node-compile-cache.mjs +17 -0
  6. package/bin/openclaude +126 -0
  7. package/dist/cli.mjs +11292 -0
  8. package/dist/sdk.mjs +284293 -0
  9. package/docs/antigravity-plugin-install.md +223 -0
  10. package/docs/windows-aliases-and-launchers.md +162 -0
  11. package/package.json +226 -0
  12. package/scripts/windows/openclaude-aliases.ps1 +206 -0
  13. package/src/entrypoints/sdk/coreTypes.generated.ts +2385 -0
  14. package/src/entrypoints/sdk.d.ts +601 -0
  15. package/vendor/node-domexception-shim/index.js +3 -0
  16. package/vendor/node-domexception-shim/package.json +8 -0
  17. package/vendor/openclaude-antigravity-provider/.claude-plugin/marketplace.json +17 -0
  18. package/vendor/openclaude-antigravity-provider/.claude-plugin/plugin.json +38 -0
  19. package/vendor/openclaude-antigravity-provider/bin/antigravity-proxy.exe +0 -0
  20. package/vendor/openclaude-antigravity-provider/hooks/SessionEnd.ps1 +22 -0
  21. package/vendor/openclaude-antigravity-provider/hooks/SessionStart.ps1 +111 -0
  22. package/vendor/openclaude-antigravity-provider/hooks/Watchdog-Stop.ps1 +82 -0
  23. package/vendor/openclaude-antigravity-provider/hooks/hooks.json +37 -0
  24. package/vendor/openclaude-antigravity-provider/hooks/inject-provider.js +110 -0
  25. package/vendor/openclaude-antigravity-provider/hooks/session-end.bat +22 -0
  26. package/vendor/openclaude-antigravity-provider/hooks/start.bat +7 -0
  27. package/vendor/openclaude-antigravity-provider/package.json +24 -0
  28. package/vendor/openclaude-antigravity-provider/src/accounts.ts +115 -0
  29. package/vendor/openclaude-antigravity-provider/src/auth-cli.ts +125 -0
  30. package/vendor/openclaude-antigravity-provider/src/auth.ts +221 -0
  31. package/vendor/openclaude-antigravity-provider/src/config.ts +68 -0
  32. package/vendor/openclaude-antigravity-provider/src/constants.ts +139 -0
  33. package/vendor/openclaude-antigravity-provider/src/gemini-fallback.ts +157 -0
  34. package/vendor/openclaude-antigravity-provider/src/server.ts +367 -0
  35. package/vendor/openclaude-antigravity-provider/src/storage.ts +56 -0
  36. package/vendor/openclaude-antigravity-provider/src/transform.ts +241 -0
  37. package/vendor/openclaude-antigravity-provider/tsconfig.json +15 -0
@@ -0,0 +1,206 @@
1
+ Set-StrictMode -Version Latest
2
+
3
+ function Test-OpenClaudeCommand {
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-OpenClaudeCommand {
14
+ [CmdletBinding()]
15
+ param(
16
+ [Parameter(Mandatory = $true)]
17
+ [string]$Name,
18
+ [Parameter(Mandatory = $true)]
19
+ [string]$InstallHint
20
+ )
21
+
22
+ if (-not (Test-OpenClaudeCommand -Name $Name)) {
23
+ throw "Required command '$Name' was not found. $InstallHint"
24
+ }
25
+ }
26
+
27
+ function Invoke-OpenClaude {
28
+ [CmdletBinding()]
29
+ param(
30
+ [Parameter(ValueFromRemainingArguments = $true)]
31
+ [string[]]$OpenClaudeArgs
32
+ )
33
+
34
+ Assert-OpenClaudeCommand -Name "openclaude" -InstallHint "Install with: npm install -g @xkei/openclaude"
35
+
36
+ & openclaude @OpenClaudeArgs
37
+
38
+ if ($LASTEXITCODE -ne 0) {
39
+ throw "openclaude failed with exit code $LASTEXITCODE."
40
+ }
41
+ }
42
+
43
+ function Invoke-OpenClaudeWithEnvironment {
44
+ [CmdletBinding()]
45
+ param(
46
+ [Parameter(Mandatory = $true)]
47
+ [hashtable]$Environment,
48
+ [Parameter(ValueFromRemainingArguments = $true)]
49
+ [string[]]$OpenClaudeArgs
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-OpenClaude @OpenClaudeArgs
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-OpenClaudeQuickHelp {
75
+ [CmdletBinding()]
76
+ param()
77
+
78
+ @(
79
+ "OpenClaude quick commands:",
80
+ " oc [args...] -> launch OpenClaude using the installed CLI",
81
+ " oc-local [args...] -> launch OpenClaude with local/Ollama OpenAI-compatible environment hints for this invocation only",
82
+ " oc-fast [args...] -> launch OpenClaude with low-latency local defaults for this invocation only",
83
+ " oc-provider -> open the provider manager in OpenClaude",
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[]]$OpenClaudeArgs
95
+ )
96
+
97
+ Invoke-OpenClaude @OpenClaudeArgs
98
+ }
99
+
100
+ function oc-local {
101
+ [CmdletBinding()]
102
+ param(
103
+ [string]$Model = "llama3.1:8b",
104
+ [Parameter(ValueFromRemainingArguments = $true)]
105
+ [string[]]$OpenClaudeArgs
106
+ )
107
+
108
+ Invoke-OpenClaudeWithEnvironment `
109
+ -Environment @{
110
+ CLAUDE_CODE_USE_OPENAI = "1"
111
+ OPENAI_BASE_URL = "http://localhost:11434/v1"
112
+ OPENAI_MODEL = $Model
113
+ } `
114
+ @OpenClaudeArgs
115
+ }
116
+
117
+ function oc-fast {
118
+ [CmdletBinding()]
119
+ param(
120
+ [string]$Model = "llama3.1:8b",
121
+ [Parameter(ValueFromRemainingArguments = $true)]
122
+ [string[]]$OpenClaudeArgs
123
+ )
124
+
125
+ Invoke-OpenClaudeWithEnvironment `
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
+ @OpenClaudeArgs
133
+ }
134
+
135
+ function oc-provider {
136
+ [CmdletBinding()]
137
+ param()
138
+
139
+ Invoke-OpenClaude "/provider"
140
+ }
141
+
142
+ function oc-check {
143
+ [CmdletBinding()]
144
+ param(
145
+ [string]$Model = "llama3.1:8b"
146
+ )
147
+
148
+ Assert-OpenClaudeCommand -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-OpenClaudeCommand -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-OpenClaudeQuickHelp
206
+ }