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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env/
ENV/
env.bak/
venv.bak/
.env

# Project specific caches
.pytest_cache/
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ If you prefer scripts or direct commands, all UI options also work via CLI subco

### 1. Configuring your Artificial Intelligence
You can choose which cognitive engine GitAuditor will use (Ollama to run 100% offline, OpenAI or OpenRouter for advanced cloud models).
If you choose **Azure OpenAI**, you must configure your custom resource endpoint (e.g., `https://<your-resource>.services.ai.azure.com/openai/v1`) using the command below.
```bash
gitauditor config
```
Expand Down
1 change: 1 addition & 0 deletions README_pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Se você prefere scripts ou comandos diretos, todas as opções da UI também fu

### 1. Configurando sua Inteligência Artificial
Você pode escolher qual motor cognitivo o GitAuditor vai usar (Ollama para rodar 100% offline, OpenAI ou OpenRouter para modelos avançados em nuvem).
Se você escolher **Azure OpenAI**, é obrigatório configurar seu endpoint customizado (ex: `https://<your-resource>.services.ai.azure.com/openai/v1`) executando o comando abaixo.
```bash
gitauditor config
```
Expand Down
13 changes: 11 additions & 2 deletions src/gitauditor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,22 @@
from rich.prompt import Prompt
from rich.table import Table

lang_to_use = "pt_BR"
import locale

try:
system_lang = locale.getdefaultlocale()[0] or "en_US"
except Exception:
system_lang = "en_US"

default_lang = "pt_BR" if system_lang.startswith("pt") else "en_US"
lang_to_use = default_lang

try:
config_path = os.path.expanduser("~/.gitauditor.json")
if os.path.exists(config_path):
with open(config_path) as f:
cfg = json.load(f)
lang_to_use = cfg.get("lang", "pt_BR")
lang_to_use = cfg.get("lang", default_lang)
except Exception as e:
import sys
print(f"Aviso: Erro ao carregar config i18n: {e}", file=sys.stderr)
Expand Down
2 changes: 1 addition & 1 deletion src/gitauditor/commands/config_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def config_command():
current_model = ai_config.get("model", "gpt-4o")
ai_config["model"] = Prompt.ask("Qual deployment name (modelo)?", default=current_model)

current_url = ai_config.get("base_url", "https://renansousa-2956-resource.services.ai.azure.com/openai/v1")
current_url = ai_config.get("base_url", "https://<your-resource>.services.ai.azure.com/openai/v1")
ai_config["base_url"] = Prompt.ask("URL base do Azure AI", default=current_url)

use_default_cred = Prompt.ask("Usar Entra ID (DefaultAzureCredential)? [S/n]", default="s")
Expand Down
2 changes: 1 addition & 1 deletion src/gitauditor/core/ai_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self):
"base_url", "https://openrouter.ai/api/v1"
)
elif self.provider == "azure":
self.base_url = self.ai_config.get("base_url", "https://renansousa-2956-resource.services.ai.azure.com/openai/v1")
self.base_url = self.ai_config.get("base_url", "https://<your-resource>.services.ai.azure.com/openai/v1")
else:
self.base_url = self.ai_config.get("base_url", "")

Expand Down
4 changes: 4 additions & 0 deletions src/gitauditor/core/policy_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def check_repository(repo_path: str) -> dict[str, Any]:
# 4. Critical Security Risks (.env check)
# Verify if .env is tracked by git (not just existing on disk)
import subprocess

if not os.path.isdir(repo_path) or not os.path.exists(os.path.join(repo_path, ".git")):
return report

try:
res = subprocess.run(["git", "ls-files", ".env"], cwd=repo_path, capture_output=True, text=True, timeout=15)
is_env_tracked = res.stdout.strip() != ""
Expand Down
Loading