Phase 3: add detectSlashSkill — slash command detection per SPEC §6.2.

Detect /skill:name at the start of raw user input for the slash tracking source.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-17 10:18:04 +07:00
parent 884fee99a5
commit 2d7392f5ed
+8
View File
@@ -0,0 +1,8 @@
/** Raw `/skill:name` at start of user input (SPEC §6.2 #1). */
const SLASH_SKILL_RE = /^\/skill:([a-z0-9-]+)/;
/** Returns skill name when text is a slash skill command, else null. */
export function detectSlashSkill(text: string): string | null {
const match = SLASH_SKILL_RE.exec(text);
return match?.[1] ?? null;
}