@@ -8,6 +8,38 @@ import {
88 checkConsumerPointers ,
99 EXPECTED_POINTER_VERSION ,
1010} from "../application/agent-content" ;
11+ import { parseAgentContentRest } from "./cmd-skill" ;
12+
13+ describe ( "parseAgentContentRest" , ( ) => {
14+ it ( "returns help on --help / -h" , ( ) => {
15+ expect ( parseAgentContentRest ( [ "skill" , "--help" ] ) . kind ) . toBe ( "help" ) ;
16+ expect ( parseAgentContentRest ( [ "rule" , "-h" ] ) . kind ) . toBe ( "help" ) ;
17+ } ) ;
18+
19+ it ( "runs with no extra arguments" , ( ) => {
20+ expect ( parseAgentContentRest ( [ "skill" ] ) ) . toEqual ( {
21+ kind : "run" ,
22+ verb : "skill" ,
23+ } ) ;
24+ expect ( parseAgentContentRest ( [ "rule" ] ) ) . toEqual ( {
25+ kind : "run" ,
26+ verb : "rule" ,
27+ } ) ;
28+ } ) ;
29+
30+ it ( "errors on unexpected flags or positionals" , ( ) => {
31+ const skillJson = parseAgentContentRest ( [ "skill" , "--json" ] ) ;
32+ expect ( skillJson . kind ) . toBe ( "error" ) ;
33+ if ( skillJson . kind === "error" ) {
34+ expect ( skillJson . message ) . toContain ( "unexpected argument" ) ;
35+ }
36+ const ruleExtra = parseAgentContentRest ( [ "rule" , "extra" ] ) ;
37+ expect ( ruleExtra . kind ) . toBe ( "error" ) ;
38+ if ( ruleExtra . kind === "error" ) {
39+ expect ( ruleExtra . message ) . toContain ( "unexpected argument" ) ;
40+ }
41+ } ) ;
42+ } ) ;
1143
1244describe ( "agent content fetch surfaces" , ( ) => {
1345 it ( "assembles the skill from section files" , ( ) => {
0 commit comments