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:
@@ -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",
|
||||||
|
|||||||
@@ -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 })
|
||||||
|
|||||||
Reference in New Issue
Block a user