config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package config parses and composes the first-slice Wirecmd configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Root    *Root
	Servers []Server
	LSPs    []LSP
}

Config is the complete source-syntax-independent configuration model consumed by execution.

func Compose

func Compose(sources ...*Source) (*Config, error)

Compose combines sources from weakest to strongest and validates the effective result. Scalars use the strongest present value. Named servers and environment entries retain first-introduction order while later sources replace matching entries.

func LoadEffective

func LoadEffective(paths []string) (*Config, error)

LoadEffective loads paths from weakest to strongest, composes their partial sources, and validates the resulting complete configuration.

func LoadEffectiveDiscovered

func LoadEffectiveDiscovered(paths []string) (*Config, error)

LoadEffectiveDiscovered validates workspace wirecmd.kdl files without changing the behavior of trusted global or explicitly supplied files.

type Environment

type Environment struct {
	Name  string
	Value Value
	Provenance
}

Environment assigns a value to a child process environment name.

type HTTP

type HTTP struct {
	Endpoint           string
	EndpointProvenance Provenance
	Query              []HTTPField
	Headers            []HTTPField
	OAuth              *OAuth
	Provenance
}

HTTP describes one complete modern Streamable HTTP transport.

type HTTPField

type HTTPField struct {
	Name  string
	Value Value
	Provenance
}

HTTPField is one named HTTP query or header value. Name retains the spelling from the source while composition uses the appropriate case-sensitivity for the field collection.

type HTTPSource

type HTTPSource struct {
	Endpoint           *string
	EndpointProvenance Provenance
	Query              []HTTPField
	Headers            []HTTPField
	OAuth              *OAuthSource
	Provenance
}

HTTPSource is a potentially partial HTTP transport layer. A present source selects HTTP even when it omits the endpoint to inherit one from a weaker HTTP layer.

type LSP

type LSP struct {
	Name                       string
	Scope                      Scope
	ScopeProvenance            Provenance
	ImplementationID           string
	ImplementationIDProvenance Provenance
	Selectors                  []LSPSelector
	Stdio                      Stdio
	Provenance
}

LSP is a named complete local language-server definition. Its name is a configuration and instance identity; routine LSP operations select matching effective workspace definitions rather than exposing a name as an argument.

type LSPSelector

type LSPSelector struct {
	LanguageID           string
	LanguageIDProvenance Provenance
	Pattern              string
	PatternProvenance    Provenance
	Provenance           Provenance
}

LSPSelector routes files matching Pattern to an LSP using LanguageID for text-document synchronization. Pattern is workspace-relative and uses doublestar path syntax.

type LSPSource

type LSPSource struct {
	Name                       string
	Scope                      *Scope
	ScopeProvenance            Provenance
	ImplementationID           *string
	ImplementationIDProvenance Provenance
	Selectors                  []LSPSelector
	Stdio                      *StdioSource
	Provenance
}

LSPSource is a potentially partial language-server layer.

type OAuth

type OAuth struct {
	ClientID              string
	ClientIDProvenance    Provenance
	ClientSecret          *Value
	RedirectURI           string
	RedirectURIProvenance Provenance
	Provenance
}

OAuth describes a complete preregistered OAuth client for an HTTP server. When OAuth is nil, execution may use dynamic client registration instead.

type OAuthSource

type OAuthSource struct {
	ClientID              *string
	ClientIDProvenance    Provenance
	ClientSecret          *Value
	RedirectURI           *string
	RedirectURIProvenance Provenance
	Provenance
}

OAuthSource is a potentially partial preregistered OAuth client layer. ClientSecret is optional even in a complete OAuth configuration.

type Provenance

type Provenance struct {
	File string
	Path string
}

Provenance identifies the configuration source and semantic location that supplied a model value.

type ResolvedValue

type ResolvedValue struct {
	Text      string
	Sensitive bool
}

ResolvedValue is a value ready for a destination. Sensitive marks values that must be kept out of normal diagnostics.

type Root

type Root struct {
	Path string
	Provenance
}

Root is a configured workspace root. Resolving relative paths and applying caller overrides are daemon concerns, not configuration composition.

type Scope

type Scope string

Scope identifies the context that owns a configured server instance.

const (
	// ScopeWorkspace makes a server instance specific to its effective workspace.
	ScopeWorkspace Scope = "workspace"
)

type Server

type Server struct {
	Name            string
	Scope           Scope
	ScopeProvenance Provenance
	Stdio           Stdio
	HTTP            *HTTP
	Provenance
}

Server is a named complete configured capability source.

type ServerSource

type ServerSource struct {
	Name            string
	Scope           *Scope
	ScopeProvenance Provenance
	Stdio           *StdioSource
	HTTP            *HTTPSource
	Provenance
}

ServerSource is a potentially partial server layer.

type Source

type Source struct {
	Root    *Root
	Servers []ServerSource
	LSPs    []LSPSource
	Provenance
}

Source is one partially specified KDL configuration layer. It is valid for a source to omit fields that are supplied by a weaker layer.

func Load

func Load(path string) (*Source, error)

Load parses one KDL 2 configuration source file.

func Parse

func Parse(file string, r io.Reader) (*Source, error)

Parse parses one possibly partial first-slice Wirecmd KDL 2 source from r.

func ParseString

func ParseString(file, source string) (*Source, error)

ParseString is Parse for source text already held in memory.

type Stdio

type Stdio struct {
	Command           string
	CommandProvenance Provenance
	Args              []Value
	Env               []Environment
	Provenance
}

Stdio describes one complete local command transport.

type StdioSource

type StdioSource struct {
	Command           *string
	CommandProvenance Provenance
	Args              []Value
	Env               []Environment
	Provenance
}

StdioSource is a potentially partial stdio layer. A non-empty Args slice replaces inherited arguments; Env entries merge by name.

type Value

type Value struct {
	Kind ValueKind
	Text string
	Provenance
}

Value is a textual literal or an annotated secret reference. Text is the literal text for ValueLiteral and the unresolved reference for ValueSecretReference.

func (Value) IsSecret

func (v Value) IsSecret() bool

IsSecret reports whether the value is an unresolved secret reference.

func (Value) ResolveEnv

func (v Value) ResolveEnv(lookup func(string) (string, bool)) (ResolvedValue, error)

ResolveEnv resolves the only first-slice secret provider, env://. lookup must preserve os.LookupEnv's distinction between an unset name and a name set to the empty string.

type ValueKind

type ValueKind uint8

ValueKind distinguishes public literals from references whose resolved value must be treated as sensitive.

const (
	ValueLiteral ValueKind = iota
	ValueSecretReference
)

Jump to

Keyboard shortcuts

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