feat(compat): package rename compatibility layer for oh-my-opencode → oh-my-openagent

- Add legacy plugin startup warning when oh-my-opencode config detected
- Update CLI installer and TUI installer for new package name
- Split monolithic config-manager.test.ts into focused test modules
- Add plugin config detection tests for legacy name fallback
- Update processed-command-store to use plugin-identity constants
- Add claude-code-plugin-loader discovery test for both config names
- Update chat-params and ultrawork-db tests for plugin identity

Part of #2823
This commit is contained in:
YeonGyu-Kim
2026-03-26 19:44:55 +09:00
parent d39891fcab
commit 1c54fdad26
16 changed files with 526 additions and 337 deletions
@@ -0,0 +1,76 @@
import { beforeEach, describe, expect, it, mock } from "bun:test"
import type { LegacyPluginCheckResult } from "./legacy-plugin-warning"
function createLegacyPluginCheckResult(
overrides: Partial<LegacyPluginCheckResult> = {},
): LegacyPluginCheckResult {
return {
hasLegacyEntry: false,
hasCanonicalEntry: false,
legacyEntries: [],
...overrides,
}
}
const mockCheckForLegacyPluginEntry = mock(() => createLegacyPluginCheckResult())
const mockLog = mock(() => {})
mock.module("./legacy-plugin-warning", () => ({
checkForLegacyPluginEntry: mockCheckForLegacyPluginEntry,
}))
mock.module("./logger", () => ({
log: mockLog,
}))
async function importFreshStartupWarningModule(): Promise<typeof import("./log-legacy-plugin-startup-warning")> {
return import(`./log-legacy-plugin-startup-warning?test=${Date.now()}-${Math.random()}`)
}
describe("logLegacyPluginStartupWarning", () => {
beforeEach(() => {
mockCheckForLegacyPluginEntry.mockReset()
mockLog.mockReset()
mockCheckForLegacyPluginEntry.mockReturnValue(createLegacyPluginCheckResult())
})
describe("#given OpenCode config contains legacy plugin entries", () => {
it("logs the legacy entries with canonical replacements", async () => {
//#given
mockCheckForLegacyPluginEntry.mockReturnValue(createLegacyPluginCheckResult({
hasLegacyEntry: true,
legacyEntries: ["oh-my-opencode", "oh-my-opencode@3.13.1"],
}))
const { logLegacyPluginStartupWarning } = await importFreshStartupWarningModule()
//#when
logLegacyPluginStartupWarning()
//#then
expect(mockLog).toHaveBeenCalledTimes(1)
expect(mockLog).toHaveBeenCalledWith(
"[OhMyOpenCodePlugin] Legacy plugin entry detected in OpenCode config",
{
legacyEntries: ["oh-my-opencode", "oh-my-opencode@3.13.1"],
suggestedEntries: ["oh-my-openagent", "oh-my-openagent@3.13.1"],
hasCanonicalEntry: false,
},
)
})
})
describe("#given OpenCode config uses only canonical plugin entries", () => {
it("does not log a startup warning", async () => {
//#given
const { logLegacyPluginStartupWarning } = await importFreshStartupWarningModule()
//#when
logLegacyPluginStartupWarning()
//#then
expect(mockLog).not.toHaveBeenCalled()
})
})
})