@@ -349,6 +349,71 @@ describe('InitCommand', () => {
349349 expect ( archiveContent ) . toContain ( 'openspec list --specs' ) ;
350350 } ) ;
351351
352+ it ( 'should create Qwen configuration and slash command files with templates' , async ( ) => {
353+ queueSelections ( 'qwen' , DONE ) ;
354+
355+ await initCommand . execute ( testDir ) ;
356+
357+ const qwenConfigPath = path . join ( testDir , 'QWEN.md' ) ;
358+ const proposalPath = path . join (
359+ testDir ,
360+ '.qwen/commands/openspec-proposal.md'
361+ ) ;
362+ const applyPath = path . join (
363+ testDir ,
364+ '.qwen/commands/openspec-apply.md'
365+ ) ;
366+ const archivePath = path . join (
367+ testDir ,
368+ '.qwen/commands/openspec-archive.md'
369+ ) ;
370+
371+ expect ( await fileExists ( qwenConfigPath ) ) . toBe ( true ) ;
372+ expect ( await fileExists ( proposalPath ) ) . toBe ( true ) ;
373+ expect ( await fileExists ( applyPath ) ) . toBe ( true ) ;
374+ expect ( await fileExists ( archivePath ) ) . toBe ( true ) ;
375+
376+ const qwenConfigContent = await fs . readFile ( qwenConfigPath , 'utf-8' ) ;
377+ expect ( qwenConfigContent ) . toContain ( '<!-- OPENSPEC:START -->' ) ;
378+ expect ( qwenConfigContent ) . toContain ( "@/openspec/AGENTS.md" ) ;
379+ expect ( qwenConfigContent ) . toContain ( '<!-- OPENSPEC:END -->' ) ;
380+
381+ const proposalContent = await fs . readFile ( proposalPath , 'utf-8' ) ;
382+ expect ( proposalContent ) . toContain ( 'name: /openspec-proposal' ) ;
383+ expect ( proposalContent ) . toContain ( 'category: OpenSpec' ) ;
384+ expect ( proposalContent ) . toContain ( 'description: Scaffold a new OpenSpec change and validate strictly.' ) ;
385+ expect ( proposalContent ) . toContain ( '<!-- OPENSPEC:START -->' ) ;
386+
387+ const applyContent = await fs . readFile ( applyPath , 'utf-8' ) ;
388+ expect ( applyContent ) . toContain ( 'name: /openspec-apply' ) ;
389+ expect ( applyContent ) . toContain ( 'category: OpenSpec' ) ;
390+ expect ( applyContent ) . toContain ( 'description: Implement an approved OpenSpec change and keep tasks in sync.' ) ;
391+ expect ( applyContent ) . toContain ( 'Work through tasks sequentially' ) ;
392+
393+ const archiveContent = await fs . readFile ( archivePath , 'utf-8' ) ;
394+ expect ( archiveContent ) . toContain ( 'name: /openspec-archive' ) ;
395+ expect ( archiveContent ) . toContain ( 'category: OpenSpec' ) ;
396+ expect ( archiveContent ) . toContain ( 'description: Archive a deployed OpenSpec change and update specs.' ) ;
397+ expect ( archiveContent ) . toContain ( 'openspec archive <id>' ) ;
398+ } ) ;
399+
400+ it ( 'should update existing QWEN.md with markers' , async ( ) => {
401+ queueSelections ( 'qwen' , DONE ) ;
402+
403+ const qwenPath = path . join ( testDir , 'QWEN.md' ) ;
404+ const existingContent = '# My Qwen Instructions\nCustom instructions here' ;
405+ await fs . writeFile ( qwenPath , existingContent ) ;
406+
407+ await initCommand . execute ( testDir ) ;
408+
409+ const updatedContent = await fs . readFile ( qwenPath , 'utf-8' ) ;
410+ expect ( updatedContent ) . toContain ( '<!-- OPENSPEC:START -->' ) ;
411+ expect ( updatedContent ) . toContain ( "@/openspec/AGENTS.md" ) ;
412+ expect ( updatedContent ) . toContain ( 'openspec update' ) ;
413+ expect ( updatedContent ) . toContain ( '<!-- OPENSPEC:END -->' ) ;
414+ expect ( updatedContent ) . toContain ( 'Custom instructions here' ) ;
415+ } ) ;
416+
352417 it ( 'should create Cline rule files with templates' , async ( ) => {
353418 queueSelections ( 'cline' , DONE ) ;
354419
@@ -688,6 +753,18 @@ describe('InitCommand', () => {
688753 expect ( claudeChoice . configured ) . toBe ( true ) ;
689754 } ) ;
690755
756+ it ( 'should mark Qwen as already configured during extend mode' , async ( ) => {
757+ queueSelections ( 'qwen' , DONE , 'qwen' , DONE ) ;
758+ await initCommand . execute ( testDir ) ;
759+ await initCommand . execute ( testDir ) ;
760+
761+ const secondRunArgs = mockPrompt . mock . calls [ 1 ] [ 0 ] ;
762+ const qwenChoice = secondRunArgs . choices . find (
763+ ( choice : any ) => choice . value === 'qwen'
764+ ) ;
765+ expect ( qwenChoice . configured ) . toBe ( true ) ;
766+ } ) ;
767+
691768 it ( 'should preselect Kilo Code when workflows already exist' , async ( ) => {
692769 queueSelections ( 'kilocode' , DONE , 'kilocode' , DONE ) ;
693770 await initCommand . execute ( testDir ) ;
0 commit comments