diff --git a/src/cad_documenter/cli.py b/src/cad_documenter/cli.py index 3866de7..1261bbf 100644 --- a/src/cad_documenter/cli.py +++ b/src/cad_documenter/cli.py @@ -11,6 +11,7 @@ from rich.table import Table from .pipeline import DocumentationPipeline, PipelineProgress, PipelineStage, create_pipeline from .config import Config, load_config +from .cli_project import project as project_commands console = Console() @@ -380,5 +381,9 @@ def main(): cli() +# Register project subcommands +cli.add_command(project_commands) + + if __name__ == "__main__": main() diff --git a/src/cad_documenter/cli_project.py b/src/cad_documenter/cli_project.py new file mode 100644 index 0000000..20122b5 --- /dev/null +++ b/src/cad_documenter/cli_project.py @@ -0,0 +1,276 @@ +"""CLI commands for project management.""" + +import click +from pathlib import Path +from rich.console import Console +from rich.table import Table +from rich.panel import Panel +from rich.progress import Progress, SpinnerColumn, TextColumn + +from .project import Project +from .incremental import IncrementalProcessor, UnifiedDocumentGenerator +from .config import load_config + +console = Console() + + +@click.group() +def project(): + """Manage iterative documentation projects.""" + pass + + +@project.command() +@click.argument("path", type=click.Path(path_type=Path)) +@click.option("--name", "-n", help="Project name (defaults to folder name)") +@click.option("--description", "-d", default="", help="Project description") +def init(path: Path, name: str | None, description: str): + """Create a new documentation project. + + Example: + cad-doc project init ./my-bracket-project + """ + if name is None: + name = path.name + + try: + proj = Project.create(path, name, description) + console.print(f"[green]✓[/green] Created project: [cyan]{name}[/cyan]") + console.print(f" Location: {path.absolute()}") + console.print() + console.print("Next steps:") + console.print(f" 1. Copy videos to [cyan]{path}/videos/[/cyan]") + console.print(f" 2. Run [cyan]cad-doc project add {path}