mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-01-13 07:38:01 -05:00
The commit adds a new ESLint configuration file to the project. The configuration extends the recommended rules from ESLint, adds recommended rules from the @typescript-eslint plugin, and adds the prettier plugin to format code. The configuration also includes rules to enforce sorting of imports, disallow console statements, and disallow non-null assertions. * 📝 docs(CONTRIBUTING.md): add contribution guidelines This commit adds a CONTRIBUTING.md file to the project repository, which outlines the steps to follow when contributing to the project. It includes instructions on how to contribute, how to report issues, and how to contact the project maintainers. It also includes guidelines for writing commit messages. * 🎨 style(.github/logo-black.png): add black version of the logo A new black version of the logo has been added to the .github directory. This will be used in situations where a black background is present, to ensure the logo is visible and clear. * 🎨 style(logo-grad.svg): add company logo A new company logo has been added to the .github directory. The logo is an SVG file with a width of 78 and a height of 75. It consists of a gradient of two colors, #D33075 and #6157D8. The logo is intended to be used as the company's official logo. * 🎨 style(logo.svg): add company logo The company logo has been added to the .github directory. The logo is an SVG file with a width of 78 and a height of 75. It consists of two paths that are filled with black color. * 📝 chore(.gitignore): add files and directories to ignore list Added files and directories to the ignore list to prevent them from being committed to the repository. The added files and directories include node_modules/, coverage/, out/, temp/, build/, dist/, application.log, .DS_Store, *.env, logfile.log, uncaughtExceptions.log, .vscode, and src/*.json. * 🆕 chore(.prettierignore): add /build and /dist directories to ignore list for Prettier This commit adds the /build and /dist directories to the ignore list for Prettier. This ensures that Prettier does not format files in these directories, which are typically generated by build tools and should not be modified directly. * 🆕 chore(.prettierrc): add Prettier configuration file A new Prettier configuration file has been added to the project root directory. The configuration file sets the `trailingComma` option to "none" and the `singleQuote` option to true. This ensures that code formatting is consistent across the project. * 🆕 add(LICENSE): add MIT License Added a MIT License to the project, which grants permission to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, subject to the conditions outlined in the license. The license also includes a disclaimer of warranties and limitations of liability. * 🆕 feat(README.md): add OpenCommit documentation This commit adds the documentation for OpenCommit, a tool that generates conventional commits with high accuracy using AI. The documentation includes instructions on how to set up and use OpenCommit, as well as its features such as GitMoji convention, descriptions of changes, and Git hook integration. Additionally, the documentation includes information on payments for OpenAI API usage. * 📝 docs(TODO.md): add build for both mjs and cjs task Added a task to build for both mjs and cjs as per the best practices outlined in the linked article. * 🆕 feat(package.json): add dependencies and devDependencies This commit adds the dependencies and devDependencies to the package.json file. The dependencies include axios, chalk, cleye, execa, ini, inquirer, and openai. The devDependencies include typescript, eslint, esbuild, dotenv, and ts-node. * 🎉 feat(api.ts): add OpenAI class with generateCommitMessage method The OpenAI class is added to the project, which provides a generateCommitMessage method that uses the OpenAI API to generate commit messages. The method takes an array of ChatCompletionRequestMessage objects and returns a ChatCompletionResponseMessage object. The apiKey is retrieved from the configuration file, and if it is not present, the user is prompted to input it. * 🆕 feat(cli.ts): add CLI support for opencommit This commit adds a new file `cli.ts` which contains the CLI implementation for opencommit. The CLI is built using the `cleye` package and supports the following commands: `config` and `hook`. The `config` command is used to configure opencommit, while the `hook` command is used to set up the Git hook. The CLI also supports a `--version` flag to display the version number and a `--help` flag to display the help message. * ✨ feat(commit.ts): add ability to commit staged files with generated commit message The commit command now supports committing staged files with a generated commit message. The user is prompted to confirm the commit message before the commit is made. If there are no staged files, the user is prompted to stage all files and generate a commit message. If the user confirms, all files are staged and the commit message is generated. * 🚀 feat(config.ts): add support for setting and getting configuration values The `config.ts` file now contains functions for setting and getting configuration values. The `getConfig` function reads the configuration file from the user's home directory and returns the configuration object. The `setConfig` function sets the configuration values passed as arguments and writes them to the configuration file. The `configCommand` function is a command-line interface for the `getConfig` and `setConfig` functions. It supports two modes: "get" and "set". The "get" mode retrieves the configuration values for the specified keys, and the "set" mode sets the configuration values for the specified keys. * ✨ feat(githook.ts): add support for setting and unsetting prepare-commit-msg hook This commit adds a new command to set and unset the prepare-commit-msg hook. The hook is set to opencommit, which is a tool that helps to write conventional commit messages. The command checks if the hook is already set and if it is, it verifies that it is set to opencommit. If the hook is set to a different tool, it throws an error and asks the user to remove it manually. If the hook is not set, it creates a symlink to opencommit. The command also supports unsetting the hook, which removes the symlink. * ✨ feat(prepare-commit-msg-hook.ts): add support for generating commit messages with chat completion This commit adds support for generating commit messages with chat completion. The `prepare-commit-msg-hook.ts` file now imports the `generateCommitMessageWithChatCompletion` function from the `generateCommitMessageFromGitDiff` module. The function generates a commit message based on the staged git diff and appends it to the commit message file. If the `OPENAI_API_KEY` environment variable is not set, an error is thrown. If the commit source is specified, the function returns without generating a commit message. * 🆕 feat(generateCommitMessageFromGitDiff.ts): add support for generating commit messages from git diff This commit adds a new module that generates commit messages from git diff. The module uses the OpenAI API to prompt the user to create a commit message in the conventional commit convention. The user is given the option to use Gitmoji convention to preface the commit and add a short description of what the commit is about. The user can also choose not to add any descriptions to the commit, only the commit message. * 🐛 fix(server.ts): change port variable case from lowercase port to uppercase PORT * ✨ feat(server.ts): add support for process.env.PORT environment variable The port variable is now named PORT, which improves consistency with the naming conventions as PORT is a constant. Support for an environment variable allows the application to be more flexible as it can now run on any available port specified via the process.env.PORT environment variable. * ✨ feat: add function to generate commit messages from diff files This commit adds a new function that generates commit messages from diff files. The function takes in a diff string and splits it by files. It then generates commit messages for each file using a separate function. The commit messages are then concatenated and returned as a single string. If the commit message is empty, it is skipped. If there is an error generating the commit message, an error is returned. * ✨ feat(git.ts): add function to assert git repository existence * ✨ feat(git.ts): add function to get staged git diff The assertGitRepo function checks if the current directory is a git repository by running the 'git rev-parse' command. If the command fails, an error is thrown. The getStagedGitDiff function returns the staged diff of the git repository. It takes an optional boolean argument isStageAllFlag, which when true stages all changes before getting the diff. The function uses the 'git diff --staged' command to get the diff and excludes big files from the diff. The function returns an object with two properties: files, which is an array of the names of the files that have changes, and diff, which is the diff of the staged changes. * 🎉 feat(tsconfig.json): add tsconfig.json file This commit adds a new tsconfig.json file to the project. The file contains compiler options that specify how TypeScript should compile the project. The options include the target language version, module code generation, output directory, and type checking options. The file also excludes the node_modules directory from compilation and includes options for ts-node.
1.5 KiB
1.5 KiB
Contribution Guidelines
Thank you for considering contributing to the project. Let's shake it baby.
How to contribute
- Fork the project repository on GitHub.
- Clone your forked repository locally.
- Create a new branch for your changes.
- Make your changes and commit them with descriptive commit messages.
- Push your changes to your forked repository.
- Create a pull request from your branch to the
masterbranch.
Getting started
To get started, follow these steps:
- Clone the project repository locally.
- Install dependencies with
npm install. - Run the project with
npm run dev. - See issues or TODO.md to help the project.
Commit message guidelines
Use the library to generate commits, stage the files and run npm run dev :)
Reporting issues
If you encounter any issues while using the project, please report them on the GitHub issue tracker. When reporting issues, please include as much information as possible, such as steps to reproduce the issue, expected behavior, and actual behavior.
Contact us
If you have any questions about contributing to the project, please contact us by creating an issue on the GitHub issue tracker.
License
By contributing to this project, you agree that your contributions will be licensed under the MIT license, as specified in the LICENSE file in the root of the project.