@@ -1233,6 +1233,7 @@ async def _run_workflow():
12331233
12341234 var_type = input_def .type .lower () # type is a direct attribute
12351235 is_required = input_def .required
1236+ default_value = getattr (input_def , 'default' , None )
12361237
12371238 type_info_str = f'type: { var_type } '
12381239 if is_required :
@@ -1245,21 +1246,32 @@ async def _run_workflow():
12451246 if hasattr (input_def , 'format' ) and input_def .format :
12461247 format_info_str = f', format: { typer .style (input_def .format , fg = typer .colors .GREEN )} '
12471248
1248- full_prompt_text = f'{ prompt_question } ({ status_str } , { type_info_str } { format_info_str } )'
1249+ # Add default value information if available
1250+ default_info_str = ''
1251+ if default_value is not None :
1252+ default_info_str = f', default: { typer .style (str (default_value ), fg = typer .colors .BLUE )} '
1253+
1254+ full_prompt_text = f'{ prompt_question } ({ status_str } , { type_info_str } { format_info_str } { default_info_str } )'
12491255
12501256 input_val = None
12511257 if var_type == 'bool' :
1252- input_val = typer .confirm (full_prompt_text )
1258+ input_val = typer .confirm (full_prompt_text , default = default_value if default_value is not None else None )
12531259 elif var_type == 'number' :
1254- input_val = typer .prompt (full_prompt_text , type = float )
1260+ input_val = typer .prompt (
1261+ full_prompt_text , type = float , default = default_value if default_value is not None else ...
1262+ )
12551263 elif var_type == 'string' : # Default to string for other unknown types as well
1256- input_val = typer .prompt (full_prompt_text , type = str )
1264+ input_val = typer .prompt (
1265+ full_prompt_text , type = str , default = default_value if default_value is not None else ...
1266+ )
12571267 else : # Should ideally not happen if schema is validated, but good to have a fallback
12581268 typer .secho (
12591269 f"Warning: Unknown type '{ var_type } ' for variable '{ input_def .name } '. Treating as string." ,
12601270 fg = typer .colors .YELLOW ,
12611271 )
1262- input_val = typer .prompt (full_prompt_text , type = str )
1272+ input_val = typer .prompt (
1273+ full_prompt_text , type = str , default = default_value if default_value is not None else ...
1274+ )
12631275
12641276 inputs [input_def .name ] = input_val
12651277 typer .echo () # Add space after each prompt
@@ -1369,6 +1381,7 @@ async def _run_workflow_no_ai():
13691381
13701382 var_type = input_def .type .lower () # type is a direct attribute
13711383 is_required = input_def .required
1384+ default_value = getattr (input_def , 'default' , None )
13721385
13731386 type_info_str = f'type: { var_type } '
13741387 if is_required :
@@ -1381,21 +1394,32 @@ async def _run_workflow_no_ai():
13811394 if hasattr (input_def , 'format' ) and input_def .format :
13821395 format_info_str = f', format: { typer .style (input_def .format , fg = typer .colors .GREEN )} '
13831396
1384- full_prompt_text = f'{ prompt_question } ({ status_str } , { type_info_str } { format_info_str } )'
1397+ # Add default value information if available
1398+ default_info_str = ''
1399+ if default_value is not None :
1400+ default_info_str = f', default: { typer .style (str (default_value ), fg = typer .colors .BLUE )} '
1401+
1402+ full_prompt_text = f'{ prompt_question } ({ status_str } , { type_info_str } { format_info_str } { default_info_str } )'
13851403
13861404 input_val = None
13871405 if var_type == 'bool' :
1388- input_val = typer .confirm (full_prompt_text )
1406+ input_val = typer .confirm (full_prompt_text , default = default_value if default_value is not None else None )
13891407 elif var_type == 'number' :
1390- input_val = typer .prompt (full_prompt_text , type = float )
1408+ input_val = typer .prompt (
1409+ full_prompt_text , type = float , default = default_value if default_value is not None else ...
1410+ )
13911411 elif var_type == 'string' : # Default to string for other unknown types as well
1392- input_val = typer .prompt (full_prompt_text , type = str )
1412+ input_val = typer .prompt (
1413+ full_prompt_text , type = str , default = default_value if default_value is not None else ...
1414+ )
13931415 else : # Should ideally not happen if schema is validated, but good to have a fallback
13941416 typer .secho (
13951417 f"Warning: Unknown type '{ var_type } ' for variable '{ input_def .name } '. Treating as string." ,
13961418 fg = typer .colors .YELLOW ,
13971419 )
1398- input_val = typer .prompt (full_prompt_text , type = str )
1420+ input_val = typer .prompt (
1421+ full_prompt_text , type = str , default = default_value if default_value is not None else ...
1422+ )
13991423
14001424 inputs [input_def .name ] = input_val
14011425 typer .echo () # Add space after each prompt
@@ -2445,7 +2469,11 @@ def run_stored_workflow(
24452469 if inp .required
24462470 else typer .style ('optional' , fg = typer .colors .YELLOW )
24472471 )
2448- typer .echo (f' • { inp .name } ({ inp .type } , { required } )' )
2472+ default_value = getattr (inp , 'default' , None )
2473+ default_str = (
2474+ f', default: { typer .style (str (default_value ), fg = typer .colors .BLUE )} ' if default_value is not None else ''
2475+ )
2476+ typer .echo (f' • { inp .name } ({ inp .type } , { required } { default_str } )' )
24492477 typer .echo ()
24502478 typer .echo ('Options:' )
24512479 typer .echo (f' 1. Run as tool: python cli.py run-stored-workflow { workflow_id } --prompt "Your task"' )
0 commit comments