Documentation
¶
Index ¶
- func DefaultAppKey() string
- func IsSupabaseCLIAuthenticated() bool
- func ModelRefTableName(name string) string
- func RevokeSupabase(store *IntegrationStore, appName string) error
- func SetupSupabase(store *IntegrationStore, appName string, printFn func(level, msg string), ...) error
- func SetupSupabaseManual(store *IntegrationStore, appName string, readLineFn func(label string) string, ...) error
- type ActiveProvider
- type BackendNeeds
- type CuratedIntegration
- type IntegrationConfig
- type IntegrationStatus
- type IntegrationStore
- func (s *IntegrationStore) AllAppNames(id ProviderID) []string
- func (s *IntegrationStore) AllStatuses() []IntegrationStatus
- func (s *IntegrationStore) GetProvider(id ProviderID, appName string) (*IntegrationConfig, error)
- func (s *IntegrationStore) Load() error
- func (s *IntegrationStore) RemoveProvider(id ProviderID, appName string) error
- func (s *IntegrationStore) SetProvider(cfg IntegrationConfig, appName string) error
- type MCPCapable
- type MCPRequest
- type MCPServerConfig
- type Manager
- func (m *Manager) AgentTools(active []ActiveProvider) []string
- func (m *Manager) AllProviders() []Provider
- func (m *Manager) GetProvider(id ProviderID) (Provider, bool)
- func (m *Manager) MCPConfigs(ctx context.Context, active []ActiveProvider) ([]MCPServerConfig, error)
- func (m *Manager) MCPToolAllowlist(active []ActiveProvider) []string
- func (m *Manager) PromptContributions(ctx context.Context, req PromptRequest, active []ActiveProvider) ([]PromptContribution, error)
- func (m *Manager) Provision(ctx context.Context, req ProvisionRequest, active []ActiveProvider) (*ProvisionResult, error)
- func (m *Manager) Resolve(ctx context.Context, appName string, planned []string, ui SetupUI) ([]ActiveProvider, error)
- func (m *Manager) ResolveExisting(appName string) []ActiveProvider
- func (m *Manager) Store() *IntegrationStore
- type ModelRef
- type MonetizationPlan
- type MonetizationProduct
- type PromptCapable
- type PromptContribution
- type PromptRequest
- type PropertyRef
- type Provider
- type ProviderID
- type ProviderMeta
- type ProviderStatus
- type ProvisionCapable
- type ProvisionRequest
- type ProvisionResult
- type Registry
- type SetupCapable
- type SetupRequest
- type SetupUI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAppKey ¶
func DefaultAppKey() string
DefaultAppKey returns the key used for migrated legacy configs.
func IsSupabaseCLIAuthenticated ¶
func IsSupabaseCLIAuthenticated() bool
IsSupabaseCLIAuthenticated checks if the Supabase CLI is already logged in by trying to list projects. If it succeeds, we're authenticated.
func ModelRefTableName ¶
ModelRefTableName converts a PascalCase model name to a snake_case plural table name.
func RevokeSupabase ¶
func RevokeSupabase(store *IntegrationStore, appName string) error
RevokeSupabase fully removes all Supabase credentials and config for an app: keyring entries, cached PAT file, and the integration config from the store.
func SetupSupabase ¶
func SetupSupabase( store *IntegrationStore, appName string, printFn func(level, msg string), pickFn func(title string, options []string) string, ) error
SetupSupabase runs the fully automatic Supabase credential flow: 1. supabase login (browser auth, skipped if already authenticated) 2. supabase orgs list (auto-select if one, picker if multiple) 3. supabase projects create (auto-create with appName) 4. supabase projects api-keys (extract anon key) 5. Validate + store
appName is used as the Supabase project name. If empty, defaults to "my-app". printFn and pickFn are injected for testability.
func SetupSupabaseManual ¶
func SetupSupabaseManual( store *IntegrationStore, appName string, readLineFn func(label string) string, printFn func(level, msg string), ) error
SetupSupabaseManual lets the user enter Supabase credentials directly. appName scopes the credentials to a specific app project. readLineFn prompts for and reads a single line of input.
Types ¶
type ActiveProvider ¶
type ActiveProvider struct {
Provider Provider
Config *IntegrationConfig
}
ActiveProvider pairs a resolved provider with its per-app config.
type BackendNeeds ¶
type BackendNeeds struct {
Auth bool `json:"auth"`
AuthMethods []string `json:"auth_methods,omitempty"` // "email", "apple", "google", "anonymous"
DB bool `json:"db"`
Storage bool `json:"storage"`
}
BackendNeeds indicates which backend capabilities an app requires.
func (*BackendNeeds) NeedsBackend ¶
func (b *BackendNeeds) NeedsBackend() bool
NeedsBackend returns true if any backend capability is required.
type CuratedIntegration ¶
type CuratedIntegration struct {
ID ProviderID
Name string
Description string
SPMPackage string // key in package_registry.go
MCPCommand string // e.g. "nanowave"
MCPArgs []string // e.g. ["mcp", "supabase"]
DocsMCPPkg string // NPM package for docs MCP (optional)
}
CuratedIntegration describes a backend integration provider with its tooling.
func AllIntegrations ¶
func AllIntegrations() []*CuratedIntegration
AllIntegrations returns all available integrations in a stable order.
func LookupIntegration ¶
func LookupIntegration(id ProviderID) *CuratedIntegration
LookupIntegration returns the curated integration for a provider ID, or nil.
type IntegrationConfig ¶
type IntegrationConfig struct {
Provider ProviderID `json:"provider"`
ProjectURL string `json:"project_url"` // https://xyz.supabase.co
ProjectRef string `json:"project_ref"` // xyz (extracted from URL)
AnonKey string `json:"anon_key"` // public anon key
PAT string `json:"pat,omitempty"` // Personal Access Token for MCP
}
IntegrationConfig stores credentials and connection details for a backend provider.
type IntegrationStatus ¶
type IntegrationStatus struct {
Provider ProviderID `json:"provider"`
AppName string `json:"app_name,omitempty"`
Configured bool `json:"configured"`
ProjectURL string `json:"project_url,omitempty"`
HasAnonKey bool `json:"has_anon_key"`
HasPAT bool `json:"has_pat"`
ValidatedAt string `json:"validated_at,omitempty"`
}
IntegrationStatus summarizes the configuration state of a provider for a specific app.
type IntegrationStore ¶
type IntegrationStore struct {
// contains filtered or unexported fields
}
IntegrationStore persists integration configs to ~/.nanowave/integrations.json. Sensitive fields (PAT) are stored in the OS keychain (or file fallback) and replaced with "secret:<key>" references in the JSON file.
func NewIntegrationStore ¶
func NewIntegrationStore(nanowaveRoot string) *IntegrationStore
NewIntegrationStore creates a store rooted at the given directory. It initializes the best available secret store (OS keychain or file fallback).
func NewIntegrationStoreWithSecrets ¶
func NewIntegrationStoreWithSecrets(nanowaveRoot string, ss secrets.SecretStore) *IntegrationStore
NewIntegrationStoreWithSecrets creates a store with a custom secret store (for testing).
func (*IntegrationStore) AllAppNames ¶
func (s *IntegrationStore) AllAppNames(id ProviderID) []string
AllAppNames returns all configured app names for a given provider.
func (*IntegrationStore) AllStatuses ¶
func (s *IntegrationStore) AllStatuses() []IntegrationStatus
AllStatuses returns the status of every known provider. Shows per-app statuses for providers with configured apps.
func (*IntegrationStore) GetProvider ¶
func (s *IntegrationStore) GetProvider(id ProviderID, appName string) (*IntegrationConfig, error)
GetProvider returns the config for a provider and app name, or nil if not configured. Secret references in the PAT field are resolved from the secret store transparently.
func (*IntegrationStore) Load ¶
func (s *IntegrationStore) Load() error
Load reads the store from disk. Missing file is not an error. Automatically migrates old flat format (provider → config) to new per-app format.
func (*IntegrationStore) RemoveProvider ¶
func (s *IntegrationStore) RemoveProvider(id ProviderID, appName string) error
RemoveProvider deletes a provider config for a specific app. Also removes the corresponding secret from the secret store.
func (*IntegrationStore) SetProvider ¶
func (s *IntegrationStore) SetProvider(cfg IntegrationConfig, appName string) error
SetProvider stores or updates a provider config for a specific app. The PAT is automatically moved to the secret store and replaced with a reference.
type MCPCapable ¶
type MCPCapable interface {
// MCPServer returns the MCP server configuration for this provider.
MCPServer(ctx context.Context, req MCPRequest) (*MCPServerConfig, error)
// MCPTools returns MCP tool names for settings allowlist (e.g. "mcp__supabase__execute_sql").
MCPTools() []string
// AgentTools returns tools for the agentic build allowlist.
AgentTools() []string
}
MCPCapable providers expose an MCP server with tools.
type MCPRequest ¶
type MCPRequest struct {
PAT string
ProjectURL string // provider-specific project ID (e.g. Supabase URL, RevenueCat project ID)
ProjectRef string // provider-specific secondary ref (e.g. Supabase ref, RevenueCat app ID)
}
MCPRequest holds parameters for MCP server configuration.
type MCPServerConfig ¶
type MCPServerConfig struct {
Name string // server name key (e.g. "supabase")
Command string // executable (e.g. "nanowave")
Args []string // arguments (e.g. ["mcp", "supabase"])
Env map[string]string // environment variables
}
MCPServerConfig describes an MCP server entry for .mcp.json.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the single facade orchestration uses for all integration operations. Pattern: database/sql.DB wraps driver internals, Docker CLI's command.Cli interface. Pipeline calls Manager methods; Manager iterates providers and type-asserts capabilities.
func NewManager ¶
func NewManager(registry *Registry, store *IntegrationStore) *Manager
NewManager creates a Manager backed by the given registry and store.
func (*Manager) AgentTools ¶
func (m *Manager) AgentTools(active []ActiveProvider) []string
AgentTools returns the combined agentic tool allowlist for all active providers. Pattern: Caddy type-asserts guest modules to check capabilities.
func (*Manager) AllProviders ¶
AllProviders returns all registered providers.
func (*Manager) GetProvider ¶
func (m *Manager) GetProvider(id ProviderID) (Provider, bool)
GetProvider returns a provider by ID from the registry.
func (*Manager) MCPConfigs ¶
func (m *Manager) MCPConfigs(ctx context.Context, active []ActiveProvider) ([]MCPServerConfig, error)
MCPConfigs returns MCP server configurations for all active providers.
func (*Manager) MCPToolAllowlist ¶
func (m *Manager) MCPToolAllowlist(active []ActiveProvider) []string
MCPToolAllowlist returns the combined MCP tool allowlist for all active providers.
func (*Manager) PromptContributions ¶
func (m *Manager) PromptContributions(ctx context.Context, req PromptRequest, active []ActiveProvider) ([]PromptContribution, error)
PromptContributions collects prompt content from all active providers.
func (*Manager) Provision ¶
func (m *Manager) Provision(ctx context.Context, req ProvisionRequest, active []ActiveProvider) (*ProvisionResult, error)
Provision runs backend provisioning for all active providers that support it.
func (*Manager) Resolve ¶
func (m *Manager) Resolve(ctx context.Context, appName string, planned []string, ui SetupUI) ([]ActiveProvider, error)
Resolve resolves planned integration IDs into active providers with their configs. For each planned ID, it looks up the config from the store. If no config exists, it calls the SetupUI callback to let the user configure the provider.
func (*Manager) ResolveExisting ¶
func (m *Manager) ResolveExisting(appName string) []ActiveProvider
ResolveExisting returns active providers that already have stored configs for the given app. Unlike Resolve, this never prompts for setup — it silently skips providers with no config. Used by the Edit/Fix flows where the project was already built and integrations were configured during the original build.
func (*Manager) Store ¶
func (m *Manager) Store() *IntegrationStore
Store returns the underlying IntegrationStore.
type ModelRef ¶
type ModelRef struct {
Name string
Storage string
Properties []PropertyRef
}
ModelRef is a bridge type mirroring orchestration.ModelPlan fields. Avoids circular import: orchestration → integrations → orchestration. Pipeline converts at the call boundary (like sql.DB → driver.Value).
type MonetizationPlan ¶
type MonetizationPlan struct {
Model string
Products []MonetizationProduct
Entitlement string
FreeCredits int
}
MonetizationPlan is a bridge type mirroring orchestration.MonetizationPlan. Avoids circular import: orchestration → integrations → orchestration.
type MonetizationProduct ¶
type MonetizationProduct struct {
Identifier string
Type string
DisplayName string
Price string
Credits int
Duration string
}
MonetizationProduct mirrors orchestration.ProductPlan fields.
type PromptCapable ¶
type PromptCapable interface {
// PromptContribution generates prompt content for the build phase.
PromptContribution(ctx context.Context, req PromptRequest) (*PromptContribution, error)
}
PromptCapable providers can contribute content to the build prompt.
type PromptContribution ¶
type PromptContribution struct {
// SystemBlock is content appended to the system prompt (e.g. <integration-config>).
SystemBlock string
// UserBlock is content injected into the user message (e.g. backend-first instructions).
UserBlock string
// BackendProvisioned signals whether the backend was already provisioned.
BackendProvisioned bool
}
PromptContribution is the output of a provider's prompt generation.
type PromptRequest ¶
type PromptRequest struct {
AppName string
Models []ModelRef
AuthMethods []string
Store *IntegrationStore
BackendProvisioned bool
MonetizationPlan *MonetizationPlan // product/subscription plan from planner
}
PromptRequest holds parameters for generating prompt contributions.
type PropertyRef ¶
PropertyRef mirrors orchestration.PropertyPlan fields.
type Provider ¶
type Provider interface {
// ID returns the unique provider identifier (e.g. ProviderSupabase).
ID() ProviderID
// Meta returns display metadata for the provider.
Meta() ProviderMeta
}
Provider is the base interface every integration provider implements. Pattern: database/sql driver.Driver — minimal required contract.
type ProviderID ¶
type ProviderID string
ProviderID identifies a backend integration provider.
const ( ProviderSupabase ProviderID = "supabase" ProviderRevenueCat ProviderID = "revenuecat" )
type ProviderMeta ¶
type ProviderMeta struct {
Name string // Human-readable name (e.g. "Supabase")
Description string // Short description
SPMPackage string // SPM package key (e.g. "supabase-swift")
MCPCommand string // MCP server command (e.g. "nanowave")
MCPArgs []string // MCP server args (e.g. ["mcp", "supabase"])
DocsMCPPkg string // NPM package for docs MCP (optional)
}
ProviderMeta holds display and tooling metadata for a provider.
type ProviderStatus ¶
type ProviderStatus struct {
Configured bool
ProjectURL string
HasAnonKey bool
HasPAT bool
ValidatedAt string
}
ProviderStatus summarizes provider state for an app.
type ProvisionCapable ¶
type ProvisionCapable interface {
// Provision creates backend resources (tables, auth, storage, etc).
Provision(ctx context.Context, req ProvisionRequest) (*ProvisionResult, error)
}
ProvisionCapable providers can auto-provision backend resources.
type ProvisionRequest ¶
type ProvisionRequest struct {
PAT string
ProjectURL string // provider-specific project ID (e.g. Supabase URL, RevenueCat project ID)
ProjectRef string // provider-specific secondary ref (e.g. Supabase ref, RevenueCat app ID)
AppName string
BundleID string
Models []ModelRef
AuthMethods []string
NeedsAuth bool
NeedsDB bool
NeedsStorage bool
NeedsRealtime bool
NeedsMonetization bool // in-app purchases / subscriptions
MonetizationType string // "subscription", "consumable", "hybrid"
MonetizationPlan *MonetizationPlan // product definitions from planner
}
ProvisionRequest holds parameters for backend provisioning.
type ProvisionResult ¶
type ProvisionResult struct {
BackendProvisioned bool
NeedsAppleSignIn bool
TablesCreated []string
Warnings []string
}
ProvisionResult holds the outcome of backend provisioning.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds registered integration providers. Pattern: database/sql Register() + sync.RWMutex-protected map. At 3-5 providers, explicit registration is more traceable than init() magic.
type SetupCapable ¶
type SetupCapable interface {
// Setup runs the interactive setup flow for a provider.
Setup(ctx context.Context, req SetupRequest) error
// Remove removes the provider config for an app.
Remove(ctx context.Context, store *IntegrationStore, appName string) error
// Status returns the current status for an app.
Status(ctx context.Context, store *IntegrationStore, appName string) (ProviderStatus, error)
// CLIAvailable returns true if the provider's CLI tool is installed.
CLIAvailable() bool
}
SetupCapable providers can be configured, removed, and queried for status via CLI.
type SetupRequest ¶
type SetupRequest struct {
Store *IntegrationStore
AppName string
Manual bool
ReadLineFn func(label string) string
PrintFn func(level, msg string)
PickFn func(title string, options []string) string
}
SetupRequest holds parameters for the Setup flow.
type SetupUI ¶
type SetupUI interface {
// PromptSetup handles first-time setup for a provider. Returns config or nil if skipped.
PromptSetup(ctx context.Context, sc SetupCapable, p Provider, store *IntegrationStore, appName string) *IntegrationConfig
// ValidateExisting validates an existing config, refreshing if needed. Returns updated config or nil.
ValidateExisting(ctx context.Context, sc SetupCapable, p Provider, store *IntegrationStore, appName string, cfg *IntegrationConfig) *IntegrationConfig
// Info prints an informational message.
Info(msg string)
// Warning prints a warning message.
Warning(msg string)
}
SetupUI abstracts the user interaction during integration resolution. The pipeline implements this to bridge terminal UI calls.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package providers registers all integration providers.
|
Package providers registers all integration providers. |
|
revenuecat
Package revenuecat implements the integration Provider for RevenueCat.
|
Package revenuecat implements the integration Provider for RevenueCat. |
|
supabase
Package supabase implements the integration Provider for Supabase.
|
Package supabase implements the integration Provider for Supabase. |
|
Package secrets provides secure storage for sensitive credentials like PATs.
|
Package secrets provides secure storage for sensitive credentials like PATs. |