Skip to main content

Include Copilot CLI in your project

If you need strict Copilot CLI version control, you can include it in your project as an npm package. Usually, installing Copilot CLI separately during deployment is enough.
See Laravel Cloud usage and GitHub Actions usage.

Prerequisites

Your Laravel project has package.json, and your production server has a Node.js runtime, so npm package installation is available.

Setup

1. Install the npm package

Install @github/copilot in dependencies.
After installation, you can run Copilot CLI directly at this path.

2. Configure .env

Set COPILOT_CLI_PATH to the full path to npm-loader.js.
If you want to set the path dynamically with base_path(), edit config/copilot.php directly.

Deployment

During production deployment, reinstall dependencies without devDependencies after building assets. @github/copilot remains because it is in dependencies.
With npm install --omit=dev, packages in devDependencies are removed, and only dependencies packages (including @github/copilot) remain in node_modules.

Benefits and cautions

Authentication

Authentication is the same regardless of installation method. Set COPILOT_GITHUB_TOKEN in .env.
For details, see Authentication.
For the latest updates, see the GitHub repository.
Last modified on June 20, 2026