Add CLI commands and output renderer
Some checks failed
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled

This commit is contained in:
2026-02-03 06:56:40 +00:00
parent 97f5938006
commit f53d9f1984

View File

@@ -0,0 +1,61 @@
"""Init command for VibeGuard CLI."""
import os
from pathlib import Path
import click
@click.command(name="init")
@click.option("--path", "-p", type=click.Path(), default=".", help="Path to create config")
@click.pass_obj
def init(ctx: dict, path: str) -> None:
"""Initialize VibeGuard configuration in the current directory."""
config_path = Path(path) / ".vibeguard.toml"
config_content = '''version = "0.1.0"
[analyze]
severity_threshold = "warning"
incremental = true
workers = 0
[patterns]
enabled = ["all"]
disabled = []
[ignore]
paths = [
"*.egg-info/",
"*.pyc",
"__pycache__/",
".git/",
"node_modules/",
"vendor/",
"test_*/",
"*_test.go",
]
[output]
theme = "default"
show_fixes = true
show_snippets = true
max_snippet_lines = 10
[formats]
json = true
html = true
sarif = true
[github]
comment_on_pr = false
create_check_runs = true
sarif_upload_url = ""
'''
if config_path.exists():
click.echo(f"[warning]Config file already exists at {config_path}[/warning]")
return
config_path.write_text(config_content)
click.echo(f"[success]Created config file at {config_path}[/success]")