> ## 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-TW/packages/laravel-boost-phpstorm-copilot.md)
- [建立 Boost 的自定義 Agent](/zh-TW/advanced/boost-custom-agent.md)
- [我的套件](/zh-TW/packages/index.md)
- [我的包](/zh-CN/packages/index.md)
- [進階主題](/zh-TW/advanced/index.md)
