loren-code 0.1.1 → 0.1.2
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/package.json
CHANGED
|
@@ -163,8 +163,38 @@ if ($LASTEXITCODE -ne 0 -or -not (Test-Path $launcherExePath)) {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
$workspaceSettings = Read-JsonFile -Path $workspaceSettingsPath
|
|
166
|
+
$bridgeHost = Get-EnvValue -Path $envPath -Name "BRIDGE_HOST"
|
|
167
|
+
if (-not $bridgeHost) {
|
|
168
|
+
$bridgeHost = "127.0.0.1"
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
$bridgePort = Get-EnvValue -Path $envPath -Name "BRIDGE_PORT"
|
|
172
|
+
if (-not $bridgePort) {
|
|
173
|
+
$bridgePort = "8788"
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
$bridgeBaseUrl = "http://${bridgeHost}:${bridgePort}"
|
|
177
|
+
|
|
166
178
|
$workspaceSettings["claudeCode.claudeProcessWrapper"] = $launcherExePath
|
|
167
179
|
$workspaceSettings["claudeCode.disableLoginPrompt"] = $true
|
|
180
|
+
$workspaceSettings["claudeCode.environmentVariables"] = @(
|
|
181
|
+
@{
|
|
182
|
+
name = "ANTHROPIC_BASE_URL"
|
|
183
|
+
value = $bridgeBaseUrl
|
|
184
|
+
},
|
|
185
|
+
@{
|
|
186
|
+
name = "ANTHROPIC_API_KEY"
|
|
187
|
+
value = "bridge-local"
|
|
188
|
+
},
|
|
189
|
+
@{
|
|
190
|
+
name = "ANTHROPIC_AUTH_TOKEN"
|
|
191
|
+
value = ""
|
|
192
|
+
},
|
|
193
|
+
@{
|
|
194
|
+
name = "CLAUDE_CODE_SKIP_AUTH_LOGIN"
|
|
195
|
+
value = "1"
|
|
196
|
+
}
|
|
197
|
+
)
|
|
168
198
|
Write-JsonFile -Path $workspaceSettingsPath -Data $workspaceSettings
|
|
169
199
|
|
|
170
200
|
$claudeSettings = Read-JsonFile -Path $claudeSettingsPath
|
package/scripts/loren.js
CHANGED
|
@@ -13,6 +13,8 @@ const runtimeDir = path.join(projectRoot, ".runtime");
|
|
|
13
13
|
const pidFilePath = path.join(runtimeDir, "loren.pid");
|
|
14
14
|
const logFilePath = path.join(runtimeDir, "bridge.log");
|
|
15
15
|
const errorLogFilePath = path.join(runtimeDir, "bridge.err.log");
|
|
16
|
+
const userHome = process.env.USERPROFILE || process.env.HOME || projectRoot;
|
|
17
|
+
const claudeSettingsPath = path.join(userHome, ".claude", "settings.json");
|
|
16
18
|
|
|
17
19
|
// Force working directory to project root for config loading
|
|
18
20
|
process.chdir(projectRoot);
|
|
@@ -53,7 +55,7 @@ const COMMANDS = {
|
|
|
53
55
|
|
|
54
56
|
function main() {
|
|
55
57
|
const args = process.argv.slice(2);
|
|
56
|
-
const [command
|
|
58
|
+
const [command] = args;
|
|
57
59
|
|
|
58
60
|
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
59
61
|
printHelp();
|
|
@@ -78,7 +80,7 @@ function main() {
|
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
if (category && action && COMMANDS[category] && COMMANDS[category][action]) {
|
|
81
|
-
COMMANDS[category][action](
|
|
83
|
+
COMMANDS[category][action](args.slice(1));
|
|
82
84
|
return;
|
|
83
85
|
}
|
|
84
86
|
|
|
@@ -194,9 +196,13 @@ function setModel(args) {
|
|
|
194
196
|
const envVars = loadEnvFile(envFilePath);
|
|
195
197
|
envVars.DEFAULT_MODEL_ALIAS = requestedModel;
|
|
196
198
|
saveEnvFile(envFilePath, envVars);
|
|
199
|
+
syncClaudeSelectedModel(requestedModel);
|
|
197
200
|
|
|
198
201
|
console.log(`\n✓ Default model set to: ${requestedModel}`);
|
|
199
202
|
console.log(" New requests will use this model immediately.");
|
|
203
|
+
if (fs.existsSync(claudeSettingsPath)) {
|
|
204
|
+
console.log(" Claude Code settings were updated as well.");
|
|
205
|
+
}
|
|
200
206
|
console.log("");
|
|
201
207
|
}
|
|
202
208
|
|
|
@@ -469,6 +475,28 @@ function safeUnlink(filePath) {
|
|
|
469
475
|
}
|
|
470
476
|
}
|
|
471
477
|
|
|
478
|
+
function syncClaudeSelectedModel(model) {
|
|
479
|
+
const settingsDir = path.dirname(claudeSettingsPath);
|
|
480
|
+
fs.mkdirSync(settingsDir, { recursive: true });
|
|
481
|
+
|
|
482
|
+
let settings = {};
|
|
483
|
+
if (fs.existsSync(claudeSettingsPath)) {
|
|
484
|
+
try {
|
|
485
|
+
settings = JSON.parse(fs.readFileSync(claudeSettingsPath, "utf8").replace(/^\uFEFF/, ""));
|
|
486
|
+
} catch {
|
|
487
|
+
settings = {};
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
const availableModels = Array.isArray(settings.availableModels) ? settings.availableModels : [];
|
|
492
|
+
if (!availableModels.includes(model)) {
|
|
493
|
+
settings.availableModels = [model, ...availableModels];
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
settings.model = model;
|
|
497
|
+
fs.writeFileSync(claudeSettingsPath, `${JSON.stringify(settings, null, 2)}\n`, "utf8");
|
|
498
|
+
}
|
|
499
|
+
|
|
472
500
|
// ============== HELP ==============
|
|
473
501
|
|
|
474
502
|
function printHelp() {
|
|
@@ -47,6 +47,7 @@ if (Test-Path $workspaceSettingsPath) {
|
|
|
47
47
|
$settings = Read-JsonFile -Path $workspaceSettingsPath
|
|
48
48
|
[void]$settings.Remove("claudeCode.claudeProcessWrapper")
|
|
49
49
|
[void]$settings.Remove("claudeCode.disableLoginPrompt")
|
|
50
|
+
[void]$settings.Remove("claudeCode.environmentVariables")
|
|
50
51
|
Write-JsonFile -Path $workspaceSettingsPath -Data $settings
|
|
51
52
|
}
|
|
52
53
|
|