GitHub
Pull Request 管理と code search のために GitHub repository を Squid に接続する
GitHub connector の機能
GitHub connector により、Squid AI agents はユーザーに代わって GitHub repository を操作できます。
| Capability | Description |
|---|---|
| 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 と comment | PR に comment する、または approve/request-changes/comment review を送信する |
| Close と merge | merge せずに 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 として認証します。
-
organization または user account で GitHub App を作成します。
-
use case に必要な repository permissions を app に付与します。最低限、Pull requests(read and write)と Contents(read)が必要です。
-
接続したい repository に app をインストールします。
-
App ID(app の About section)と Installation ID(installation page の URL、
github.com/settings/installations/<ID>)を控えます。 -
Private keys で private key を生成し、PEM file をダウンロードします。
Squid application に GitHub connector を追加する
-
Squid Console の Connectors tab に移動します。
-
Available Connectors をクリックします。
-
GitHub connector を見つけ、Add Connector を選択します。
-
次の 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
-
Squid Console の Studio tab に移動します。
-
Create AI Agent をクリックします。
-
"repo-agent" や "This agent helps the user manage pull requests" のような agent ID と description を入力します。
-
Add Abilities をクリックします。
-
GitHub entry を展開し、先ほど作成した GitHub connector を選択します。
-
"Call this when a user wants to work with pull requests or search the code base." のように、agent がこの connection をどのように使用すべきかの description を入力します。
-
Test をクリックし、agent に "List the open pull requests" と尋ねてみます。
Squid SDK を使用する
Squid SDK で AI agent を作成している場合は、ask() function の connectedIntegrations option に GitHub connector を追加して接続します。
- TypeScript
- Python
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',
},
],
});
await squid.ai().agent('AGENT_ID').ask(
'Summarize the open pull requests',
options={
'connectedIntegrations': [
{
'integrationId': 'GITHUB_CONNECTOR_ID',
'integrationType': 'github',
'description': 'Call this connector to work with pull requests and search code',
}
]
},
)
SDK から agent と対話する方法の詳細については、AI agent documentation を参照してください。