Skip to content

Commit 83ed4ac

Browse files
authored
Merge pull request #133 from Miyamura80/fix/onboard-prek-hooks
Fix onboarding hooks step to use prek instead of pre-commit
2 parents ce43732 + 4674c7c commit 83ed4ac

3 files changed

Lines changed: 13 additions & 83 deletions

File tree

onboard.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
import re
66
import shutil
77
import subprocess
8+
import tomllib
89
from pathlib import Path
910

1011
import questionary
1112
import typer
12-
import yaml
1313
from rich import print as rprint
1414
from rich.console import Console
1515
from 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()
408408
def 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

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,5 @@ show_missing = true
110110

111111
[dependency-groups]
112112
dev = [
113-
"pre-commit>=4.5.1",
114113
"pytest-check-links>=0.9.1",
115114
]

uv.lock

Lines changed: 1 addition & 71 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)