Advanced: Package Linking

Link your local CopilotKit packages into your own project. Then pnpm run dev in the monorepo updates your project as you edit.

Global Package Linking With pnpm

We will use pnpm's global linking feature to link the CopilotKit packages to your own project.

In The CopilotKit Monorepo

First, set up the monorepo with the code contribution guide.

Navigate to the CopilotKit monorepo and run the following command to link the packages globally:

pnpm exec nx run-many -t link:global

In Your Project

In your project, make sure that you have pnpm configured. This will not prevent you from using npm or yarn as well. But for the purpose of global linking, you must use pnpm.

cd your-project
pnpm i

Next, link the desired package in your project:

You can run this for all packages, or just the ones you need. Your changes will now be synced.

Unlinking

Once you are done, you can undo the global linking by running the following command in the CopilotKit monorepo:

pnpm exec nx run-many -t unlink:global

And then in your project:

pnpm install

That's it, everything is now back to normal.

Need help?

If you need help with anything, please don't hesitate to reach out to us on Discord. We have a dedicated #contributing channel.

How is this guide?