Add CLI commands and output renderer
This commit is contained in:
61
vibeguard/cli/commands/init.py
Normal file
61
vibeguard/cli/commands/init.py
Normal 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]")
|
||||||
Reference in New Issue
Block a user