refactor: convert config path constants to getter functions for dynamic OPENCODE_CONFIG_DIR support

🤖 Generated with assistance of OhMyOpenCode
This commit is contained in:
YeonGyu-Kim
2026-04-05 11:23:01 +09:00
parent b14665f174
commit 98c2f92251
10 changed files with 139 additions and 35 deletions
@@ -94,6 +94,26 @@ describe("loadPluginExtendedConfig", () => {
},
})
})
test("#given OPENCODE_CONFIG_DIR points at a profile dir after module import #when loading extended config #then it reads the profile config file", async () => {
//#given
const profileConfigDir = join(tempDirectory, ".config", "opencode", "profiles", "today")
const profileConfigPath = join(profileConfigDir, "opencode-cc-plugin.json")
mkdirSync(profileConfigDir, { recursive: true })
process.env.OPENCODE_CONFIG_DIR = profileConfigDir
writeConfigFile(profileConfigPath, ["profile-stop"])
//#when
clearPluginExtendedConfigCache()
const result = await loadPluginExtendedConfig()
//#then
expect(result).toEqual({
disabledHooks: {
Stop: ["profile-stop"],
},
})
})
})
function writeConfigFile(filePath: string, stopPatterns: string[]): void {