Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions onboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import re
import shutil
import subprocess
import tomllib
from pathlib import Path

import questionary
import typer
import yaml
from rich import print as rprint
from rich.console import Console
from rich.panel import Panel
Expand Down Expand Up @@ -64,7 +64,7 @@ def _run_orchestrator() -> None:
" 1. Rename - Set project name and description\n"
" 2. Dependencies - Install project dependencies\n"
" 3. Environment - Configure API keys and secrets\n"
" 4. Hooks - Activate pre-commit hooks\n"
" 4. Hooks - Activate prek hooks\n"
" 5. Media - Generate banner and logo assets\n"
" 6. Jules - Enable/disable automated maintenance workflows",
title="Welcome to Project Onboarding",
Expand Down Expand Up @@ -406,15 +406,16 @@ def env() -> None:

@app.command()
def hooks() -> None:
"""Step 4: Activate pre-commit hooks."""
config_path = PROJECT_ROOT / ".pre-commit-config.yaml"
"""Step 4: Activate prek hooks."""
config_path = PROJECT_ROOT / "prek.toml"
if not config_path.exists():
rprint("[red]✗ .pre-commit-config.yaml not found.[/red]")
rprint("[red]✗ prek.toml not found.[/red]")
raise typer.Exit(code=1)

config = yaml.safe_load(config_path.read_text())
with open(config_path, "rb") as f:
config = tomllib.load(f)

table = Table(title="Configured Pre-commit Hooks")
table = Table(title="Configured Prek Hooks")
table.add_column("Hook ID", style="cyan")
table.add_column("Description", style="white")

Expand All @@ -428,27 +429,27 @@ def hooks() -> None:
rprint("")

activate = questionary.confirm(
"Activate pre-commit hooks? (Recommended)",
"Activate prek hooks? (Recommended)",
default=True,
).ask()
if activate is None:
raise typer.Abort()

if activate:
result = subprocess.run(
["uv", "run", "pre-commit", "install"],
["uv", "tool", "run", "prek", "install"],
cwd=PROJECT_ROOT,
capture_output=True,
text=True,
)
if result.returncode != 0:
rprint(f"[red]✗ Failed to activate hooks:[/red]\n{result.stderr}")
raise typer.Exit(code=1)
rprint("[green]✓ Pre-commit hooks activated.[/green]")
rprint("[green]✓ Prek hooks activated.[/green]")
else:
rprint(
"[yellow]Skipped.[/yellow] You can activate later with: "
"[bold]pre-commit install[/bold]"
"[bold]uv tool run prek install[/bold]"
)


Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,5 @@ show_missing = true

[dependency-groups]
dev = [
"pre-commit>=4.5.1",
"pytest-check-links>=0.9.1",
]
72 changes: 1 addition & 71 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.