Documentation
¶
Index ¶
- func NewCmdConfig(f *cmdutil.Factory) *cobra.Command
- func NewCmdConfigBind(f *cmdutil.Factory, runF func(*BindOptions) error) *cobra.Command
- func NewCmdConfigDefaultAs(f *cmdutil.Factory) *cobra.Command
- func NewCmdConfigInit(f *cmdutil.Factory, runF func(*ConfigInitOptions) error) *cobra.Command
- func NewCmdConfigRemove(f *cmdutil.Factory, runF func(*ConfigRemoveOptions) error) *cobra.Command
- func NewCmdConfigShow(f *cmdutil.Factory, runF func(*ConfigShowOptions) error) *cobra.Command
- func NewCmdConfigStrictMode(f *cmdutil.Factory) *cobra.Command
- type BindOptions
- type Candidate
- type ConfigInitOptions
- type ConfigRemoveOptions
- type ConfigShowOptions
- type SourceBinder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCmdConfig ¶
NewCmdConfig creates the config command with subcommands.
func NewCmdConfigBind ¶ added in v1.0.18
NewCmdConfigBind creates the config bind subcommand.
func NewCmdConfigDefaultAs ¶
NewCmdConfigDefaultAs creates the "config default-as" subcommand.
func NewCmdConfigInit ¶
NewCmdConfigInit creates the config init subcommand.
func NewCmdConfigRemove ¶
NewCmdConfigRemove creates the config remove subcommand.
func NewCmdConfigShow ¶
NewCmdConfigShow creates the config show 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
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 ¶
ConfigRemoveOptions holds all inputs for config remove.
type ConfigShowOptions ¶
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.