config

package
v1.0.19 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmdConfig

func NewCmdConfig(f *cmdutil.Factory) *cobra.Command

NewCmdConfig creates the config command with subcommands.

func NewCmdConfigBind added in v1.0.18

func NewCmdConfigBind(f *cmdutil.Factory, runF func(*BindOptions) error) *cobra.Command

NewCmdConfigBind creates the config bind subcommand.

func NewCmdConfigDefaultAs

func NewCmdConfigDefaultAs(f *cmdutil.Factory) *cobra.Command

NewCmdConfigDefaultAs creates the "config default-as" subcommand.

func NewCmdConfigInit

func NewCmdConfigInit(f *cmdutil.Factory, runF func(*ConfigInitOptions) error) *cobra.Command

NewCmdConfigInit creates the config init subcommand.

func NewCmdConfigRemove

func NewCmdConfigRemove(f *cmdutil.Factory, runF func(*ConfigRemoveOptions) error) *cobra.Command

NewCmdConfigRemove creates the config remove subcommand.

func NewCmdConfigShow

func NewCmdConfigShow(f *cmdutil.Factory, runF func(*ConfigShowOptions) error) *cobra.Command

NewCmdConfigShow creates the config show subcommand.

func NewCmdConfigStrictMode added in v1.0.5

func NewCmdConfigStrictMode(f *cmdutil.Factory) *cobra.Command

NewCmdConfigStrictMode creates the "config strict-mode" subcommand.

Types

type BindOptions added in v1.0.18

type BindOptions struct {
	Factory *cmdutil.Factory
	Source  string
	AppID   string
	// Identity selects one of two presets — "bot-only" or "user-default" —
	// that expand to underlying StrictMode + DefaultAs in applyPreferences.
	// Empty means "decide later": TUI prompts, flag mode defaults to bot-only
	// (the safer choice — bot acts under its own identity, no impersonation
	// risk; users can still opt into "user-default" via --identity).
	Identity string

	// Force opts in to an otherwise-blocked flag-mode transition — currently
	// only the bot-only → user-default identity escalation. TUI mode ignores
	// this flag because its own prompts already require human confirmation.
	Force bool

	Lang string

	// Brand holds the resolved Lark product brand ("feishu" | "lark") for
	// the account being bound. Populated after resolveAccount; TUI stages
	// that run before that (source / account selection) render brand-aware
	// text with an empty value, which brandDisplay falls back to Feishu.
	Brand string

	// IsTUI is the resolved interactive-mode flag: true only when Source is
	// empty and stdin is a terminal. Computed once at the top of
	// configBindRun; downstream branches read this instead of rechecking
	// IOStreams.IsTerminal. Do not set from outside — it is overwritten.
	IsTUI bool
	// contains filtered or unexported fields
}

BindOptions holds all inputs for config bind.

type Candidate added in v1.0.18

type Candidate struct {
	AppID string
	Label string
}

Candidate is the source-agnostic view of a bindable account. It carries only the identity fields needed by selectCandidate / TUI; secrets remain inside the SourceBinder implementation.

type ConfigInitOptions

type ConfigInitOptions struct {
	Factory *cmdutil.Factory
	Ctx     context.Context
	AppID   string

	AppSecretStdin bool // read app-secret from stdin (avoids process list exposure)
	Brand          string
	New            bool
	Lang           string

	ProfileName string // when set, create/update a named profile instead of replacing Apps[0]
	// contains filtered or unexported fields
}

ConfigInitOptions holds all inputs for config init.

type ConfigRemoveOptions

type ConfigRemoveOptions struct {
	Factory *cmdutil.Factory
}

ConfigRemoveOptions holds all inputs for config remove.

type ConfigShowOptions

type ConfigShowOptions struct {
	Factory *cmdutil.Factory
}

ConfigShowOptions holds all inputs for config show.

type SourceBinder added in v1.0.18

type SourceBinder interface {
	// Name returns the source identifier (used in error envelopes).
	Name() string
	// ConfigPath returns the resolved path to the source's config file.
	ConfigPath() string
	// ListCandidates enumerates bindable accounts from the source config.
	// An empty slice is valid (selectCandidate will turn it into a typed error).
	ListCandidates() ([]Candidate, error)
	// Build resolves secrets, persists to keychain, and returns a ready AppConfig
	// for the chosen candidate AppID. Must be called after ListCandidates succeeds.
	Build(appID string) (*core.AppConfig, error)
}

SourceBinder abstracts a bind source (openclaw / hermes / future sources). Implementations only list candidates and build an AppConfig for a chosen candidate — they stay out of mode (TUI vs flag) and orchestration concerns.

Jump to

Keyboard shortcuts

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