From 375148a5546806cc87298068eb82c7208d2d4ed4 Mon Sep 17 00:00:00 2001 From: Alex Verkhovsky Date: Sun, 22 Feb 2026 14:17:57 -0700 Subject: [PATCH] fix(schema): allow digits in compound trigger shortcuts The COMPOUND_TRIGGER_PATTERN and description bracket regex only accepted [A-Z]{1,3}, rejecting shortcuts like QD2 that include digits. Update both regexes to accept [A-Z][A-Z0-9]{0,2} so alphanumeric shortcuts work while still requiring a leading letter. Add test fixture covering the alphanumeric shortcut case. --- .../valid/menu-triggers/compound-triggers.agent.yaml | 3 +++ tools/schema/agent.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/fixtures/agent-schema/valid/menu-triggers/compound-triggers.agent.yaml b/test/fixtures/agent-schema/valid/menu-triggers/compound-triggers.agent.yaml index 7a9fdec0b..874f6046e 100644 --- a/test/fixtures/agent-schema/valid/menu-triggers/compound-triggers.agent.yaml +++ b/test/fixtures/agent-schema/valid/menu-triggers/compound-triggers.agent.yaml @@ -29,3 +29,6 @@ agent: - trigger: H or fuzzy match on help description: "[H] Single-word compound trigger (1-letter shortcut)" action: help + - trigger: QD2 or fuzzy match on quick-dev2 + description: "[QD2] Alphanumeric shortcut with trailing digit" + action: quick_dev2 diff --git a/tools/schema/agent.js b/tools/schema/agent.js index 93ced7c6e..6646190bb 100644 --- a/tools/schema/agent.js +++ b/tools/schema/agent.js @@ -4,7 +4,7 @@ const { z } = require('zod'); const COMMAND_TARGET_KEYS = ['workflow', 'validate-workflow', 'exec', 'action', 'tmpl', 'data']; const TRIGGER_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/; -const COMPOUND_TRIGGER_PATTERN = /^([A-Z]{1,3}) or fuzzy match on ([a-z0-9]+(?:-[a-z0-9]+)*)$/; +const COMPOUND_TRIGGER_PATTERN = /^([A-Z][A-Z0-9]{0,2}) or fuzzy match on ([a-z0-9]+(?:-[a-z0-9]+)*)$/; /** * Derive the expected shortcut from a kebab-case trigger. @@ -100,7 +100,7 @@ function agentSchema(options = {}) { } // Validate that shortcut matches description brackets - const descriptionMatch = item.description?.match(/^\[([A-Z]{1,3})\]/); + const descriptionMatch = item.description?.match(/^\[([A-Z][A-Z0-9]{0,2})\]/); if (!descriptionMatch) { ctx.addIssue({ code: 'custom',