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
Binary file added .coverage
Binary file not shown.
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,20 @@ tests/repo_windows/
# OS generated files
.DS_Store
Thumbs.db

# Build artifacts
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
25 changes: 25 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,35 @@ dependencies = [
"typer>=0.12.0",
"sqlmodel>=0.0.16",
"tenacity>=8.0.0",
"azure-identity>=1.15.0",
]

[project.scripts]
gitauditor = "gitauditor.__main__:main"

[tool.setuptools.packages.find]
where = ["src"]

[project.optional-dependencies]
dev = [
"pytest>=8.0.0",
"pytest-cov>=4.1.0",
"pytest-asyncio>=0.23.5",
"ruff>=0.3.0",
]

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-ra -q --cov=src"
testpaths = [
"tests",
]
asyncio_default_fixture_loop_scope = "function"

[tool.ruff]
line-length = 100
target-version = "py310"

[tool.ruff.lint]
select = ["E", "F", "I", "W", "UP"]
ignore = ["E501", "E402", "F841"]
72 changes: 59 additions & 13 deletions repomix-output.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,72 @@ The content is organized as follows:
</file_summary>

<directory_structure>
.github/
workflows/
ci.yml
src/
commands/
__init__.py
amend_cmd.py
audit_cmd.py
repo_cmd.py
ssh_cmd.py
core/
git_ops.py
ollama_api.py
scanner.py
ssh_audit.py
__main__.py
cli.py
gitauditor/
commands/
__init__.py
amend_cmd.py
audit_cmd.py
catalog_cmd.py
changelog_cmd.py
config_cmd.py
policy_cmd.py
repo_app.py
repo_cmd.py
review_cmd.py
ssh_cmd.py
worktree_cmd.py
core/
ai_api.py
audit_log.py
catalog.py
config.py
enricher.py
git_ops.py
heuristics.py
models.py
policy_engine.py
scanner.py
semantic.py
ssh_audit.py
locales/
en_US/
LC_MESSAGES/
gitauditor.mo
gitauditor.po
messages.mo
messages.po
pt_BR/
LC_MESSAGES/
gitauditor.mo
gitauditor.po
messages.mo
messages.po
gitauditor.pot
__main__.py
cli.py
gitauditor.egg-info/
dependency_links.txt
entry_points.txt
PKG-INFO
requires.txt
SOURCES.txt
top_level.txt
tests/
test_enricher.py
test_point1_rebase_merges.py
test_point2_async_audit.py
test_point3_windows_rebase.py
test_point5_duplicates.py
.gitignore
BLUEPRINT.md
pyproject.toml
README_pt.md
README.md
requirements.txt
test_azure_key.py
test_azure.py
</directory_structure>
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ httpx>=0.27.0
rich>=13.7.1
pyyaml>=6.0.1
tenacity>=8.0.0
azure-identity>=1.15.0
66 changes: 0 additions & 66 deletions src/gitauditor.egg-info/PKG-INFO

This file was deleted.

23 changes: 0 additions & 23 deletions src/gitauditor.egg-info/SOURCES.txt

This file was deleted.

1 change: 0 additions & 1 deletion src/gitauditor.egg-info/dependency_links.txt

This file was deleted.

2 changes: 0 additions & 2 deletions src/gitauditor.egg-info/entry_points.txt

This file was deleted.

7 changes: 0 additions & 7 deletions src/gitauditor.egg-info/requires.txt

This file was deleted.

1 change: 0 additions & 1 deletion src/gitauditor.egg-info/top_level.txt

This file was deleted.

44 changes: 22 additions & 22 deletions src/gitauditor/cli.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import os
import asyncio
import typer
from rich.console import Console
from rich.table import Table
from rich.panel import Panel
from rich.prompt import Prompt

# --- Inicialização da Internacionalização (i18n) ---
import gettext
import json
import os

import typer
from rich.console import Console
from rich.panel import Panel
from rich.prompt import Prompt
from rich.table import Table

lang_to_use = "pt_BR"
try:
config_path = os.path.expanduser("~/.gitauditor.json")
if os.path.exists(config_path):
with open(config_path, "r") as f:
with open(config_path) as f:
cfg = json.load(f)
lang_to_use = cfg.get("lang", "pt_BR")
except:
except Exception:
pass

localedir = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'locales')
Expand All @@ -30,15 +31,14 @@
builtins.__dict__['_'] = lambda x: x
# ----------------------------------------------------

from gitauditor.core.scanner import GitScanner
from gitauditor.core.ai_api import AIClient

from gitauditor.commands.ssh_cmd import handle_manage_ssh
from gitauditor.commands.catalog_cmd import catalog_app
from gitauditor.commands.worktree_cmd import worktree_app
from gitauditor.commands.config_cmd import config_command
from gitauditor.commands.policy_cmd import policy_app
from gitauditor.commands.repo_app import repo_app
from gitauditor.commands.ssh_cmd import handle_manage_ssh
from gitauditor.commands.worktree_cmd import worktree_app
from gitauditor.core.ai_api import AIClient
from gitauditor.core.scanner import GitScanner

app = typer.Typer(
help=_("GitAuditor - O seu assistente IA e motor de políticas para repositórios Git."),
Expand Down Expand Up @@ -88,7 +88,7 @@ def run(self):
f"[9] 🏷️ Filtrar Tabela (Atual: [bold green]{self.current_filter}[/bold green])"
)
console.print("[0] 🚪 Sair")

total_pages = (total_filtered + self.page_size - 1) // self.page_size if total_filtered > 0 else 1
if total_pages > 1:
console.print(f"[dim]Página {self.current_page + 1}/{total_pages} - Digite 'n' para próxima, 'p' para anterior[/dim]")
Expand All @@ -112,6 +112,7 @@ def run(self):
else:
self.current_page = total_pages - 1
elif choice == "1":
from gitauditor.commands.repo_cmd import handle_repo_details
handle_repo_details(self)
elif choice == "2":
from gitauditor.commands.catalog_cmd import open_repo
Expand All @@ -126,6 +127,7 @@ def run(self):
Prompt.ask("\n[dim]Pressione ENTER para continuar[/dim]")
elif choice == "4":
from rich.prompt import Confirm

from gitauditor.commands.catalog_cmd import dedupe_repos

plan = Confirm.ask("Rodar em modo seguro (Dry-Run)?", default=True)
Expand All @@ -136,8 +138,8 @@ def run(self):
console.print("[2] Criar Nova Worktree")
wc = Prompt.ask("Opção", choices=["1", "2"])
from gitauditor.commands.worktree_cmd import (
list_worktrees,
create_worktree,
list_worktrees,
)

q = Prompt.ask("Nome do repositório original")
Expand Down Expand Up @@ -184,7 +186,6 @@ def _show_ai_menu(self):

handle_ai_amend(self)
elif ai_choice == "2":
import asyncio
from gitauditor.commands.review_cmd import review_command

if not self.repos:
Expand Down Expand Up @@ -257,9 +258,10 @@ def _show_ai_menu(self):
Prompt.ask("\n[dim]Pressione ENTER para continuar[/dim]")

def _load_catalog(self, silent=False):
from sqlmodel import Session, select

from gitauditor.core.catalog import engine, init_db
from gitauditor.core.models import Repo
from sqlmodel import Session, select

init_db()
try:
Expand Down Expand Up @@ -383,7 +385,7 @@ def _show_repo_table(self) -> int:
for idx, repo_path in enumerate(self.repos):
status_obj = self.repo_status.get(repo_path, {"icon": "⚪", "reason": ""})
icon = status_obj if isinstance(status_obj, str) else status_obj["icon"]

if self.current_filter == "Apenas OK" and "🟢" not in icon:
continue
if self.current_filter == "Apenas Negados" and "🔴" not in icon:
Expand All @@ -393,7 +395,7 @@ def _show_repo_table(self) -> int:
filtered_repos.append((idx, repo_path, status_obj))

total_filtered = len(filtered_repos)

# Adjust page if out of bounds
max_page = max(0, (total_filtered - 1) // self.page_size)
if self.current_page > max_page:
Expand Down Expand Up @@ -421,7 +423,7 @@ def _show_repo_table(self) -> int:
console.print(
f"[yellow]Nenhum repositório corresponde ao filtro: {self.current_filter}[/yellow]"
)

return total_filtered

def _action_filter_table(self):
Expand All @@ -445,8 +447,6 @@ def _action_filter_table(self):
self.current_page = 0


app = typer.Typer(help="GitAuditor CLI - IA Manager", invoke_without_command=True)

# Registra os Sub-Apps Oficiais
app.add_typer(catalog_app, name="catalog", help=_("Catálogo Local de Repositórios"))
app.add_typer(repo_app, name="repo", help=_("Operações de Repositório (IA, Changelog, Amend)"))
Expand Down
Loading
Loading