From 465c9e511f0c66a014700585cd6aee26d5e6b5a7 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sun, 28 Dec 2025 15:01:37 +0900 Subject: [PATCH] feat(comment-checker): pass custom_prompt to CLI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add customPrompt parameter to runCommentChecker function - Pass --prompt flag to comment-checker CLI when custom_prompt is configured - Wire up config from plugin initialization 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode) --- src/hooks/comment-checker/cli.ts | 10 ++++++++-- src/index.ts | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/hooks/comment-checker/cli.ts b/src/hooks/comment-checker/cli.ts index 245a135..ee6d382 100644 --- a/src/hooks/comment-checker/cli.ts +++ b/src/hooks/comment-checker/cli.ts @@ -142,8 +142,9 @@ export interface CheckResult { * Run comment-checker CLI with given input. * @param input Hook input to check * @param cliPath Optional explicit path to CLI binary + * @param customPrompt Optional custom prompt to replace default warning message */ -export async function runCommentChecker(input: HookInput, cliPath?: string): Promise { +export async function runCommentChecker(input: HookInput, cliPath?: string, customPrompt?: string): Promise { const binaryPath = cliPath ?? resolvedCliPath ?? COMMENT_CHECKER_CLI_PATH if (!binaryPath) { @@ -160,7 +161,12 @@ export async function runCommentChecker(input: HookInput, cliPath?: string): Pro debugLog("running comment-checker with input:", jsonInput.substring(0, 200)) try { - const proc = spawn([binaryPath], { + const args = [binaryPath] + if (customPrompt) { + args.push("--prompt", customPrompt) + } + + const proc = spawn(args, { stdin: "pipe", stdout: "pipe", stderr: "pipe", diff --git a/src/index.ts b/src/index.ts index 0cf91c4..98a904a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -233,7 +233,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => { : null; const commentChecker = isHookEnabled("comment-checker") - ? createCommentCheckerHooks() + ? createCommentCheckerHooks(pluginConfig.comment_checker) : null; const toolOutputTruncator = isHookEnabled("tool-output-truncator") ? createToolOutputTruncatorHook(ctx, { experimental: pluginConfig.experimental })