fix: add oh-my-openagent.jsonc config file detection (fixes #2624)

This commit is contained in:
YeonGyu-Kim
2026-03-23 18:11:01 +09:00
parent d886ac701f
commit 7f20dd6ff5
7 changed files with 256 additions and 25 deletions
+14
View File
@@ -1,4 +1,5 @@
import { existsSync, readFileSync } from "node:fs"
import { join } from "node:path"
import { parse, ParseError, printParseErrorCode } from "jsonc-parser"
export interface JsoncParseResult<T> {
@@ -64,3 +65,16 @@ export function detectConfigFile(basePath: string): {
}
return { format: "none", path: jsonPath }
}
const PLUGIN_CONFIG_NAMES = ["oh-my-openagent", "oh-my-opencode"] as const
export function detectPluginConfigFile(dir: string): {
format: "json" | "jsonc" | "none"
path: string
} {
for (const name of PLUGIN_CONFIG_NAMES) {
const result = detectConfigFile(join(dir, name))
if (result.format !== "none") return result
}
return { format: "none", path: join(dir, PLUGIN_CONFIG_NAMES[0] + ".json") }
}