> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Laravel Boost Custom Agent for GitHub Copilot CLI

> 为 Laravel Boost 增加 GitHub Copilot CLI 用自定义 agent 的包。以支持 Testbench 为特色。

## 概览

`revolution/laravel-boost-copilot-cli` 是 [Laravel Boost](https://github.com/laravel/boost) 的扩展包，用来为 GitHub Copilot CLI 增加自定义 agent。

Laravel Boost 本体也有 `GitHub Copilot`，但那主要面向 VS Code 的 GitHub Copilot 集成。本包则明确面向 Copilot CLI，特别是在使用 Testbench 的包开发场景中提供更易用的结构。

## 环境要求

* PHP 8.2+
* Laravel 12+
* Laravel Boost 2.0+
* Copilot CLI 1.0.61+

## 支持平台

* macOS
* WSL（也支持原生 Windows，推荐使用 WSL）
* Linux

也可以在 Laravel Sail 中使用。请先执行 `vendor/bin/sail up -d`，然后在 Sail 外部执行 `copilot` 命令。

## 安装

```shell theme={null}
composer require revolution/laravel-boost-copilot-cli --dev
```

## 用法

```shell theme={null}
php artisan boost:install
# 选择 "GitHub Copilot CLI"
copilot
```

指南会作为自定义 instructions 生成到 `.github/instructions/laravel-boost.instructions.md`。

Copilot CLI 会自动读取项目根目录下的 `.github/mcp.json`，因此不需要额外配置。

## 自定义

发布 `config/boost.php` 后，可以修改指南文件和 MCP 配置文件的生成路径。

```shell theme={null}
php artisan vendor:publish --tag=boost-config
```

在 `config/boost.php` 中添加 `agents`。要让 Copilot CLI 与官方 Copilot（VS Code）保持一致，可以指定 `AGENTS.md`。反过来，也可以修改 Copilot（VS Code）一侧。

```php theme={null}
'executable_paths' => [],

'agents' => [
    // Copilot CLI
    'copilot_cli' => [
        'guidelines_path' => 'AGENTS.md',
        'mcp_config_path' => '.github/mcp.json',
    ],
    // Copilot(VS Code)
    'copilot' => [
        'guidelines_path' => '.github/instructions/laravel-boost.instructions.md',
        'mcp_config_path' => '.vscode/mcp.json',
    ],
],
```

<Warning>
  `agents` 是文档中未记载的功能，未来版本升级中可能会发生变化。
</Warning>

## Testbench 支持（面向包开发者）

本包提供了一种更易适配基于 Testbench 的运营方式，弥补 Laravel Boost 官方难以覆盖的场景。

<Steps>
  <Step title="搭建 Testbench 的 workbench">
    ```shell theme={null}
    vendor/bin/testbench workbench:install
    ```
  </Step>

  <Step title="在 composer.json 中添加 @build">
    在 `post-autoload-dump` 中添加 `@build`。

    ```json theme={null}
    {
      "scripts": {
        "post-autoload-dump": [
          "@clear",
          "@prepare",
          "@build"
        ]
      }
    }
    ```
  </Step>

  <Step title="通过 Testbench 安装 Boost">
    ```shell theme={null}
    vendor/bin/testbench boost:install
    ```
  </Step>
</Steps>

## 相关链接

* GitHub: [invokable/laravel-boost-copilot-cli](https://github.com/invokable/laravel-boost-copilot-cli)
* 面向 PhpStorm 的相关包: [invokable/laravel-boost-phpstorm-copilot](https://github.com/invokable/laravel-boost-phpstorm-copilot)
* Copilot SDK for Laravel: [invokable/laravel-copilot-sdk](https://github.com/invokable/laravel-copilot-sdk)


## Related topics

- [Laravel Boost Custom Agent for PhpStorm with GitHub Copilot](/zh/packages/laravel-boost-phpstorm-copilot.md)
- [认证 - GitHub Copilot SDK for Laravel](/zh/packages/laravel-copilot-sdk/auth.md)
- [Laravel Cloud - GitHub Copilot SDK for Laravel](/zh/packages/laravel-copilot-sdk/laravel-cloud.md)
- [GitHub Actions - GitHub Copilot SDK for Laravel](/zh/packages/laravel-copilot-sdk/github-actions.md)
- [快速开始 - GitHub Copilot SDK for Laravel](/zh/packages/laravel-copilot-sdk/getting-started.md)
