gitpr-cli 0.0.31__tar.gz → 0.0.33__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 (49) hide show
  1. {gitpr_cli-0.0.31/gitpr_cli.egg-info → gitpr_cli-0.0.33}/PKG-INFO +63 -1
  2. gitpr_cli-0.0.31/PKG-INFO → gitpr_cli-0.0.33/README.md +419 -376
  3. gitpr_cli-0.0.31/README.md → gitpr_cli-0.0.33/gitpr_cli.egg-info/PKG-INFO +438 -357
  4. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/gitpr_cli.egg-info/SOURCES.txt +5 -0
  5. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/pyproject.toml +11 -2
  6. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/blame_engine.py +11 -4
  7. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/config.py +9 -1
  8. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/core.py +418 -23
  9. gitpr_cli-0.0.33/src/github_api.py +126 -0
  10. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/i18n.py +10 -10
  11. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/issue_engine.py +66 -6
  12. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/linter_engine.py +3 -0
  13. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/main.py +289 -16
  14. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/ui/issue_app.py +6 -4
  15. gitpr_cli-0.0.33/src/ui/pr_publish_app.py +1210 -0
  16. gitpr_cli-0.0.33/src/ui/pr_publish_help.py +45 -0
  17. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/updater.py +7 -2
  18. gitpr_cli-0.0.33/tests/test_blame_metrics.py +140 -0
  19. gitpr_cli-0.0.33/tests/test_linter_metrics.py +116 -0
  20. gitpr_cli-0.0.33/tests/test_smart_excludes.py +234 -0
  21. gitpr_cli-0.0.31/tests/test_smart_excludes.py +0 -71
  22. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/LICENSE +0 -0
  23. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/gitpr_cli.egg-info/dependency_links.txt +0 -0
  24. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/gitpr_cli.egg-info/entry_points.txt +0 -0
  25. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/gitpr_cli.egg-info/requires.txt +0 -0
  26. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/gitpr_cli.egg-info/top_level.txt +0 -0
  27. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/setup.cfg +0 -0
  28. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/__init__.py +0 -0
  29. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/ai_providers.py +0 -0
  30. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/cache.py +0 -0
  31. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/chat_memory.py +0 -0
  32. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/mcp_server.py +0 -0
  33. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/metrics.py +0 -0
  34. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/security.py +0 -0
  35. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/spinner.py +0 -0
  36. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/tui_issue.py +0 -0
  37. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/ui/__init__.py +0 -0
  38. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/ui/chat_app.py +0 -0
  39. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/ui/help_screen.py +0 -0
  40. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/src/ui/metrics_app.py +0 -0
  41. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/tests/test_chat_backend.py +0 -0
  42. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/tests/test_core.py +0 -0
  43. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/tests/test_install_wizard.py +0 -0
  44. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/tests/test_mcp_prompts.py +0 -0
  45. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/tests/test_mcp_server.py +0 -0
  46. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/tests/test_metrics.py +0 -0
  47. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/tests/test_pre_save.py +0 -0
  48. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/tests/test_skill_command.py +0 -0
  49. {gitpr_cli-0.0.31 → gitpr_cli-0.0.33}/tests/test_thinking_words.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitpr-cli
3
- Version: 0.0.31
3
+ Version: 0.0.33
4
4
  Summary: AI-powered PR automation, commit messages, and code review (Gemini, DeepSeek, and Ollama)
5
5
  Author-email: Natan Fiuza <contato@natanfiuza.dev.br>
6
6
  Requires-Python: >=3.10
@@ -170,6 +170,7 @@ You can pass the following *flags* for specific actions:
170
170
  * **New Code Issue (`gitpr -is`):** Reads the current `git diff`. **Why use:** Ideal for quickly documenting the task you just finished programming, before committing.
171
171
  * **Epic/Release Issue (`gitpr -is -ht`):** Reads the full history of the current branch (Git Log + PR Cache). **Why use:** Ideal for generating consolidated documentation of an entire release or a large *feature* that took several days/commits to complete.
172
172
  * **Archaeological/Technical Debt Issue (`gitpr -is -b file:lines`):** Reads the timeline of a specific business rule. **Why use:** Ideal for documenting technical debt, explaining how a legacy code block evolved and why it needs to be refactored.
173
+ * **PR Publisher (default):** Running `gitpr` generates the PR description with AI, saves the `.md` file to `.gitpr/reports/pr_desc/`, and opens an interactive terminal interface (TUI) to review, edit, and publish the Pull Request directly to GitHub via REST API. Before generation, it checks for unstaged files and offers a modal to manage them. Use `--no-publish` to save only the PR file locally without opening the publisher, or `--no-edit` to auto-commit pending changes (with lint validation), auto-push, and publish immediately — handling existing PR updates and optional auto-merge. Use `--base <branch>` to change the target branch. 📖 [Full docs](https://github.com/natanfiuza/gitpr/blob/main/docs/pull-request-publication.md)
173
174
  * `-h` or `--help`: Shows the general help with all options. Use together with another flag for **contextual help** (e.g.: `gitpr -h --issue`, `gitpr -h --linter`) with a direct link to the detailed documentation of each feature.
174
175
  * `-u` or `--update`: Checks and installs the latest version of GitPR (Auto-Updater).
175
176
 
@@ -238,6 +239,32 @@ To force a specific language, set `GITPR_LANG=pt_br` or `GITPR_LANG=en` in `~/.g
238
239
 
239
240
  > 📖 **Full developer guide:** [docs/i18n_explanation.md](https://github.com/natanfiuza/gitpr/blob/main/docs/i18n_explanation.md) — architecture, usage patterns, circular import precautions, and how to add new languages.
240
241
 
242
+ ## 🔄 Hook Scripts Versioning & Auto-Sync
243
+
244
+ GitPR includes an automatic versioning system for Git hook scripts (`pre-commit`, `prepare-commit-msg`, `pre-push`, `post-checkout`, `post-merge`). Every time you run `gitpr`, the system silently checks whether your installed hooks match the latest version and automatically updates them if needed — all while respecting your language preference.
245
+
246
+ **How it works:**
247
+ 1. Reads `SCRIPTS_VERSION` and `SCRIPTS_LANG` from `~/.gitpr/.env`
248
+ 2. Compares with the latest version (`__scripts_version__`) shipped with your GitPR release
249
+ 3. If versions or language differ → automatically downloads and updates hooks
250
+ 4. If everything matches → skips entirely (single `.env` read, zero network I/O)
251
+
252
+ **Example:**
253
+ ```bash
254
+ # First run — no hooks installed yet
255
+ $ gitpr --installhooks
256
+ 📥 Downloading pre-commit...
257
+ 📥 Downloading prepare-commit-msg...
258
+ ✅ Scripts synced successfully!
259
+
260
+ # Subsequent runs — silent checks
261
+ $ gitpr # (no output = hooks are up to date)
262
+ ```
263
+
264
+ The system supports **5 languages**: English (default), Portuguese (Brazil), Portuguese (Portugal), French, and Spanish. Scripts are thin shims — the real logic lives in the CLI, so even slightly stale hooks continue working correctly.
265
+
266
+ 📚 [Full Documentation](https://gitpr.natanfiuza.dev.br/docs/hooks-versioning)
267
+
241
268
  ## 🔌 MCP Integration (Model Context Protocol)
242
269
 
243
270
  GitPR can run as an **MCP server**, exposing its AI-powered capabilities as tools that your editor's AI assistant can invoke directly — no terminal needed. This enables a fully integrated workflow where you can generate commit messages, review code, run linters, trace code origins, and create issues without leaving your IDE.
@@ -297,6 +324,39 @@ Once configured, use natural language in your editor's AI chat:
297
324
 
298
325
  > 💬 **MCP Prompts** — GitPR also exposes 7 pre-defined message templates (prompts) for common flows like "Review PR", "Generate Commit Message", and "Create Issue from Diff". See the [MCP Prompts guide](https://github.com/natanfiuza/gitpr/blob/main/docs/mcp-prompts.md) for the full list.
299
326
 
327
+ ## 🎯 Smart Excludes (Token Optimization)
328
+
329
+ GitPR automatically removes non-code files from your `git diff` before sending them to the AI — reducing token consumption and API costs with **zero configuration** required.
330
+
331
+ **Two layers of exclusions:**
332
+ - **Lockfiles & generated files:** `package-lock.json`, `*.min.js`, `*.map`, `*.pyc`, `*.svg`, and 30+ more patterns defined in [`gitpr.smart-excludes.json`](https://github.com/natanfiuza/gitpr/blob/main/templates/gitpr.smart-excludes.json)
333
+ - **Documentation prose:** `*.md`, `*.txt`, `*.rst`, `*.adoc`, `*.tex`, and 20+ more extensions defined in [`gitpr.docs-smart-excludes.json`](https://github.com/natanfiuza/gitpr/blob/main/templates/gitpr.docs-smart-excludes.json)
334
+
335
+ **Documentation tracking:** Even though documentation content is excluded from the diff, GitPR still tells the AI _which_ documentation files changed by injecting their paths as metadata into the system instructions. The AI has full context about doc updates without consuming tokens on their prose.
336
+
337
+ **Benefits:**
338
+ - ✅ Up to **98% token reduction** on documentation-heavy branches
339
+ - ✅ **Faster AI responses** — less text to process per API call
340
+ - ✅ **Higher-quality analysis** — AI focuses on code changes, not markup
341
+ - ✅ **Zero configuration** — works automatically on every run, managed remotely
342
+
343
+ > 📖 **Full documentation:** [docs/smart-excludes.md](https://github.com/natanfiuza/gitpr/blob/main/docs/smart-excludes.md) — available in 5 languages (EN, PT-BR, PT-PT, FR, ES).
344
+
345
+ ## 📁 Output Directory Structure
346
+
347
+ By default, GitPR saves all generated files in the `.gitpr/reports/` directory, organized by artifact type:
348
+
349
+ | Artifact | Default Location |
350
+ |---|---|
351
+ | PR Description | `.gitpr/reports/pr_desc/` |
352
+ | Code Review | `.gitpr/reports/review/` |
353
+ | Full Review | `.gitpr/reports/full_review/` |
354
+ | File Review | `.gitpr/reports/file_review/` |
355
+ | Blame Report | `.gitpr/reports/blame/` |
356
+ | Issue Draft | `.gitpr/reports/issue/` |
357
+
358
+ Directories are created automatically on first use. **Backward compatible:** if your `.env` already contains custom paths with directory separators (e.g., `OUTPUT_FILE_NAME=/home/user/prs/my_pr.md`), those are honored as-is — GitPR only redirects bare filenames to `.gitpr/reports/`.
359
+
300
360
  ## 📚 Technical Documentation and Advanced Guides
301
361
 
302
362
  To keep this README concise, we detail the most advanced **DevOps** and **Continuous Integration** focused implementations in separate documents.
@@ -312,12 +372,14 @@ If you want to implement GitPR as an automated quality barrier in your team, che
312
372
  ### DevOps & CI/CD
313
373
 
314
374
  * [**Local Git Hooks (Shift-Left)**](https://github.com/natanfiuza/gitpr/blob/main/docs/git-hooks-locais.md) — How to use `gitpr --installhooks` to create guardrails on the developer's machine and use AI to automatically write commit messages.
375
+ * [**Hook Scripts Versioning & Auto-Sync**](https://github.com/natanfiuza/gitpr/blob/main/docs/hooks-versioning.md) — How the automatic versioning and i18n-aware synchronization system keeps your Git hooks up to date.
315
376
  * [**Customizable Static Linter**](https://github.com/natanfiuza/gitpr/blob/main/docs/linter-regras-customizadas.md) — How to create validation rules in `.gitpr.linter.yml` for CI/CD and pre-commit hooks.
316
377
  * [**CI/CD Integration (GitHub Actions)**](https://github.com/natanfiuza/gitpr/blob/main/docs/github-ci-linter.md) — How to run GitPR in the pipeline to block "Merge" of PRs with violations.
317
378
 
318
379
  ### Core Features
319
380
 
320
381
  * [**Pull Request (Default Mode)**](https://github.com/natanfiuza/gitpr/blob/main/docs/pr-descricao-padrao.md) — Complete flow for generating PR descriptions without flags.
382
+ * [**Pull Request Publisher TUI**](https://github.com/natanfiuza/gitpr/blob/main/docs/pull-request-publication.md) — How to review and publish Pull Requests directly to GitHub from the terminal.
321
383
  * [**AI Code Review**](https://github.com/natanfiuza/gitpr/blob/main/docs/code-review-ia.md) — Guide to review modes (`--review`, `--fullreview`) and file auditing (`--input`).
322
384
  * [**AI Commit Messages**](https://github.com/natanfiuza/gitpr/blob/main/docs/commit-message-ia.md) — How to generate messages in the Conventional Commits standard and integrate with Git Hooks.
323
385
  * [**Issue Generation and TUI Interface**](https://github.com/natanfiuza/gitpr/blob/main/docs/issue-tui-help.md) — How to use the terminal graphical interface (TUI) and the 3 context engines to manage structured Issues.