@@ -416,6 +416,59 @@ describe('InitCommand', () => {
416416 expect ( updatedContent ) . not . toContain ( 'Custom instruction added by user' ) ;
417417 } ) ;
418418
419+ it ( 'should create IFlow CLI slash command files with templates' , async ( ) => {
420+ queueSelections ( 'iflow' , DONE ) ;
421+ await initCommand . execute ( testDir ) ;
422+
423+ const iflowProposal = path . join (
424+ testDir ,
425+ '.iflow/commands/openspec-proposal.md'
426+ ) ;
427+ const iflowApply = path . join (
428+ testDir ,
429+ '.iflow/commands/openspec-apply.md'
430+ ) ;
431+ const iflowArchive = path . join (
432+ testDir ,
433+ '.iflow/commands/openspec-archive.md'
434+ ) ;
435+
436+ expect ( await fileExists ( iflowProposal ) ) . toBe ( true ) ;
437+ expect ( await fileExists ( iflowApply ) ) . toBe ( true ) ;
438+ expect ( await fileExists ( iflowArchive ) ) . toBe ( true ) ;
439+
440+ const proposalContent = await fs . readFile ( iflowProposal , 'utf-8' ) ;
441+ expect ( proposalContent ) . toContain ( 'description: Scaffold a new OpenSpec change and validate strictly.' ) ;
442+ expect ( proposalContent ) . toContain ( '<!-- OPENSPEC:START -->' ) ;
443+ expect ( proposalContent ) . toContain ( '**Guardrails**' ) ;
444+ expect ( proposalContent ) . toContain ( '<!-- OPENSPEC:END -->' ) ;
445+
446+ const applyContent = await fs . readFile ( iflowApply , 'utf-8' ) ;
447+ expect ( applyContent ) . toContain ( 'description: Implement an approved OpenSpec change and keep tasks in sync.' ) ;
448+ expect ( applyContent ) . toContain ( 'Work through tasks sequentially' ) ;
449+
450+ const archiveContent = await fs . readFile ( iflowArchive , 'utf-8' ) ;
451+ expect ( archiveContent ) . toContain ( 'description: Archive a deployed OpenSpec change and update specs.' ) ;
452+ expect ( archiveContent ) . toContain ( 'openspec archive <id>' ) ;
453+ } ) ;
454+
455+ it ( 'should update existing IFLOW.md with markers' , async ( ) => {
456+ queueSelections ( 'iflow' , DONE ) ;
457+
458+ const iflowPath = path . join ( testDir , 'IFLOW.md' ) ;
459+ const existingContent = '# My IFLOW Instructions\nCustom instructions here' ;
460+ await fs . writeFile ( iflowPath , existingContent ) ;
461+
462+ await initCommand . execute ( testDir ) ;
463+
464+ const updatedContent = await fs . readFile ( iflowPath , 'utf-8' ) ;
465+ expect ( updatedContent ) . toContain ( '<!-- OPENSPEC:START -->' ) ;
466+ expect ( updatedContent ) . toContain ( "@/openspec/AGENTS.md" ) ;
467+ expect ( updatedContent ) . toContain ( 'openspec update' ) ;
468+ expect ( updatedContent ) . toContain ( '<!-- OPENSPEC:END -->' ) ;
469+ expect ( updatedContent ) . toContain ( 'Custom instructions here' ) ;
470+ } ) ;
471+
419472 it ( 'should create OpenCode slash command files with templates' , async ( ) => {
420473 queueSelections ( 'opencode' , DONE ) ;
421474
0 commit comments