From 2d7392f5ed2382865a9024f6c1819111b343c73d Mon Sep 17 00:00:00 2001 From: GRayHook Date: Wed, 17 Jun 2026 10:18:04 +0700 Subject: [PATCH] =?UTF-8?q?Phase=203:=20add=20detectSlashSkill=20=E2=80=94?= =?UTF-8?q?=20slash=20command=20detection=20per=20SPEC=20=C2=A76.2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Detect /skill:name at the start of raw user input for the slash tracking source. Co-authored-by: Cursor --- src/detect.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/detect.ts diff --git a/src/detect.ts b/src/detect.ts new file mode 100644 index 0000000..a7401d6 --- /dev/null +++ b/src/detect.ts @@ -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; +}