99 expandSkillGroups ,
1010 serializeSkill ,
1111} from '../skill-generator.js' ;
12- import { generateCliManifest } from '../build-phases.js' ;
12+ import { generateCliEntries } from '../build-phases.js' ;
1313
1414function createFixture ( tree , baseDir ) {
1515 for ( const [ name , content ] of Object . entries ( tree ) ) {
@@ -293,43 +293,31 @@ describe('expandSkillGroups with cli blocks', () => {
293293 } ) ;
294294} ) ;
295295
296- describe ( 'generateCliManifest' , ( ) => {
297- const baseManifest = {
298- version : '1.0' ,
299- buildVersion : 'test' ,
300- buildTimestamp : '2026-06-08T00:00:00.000Z' ,
301- } ;
302-
296+ describe ( 'generateCliEntries' , ( ) => {
303297 it ( 'emits only skills with a cli block' , ( ) => {
304298 const skills = [
305299 { id : 'integration-django' , displayName : 'Django' , description : 'd' } ,
306300 { id : 'audit-events' , displayName : 'Audit events' , description : 'a' ,
307301 cli : { role : 'command' , parentCommand : 'audit' , command : 'events' } } ,
308302 ] ;
309- const manifest = generateCliManifest ( { allSkills : skills , manifest : baseManifest } ) ;
310- expect ( manifest . entries ) . toHaveLength ( 1 ) ;
311- expect ( manifest . entries [ 0 ] . skillId ) . toBe ( 'audit-events' ) ;
303+ const entries = generateCliEntries ( { allSkills : skills } ) ;
304+ expect ( entries ) . toHaveLength ( 1 ) ;
305+ expect ( entries [ 0 ] . skillId ) . toBe ( 'audit-events' ) ;
312306 } ) ;
313307
314- it ( 'carries version + buildVersion + buildTimestamp through' , ( ) => {
315- const manifest = generateCliManifest ( { allSkills : [ ] , manifest : baseManifest } ) ;
316- expect ( manifest ) . toMatchObject ( {
317- version : '1.0' ,
318- buildVersion : 'test' ,
319- buildTimestamp : '2026-06-08T00:00:00.000Z' ,
320- entries : [ ] ,
321- } ) ;
308+ it ( 'returns an empty array when no skills declare a cli block' , ( ) => {
309+ const entries = generateCliEntries ( { allSkills : [ ] } ) ;
310+ expect ( entries ) . toEqual ( [ ] ) ;
322311 } ) ;
323312
324313 it ( 'omits command and parentCommand when not set on the cli block' , ( ) => {
325- const manifest = generateCliManifest ( {
314+ const entries = generateCliEntries ( {
326315 allSkills : [
327316 { id : 'doctor' , displayName : 'Doctor' , description : 'd' ,
328317 cli : { role : 'skill' } } ,
329318 ] ,
330- manifest : baseManifest ,
331319 } ) ;
332- expect ( manifest . entries [ 0 ] ) . toEqual ( {
320+ expect ( entries [ 0 ] ) . toEqual ( {
333321 skillId : 'doctor' ,
334322 role : 'skill' ,
335323 displayName : 'Doctor' ,
@@ -338,7 +326,7 @@ describe('generateCliManifest', () => {
338326 } ) ;
339327
340328 it ( 'sorts entries by role, then parentCommand, then command' , ( ) => {
341- const manifest = generateCliManifest ( {
329+ const entries = generateCliEntries ( {
342330 allSkills : [
343331 { id : 'b-skill' , displayName : 'B' , description : 'd' , cli : { role : 'skill' } } ,
344332 { id : 'a-int' , displayName : 'A' , description : 'd' , cli : { role : 'internal' } } ,
@@ -349,22 +337,20 @@ describe('generateCliManifest', () => {
349337 { id : 'revenue' , displayName : 'R' , description : 'd' ,
350338 cli : { role : 'command' , command : 'revenue' } } ,
351339 ] ,
352- manifest : baseManifest ,
353340 } ) ;
354- const order = manifest . entries . map ( e => e . skillId ) ;
341+ const order = entries . map ( e => e . skillId ) ;
355342 // command flat (no parent) sorts before grouped 'audit', then skill, then internal
356343 expect ( order ) . toEqual ( [ 'revenue' , 'audit-all' , 'audit-events' , 'b-skill' , 'a-int' ] ) ;
357344 } ) ;
358345
359346 it ( 'carries recommended:true through into the entry' , ( ) => {
360- const manifest = generateCliManifest ( {
347+ const entries = generateCliEntries ( {
361348 allSkills : [
362349 { id : 'audit-all' , displayName : 'Audit' , description : 'd' ,
363350 cli : { role : 'command' , parentCommand : 'audit' , command : 'all' , recommended : true } } ,
364351 ] ,
365- manifest : baseManifest ,
366352 } ) ;
367- expect ( manifest . entries [ 0 ] ) . toMatchObject ( {
353+ expect ( entries [ 0 ] ) . toMatchObject ( {
368354 skillId : 'audit-all' ,
369355 parentCommand : 'audit' ,
370356 command : 'all' ,
@@ -374,26 +360,24 @@ describe('generateCliManifest', () => {
374360
375361 it ( 'throws when a family has more than one recommended leaf' , ( ) => {
376362 expect ( ( ) =>
377- generateCliManifest ( {
363+ generateCliEntries ( {
378364 allSkills : [
379365 { id : 'audit-all' , displayName : 'A' , description : 'd' ,
380366 cli : { role : 'command' , parentCommand : 'audit' , command : 'all' , recommended : true } } ,
381367 { id : 'audit-events' , displayName : 'AE' , description : 'd' ,
382368 cli : { role : 'command' , parentCommand : 'audit' , command : 'events' , recommended : true } } ,
383369 ] ,
384- manifest : baseManifest ,
385370 } ) ,
386371 ) . toThrow ( / F a m i l y " a u d i t " h a s m o r e t h a n o n e c l i \. r e c o m m e n d e d l e a f / ) ;
387372 } ) ;
388373
389374 it ( 'throws when recommended is set on a flat command with no parentCommand' , ( ) => {
390375 expect ( ( ) =>
391- generateCliManifest ( {
376+ generateCliEntries ( {
392377 allSkills : [
393378 { id : 'revenue' , displayName : 'R' , description : 'd' ,
394379 cli : { role : 'command' , command : 'revenue' , recommended : true } } ,
395380 ] ,
396- manifest : baseManifest ,
397381 } ) ,
398382 ) . toThrow ( / o n l y v a l i d o n a l e a f i n s i d e a f a m i l y / ) ;
399383 } ) ;
0 commit comments