@@ -102,6 +102,29 @@ base mixin DashCliSupport on ToolsSupport, LoggingSupport, RootsTrackingSupport
102102 ),
103103 );
104104 }
105+ final platforms =
106+ ((args[ParameterNames .platform] as List ? )? .cast <String >() ?? [])
107+ .toSet ();
108+ if (projectType == 'flutter' ) {
109+ // Platforms are ignored for Dart, so no need to validate them.
110+ final invalidPlatforms = platforms.difference (_allowedFlutterPlatforms);
111+ if (invalidPlatforms.isNotEmpty) {
112+ final plural =
113+ invalidPlatforms.length > 1
114+ ? 'are not valid platforms'
115+ : 'is not a valid platform' ;
116+ errors.add (
117+ ValidationError (
118+ ValidationErrorType .itemInvalid,
119+ path: [ParameterNames .platform],
120+ details:
121+ '${invalidPlatforms .join (',' )} $plural . Platforms '
122+ '${_allowedFlutterPlatforms .map ((e ) => '`$e `' ).join (', ' )} '
123+ 'are the only allowed values for the platform list argument.' ,
124+ ),
125+ );
126+ }
127+ }
105128
106129 if (errors.isNotEmpty) {
107130 return CallToolResult (
@@ -117,6 +140,13 @@ base mixin DashCliSupport on ToolsSupport, LoggingSupport, RootsTrackingSupport
117140 final commandArgs = [
118141 'create' ,
119142 if (template != null && template.isNotEmpty) ...['--template' , template],
143+ if (projectType == 'flutter' && platforms.isNotEmpty)
144+ '--platform=${platforms .join (',' )}' ,
145+ // Create an "empty" project by default so the LLM doesn't have to deal
146+ // with all the boilerplate and comments.
147+ if (projectType == 'flutter' &&
148+ (args[ParameterNames .empty] as bool ? ?? true ))
149+ '--empty' ,
120150 directory,
121151 ];
122152
@@ -188,8 +218,30 @@ base mixin DashCliSupport on ToolsSupport, LoggingSupport, RootsTrackingSupport
188218 description:
189219 'The project template to use (e.g., "console-full", "app").' ,
190220 ),
221+ ParameterNames .platform: Schema .list (
222+ items: Schema .string (),
223+ description:
224+ 'The list of platforms this project supports. Only valid '
225+ 'for Flutter projects. The allowed values are '
226+ '${_allowedFlutterPlatforms .map ((e ) => '`$e `' ).join (', ' )}. '
227+ 'Defaults to creating a project for all platforms.' ,
228+ ),
229+ ParameterNames .empty: Schema .bool (
230+ description:
231+ 'Whether or not to create an "empty" project with minimized '
232+ 'boilerplate and example code. Defaults to true.' ,
233+ ),
191234 },
192235 required : [ParameterNames .directory, ParameterNames .projectType],
193236 ),
194237 );
238+
239+ static const _allowedFlutterPlatforms = {
240+ 'web' ,
241+ 'linux' ,
242+ 'macos' ,
243+ 'windows' ,
244+ 'android' ,
245+ 'ios' ,
246+ };
195247}
0 commit comments