diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f4d146..b6890aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,12 +6,12 @@ This file is written automatically by the [version bump script](version-bump.ts) ### Changelog Summary -- Enhanced version bump and changelog handling. -- Improved commit flow with Launchpad bug integration. -- Enhanced commit message handling by improved sanitization logic, specifically replacing newline characters with escape sequences for better multi-line support. -- Refactored code for improved readability and error handling. -- Utilized temporary files for git commit message construction. -- General code prettification and refactoring for better code organization and functionality. +- Enhanced version bump and changelog handling. +- Improved commit flow with Launchpad bug integration. +- Enhanced commit message handling by improved sanitization logic, specifically replacing newline characters with escape sequences for better multi-line support. +- Refactored code for improved readability and error handling. +- Utilized temporary files for git commit message construction. +- General code prettification and refactoring for better code organization and functionality. ## [0.1.1] - 2024-11-16 @@ -19,9 +19,9 @@ This file is written automatically by the [version bump script](version-bump.ts) ### Changelog Summary -- Enhanced commit workflow: - - Added a feedback loop for improved user interaction. - - Introduced an option to unstage changes. +- Enhanced commit workflow: + - Added a feedback loop for improved user interaction. + - Introduced an option to unstage changes. ## [0.1.2] - 2024-11-17 @@ -31,35 +31,35 @@ This file is written automatically by the [version bump script](version-bump.ts) #### New Features -- Added test job to GitHub Actions workflow. -- Enhanced CLI options and updated version handling in evergit. +- Added test job to GitHub Actions workflow. +- Enhanced CLI options and updated version handling in evergit. #### Improvements -- Added code coverage reports and refactored tests -- Implemented error handling for model settings with a list of available models -- Updated README with npm install and usage instructions. -- Added changelog generation details to the `CHANGELOG.md`. -- Introduced option for staging all files during commit. -- Added `ts-prune` to check for unused exports. +- Added code coverage reports and refactored tests +- Implemented error handling for model settings with a list of available models +- Updated README with npm install and usage instructions. +- Added changelog generation details to the `CHANGELOG.md`. +- Introduced option for staging all files during commit. +- Added `ts-prune` to check for unused exports. #### Refactoring -- Refactored diff retrieval to exclude specific files. +- Refactored diff retrieval to exclude specific files. #### Code Quality -- Prettified code in multiple instances. +- Prettified code in multiple instances. #### Maintenance -- Added `.VSCodeCounter/` to `.gitignore` for a cleaner repository. -- Removed generated coverage files from the repository and updated `.gitignore` accordingly. -- Cleaned up coverage files and ignored them in future commits. +- Added `.VSCodeCounter/` to `.gitignore` for a cleaner repository. +- Removed generated coverage files from the repository and updated `.gitignore` accordingly. +- Cleaned up coverage files and ignored them in future commits. #### Fixes -- Added a success message after the commit operation is performed. +- Added a success message after the commit operation is performed. ## [0.1.3] - 2024-11-19 @@ -67,21 +67,21 @@ This file is written automatically by the [version bump script](version-bump.ts) ### Changelog Summary -- **Enhancements:** +- **Enhancements:** - - Improved buffer handling in the `getDiffForStagedFiles` function. - - Enhanced the CLI main function and added corresponding tests. + - Improved buffer handling in the `getDiffForStagedFiles` function. + - Enhanced the CLI main function and added corresponding tests. -- **Testing:** +- **Testing:** - - Added integration tests for Git utilities. + - Added integration tests for Git utilities. -- **Code Quality:** +- **Code Quality:** - - Prettified codebase for improved readability. + - Prettified codebase for improved readability. -- **Merges:** - - Merged branch 'dev' from the repository. +- **Merges:** + - Merged branch 'dev' from the repository. ## [0.1.4] - 2024-12-16 @@ -89,9 +89,9 @@ This file is written automatically by the [version bump script](version-bump.ts) # Changelog Summary -- Refactored AI utility to use Axios instead of OpenAI client. -- Improved code readability by applying code formatting (Prettified Code). -- Merged changes from the 'main' branch into 'dev'. +- Refactored AI utility to use Axios instead of OpenAI client. +- Improved code readability by applying code formatting (Prettified Code). +- Merged changes from the 'main' branch into 'dev'. ## [0.2.0] - 2025-01-01 @@ -99,8 +99,7 @@ This file is written automatically by the [version bump script](version-bump.ts) # Changelog Summary -- Added user-specific configuration management to the Evergit tool. -- Enhanced the configuration management system within Evergit. -- Removed the `open` package and its type definitions from dependencies. -- Applied code formatting improvements for better readability. - +- Added user-specific configuration management to the Evergit tool. +- Enhanced the configuration management system within Evergit. +- Removed the `open` package and its type definitions from dependencies. +- Applied code formatting improvements for better readability. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0b87544..59ec222 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,40 +5,45 @@ We appreciate your interest in contributing to **Evergit**! This document outlin ## How to Contribute ### 1. Fork the Repository + 1. [**Fork the Repository**](https://github.com/IanSkelskey/evergit/fork) 2. Clone your fork to your local machine: - ~~~bash - git clone https://github.com//evergit.git - ~~~ + ```bash + git clone https://github.com//evergit.git + ``` 3. Add the original repository as an upstream remote: - ~~~bash - git remote add upstream https://github.com/IanSkelskey/evergit.git - ~~~ + ```bash + git remote add upstream https://github.com/IanSkelskey/evergit.git + ``` ### 2. Work on Your Feature or Fix + 1. Create a new branch for your changes, based on the `dev` branch: - ~~~bash - git checkout dev - git pull upstream dev - git checkout -b feature/your-feature-name - ~~~ + ```bash + git checkout dev + git pull upstream dev + git checkout -b feature/your-feature-name + ``` 2. Make your changes, commit them, and push the branch to your fork: - ~~~bash - git add . - git commit -m "Add your meaningful commit message here" - git push origin feature/your-feature-name - ~~~ + ```bash + git add . + git commit -m "Add your meaningful commit message here" + git push origin feature/your-feature-name + ``` ### 3. Open a Pull Request + 1. Navigate to the [Pull Requests](https://github.com/IanSkelskey/evergit/pulls) section of the Evergit repository. 2. Click **New Pull Request** and select: - - **Base branch:** `dev` - - **Compare branch:** `feature/your-feature-name` (or the branch you created) + - **Base branch:** `dev` + - **Compare branch:** `feature/your-feature-name` (or the branch you created) 3. Provide a detailed description of the changes in the pull request template and link to any related issues. 4. Submit the pull request. ### 4. Preparing for Merging into `main` + Before a pull request is merged into the `main` branch, ensure: + 1. The code is fully tested and passes all checks. 2. The version bump script is executed (see below). @@ -47,41 +52,46 @@ Before a pull request is merged into the `main` branch, ensure: ## Running the Code Locally 1. **Clone the repository:** - ~~~bash - git clone https://github.com//evergit.git - cd evergit - ~~~ + + ```bash + git clone https://github.com//evergit.git + cd evergit + ``` 2. **Install dependencies:** - ~~~bash - npm install - ~~~ + + ```bash + npm install + ``` 3. **Run the project:** To execute the project locally: - ~~~bash - npm start - ~~~ + + ```bash + npm start + ``` 4. **Run a specific command:** For example, to test the `commit` command: - ~~~bash - npm start commit -- -a - ~~~ + ```bash + npm start commit -- -a + ``` --- ## Testing the Code This project uses Jest for testing. To run all tests: -~~~bash + +```bash npm test -~~~ +``` To run a specific test file: -~~~bash + +```bash npm test -~~~ +``` Ensure all tests pass before submitting your pull request. @@ -90,14 +100,16 @@ Ensure all tests pass before submitting your pull request. ## Formatting the Code To ensure consistent code formatting, use the provided Prettier script. Run the following command to format the entire codebase: -~~~bash + +```bash npm run format -~~~ +``` To check for formatting issues without applying changes: -~~~bash + +```bash npm run format-check -~~~ +``` --- @@ -106,40 +118,46 @@ npm run format-check Before opening a pull request into the `main` branch, you must run the version bump script to increment the version number and update the changelog. ### Steps: + 1. **Run the script:** - ~~~bash - npm run version-bump -- - ~~~ - Replace `` with one of the following: - - `major`: For breaking changes - - `minor`: For new features - - `patch`: For bug fixes (default if no increment is specified) + + ```bash + npm run version-bump -- + ``` + + Replace `` with one of the following: + + - `major`: For breaking changes + - `minor`: For new features + - `patch`: For bug fixes (default if no increment is specified) 2. **Commit the updated files:** The script will automatically: - - Update `package.json` and `package-lock.json` with the new version. - - Update the version badge in `README.md`. - - Update the version in `src/main.ts`. - - Append the changelog in `CHANGELOG.md`. - After running the script, commit the changes: - ~~~bash - git add package.json package-lock.json README.md CHANGELOG.md src/main.ts - git commit -m "Bump version for release" - ~~~ + - Update `package.json` and `package-lock.json` with the new version. + - Update the version badge in `README.md`. + - Update the version in `src/main.ts`. + - Append the changelog in `CHANGELOG.md`. + + After running the script, commit the changes: + + ```bash + git add package.json package-lock.json README.md CHANGELOG.md src/main.ts + git commit -m "Bump version for release" + ``` 3. **Push the updated version:** - ~~~bash - git push origin feature/your-feature-name - ~~~ + ```bash + git push origin feature/your-feature-name + ``` --- ## Code Guidelines -- Follow the existing coding style and conventions. -- Document your code where necessary. -- Ensure the code is clean and free of console logs or unnecessary comments before submitting. +- Follow the existing coding style and conventions. +- Document your code where necessary. +- Ensure the code is clean and free of console logs or unnecessary comments before submitting. --- diff --git a/README.md b/README.md index d6ff8aa..83c35ce 100644 --- a/README.md +++ b/README.md @@ -12,18 +12,18 @@ An AI-powered Git helper for the Evergreen ILS project. Evergit uses OpenAI’s ## Features -- Generate commit messages using OpenAI's LLM models. -- Automatically reference Launchpad bugs in commit messages. -- Automatically sign off commits with the user's name and email. -- Select files to stage for commit. -- Use different models by specifying the model name as an argument. -- Manage user-specific configuration for name and email. +- Generate commit messages using OpenAI's LLM models. +- Automatically reference Launchpad bugs in commit messages. +- Automatically sign off commits with the user's name and email. +- Select files to stage for commit. +- Use different models by specifying the model name as an argument. +- Manage user-specific configuration for name and email. ## Requirements -- `Node.js`, `npm`, and `Git` must be installed on your system. -- OpenAI API key (stored in the `OPENAI_API_KEY` environment variable) -- A launchpad account is required to reference bugs in commit messages. +- `Node.js`, `npm`, and `Git` must be installed on your system. +- OpenAI API key (stored in the `OPENAI_API_KEY` environment variable) +- A launchpad account is required to reference bugs in commit messages. ## Installation @@ -47,20 +47,20 @@ Generates a commit message using a LLM model from OpenAI that follows the Evergr evergit commit # Uses the default model and prompts the user to select files to stage ``` -- Prompts the user to select files to stage. -- Prompts the user for a Launchpad bug number. - - References the bug name, description and conversation when generating the commit message using the Launchpad API. -- Automatically signs off the commit with the user's name and email from the git configuration. +- Prompts the user to select files to stage. +- Prompts the user for a Launchpad bug number. + - References the bug name, description and conversation when generating the commit message using the Launchpad API. +- Automatically signs off the commit with the user's name and email from the git configuration. ##### Options -- `-m, --model `: Use a specific model to generate the commit message. +- `-m, --model `: Use a specific model to generate the commit message. ```bash evergit commit --model # Uses a specific model ``` -- `-a, --all`: Stage all modified files for commit. +- `-a, --all`: Stage all modified files for commit. ```bash evergit commit --all # Stages all modified files @@ -72,34 +72,34 @@ Manage user-specific configuration options for name and email. If no name and/or ##### Options -- `--set `: Set a configuration option. Valid keys are `name` and `email`. +- `--set `: Set a configuration option. Valid keys are `name` and `email`. ```bash evergit config --set name "Your Name" evergit config --set email "your.email@example.com" ``` -- `--get `: Get a configuration option. Valid keys are `name` and `email`. +- `--get `: Get a configuration option. Valid keys are `name` and `email`. ```bash evergit config --get name evergit config --get email ``` -- `--clear `: Clear a configuration option. Valid keys are `name` and `email`. +- `--clear `: Clear a configuration option. Valid keys are `name` and `email`. ```bash evergit config --clear name evergit config --clear email ``` -- `--get-all`: Get the entire configuration. +- `--get-all`: Get the entire configuration. ```bash evergit config --get-all ``` -- `--edit`: Edit the configuration file manually in the default editor. +- `--edit`: Edit the configuration file manually in the default editor. ```bash evergit config --edit