55import re
66import shutil
77import subprocess
8+ import tomllib
89from pathlib import Path
910
1011import questionary
1112import typer
12- import yaml
1313from rich import print as rprint
1414from rich .console import Console
1515from rich .panel import Panel
@@ -64,7 +64,7 @@ def _run_orchestrator() -> None:
6464 " 1. Rename - Set project name and description\n "
6565 " 2. Dependencies - Install project dependencies\n "
6666 " 3. Environment - Configure API keys and secrets\n "
67- " 4. Hooks - Activate pre-commit hooks\n "
67+ " 4. Hooks - Activate prek hooks\n "
6868 " 5. Media - Generate banner and logo assets\n "
6969 " 6. Jules - Enable/disable automated maintenance workflows" ,
7070 title = "Welcome to Project Onboarding" ,
@@ -406,15 +406,16 @@ def env() -> None:
406406
407407@app .command ()
408408def hooks () -> None :
409- """Step 4: Activate pre-commit hooks."""
410- config_path = PROJECT_ROOT / ".pre-commit-config.yaml "
409+ """Step 4: Activate prek hooks."""
410+ config_path = PROJECT_ROOT / "prek.toml "
411411 if not config_path .exists ():
412- rprint ("[red]✗ .pre-commit-config.yaml not found.[/red]" )
412+ rprint ("[red]✗ prek.toml not found.[/red]" )
413413 raise typer .Exit (code = 1 )
414414
415- config = yaml .safe_load (config_path .read_text ())
415+ with open (config_path , "rb" ) as f :
416+ config = tomllib .load (f )
416417
417- table = Table (title = "Configured Pre-commit Hooks" )
418+ table = Table (title = "Configured Prek Hooks" )
418419 table .add_column ("Hook ID" , style = "cyan" )
419420 table .add_column ("Description" , style = "white" )
420421
@@ -428,27 +429,27 @@ def hooks() -> None:
428429 rprint ("" )
429430
430431 activate = questionary .confirm (
431- "Activate pre-commit hooks? (Recommended)" ,
432+ "Activate prek hooks? (Recommended)" ,
432433 default = True ,
433434 ).ask ()
434435 if activate is None :
435436 raise typer .Abort ()
436437
437438 if activate :
438439 result = subprocess .run (
439- ["uv" , "run" , "pre-commit " , "install" ],
440+ ["uv" , "tool" , " run" , "prek " , "install" ],
440441 cwd = PROJECT_ROOT ,
441442 capture_output = True ,
442443 text = True ,
443444 )
444445 if result .returncode != 0 :
445446 rprint (f"[red]✗ Failed to activate hooks:[/red]\n { result .stderr } " )
446447 raise typer .Exit (code = 1 )
447- rprint ("[green]✓ Pre-commit hooks activated.[/green]" )
448+ rprint ("[green]✓ Prek hooks activated.[/green]" )
448449 else :
449450 rprint (
450451 "[yellow]Skipped.[/yellow] You can activate later with: "
451- "[bold]pre-commit install[/bold]"
452+ "[bold]uv tool run prek install[/bold]"
452453 )
453454
454455
0 commit comments