feat(gen-skill-docs): keep voice triggers in the root routing block

The Claude catalog trim drops each skill's "Voice triggers (speech-to-text
aliases)" line from its description, and the body section that used to hold
it is gone. {{VOICE_TRIGGER_ROUTING}} renders them in the root router's
routing block instead: one "Voice trigger ... → invoke /<skill>" line per
skill, read from the templates' voice-triggers lists, so disabled-skill
filtering applies to them like any other routing line. Other hosts keep the
line in each description and render nothing here.

extractVoiceTriggers moves to the new resolver so the generator and the
resolver share one parser.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 645e75b1e8)
This commit is contained in:
thanhnguyentung95 authored and garrytan committed 2026-10-19 18:36:21 +00:00
1 parent 08eadda5d7
commit 0e85635e86
5 files changed
+82 -26

No files matched your search

+15
View File
@@ -4451,6 +4451,21 @@ describe('voice-triggers processing', () => {
expect(content).toContain('Voice triggers (speech-to-text aliases):');
});
test('Claude root router routes every skill voice trigger the catalog trim drops', () => {
const routing = between(fs.readFileSync(path.join(ROOT, 'SKILL.md'), 'utf-8'), '**Routing rules', '**Route only to skills');
const skills = fs.readdirSync(ROOT).filter(d => fs.existsSync(path.join(ROOT, d, 'SKILL.md.tmpl')));
let routed = 0;
for (const skill of skills) {
const triggers = extractVoiceTriggers(fs.readFileSync(path.join(ROOT, skill, 'SKILL.md.tmpl'), 'utf-8').replace(/\r\n/g, '\n'));
if (triggers.length === 0) continue;
const line = routing.split('\n').find(l => l.endsWith(`→ invoke \`/${skill}\``) && l.startsWith('- Voice trigger '));
expect(line, skill).toBeDefined();
for (const t of triggers) expect(line, skill).toContain(`"${t}"`);
routed++;
}
expect(routed).toBeGreaterThan(0);
});
test('generated CSO SKILL.md does NOT contain raw voice-triggers field', () => {
const content = fs.readFileSync(path.join(ROOT, 'cso', 'SKILL.md'), 'utf-8');
const fmEnd = content.indexOf('\n---', 4);