commands

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAPIURL = "https://studio.taufinity.io"

DefaultAPIURL is the default Taufinity API endpoint.

Variables

View Source
var (
	Version   = "dev"
	GitCommit = "unknown"
	BuildTime = "unknown"
)

Build-time variables (set via ldflags). Kept as package-level vars so the Makefile's -X linker flags still work; buildinfo.FromBuildtime falls back to debug.BuildInfo when they're left at their defaults.

Functions

func Execute

func Execute() error

Execute runs the root command.

func GetAPIURL

func GetAPIURL() string

GetAPIURL returns the resolved API URL.

func GetFormat

func GetFormat() string

GetFormat returns the output format.

func GetOrg

func GetOrg() string

GetOrg returns the resolved organization ID.

func GetSite

func GetSite() string

GetSite returns the resolved site ID.

func IsDebug

func IsDebug() bool

IsDebug returns whether debug mode is enabled.

func IsDryRun

func IsDryRun() bool

IsDryRun returns whether dry-run mode is enabled.

func IsQuiet

func IsQuiet() bool

IsQuiet returns whether quiet mode is enabled.

func Print

func Print(format string, args ...any)

Print prints a message unless quiet mode is enabled.

func PrintLn

func PrintLn(msg string)

PrintLn prints a line unless quiet mode is enabled.

func RunStdioBridge

func RunStdioBridge(ctx context.Context, cfg StdioBridgeConfig) error

RunStdioBridge runs the stdio bridge against the configured upstream. It blocks until ctx is canceled, stdin reaches EOF, or a fatal error occurs.

func SetSite

func SetSite(site string)

SetSite sets the site from project config (taufinity.yaml). Project config overrides user config but not flag or env.

Types

type DeviceCodeResponse

type DeviceCodeResponse struct {
	DeviceCode      string `json:"device_code"`
	UserCode        string `json:"user_code"`
	VerificationURI string `json:"verification_uri"`
	ExpiresIn       int    `json:"expires_in"`
	Interval        int    `json:"interval"`
}

DeviceCodeResponse matches the API response.

type DeviceCodeStatusResponse

type DeviceCodeStatusResponse struct {
	Status           string     `json:"status"`
	AccessToken      string     `json:"access_token,omitempty"`
	RefreshToken     string     `json:"refresh_token,omitempty"`
	ExpiresAt        *time.Time `json:"expires_at,omitempty"`
	Email            string     `json:"email,omitempty"`
	OrganizationName string     `json:"organization_name,omitempty"`
}

DeviceCodeStatusResponse matches the API response.

type StdioBridgeConfig

type StdioBridgeConfig struct {
	UpstreamURL   string
	TokenSource   TokenSource
	Token         string // static fallback; ignored if TokenSource is set
	OrgID         string // if set, sends X-Organization-ID on every request
	UserAgent     string
	Timeout       time.Duration
	MaxFrameBytes int // 0 → defaultMaxFrameBytes
	Stdin         io.Reader
	Stdout        io.Writer
	Stderr        io.Writer
}

StdioBridgeConfig configures the stdio MCP bridge.

Either TokenSource or Token may be set. TokenSource is preferred — it is called per-request so a token rotated outside the process (e.g. user re-running `taufinity auth login`) is picked up without restarting the bridge. Token is a static fallback for tests and embedded callers; it never expires for the bridge's purposes.

type TokenSource

type TokenSource func(ctx context.Context) (token string, expiresAt time.Time, err error)

TokenSource produces a bearer token for the upstream /mcp endpoint. It is called once per outbound HTTP request (via WithHTTPHeaderFunc), with results cached in-memory until the token is within tokenRefreshLeeway of expiry. Implementations should be cheap (single file read) but safe to call concurrently. Returning an error suppresses the Authorization header for that request, surfacing a clear upstream 401 to the client rather than silently sending a stale bearer.

Jump to

Keyboard shortcuts

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