@@ -351,6 +351,7 @@ def main():
351351 generator .generate ()
352352
353353 # Initialize git repo
354+ git_initialized = False
354355 try :
355356 subprocess .run (
356357 ["git" , "init" ],
@@ -359,8 +360,33 @@ def main():
359360 capture_output = True ,
360361 text = True ,
361362 )
363+ git_initialized = True
362364 except (FileNotFoundError , subprocess .CalledProcessError ):
363365 pass # Silently skip if git is not available
366+ if git_initialized :
367+ try :
368+ subprocess .run (
369+ ["git" , "add" , "." ],
370+ cwd = project_path ,
371+ check = True ,
372+ capture_output = True ,
373+ text = True ,
374+ )
375+ subprocess .run (
376+ ["git" , "commit" , "-m" , "feat: initial project structure" ],
377+ cwd = project_path ,
378+ check = True ,
379+ capture_output = True ,
380+ text = True ,
381+ )
382+ except subprocess .CalledProcessError as e :
383+ console .print (
384+ "[yellow]![/yellow] Git commit skipped (configure user.name/email to enable)."
385+ )
386+ if e .stderr :
387+ console .print (e .stderr )
388+ except FileNotFoundError :
389+ console .print ("[yellow]![/yellow] Git not found, skipping commit" )
364390
365391 console .print ("[green]✓[/green] Project structure created" )
366392
@@ -387,20 +413,55 @@ def main():
387413 except FileNotFoundError :
388414 console .print ("[yellow]![/yellow] uv not found, skipping sync" )
389415
390- # Success message
391- console .print ()
416+ next_action = questionary .select (
417+ "What would you like to do next?" ,
418+ choices = [
419+ questionary .Choice ("Start development server" , value = "start" ),
420+ questionary .Choice ("Show instructions and exit" , value = "instructions" ),
421+ ],
422+ pointer = ">" ,
423+ ).unsafe_ask ()
392424
393- commands = [f"cd { project_location } " ]
394- if not sync_success :
395- commands .append ("uv sync" )
396- commands .append ("pywire dev" )
425+ should_show_instructions = next_action == "instructions"
426+ if next_action == "start" :
427+ try :
428+ subprocess .run (
429+ ["uv" , "run" , "pywire" , "dev" ],
430+ cwd = project_path ,
431+ check = True ,
432+ )
433+ return
434+ except subprocess .CalledProcessError :
435+ console .print ("[red]✗[/red] Failed to start the dev server" )
436+ should_show_instructions = True
437+ except FileNotFoundError :
438+ console .print ("[yellow]![/yellow] uv not found, cannot start server" )
439+ should_show_instructions = True
440+
441+ if should_show_instructions :
442+ console .print ()
443+
444+ is_windows = os .name == "nt"
445+ commands = [f"cd { project_location } " ]
446+ if not sync_success :
447+ commands .append ("uv sync" )
448+ if is_windows :
449+ activate_cmd = r".venv\Scripts\activate"
450+ else :
451+ activate_cmd = "source .venv/bin/activate"
452+ commands .extend (
453+ [
454+ activate_cmd ,
455+ "pywire dev" ,
456+ ]
457+ )
397458
398- cmd_text = "\n " .join (commands )
459+ cmd_text = "\n " .join (commands )
399460
400- console .print (
401- Panel (
402- Markdown (
403- f"""
461+ console .print (
462+ Panel (
463+ Markdown (
464+ f"""
404465# System Online 🟢
405466
406467Run the following commands to enter the environment:
@@ -409,12 +470,12 @@ def main():
409470
410471> **Tip:** Install the **PyWire** extension (id: `pywire.pywire`) in VS Code for syntax highlighting and snippets.
411472 """
412- ),
413- border_style = "cyan" ,
414- title = "Initialization Complete" ,
415- title_align = "left" ,
473+ ),
474+ border_style = "cyan" ,
475+ title = "Initialization Complete" ,
476+ title_align = "left" ,
477+ )
416478 )
417- )
418479 except KeyboardInterrupt :
419480 console .print ("\n [bold red]System Aborted.[/bold red]" )
420481 sys .exit (1 )
0 commit comments