feat: integrate command/skill loaders and think-mode hook in main entry

- Add loadCommands() and loadSkills() to config
- Register think-mode hook for UserPromptSubmit event

🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
YeonGyu-Kim
2025-12-09 15:49:13 +09:00
parent 7059407cbc
commit c0e0dc1f95

View File

@@ -8,7 +8,18 @@ import {
createGrepOutputTruncatorHook,
createDirectoryAgentsInjectorHook,
createEmptyTaskResponseDetectorHook,
createThinkModeHook,
} from "./hooks";
import {
loadUserCommands,
loadProjectCommands,
loadOpencodeGlobalCommands,
loadOpencodeProjectCommands,
} from "./features/command-loader";
import {
loadUserSkillsAsCommands,
loadProjectSkillsAsCommands,
} from "./features/skill-loader";
import { updateTerminalTitle } from "./features/terminal";
import { builtinTools } from "./tools";
import { createBuiltinMcps } from "./mcp";
@@ -57,6 +68,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
const grepOutputTruncator = createGrepOutputTruncatorHook(ctx);
const directoryAgentsInjector = createDirectoryAgentsInjectorHook(ctx);
const emptyTaskResponseDetector = createEmptyTaskResponseDetectorHook(ctx);
const thinkMode = createThinkModeHook();
updateTerminalTitle({ sessionId: "main" });
@@ -86,12 +98,31 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
...config.mcp,
...createBuiltinMcps(pluginConfig.disabled_mcps),
};
const userCommands = loadUserCommands();
const opencodeGlobalCommands = loadOpencodeGlobalCommands();
const systemCommands = config.command ?? {};
const projectCommands = loadProjectCommands();
const opencodeProjectCommands = loadOpencodeProjectCommands();
const userSkills = loadUserSkillsAsCommands();
const projectSkills = loadProjectSkillsAsCommands();
config.command = {
...userCommands,
...userSkills,
...opencodeGlobalCommands,
...systemCommands,
...projectCommands,
...projectSkills,
...opencodeProjectCommands,
};
},
event: async (input) => {
await todoContinuationEnforcer(input);
await contextWindowMonitor.event(input);
await directoryAgentsInjector.event(input);
await thinkMode.event(input);
const { event } = input;
const props = event.properties as Record<string, unknown> | undefined;