diff --git a/src/shared/commit-message-agent-spec.test.ts b/src/shared/commit-message-agent-spec.test.ts index af2d0ea43..ce7052d43 100644 --- a/src/shared/commit-message-agent-spec.test.ts +++ b/src/shared/commit-message-agent-spec.test.ts @@ -46,6 +46,27 @@ describe('COMMIT_MESSAGE_AGENT_SPECS', () => { expect(COMMIT_MESSAGE_AGENT_SPECS.pi?.defaultModelId).toBe('github-copilot/gpt-5.4-mini') }) + it('uses --prompt (not Claude --print) for Kimi non-interactive generation', () => { + // Why: kimi-code 0.31+ rejects --print; non-interactive mode is --prompt/-p (#11669). + const spec = COMMIT_MESSAGE_AGENT_SPECS.kimi + expect(spec).toBeDefined() + expect(spec!.promptDelivery).toBe('argv') + const args = spec!.buildArgs({ + prompt: 'Name a branch for adding login', + model: 'kimi-code/kimi-for-coding', + thinkingLevel: 'on' + }) + expect(args).toContain('--prompt') + expect(args).not.toContain('--print') + // Why: with argv delivery the prompt is the value of --prompt. + const promptIndex = args.indexOf('--prompt') + expect(promptIndex).toBeGreaterThanOrEqual(0) + expect(args[promptIndex + 1]).toBe('Name a branch for adding login') + expect(args).toContain('--quiet') + expect(args).toContain('--thinking') + expect(args).toEqual(expect.arrayContaining(['--model', 'kimi-code/kimi-for-coding'])) + }) + it('uses the provider-qualified Kimi model id accepted by the CLI', () => { expect(COMMIT_MESSAGE_AGENT_SPECS.kimi?.models.map((m) => m.id)).toEqual([ 'default', @@ -53,6 +74,25 @@ describe('COMMIT_MESSAGE_AGENT_SPECS', () => { ]) }) + it('maps Kimi thinking off and omission to distinct argv', () => { + const spec = COMMIT_MESSAGE_AGENT_SPECS.kimi! + const offArgs = spec.buildArgs({ prompt: 'PROMPT', model: 'default', thinkingLevel: 'off' }) + const defaultArgs = spec.buildArgs({ prompt: 'PROMPT', model: 'default' }) + + expect(offArgs).toContain('--no-thinking') + expect(offArgs).not.toContain('--thinking') + expect(defaultArgs).not.toContain('--thinking') + expect(defaultArgs).not.toContain('--no-thinking') + }) + + it('omits Kimi --model for the config default and an empty model', () => { + const spec = COMMIT_MESSAGE_AGENT_SPECS.kimi! + + for (const model of ['default', '']) { + expect(spec.buildArgs({ prompt: 'PROMPT', model })).not.toContain('--model') + } + }) + it('lists Copilot hosted CLI models even when account policy filters the picker', () => { expect(COMMIT_MESSAGE_AGENT_SPECS.copilot?.defaultModelId).toBe('gpt-5.4') expect(COMMIT_MESSAGE_AGENT_SPECS.copilot?.models.map((m) => m.id)).toEqual([ diff --git a/src/shared/commit-message-agent-spec.ts b/src/shared/commit-message-agent-spec.ts index 140bb025e..7c8b8bbfa 100644 --- a/src/shared/commit-message-agent-spec.ts +++ b/src/shared/commit-message-agent-spec.ts @@ -568,9 +568,12 @@ export const COMMIT_MESSAGE_AGENT_SPECS: Partial [ - '--print', + // Why: kimi-code accepts the generation prompt only via --prompt/-p (Claude's + // --print is rejected). Deliver on argv so --prompt receives the text (#11669). + promptDelivery: 'argv', + buildArgs: ({ prompt, model, thinkingLevel }) => [ + '--prompt', + prompt, '--quiet', ...(model && model !== 'default' ? ['--model', model] : []), ...(thinkingLevel === 'on'