cmd

package
v0.1.0-alpha.51 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "0.1.0-alpha.51" // x-release-please-version

Variables

View Source
var (
	Command       *cli.Command
	OutputFormats = []string{"auto", "explore", "json", "pretty", "raw", "yaml"}
)
View Source
var ErrUserCancelled = errors.New("user cancelled")

Functions

func ConfigDir

func ConfigDir() (string, error)

ConfigDir returns the directory where config files are stored

func Confirm

func Confirm(cmd *cli.Command, flagName, title, description string, defaultValue bool) (bool, error)

func GetFormKeyMap

func GetFormKeyMap() *huh.KeyMap

GetFormKeyMap returns the standard huh keymap used across all forms

func GetFormTheme

func GetFormTheme(indent int) *huh.Theme

GetFormTheme returns the standard huh theme used across all forms

func Hyperlink(url, text string) string

func Rel

func Rel(basepath, targpath string) string

Rel returns a relative path similar to filepath.Rel but with custom behavior: - If target is empty, returns empty string - If relative path doesn't start with "../", it prefixes with "./"

func SError

func SError(indent int, format string, args ...any) string

func SHeader

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

func SInfo

func SInfo(indent int, format string, args ...any) string

func SProgress

func SProgress(indent int, format string, args ...any) string

func SProperty

func SProperty(indent int, key, msg string) string

func SSuccess

func SSuccess(indent int, format string, args ...any) string

func SWarn

func SWarn(indent int, format string, args ...any) string

func ShowJSON

func ShowJSON(title string, res gjson.Result, format string, transform string) error

func Spacer

func Spacer()

func ViewBuildPipeline

func ViewBuildPipeline(build *stainless.Build, target stainless.Target, downloads map[stainless.Target]struct {
	status string
	path   string
}) string

func ViewDiagnosticIcon

func ViewDiagnosticIcon(level stainless.BuildDiagnosticLevel) string

func ViewDiagnosticsPrint

func ViewDiagnosticsPrint(diagnostics []stainless.BuildDiagnostic, maxDiagnostics int) string

func ViewStepSymbol

func ViewStepSymbol(status, conclusion string) string

Types

type AuthConfig

type AuthConfig struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token,omitempty"`
	TokenType    string `json:"token_type"`

	ConfigPath string `json:"-"`
}

AuthConfig stores the OAuth credentials

func NewAuthConfig

func NewAuthConfig() (*AuthConfig, error)

NewAuthConfig creates a new AuthConfig with ConfigPath populated. Use this when creating a new config that you plan to save. For loading existing configs, use &AuthConfig{} and call Find() or Load().

func (*AuthConfig) Exists

func (config *AuthConfig) Exists() bool

Exists checks if the auth config file exists

func (*AuthConfig) Find

func (config *AuthConfig) Find() (bool, error)

Find searches for and loads the auth config from the standard location. Returns (true, nil) if config file exists and was successfully loaded. Returns (false, nil) if config file doesn't exist or is empty (not an error). Returns (false, error) if config file exists but failed to load due to an error.

func (*AuthConfig) Load

func (config *AuthConfig) Load(configPath string) error

Load loads the auth config from a specific path. Returns nil if the file doesn't exist (not treated as an error). Returns nil if the file exists but is empty (not treated as an error). Returns error only if the file exists but fails to parse or read. Only sets ConfigPath if a valid config with AccessToken is successfully loaded.

func (*AuthConfig) Remove

func (config *AuthConfig) Remove() error

Remove removes the auth config file

func (*AuthConfig) Save

func (config *AuthConfig) Save() error

Save saves the auth config to disk

type Build

type Build struct {
	*stainless.Build
}

Build wraps stainless.Build to provide convenience methods

func NewBuild

func NewBuild(build *stainless.Build) *Build

NewBuild creates a new Build wrapper

func (*Build) BuildTarget

func (b *Build) BuildTarget(target stainless.Target) *BuildTarget

BuildTarget returns the build target wrapper for a given target type, replacing getBuildTarget

func (*Build) IsCompleted

func (b *Build) IsCompleted() bool

IsCompleted checks if the entire build is completed (all targets)

func (*Build) Languages

func (b *Build) Languages() []stainless.Target

Languages returns all available build languages/targets for this build

type BuildModel

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

BuildModel represents the bubbletea model for build monitoring

func NewBuildModel

func NewBuildModel(cc *apiCommandContext, ctx context.Context, branch string, fn func() (*stainless.Build, error)) BuildModel

func (BuildModel) FullHelp

func (m BuildModel) FullHelp() [][]key.Binding

func (BuildModel) Init

func (m BuildModel) Init() tea.Cmd

func (BuildModel) ShortHelp

func (m BuildModel) ShortHelp() []key.Binding

func (BuildModel) Update

func (m BuildModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (BuildModel) View

func (m BuildModel) View() string

type BuildTarget

type BuildTarget struct {
	*stainless.BuildTarget
	// contains filtered or unexported fields
}

BuildTarget wraps stainless.BuildTarget to provide convenience methods

func NewBuildTarget

func NewBuildTarget(buildTarget *stainless.BuildTarget, target stainless.Target) *BuildTarget

NewBuildTarget creates a new BuildTarget wrapper

func (*BuildTarget) IsCommitCompleted

func (bt *BuildTarget) IsCommitCompleted() bool

IsCommitCompleted checks if the commit step is completed

func (*BuildTarget) IsCompleted

func (bt *BuildTarget) IsCompleted() bool

IsCompleted checks if all steps in this build target are completed

func (*BuildTarget) IsInProgress

func (bt *BuildTarget) IsInProgress() bool

IsInProgress checks if any step in this build target is in progress

func (*BuildTarget) StepInfo

func (bt *BuildTarget) StepInfo(step string) (status, url, conclusion string)

StepInfo extracts status, url, and conclusion from a step union

func (*BuildTarget) StepUnion

func (bt *BuildTarget) StepUnion(step string) any

StepUnion returns the step union for a given step name

func (*BuildTarget) Steps

func (bt *BuildTarget) Steps() []string

Steps returns all available steps for this build target

func (*BuildTarget) Target

func (bt *BuildTarget) Target() stainless.Target

Target returns the target type (node, python, etc.)

type BuildTargetInfo

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

BuildTargetInfo holds information about a build target

type GenerateSpecParams

type GenerateSpecParams struct {
	Project string `json:"project"`
	Source  struct {
		Type            string `json:"type"`
		OpenAPISpec     string `json:"openapi_spec"`
		StainlessConfig string `json:"stainless_config"`
	} `json:"source"`
}

type Group

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

Group represents a nested logging group

func Error

func Error(format string, args ...any) Group
func Header(format string, args ...any) Group

func Info

func Info(format string, args ...any) Group

func Progress

func Progress(format string, args ...any) Group

func Property

func Property(key, msg string) Group

func Success

func Success(format string, args ...any) Group

func Warn

func Warn(format string, args ...any) Group

func (Group) Confirm

func (g Group) Confirm(cmd *cli.Command, flagName, title, description string, defaultValue bool) (bool, Group, error)

func (Group) Error

func (g Group) Error(format string, args ...any) Group

func (Group) Info

func (g Group) Info(format string, args ...any) Group

func (Group) Progress

func (g Group) Progress(format string, args ...any) Group

func (Group) Property

func (g Group) Property(key, msg string) Group

func (Group) Success

func (g Group) Success(format string, args ...any) Group

func (Group) Warn

func (g Group) Warn(format string, args ...any) Group

type TargetConfig

type TargetConfig struct {
	OutputPath string `json:"output_path"`
}

TargetConfig stores configuration for a specific SDK target

type TargetInfo

type TargetInfo struct {
	DisplayName     string
	Name            string
	DefaultSelected bool
}

TargetInfo represents a target with its display name and default selection

type WorkspaceConfig

type WorkspaceConfig struct {
	Project         string                   `json:"project"`
	OpenAPISpec     string                   `json:"openapi_spec,omitempty"`
	StainlessConfig string                   `json:"stainless_config,omitempty"`
	Targets         map[string]*TargetConfig `json:"targets,omitempty"`

	ConfigPath string `json:"-"`
}

WorkspaceConfig stores workspace-level configuration

func NewWorkspaceConfig

func NewWorkspaceConfig(projectName, openAPISpecPath, stainlessConfigPath string) (WorkspaceConfig, error)

func (*WorkspaceConfig) Find

func (config *WorkspaceConfig) Find() (bool, error)

Find searches for a stainless-workspace.json file starting from the current directory and moving up to parent directories until found or root is reached

func (*WorkspaceConfig) Load

func (config *WorkspaceConfig) Load(configPath string) error

func (*WorkspaceConfig) Save

func (config *WorkspaceConfig) Save() error

Jump to

Keyboard shortcuts

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