Documentation
¶
Index ¶
- Constants
- Variables
- func ColorizeJSON(input string, w io.Writer) string
- func ConfigDir() (string, error)
- func Confirm(cmd *cli.Command, flagName, title, description string, defaultValue bool) (bool, error)
- func GetFormKeyMap() *huh.KeyMap
- func GetFormTheme(indent int) *huh.Theme
- func Hyperlink(url, text string) string
- func SError(indent int, format string, args ...any) string
- func SHeader(format string, args ...any) string
- func SInfo(indent int, format string, args ...any) string
- func SProgress(indent int, format string, args ...any) string
- func SProperty(indent int, key, msg string) string
- func SSuccess(indent int, format string, args ...any) string
- func SWarn(indent int, format string, args ...any) string
- func SaveAuthConfig(config *AuthConfig) error
- func Spacer()
- func ViewBuildPipeline(build *stainless.BuildObject, target stainless.Target, ...) string
- func ViewDiagnosticIcon(level stainless.BuildDiagnosticListResponseLevel) string
- func ViewDiagnosticsPrint(diagnostics []stainless.BuildDiagnosticListResponse) string
- func ViewHelpMenu() string
- func ViewStepSymbol(status, conclusion string) string
- type AuthConfig
- type BuildModel
- type BuildTargetInfo
- type Group
- func Error(format string, args ...any) Group
- func Header(format string, args ...any) Group
- func Info(format string, args ...any) Group
- func Progress(format string, args ...any) Group
- func Property(key, msg string) Group
- func Success(format string, args ...any) Group
- func Warn(format string, args ...any) Group
- func (g Group) Error(format string, args ...any) Group
- func (g Group) Info(format string, args ...any) Group
- func (g Group) Progress(format string, args ...any) Group
- func (g Group) Property(key, msg string) Group
- func (g Group) Success(format string, args ...any) Group
- func (g Group) Warn(format string, args ...any) Group
- type TargetConfig
- type TargetInfo
- type WorkspaceConfig
Constants ¶
const Version = "0.1.0-alpha.33" // x-release-please-version
Variables ¶
var Command = cli.Command{ Name: "stl", Usage: "CLI for the stainless API", Version: Version, Flags: []cli.Flag{ &cli.BoolFlag{ Name: "debug", Usage: "Enable debug logging", }, &cli.StringFlag{ Name: "base-url", Usage: "Override the base URL for API requests", }, &cli.StringFlag{ Name: "environment", Usage: "Set the environment for API requests", }, }, Commands: []*cli.Command{ { Name: "auth", Commands: []*cli.Command{ &authLogin, &authLogout, &authStatus, }, }, { Name: "workspace", Commands: []*cli.Command{ &workspaceInit, &workspaceStatus, }, }, { Name: "projects", Category: "API RESOURCE", Commands: []*cli.Command{ &projectsCreate, &projectsRetrieve, &projectsUpdate, &projectsList, }, }, { Name: "projects:branches", Category: "API RESOURCE", Commands: []*cli.Command{ &projectsBranchesCreate, &projectsBranchesRetrieve, &projectsBranchesList, &projectsBranchesDelete, }, }, { Name: "projects:configs", Category: "API RESOURCE", Commands: []*cli.Command{ &projectsConfigsRetrieve, &projectsConfigsGuess, }, }, { Name: "builds", Category: "API RESOURCE", Commands: []*cli.Command{ &buildsCreate, &buildsRetrieve, &buildsList, &buildsCompare, }, }, { Name: "builds:diagnostics", Category: "API RESOURCE", Commands: []*cli.Command{ &buildsDiagnosticsList, }, }, { Name: "builds:target_outputs", Category: "API RESOURCE", Commands: []*cli.Command{ &buildsTargetOutputsRetrieve, }, }, { Name: "orgs", Category: "API RESOURCE", Commands: []*cli.Command{ &orgsRetrieve, &orgsList, }, }, &initCommand, &mcpCommand, &devCommand, }, EnableShellCompletion: true, HideHelpCommand: true, }
var ErrUserCancelled = errors.New("user cancelled")
Functions ¶
func Confirm ¶
func Confirm(cmd *cli.Command, flagName, title, description string, defaultValue bool) (bool, error)
Confirm prompts the user with a yes/no question if the flag wasn't explicitly set
func GetFormKeyMap ¶
GetFormKeyMap returns the standard huh keymap used across all forms
func GetFormTheme ¶
GetFormTheme returns the standard huh theme used across all forms
func SaveAuthConfig ¶
func SaveAuthConfig(config *AuthConfig) error
SaveAuthConfig saves the auth config to disk
func ViewBuildPipeline ¶
func ViewDiagnosticIcon ¶
func ViewDiagnosticIcon(level stainless.BuildDiagnosticListResponseLevel) string
func ViewDiagnosticsPrint ¶
func ViewDiagnosticsPrint(diagnostics []stainless.BuildDiagnosticListResponse) string
func ViewHelpMenu ¶
func ViewHelpMenu() string
ViewHelpMenu creates a styled help menu inspired by huh help component
func ViewStepSymbol ¶
Types ¶
type AuthConfig ¶
type AuthConfig struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token,omitempty"`
TokenType string `json:"token_type"`
}
AuthConfig stores the OAuth credentials
func LoadAuthConfig ¶
func LoadAuthConfig() (*AuthConfig, error)
LoadAuthConfig loads the auth config from disk
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.BuildObject, error)) BuildModel
func (BuildModel) Init ¶
func (m BuildModel) Init() tea.Cmd
func (BuildModel) Update ¶
func (m BuildModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)
func (BuildModel) View ¶
func (m BuildModel) View() string
type BuildTargetInfo ¶
type BuildTargetInfo struct {
// contains filtered or unexported fields
}
BuildTargetInfo holds information about a build target
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group represents a nested logging group
type TargetConfig ¶
type TargetConfig struct {
OutputPath string `json:"output_path"`
}
TargetConfig stores configuration for a specific SDK target
type TargetInfo ¶
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, openAPISpec, stainlessConfig string) (WorkspaceConfig, error)
func NewWorkspaceConfigWithTargets ¶
func NewWorkspaceConfigWithTargets(projectName, openAPISpec, stainlessConfig string, targets map[string]*TargetConfig) (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