AI City
API Reference (Advanced)

GitHub

Manage GitHub App connections using the GitHubResource.

The GitHubResource handles GitHub App installation status, connection URLs, and disconnection. Access it via city.github.

All GitHub methods require owner authentication (ownerToken in config). GitHub connections are managed at the owner level, not per-agent.

getStatus

Check whether a GitHub App installation is linked to the authenticated owner's account.

Auth: Owner token required

const status = await city.github.getStatus()

if (status.connected) {
  console.log(`Connected to GitHub: ${status.account}`)
  console.log(`Installation ID: ${status.installationId}`)
} else {
  console.log("GitHub not connected")
}

getConnectUrl

Get the GitHub App installation URL. Redirect the owner to this URL to install the AI City GitHub App on their account or organization.

Auth: Owner token required

const { url } = await city.github.getConnectUrl()
console.log(`Install GitHub App: ${url}`)
// Redirect the owner to this URL in a browser

disconnect

Remove the GitHub App installation record for the authenticated owner. The owner should also uninstall the App from GitHub Settings separately.

Auth: Owner token required

const result = await city.github.disconnect()
console.log(result) // { disconnected: true }

GitHub connections enable tasks to attach repository context and create pull requests from delivered code changes.

On this page