fix(#2823): auto-migrate legacy plugin name and warn users at startup
- logLegacyPluginStartupWarning now emits console.warn (visible to user, not just log file) when oh-my-opencode is detected in opencode.json - Auto-migrates opencode.json plugin entry from oh-my-opencode to oh-my-openagent (with backup) - plugin-config.ts: add console.warn when loading legacy config filename - test: 10 tests covering migration, console output, edge cases
This commit is contained in:
@@ -10,6 +10,8 @@ import {
|
||||
detectPluginConfigFile,
|
||||
migrateConfigFile,
|
||||
} from "./shared";
|
||||
import { migrateLegacyConfigFile } from "./shared/migrate-legacy-config-file";
|
||||
import { LEGACY_CONFIG_BASENAME } from "./shared/plugin-identity";
|
||||
|
||||
const PARTIAL_STRING_ARRAY_KEYS = new Set([
|
||||
"disabled_mcps",
|
||||
@@ -168,6 +170,11 @@ export function loadPluginConfig(
|
||||
? userDetected.path
|
||||
: path.join(configDir, "oh-my-opencode.json");
|
||||
|
||||
// Auto-copy legacy config file to canonical name if needed
|
||||
if (userDetected.format !== "none" && path.basename(userDetected.path).startsWith(LEGACY_CONFIG_BASENAME)) {
|
||||
migrateLegacyConfigFile(userDetected.path);
|
||||
}
|
||||
|
||||
// Project-level config path - prefer .jsonc over .json
|
||||
const projectBasePath = path.join(directory, ".opencode");
|
||||
const projectDetected = detectPluginConfigFile(projectBasePath);
|
||||
@@ -176,6 +183,11 @@ export function loadPluginConfig(
|
||||
? projectDetected.path
|
||||
: path.join(projectBasePath, "oh-my-opencode.json");
|
||||
|
||||
// Auto-copy legacy project config file to canonical name if needed
|
||||
if (projectDetected.format !== "none" && path.basename(projectDetected.path).startsWith(LEGACY_CONFIG_BASENAME)) {
|
||||
migrateLegacyConfigFile(projectDetected.path);
|
||||
}
|
||||
|
||||
// Load user config first (base)
|
||||
let config: OhMyOpenCodeConfig =
|
||||
loadConfigFromPath(userConfigPath, ctx) ?? {};
|
||||
|
||||
Reference in New Issue
Block a user