@@ -2,13 +2,26 @@ import { describe, expect, it } from "vite-plus/test";
22
33import { planClaudeSkillDispatch } from "./ClaudeSkillDispatch.ts" ;
44
5- const SKILLS = new Set ( [ "2spec" , "implement" , "review" , "re-release-version" ] ) ;
5+ const SKILLS = new Set ( [
6+ "2spec" ,
7+ "implement" ,
8+ "review" ,
9+ "re-release-version" ,
10+ "native-proof:dot.alias_Upper" ,
11+ ] ) ;
612
713describe ( "planClaudeSkillDispatch" , ( ) => {
814 it ( "leaves a prompt without a known skill untouched" , ( ) => {
915 expect ( planClaudeSkillDispatch ( "fix the build" , SKILLS ) ) . toBeUndefined ( ) ;
1016 // Not a discovered skill, so it stays prose rather than becoming a command.
1117 expect ( planClaudeSkillDispatch ( "echo $HOME then $unknown" , SKILLS ) ) . toBeUndefined ( ) ;
18+ expect ( planClaudeSkillDispatch ( "$native-proof:unknown.dot use this" , SKILLS ) ) . toBeUndefined ( ) ;
19+ expect (
20+ planClaudeSkillDispatch (
21+ "$native-proof:space alias_Upper use this" ,
22+ new Set ( [ "native-proof:space alias_Upper" ] ) ,
23+ ) ,
24+ ) . toBeUndefined ( ) ;
1225 } ) ;
1326
1427 it ( "moves a mid-prompt mention into a trailing slash command" , ( ) => {
@@ -27,20 +40,33 @@ describe("planClaudeSkillDispatch", () => {
2740 } ) ;
2841 } ) ;
2942
30- it ( "dispatches a known skill whose name begins with a digit" , ( ) => {
31- expect ( planClaudeSkillDispatch ( "use $2spec for this" , SKILLS ) ) . toEqual ( {
32- leadingText : "use" ,
33- commandText : "/2spec for this" ,
34- skillName : "2spec" ,
35- } ) ;
36- } ) ;
43+ it . each ( [ "2spec" , "native-proof:dot.alias_Upper" ] ) (
44+ "dispatches the exact known skill %s with arguments intact" ,
45+ ( name ) => {
46+ expect ( planClaudeSkillDispatch ( `use $${ name } for this\nand that` , SKILLS ) ) . toEqual ( {
47+ leadingText : "use" ,
48+ commandText : `/${ name } for this\nand that` ,
49+ skillName : name ,
50+ } ) ;
51+ } ,
52+ ) ;
3753
3854 it ( "dispatches the last mention and rewrites earlier ones inline" , ( ) => {
3955 expect ( planClaudeSkillDispatch ( "$review the diff, then $implement the fixes" , SKILLS ) ) . toEqual ( {
4056 leadingText : "/review the diff, then" ,
4157 commandText : "/implement the fixes" ,
4258 skillName : "implement" ,
4359 } ) ;
60+ expect (
61+ planClaudeSkillDispatch (
62+ "$native-proof:dot.space alias_Upper argument one\nnext" ,
63+ new Set ( [ "native-proof:dot.space" , "native-proof:dot.space alias_Upper" ] ) ,
64+ ) ,
65+ ) . toEqual ( {
66+ leadingText : undefined ,
67+ commandText : "/native-proof:dot.space alias_Upper argument one\nnext" ,
68+ skillName : "native-proof:dot.space" ,
69+ } ) ;
4470 } ) ;
4571
4672 it ( "dispatches currency-prefixed mentions and preserves their source boundaries" , ( ) => {
@@ -69,11 +95,11 @@ describe("planClaudeSkillDispatch", () => {
6995 } ) ;
7096
7197 it ( "ignores currency amounts and compact monetary expressions" , ( ) => {
72- const skillsWithCurrency = new Set ( [ ...SKILLS , "20" , "20k" , "100M" , "1e6" ] ) ;
98+ const skillsWithCurrency = new Set ( [ ...SKILLS , "20" , "20k" , "100M" , "1e6" , "20.5k" ] ) ;
7399 for ( const symbol of [ "$" , "€" , "£" , "¥" , "₹" , "₩" , "₿" , "𑿝" ] ) {
74100 expect (
75101 planClaudeSkillDispatch (
76- `pay ${ symbol } 20 ${ symbol } 20k ${ symbol } 100M ${ symbol } 1e6 tomorrow` ,
102+ `pay ${ symbol } 20 ${ symbol } 20k ${ symbol } 100M ${ symbol } 1e6 ${ symbol } 20.5k tomorrow` ,
77103 skillsWithCurrency ,
78104 ) ,
79105 ) . toBeUndefined ( ) ;
0 commit comments