goodfella 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. goodfella-0.1.2/.github/workflows/ci.yml +28 -0
  2. goodfella-0.1.2/.github/workflows/publish.yml +54 -0
  3. goodfella-0.1.2/.gitignore +25 -0
  4. goodfella-0.1.2/.python-version +1 -0
  5. goodfella-0.1.2/LICENSE +12 -0
  6. goodfella-0.1.2/PKG-INFO +110 -0
  7. goodfella-0.1.2/README.md +65 -0
  8. goodfella-0.1.2/pyproject.toml +58 -0
  9. goodfella-0.1.2/src/goodfella/__init__.py +3 -0
  10. goodfella-0.1.2/src/goodfella/cli/__init__.py +1 -0
  11. goodfella-0.1.2/src/goodfella/cli/app.py +144 -0
  12. goodfella-0.1.2/src/goodfella/cli/commands.py +457 -0
  13. goodfella-0.1.2/src/goodfella/cli/ui.py +33 -0
  14. goodfella-0.1.2/src/goodfella/core/__init__.py +1 -0
  15. goodfella-0.1.2/src/goodfella/core/config.py +71 -0
  16. goodfella-0.1.2/src/goodfella/core/constants.py +63 -0
  17. goodfella-0.1.2/src/goodfella/core/env.py +34 -0
  18. goodfella-0.1.2/src/goodfella/knowledge/__init__.py +1 -0
  19. goodfella-0.1.2/src/goodfella/knowledge/anti_patterns/anemic_domain.md +75 -0
  20. goodfella-0.1.2/src/goodfella/knowledge/anti_patterns/god_class.md +49 -0
  21. goodfella-0.1.2/src/goodfella/knowledge/anti_patterns/tight_coupling.md +80 -0
  22. goodfella-0.1.2/src/goodfella/knowledge/rules/clean_architecture.md +44 -0
  23. goodfella-0.1.2/src/goodfella/knowledge/rules/ddd.md +49 -0
  24. goodfella-0.1.2/src/goodfella/knowledge/rules/hexagonal.md +43 -0
  25. goodfella-0.1.2/src/goodfella/knowledge/rules/solid.md +54 -0
  26. goodfella-0.1.2/src/goodfella/knowledge/rules.py +96 -0
  27. goodfella-0.1.2/src/goodfella/llm/__init__.py +1 -0
  28. goodfella-0.1.2/src/goodfella/llm/factory.py +73 -0
  29. goodfella-0.1.2/src/goodfella/llm/memory.py +73 -0
  30. goodfella-0.1.2/src/goodfella/rag/__init__.py +1 -0
  31. goodfella-0.1.2/src/goodfella/rag/chunker.py +130 -0
  32. goodfella-0.1.2/src/goodfella/rag/db.py +40 -0
  33. goodfella-0.1.2/src/goodfella/rag/scanner.py +92 -0
  34. goodfella-0.1.2/src/goodfella/rag/sync.py +90 -0
  35. goodfella-0.1.2/tests/__init__.py +1 -0
  36. goodfella-0.1.2/tests/test_config.py +69 -0
  37. goodfella-0.1.2/uv.lock +3933 -0
@@ -0,0 +1,28 @@
1
+ # Adicionar CD e criação de release futuramente
2
+
3
+ name: CI
4
+
5
+ on:
6
+ push:
7
+ branches: [ main ]
8
+ pull_request:
9
+ branches: [ main ]
10
+
11
+ jobs:
12
+ test:
13
+ name: Run Tests
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - name: Check out repository
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Install uv and set up Python
20
+ uses: astral-sh/setup-uv@v3
21
+ with:
22
+ enable-cache: true
23
+
24
+ - name: Install dependencies
25
+ run: uv sync --all-extras --dev
26
+
27
+ - name: Run pytest
28
+ run: uv run pytest
@@ -0,0 +1,54 @@
1
+ name: Release & Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ github-release:
11
+ name: Generate GitHub Release
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: write
15
+ steps:
16
+ - name: Checkout source
17
+ uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0
20
+
21
+ - name: Create GitHub Release
22
+ uses: softprops/action-gh-release@v2
23
+ with:
24
+ generate_release_notes: true
25
+
26
+ pypi-publish:
27
+ name: Build and publish to PyPI
28
+ needs: github-release
29
+ runs-on: ubuntu-latest
30
+ environment:
31
+ name: pypi
32
+ url: https://pypi.org/p/goodfella
33
+ permissions:
34
+ id-token: write
35
+ contents: read
36
+ steps:
37
+ - name: Checkout source
38
+ uses: actions/checkout@v4
39
+
40
+ - name: Set up Python
41
+ uses: actions/setup-python@v5
42
+ with:
43
+ python-version: "3.11"
44
+
45
+ - name: Install uv
46
+ run: curl -LsSf https://astral.sh/uv/install.sh | sh
47
+
48
+ - name: Build distributions
49
+ run: uv build
50
+
51
+ - name: Publish package distributions to PyPI
52
+ uses: pypa/gh-action-pypi-publish@release/v1
53
+ with:
54
+ packages-dir: dist/
@@ -0,0 +1,25 @@
1
+ .goodfella/
2
+
3
+ __pycache__/
4
+ *.py[cod]
5
+ *$py.class
6
+ *.egg-info/
7
+ dist/
8
+ build/
9
+ *.egg
10
+
11
+ .venv/
12
+ venv/
13
+
14
+ .vscode/
15
+ .idea/
16
+ *.swp
17
+ *.swo
18
+
19
+ .DS_Store
20
+ Thumbs.db
21
+
22
+ .env
23
+ .env.local
24
+
25
+ brainstorm.md
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2026 Bruno
2
+
3
+ All rights reserved.
4
+
5
+ The source code in this repository is provided for viewing and educational purposes only.
6
+
7
+ You are NOT permitted to:
8
+ - Modify, adapt, or create derivative works from this software.
9
+ - Distribute, publish, or share this software or any part of it.
10
+ - Use this software for any commercial purposes.
11
+
12
+ Any use of this software outside of personal viewing requires explicit prior written permission from the copyright holder.
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: goodfella
3
+ Version: 0.1.2
4
+ Summary: Strict Pair Programmer CLI — AI-powered software architecture reviewer
5
+ Project-URL: Homepage, https://github.com/BrunoSaintClair/goodfella-ai
6
+ Project-URL: Repository, https://github.com/BrunoSaintClair/goodfella-ai.git
7
+ Project-URL: Bug Tracker, https://github.com/BrunoSaintClair/goodfella-ai/issues
8
+ Author-email: Bruno Saint Clair <brunosaint.dev@gmail.com>
9
+ License: Copyright (c) 2026 Bruno
10
+
11
+ All rights reserved.
12
+
13
+ The source code in this repository is provided for viewing and educational purposes only.
14
+
15
+ You are NOT permitted to:
16
+ - Modify, adapt, or create derivative works from this software.
17
+ - Distribute, publish, or share this software or any part of it.
18
+ - Use this software for any commercial purposes.
19
+
20
+ Any use of this software outside of personal viewing requires explicit prior written permission from the copyright holder.
21
+ License-File: LICENSE
22
+ Keywords: ai,architecture,cli,goodfella,llm,pair-programming,rag
23
+ Classifier: Development Status :: 4 - Beta
24
+ Classifier: Environment :: Console
25
+ Classifier: Intended Audience :: Developers
26
+ Classifier: Programming Language :: Python :: 3
27
+ Classifier: Programming Language :: Python :: 3.11
28
+ Classifier: Programming Language :: Python :: 3.12
29
+ Classifier: Topic :: Software Development :: Quality Assurance
30
+ Requires-Python: >=3.11
31
+ Requires-Dist: chromadb>=0.5
32
+ Requires-Dist: langchain-anthropic>=0.3
33
+ Requires-Dist: langchain-community>=0.3
34
+ Requires-Dist: langchain-google-genai>=2.0
35
+ Requires-Dist: langchain-ollama>=0.3
36
+ Requires-Dist: langchain-openai>=0.3
37
+ Requires-Dist: langchain>=0.3
38
+ Requires-Dist: prompt-toolkit>=3.0
39
+ Requires-Dist: pydantic-settings>=2.0
40
+ Requires-Dist: pydantic>=2.0
41
+ Requires-Dist: python-dotenv>=1.0
42
+ Requires-Dist: questionary>=2.1.1
43
+ Requires-Dist: rich>=13.0
44
+ Description-Content-Type: text/markdown
45
+
46
+ # 🎩 Goodfella
47
+
48
+ **Strict Pair Programmer CLI** — Um assistente de IA focado estritamente em Engenharia de Software que atua como um Pair Programmer Rigoroso e Arquiteto de Software.
49
+
50
+ ## O que é?
51
+
52
+ O Goodfella analisa códigos, detecta violações de princípios (SOLID, Clean Architecture, DDD, etc.) e sugere melhorias. Ele **não altera código diretamente** — apenas aconselha.
53
+
54
+ ## Características
55
+
56
+ - 🔒 **Local-First** — Processamento padrão 100% local via Ollama
57
+ - ☁️ **Multi-Provedor** — Suporte a OpenAI, Anthropic, Gemini
58
+ - 🧠 **RAG Inteligente** — Base vetorial com ChromaDB embutido
59
+ - 📂 **Isolamento por Projeto** — Contextos independentes por diretório
60
+ - 💬 **Chat Interativo** — REPL fluido no terminal com Rich
61
+
62
+ ## Instalação
63
+
64
+ ### Via pip (quando publicado)
65
+
66
+ ```bash
67
+ pip install goodfella
68
+ ```
69
+
70
+ ### Via código-fonte
71
+
72
+ ```bash
73
+ git clone <repo-url>
74
+ cd goodfella
75
+ uv sync
76
+ uv run goodfella
77
+ ```
78
+
79
+ ## Uso
80
+
81
+ ```bash
82
+ # Inicia o chat interativo no diretório do seu projeto
83
+ $ goodfella
84
+ ```
85
+
86
+ ### Comandos Principais
87
+
88
+ | Comando | Descrição |
89
+ |---------|-----------|
90
+ | `/review` | Revisão estrita de Clean Architecture/SOLID |
91
+ | `/deep-review` | Análise completa via modelo Cloud (bypass do RAG) |
92
+ | `/setup` | Assistente de configuração de provedor |
93
+ | `/status` | Saúde do sistema e provedor ativo |
94
+ | `/rule add` | Adicionar regra customizada |
95
+ | `/rebuild` | Reconstruir banco vetorial do zero |
96
+ | `/quit` | Encerrar e salvar histórico |
97
+
98
+ ## Stack Técnica
99
+
100
+ - **Python** + **uv**
101
+ - **LangChain** — Orquestração de IA
102
+ - **ChromaDB** — Banco vetorial embutido
103
+ - **Rich** — Interface de terminal
104
+ - **Ollama** — LLM local (padrão)
105
+
106
+ ## Licença
107
+
108
+ Proprietary / All Rights Reserved
109
+
110
+ O código-fonte é disponibilizado apenas para visualização e fins educacionais. É estritamente proibido modificar, distribuir, sublicenciar ou utilizar este projeto (ou qualquer parte dele) para fins comerciais sem autorização prévia por escrito.
@@ -0,0 +1,65 @@
1
+ # 🎩 Goodfella
2
+
3
+ **Strict Pair Programmer CLI** — Um assistente de IA focado estritamente em Engenharia de Software que atua como um Pair Programmer Rigoroso e Arquiteto de Software.
4
+
5
+ ## O que é?
6
+
7
+ O Goodfella analisa códigos, detecta violações de princípios (SOLID, Clean Architecture, DDD, etc.) e sugere melhorias. Ele **não altera código diretamente** — apenas aconselha.
8
+
9
+ ## Características
10
+
11
+ - 🔒 **Local-First** — Processamento padrão 100% local via Ollama
12
+ - ☁️ **Multi-Provedor** — Suporte a OpenAI, Anthropic, Gemini
13
+ - 🧠 **RAG Inteligente** — Base vetorial com ChromaDB embutido
14
+ - 📂 **Isolamento por Projeto** — Contextos independentes por diretório
15
+ - 💬 **Chat Interativo** — REPL fluido no terminal com Rich
16
+
17
+ ## Instalação
18
+
19
+ ### Via pip (quando publicado)
20
+
21
+ ```bash
22
+ pip install goodfella
23
+ ```
24
+
25
+ ### Via código-fonte
26
+
27
+ ```bash
28
+ git clone <repo-url>
29
+ cd goodfella
30
+ uv sync
31
+ uv run goodfella
32
+ ```
33
+
34
+ ## Uso
35
+
36
+ ```bash
37
+ # Inicia o chat interativo no diretório do seu projeto
38
+ $ goodfella
39
+ ```
40
+
41
+ ### Comandos Principais
42
+
43
+ | Comando | Descrição |
44
+ |---------|-----------|
45
+ | `/review` | Revisão estrita de Clean Architecture/SOLID |
46
+ | `/deep-review` | Análise completa via modelo Cloud (bypass do RAG) |
47
+ | `/setup` | Assistente de configuração de provedor |
48
+ | `/status` | Saúde do sistema e provedor ativo |
49
+ | `/rule add` | Adicionar regra customizada |
50
+ | `/rebuild` | Reconstruir banco vetorial do zero |
51
+ | `/quit` | Encerrar e salvar histórico |
52
+
53
+ ## Stack Técnica
54
+
55
+ - **Python** + **uv**
56
+ - **LangChain** — Orquestração de IA
57
+ - **ChromaDB** — Banco vetorial embutido
58
+ - **Rich** — Interface de terminal
59
+ - **Ollama** — LLM local (padrão)
60
+
61
+ ## Licença
62
+
63
+ Proprietary / All Rights Reserved
64
+
65
+ O código-fonte é disponibilizado apenas para visualização e fins educacionais. É estritamente proibido modificar, distribuir, sublicenciar ou utilizar este projeto (ou qualquer parte dele) para fins comerciais sem autorização prévia por escrito.
@@ -0,0 +1,58 @@
1
+ [project]
2
+ name = "goodfella"
3
+ version = "0.1.2"
4
+ description = "Strict Pair Programmer CLI — AI-powered software architecture reviewer"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ authors = [
8
+ { name = "Bruno Saint Clair", email = "brunosaint.dev@gmail.com" }
9
+ ]
10
+ license = { file = "LICENSE" }
11
+ keywords = ["ai", "cli", "pair-programming", "rag", "architecture", "llm", "goodfella"]
12
+ classifiers = [
13
+ "Development Status :: 4 - Beta",
14
+ "Environment :: Console",
15
+ "Intended Audience :: Developers",
16
+ "Topic :: Software Development :: Quality Assurance",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ ]
21
+
22
+ dependencies = [
23
+ "langchain>=0.3",
24
+ "langchain-community>=0.3",
25
+ "langchain-ollama>=0.3",
26
+ "langchain-openai>=0.3",
27
+ "langchain-google-genai>=2.0",
28
+ "langchain-anthropic>=0.3",
29
+ "chromadb>=0.5",
30
+ "rich>=13.0",
31
+ "prompt-toolkit>=3.0",
32
+ "pydantic>=2.0",
33
+ "pydantic-settings>=2.0",
34
+ "python-dotenv>=1.0",
35
+ "questionary>=2.1.1",
36
+ ]
37
+
38
+ [project.urls]
39
+ Homepage = "https://github.com/BrunoSaintClair/goodfella-ai"
40
+ Repository = "https://github.com/BrunoSaintClair/goodfella-ai.git"
41
+ "Bug Tracker" = "https://github.com/BrunoSaintClair/goodfella-ai/issues"
42
+
43
+ [project.scripts]
44
+ goodfella = "goodfella.cli.app:main"
45
+
46
+ [build-system]
47
+ requires = ["hatchling"]
48
+ build-backend = "hatchling.build"
49
+
50
+ [tool.hatch.build.targets.wheel]
51
+ packages = ["src/goodfella"]
52
+
53
+ [tool.pytest.ini_options]
54
+ testpaths = ["tests"]
55
+ pythonpath = ["src"]
56
+
57
+ [dependency-groups]
58
+ dev = ["pytest>=8.0.0"]
@@ -0,0 +1,3 @@
1
+ """Goodfella"""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1 @@
1
+ """Goodfella CLI — Camada de interface do terminal."""
@@ -0,0 +1,144 @@
1
+ """
2
+ Entry point principal do Goodfella CLI.
3
+
4
+ Este módulo contém a função `main()` que é registrada como console_script
5
+ no pyproject.toml, permitindo invocar o Goodfella diretamente via terminal:
6
+
7
+ $ goodfella
8
+
9
+ """
10
+
11
+
12
+ import sys
13
+ import logging
14
+ import warnings
15
+
16
+ # Suprime warnings e logs de bibliotecas de terceiros (ChromaDB, Langchain, etc)
17
+ warnings.filterwarnings("ignore")
18
+ logging.getLogger("chromadb").setLevel(logging.ERROR)
19
+ logging.getLogger("httpx").setLevel(logging.ERROR)
20
+
21
+ from langchain_core.messages import SystemMessage, HumanMessage
22
+
23
+ from goodfella.core.env import init_environment
24
+ from goodfella.rag.chunker import run_indexing_pipeline
25
+ from goodfella.knowledge.rules import sync_rules
26
+ from goodfella.llm.factory import get_llm
27
+ from goodfella.llm.memory import load_history, save_message, clear_history
28
+ from goodfella.cli.ui import console, show_spinner
29
+ from goodfella.cli.commands import handle_setup, handle_status, handle_refresh, handle_rebuild, handle_help, handle_review, handle_deep_review, handle_rule_add
30
+
31
+ def print_welcome():
32
+ console.print("\n[bold magenta]🎩 Goodfella AI Pair Programmer[/bold magenta]")
33
+ console.print("[info]Digite /help para ver a lista de comandos disponíveis.[/info]\n")
34
+
35
+ def main() -> None:
36
+ """Ponto de entrada principal do comando `goodfella`.
37
+
38
+ Inicializa o ambiente, sincroniza a base vetorial e
39
+ inicia o loop REPL interativo com o usuário.
40
+ """
41
+ try:
42
+ # 1. Setup do ambiente e Banco de Dados
43
+ init_environment()
44
+
45
+ with show_spinner("Sincronizando base de código e regras..."):
46
+ sync_rules()
47
+ run_indexing_pipeline()
48
+ # 2. Inicialização da Instância LangChain
49
+ llm = get_llm()
50
+
51
+ print_welcome()
52
+
53
+ # 3. Loop REPL Interativo
54
+ while True:
55
+ try:
56
+ user_input = console.input("[bold blue]❯[/bold blue] ")
57
+ except (KeyboardInterrupt, EOFError):
58
+ break
59
+
60
+ if not user_input.strip():
61
+ continue
62
+
63
+ cmd = user_input.strip().lower()
64
+ if cmd in ["/exit", "/quit"]:
65
+ break
66
+ elif cmd == "/clear":
67
+ console.clear()
68
+ print_welcome()
69
+ continue
70
+ elif cmd == "/reset":
71
+ clear_history()
72
+ console.print("[info]Histórico apagado.[/info]\n")
73
+ continue
74
+ elif cmd == "/setup":
75
+ handle_setup()
76
+ continue
77
+ elif cmd == "/status":
78
+ handle_status()
79
+ continue
80
+ elif cmd == "/refresh":
81
+ handle_refresh()
82
+ continue
83
+ elif cmd == "/rebuild":
84
+ handle_rebuild()
85
+ continue
86
+ elif cmd == "/help":
87
+ handle_help()
88
+ continue
89
+ elif cmd.startswith("/rule add"):
90
+ handle_rule_add()
91
+ continue
92
+
93
+ # Prepara a janela de contexto
94
+ history = load_history()
95
+
96
+ if cmd.startswith("/review"):
97
+ user_msg, sys_prompt = handle_review(cmd)
98
+ if not user_msg:
99
+ continue
100
+ user_input = user_msg
101
+ system_prompt = sys_prompt
102
+ elif cmd.startswith("/deep-review"):
103
+ user_msg, sys_prompt = handle_deep_review(cmd)
104
+ if not user_msg:
105
+ continue
106
+ user_input = user_msg
107
+ system_prompt = sys_prompt
108
+ else:
109
+ system_prompt = (
110
+ "Você é o Goodfella, um AI Pair Programmer local-first ultra focado em "
111
+ "engenharia de software pragmática. Responda sempre em português, de forma direta."
112
+ )
113
+
114
+ messages = [SystemMessage(content=system_prompt)]
115
+ messages.extend(history)
116
+ messages.append(HumanMessage(content=user_input))
117
+
118
+ console.print("\n[bold magenta]❖[/bold magenta] ", end="")
119
+ full_response = ""
120
+
121
+ try:
122
+ for chunk in llm.stream(messages):
123
+ print(chunk.content, end="", flush=True)
124
+ full_response += chunk.content
125
+ except Exception as e:
126
+ error_msg = str(e)
127
+ if "Connection refused" in error_msg or "Errno 111" in error_msg:
128
+ console.print("\n[danger]Erro: Não foi possível conectar ao Ollama (Connection refused).[/danger]")
129
+ console.print("[info]Dica: Verifique se o Ollama está rodando no seu terminal com 'ollama serve'.[/info]")
130
+ console.print("[info]Se deseja usar OpenAI ou Gemini, configure-os usando o comando /setup.[/info]")
131
+ else:
132
+ console.print(f"\n[danger]Erro de LLM: {error_msg}[/danger]")
133
+ continue
134
+ print("\n")
135
+
136
+ save_message("user", user_input)
137
+ save_message("ai", full_response)
138
+
139
+ except Exception as e:
140
+ console.print(f"\n[danger]Erro Fatal: {e}[/danger]")
141
+ sys.exit(1)
142
+
143
+ if __name__ == "__main__":
144
+ main()