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 NewCmdConfigKeychainDowngrade(f *cmdutil.Factory) *cobra.Command
- func NewCmdConfigPlugins(f *cmdutil.Factory) *cobra.Command
- func NewCmdConfigPolicy(f *cmdutil.Factory) *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 NewCmdConfigKeychainDowngrade ¶ added in v1.0.41
NewCmdConfigKeychainDowngrade is registered on all platforms so that `lark-cli config --help` reads the same everywhere. On non-macOS it refuses with a clear message.
func NewCmdConfigPlugins ¶ added in v1.0.33
NewCmdConfigPlugins exposes the plugin inventory diagnostic command.
`config policy show` is intentionally focused on the user-layer Rule (Restrict). Plugins also contribute hooks (Observe / Wrap / Lifecycle) that are not policy gates but still mutate the CLI's runtime behaviour. This command surfaces both halves so an operator can answer "what is this binary doing differently from stock lark-cli?" in one place.
Like config policy show, the dispatch path is exempt from policy enforcement (see internal/cmdpolicy/diagnostic.go) so it remains usable under any Rule.
func NewCmdConfigPolicy ¶ added in v1.0.33
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 // raw --lang (string for cobra); normalized to canonical/"" in validateBindFlags
UILang i18n.Lang // TUI display language (picker-only); intentionally separate from --lang
// 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 // raw --lang (string for cobra); normalized to canonical/"" in validateInitLang
UILang i18n.Lang // TUI display language (picker-only); intentionally separate from --lang
ProfileName string // when set, create/update a named profile instead of replacing Apps[0]
// ForceInit overrides the agent-workspace guard. Without it, running
// init under OPENCLAW_HOME / HERMES_HOME refuses and points the caller
// at config bind — which is what AI agents almost always want. Manual
// users with a legitimate need for a separate app can pass --force-init
// to bypass.
ForceInit bool
// 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.