pr-generator-agent 1.0.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.
Files changed (30) hide show
  1. pr_generator_agent-1.0.0/.flake8 +9 -0
  2. pr_generator_agent-1.0.0/.github/commit-convention.md +5 -0
  3. pr_generator_agent-1.0.0/.github/dependabot.yml +24 -0
  4. pr_generator_agent-1.0.0/.github/workflows/release.yml +62 -0
  5. pr_generator_agent-1.0.0/.github/workflows/test.yml +87 -0
  6. pr_generator_agent-1.0.0/.gitignore +59 -0
  7. pr_generator_agent-1.0.0/.python-version +1 -0
  8. pr_generator_agent-1.0.0/.release-please-config.json +18 -0
  9. pr_generator_agent-1.0.0/.release-please-manifest.json +3 -0
  10. pr_generator_agent-1.0.0/CHANGELOG.md +67 -0
  11. pr_generator_agent-1.0.0/CONTRIBUTING.md +159 -0
  12. pr_generator_agent-1.0.0/LICENSE +21 -0
  13. pr_generator_agent-1.0.0/Makefile +85 -0
  14. pr_generator_agent-1.0.0/PKG-INFO +152 -0
  15. pr_generator_agent-1.0.0/README.md +131 -0
  16. pr_generator_agent-1.0.0/aipr/__init__.py +18 -0
  17. pr_generator_agent-1.0.0/aipr/main.py +634 -0
  18. pr_generator_agent-1.0.0/aipr/prompts/__init__.py +5 -0
  19. pr_generator_agent-1.0.0/aipr/prompts/meta.xml +49 -0
  20. pr_generator_agent-1.0.0/aipr/prompts/prompts.py +189 -0
  21. pr_generator_agent-1.0.0/aipr/providers.py +197 -0
  22. pr_generator_agent-1.0.0/docs/custom_prompts.md +102 -0
  23. pr_generator_agent-1.0.0/docs/custom_prompts_prd.md +111 -0
  24. pr_generator_agent-1.0.0/docs/yoda_prompt.xml +81 -0
  25. pr_generator_agent-1.0.0/pyproject.toml +63 -0
  26. pr_generator_agent-1.0.0/tests/__init__.py +3 -0
  27. pr_generator_agent-1.0.0/tests/conftest.py +51 -0
  28. pr_generator_agent-1.0.0/tests/test_main.py +895 -0
  29. pr_generator_agent-1.0.0/tests/test_prompts.py +126 -0
  30. pr_generator_agent-1.0.0/uv.lock +1460 -0
@@ -0,0 +1,9 @@
1
+ [flake8]
2
+ max-line-length = 100
3
+ # Ignore whitespace before ':' (conflicts with Black)
4
+ extend-ignore = E203
5
+
6
+ # Ignore specific errors in specific files
7
+ per-file-ignores =
8
+ __init__.py: F401
9
+ tests/*: F401,F841
@@ -0,0 +1,5 @@
1
+ # Commit Convention
2
+
3
+ This project follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
4
+
5
+ ## Format
@@ -0,0 +1,24 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "pip" # For Python packages
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "weekly"
12
+ open-pull-requests-limit: 10
13
+ labels:
14
+ - "dependencies"
15
+ - "python"
16
+
17
+ - package-ecosystem: "github-actions" # For GitHub Actions
18
+ directory: "/"
19
+ schedule:
20
+ interval: "weekly"
21
+ open-pull-requests-limit: 10
22
+ labels:
23
+ - "dependencies"
24
+ - "github-actions"
@@ -0,0 +1,62 @@
1
+ name: Release Management
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ workflow_dispatch:
7
+ inputs:
8
+ publish_to_pypi:
9
+ description: "Publish current release to PyPI"
10
+ required: true
11
+ type: boolean
12
+ default: false
13
+
14
+ permissions:
15
+ contents: write
16
+ pull-requests: write
17
+ id-token: write
18
+ security-events: write
19
+
20
+ jobs:
21
+ release-please:
22
+ runs-on: ubuntu-latest
23
+ if: github.event_name == 'push'
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ with:
27
+ fetch-depth: 0
28
+ - uses: googleapis/release-please-action@v4
29
+ with:
30
+ release-type: python
31
+ package-name: pr-generator-agent
32
+ path: .
33
+ config-file: .release-please-config.json
34
+ token: ${{ secrets.GITHUB_TOKEN }}
35
+
36
+ publish:
37
+ runs-on: ubuntu-latest
38
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to_pypi == 'true'
39
+ steps:
40
+ - uses: actions/checkout@v4
41
+ with:
42
+ fetch-depth: 0
43
+ - name: Set up Python
44
+ uses: actions/setup-python@v5
45
+ with:
46
+ python-version: "3.10"
47
+ - name: Install dependencies
48
+ run: |
49
+ python -m pip install --upgrade pip
50
+ pip install build twine
51
+ - name: Build package
52
+ run: python -m build
53
+ - name: Check PyPI token
54
+ run: |
55
+ if [ -z "${{ secrets.PYPI_API_TOKEN }}" ]; then
56
+ echo "Error: PYPI_API_TOKEN secret is not set"
57
+ exit 1
58
+ fi
59
+ - name: Publish to PyPI
60
+ uses: pypa/gh-action-pypi-publish@release/v1
61
+ with:
62
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,87 @@
1
+ name: Python Tests & Lint
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ push:
8
+ branches-ignore:
9
+ - main # Exclude main as it's handled by release workflow
10
+ - 'dependabot/**' # Exclude dependabot branches
11
+ paths-ignore:
12
+ - '**.md'
13
+ - 'docs/**'
14
+ - '.gitignore'
15
+ - 'LICENSE'
16
+
17
+ # Minimal permissions required for running tests and linting
18
+ permissions:
19
+ contents: read # Needed to checkout code
20
+ checks: write # Needed for test reporting
21
+
22
+ jobs:
23
+ lint:
24
+ name: Code Quality Checks
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v4
28
+
29
+ - name: Set up Python
30
+ uses: actions/setup-python@v5
31
+ with:
32
+ python-version: '3.11' # Use latest stable Python for linting
33
+
34
+ - name: Cache Python dependencies
35
+ uses: actions/cache@v4
36
+ with:
37
+ path: ~/.cache/pip
38
+ key: ${{ runner.os }}-pip-lint-${{ hashFiles('pyproject.toml') }}
39
+ restore-keys: |
40
+ ${{ runner.os }}-pip-lint-
41
+
42
+ - name: Install dependencies
43
+ run: |
44
+ python -m pip install --upgrade pip
45
+ pip install -e ".[dev]"
46
+
47
+ - name: Run linters
48
+ run: |
49
+ black --check aipr/ tests/
50
+ isort --check aipr/ tests/
51
+ flake8 aipr/ tests/
52
+
53
+ test:
54
+ name: Python Tests
55
+ needs: lint # Only run tests if linting passes
56
+ runs-on: ubuntu-latest
57
+ strategy:
58
+ fail-fast: true
59
+ matrix:
60
+ # We support the latest two stable Python versions plus beta
61
+ python-version: ['3.10', '3.11'] # Removed 3.13 as it's still in beta
62
+
63
+ steps:
64
+ - uses: actions/checkout@v4
65
+
66
+ - name: Set up Python ${{ matrix.python-version }}
67
+ uses: actions/setup-python@v5
68
+ with:
69
+ python-version: ${{ matrix.python-version }}
70
+ check-latest: true
71
+
72
+ - name: Cache Python dependencies
73
+ uses: actions/cache@v4
74
+ with:
75
+ path: ~/.cache/pip
76
+ key: ${{ runner.os }}-pip-test-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
77
+ restore-keys: |
78
+ ${{ runner.os }}-pip-test-${{ matrix.python-version }}-
79
+
80
+ - name: Install dependencies
81
+ run: |
82
+ python -m pip install --upgrade pip
83
+ pip install -e ".[dev]"
84
+
85
+ - name: Run tests
86
+ run: |
87
+ pytest --cov=aipr --cov-report=term-missing
@@ -0,0 +1,59 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual Environment
24
+ .env
25
+ .venv
26
+ env/
27
+ venv/
28
+ ENV/
29
+
30
+ # IDE
31
+ .idea/
32
+ .vscode/
33
+ *.swp
34
+ *.swo
35
+ .DS_Store
36
+
37
+ # Testing
38
+ .tox/
39
+ .coverage
40
+ .coverage.*
41
+ .cache
42
+ nosetests.xml
43
+ coverage.xml
44
+ *.cover
45
+ .hypothesis/
46
+ .pytest_cache/
47
+ htmlcov/
48
+
49
+ # mypy
50
+ .mypy_cache/
51
+ .dmypy.json
52
+ dmypy.json
53
+
54
+ # Jupyter Notebook
55
+ .ipynb_checkpoints
56
+
57
+ # Local development
58
+ *.log
59
+ local_settings.py
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3
+ "release-type": "python",
4
+ "package-name": "pr-generator-agent",
5
+ "changelog-sections": [
6
+ {"type": "feat", "section": "Features", "hidden": false},
7
+ {"type": "fix", "section": "Bug Fixes", "hidden": false},
8
+ {"type": "perf", "section": "Performance Improvements", "hidden": false},
9
+ {"type": "revert", "section": "Reverts", "hidden": false},
10
+ {"type": "docs", "section": "Documentation", "hidden": false},
11
+ {"type": "style", "section": "Styles", "hidden": true},
12
+ {"type": "chore", "section": "Miscellaneous Chores", "hidden": true},
13
+ {"type": "refactor", "section": "Code Refactoring", "hidden": false},
14
+ {"type": "test", "section": "Tests", "hidden": true},
15
+ {"type": "build", "section": "Build System", "hidden": true},
16
+ {"type": "ci", "section": "Continuous Integration", "hidden": true}
17
+ ]
18
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.0.0"
3
+ }
@@ -0,0 +1,67 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0](https://github.com/danielscholl/pr-generator-agent/compare/v0.1.2...v1.0.0) (2025-02-17)
9
+
10
+
11
+ ### ⚠ BREAKING CHANGES
12
+
13
+ * Promoting to first major release 1.0.0. This marks the first stable release of the AIPR tool.
14
+
15
+ ### Features
16
+
17
+ * promote to version 1.0.0 ([ae85038](https://github.com/danielscholl/pr-generator-agent/commit/ae850384909425efe311c770e3a1cc087dbdd059))
18
+
19
+ ## [0.1.2](https://github.com/danielscholl/pr-generator-agent/compare/v0.1.1...v0.1.2) (2025-02-17)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * add explicit path to release-please config ([6343f66](https://github.com/danielscholl/pr-generator-agent/commit/6343f66db39c196e97d114e2a7e82eb7b7c44579))
25
+ * correct release-please versioning configuration ([58b6718](https://github.com/danielscholl/pr-generator-agent/commit/58b6718c299c318b402c071659fb646675e12537))
26
+ * file ([645c225](https://github.com/danielscholl/pr-generator-agent/commit/645c2255e813254852e541b44d8876db37578c4e))
27
+ * file ([e761857](https://github.com/danielscholl/pr-generator-agent/commit/e76185745e08934aab79b4998499dcb748d0c728))
28
+ * improve release-please version management configuration ([d5a62c9](https://github.com/danielscholl/pr-generator-agent/commit/d5a62c9a98d1cc1f6999c37162955b44edaa735c))
29
+ * update release-please config to use toml type and path ([939a94f](https://github.com/danielscholl/pr-generator-agent/commit/939a94ff3a819e919fa4421d805f73f4945857e9))
30
+ * update release-please configuration for better version management ([4de1559](https://github.com/danielscholl/pr-generator-agent/commit/4de1559a73153a739423a74ab353828429553524))
31
+ * update release-please configuration for better version management ([71b1277](https://github.com/danielscholl/pr-generator-agent/commit/71b1277a71d238fc804b7616a70aabab05a87816))
32
+ * update release-please extra-files type to simple ([1e71c6e](https://github.com/danielscholl/pr-generator-agent/commit/1e71c6eb1cdd016c468b737bee09efc93440cfb4))
33
+ * update release-please setup for single package ([2e45307](https://github.com/danielscholl/pr-generator-agent/commit/2e4530796519f008b1a9150b856e0abd2342f728))
34
+
35
+ ## [0.1.1](https://github.com/danielscholl/pr-generator-agent/compare/v0.1.0...v0.1.1) (2025-02-17)
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * project file ([040d592](https://github.com/danielscholl/pr-generator-agent/commit/040d5920db5d082cb5f7de23ff5939cb70608313))
41
+ * update package name to pr-generator-agent and align documentation ([a8605ba](https://github.com/danielscholl/pr-generator-agent/commit/a8605ba3bd1b2cb7ac21c315f5c19a119f990f8c))
42
+
43
+ ## 0.1.0 (2025-02-16)
44
+
45
+
46
+ ### Features
47
+
48
+ * initial release of AIPR ([81b40cb](https://github.com/danielscholl/pr-generator-agent/commit/81b40cbd77e0bc767e93f657c71d701f494d261b))
49
+
50
+ ## [1.0.0] - 2025-02-17
51
+
52
+ ### Added
53
+ - Initial release of AIPR (AI Pull Request Generator)
54
+ - Core functionality to generate AI-powered pull request descriptions
55
+ - Support for both OpenAI and Anthropic Claude models
56
+ - Git integration for analyzing changes and generating contextual PR descriptions
57
+ - Command-line interface with customizable options
58
+ - Automatic token counting and context management
59
+ - Support for Python 3.10 and above
60
+ - Comprehensive test suite with pytest
61
+ - GitHub Actions workflows for testing and releases
62
+ - Development environment setup with black, isort, and flake8
63
+
64
+ ### Features
65
+ - Customizable prompt system with XML-based prompt definitions ([Custom Prompts PRD](docs/custom_prompts_prd.md))
66
+
67
+ [1.0.0]: https://github.com/danielscholl/pr-generator-agent/releases/tag/v1.0.0
@@ -0,0 +1,159 @@
1
+ # Contributing to AIPR
2
+
3
+ We welcome pull requests from everyone! Whether it's a bug fix, new feature, or documentation improvement, we appreciate your help. This guide will help you get started.
4
+
5
+ ## Before You Start
6
+
7
+ - If you're planning a large or complex change, please open an issue first to discuss the approach.
8
+ - Have questions? Open a Discussion or create an Issue with the "question" label.
9
+ - All contributions must follow our [Code of Conduct](CODE_OF_CONDUCT.md).
10
+
11
+ ## Development Guide
12
+
13
+ 1. **Prerequisites**
14
+ - Python 3.10 or higher
15
+ - Git
16
+ - GitHub account
17
+ - GitHub CLI (`gh`) - https://cli.github.com
18
+
19
+ 2. **Package and Command Names**
20
+ - PyPI Package Name: `pr-generator-agent` (for installation)
21
+ - Module Name: `aipr` (for imports)
22
+ - Command Name: `aipr` (CLI tool)
23
+
24
+ Example usage:
25
+ ```bash
26
+ # Installing the package
27
+ pip install pr-generator-agent
28
+
29
+ # Using the CLI tool
30
+ aipr
31
+
32
+ # Importing in Python
33
+ from aipr import ...
34
+ ```
35
+
36
+ 3. **Development Commands**
37
+ ```bash
38
+ # Key make targets
39
+ make install # Sets up the virtualenv and installs dependencies
40
+ make check # Runs linting, formatting, tests
41
+ make test # Just run the test suite
42
+ make pr # Creates a pull request via gh/glab
43
+ make clean # Removes build artifacts & venv
44
+ ```
45
+
46
+ 4. **Code Style**
47
+ - We use Black for code formatting and Flake8 for linting
48
+ - All code must pass `make check` before being merged
49
+ - GitHub Actions will automatically verify these checks on your PR
50
+
51
+ 5. **Commit Conventions**
52
+ We use [Conventional Commits](https://www.conventionalcommits.org/) to automate versioning and changelog generation. Your commit messages should follow this format:
53
+ ```
54
+ type(optional-scope): description
55
+
56
+ [optional body]
57
+ [optional footer(s)]
58
+ ```
59
+
60
+ Types that affect versioning:
61
+ - `feat:` - New feature (bumps minor version)
62
+ - `fix:` - Bug fix (bumps patch version)
63
+ - `feat!:` or `fix!:` - Breaking change (bumps major version)
64
+
65
+ Other types (don't affect version):
66
+ - `docs:` - Documentation changes
67
+ - `style:` - Code style changes
68
+ - `refactor:` - Code changes that neither fix a bug nor add a feature
69
+ - `test:` - Adding/updating tests
70
+ - `chore:` - Maintenance tasks
71
+
72
+ Examples:
73
+ ```bash
74
+ git commit -m "feat: add support for OpenAI models"
75
+ git commit -m "fix: handle empty commit messages"
76
+ git commit -m "feat!: switch to new API version"
77
+ git commit -m "docs: update installation instructions"
78
+ ```
79
+
80
+ 6. **Initial Setup**
81
+ ```bash
82
+ # Verify GitHub CLI is installed and authenticated
83
+ gh auth status
84
+
85
+ # Fork the repository and clone it
86
+ gh repo fork danielscholl/pr-generator-agent --clone=true
87
+ cd pr-generator-agent
88
+
89
+ # The gh fork command automatically sets up the upstream remote
90
+ # You can verify with: git remote -v
91
+
92
+ # Create virtual environment and install dependencies
93
+ make install
94
+
95
+ # Activate the virtual environment
96
+ source .venv/bin/activate
97
+ ```
98
+
99
+ 7. **Making Changes**
100
+ ```bash
101
+ # Ensure your fork is up to date
102
+ git fetch upstream
103
+ git checkout main
104
+ git merge upstream/main
105
+
106
+ # Create a new branch
107
+ git checkout -b feature-name
108
+
109
+ # Make your changes...
110
+
111
+ # Verify your changes
112
+ make check
113
+
114
+ # Commit and push your changes
115
+ git add .
116
+ git commit -m "feat: description of your changes" # Use conventional commits!
117
+ git push -u origin feature-name
118
+
119
+ # Create a pull request
120
+ make pr # Uses commit messages for title and description
121
+ make pr title="Add new feature" # Uses a specific title
122
+ ```
123
+
124
+ ## Release Process
125
+
126
+ Releases are automated using Release Please. Here's how it works:
127
+
128
+ 1. **Versioning**
129
+ - Commits to `main` automatically trigger version updates based on conventional commits
130
+ - `fix:` commits bump the patch version (0.1.0 → 0.1.1)
131
+ - `feat:` commits bump the minor version (0.1.0 → 0.2.0)
132
+ - `feat!:` or any commit with `!` bump the major version (0.1.0 → 1.0.0)
133
+
134
+ 2. **Release Flow**
135
+ - Push commits to main using conventional commit messages
136
+ - Release Please automatically creates/updates a release PR
137
+ - When the release PR is merged:
138
+ - Version is bumped in `pyproject.toml` and `__init__.py`
139
+ - Changelog is updated
140
+ - GitHub release is created
141
+ - Git tag is created
142
+
143
+ 3. **Publishing**
144
+ - Publishing to PyPI is a manual step
145
+ - Go to Actions → Release Management
146
+ - Click "Run workflow"
147
+ - Select "Publish current release to PyPI"
148
+ - Click "Run workflow"
149
+
150
+ ## Pull Request Process
151
+
152
+ 1. After opening a PR, a maintainer will review your changes
153
+ 2. We aim to respond within 3 business days
154
+ 3. We may request changes or additional tests
155
+ 4. Once approved and all checks pass, we'll merge your contribution
156
+
157
+ ## License
158
+
159
+ By contributing, you agree that your contributions will be licensed under the MIT License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Daniel Scholl
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,85 @@
1
+ .PHONY: install check clean build pr clean-pyc
2
+
3
+ # Virtual environment settings
4
+ VENV := .venv
5
+
6
+ clean-pyc:
7
+ @echo "Cleaning Python cache..."
8
+ find . -name '*.pyc' -delete
9
+ find . -name '*.pyo' -delete
10
+ find . -name '__pycache__' -type d -exec rm -rf {} +
11
+
12
+ install: clean-pyc
13
+ @echo "Setting up development environment..."
14
+ python3 -m venv $(VENV)
15
+ # Install in the virtual environment (temporary activation)
16
+ . $(VENV)/bin/activate && python -m pip install -e ".[dev]"
17
+ @echo "\nVerifying installation:"
18
+ @echo "Binary location: $(VENV)/bin/aipr"
19
+ @echo "Python package location: $$($(VENV)/bin/python -c "import aipr; print(aipr.__file__)")"
20
+ @echo "\nNext step:"
21
+ @echo "To begin development, run: source .venv/bin/activate"
22
+ @echo "This will activate the virtual environment in your shell"
23
+
24
+ format:
25
+ . $(VENV)/bin/activate && python -m black aipr/ tests/
26
+ . $(VENV)/bin/activate && python -m isort aipr/ tests/
27
+
28
+ lint:
29
+ . $(VENV)/bin/activate && python -m flake8 aipr/ tests/
30
+
31
+ test:
32
+ . $(VENV)/bin/activate && python -m pytest
33
+
34
+ check: format lint test
35
+ @echo "\nAll checks passed!"
36
+ @echo "Next step: Ready to commit your changes"
37
+
38
+ clean:
39
+ @echo "Cleaning up build artifacts and virtual environment..."
40
+ rm -rf dist/ build/ *.egg-info .coverage htmlcov/ .pytest_cache/ $(VENV)
41
+ find . -name '__pycache__' -type d -exec rm -rf {} +
42
+ @echo "\nNext step:"
43
+ @echo "Run 'deactivate' to ensure python is not running in the virtual environment"
44
+
45
+ build: clean
46
+ . $(VENV)/bin/activate && python -m build
47
+
48
+ # GitHub PR target
49
+ # Usage: make pr title="Your PR title"
50
+ pr:
51
+ @if [ -z "$(title)" ]; then \
52
+ echo "Error: title parameter is required. Usage: make pr title=\"Your PR title\""; \
53
+ exit 1; \
54
+ fi
55
+ @if [ -n "$$(git status --porcelain)" ]; then \
56
+ echo "Error: You have uncommitted changes. Please commit or stash them first."; \
57
+ exit 1; \
58
+ fi
59
+ @BRANCH=$$(git branch --show-current); \
60
+ if ! git show-ref --verify --quiet refs/remotes/origin/$$BRANCH; then \
61
+ if git ls-remote --exit-code --heads origin $$BRANCH >/dev/null 2>&1; then \
62
+ git branch --set-upstream-to=origin/$$BRANCH $$BRANCH 2>/dev/null || true; \
63
+ else \
64
+ echo "Error: Branch '$$BRANCH' does not exist on remote 'origin'."; \
65
+ echo "Please push the branch with: git push --set-upstream origin $$BRANCH"; \
66
+ exit 1; \
67
+ fi; \
68
+ fi
69
+ @if [ -n "$$(git log @{u}.. 2>/dev/null)" ]; then \
70
+ echo "Error: You have unpushed commits. Please push them first: git push"; \
71
+ exit 1; \
72
+ fi
73
+ @BRANCH=$$(git branch --show-current); \
74
+ PR_COUNT=$$(gh pr list --head $$BRANCH --state open --json number --jq 'length'); \
75
+ if [ "$$PR_COUNT" -gt 0 ]; then \
76
+ echo "Updating existing pull request for branch $$BRANCH..."; \
77
+ . $(VENV)/bin/activate && aipr -s --vulns -m azure/o1-mini -p meta | gh pr edit $$BRANCH --body-file -; \
78
+ echo "\nPull request updated!"; \
79
+ echo "Next step: Address any new feedback"; \
80
+ else \
81
+ echo "Creating new pull request for branch $$BRANCH..."; \
82
+ . $(VENV)/bin/activate && aipr -s --vulns -m azure/o1-mini -p meta | gh pr create --body-file - -t "$(title)"; \
83
+ echo "\nPull request created!"; \
84
+ echo "Next step: Wait for review and address any feedback"; \
85
+ fi