メインコンテンツまでスキップ

GitHub

Pull Request 管理と code search のために GitHub repository を Squid に接続する

GitHub connector の機能

GitHub connector により、Squid AI agents はユーザーに代わって GitHub repository を操作できます。

CapabilityDescription
Pull Request を検索query、state、author、reviewer で PR を検索する、または open な PR を一覧表示する
PR details を取得変更された files と reviews を任意で含む、完全な PR details
Code を検索repository の code を検索し、必要に応じて path や file extension でフィルタリングする
Files を読み取る任意の branch、tag、commit から file の content を読み取る
Pull Request を作成branches 間で PR(draft PR を含む)を開く
Review と commentPR に comment する、または approve/request-changes/comment review を送信する
Close と mergemerge せずに PR を close する、または merge、squash、rebase を使用して merge する

各 connector は単一の repository に scoped されます。複数の repositories を扱うには、repository ごとに connector を 1 つ追加してください。

これらの機能により、ユーザーは AI agent に「open な PR を要約して」「PR #42 を review して」「rate limiter はどこに実装されていますか?」のような依頼ができます。

GitHub App の作成

connector は、repository にインストールされた GitHub App として認証します。

  1. organization または user account で GitHub App を作成します。

  2. use case に必要な repository permissions を app に付与します。最低限、Pull requests(read and write)と Contents(read)が必要です。

  3. 接続したい repository に app をインストールします。

  4. App ID(app の About section)と Installation ID(installation page の URL、github.com/settings/installations/<ID>)を控えます。

  5. Private keys で private key を生成し、PEM file をダウンロードします。

Squid application に GitHub connector を追加する

  1. Squid ConsoleConnectors tab に移動します。

  2. Available Connectors をクリックします。

  3. GitHub connector を見つけ、Add Connector を選択します。

  4. 次の configuration details を入力します。

Connector ID: code 内で connector を一意に識別する string。

App ID: GitHub App の App ID。

Installation ID: repository の Installation ID。

Private Key: GitHub App 用に生成された private key(PEM format)。key は Squid secret として安全に保存されます。

Repository: facebook/react のような owner/repo format の repository。

Webhook Secret: 任意。GitHub App が Squid に webhooks を送信するように設定した場合に、GitHub webhook signatures を検証するために使用される secret。

application で GitHub connector を使用する

No-code Studio

  1. Squid ConsoleStudio tab に移動します。

  2. Create AI Agent をクリックします。

  3. "repo-agent" や "This agent helps the user manage pull requests" のような agent IDdescription を入力します。

  4. Add Abilities をクリックします。

  5. GitHub entry を展開し、先ほど作成した GitHub connector を選択します。

  6. "Call this when a user wants to work with pull requests or search the code base." のように、agent がこの connection をどのように使用すべきかの description を入力します。

  7. Test をクリックし、agent に "List the open pull requests" と尋ねてみます。

Squid SDK を使用する

Squid SDK で AI agent を作成している場合は、ask() function の connectedIntegrations option に GitHub connector を追加して接続します。

await this.squid
.ai()
.agent('AGENT_ID')
.ask('Summarize the open pull requests', {
connectedIntegrations: [
{
integrationId: 'GITHUB_CONNECTOR_ID',
integrationType: 'github',
description: 'Call this connector to work with pull requests and search code',
},
],
});

SDK から agent と対話する方法の詳細については、AI agent documentation を参照してください。