Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: the app no longer writes an opencode.jsonc into the project

ogsamrat091efb96ba7f
diff --git a/apps/desktop/electron/runtime.mjs b/apps/desktop/electron/runtime.mjs
index 5d1ff646..5a511d67 100644
--- a/apps/desktop/electron/runtime.mjs
+++ b/apps/desktop/electron/runtime.mjs
@@ -21,7 +21,6 @@ import {
normalizeWorkspaceRootPath,
omnirushEnvStorePath,
omnirushServerConfigPath,
- resolveWorkspaceOpencodeConfigPath,
} from "@omnirush/paths";
import {
dedupeCertificates,
@@ -530,15 +529,6 @@ function assertOmniRushServerReady(snapshot) {
return snapshot;
}
-async function fileExists(targetPath) {
- try {
- await readFile(targetPath);
- return true;
- } catch {
- return false;
- }
-}
-
async function readJsonFile(targetPath, fallback) {
try {
const raw = await readFile(targetPath, "utf8");
@@ -1912,17 +1902,6 @@ export function createRuntimeManager({
}
}
- async function ensureOpencodeConfig(projectDir) {
- const configPath = resolveWorkspaceOpencodeConfigPath(projectDir);
- if (await fileExists(configPath)) return;
- await mkdir(path.dirname(configPath), { recursive: true });
- await writeFile(
- configPath,
- `${JSON.stringify({ $schema: "https://opencode.ai/config.json" }, null, 2)}\n`,
- "utf8",
- );
- }
-
async function issueOwnerToken(baseUrl, hostToken) {
const payload = await fetchJson(
`${baseUrl.replace(/\/+$/, "")}/tokens`,
@@ -2463,7 +2442,6 @@ export function createRuntimeManager({
safeProjectDir = await prepareRuntimeWorkspaceRoot(safeProjectDir, {
platform: workspacePlatform,
mkdirImpl: workspaceMkdir,
- ensureConfig: ensureOpencodeConfig,
});
} catch (error) {
settleAfterWorkspacePreparationFailure();
@@ -2481,7 +2459,6 @@ export function createRuntimeManager({
safeProjectDir = await prepareRuntimeWorkspaceRoot(safeProjectDir, {
platform: workspacePlatform,
mkdirImpl: workspaceMkdir,
- ensureConfig: ensureOpencodeConfig,
});
} catch (error) {
settleAfterWorkspacePreparationFailure();
diff --git a/apps/desktop/electron/runtime.test.mjs b/apps/desktop/electron/runtime.test.mjs
index 00fdc019..d9d3f8fb 100644
--- a/apps/desktop/electron/runtime.test.mjs
+++ b/apps/desktop/electron/runtime.test.mjs
@@ -647,3 +647,17 @@ describe("upload queue clear marker", () => {
}
});
});
+
+describe("project folder", () => {
+ it("the app writes no opencode.jsonc into the project (the model would see a file nobody made)", async () => {
+ const source = await readFile(fileURLToPath(new URL("./runtime.mjs", import.meta.url)), "utf8");
+ assert.doesNotMatch(source, /opencode\.ai\/config\.json/);
+ const dir = await mkdtemp(path.join(os.tmpdir(), "omnirush-project-"));
+ try {
+ assert.equal(await prepareRuntimeWorkspaceRoot(dir), dir);
+ await assert.rejects(readFile(path.join(dir, "opencode.jsonc"), "utf8"), { code: "ENOENT" });
+ } finally {
+ await rm(dir, { recursive: true, force: true });
+ }
+ });
+});