gitpr-cli 1.0.0__tar.gz → 1.2.0__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.
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/PKG-INFO +25 -37
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/README.md +24 -36
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/gitpr_cli.egg-info/PKG-INFO +25 -37
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/gitpr_cli.egg-info/SOURCES.txt +27 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/cache.py +63 -2
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/config.py +336 -1
- gitpr_cli-1.2.0/src/config_schema.py +1046 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/core.py +133 -53
- gitpr_cli-1.2.0/src/diff_parser.py +321 -0
- gitpr_cli-1.2.0/src/doc_links.py +28 -0
- gitpr_cli-1.2.0/src/fix/__init__.py +16 -0
- gitpr_cli-1.2.0/src/fix/apply_fix.py +479 -0
- gitpr_cli-1.2.0/src/fix/fix_history.py +153 -0
- gitpr_cli-1.2.0/src/fix/patch_applier.py +172 -0
- gitpr_cli-1.2.0/src/fix/patch_extractor.py +61 -0
- gitpr_cli-1.2.0/src/fix/patch_provenance.py +96 -0
- gitpr_cli-1.2.0/src/fix/patch_safety_classifier.py +101 -0
- gitpr_cli-1.2.0/src/fix/rollback_fix.py +69 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/i18n.py +18 -3
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/infrastructure/scm/azure_devops_provider.py +13 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/infrastructure/scm/base.py +29 -1
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/infrastructure/scm/bitbucket_provider.py +9 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/infrastructure/scm/github_provider.py +77 -4
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/infrastructure/scm/gitlab_provider.py +50 -3
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/linter_engine.py +11 -2
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/linter_wizard.py +6 -2
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/main.py +518 -82
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/mcp_server.py +270 -0
- gitpr_cli-1.2.0/src/review/__init__.py +13 -0
- gitpr_cli-1.2.0/src/review/diff_normalizer.py +84 -0
- gitpr_cli-1.2.0/src/review/diff_source.py +69 -0
- gitpr_cli-1.2.0/src/review/remote_pr.py +319 -0
- gitpr_cli-1.2.0/src/review/render.py +75 -0
- gitpr_cli-1.2.0/src/reviewer_resolution.py +159 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/reviewer_suggestion.py +19 -3
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/spinner.py +15 -5
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/suggest_reviewers.py +19 -12
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/ui/chat_app.py +3 -31
- gitpr_cli-1.2.0/src/ui/config_app.py +1835 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/ui/pr_publish_app.py +222 -38
- gitpr_cli-1.2.0/src/updater.py +145 -0
- gitpr_cli-1.2.0/src/usage_log.py +175 -0
- gitpr_cli-1.2.0/tests/test_config_app.py +1647 -0
- gitpr_cli-1.2.0/tests/test_config_cli.py +116 -0
- gitpr_cli-1.2.0/tests/test_config_schema.py +459 -0
- gitpr_cli-1.2.0/tests/test_config_store.py +189 -0
- gitpr_cli-1.2.0/tests/test_config_validation.py +317 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_core.py +138 -0
- gitpr_cli-1.2.0/tests/test_diff_parser.py +359 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_i18n.py +14 -3
- gitpr_cli-1.2.0/tests/test_linter_presets.py +92 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_main_suggest_reviewers.py +40 -4
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_mcp_server.py +244 -4
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_pr_publish_app.py +146 -5
- gitpr_cli-1.2.0/tests/test_reviewer_resolution.py +255 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_reviewer_suggestion.py +23 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_skill_context.py +33 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_smart_excludes.py +37 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_suggest_reviewers.py +32 -1
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_thinking_words.py +31 -0
- gitpr_cli-1.2.0/tests/test_updater.py +231 -0
- gitpr_cli-1.2.0/tests/test_usage_log.py +254 -0
- gitpr_cli-1.0.0/src/diff_parser.py +0 -159
- gitpr_cli-1.0.0/src/updater.py +0 -200
- gitpr_cli-1.0.0/tests/test_diff_parser.py +0 -204
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/LICENSE +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/gitpr_cli.egg-info/dependency_links.txt +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/gitpr_cli.egg-info/entry_points.txt +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/gitpr_cli.egg-info/requires.txt +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/gitpr_cli.egg-info/top_level.txt +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/pyproject.toml +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/setup.cfg +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/__init__.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/ai_providers.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/blame_engine.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/changelog_builder.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/chat_memory.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/commit_classifier.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/github_api.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/infrastructure/__init__.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/infrastructure/scm/__init__.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/infrastructure/scm/factory.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/issue_engine.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/metrics.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/net.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/release_engine.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/security.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/tui_issue.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/ui/__init__.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/ui/help_screen.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/ui/issue_app.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/ui/linter_app.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/ui/metrics_app.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/ui/pr_publish_help.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/src/version_bump.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_blame_engine_ranges.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_blame_metrics.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_changelog_builder.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_chat_backend.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_commit_classifier.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_config_suggest_reviewers.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_external_linters.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_install_wizard.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_issue_engine.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_linter_metrics.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_mcp_prompts.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_mcp_server_e2e.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_metrics.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_net_timeouts.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_plugins.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_pr_publish_linter_modal.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_pre_save.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_release_cli.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_release_engine.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_skill_command.py +0 -0
- {gitpr_cli-1.0.0 → gitpr_cli-1.2.0}/tests/test_version_bump.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitpr-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
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
|
|
@@ -66,27 +66,6 @@ This project was developed in Python and uses the following main libraries:
|
|
|
66
66
|
* [**Requests**](https://pypi.org/project/requests/): Elegant and robust library for HTTP requests, used to communicate with the GitHub REST API.
|
|
67
67
|
* [**MCP**](https://pypi.org/project/mcp/): Official Python SDK for the Model Context Protocol, enabling GitPR to integrate directly with AI-powered editors and IDEs.
|
|
68
68
|
|
|
69
|
-
----
|
|
70
|
-
|
|
71
|
-
## 📦 How to Compile the Executable Locally
|
|
72
|
-
|
|
73
|
-
If you want to generate your own binary from the source code, we use **PyInstaller**. Make sure you are in the project root directory with the virtual environment configured.
|
|
74
|
-
|
|
75
|
-
1. Install development dependencies (if you haven't already):
|
|
76
|
-
```bash
|
|
77
|
-
pipenv install --dev
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
2. Run the build command pointing to our entry point (`run.py`):
|
|
81
|
-
```bash
|
|
82
|
-
pipenv run pyinstaller --noconfirm --onefile --icon=icon.ico --name gitpr run.py
|
|
83
|
-
```
|
|
84
|
-
> **Technical note:** The `--onefile` flag ensures all Python, libraries, and dependencies are compressed into a single binary, while `--paths src` helps the compiler find our `core.py` and `config.py` files. 🛠️
|
|
85
|
-
|
|
86
|
-
After running this command, PyInstaller will create some folders (`build` and `dist`).
|
|
87
|
-
Your final ready-to-use file will be inside the **`dist/`** folder named `gitpr` (or `gitpr.exe` on Windows).
|
|
88
|
-
|
|
89
|
-
|
|
90
69
|
----
|
|
91
70
|
|
|
92
71
|
## 🧪 Running Tests
|
|
@@ -107,11 +86,13 @@ Pytest will automatically detect files inside the `tests/` folder and display a
|
|
|
107
86
|
----
|
|
108
87
|
## **⚙️ Installation and Configuration**
|
|
109
88
|
|
|
110
|
-
### **
|
|
89
|
+
### **Installing from PyPI (Recommended)**
|
|
111
90
|
|
|
112
|
-
1.
|
|
113
|
-
|
|
114
|
-
|
|
91
|
+
1. Install the package with pip:
|
|
92
|
+
```bash
|
|
93
|
+
pip install gitpr-cli
|
|
94
|
+
```
|
|
95
|
+
2. On the first run, the wizard will guide you:
|
|
115
96
|
```bash
|
|
116
97
|
$ gitpr
|
|
117
98
|
```
|
|
@@ -126,6 +107,8 @@ Pytest will automatically detect files inside the `tests/` folder and display a
|
|
|
126
107
|
```
|
|
127
108
|
*Note: Your configuration will be securely saved in the `~/.gitpr/.env` file.*
|
|
128
109
|
|
|
110
|
+
*Note (updates): GitPR is distributed exclusively through PyPI. On every run it checks whether a newer version has been published, and when one exists it **blocks the execution** and asks you to run `pip install --upgrade gitpr-cli`. See [auto-update.md](docs/auto-update.md).*
|
|
111
|
+
|
|
129
112
|
> **🔒 Security Note:** GitPR CLI uses symmetric encryption (Fernet). Your API key is stored as a hash in the `.env` file, and the master key for decryption is automatically generated in `~/.gitpr/secret.key`. **Never share your secret.key file.**
|
|
130
113
|
|
|
131
114
|
### From Source Code
|
|
@@ -165,18 +148,18 @@ You can pass the following *flags* for specific actions:
|
|
|
165
148
|
* `--status`: Lists uncommitted file changes categorized as **new**, **modified**, and **deleted** — fast, no AI, no network. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/git-status.md)
|
|
166
149
|
* `--no-unstaged-check`: Skips the unstaged files verification before AI processing for a single invocation. Equivalent to `GITPR_SKIP_UNSTAGED_CHECK=true` for one run. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/git-status.md)
|
|
167
150
|
* `--linter-setup`: **Interactive external linter wizard.** Guides you through installing and configuring external linters (ESLint, PHPCS, Stylelint) as a Checkstyle XML bridge. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/linter-regras-customizadas.md)
|
|
168
|
-
* `--mcp`: Starts GitPR as an **MCP server** (Model Context Protocol) on stdio transport. Enables integration with VS Code, Cursor, Claude Desktop, and other MCP-compatible editors — exposing all GitPR AI capabilities as
|
|
151
|
+
* `--mcp`: Starts GitPR as an **MCP server** (Model Context Protocol) on stdio transport. Enables integration with VS Code, Cursor, Claude Desktop, and other MCP-compatible editors — exposing all GitPR AI capabilities as 14 annotated tools, 18 resources, and 7 pre-built prompts directly inside your IDE. Also available as the standalone `gitpr-mcp` command.
|
|
169
152
|
* `--plugins`: Lists all **globally installed plugins** — custom linter packs from `~/.gitpr/plugins/linter/` and MCP prompt templates from `~/.gitpr/plugins/prompts/`. These plugins apply across all your projects without duplication. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/plugins-system.md)
|
|
170
153
|
* `--install`: **Interactive Setup Wizard.** Runs a guided 4-step setup: downloads skill templates, installs Git hooks, configures MCP for detected editors, and checks/requests your AI provider API key. Each step asks for confirmation before proceeding.
|
|
171
154
|
* `-ih` or `--installhooks`: Automatically installs **local Git Hooks** (`pre-commit` and `prepare-commit-msg`) in your repository.
|
|
172
|
-
* `-s` or `--skill`: Creates the AI context template files (`.gitpr.commit.md`, `.gitpr.pr.md`, `.gitpr.review.md`, `.gitpr.filereview.md`, `.gitpr.issue.md`, `.gitpr.blame.md`) and the Linter (`.gitpr.linter.yml`)
|
|
155
|
+
* `-s` or `--skill`: Creates the AI context template files (`.gitpr.commit.md`, `.gitpr.pr.md`, `.gitpr.review.md`, `.gitpr.filereview.md`, `.gitpr.issue.md`, `.gitpr.blame.md`) and the Linter (`.gitpr.linter.yml`) inside `.gitpr/skill/`.
|
|
173
156
|
* `-is` or `--issue`: Automatically generates a draft of a **standardized Issue** and opens an interactive interface (TUI) for editing or direct submission via REST API. This feature has **3 context engines** depending on the command combination:
|
|
174
157
|
* **New Code Issue (`gitpr -is`):** Reads the current `git diff`. **Why use:** Ideal for quickly documenting the task you just finished programming, before committing.
|
|
175
158
|
* **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.
|
|
176
159
|
* **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.
|
|
177
160
|
* **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, optional auto-merge, and clear error feedback when merge conflicts occur. Use `--base <branch>` to change the target branch. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/pull-request-publication.md)
|
|
178
161
|
* `-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.
|
|
179
|
-
* `-u` or `--update`: Checks
|
|
162
|
+
* `-u` or `--update`: Checks the latest version of GitPR on PyPI and shows how to update it (Auto-Updater).
|
|
180
163
|
|
|
181
164
|
> **⚙️ Technical Note (--hook):** GitPR has a hidden flag `--hook <file>` that is triggered exclusively by the Git Hooks system in the background. It allows the AI to inject the suggested message directly into Git's temporary file, without cluttering your terminal.
|
|
182
165
|
>
|
|
@@ -246,7 +229,7 @@ You can dynamically switch models by configuring the `GEMINI_API_MODEL_PRIMARY`
|
|
|
246
229
|
|
|
247
230
|
## 🎯 Customizable "Skills" System (Prompt Engineering)
|
|
248
231
|
|
|
249
|
-
Instead of hiding AI instructions in the source code, GitPR uses local Markdown files that act as *System Instructions*. When running `gitpr -s`, the following files are generated
|
|
232
|
+
Instead of hiding AI instructions in the source code, GitPR uses local Markdown files that act as *System Instructions*. When running `gitpr -s`, the following files are generated inside `.gitpr/skill/` to customize the AI's "persona" according to your company's business rules:
|
|
250
233
|
|
|
251
234
|
* `.gitpr.commit.md`: Rules for generating short commit messages.
|
|
252
235
|
* `.gitpr.pr.md`: Required topic structure for the Pull Request description.
|
|
@@ -275,8 +258,8 @@ To force a specific language, set `GITPR_LANG=pt_br` or `GITPR_LANG=en` in `~/.g
|
|
|
275
258
|
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.
|
|
276
259
|
|
|
277
260
|
**How it works:**
|
|
278
|
-
1. Reads `SCRIPTS_VERSION` and `
|
|
279
|
-
2. Compares with the latest version (`__scripts_version__`) shipped with your GitPR release
|
|
261
|
+
1. Reads `SCRIPTS_VERSION` and `SCRIPTS_INSTALLED_LANG` from `~/.gitpr/.env`
|
|
262
|
+
2. Compares with the latest version (`__scripts_version__`) shipped with your GitPR release, and with the language you asked for (`SCRIPTS_LANG`, empty = follow the interface language)
|
|
280
263
|
3. If versions or language differ → automatically downloads and updates hooks
|
|
281
264
|
4. If everything matches → skips entirely (single `.env` read, zero network I/O)
|
|
282
265
|
|
|
@@ -352,6 +335,8 @@ Once configured, use natural language in your editor's AI chat:
|
|
|
352
335
|
| `generate_issue` | Structured issue from diff, history, or blame |
|
|
353
336
|
| `list_unstaged_files` | Uncommitted file changes categorized (new/modified/deleted) |
|
|
354
337
|
| `analyze_unstaged_diff` | Unstaged diff only (working tree vs index) |
|
|
338
|
+
| `list_fix_candidates` | Fix candidates of the last review: patch, classification, id (read-only) |
|
|
339
|
+
| `review_remote_pr` | AI review of a pull request already open on the forge, fetched by number (read-only) |
|
|
355
340
|
|
|
356
341
|
### Direct CLI Invocation
|
|
357
342
|
|
|
@@ -447,18 +432,20 @@ If you want to implement GitPR as an automated quality barrier in your team, che
|
|
|
447
432
|
|
|
448
433
|
* [**Pull Request (Default Mode)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/pr-descricao-padrao.md) — Complete flow for generating PR descriptions without flags.
|
|
449
434
|
* [**Pull Request Publisher TUI**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/pull-request-publication.md) — How to review and publish Pull Requests directly to GitHub from the terminal.
|
|
450
|
-
* [**AI Code Review**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/code-review-ia.md) — Guide to review modes (`--review`, `--fullreview`)
|
|
435
|
+
* [**AI Code Review**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/code-review-ia.md) — Guide to review modes (`--review`, `--fullreview`), file auditing (`--input`) and remote pull request review (`gitpr review-pr`).
|
|
436
|
+
* [**Remote Pull Request Review (gitpr review-pr)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/review-pr.md) — How the `gitpr review-pr` subcommand reviews a pull request that is already open on the forge, fetching its diff from the API without checking out its branch.
|
|
451
437
|
* [**AI Commit Messages**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/commit-message-ia.md) — How to generate messages in the Conventional Commits standard and integrate with Git Hooks.
|
|
452
438
|
* [**Issue Generation and TUI Interface**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/issue-tui-help.md) — How to use the terminal graphical interface (TUI) and the 3 context engines to manage structured Issues.
|
|
453
439
|
* [**Code Archaeologist (Git Blame)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/blame-arqueologo.md) — How to trace the origin of business rules with `git blame` and AI.
|
|
454
440
|
* [**Skills and Templates System**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/skill-template.md) — How to customize AI behavior with `.gitpr.*.md` files.
|
|
455
441
|
* [**Release Notes & Changelog (gitpr release)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/release-notes.md) — How the `gitpr release` subcommand generates the changelog / release notes of a repository, suggests the next semantic version and publishes releases on the forge.
|
|
442
|
+
* [**Fix Command (gitpr fix)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/fix-command.md) — How the `gitpr fix` subcommand turns the findings of the last review into patches you read before they touch your tree, classifies each one by safety, and undoes an applied patch on demand.
|
|
456
443
|
|
|
457
444
|
### Configuration & Infrastructure
|
|
458
445
|
|
|
459
446
|
* [**Install Wizard**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/install-wizard.md) — Step-by-step guided setup for configuring GitPR in a new project.
|
|
460
447
|
* [**AI Providers**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/providers-ia.md) — Configuration and selection between Google Gemini, DeepSeek, and Ollama.
|
|
461
|
-
* [**Auto-Updater**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/auto-update.md) — How GitPR's automatic update
|
|
448
|
+
* [**Auto-Updater**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/auto-update.md) — How GitPR's automatic update and the mandatory update block work.
|
|
462
449
|
* [**Architecture**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/ARCHITECTURE.md) — Project architecture, design patterns, and technical stack overview.
|
|
463
450
|
* [**GitHub Token (PAT) Integration and Security**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/github-pat-integration.md) — Understand how GitPR creates issues directly in the repository with authentication.
|
|
464
451
|
* [**Internationalization (i18n)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/i18n_explanation.md) — Architecture, usage patterns, and how to add new languages.
|
|
@@ -476,9 +463,10 @@ If you run the same command again without changing the code, GitPR intercepts th
|
|
|
476
463
|
|
|
477
464
|
Never worry about manually downloading new versions again. GitPR has a Connection Guardian and a built-in updater:
|
|
478
465
|
* It checks network availability before starting so it doesn't block your offline workflow.
|
|
479
|
-
* On each execution, it
|
|
480
|
-
*
|
|
481
|
-
*
|
|
466
|
+
* On each execution, it checks PyPI for a newer published version (cached for 24 hours).
|
|
467
|
+
* When a newer version exists, it **blocks the execution** and asks you to run `pip install --upgrade gitpr-cli`.
|
|
468
|
+
* You can force the check at any time with `gitpr --update` or `gitpr -u` — it shows the upgrade command without installing anything.
|
|
469
|
+
* Scripts, Git hooks, the MCP server and the contextual help are never blocked.
|
|
482
470
|
|
|
483
471
|
## Publishing to PyPI
|
|
484
472
|
|
|
@@ -47,27 +47,6 @@ This project was developed in Python and uses the following main libraries:
|
|
|
47
47
|
* [**Requests**](https://pypi.org/project/requests/): Elegant and robust library for HTTP requests, used to communicate with the GitHub REST API.
|
|
48
48
|
* [**MCP**](https://pypi.org/project/mcp/): Official Python SDK for the Model Context Protocol, enabling GitPR to integrate directly with AI-powered editors and IDEs.
|
|
49
49
|
|
|
50
|
-
----
|
|
51
|
-
|
|
52
|
-
## 📦 How to Compile the Executable Locally
|
|
53
|
-
|
|
54
|
-
If you want to generate your own binary from the source code, we use **PyInstaller**. Make sure you are in the project root directory with the virtual environment configured.
|
|
55
|
-
|
|
56
|
-
1. Install development dependencies (if you haven't already):
|
|
57
|
-
```bash
|
|
58
|
-
pipenv install --dev
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
2. Run the build command pointing to our entry point (`run.py`):
|
|
62
|
-
```bash
|
|
63
|
-
pipenv run pyinstaller --noconfirm --onefile --icon=icon.ico --name gitpr run.py
|
|
64
|
-
```
|
|
65
|
-
> **Technical note:** The `--onefile` flag ensures all Python, libraries, and dependencies are compressed into a single binary, while `--paths src` helps the compiler find our `core.py` and `config.py` files. 🛠️
|
|
66
|
-
|
|
67
|
-
After running this command, PyInstaller will create some folders (`build` and `dist`).
|
|
68
|
-
Your final ready-to-use file will be inside the **`dist/`** folder named `gitpr` (or `gitpr.exe` on Windows).
|
|
69
|
-
|
|
70
|
-
|
|
71
50
|
----
|
|
72
51
|
|
|
73
52
|
## 🧪 Running Tests
|
|
@@ -88,11 +67,13 @@ Pytest will automatically detect files inside the `tests/` folder and display a
|
|
|
88
67
|
----
|
|
89
68
|
## **⚙️ Installation and Configuration**
|
|
90
69
|
|
|
91
|
-
### **
|
|
70
|
+
### **Installing from PyPI (Recommended)**
|
|
92
71
|
|
|
93
|
-
1.
|
|
94
|
-
|
|
95
|
-
|
|
72
|
+
1. Install the package with pip:
|
|
73
|
+
```bash
|
|
74
|
+
pip install gitpr-cli
|
|
75
|
+
```
|
|
76
|
+
2. On the first run, the wizard will guide you:
|
|
96
77
|
```bash
|
|
97
78
|
$ gitpr
|
|
98
79
|
```
|
|
@@ -107,6 +88,8 @@ Pytest will automatically detect files inside the `tests/` folder and display a
|
|
|
107
88
|
```
|
|
108
89
|
*Note: Your configuration will be securely saved in the `~/.gitpr/.env` file.*
|
|
109
90
|
|
|
91
|
+
*Note (updates): GitPR is distributed exclusively through PyPI. On every run it checks whether a newer version has been published, and when one exists it **blocks the execution** and asks you to run `pip install --upgrade gitpr-cli`. See [auto-update.md](docs/auto-update.md).*
|
|
92
|
+
|
|
110
93
|
> **🔒 Security Note:** GitPR CLI uses symmetric encryption (Fernet). Your API key is stored as a hash in the `.env` file, and the master key for decryption is automatically generated in `~/.gitpr/secret.key`. **Never share your secret.key file.**
|
|
111
94
|
|
|
112
95
|
### From Source Code
|
|
@@ -146,18 +129,18 @@ You can pass the following *flags* for specific actions:
|
|
|
146
129
|
* `--status`: Lists uncommitted file changes categorized as **new**, **modified**, and **deleted** — fast, no AI, no network. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/git-status.md)
|
|
147
130
|
* `--no-unstaged-check`: Skips the unstaged files verification before AI processing for a single invocation. Equivalent to `GITPR_SKIP_UNSTAGED_CHECK=true` for one run. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/git-status.md)
|
|
148
131
|
* `--linter-setup`: **Interactive external linter wizard.** Guides you through installing and configuring external linters (ESLint, PHPCS, Stylelint) as a Checkstyle XML bridge. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/linter-regras-customizadas.md)
|
|
149
|
-
* `--mcp`: Starts GitPR as an **MCP server** (Model Context Protocol) on stdio transport. Enables integration with VS Code, Cursor, Claude Desktop, and other MCP-compatible editors — exposing all GitPR AI capabilities as
|
|
132
|
+
* `--mcp`: Starts GitPR as an **MCP server** (Model Context Protocol) on stdio transport. Enables integration with VS Code, Cursor, Claude Desktop, and other MCP-compatible editors — exposing all GitPR AI capabilities as 14 annotated tools, 18 resources, and 7 pre-built prompts directly inside your IDE. Also available as the standalone `gitpr-mcp` command.
|
|
150
133
|
* `--plugins`: Lists all **globally installed plugins** — custom linter packs from `~/.gitpr/plugins/linter/` and MCP prompt templates from `~/.gitpr/plugins/prompts/`. These plugins apply across all your projects without duplication. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/plugins-system.md)
|
|
151
134
|
* `--install`: **Interactive Setup Wizard.** Runs a guided 4-step setup: downloads skill templates, installs Git hooks, configures MCP for detected editors, and checks/requests your AI provider API key. Each step asks for confirmation before proceeding.
|
|
152
135
|
* `-ih` or `--installhooks`: Automatically installs **local Git Hooks** (`pre-commit` and `prepare-commit-msg`) in your repository.
|
|
153
|
-
* `-s` or `--skill`: Creates the AI context template files (`.gitpr.commit.md`, `.gitpr.pr.md`, `.gitpr.review.md`, `.gitpr.filereview.md`, `.gitpr.issue.md`, `.gitpr.blame.md`) and the Linter (`.gitpr.linter.yml`)
|
|
136
|
+
* `-s` or `--skill`: Creates the AI context template files (`.gitpr.commit.md`, `.gitpr.pr.md`, `.gitpr.review.md`, `.gitpr.filereview.md`, `.gitpr.issue.md`, `.gitpr.blame.md`) and the Linter (`.gitpr.linter.yml`) inside `.gitpr/skill/`.
|
|
154
137
|
* `-is` or `--issue`: Automatically generates a draft of a **standardized Issue** and opens an interactive interface (TUI) for editing or direct submission via REST API. This feature has **3 context engines** depending on the command combination:
|
|
155
138
|
* **New Code Issue (`gitpr -is`):** Reads the current `git diff`. **Why use:** Ideal for quickly documenting the task you just finished programming, before committing.
|
|
156
139
|
* **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.
|
|
157
140
|
* **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.
|
|
158
141
|
* **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, optional auto-merge, and clear error feedback when merge conflicts occur. Use `--base <branch>` to change the target branch. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/pull-request-publication.md)
|
|
159
142
|
* `-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.
|
|
160
|
-
* `-u` or `--update`: Checks
|
|
143
|
+
* `-u` or `--update`: Checks the latest version of GitPR on PyPI and shows how to update it (Auto-Updater).
|
|
161
144
|
|
|
162
145
|
> **⚙️ Technical Note (--hook):** GitPR has a hidden flag `--hook <file>` that is triggered exclusively by the Git Hooks system in the background. It allows the AI to inject the suggested message directly into Git's temporary file, without cluttering your terminal.
|
|
163
146
|
>
|
|
@@ -227,7 +210,7 @@ You can dynamically switch models by configuring the `GEMINI_API_MODEL_PRIMARY`
|
|
|
227
210
|
|
|
228
211
|
## 🎯 Customizable "Skills" System (Prompt Engineering)
|
|
229
212
|
|
|
230
|
-
Instead of hiding AI instructions in the source code, GitPR uses local Markdown files that act as *System Instructions*. When running `gitpr -s`, the following files are generated
|
|
213
|
+
Instead of hiding AI instructions in the source code, GitPR uses local Markdown files that act as *System Instructions*. When running `gitpr -s`, the following files are generated inside `.gitpr/skill/` to customize the AI's "persona" according to your company's business rules:
|
|
231
214
|
|
|
232
215
|
* `.gitpr.commit.md`: Rules for generating short commit messages.
|
|
233
216
|
* `.gitpr.pr.md`: Required topic structure for the Pull Request description.
|
|
@@ -256,8 +239,8 @@ To force a specific language, set `GITPR_LANG=pt_br` or `GITPR_LANG=en` in `~/.g
|
|
|
256
239
|
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.
|
|
257
240
|
|
|
258
241
|
**How it works:**
|
|
259
|
-
1. Reads `SCRIPTS_VERSION` and `
|
|
260
|
-
2. Compares with the latest version (`__scripts_version__`) shipped with your GitPR release
|
|
242
|
+
1. Reads `SCRIPTS_VERSION` and `SCRIPTS_INSTALLED_LANG` from `~/.gitpr/.env`
|
|
243
|
+
2. Compares with the latest version (`__scripts_version__`) shipped with your GitPR release, and with the language you asked for (`SCRIPTS_LANG`, empty = follow the interface language)
|
|
261
244
|
3. If versions or language differ → automatically downloads and updates hooks
|
|
262
245
|
4. If everything matches → skips entirely (single `.env` read, zero network I/O)
|
|
263
246
|
|
|
@@ -333,6 +316,8 @@ Once configured, use natural language in your editor's AI chat:
|
|
|
333
316
|
| `generate_issue` | Structured issue from diff, history, or blame |
|
|
334
317
|
| `list_unstaged_files` | Uncommitted file changes categorized (new/modified/deleted) |
|
|
335
318
|
| `analyze_unstaged_diff` | Unstaged diff only (working tree vs index) |
|
|
319
|
+
| `list_fix_candidates` | Fix candidates of the last review: patch, classification, id (read-only) |
|
|
320
|
+
| `review_remote_pr` | AI review of a pull request already open on the forge, fetched by number (read-only) |
|
|
336
321
|
|
|
337
322
|
### Direct CLI Invocation
|
|
338
323
|
|
|
@@ -428,18 +413,20 @@ If you want to implement GitPR as an automated quality barrier in your team, che
|
|
|
428
413
|
|
|
429
414
|
* [**Pull Request (Default Mode)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/pr-descricao-padrao.md) — Complete flow for generating PR descriptions without flags.
|
|
430
415
|
* [**Pull Request Publisher TUI**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/pull-request-publication.md) — How to review and publish Pull Requests directly to GitHub from the terminal.
|
|
431
|
-
* [**AI Code Review**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/code-review-ia.md) — Guide to review modes (`--review`, `--fullreview`)
|
|
416
|
+
* [**AI Code Review**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/code-review-ia.md) — Guide to review modes (`--review`, `--fullreview`), file auditing (`--input`) and remote pull request review (`gitpr review-pr`).
|
|
417
|
+
* [**Remote Pull Request Review (gitpr review-pr)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/review-pr.md) — How the `gitpr review-pr` subcommand reviews a pull request that is already open on the forge, fetching its diff from the API without checking out its branch.
|
|
432
418
|
* [**AI Commit Messages**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/commit-message-ia.md) — How to generate messages in the Conventional Commits standard and integrate with Git Hooks.
|
|
433
419
|
* [**Issue Generation and TUI Interface**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/issue-tui-help.md) — How to use the terminal graphical interface (TUI) and the 3 context engines to manage structured Issues.
|
|
434
420
|
* [**Code Archaeologist (Git Blame)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/blame-arqueologo.md) — How to trace the origin of business rules with `git blame` and AI.
|
|
435
421
|
* [**Skills and Templates System**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/skill-template.md) — How to customize AI behavior with `.gitpr.*.md` files.
|
|
436
422
|
* [**Release Notes & Changelog (gitpr release)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/release-notes.md) — How the `gitpr release` subcommand generates the changelog / release notes of a repository, suggests the next semantic version and publishes releases on the forge.
|
|
423
|
+
* [**Fix Command (gitpr fix)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/fix-command.md) — How the `gitpr fix` subcommand turns the findings of the last review into patches you read before they touch your tree, classifies each one by safety, and undoes an applied patch on demand.
|
|
437
424
|
|
|
438
425
|
### Configuration & Infrastructure
|
|
439
426
|
|
|
440
427
|
* [**Install Wizard**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/install-wizard.md) — Step-by-step guided setup for configuring GitPR in a new project.
|
|
441
428
|
* [**AI Providers**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/providers-ia.md) — Configuration and selection between Google Gemini, DeepSeek, and Ollama.
|
|
442
|
-
* [**Auto-Updater**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/auto-update.md) — How GitPR's automatic update
|
|
429
|
+
* [**Auto-Updater**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/auto-update.md) — How GitPR's automatic update and the mandatory update block work.
|
|
443
430
|
* [**Architecture**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/ARCHITECTURE.md) — Project architecture, design patterns, and technical stack overview.
|
|
444
431
|
* [**GitHub Token (PAT) Integration and Security**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/github-pat-integration.md) — Understand how GitPR creates issues directly in the repository with authentication.
|
|
445
432
|
* [**Internationalization (i18n)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/i18n_explanation.md) — Architecture, usage patterns, and how to add new languages.
|
|
@@ -457,9 +444,10 @@ If you run the same command again without changing the code, GitPR intercepts th
|
|
|
457
444
|
|
|
458
445
|
Never worry about manually downloading new versions again. GitPR has a Connection Guardian and a built-in updater:
|
|
459
446
|
* It checks network availability before starting so it doesn't block your offline workflow.
|
|
460
|
-
* On each execution, it
|
|
461
|
-
*
|
|
462
|
-
*
|
|
447
|
+
* On each execution, it checks PyPI for a newer published version (cached for 24 hours).
|
|
448
|
+
* When a newer version exists, it **blocks the execution** and asks you to run `pip install --upgrade gitpr-cli`.
|
|
449
|
+
* You can force the check at any time with `gitpr --update` or `gitpr -u` — it shows the upgrade command without installing anything.
|
|
450
|
+
* Scripts, Git hooks, the MCP server and the contextual help are never blocked.
|
|
463
451
|
|
|
464
452
|
## Publishing to PyPI
|
|
465
453
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitpr-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
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
|
|
@@ -66,27 +66,6 @@ This project was developed in Python and uses the following main libraries:
|
|
|
66
66
|
* [**Requests**](https://pypi.org/project/requests/): Elegant and robust library for HTTP requests, used to communicate with the GitHub REST API.
|
|
67
67
|
* [**MCP**](https://pypi.org/project/mcp/): Official Python SDK for the Model Context Protocol, enabling GitPR to integrate directly with AI-powered editors and IDEs.
|
|
68
68
|
|
|
69
|
-
----
|
|
70
|
-
|
|
71
|
-
## 📦 How to Compile the Executable Locally
|
|
72
|
-
|
|
73
|
-
If you want to generate your own binary from the source code, we use **PyInstaller**. Make sure you are in the project root directory with the virtual environment configured.
|
|
74
|
-
|
|
75
|
-
1. Install development dependencies (if you haven't already):
|
|
76
|
-
```bash
|
|
77
|
-
pipenv install --dev
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
2. Run the build command pointing to our entry point (`run.py`):
|
|
81
|
-
```bash
|
|
82
|
-
pipenv run pyinstaller --noconfirm --onefile --icon=icon.ico --name gitpr run.py
|
|
83
|
-
```
|
|
84
|
-
> **Technical note:** The `--onefile` flag ensures all Python, libraries, and dependencies are compressed into a single binary, while `--paths src` helps the compiler find our `core.py` and `config.py` files. 🛠️
|
|
85
|
-
|
|
86
|
-
After running this command, PyInstaller will create some folders (`build` and `dist`).
|
|
87
|
-
Your final ready-to-use file will be inside the **`dist/`** folder named `gitpr` (or `gitpr.exe` on Windows).
|
|
88
|
-
|
|
89
|
-
|
|
90
69
|
----
|
|
91
70
|
|
|
92
71
|
## 🧪 Running Tests
|
|
@@ -107,11 +86,13 @@ Pytest will automatically detect files inside the `tests/` folder and display a
|
|
|
107
86
|
----
|
|
108
87
|
## **⚙️ Installation and Configuration**
|
|
109
88
|
|
|
110
|
-
### **
|
|
89
|
+
### **Installing from PyPI (Recommended)**
|
|
111
90
|
|
|
112
|
-
1.
|
|
113
|
-
|
|
114
|
-
|
|
91
|
+
1. Install the package with pip:
|
|
92
|
+
```bash
|
|
93
|
+
pip install gitpr-cli
|
|
94
|
+
```
|
|
95
|
+
2. On the first run, the wizard will guide you:
|
|
115
96
|
```bash
|
|
116
97
|
$ gitpr
|
|
117
98
|
```
|
|
@@ -126,6 +107,8 @@ Pytest will automatically detect files inside the `tests/` folder and display a
|
|
|
126
107
|
```
|
|
127
108
|
*Note: Your configuration will be securely saved in the `~/.gitpr/.env` file.*
|
|
128
109
|
|
|
110
|
+
*Note (updates): GitPR is distributed exclusively through PyPI. On every run it checks whether a newer version has been published, and when one exists it **blocks the execution** and asks you to run `pip install --upgrade gitpr-cli`. See [auto-update.md](docs/auto-update.md).*
|
|
111
|
+
|
|
129
112
|
> **🔒 Security Note:** GitPR CLI uses symmetric encryption (Fernet). Your API key is stored as a hash in the `.env` file, and the master key for decryption is automatically generated in `~/.gitpr/secret.key`. **Never share your secret.key file.**
|
|
130
113
|
|
|
131
114
|
### From Source Code
|
|
@@ -165,18 +148,18 @@ You can pass the following *flags* for specific actions:
|
|
|
165
148
|
* `--status`: Lists uncommitted file changes categorized as **new**, **modified**, and **deleted** — fast, no AI, no network. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/git-status.md)
|
|
166
149
|
* `--no-unstaged-check`: Skips the unstaged files verification before AI processing for a single invocation. Equivalent to `GITPR_SKIP_UNSTAGED_CHECK=true` for one run. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/git-status.md)
|
|
167
150
|
* `--linter-setup`: **Interactive external linter wizard.** Guides you through installing and configuring external linters (ESLint, PHPCS, Stylelint) as a Checkstyle XML bridge. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/linter-regras-customizadas.md)
|
|
168
|
-
* `--mcp`: Starts GitPR as an **MCP server** (Model Context Protocol) on stdio transport. Enables integration with VS Code, Cursor, Claude Desktop, and other MCP-compatible editors — exposing all GitPR AI capabilities as
|
|
151
|
+
* `--mcp`: Starts GitPR as an **MCP server** (Model Context Protocol) on stdio transport. Enables integration with VS Code, Cursor, Claude Desktop, and other MCP-compatible editors — exposing all GitPR AI capabilities as 14 annotated tools, 18 resources, and 7 pre-built prompts directly inside your IDE. Also available as the standalone `gitpr-mcp` command.
|
|
169
152
|
* `--plugins`: Lists all **globally installed plugins** — custom linter packs from `~/.gitpr/plugins/linter/` and MCP prompt templates from `~/.gitpr/plugins/prompts/`. These plugins apply across all your projects without duplication. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/plugins-system.md)
|
|
170
153
|
* `--install`: **Interactive Setup Wizard.** Runs a guided 4-step setup: downloads skill templates, installs Git hooks, configures MCP for detected editors, and checks/requests your AI provider API key. Each step asks for confirmation before proceeding.
|
|
171
154
|
* `-ih` or `--installhooks`: Automatically installs **local Git Hooks** (`pre-commit` and `prepare-commit-msg`) in your repository.
|
|
172
|
-
* `-s` or `--skill`: Creates the AI context template files (`.gitpr.commit.md`, `.gitpr.pr.md`, `.gitpr.review.md`, `.gitpr.filereview.md`, `.gitpr.issue.md`, `.gitpr.blame.md`) and the Linter (`.gitpr.linter.yml`)
|
|
155
|
+
* `-s` or `--skill`: Creates the AI context template files (`.gitpr.commit.md`, `.gitpr.pr.md`, `.gitpr.review.md`, `.gitpr.filereview.md`, `.gitpr.issue.md`, `.gitpr.blame.md`) and the Linter (`.gitpr.linter.yml`) inside `.gitpr/skill/`.
|
|
173
156
|
* `-is` or `--issue`: Automatically generates a draft of a **standardized Issue** and opens an interactive interface (TUI) for editing or direct submission via REST API. This feature has **3 context engines** depending on the command combination:
|
|
174
157
|
* **New Code Issue (`gitpr -is`):** Reads the current `git diff`. **Why use:** Ideal for quickly documenting the task you just finished programming, before committing.
|
|
175
158
|
* **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.
|
|
176
159
|
* **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.
|
|
177
160
|
* **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, optional auto-merge, and clear error feedback when merge conflicts occur. Use `--base <branch>` to change the target branch. 📖 [Full docs](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/pull-request-publication.md)
|
|
178
161
|
* `-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.
|
|
179
|
-
* `-u` or `--update`: Checks
|
|
162
|
+
* `-u` or `--update`: Checks the latest version of GitPR on PyPI and shows how to update it (Auto-Updater).
|
|
180
163
|
|
|
181
164
|
> **⚙️ Technical Note (--hook):** GitPR has a hidden flag `--hook <file>` that is triggered exclusively by the Git Hooks system in the background. It allows the AI to inject the suggested message directly into Git's temporary file, without cluttering your terminal.
|
|
182
165
|
>
|
|
@@ -246,7 +229,7 @@ You can dynamically switch models by configuring the `GEMINI_API_MODEL_PRIMARY`
|
|
|
246
229
|
|
|
247
230
|
## 🎯 Customizable "Skills" System (Prompt Engineering)
|
|
248
231
|
|
|
249
|
-
Instead of hiding AI instructions in the source code, GitPR uses local Markdown files that act as *System Instructions*. When running `gitpr -s`, the following files are generated
|
|
232
|
+
Instead of hiding AI instructions in the source code, GitPR uses local Markdown files that act as *System Instructions*. When running `gitpr -s`, the following files are generated inside `.gitpr/skill/` to customize the AI's "persona" according to your company's business rules:
|
|
250
233
|
|
|
251
234
|
* `.gitpr.commit.md`: Rules for generating short commit messages.
|
|
252
235
|
* `.gitpr.pr.md`: Required topic structure for the Pull Request description.
|
|
@@ -275,8 +258,8 @@ To force a specific language, set `GITPR_LANG=pt_br` or `GITPR_LANG=en` in `~/.g
|
|
|
275
258
|
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.
|
|
276
259
|
|
|
277
260
|
**How it works:**
|
|
278
|
-
1. Reads `SCRIPTS_VERSION` and `
|
|
279
|
-
2. Compares with the latest version (`__scripts_version__`) shipped with your GitPR release
|
|
261
|
+
1. Reads `SCRIPTS_VERSION` and `SCRIPTS_INSTALLED_LANG` from `~/.gitpr/.env`
|
|
262
|
+
2. Compares with the latest version (`__scripts_version__`) shipped with your GitPR release, and with the language you asked for (`SCRIPTS_LANG`, empty = follow the interface language)
|
|
280
263
|
3. If versions or language differ → automatically downloads and updates hooks
|
|
281
264
|
4. If everything matches → skips entirely (single `.env` read, zero network I/O)
|
|
282
265
|
|
|
@@ -352,6 +335,8 @@ Once configured, use natural language in your editor's AI chat:
|
|
|
352
335
|
| `generate_issue` | Structured issue from diff, history, or blame |
|
|
353
336
|
| `list_unstaged_files` | Uncommitted file changes categorized (new/modified/deleted) |
|
|
354
337
|
| `analyze_unstaged_diff` | Unstaged diff only (working tree vs index) |
|
|
338
|
+
| `list_fix_candidates` | Fix candidates of the last review: patch, classification, id (read-only) |
|
|
339
|
+
| `review_remote_pr` | AI review of a pull request already open on the forge, fetched by number (read-only) |
|
|
355
340
|
|
|
356
341
|
### Direct CLI Invocation
|
|
357
342
|
|
|
@@ -447,18 +432,20 @@ If you want to implement GitPR as an automated quality barrier in your team, che
|
|
|
447
432
|
|
|
448
433
|
* [**Pull Request (Default Mode)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/pr-descricao-padrao.md) — Complete flow for generating PR descriptions without flags.
|
|
449
434
|
* [**Pull Request Publisher TUI**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/pull-request-publication.md) — How to review and publish Pull Requests directly to GitHub from the terminal.
|
|
450
|
-
* [**AI Code Review**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/code-review-ia.md) — Guide to review modes (`--review`, `--fullreview`)
|
|
435
|
+
* [**AI Code Review**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/code-review-ia.md) — Guide to review modes (`--review`, `--fullreview`), file auditing (`--input`) and remote pull request review (`gitpr review-pr`).
|
|
436
|
+
* [**Remote Pull Request Review (gitpr review-pr)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/review-pr.md) — How the `gitpr review-pr` subcommand reviews a pull request that is already open on the forge, fetching its diff from the API without checking out its branch.
|
|
451
437
|
* [**AI Commit Messages**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/commit-message-ia.md) — How to generate messages in the Conventional Commits standard and integrate with Git Hooks.
|
|
452
438
|
* [**Issue Generation and TUI Interface**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/issue-tui-help.md) — How to use the terminal graphical interface (TUI) and the 3 context engines to manage structured Issues.
|
|
453
439
|
* [**Code Archaeologist (Git Blame)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/blame-arqueologo.md) — How to trace the origin of business rules with `git blame` and AI.
|
|
454
440
|
* [**Skills and Templates System**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/skill-template.md) — How to customize AI behavior with `.gitpr.*.md` files.
|
|
455
441
|
* [**Release Notes & Changelog (gitpr release)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/release-notes.md) — How the `gitpr release` subcommand generates the changelog / release notes of a repository, suggests the next semantic version and publishes releases on the forge.
|
|
442
|
+
* [**Fix Command (gitpr fix)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/fix-command.md) — How the `gitpr fix` subcommand turns the findings of the last review into patches you read before they touch your tree, classifies each one by safety, and undoes an applied patch on demand.
|
|
456
443
|
|
|
457
444
|
### Configuration & Infrastructure
|
|
458
445
|
|
|
459
446
|
* [**Install Wizard**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/install-wizard.md) — Step-by-step guided setup for configuring GitPR in a new project.
|
|
460
447
|
* [**AI Providers**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/providers-ia.md) — Configuration and selection between Google Gemini, DeepSeek, and Ollama.
|
|
461
|
-
* [**Auto-Updater**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/auto-update.md) — How GitPR's automatic update
|
|
448
|
+
* [**Auto-Updater**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/auto-update.md) — How GitPR's automatic update and the mandatory update block work.
|
|
462
449
|
* [**Architecture**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/ARCHITECTURE.md) — Project architecture, design patterns, and technical stack overview.
|
|
463
450
|
* [**GitHub Token (PAT) Integration and Security**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/github-pat-integration.md) — Understand how GitPR creates issues directly in the repository with authentication.
|
|
464
451
|
* [**Internationalization (i18n)**](https://github.com/gitpr-cli/gitpr.git/blob/main/docs/i18n_explanation.md) — Architecture, usage patterns, and how to add new languages.
|
|
@@ -476,9 +463,10 @@ If you run the same command again without changing the code, GitPR intercepts th
|
|
|
476
463
|
|
|
477
464
|
Never worry about manually downloading new versions again. GitPR has a Connection Guardian and a built-in updater:
|
|
478
465
|
* It checks network availability before starting so it doesn't block your offline workflow.
|
|
479
|
-
* On each execution, it
|
|
480
|
-
*
|
|
481
|
-
*
|
|
466
|
+
* On each execution, it checks PyPI for a newer published version (cached for 24 hours).
|
|
467
|
+
* When a newer version exists, it **blocks the execution** and asks you to run `pip install --upgrade gitpr-cli`.
|
|
468
|
+
* You can force the check at any time with `gitpr --update` or `gitpr -u` — it shows the upgrade command without installing anything.
|
|
469
|
+
* Scripts, Git hooks, the MCP server and the contextual help are never blocked.
|
|
482
470
|
|
|
483
471
|
## Publishing to PyPI
|
|
484
472
|
|
|
@@ -15,8 +15,10 @@ src/changelog_builder.py
|
|
|
15
15
|
src/chat_memory.py
|
|
16
16
|
src/commit_classifier.py
|
|
17
17
|
src/config.py
|
|
18
|
+
src/config_schema.py
|
|
18
19
|
src/core.py
|
|
19
20
|
src/diff_parser.py
|
|
21
|
+
src/doc_links.py
|
|
20
22
|
src/github_api.py
|
|
21
23
|
src/i18n.py
|
|
22
24
|
src/issue_engine.py
|
|
@@ -27,13 +29,23 @@ src/mcp_server.py
|
|
|
27
29
|
src/metrics.py
|
|
28
30
|
src/net.py
|
|
29
31
|
src/release_engine.py
|
|
32
|
+
src/reviewer_resolution.py
|
|
30
33
|
src/reviewer_suggestion.py
|
|
31
34
|
src/security.py
|
|
32
35
|
src/spinner.py
|
|
33
36
|
src/suggest_reviewers.py
|
|
34
37
|
src/tui_issue.py
|
|
35
38
|
src/updater.py
|
|
39
|
+
src/usage_log.py
|
|
36
40
|
src/version_bump.py
|
|
41
|
+
src/fix/__init__.py
|
|
42
|
+
src/fix/apply_fix.py
|
|
43
|
+
src/fix/fix_history.py
|
|
44
|
+
src/fix/patch_applier.py
|
|
45
|
+
src/fix/patch_extractor.py
|
|
46
|
+
src/fix/patch_provenance.py
|
|
47
|
+
src/fix/patch_safety_classifier.py
|
|
48
|
+
src/fix/rollback_fix.py
|
|
37
49
|
src/infrastructure/__init__.py
|
|
38
50
|
src/infrastructure/scm/__init__.py
|
|
39
51
|
src/infrastructure/scm/azure_devops_provider.py
|
|
@@ -42,8 +54,14 @@ src/infrastructure/scm/bitbucket_provider.py
|
|
|
42
54
|
src/infrastructure/scm/factory.py
|
|
43
55
|
src/infrastructure/scm/github_provider.py
|
|
44
56
|
src/infrastructure/scm/gitlab_provider.py
|
|
57
|
+
src/review/__init__.py
|
|
58
|
+
src/review/diff_normalizer.py
|
|
59
|
+
src/review/diff_source.py
|
|
60
|
+
src/review/remote_pr.py
|
|
61
|
+
src/review/render.py
|
|
45
62
|
src/ui/__init__.py
|
|
46
63
|
src/ui/chat_app.py
|
|
64
|
+
src/ui/config_app.py
|
|
47
65
|
src/ui/help_screen.py
|
|
48
66
|
src/ui/issue_app.py
|
|
49
67
|
src/ui/linter_app.py
|
|
@@ -55,7 +73,12 @@ tests/test_blame_metrics.py
|
|
|
55
73
|
tests/test_changelog_builder.py
|
|
56
74
|
tests/test_chat_backend.py
|
|
57
75
|
tests/test_commit_classifier.py
|
|
76
|
+
tests/test_config_app.py
|
|
77
|
+
tests/test_config_cli.py
|
|
78
|
+
tests/test_config_schema.py
|
|
79
|
+
tests/test_config_store.py
|
|
58
80
|
tests/test_config_suggest_reviewers.py
|
|
81
|
+
tests/test_config_validation.py
|
|
59
82
|
tests/test_core.py
|
|
60
83
|
tests/test_diff_parser.py
|
|
61
84
|
tests/test_external_linters.py
|
|
@@ -63,6 +86,7 @@ tests/test_i18n.py
|
|
|
63
86
|
tests/test_install_wizard.py
|
|
64
87
|
tests/test_issue_engine.py
|
|
65
88
|
tests/test_linter_metrics.py
|
|
89
|
+
tests/test_linter_presets.py
|
|
66
90
|
tests/test_main_suggest_reviewers.py
|
|
67
91
|
tests/test_mcp_prompts.py
|
|
68
92
|
tests/test_mcp_server.py
|
|
@@ -75,10 +99,13 @@ tests/test_pr_publish_linter_modal.py
|
|
|
75
99
|
tests/test_pre_save.py
|
|
76
100
|
tests/test_release_cli.py
|
|
77
101
|
tests/test_release_engine.py
|
|
102
|
+
tests/test_reviewer_resolution.py
|
|
78
103
|
tests/test_reviewer_suggestion.py
|
|
79
104
|
tests/test_skill_command.py
|
|
80
105
|
tests/test_skill_context.py
|
|
81
106
|
tests/test_smart_excludes.py
|
|
82
107
|
tests/test_suggest_reviewers.py
|
|
83
108
|
tests/test_thinking_words.py
|
|
109
|
+
tests/test_updater.py
|
|
110
|
+
tests/test_usage_log.py
|
|
84
111
|
tests/test_version_bump.py
|