Code Checker is an open source project that uses the GPT language model to review and correct code following good programming practices. It scans every file in a project and sends its content to the GPT Chat, which returns a corrected version of the code.
- Node.js v20 (refer to the
.nvmrc
file for the exact version) - An OpenAI API key. You need to create a
.env
file in the project root and add your OpenAI API key asOPENAI_API_KEY
.
-
Clone this repository.
-
Navigate to the project directory.
-
Create a
.env
file in the project root with the following content:OPENAI_API_KEY=your-openai-key
Replace
your-openai-key
with your actual OpenAI API key. -
Run
npm install
to install the project dependencies.
Run the index.js
script with the npm start
command, providing the path to the project folder you want to check as a
command line argument:
npm start path/to/your/project
If you do not provide a project path, the script will use './src'
as default.
You can use the example project located at ./tests/mock-project
to try out Code Checker.
To run the tests, use the npm test
command:
npm test
src
: The project's source code. Contains the following main components:index.js
: This is the orchestrator of the project. It controls the program flow.FileWalker.js
: This component is responsible for walking through the files of the project being checked.AIMessage.js
: This component is responsible for assembling the prompt for GPT Chat with the content of the files.
tests
: Contains tests for the project.tests/mock-project
: A mock project structure used for testing.
This project uses the following dependencies:
Main dependencies:
dotenv
: ^16.3.1openai
: ^3.3.0
Development dependencies:
jest
: ^29.6.1prettier
: 3.0.0
This is an open source project and we would love to see contributors. Here are some guidelines for contributing to the project:
- Fork the repository.
- Create a new branch for your changes.
- Make your changes or additions to the project.
- Make a pull request detailing the changes you made.
- Your PR will be reviewed and if it is helpful, it will be approved and merged into the project.
We thank you in advance for any contribution!