fix(review): address 4 Copilot comments

- Add model attribution to no-findings LGTM path
- Handle empty string from getModel() with .trim() || 'unknown'
- Add tests for {{model}} with args and empty model ID
- Fix doc contradiction: PR autofix pushes automatically from worktree

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
wenshao 2026-04-07 03:13:23 +08:00
parent a5cc2c38cb
commit 08a797cf76
4 changed files with 47 additions and 3 deletions

View file

@ -170,6 +170,48 @@ describe('BundledSkillLoader', () => {
});
});
it('should resolve {{model}} when args are provided', async () => {
const skill = makeSkill({
body: 'Review by {{model}}',
});
mockSkillManager.listSkills.mockResolvedValue([skill]);
(mockConfig.getModel as ReturnType<typeof vi.fn>).mockReturnValue(
'qwen3-coder',
);
const loader = new BundledSkillLoader(mockConfig);
const commands = await loader.loadCommands(signal);
const result = await commands[0].action!(
{ invocation: { raw: '/review 123', args: '123' } } as never,
'123',
);
expect(result).toEqual({
type: 'submit_prompt',
content: [{ text: 'Review by qwen3-coder\n\n/review 123' }],
});
});
it('should use "unknown" for {{model}} when getModel returns empty string', async () => {
const skill = makeSkill({
body: 'Review by {{model}}',
});
mockSkillManager.listSkills.mockResolvedValue([skill]);
(mockConfig.getModel as ReturnType<typeof vi.fn>).mockReturnValue('');
const loader = new BundledSkillLoader(mockConfig);
const commands = await loader.loadCommands(signal);
const result = await commands[0].action!(
{ invocation: { raw: '/review', args: '' } } as never,
'',
);
expect(result).toEqual({
type: 'submit_prompt',
content: [{ text: 'Review by unknown' }],
});
});
it('should not modify skill body without {{model}} template', async () => {
const skill = makeSkill({ body: 'No template here' });
mockSkillManager.listSkills.mockResolvedValue([skill]);