From 09fd131f24328a746737909f3fd7d841ce46a77a Mon Sep 17 00:00:00 2001 From: David Hardy Date: Fri, 27 Feb 2026 14:46:12 +0000 Subject: [PATCH] fix: initialize config context in plugin runtime to prevent warnings The auto-update checker hook calls getConfigDir() which requires the config context to be initialized via initConfigContext(). When running in the OpenCode TUI plugin runtime (vs CLI), this initialization never happened, causing the warning: "getConfigContext() called before initConfigContext(); defaulting to CLI paths." This warning would appear when opening folders containing .mulch or .beads directories because the lifecycle plugins triggered the auto-update checker. Fix: Call initConfigContext("opencode", null) at plugin startup to ensure the config context is properly initialized for all hooks and utilities. Fixes upstream issue where TUI users see spurious bun install warnings. --- src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.ts b/src/index.ts index bba719041..3ae22411c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ +import { initConfigContext } from "./cli/config-manager/config-context" import type { Plugin } from "@opencode-ai/plugin" import type { HookName } from "./config" @@ -14,6 +15,8 @@ import { injectServerAuthIntoClient, log } from "./shared" import { startTmuxCheck } from "./tools" const OhMyOpenCodePlugin: Plugin = async (ctx) => { + // Initialize config context for plugin runtime (prevents warnings from hooks) + initConfigContext("opencode", null) log("[OhMyOpenCodePlugin] ENTRY - plugin loading", { directory: ctx.directory, })