@@ -309,4 +309,85 @@ export const appConfig: ApplicationConfig = {
309309 await runner . runSchematic ( "cli-config" , { } , tree ) ;
310310 expect ( warns ) . toContain ( jasmine . stringMatching ( pattern ) ) ;
311311 } ) ;
312+
313+ describe ( "addAIConfig" , ( ) => {
314+ const mcpFilePath = "/.vscode/mcp.json" ;
315+
316+ it ( "should create .vscode/mcp.json with both servers when file does not exist" , async ( ) => {
317+ await runner . runSchematic ( "cli-config" , { } , tree ) ;
318+
319+ expect ( tree . exists ( mcpFilePath ) ) . toBeTruthy ( ) ;
320+ const content = JSON . parse ( tree . readContent ( mcpFilePath ) ) ;
321+ expect ( content . servers [ "igniteui" ] ) . toEqual ( { command : "npx" , args : [ "-y" , "igniteui-cli@next" , "mcp" ] } ) ;
322+ expect ( content . servers [ "igniteui-theming" ] ) . toEqual ( { command : "npx" , args : [ "-y" , "igniteui-theming" , "igniteui-theming-mcp" ] } ) ;
323+ } ) ;
324+
325+ it ( "should add both servers to existing .vscode/mcp.json that has no servers" , async ( ) => {
326+ tree . create ( mcpFilePath , JSON . stringify ( { servers : { } } ) ) ;
327+
328+ await runner . runSchematic ( "cli-config" , { } , tree ) ;
329+
330+ const content = JSON . parse ( tree . readContent ( mcpFilePath ) ) ;
331+ expect ( content . servers [ "igniteui" ] ) . toEqual ( { command : "npx" , args : [ "-y" , "igniteui-cli@next" , "mcp" ] } ) ;
332+ expect ( content . servers [ "igniteui-theming" ] ) . toEqual ( { command : "npx" , args : [ "-y" , "igniteui-theming" , "igniteui-theming-mcp" ] } ) ;
333+ } ) ;
334+
335+ it ( "should add missing igniteui-theming server if only igniteui is already present" , async ( ) => {
336+ tree . create ( mcpFilePath , JSON . stringify ( {
337+ servers : {
338+ "igniteui" : { command : "npx" , args : [ "-y" , "igniteui-cli@next" , "mcp" ] }
339+ }
340+ } ) ) ;
341+
342+ await runner . runSchematic ( "cli-config" , { } , tree ) ;
343+
344+ const content = JSON . parse ( tree . readContent ( mcpFilePath ) ) ;
345+ expect ( content . servers [ "igniteui" ] ) . toEqual ( { command : "npx" , args : [ "-y" , "igniteui-cli@next" , "mcp" ] } ) ;
346+ expect ( content . servers [ "igniteui-theming" ] ) . toEqual ( { command : "npx" , args : [ "-y" , "igniteui-theming" , "igniteui-theming-mcp" ] } ) ;
347+ } ) ;
348+
349+ it ( "should add missing igniteui server if only igniteui-theming is already present" , async ( ) => {
350+ tree . create ( mcpFilePath , JSON . stringify ( {
351+ servers : {
352+ "igniteui-theming" : { command : "npx" , args : [ "-y" , "igniteui-theming" , "igniteui-theming-mcp" ] }
353+ }
354+ } ) ) ;
355+
356+ await runner . runSchematic ( "cli-config" , { } , tree ) ;
357+
358+ const content = JSON . parse ( tree . readContent ( mcpFilePath ) ) ;
359+ expect ( content . servers [ "igniteui" ] ) . toEqual ( { command : "npx" , args : [ "-y" , "igniteui-cli@next" , "mcp" ] } ) ;
360+ expect ( content . servers [ "igniteui-theming" ] ) . toEqual ( { command : "npx" , args : [ "-y" , "igniteui-theming" , "igniteui-theming-mcp" ] } ) ;
361+ } ) ;
362+
363+ it ( "should not modify .vscode/mcp.json if both servers are already present" , async ( ) => {
364+ const existing = {
365+ servers : {
366+ "igniteui" : { command : "npx" , args : [ "-y" , "igniteui-cli@next" , "mcp" ] } ,
367+ "igniteui-theming" : { command : "npx" , args : [ "-y" , "igniteui-theming" , "igniteui-theming-mcp" ] }
368+ }
369+ } ;
370+ tree . create ( mcpFilePath , JSON . stringify ( existing ) ) ;
371+
372+ await runner . runSchematic ( "cli-config" , { } , tree ) ;
373+
374+ const content = JSON . parse ( tree . readContent ( mcpFilePath ) ) ;
375+ expect ( content ) . toEqual ( existing ) ;
376+ } ) ;
377+
378+ it ( "should preserve existing servers when adding igniteui servers" , async ( ) => {
379+ tree . create ( mcpFilePath , JSON . stringify ( {
380+ servers : {
381+ "other-server" : { command : "node" , args : [ "server.js" ] }
382+ }
383+ } ) ) ;
384+
385+ await runner . runSchematic ( "cli-config" , { } , tree ) ;
386+
387+ const content = JSON . parse ( tree . readContent ( mcpFilePath ) ) ;
388+ expect ( content . servers [ "other-server" ] ) . toEqual ( { command : "node" , args : [ "server.js" ] } ) ;
389+ expect ( content . servers [ "igniteui" ] ) . toBeDefined ( ) ;
390+ expect ( content . servers [ "igniteui-theming" ] ) . toBeDefined ( ) ;
391+ } ) ;
392+ } ) ;
312393} ) ;
0 commit comments