Skip to content

How to wire custom completion

package predict is a standalone SDK for generating completion candidates. Library authors can import it on its own to ship predictors for their types.

import "github.com/conga-sh/conga/predict"

Registry style — register a named predictor on the app and reference it from struct tags:

app.Predictor("region", predict.Values("us-east-1", "us-west-2", "eu-central-1"))
type Deploy struct {
Region conga.OptionalFlag[string] `predictor:"region" help:"Target region"`
}

Self-completing style — implement Predictable, or TagAwarePredictable when candidates depend on the field’s declared tags, on the type itself. This is how the built-in domain types work — see Domain Types and How to extend with custom types, maps & decoders.

Both styles resolve to the same predictor values; the package predict reference catalogues every constructor, combinator, context helper, and directive.