@@ -1347,6 +1347,61 @@ describe('InitCommand', () => {
13471347 expect ( qoderChoice . configured ) . toBe ( true ) ;
13481348 } ) ;
13491349
1350+ it ( 'should create IFlow slash command files with templates' , async ( ) => {
1351+ queueSelections ( 'iflow' , DONE ) ;
1352+
1353+ await initCommand . execute ( testDir ) ;
1354+
1355+ const iflowProposal = path . join (
1356+ testDir ,
1357+ '.iflow/commands/openspec-proposal.md'
1358+ ) ;
1359+ const iflowApply = path . join (
1360+ testDir ,
1361+ '.iflow/commands/openspec-apply.md'
1362+ ) ;
1363+ const iflowArchive = path . join (
1364+ testDir ,
1365+ '.iflow/commands/openspec-archive.md'
1366+ ) ;
1367+
1368+ expect ( await fileExists ( iflowProposal ) ) . toBe ( true ) ;
1369+ expect ( await fileExists ( iflowApply ) ) . toBe ( true ) ;
1370+ expect ( await fileExists ( iflowArchive ) ) . toBe ( true ) ;
1371+
1372+ const proposalContent = await fs . readFile ( iflowProposal , 'utf-8' ) ;
1373+ expect ( proposalContent ) . toContain ( '---' ) ;
1374+ expect ( proposalContent ) . toContain ( 'name: /openspec-proposal' ) ;
1375+ expect ( proposalContent ) . toContain ( 'description: Scaffold a new OpenSpec change and validate strictly.' ) ;
1376+ expect ( proposalContent ) . toContain ( 'category: OpenSpec' ) ;
1377+ expect ( proposalContent ) . toContain ( '<!-- OPENSPEC:START -->' ) ;
1378+ expect ( proposalContent ) . toContain ( '**Guardrails**' ) ;
1379+
1380+ const applyContent = await fs . readFile ( iflowApply , 'utf-8' ) ;
1381+ expect ( applyContent ) . toContain ( '---' ) ;
1382+ expect ( applyContent ) . toContain ( 'name: /openspec-apply' ) ;
1383+ expect ( applyContent ) . toContain ( 'description: Implement an approved OpenSpec change and keep tasks in sync.' ) ;
1384+ expect ( applyContent ) . toContain ( 'Work through tasks sequentially' ) ;
1385+
1386+ const archiveContent = await fs . readFile ( iflowArchive , 'utf-8' ) ;
1387+ expect ( archiveContent ) . toContain ( '---' ) ;
1388+ expect ( archiveContent ) . toContain ( 'name: /openspec-archive' ) ;
1389+ expect ( archiveContent ) . toContain ( 'description: Archive a deployed OpenSpec change and update specs.' ) ;
1390+ expect ( archiveContent ) . toContain ( 'openspec archive <id> --yes' ) ;
1391+ } ) ;
1392+
1393+ it ( 'should mark iFlow as already configured during extend mode' , async ( ) => {
1394+ queueSelections ( 'iflow' , DONE , 'iflow' , DONE ) ;
1395+ await initCommand . execute ( testDir ) ;
1396+ await initCommand . execute ( testDir ) ;
1397+
1398+ const secondRunArgs = mockPrompt . mock . calls [ 1 ] [ 0 ] ;
1399+ const iflowChoice = secondRunArgs . choices . find (
1400+ ( choice : any ) => choice . value === 'iflow'
1401+ ) ;
1402+ expect ( iflowChoice . configured ) . toBe ( true ) ;
1403+ } ) ;
1404+
13501405 it ( 'should create COSTRICT.md when CoStrict is selected' , async ( ) => {
13511406 queueSelections ( 'costrict' , DONE ) ;
13521407
@@ -1376,6 +1431,22 @@ describe('InitCommand', () => {
13761431 expect ( content ) . toContain ( 'openspec update' ) ;
13771432 expect ( content ) . toContain ( '<!-- OPENSPEC:END -->' ) ;
13781433 } ) ;
1434+
1435+ it ( 'should create IFLOW.md when iFlow is selected' , async ( ) => {
1436+ queueSelections ( 'iflow' , DONE ) ;
1437+
1438+ await initCommand . execute ( testDir ) ;
1439+
1440+ const iflowPath = path . join ( testDir , 'IFLOW.md' ) ;
1441+ expect ( await fileExists ( iflowPath ) ) . toBe ( true ) ;
1442+
1443+ const content = await fs . readFile ( iflowPath , 'utf-8' ) ;
1444+ expect ( content ) . toContain ( '<!-- OPENSPEC:START -->' ) ;
1445+ expect ( content ) . toContain ( "@/openspec/AGENTS.md" ) ;
1446+ expect ( content ) . toContain ( 'openspec update' ) ;
1447+ expect ( content ) . toContain ( '<!-- OPENSPEC:END -->' ) ;
1448+ } ) ;
1449+
13791450 it ( 'should update existing COSTRICT.md with markers' , async ( ) => {
13801451 queueSelections ( 'costrict' , DONE ) ;
13811452
@@ -1409,6 +1480,25 @@ describe('InitCommand', () => {
14091480 expect ( updatedContent ) . toContain ( '<!-- OPENSPEC:END -->' ) ;
14101481 expect ( updatedContent ) . toContain ( 'Custom instructions here' ) ;
14111482 } ) ;
1483+
1484+ it ( 'should update existing IFLOW.md with markers' , async ( ) => {
1485+ queueSelections ( 'iflow' , DONE ) ;
1486+
1487+ const iflowPath = path . join ( testDir , 'IFLOW.md' ) ;
1488+ const existingContent =
1489+ '# My iFlow Instructions\nCustom instructions here' ;
1490+ await fs . writeFile ( iflowPath , existingContent ) ;
1491+
1492+ await initCommand . execute ( testDir ) ;
1493+
1494+ const updatedContent = await fs . readFile ( iflowPath , 'utf-8' ) ;
1495+ expect ( updatedContent ) . toContain ( '<!-- OPENSPEC:START -->' ) ;
1496+ expect ( updatedContent ) . toContain ( "@/openspec/AGENTS.md" ) ;
1497+ expect ( updatedContent ) . toContain ( 'openspec update' ) ;
1498+ expect ( updatedContent ) . toContain ( '<!-- OPENSPEC:END -->' ) ;
1499+ expect ( updatedContent ) . toContain ( 'Custom instructions here' ) ;
1500+ } ) ;
1501+
14121502 } ) ;
14131503
14141504 describe ( 'non-interactive mode' , ( ) => {
0 commit comments