fix: use jsonc-parser for safe JSONC migration and add project-local config detection

This commit is contained in:
YeonGyu-Kim
2026-03-31 17:06:46 -07:00
parent 9f2c4500e8
commit 11ee88f28f
7 changed files with 187 additions and 54 deletions
+4 -2
View File
@@ -1,3 +1,5 @@
import { dirname } from "node:path"
import type { PluginInput } from "@opencode-ai/plugin"
import { checkForLegacyPluginEntry } from "../../shared/legacy-plugin-warning"
@@ -17,10 +19,10 @@ export function createLegacyPluginToastHook(ctx: PluginInput) {
fired = true
const result = checkForLegacyPluginEntry()
const result = checkForLegacyPluginEntry(undefined, ctx.directory)
if (!result.hasLegacyEntry) return
const migration = autoMigrateLegacyPluginEntry()
const migration = autoMigrateLegacyPluginEntry(result.configPath ? dirname(result.configPath) : undefined)
if (migration.migrated) {
log("[legacy-plugin-toast] Auto-migrated opencode.json plugin entry", {