feat(comment-checker): pass custom_prompt to CLI

- 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)
This commit is contained in:
YeonGyu-Kim
2025-12-28 15:01:37 +09:00
parent 18d134fa57
commit 465c9e511f
2 changed files with 9 additions and 3 deletions

View File

@@ -142,8 +142,9 @@ export interface CheckResult {
* Run comment-checker CLI with given input. * Run comment-checker CLI with given input.
* @param input Hook input to check * @param input Hook input to check
* @param cliPath Optional explicit path to CLI binary * @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<CheckResult> { export async function runCommentChecker(input: HookInput, cliPath?: string, customPrompt?: string): Promise<CheckResult> {
const binaryPath = cliPath ?? resolvedCliPath ?? COMMENT_CHECKER_CLI_PATH const binaryPath = cliPath ?? resolvedCliPath ?? COMMENT_CHECKER_CLI_PATH
if (!binaryPath) { 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)) debugLog("running comment-checker with input:", jsonInput.substring(0, 200))
try { try {
const proc = spawn([binaryPath], { const args = [binaryPath]
if (customPrompt) {
args.push("--prompt", customPrompt)
}
const proc = spawn(args, {
stdin: "pipe", stdin: "pipe",
stdout: "pipe", stdout: "pipe",
stderr: "pipe", stderr: "pipe",

View File

@@ -233,7 +233,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
: null; : null;
const commentChecker = isHookEnabled("comment-checker") const commentChecker = isHookEnabled("comment-checker")
? createCommentCheckerHooks() ? createCommentCheckerHooks(pluginConfig.comment_checker)
: null; : null;
const toolOutputTruncator = isHookEnabled("tool-output-truncator") const toolOutputTruncator = isHookEnabled("tool-output-truncator")
? createToolOutputTruncatorHook(ctx, { experimental: pluginConfig.experimental }) ? createToolOutputTruncatorHook(ctx, { experimental: pluginConfig.experimental })