Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b872baf
build: setup pytest infrastructure and mocks for phase 2 coverage
refernandes Jun 27, 2026
28a8f3f
test: add coverage for git scanner and git ops passive functions
refernandes Jun 27, 2026
0276060
test: add catalog commands coverage mocking SQLite in-memory
refernandes Jun 27, 2026
a9f1b19
test: add coverage for ai client structure and error handling
refernandes Jun 27, 2026
dbf370f
build: configure pytest coverage and set fail-under threshold
refernandes Jun 27, 2026
be510aa
refactor: introduce custom exception hierarchy
refernandes Jun 27, 2026
3e753e2
refactor(db): migrate repo tags from csv string to json
refernandes Jun 27, 2026
1ff665d
refactor(cli): replace global state with Typer Context dependency inj…
refernandes Jun 27, 2026
1d091d9
fix(cli): pass Typer Context to alias commands to prevent arguments m…
refernandes Jun 27, 2026
448ee3b
ci: add mypy strict checking to pipeline (allow failure for increment…
refernandes Jun 27, 2026
5403151
chore: add py.typed and __init__ to support type checkers
refernandes Jun 27, 2026
531ec2c
ci: expand pipeline with dedicated jobs for lint, typecheck, test (ma…
refernandes Jun 27, 2026
2f13100
ci: add release workflow to publish to PyPI on version tags
refernandes Jun 27, 2026
2d1d527
ci: configure dependabot for pip and github-actions weekly updates
refernandes Jun 27, 2026
0a2c5ae
docs: add CI and Codecov badges to README files
refernandes Jun 27, 2026
f79a7fb
docs: add full metadata (classifiers, keywords, urls) to pyproject.toml
refernandes Jun 27, 2026
d4fa3a1
docs: setup mkdocs-material and initial documentation structure
refernandes Jun 27, 2026
5f028b2
ci: add GitHub actions workflow to deploy mkdocs
refernandes Jun 27, 2026
104ca42
docs: add module-level and class-level docstrings to core modules
refernandes Jun 27, 2026
e0b21cf
test: add tests for policy_engine module
refernandes Jun 27, 2026
3f8aa05
test: add tests for config module
refernandes Jun 27, 2026
cc0d548
test: add tests for ssh_audit module
refernandes Jun 27, 2026
dd6e280
test: fix async mock for ssh_audit connection test
refernandes Jun 27, 2026
84d5862
build: configure pytest coverage and codecov upload
refernandes Jun 27, 2026
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
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
74 changes: 61 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,79 @@ on:
branches: [ "main", "master" ]

jobs:
test:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Lint with Ruff
run: |
ruff check .
ruff format --check .

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mypy
pip install -e ".[dev]"
- name: Type checking with mypy
continue-on-error: true
run: |
mypy --strict src/

test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]

os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff pytest pytest-asyncio
pip install -e .

- name: Lint with Ruff
run: |
ruff check .
ruff format --check .

pip install -e ".[dev]"
- name: Test with pytest
run: |
pytest tests/
pytest tests/ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml

security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pip-audit
pip install -e .
- name: Run pip-audit
run: |
pip-audit
35 changes: 35 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy docs

on:
push:
branches:
- main
paths:
- "docs/**"
- "mkdocs.yml"
- ".github/workflows/docs.yml"
workflow_dispatch:

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install mkdocs-material
- name: Build docs
run: mkdocs build
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
publish_branch: gh-pages
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish to PyPI

on:
push:
tags:
- "v*"

jobs:
publish:
name: Build and Publish
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install build tool
run: |
python -m pip install --upgrade pip
pip install build

- name: Build package
run: python -m build

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- GitHub Actions workflow for MkDocs deployment (Phase 5).
- Comprehensive metadata to `pyproject.toml`.
- Docstrings across public modules (`ai_api.py`, `policy_engine.py`, `scanner.py`, `models.py`).

## [3.0.0] - 2026-06-27

### Added
- **Semantic Catalog (P3 Blueprint)**: Transformed into an AI-powered Intelligent Code Infrastructure Catalog.
- **Git Worktree Manager (P2)**: Created linked worktrees for efficient branch management.
- Multi-provider AI configuration panel (OpenAI, OpenRouter, Ollama, Azure).
- Semantic context extraction (hash-based project tree analysis).
- Auto-tagging system (heuristic + AI).
- Local strict code reviewer.
- AI-generated release notes (`gitauditor repo changelog`).

## [2.0.0] - 2025-10-15

### Added
- SQLite local database via `SQLModel` (`~/.gitauditor/catalog.db`).
- Improved repository discovery and deduplication.

### Changed
- Refactored core modules for better testability.

## [1.0.0] - 2025-01-10

### Added
- Initial release.
- Basic CLI structure using `Typer` and `Rich`.
- Local script capabilities to scan repositories.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# GitAuditor 🤖

[![CI](https://github.com/refernandes/gitauditor/actions/workflows/ci.yml/badge.svg)](https://github.com/refernandes/gitauditor/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/refernandes/gitauditor/graph/badge.svg?token=YOUR_TOKEN_HERE)](https://codecov.io/gh/refernandes/gitauditor)
*[Leia esta documentação em Português / Read this in Portuguese](README_pt.md)*

**GitAuditor** has evolved from a simple local script into an **AI-powered Intelligent Code Infrastructure Catalog**.
Expand Down
2 changes: 2 additions & 0 deletions README_pt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# GitAuditor 🤖

[![CI](https://github.com/refernandes/gitauditor/actions/workflows/ci.yml/badge.svg)](https://github.com/refernandes/gitauditor/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/refernandes/gitauditor/graph/badge.svg?token=YOUR_TOKEN_HERE)](https://codecov.io/gh/refernandes/gitauditor)
**GitAuditor** evoluiu de um simples script local para um **Catálogo Inteligente de Infraestrutura de Código turbinado por Inteligência Artificial**.
Construído em Python com `Typer`, `SQLModel` e `Rich`, ele transforma pastas de repositórios espalhadas pela sua máquina em um banco de dados local perfeitamente gerenciável, ao mesmo tempo que entende o contexto semântico do seu código usando provedores de IA como OpenAI, OpenRouter ou Ollama local.

Expand Down
12 changes: 12 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Architecture

GitAuditor is structured around several core components:

## Core Modules

- **CLI (`cli.py`, `commands/`)**: Uses `typer` to provide a robust command-line interface. State is managed via `typer.Context` and an `AppState` object.
- **Catalog (`catalog_db.py`, `models.py`)**: Uses `sqlmodel` for local SQLite database management. Tracks cloned repositories and configuration.
- **AI Engine (`ai_api.py`)**: An abstraction layer for talking to multiple LLM providers (OpenAI, OpenRouter, Azure, Ollama).
- **Scanner (`scanner.py`)**: Handles Git parsing and semantic extraction (hash calculation, tree generation).
- **Policy Engine (`policy_engine.py`)**: Applies security and standard rules across repositories.
- **Worktree Manager**: Orchestrates linked Git worktrees for efficient multi-branch development without full clones.
40 changes: 40 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- GitHub Actions workflow for MkDocs deployment (Phase 5).
- Comprehensive metadata to `pyproject.toml`.
- Docstrings across public modules (`ai_api.py`, `policy_engine.py`, `scanner.py`, `models.py`).

## [3.0.0] - 2026-06-27

### Added
- **Semantic Catalog (P3 Blueprint)**: Transformed into an AI-powered Intelligent Code Infrastructure Catalog.
- **Git Worktree Manager (P2)**: Created linked worktrees for efficient branch management.
- Multi-provider AI configuration panel (OpenAI, OpenRouter, Ollama, Azure).
- Semantic context extraction (hash-based project tree analysis).
- Auto-tagging system (heuristic + AI).
- Local strict code reviewer.
- AI-generated release notes (`gitauditor repo changelog`).

## [2.0.0] - 2025-10-15

### Added
- SQLite local database via `SQLModel` (`~/.gitauditor/catalog.db`).
- Improved repository discovery and deduplication.

### Changed
- Refactored core modules for better testability.

## [1.0.0] - 2025-01-10

### Added
- Initial release.
- Basic CLI structure using `Typer` and `Rich`.
- Local script capabilities to scan repositories.
7 changes: 7 additions & 0 deletions docs/commands/catalog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Catalog Commands

Manage your local SQLite catalog of repositories.

- `gitauditor catalog sync <path>`: Scans a folder recursively, finds Git repositories, and syncs them into the catalog.
- `gitauditor catalog status`: Shows the current overview of tracked repositories.
- `gitauditor catalog tag`: Triggers auto-tagging of repositories.
6 changes: 6 additions & 0 deletions docs/commands/policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Policy Commands

Enforce and check policies across your code infrastructure.

- `gitauditor policy check`: Runs pre-commit checks locally or globally.
- `gitauditor policy apply`: Re-applies fixes if necessary.
6 changes: 6 additions & 0 deletions docs/commands/repo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Repo Commands

Analyze repository content and history.

- `gitauditor repo analyze`: Scans the current repository to extract metadata and summaries.
- `gitauditor repo changelog`: Uses AI to generate a semantic changelog based on the latest commits.
5 changes: 5 additions & 0 deletions docs/commands/ssh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SSH Commands

Audit SSH keys and connections for security policies.

- `gitauditor ssh check`: Scans current SSH agent and config for insecure keys.
7 changes: 7 additions & 0 deletions docs/commands/worktree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Worktree Commands

Manage Git worktrees effortlessly.

- `gitauditor worktree add <branch>`: Creates a new linked worktree for the given branch.
- `gitauditor worktree list`: Lists all active worktrees for the current repository.
- `gitauditor worktree clean`: Removes defunct worktrees.
31 changes: 31 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Configuration

GitAuditor supports multiple AI providers for its semantic features.

## Setting up Providers

You can configure the active provider using:

```bash
gitauditor config set provider <provider_name>
```

Currently supported providers:
- `openai`
- `ollama` (Local)
- `openrouter`
- `azure`

## Managing Keys

Set API keys for cloud providers:

```bash
gitauditor config set api_key <your_api_key>
```

For custom endpoint configurations (like Azure or Ollama):

```bash
gitauditor config set endpoint_url <url>
```
34 changes: 34 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Getting Started

Welcome to GitAuditor! This guide will help you install and run GitAuditor for the first time.

## Installation

You can install GitAuditor from PyPI:

```bash
pip install gitauditor
```

Or from source:

```bash
git clone https://github.com/refernandes/gitauditor.git
cd gitauditor
pip install -e .
```

## First Run

Initialize your catalog database:

```bash
gitauditor catalog sync ~/projects/
```

Configure your AI provider:

```bash
gitauditor config set provider openai
gitauditor config set api_key sk-xxxx
```
Loading
Loading