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 })