loren-code 0.1.2 → 0.1.4
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/README.md
CHANGED
|
@@ -66,6 +66,27 @@ The local bridge runs on:
|
|
|
66
66
|
http://127.0.0.1:8788
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
## Claude Code On Windows
|
|
70
|
+
|
|
71
|
+
If you want the installed `claude` command to route through Loren instead of the official Claude CLI, run:
|
|
72
|
+
|
|
73
|
+
```powershell
|
|
74
|
+
powershell -ExecutionPolicy Bypass -File "$(npm prefix -g)\node_modules\loren-code\scripts\install-claude-ollama.ps1"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
That installer:
|
|
78
|
+
|
|
79
|
+
- configures VS Code to use the local bridge
|
|
80
|
+
- updates your user `.claude` settings
|
|
81
|
+
- backs up existing global `claude` shims
|
|
82
|
+
- installs Loren-backed `claude`, `claude.cmd`, and `claude.ps1` wrappers
|
|
83
|
+
|
|
84
|
+
To restore the original `claude` command:
|
|
85
|
+
|
|
86
|
+
```powershell
|
|
87
|
+
powershell -ExecutionPolicy Bypass -File "$(npm prefix -g)\node_modules\loren-code\scripts\uninstall-claude-ollama.ps1"
|
|
88
|
+
```
|
|
89
|
+
|
|
69
90
|
## Troubleshooting
|
|
70
91
|
|
|
71
92
|
### `loren` not found
|
package/package.json
CHANGED
|
@@ -10,6 +10,13 @@ $claudeSettingsPath = Join-Path $claudeDir "settings.json"
|
|
|
10
10
|
$launcherSourcePath = Join-Path $repoRoot "scripts\\ClaudeWrapperLauncher.cs"
|
|
11
11
|
$launcherExePath = Join-Path $repoRoot "scripts\\ClaudeWrapperLauncher.exe"
|
|
12
12
|
$envPath = Join-Path $repoRoot ".env.local"
|
|
13
|
+
$npmBinDir = Join-Path $appData "npm"
|
|
14
|
+
$claudeCmdPath = Join-Path $npmBinDir "claude.cmd"
|
|
15
|
+
$claudeShellPath = Join-Path $npmBinDir "claude"
|
|
16
|
+
$claudePs1Path = Join-Path $npmBinDir "claude.ps1"
|
|
17
|
+
$claudeCmdBackupPath = Join-Path $npmBinDir "claude.loren-backup.cmd"
|
|
18
|
+
$claudeShellBackupPath = Join-Path $npmBinDir "claude.loren-backup"
|
|
19
|
+
$claudePs1BackupPath = Join-Path $npmBinDir "claude.loren-backup.ps1"
|
|
13
20
|
|
|
14
21
|
if (-not (Test-Path $envPath)) {
|
|
15
22
|
throw ".env.local not found. Create it first with OLLAMA_API_KEYS."
|
|
@@ -17,6 +24,7 @@ if (-not (Test-Path $envPath)) {
|
|
|
17
24
|
|
|
18
25
|
New-Item -ItemType Directory -Force -Path $workspaceSettingsDir | Out-Null
|
|
19
26
|
New-Item -ItemType Directory -Force -Path $claudeDir | Out-Null
|
|
27
|
+
New-Item -ItemType Directory -Force -Path $npmBinDir | Out-Null
|
|
20
28
|
|
|
21
29
|
function Read-JsonFile {
|
|
22
30
|
param([string]$Path)
|
|
@@ -97,6 +105,17 @@ function Get-CSharpCompiler {
|
|
|
97
105
|
throw "C# compiler not found. Unable to generate the launcher .exe."
|
|
98
106
|
}
|
|
99
107
|
|
|
108
|
+
function Backup-IfNeeded {
|
|
109
|
+
param(
|
|
110
|
+
[string]$SourcePath,
|
|
111
|
+
[string]$BackupPath
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
if ((Test-Path $SourcePath) -and -not (Test-Path $BackupPath)) {
|
|
115
|
+
Move-Item -LiteralPath $SourcePath -Destination $BackupPath -Force
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
100
119
|
function Get-OllamaAvailableModels {
|
|
101
120
|
param(
|
|
102
121
|
[string]$EnvPath,
|
|
@@ -219,9 +238,33 @@ $claudeSettings["model"] = $defaultModel
|
|
|
219
238
|
$claudeSettings["availableModels"] = $availableModels
|
|
220
239
|
Write-JsonFile -Path $claudeSettingsPath -Data $claudeSettings
|
|
221
240
|
|
|
241
|
+
Backup-IfNeeded -SourcePath $claudeCmdPath -BackupPath $claudeCmdBackupPath
|
|
242
|
+
Backup-IfNeeded -SourcePath $claudeShellPath -BackupPath $claudeShellBackupPath
|
|
243
|
+
Backup-IfNeeded -SourcePath $claudePs1Path -BackupPath $claudePs1BackupPath
|
|
244
|
+
|
|
245
|
+
$cmdContent = @"
|
|
246
|
+
@echo off
|
|
247
|
+
"$launcherExePath" %*
|
|
248
|
+
"@
|
|
249
|
+
Set-Content -LiteralPath $claudeCmdPath -Value $cmdContent -Encoding ASCII
|
|
250
|
+
|
|
251
|
+
$shellLauncherPath = ($launcherExePath -replace "\\", "/")
|
|
252
|
+
$shellContent = @"
|
|
253
|
+
#!/bin/sh
|
|
254
|
+
"$shellLauncherPath" "$@"
|
|
255
|
+
"@
|
|
256
|
+
Set-Content -LiteralPath $claudeShellPath -Value $shellContent -Encoding ASCII
|
|
257
|
+
|
|
258
|
+
$ps1Content = @"
|
|
259
|
+
& "$launcherExePath" @args
|
|
260
|
+
"@
|
|
261
|
+
Set-Content -LiteralPath $claudePs1Path -Value $ps1Content -Encoding UTF8
|
|
262
|
+
|
|
222
263
|
Write-Host "Installation completed."
|
|
223
264
|
Write-Host "Claude launcher:" $launcherExePath
|
|
224
265
|
Write-Host "VS Code user settings:" $workspaceSettingsPath
|
|
225
266
|
Write-Host "Claude user settings:" $claudeSettingsPath
|
|
267
|
+
Write-Host "Global Claude command:" $claudeCmdPath
|
|
226
268
|
Write-Host ""
|
|
227
269
|
Write-Host "Restart VS Code. Claude Code will use the bridge in any project."
|
|
270
|
+
Write-Host "The global 'claude' command now routes through Loren."
|
|
@@ -7,6 +7,13 @@ $workspaceSettingsPath = Join-Path $appData "Code\\User\\settings.json"
|
|
|
7
7
|
$claudeSettingsPath = Join-Path $userProfile ".claude\\settings.json"
|
|
8
8
|
$bridgePidPath = Join-Path $repoRoot ".runtime\\bridge.pid"
|
|
9
9
|
$launcherExePath = Join-Path $repoRoot "scripts\\ClaudeWrapperLauncher.exe"
|
|
10
|
+
$npmBinDir = Join-Path $appData "npm"
|
|
11
|
+
$claudeCmdPath = Join-Path $npmBinDir "claude.cmd"
|
|
12
|
+
$claudeShellPath = Join-Path $npmBinDir "claude"
|
|
13
|
+
$claudePs1Path = Join-Path $npmBinDir "claude.ps1"
|
|
14
|
+
$claudeCmdBackupPath = Join-Path $npmBinDir "claude.loren-backup.cmd"
|
|
15
|
+
$claudeShellBackupPath = Join-Path $npmBinDir "claude.loren-backup"
|
|
16
|
+
$claudePs1BackupPath = Join-Path $npmBinDir "claude.loren-backup.ps1"
|
|
10
17
|
|
|
11
18
|
function Read-JsonFile {
|
|
12
19
|
param([string]$Path)
|
|
@@ -43,6 +50,20 @@ function Write-JsonFile {
|
|
|
43
50
|
Set-Content -LiteralPath $Path -Value ($json + "`n") -Encoding UTF8
|
|
44
51
|
}
|
|
45
52
|
|
|
53
|
+
function Restore-BackupIfPresent {
|
|
54
|
+
param(
|
|
55
|
+
[string]$BackupPath,
|
|
56
|
+
[string]$TargetPath
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
if (Test-Path $BackupPath) {
|
|
60
|
+
if (Test-Path $TargetPath) {
|
|
61
|
+
Remove-Item -LiteralPath $TargetPath -Force -ErrorAction SilentlyContinue
|
|
62
|
+
}
|
|
63
|
+
Move-Item -LiteralPath $BackupPath -Destination $TargetPath -Force
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
46
67
|
if (Test-Path $workspaceSettingsPath) {
|
|
47
68
|
$settings = Read-JsonFile -Path $workspaceSettingsPath
|
|
48
69
|
[void]$settings.Remove("claudeCode.claudeProcessWrapper")
|
|
@@ -71,4 +92,8 @@ if (Test-Path $launcherExePath) {
|
|
|
71
92
|
Remove-Item -LiteralPath $launcherExePath -Force -ErrorAction SilentlyContinue
|
|
72
93
|
}
|
|
73
94
|
|
|
95
|
+
Restore-BackupIfPresent -BackupPath $claudeCmdBackupPath -TargetPath $claudeCmdPath
|
|
96
|
+
Restore-BackupIfPresent -BackupPath $claudeShellBackupPath -TargetPath $claudeShellPath
|
|
97
|
+
Restore-BackupIfPresent -BackupPath $claudePs1BackupPath -TargetPath $claudePs1Path
|
|
98
|
+
|
|
74
99
|
Write-Host "Global configuration removed."
|