Display version and system information.
(
features: bool = typer.Option(
False,
"--features",
help="Show local CLI feature capabilities.",
),
json_output: bool = typer.Option(
False,
"--json",
help="Emit feature capabilities as JSON. Requires --features.",
),
)
| 434 | |
| 435 | @app.command() |
| 436 | def version( |
| 437 | features: bool = typer.Option( |
| 438 | False, |
| 439 | "--features", |
| 440 | help="Show local CLI feature capabilities.", |
| 441 | ), |
| 442 | json_output: bool = typer.Option( |
| 443 | False, |
| 444 | "--json", |
| 445 | help="Emit feature capabilities as JSON. Requires --features.", |
| 446 | ), |
| 447 | ): |
| 448 | """Display version and system information.""" |
| 449 | import platform |
| 450 | |
| 451 | cli_version = get_speckit_version() |
| 452 | |
| 453 | if json_output and not features: |
| 454 | console.print("[red]Error:[/red] --json requires --features.") |
| 455 | raise typer.Exit(1) |
| 456 | |
| 457 | if features: |
| 458 | capabilities = _feature_capabilities() |
| 459 | if json_output: |
| 460 | payload = {"version": cli_version, "features": capabilities} |
| 461 | console.print(json.dumps(payload, indent=2)) |
| 462 | return |
| 463 | |
| 464 | console.print(f"Spec Kit CLI: {cli_version}") |
| 465 | console.print() |
| 466 | console.print("Features:") |
| 467 | for key, enabled in capabilities.items(): |
| 468 | label = key.replace("_", " ") |
| 469 | console.print(f"- {label}: {'yes' if enabled else 'no'}") |
| 470 | return |
| 471 | |
| 472 | show_banner() |
| 473 | |
| 474 | info_table = Table(show_header=False, box=None, padding=(0, 2)) |
| 475 | info_table.add_column("Key", style="cyan", justify="right") |
| 476 | info_table.add_column("Value", style="white") |
| 477 | |
| 478 | info_table.add_row("CLI Version", cli_version) |
| 479 | info_table.add_row("", "") |
| 480 | info_table.add_row("Python", platform.python_version()) |
| 481 | info_table.add_row("Platform", platform.system()) |
| 482 | info_table.add_row("Architecture", platform.machine()) |
| 483 | info_table.add_row("OS Version", platform.version()) |
| 484 | |
| 485 | panel = Panel( |
| 486 | info_table, |
| 487 | title="[bold cyan]Specify CLI Information[/bold cyan]", |
| 488 | border_style="cyan", |
| 489 | padding=(1, 2) |
| 490 | ) |
| 491 | |
| 492 | console.print(panel) |
| 493 | console.print() |
nothing calls this directly
no test coverage detected