Documentation
¶
Overview ¶
Package appsetup handles creating and installing per-role GitHub Apps using the manifest flow. It checks for existing app installations before creating new ones, and supports reusing apps whose private keys are already stored as secrets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpectedAppSlug ¶
ExpectedAppSlug returns the conventional app slug for a given org and role. The convention is simply <org>-<role> for all roles. Used during uninstall to infer app names when config.yaml is unavailable.
Types ¶
type AppCredentials ¶
type AppCredentials struct {
AppID int
Slug string
Name string
PEM string
ClientID string
ClientSecret string
WebhookSecret *string
HTMLURL string
}
AppCredentials holds the credentials returned from the manifest flow.
type BrowserOpener ¶
BrowserOpener opens URLs in the user's browser.
type DefaultBrowser ¶
type DefaultBrowser struct{}
DefaultBrowser opens URLs using platform-specific commands.
type SecretExistsFunc ¶
SecretExistsFunc checks if a secret exists for a given role.
type Setup ¶
type Setup struct {
// contains filtered or unexported fields
}
Setup orchestrates the creation or reuse of GitHub Apps for agent roles.
func NewSetup ¶
func NewSetup(client forge.Client, prompter Prompter, browser BrowserOpener, printer *ui.Printer) *Setup
NewSetup creates a new Setup instance.
func (*Setup) Run ¶
Run creates or reuses a GitHub App for the given org and role.
The flow:
- Check for an existing installation matching this org/role.
- If found and the PEM secret exists, offer to reuse.
- If found but PEM is lost, return an error.
- If not found, run the manifest flow to create a new app.
- After creation, ensure the app is installed on the org.
func (*Setup) WithKnownSlugs ¶
WithKnownSlugs sets a mapping of role → app slug for matching existing installations that don't follow the default naming convention.
func (*Setup) WithSecretExists ¶
func (s *Setup) WithSecretExists(fn SecretExistsFunc) *Setup
WithSecretExists sets the function used to check whether a private key secret already exists for a given role.
type StdinPrompter ¶
type StdinPrompter struct{}
StdinPrompter reads user input from stdin.
func (StdinPrompter) WaitForEnter ¶
func (StdinPrompter) WaitForEnter(prompt string) error