config

package
v1.0.44 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 25 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 NewCmdConfigKeychainDowngrade added in v1.0.41

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

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

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

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 NewCmdConfigPolicy(f *cmdutil.Factory) *cobra.Command

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 // 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

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 // 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

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