test: remove remaining legacy warning mock leaks
This commit is contained in:
@@ -4,15 +4,25 @@ import { migrateLegacyPluginEntry } from "./migrate-legacy-plugin-entry"
|
||||
import { toCanonicalEntry } from "./plugin-entry-migrator"
|
||||
import { LEGACY_PLUGIN_NAME, PLUGIN_NAME } from "./plugin-identity"
|
||||
|
||||
export function logLegacyPluginStartupWarning(): void {
|
||||
const result = checkForLegacyPluginEntry()
|
||||
type LogLegacyPluginStartupWarningDeps = {
|
||||
checkForLegacyPluginEntry?: typeof checkForLegacyPluginEntry
|
||||
log?: typeof log
|
||||
migrateLegacyPluginEntry?: typeof migrateLegacyPluginEntry
|
||||
}
|
||||
|
||||
export function logLegacyPluginStartupWarning(deps: LogLegacyPluginStartupWarningDeps = {}): void {
|
||||
const checkForLegacyPluginEntryFn = deps.checkForLegacyPluginEntry ?? checkForLegacyPluginEntry
|
||||
const logFn = deps.log ?? log
|
||||
const migrateLegacyPluginEntryFn = deps.migrateLegacyPluginEntry ?? migrateLegacyPluginEntry
|
||||
|
||||
const result = checkForLegacyPluginEntryFn()
|
||||
if (!result.hasLegacyEntry) {
|
||||
return
|
||||
}
|
||||
|
||||
const suggestedEntries = result.legacyEntries.map(toCanonicalEntry)
|
||||
|
||||
log("[OhMyOpenCodePlugin] Legacy plugin entry detected in OpenCode config", {
|
||||
logFn("[OhMyOpenCodePlugin] Legacy plugin entry detected in OpenCode config", {
|
||||
legacyEntries: result.legacyEntries,
|
||||
suggestedEntries,
|
||||
hasCanonicalEntry: result.hasCanonicalEntry,
|
||||
@@ -24,7 +34,7 @@ export function logLegacyPluginStartupWarning(): void {
|
||||
+ ` Attempting auto-migration...`,
|
||||
)
|
||||
|
||||
const migrated = migrateLegacyPluginEntry(result.configPath!)
|
||||
const migrated = migrateLegacyPluginEntryFn(result.configPath!)
|
||||
if (migrated) {
|
||||
console.warn(`[oh-my-openagent] Auto-migrated opencode.json: ${result.legacyEntries.join(", ")} -> ${suggestedEntries.join(", ")}`)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user