@@ -3,6 +3,7 @@ import { App, Config, FS_TOKEN, FsFileSystem, GoogleAnalytics, IFileSystem, Inqu
33import * as coreDetect from "../../packages/core/util/detect-framework" ;
44import { configureMCP , configureSkills } from "../../packages/cli/lib/commands/ai-config" ;
55import * as aiConfig from "../../packages/cli/lib/commands/ai-config" ;
6+ import { addMcpServers } from "../../packages/core/util/mcp-config" ;
67
78const IGNITEUI_SERVER_KEY = "igniteui-cli" ;
89const IGNITEUI_THEMING_SERVER_KEY = "igniteui-theming" ;
@@ -104,19 +105,37 @@ describe("Unit - ai-config command", () => {
104105 expect ( ( config . servers as any ) [ IGNITEUI_THEMING_SERVER_KEY ] ) . toEqual ( igniteuiThemingServer ) ;
105106 } ) ;
106107
107- it ( "is a no-op and logs when both servers are already configured" , ( ) => {
108+ it ( "is a no-op when both servers are already configured" , ( ) => {
108109 const mockFs = createMockFs ( JSON . stringify ( {
109110 servers : {
110111 [ IGNITEUI_SERVER_KEY ] : igniteuiServer ,
111112 [ IGNITEUI_THEMING_SERVER_KEY ] : igniteuiThemingServer
112113 }
113- } ) ) ;
114+ } , null , 2 ) ) ;
114115 App . container . set ( FS_TOKEN , mockFs ) ;
115116
116- configureMCP ( [ "vscode" ] ) ;
117+ const result = addMcpServers ( "vscode" ) ;
117118
119+ expect ( result ) . toBe ( false ) ;
118120 expect ( mockFs . writeFile ) . not . toHaveBeenCalled ( ) ;
119- expect ( Util . log ) . toHaveBeenCalledWith ( jasmine . stringContaining ( "already configured" ) ) ;
121+ } ) ;
122+
123+ it ( "updates config when server configuration is outdated" , ( ) => {
124+ const mockFs = createMockFs ( JSON . stringify ( {
125+ servers : {
126+ [ IGNITEUI_SERVER_KEY ] : { command : "npx" , args : [ "-y" , "igniteui-cli" , "old-command" ] } ,
127+ [ IGNITEUI_THEMING_SERVER_KEY ] : igniteuiThemingServer
128+ }
129+ } , null , 2 ) ) ;
130+ App . container . set ( FS_TOKEN , mockFs ) ;
131+
132+ const result = addMcpServers ( "vscode" ) ;
133+
134+ expect ( result ) . toBe ( true ) ;
135+ expect ( mockFs . writeFile ) . toHaveBeenCalled ( ) ;
136+ const config = writtenConfig ( mockFs ) ;
137+ expect ( ( config . servers as any ) [ IGNITEUI_SERVER_KEY ] ) . toEqual ( igniteuiServer ) ;
138+ expect ( ( config . servers as any ) [ IGNITEUI_THEMING_SERVER_KEY ] ) . toEqual ( igniteuiThemingServer ) ;
120139 } ) ;
121140
122141 it ( "preserves existing third-party servers when adding igniteui servers" , ( ) => {
0 commit comments