From 32035d153e0bf44e7cbdaa2692205c9b061162f5 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Tue, 24 Mar 2026 20:38:54 +0900 Subject: [PATCH] fix(config): prefer canonical plugin config filenames Ensure oh-my-opencode filenames always win over legacy oh-my-openagent files so readers match canonical writer behavior. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/plugin-config.ts | 4 ++-- src/shared/jsonc-parser.test.ts | 14 +++++++------- src/shared/jsonc-parser.ts | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugin-config.ts b/src/plugin-config.ts index e3aadb1c3..67322f17a 100644 --- a/src/plugin-config.ts +++ b/src/plugin-config.ts @@ -166,7 +166,7 @@ export function loadPluginConfig( const userConfigPath = userDetected.format !== "none" ? userDetected.path - : path.join(configDir, "oh-my-openagent.json"); + : path.join(configDir, "oh-my-opencode.json"); // Project-level config path - prefer .jsonc over .json const projectBasePath = path.join(directory, ".opencode"); @@ -174,7 +174,7 @@ export function loadPluginConfig( const projectConfigPath = projectDetected.format !== "none" ? projectDetected.path - : path.join(projectBasePath, "oh-my-openagent.json"); + : path.join(projectBasePath, "oh-my-opencode.json"); // Load user config first (base) let config: OhMyOpenCodeConfig = diff --git a/src/shared/jsonc-parser.test.ts b/src/shared/jsonc-parser.test.ts index 759730d15..54c529399 100644 --- a/src/shared/jsonc-parser.test.ts +++ b/src/shared/jsonc-parser.test.ts @@ -268,7 +268,7 @@ describe("detectConfigFile", () => { describe("detectPluginConfigFile", () => { const testDir = join(__dirname, ".test-detect-plugin") - test("prefers oh-my-openagent over oh-my-opencode", () => { + test("prefers oh-my-opencode over oh-my-openagent", () => { // given if (!existsSync(testDir)) mkdirSync(testDir, { recursive: true }) writeFileSync(join(testDir, "oh-my-openagent.jsonc"), "{}") @@ -279,7 +279,7 @@ describe("detectPluginConfigFile", () => { // then expect(result.format).toBe("jsonc") - expect(result.path).toBe(join(testDir, "oh-my-openagent.jsonc")) + expect(result.path).toBe(join(testDir, "oh-my-opencode.jsonc")) rmSync(testDir, { recursive: true, force: true }) }) @@ -324,23 +324,23 @@ describe("detectPluginConfigFile", () => { // then expect(result.format).toBe("none") - expect(result.path).toBe(join(emptyDir, "oh-my-openagent.json")) + expect(result.path).toBe(join(emptyDir, "oh-my-opencode.json")) rmSync(testDir, { recursive: true, force: true }) }) - test("prefers oh-my-openagent.json over oh-my-opencode.jsonc", () => { + test("prefers oh-my-opencode.json over oh-my-openagent.jsonc", () => { // given if (!existsSync(testDir)) mkdirSync(testDir, { recursive: true }) - writeFileSync(join(testDir, "oh-my-openagent.json"), "{}") - writeFileSync(join(testDir, "oh-my-opencode.jsonc"), "{}") + writeFileSync(join(testDir, "oh-my-opencode.json"), "{}") + writeFileSync(join(testDir, "oh-my-openagent.jsonc"), "{}") // when const result = detectPluginConfigFile(testDir) // then expect(result.format).toBe("json") - expect(result.path).toBe(join(testDir, "oh-my-openagent.json")) + expect(result.path).toBe(join(testDir, "oh-my-opencode.json")) rmSync(testDir, { recursive: true, force: true }) }) diff --git a/src/shared/jsonc-parser.ts b/src/shared/jsonc-parser.ts index b7c715ad5..7431ad9a2 100644 --- a/src/shared/jsonc-parser.ts +++ b/src/shared/jsonc-parser.ts @@ -66,7 +66,7 @@ export function detectConfigFile(basePath: string): { return { format: "none", path: jsonPath } } -const PLUGIN_CONFIG_NAMES = ["oh-my-openagent", "oh-my-opencode"] as const +const PLUGIN_CONFIG_NAMES = ["oh-my-opencode", "oh-my-openagent"] as const export function detectPluginConfigFile(dir: string): { format: "json" | "jsonc" | "none"