fix(review): prepend YOUR_MODEL_ID declaration for model attribution

Some models (e.g., glm-5.1) ignore the {{model}} template in code
blocks and write their own footer without the model name. Fix:

1. BundledSkillLoader prepends YOUR_MODEL_ID="glm-5.1" as a top-level
   declaration at the start of the skill body — impossible to miss
2. SKILL.md references YOUR_MODEL_ID in footer instructions
3. Empty model → empty string (no "unknown" — prefer omission)
4. YOUR_MODEL_ID declaration only prepended when model is available

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
wenshao 2026-04-09 02:38:17 +08:00
parent 3364cf880f
commit df3cfd1e83
3 changed files with 26 additions and 12 deletions

View file

@ -146,11 +146,15 @@ describe('BundledSkillLoader', () => {
expect(result).toEqual({
type: 'submit_prompt',
content: [{ text: 'Review by qwen3-coder via Qwen Code' }],
content: [
{
text: 'YOUR_MODEL_ID="qwen3-coder"\n\nReview by qwen3-coder via Qwen Code',
},
],
});
});
it('should use "unknown" for {{model}} when getModel returns undefined', async () => {
it('should use empty string for {{model}} when getModel returns undefined', async () => {
const skill = makeSkill({
body: 'Review by {{model}}',
});
@ -166,7 +170,7 @@ describe('BundledSkillLoader', () => {
expect(result).toEqual({
type: 'submit_prompt',
content: [{ text: 'Review by unknown' }],
content: [{ text: 'Review by ' }],
});
});
@ -188,11 +192,15 @@ describe('BundledSkillLoader', () => {
expect(result).toEqual({
type: 'submit_prompt',
content: [{ text: 'Review by qwen3-coder\n\n/review 123' }],
content: [
{
text: 'YOUR_MODEL_ID="qwen3-coder"\n\nReview by qwen3-coder\n\n/review 123',
},
],
});
});
it('should use "unknown" for {{model}} when getModel returns empty string', async () => {
it('should use empty string for {{model}} when getModel returns empty string', async () => {
const skill = makeSkill({
body: 'Review by {{model}}',
});
@ -208,7 +216,7 @@ describe('BundledSkillLoader', () => {
expect(result).toEqual({
type: 'submit_prompt',
content: [{ text: 'Review by unknown' }],
content: [{ text: 'Review by ' }],
});
});