fix: add oh-my-openagent.jsonc config file detection (fixes #2624)
This commit is contained in:
@@ -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") }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user