Better environments for the vibes (#4077)

* Get root of the cline storage directory from an env var.

Set the cline directory env var when running the standalone app from the vscode launcher.
Add missing vscode SDK stub.

* Stop spamming the logs.
This commit is contained in:
Sarah Fortune authored and GitHub committed 2025-06-06 10:15:29 -07:00
1 parent 7e37cec1ab
commit 0abd13e1f2
5 files changed
+17 -6

No files matched your search

+2 -1
View File
@@ -52,7 +52,8 @@
"env": {
"GRPC_TRACE": "all",
"GRPC_VERBOSITY": "DEBUG",
"NODE_PATH": "${workspaceFolder}/dist-standalone/node_modules"
"NODE_PATH": "${workspaceFolder}/dist-standalone/node_modules",
"CLINE_DIR": "${userHome}/.cline-standalone"
},
"program": "standalone.js"
}
@@ -15,7 +15,7 @@ import { GlobalFileNames } from "@core/storage/disk"
*/
export async function refreshOpenRouterModels(
controller: Controller,
request: EmptyRequest,
_request: EmptyRequest,
): Promise<OpenRouterCompatibleModelInfo> {
const openRouterModelsFilePath = path.join(await ensureCacheDirectoryExists(controller), GlobalFileNames.openRouterModels)
@@ -123,7 +123,7 @@ export async function refreshOpenRouterModels(
console.error("Invalid response from OpenRouter API")
}
await fs.writeFile(openRouterModelsFilePath, JSON.stringify(models))
console.log("OpenRouter models fetched and saved", models)
console.log("OpenRouter models fetched and saved", JSON.stringify(models).slice(0, 300))
} catch (error) {
console.error("Error fetching OpenRouter models:", error)
+1 -1
View File
@@ -15,7 +15,7 @@ const outputChannel: vscode.OutputChannel = {
}
function postMessage(message: ExtensionMessage): Promise<boolean> {
log("postMessage stub called:", message)
log("postMessage stub called:", JSON.stringify(message).slice(0, 200))
return Promise.resolve(true)
}
+11 -2
View File
@@ -1,13 +1,22 @@
import { URI } from "vscode-uri"
import path from "path"
import { mkdirSync } from "fs"
import type { Extension, ExtensionContext } from "vscode"
import { ExtensionKind, ExtensionMode } from "vscode"
import { outputChannel, postMessage } from "./vscode-context-stubs"
import { EnvironmentVariableCollection, MementoStore, readJson, SecretStore } from "./vscode-context-utils"
import { log } from "./utils"
const DATA_DIR = process.env.DATA_DIR ?? "."
const EXTENSION_DIR = process.env.EXTENSION_DIR ?? "."
if (!process.env.CLINE_DIR) {
console.warn("Environment variable CLINE_DIR was not set.")
process.exit(1)
}
const DATA_DIR = path.join(process.env.CLINE_DIR, "data")
mkdirSync(DATA_DIR, { recursive: true })
log("Using settings dir:", DATA_DIR)
const EXTENSION_DIR = path.join(process.env.CLINE_DIR, "core")
const EXTENSION_MODE = process.env.IS_DEV === "true" ? ExtensionMode.Development : ExtensionMode.Production
const extension: Extension<void> = {
@@ -53,6 +53,7 @@ vscode.window = {
tabGroups: {
all: [],
close: async () => {},
onDidChangeTabs: createStub("vscode.env.tabGroups.onDidChangeTabs"),
},
withProgress: async (_options, task) => {
console.log("Stubbed withProgress")