@@ -117,6 +117,104 @@ const SkillsDeleteCommand = cmd({
117117 } ,
118118} )
119119
120+ // Skill flywheel — Stage 5 review queue. Auto-generated drafts from the
121+ // trajectory→pattern→synthesis pipeline land in pending_review status; this
122+ // subcommand lets the originator approve (publish + auto-install) or reject.
123+
124+ const SkillsReviewListCommand = cmd ( {
125+ command : "list" ,
126+ aliases : [ "ls" ] ,
127+ describe : "list auto-generated skill drafts pending review (originator-only)" ,
128+ builder : ( yargs ) => yargs . option ( "json" , { type : "boolean" , default : false } ) ,
129+ async handler ( args ) {
130+ UI . empty ( )
131+ prompts . intro ( "◈ Skill Drafts — Pending Review" )
132+ const token = await requireAuth ( ) ; if ( ! token ) { prompts . outro ( "Done" ) ; return }
133+ const res = await irisFetch ( `/api/v1/skills/auto-generated/pending` )
134+ const ok = await handleApiError ( res , "List pending drafts" ) ; if ( ! ok ) { prompts . outro ( "Done" ) ; return }
135+ const data = ( await res . json ( ) ) as any
136+ const drafts : any [ ] = data ?. data ?? [ ]
137+ if ( args . json ) { console . log ( JSON . stringify ( drafts , null , 2 ) ) ; prompts . outro ( "Done" ) ; return }
138+ if ( drafts . length === 0 ) {
139+ printDivider ( )
140+ console . log ( ` ${ dim ( "No drafts pending review." ) } ` )
141+ printDivider ( )
142+ prompts . outro ( "Done" )
143+ return
144+ }
145+ printDivider ( )
146+ for ( const d of drafts ) {
147+ console . log ( ` ${ bold ( `#${ d . id } ` ) } ${ d . display_name } ` )
148+ console . log ( ` ${ dim ( `tools: ${ ( d . tool_sequence ?? [ ] ) . join ( " → " ) || "(none)" } ` ) } ` )
149+ console . log ( ` ${ dim ( `confidence: ${ d . confidence ?. toFixed ?.( 2 ) ?? d . confidence } , bloq: ${ d . originating_bloq_id ?? "(any)" } , examples: ${ ( d . trajectory_ids ?? [ ] ) . length } ` ) } ` )
150+ console . log ( ` ${ dim ( d . description ?? "" ) } ` )
151+ console . log ( )
152+ }
153+ printDivider ( )
154+ prompts . outro ( `${ drafts . length } draft(s) — approve with: iris skills review approve <id>` )
155+ } ,
156+ } )
157+
158+ const SkillsReviewApproveCommand = cmd ( {
159+ command : "approve <id>" ,
160+ describe : "approve an auto-generated skill draft (publishes + auto-installs)" ,
161+ builder : ( yargs ) =>
162+ yargs
163+ . positional ( "id" , { type : "number" , demandOption : true } )
164+ . option ( "json" , { type : "boolean" , default : false } ) ,
165+ async handler ( args ) {
166+ UI . empty ( )
167+ prompts . intro ( `◈ Approve Skill Draft #${ args . id } ` )
168+ const token = await requireAuth ( ) ; if ( ! token ) { prompts . outro ( "Done" ) ; return }
169+ const res = await irisFetch ( `/api/v1/skills/${ args . id } /approve` , { method : "POST" , body : JSON . stringify ( { } ) } )
170+ const ok = await handleApiError ( res , "Approve skill" ) ; if ( ! ok ) { prompts . outro ( "Done" ) ; return }
171+ const data = ( await res . json ( ) ) as any
172+ if ( args . json ) { console . log ( JSON . stringify ( data , null , 2 ) ) ; prompts . outro ( "Done" ) ; return }
173+ printDivider ( )
174+ console . log ( ` ${ success ( "✓" ) } ${ data ?. message ?? "Approved" } ` )
175+ if ( data ?. data ?. installation_id ) console . log ( ` ${ dim ( `Installation ID: ${ data . data . installation_id } ` ) } ` )
176+ printDivider ( )
177+ prompts . outro ( "Done" )
178+ } ,
179+ } )
180+
181+ const SkillsReviewRejectCommand = cmd ( {
182+ command : "reject <id>" ,
183+ describe : "reject an auto-generated skill draft" ,
184+ builder : ( yargs ) =>
185+ yargs
186+ . positional ( "id" , { type : "number" , demandOption : true } )
187+ . option ( "reason" , { type : "string" , describe : "optional rejection reason" } )
188+ . option ( "json" , { type : "boolean" , default : false } ) ,
189+ async handler ( args ) {
190+ UI . empty ( )
191+ prompts . intro ( `◈ Reject Skill Draft #${ args . id } ` )
192+ const token = await requireAuth ( ) ; if ( ! token ) { prompts . outro ( "Done" ) ; return }
193+ const body : Record < string , unknown > = { }
194+ if ( args . reason ) body . reason = String ( args . reason )
195+ const res = await irisFetch ( `/api/v1/skills/${ args . id } /reject` , { method : "POST" , body : JSON . stringify ( body ) } )
196+ const ok = await handleApiError ( res , "Reject skill" ) ; if ( ! ok ) { prompts . outro ( "Done" ) ; return }
197+ const data = ( await res . json ( ) ) as any
198+ if ( args . json ) { console . log ( JSON . stringify ( data , null , 2 ) ) ; prompts . outro ( "Done" ) ; return }
199+ printDivider ( )
200+ console . log ( ` ${ success ( "✓" ) } ${ data ?. message ?? "Rejected" } ` )
201+ printDivider ( )
202+ prompts . outro ( "Done" )
203+ } ,
204+ } )
205+
206+ const SkillsReviewCommand = cmd ( {
207+ command : "review <command>" ,
208+ describe : "review auto-generated skill drafts — list, approve, reject" ,
209+ builder : ( yargs ) =>
210+ yargs
211+ . command ( SkillsReviewListCommand )
212+ . command ( SkillsReviewApproveCommand )
213+ . command ( SkillsReviewRejectCommand )
214+ . demandCommand ( 1 , "specify a subcommand: list | approve <id> | reject <id>" ) ,
215+ handler : ( ) => { } ,
216+ } )
217+
120218export const PlatformSkillsCommand = cmd ( {
121219 command : "skills" ,
122220 describe : "manage agent skills (V6)" ,
@@ -126,6 +224,7 @@ export const PlatformSkillsCommand = cmd({
126224 . command ( SkillsShowCommand )
127225 . command ( SkillsCreateCommand )
128226 . command ( SkillsDeleteCommand )
227+ . command ( SkillsReviewCommand )
129228 . demandCommand ( ) ,
130229 async handler ( ) { } ,
131230} )
0 commit comments