Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* aider: Added /Users/tedfulk/repos/personal/do_you_even_diff_bro/py_do_you_even_diff_bro/git.py * aider: Updated the README.md to include an introduction, a detailed description, and instructions on how to use the tool. # Aider chat conversation: USER: update the README.md to be a comprehensive representation of all the files i have given. I want it to be four sections an Introduction, a more detailed description, and how to use it. ASSISTANT: Sure, I can help with that. Here's a general structure for the README.md file. ```markdown README.md <<<<<<< SEARCH ======= # Introduction This project is a command-line tool named BROGRAMMER, an AI Peer Review Bro. It uses the GPT model to review your code and provide feedback. The tool is designed to be flexible, allowing you to specify the level of feedback you want, the files you want to include or exclude, and even the branch to compare the git diff against. # Detailed Description The main functionality of the tool is contained within the `main.py` file. This script uses the `typer` library to parse command-line arguments and options. It also uses the `rich` library to display the results in a formatted table in the console. The `git.py` file contains a function to get the git diff of the current project. It allows you to specify the file extensions to include or exclude, and the branch to compare against. The `llm.py` file contains functions to interact with the GPT model. It sends a prompt to the model and parses the response. The `models.py` file defines the `BroMode` enum, which represents the level of feedback you want from the tool. The `utils.py` file contains utility functions used by the other scripts. The `constants.py` and `commandments.py` files contain constant values and functions to generate prompts for the GPT model, respectively. # How to Use To use the tool, run the `main.py` script with the desired options. For example, to get a chill, jr-level engineer review, use the `--chill` option: ```bash python main.py --chill ``` To specify the GPT model to use, use the `--model` option: ```bash python main.py --model gpt-4 ``` To only include files with certain extensions, use the `--only` option: ```bash python main.py --only .py .js ``` To ignore files with certain extensions, use the `--ignore` option: ```bash python main.py --ignore .txt .md ``` To specify a custom prompt for the GPT model, use the `--prompt` option: ```bash python main.py --prompt "Review this code" ``` To summarize the git diff, use the `--summarize` option: ```bash python main.py --summarize ``` To specify the branch to compare the git diff against, use the `--peer-review` option: ```bash python main.py --peer-review main ``` >>>>>>> REPLACE ``` Please note that this is a general structure and might need to be adjusted based on the specific functionality and usage of your project. * aider: Added README.md file with an introduction, detailed description, and instructions on how to use the tool. # Aider chat conversation: USER: I added these *read-write* files: py_do_you_even_diff_bro/README.md, py_do_you_even_diff_bro/constants.py, py_do_you_even_diff_bro/utils.py, py_do_you_even_diff_bro/models.py, py_do_you_even_diff_bro/llm.py, py_do_you_even_diff_bro/commandments.py ASSISTANT: Great! Now that we have all the necessary files, let's proceed with the changes. 1. **File to modify:** `py_do_you_even_diff_bro/README.md` The README file is the first point of contact for anyone who wants to understand your project. It should provide a clear and concise overview of what the project does, how to install and use it, and any other relevant information. Here's a general structure for the README.md file. ```markdown README.md <<<<<<< SEARCH ======= # Introduction This project is a command-line tool named BROGRAMMER, an AI Peer Review Bro. It uses the GPT model to review your code and provide feedback. The tool is designed to be flexible, allowing you to specify the level of feedback you want, the files you want to include or exclude, and even the branch to compare the git diff against. # Detailed Description The main functionality of the tool is contained within the `main.py` file. This script uses the `typer` library to parse command-line arguments and options. It also uses the `rich` library to display the results in a formatted table in the console. The `git.py` file contains a function to get the git diff of the current project. It allows you to specify the file extensions to include or exclude, and the branch to compare against. The `llm.py` file contains functions to interact with the GPT model. It sends a prompt to the model and parses the response. The `models.py` file defines the `BroMode` enum, which represents the level of feedback you want from the tool. The `utils.py` file contains utility functions used by the other scripts. The `constants.py` and `commandments.py` files contain constant values and functions to generate prompts for the GPT model, respectively. # How to Use To use the tool, run the `main.py` script with the desired options. For example, to get a chill, jr-level engineer review, use the `--chill` option: ```bash python main.py --chill ``` To specify the GPT model to use, use the `--model` option: ```bash python main.py --model gpt-4 ``` To only include files with certain extensions, use the `--only` option: ```bash python main.py --only .py .js ``` To ignore files with certain extensions, use the `--ignore` option: ```bash python main.py --ignore .txt .md ``` To specify a custom prompt for the GPT model, use the `--prompt` option: ```bash python main.py --prompt "Review this code" ``` To summarize the git diff, use the `--summarize` option: ```bash python main.py --summarize ``` To specify the branch to compare the git diff against, use the `--peer-review` option: ```bash python main.py --peer-review main ``` >>>>>>> REPLACE ``` Please note that this is a general structure and might need to be adjusted based on the specific functionality and usage of your project. * aider: Added /Users/tedfulk/repos/personal/do_you_even_diff_bro/tests/test_main.py * aider: Add unit tests for `main.py` using pytest in `test_main.py`. # Aider chat conversation: USER: update test_main.py to include unit tests using pytest for main.py ASSISTANT: To add unit tests for `main.py` in `test_main.py`, we need to import the necessary modules and functions, and then write the tests. Here is an example of how you might structure your tests. Note that the actual tests will depend on the specific functionality of your code, so you may need to adjust these examples to fit your needs. ```python tests/test_main.py <<<<<<< SEARCH ======= import pytest from py_do_you_even_diff_bro.main import get_bro_mode, display_diff_summary, main from py_do_you_even_diff_bro.models import BroMode def test_get_bro_mode(): assert get_bro_mode(True, False, False) == BroMode.CHILL assert get_bro_mode(False, True, False) == BroMode.MID assert get_bro_mode(False, False, True) == BroMode.CHAD assert get_bro_mode(False, False, False) == BroMode.CHILL def test_display_diff_summary(mocker): mocker.patch('py_do_you_even_diff_bro.main.console') display_diff_summary("Test summary") py_do_you_even_diff_bro.main.console.print.assert_called_once() @pytest.mark.parametrize("chill, mid, chad, model, only, ignore, prompt, summarize, peer_review", [ (True, False, False, 'gpt-4', ['.py'], [], '', False, ''), (False, True, False, 'gpt-3.5-turbo', ['.py'], ['.txt'], 'Test prompt', True, 'main') ]) def test_main(chill, mid, chad, model, only, ignore, prompt, summarize, peer_review, mocker): mocker.patch('py_do_you_even_diff_bro.main.get_git_diff', return_value="Test diff") mocker.patch('py_do_you_even_diff_bro.main.gpt_prompt', return_value="Test response") main(chill, mid, chad, model, only, ignore, prompt, summarize, peer_review) py_do_you_even_diff_bro.main.get_git_diff.assert_called_once_with(only, ignore, peer_review) py_do_you_even_diff_bro.main.gpt_prompt.assert_called() >>>>>>> REPLACE ``` This code adds three tests: 1. `test_get_bro_mode` tests the `get_bro_mode` function with different combinations of inputs. 2. `test_display_diff_summary` tests the `display_diff_summary` function and checks that it calls the `console.print` method once. 3. `test_main` tests the `main` function with different combinations of inputs and checks that it calls the `get_git_diff` and `gpt_prompt` functions. Please note that you need to install the `pytest` and `pytest-mock` packages to run these tests. You can install them with pip: ```bash pip install pytest pytest-mock ``` To run the tests, use the following command: ```bash pytest tests/test_main.py ``` * refactor & tests: added validation for main function and unit tests * added labeler action * Delete .github/workflows/labeler.yml * Delete README.html --------- Co-authored-by: Ted Fulk <[email protected]>
- Loading branch information