onboarding

package
v0.260507.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(router *swagger.RouteGroup, handler *Handler)

RegisterRoutes wires the onboarding endpoints onto a swagger route group. The route group is expected to already carry the user auth middleware.

Types

type ErrorDetail

type ErrorDetail struct {
	Message string `json:"message"`
	Type    string `json:"type,omitempty"`
}

ErrorDetail is a minimal error envelope. Kept local to the module so the onboarding API does not depend on internal server types.

type ExtractData

type ExtractData struct {
	URLs   []string         `json:"urls"`
	Tokens []TokenCandidate `json:"tokens"`
}

ExtractData is the inner payload returned by the extractor. It is a flat list of detected URLs and tokens — provider matching, if any, is done on the client side after the user picks values.

type ExtractRequest

type ExtractRequest struct {
	Input string `json:"input"`
}

ExtractRequest is the body for POST /api/v1/onboarding/extract.

type ExtractResponse

type ExtractResponse struct {
	Success bool         `json:"success"`
	Data    *ExtractData `json:"data,omitempty"`
	Error   *ErrorDetail `json:"error,omitempty"`
}

ExtractResponse mirrors the rest of the v1 envelope shape used elsewhere.

type Extractor

type Extractor interface {
	Extract(ctx context.Context, input string) (data ExtractData, err error)
}

Extractor is the contract handlers depend on. v1 ships a pure rule-based implementation; future variants (LLM-assisted, model-based) can satisfy the same contract without changing the handler or wire format.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler serves the onboarding extraction endpoint.

func NewHandler

func NewHandler(extractor Extractor) *Handler

NewHandler creates a new onboarding handler. The extractor is injected so tests and future variants (LLM-assisted, model-based) can swap in a different implementation without touching the route.

func (*Handler) Extract

func (h *Handler) Extract(c *gin.Context)

Extract parses an arbitrary text blob (env file, curl, snippet from docs, etc.) and returns the URLs and possible API tokens it finds. The extraction is vendor-agnostic; the user picks which URL and which token to use in the dialog.

type RuleExtractor

type RuleExtractor struct{}

RuleExtractor implements Extractor with pure regex matching. No LLM, no network calls, no vendor-specific assumptions.

func NewRuleExtractor

func NewRuleExtractor() *RuleExtractor

NewRuleExtractor builds a new RuleExtractor. The signature accepts a dependency placeholder (any) for future-proofing — the v1 implementation has no dependencies.

func (*RuleExtractor) Extract

func (e *RuleExtractor) Extract(_ context.Context, input string) (ExtractData, error)

Extract scans the input text for URLs and possible API tokens. It is deliberately vendor-agnostic: no scoring, no provider matching, no warnings. The caller decides what to do with the raw signals.

type TokenCandidate

type TokenCandidate struct {
	Value   string `json:"value"`
	Preview string `json:"preview"`
	Source  string `json:"source"` // bearer | x-api-key | env:NAME | json:api_key | key_prefix
}

TokenCandidate is a possible API token found in the input. The extractor stays vendor-agnostic — it just reports what it saw and where it came from. The user picks which one (if any) to use.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL