feat(hooks): Add interactive-bash-blocker hook

- Prevent interactive bash commands from being executed automatically
- Block commands in tool.execute.before hook
- Register in schema and main plugin initialization
This commit is contained in:
YeonGyu-Kim
2025-12-14 22:27:19 +09:00
parent 1aaa6e6ba2
commit 4b6b725f13
6 changed files with 189 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ import {
createAutoUpdateCheckerHook,
createKeywordDetectorHook,
createAgentUsageReminderHook,
createInteractiveBashBlockerHook,
} from "./hooks";
import { createGoogleAntigravityAuthPlugin } from "./auth/antigravity";
import {
@@ -238,6 +239,9 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
const agentUsageReminder = isHookEnabled("agent-usage-reminder")
? createAgentUsageReminderHook(ctx)
: null;
const interactiveBashBlocker = isHookEnabled("interactive-bash-blocker")
? createInteractiveBashBlockerHook(ctx)
: null;
updateTerminalTitle({ sessionId: "main" });
@@ -479,6 +483,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
"tool.execute.before": async (input, output) => {
await claudeCodeHooks["tool.execute.before"](input, output);
await interactiveBashBlocker?.["tool.execute.before"](input, output);
await commentChecker?.["tool.execute.before"](input, output);
if (input.sessionID === getMainSessionID()) {