Quickstart: contributing
Learn how to preview changes locally
Setup Local Environment
Prerequisite You should have installed Node.js (version 18.10.0 or higher).
Step 1. Install pnpm
on your OS (version 8.14.3 or higher):
Step 3. Install the required dev dependencies:
- Go to
<CopilotKit Directory>/CopilotKit/
- Run
pnpm -w install --dev
- Press
Y
to accept (read question first).
Step 3. Add the required environment variables:
- Go to
<CopilotKit Directory>/CopilotKit/examples/next-openai/
- Duplicate
.env.local.example
, name the duplicate.env.local
- Edit
.env.local
with approrpriate values
Step 4. Recursively install & build all dependencies:
In <CopilotKit Directory>/CopilotKit
run:
pnpm -w freshbuild
Step 5. Run all packages & the example app in dev mode, to automatically load changes on file save.
Please Note!
If you save files in a file that’s part of the example app, the app will hot-load the changes automatically.
But if you make changes in a package, you first have to go to a file of the example app, and re-save it,
for the package changes to propagate into the running app.
In <CopilotKit Directory>/CopilotKit/
run:
pnpm run dev
By default the app will run on http://localhost:3000
, however if 3000 is already taken, it will try other available ports sequentially.
To see which port was chosen, look in the output logs for something like
next-openai:dev: - ready started server on 0.0.0.0:3002, url: http://localhost:3002
Testing your solution
Before submitting a pull request, please run the following locally:
-
Lint your code:
pnpm -w format
-
Make sure there are no build errors:
pnpm -w freshbuild
-
Make sure tests are passing
pnpm run test
-
(Optional): Run QA test scripts We have some scripts in CopilotKit/scripts/qa that can help you test your changes. For example, to test your changes in a fresh NextJS app you can run
scripts/qa/next.sh
.
Troubleshooting
Here’s how to solve some common problems when working with the CLI.
Need support? Check out the #contributing channel in the Discord.