Skip to content

Conversation

@blinkagent
Copy link

@blinkagent blinkagent bot commented Dec 12, 2025

Summary

Implements a browser-based GitHub App creation flow similar to the CLI flow, allowing users to create and configure GitHub Apps directly from the web UI.

Changes

Database Schema

  • Add github_app_setup field to agent schema for tracking setup session state

API Routes (packages/api/src/routes/agents/setup-github.*)

  • GET /webhook-url - Get the agent's webhook URL for GitHub
  • POST /start-creation - Initiate app creation, returns manifest URL and session ID
  • GET /callback - Handle GitHub's redirect with code exchange (public endpoint)
  • GET /creation-status/:sessionId - Poll for completion status
  • POST /complete-creation - Save credentials as environment variables
  • POST /cancel-creation - Cleanup pending session

Frontend Component (packages/site/components/github-setup-wizard.tsx)

  • Step-by-step wizard matching the Slack setup wizard style
  • App name and optional organization input
  • GitHub manifest flow integration (opens GitHub in new tab)
  • Polling for callback completion
  • Credential saving with success feedback
  • Error handling with retry capability

Stories

  • Comprehensive Storybook coverage for all wizard states

Key Features

  • 10 minute session expiry - Sessions expire after 10 minutes for security
  • Supports updating existing apps - Credentials are upserted, not just inserted
  • Uses access URL from server config - Works with self-hosted deployments (doesn't assume blink.so)
  • Functionally identical to CLI flow - Uses the same GitHub App Manifest approach

Flow

  1. User enters app name (and optionally organization)
  2. Backend generates manifest URL with webhook URL and callback URL
  3. User clicks button to open GitHub in new tab
  4. User completes app creation on GitHub
  5. GitHub redirects to callback endpoint with code
  6. Backend exchanges code for credentials via GitHub API
  7. Frontend polls and detects completion
  8. User clicks "Save credentials" to persist as env vars

Testing

  • TypeScript compilation passes
  • Storybook stories for visual testing
  • Mock fetch handlers in stories for all API endpoints

@hugodutka hugodutka force-pushed the hugodutka/oss branch 6 times, most recently from b38bdf2 to b52d6b4 Compare December 12, 2025 18:06
@hugodutka hugodutka closed this Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant