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

GitHub

pull request management と code search のため、GitHub repository を Squid に接続します

GitHub Connector の Functionality

GitHub connector により、Squid AI agent は user に代わって GitHub repository を操作できます。

Capability説明
Pull request の検索query、state、author、reviewer で PR を検索するか、open PR を list 化します
PR detail の取得optional で変更済み file と review を含む、完全な PR detail
Code の検索optional で path または file extension により filter して、repository の code を検索します
File の読み取り任意の branch、tag、commit から file content を読み取ります
Pull request の作成branch 間の PR(draft PR を含む)を open します
Review と commentPR に comment するか、approve/request-changes/comment review を送信します
Close と mergemerge せずに PR を close するか、merge、squash、rebase を使用して merge します

各 connector は single repository に scope されます。複数 repository を操作するには、repository ごとに connector を追加します。

これらの capability により、user は AI agent に「open PR を summarize して」、「PR #42 を review して」、「rate limiter はどこに実装されていますか?」などを尋ねられます。

GitHub App の作成

connector は repository に install された GitHub App として authenticate します。

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

  2. use case に必要な repository permission を app に付与します。最低限、Pull requests(read と write)および Contents(read)を付与します。

  3. 接続する repository に app を install します。

  4. App ID(app の About section)および Installation ID(installation page の URL、github.com/settings/installations/<ID>)を確認します。

  5. Private keys で private key を生成し、PEM file を download します。

Squid Application に GitHub Connector を追加する

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

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

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

  4. 次の configuration detail を指定します。

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

App ID: GitHub App の App ID。

Installation ID: repository の Installation ID。

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

Repository: facebook/react など、owner/repo format の repository。

Webhook Secret: Optional。GitHub App を構成して Squid に webhook を配信する場合に、GitHub webhook signature の verification に使用する 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 を expand し、先ほど作成した GitHub connector を選択します。

  6. agent がこの connection を使用する方法の description を指定します。たとえば、"Call this when a user wants to work with pull requests or search the code base." です。

  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 と interaction する方法の詳細については、AI agent documentationを参照してください。