config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config loads and version-routes .mcpsmithy.yaml configs.

Each config schema version lives in its own sub-package (v1/, v2/, …) and satisfies the VersionSchema interface. The loader reads raw YAML, detects the "version" field, and delegates to the correct version.

Adding a new version:

  1. Create the vN/ sub-package satisfying VersionSchema
  2. Register it in the versions map in this file

Type aliases below re-export the latest version's types so that consumers can keep importing "internal/config" without change.

Index

Constants

View Source
const (
	// ReservedContextKey is the single template context key owned by the
	// engine. User params with this name collide with the injected config namespace.
	// Canonical definition is in the schema package; this alias keeps the existing export path stable.
	ReservedContextKey = schema.ReservedContextKey

	// Constant aliases; re-export values so consumers never import v1 directly.
	// PullPolicy values control when external sources are fetched.
	PullPolicyAlways       = v1.PullPolicyAlways
	PullPolicyIfNotPresent = v1.PullPolicyIfNotPresent
	PullPolicyNever        = v1.PullPolicyNever

	// ParamType values for tool parameter types.
	ParamTypeString          = v1.ParamTypeString
	ParamTypeNumber          = v1.ParamTypeNumber
	ParamTypeBool            = v1.ParamTypeBool
	ParamTypeArray           = v1.ParamTypeArray
	ParamTypeProjectFilePath = v1.ParamTypeProjectFilePath

	// BuiltinFunc names; the template functions available inside tool templates.
	BuiltinFuncConventionsFor = v1.BuiltinFuncConventionsFor
	BuiltinFuncSearchFor      = v1.BuiltinFuncSearchFor
	BuiltinFuncFileRead       = v1.BuiltinFuncFileRead
	BuiltinFuncHTTPGet        = v1.BuiltinFuncHTTPGet
	BuiltinFuncHTTPPost       = v1.BuiltinFuncHTTPPost
	BuiltinFuncHTTPPut        = v1.BuiltinFuncHTTPPut
	BuiltinFuncGrep           = v1.BuiltinFuncGrep
)

Variables

View Source
var TypesSources = v1.TypesSources

TypesSources returns the raw Go source files for the latest version's types. Callers that only need the latest version can use this directly.

View Source
var Versions = map[string]VersionSchema{
	v1.Version: v1.Schema{},
}

Versions is the single source of truth for which schema versions are accepted. Each entry satisfies VersionSchema.

Functions

This section is empty.

Types

type BuiltinFunc

type BuiltinFunc = v1.BuiltinFunc

Type aliases; always point to the latest version.

type Config

type Config = v1.Config

Type aliases; always point to the latest version.

func Parse

func Parse(data []byte) (*Config, error)

Parse parses raw YAML bytes, detects the version, delegates to the correct versioned parser, and converts the result to the latest Config type.

type Convention

type Convention = v1.Convention

Type aliases; always point to the latest version.

type ConventionRelations

type ConventionRelations = v1.ConventionRelations

Type aliases; always point to the latest version.

type DocRef

type DocRef = v1.DocRef

Type aliases; always point to the latest version.

type GitSource

type GitSource = v1.GitSource

Type aliases; always point to the latest version.

type HTTPSource

type HTTPSource = v1.HTTPSource

Type aliases; always point to the latest version.

type LocalSource

type LocalSource = v1.LocalSource

Type aliases; always point to the latest version.

type ParamConstraints

type ParamConstraints = v1.ParamConstraints

Type aliases; always point to the latest version.

type ParamType

type ParamType = v1.ParamType

Type aliases; always point to the latest version.

type Project

type Project = v1.Project

Type aliases; always point to the latest version.

type ProjectSources

type ProjectSources = v1.ProjectSources

Type aliases; always point to the latest version.

type PullPolicy

type PullPolicy = v1.PullPolicy

Type aliases; always point to the latest version.

type ScrapeSource

type ScrapeSource = v1.ScrapeSource

Type aliases; always point to the latest version.

type TemplateString

type TemplateString = v1.TemplateString

Type aliases; always point to the latest version.

type Tool

type Tool = v1.Tool

Type aliases; always point to the latest version.

type ToolParam

type ToolParam = v1.ToolParam

Type aliases; always point to the latest version.

type VersionSchema

type VersionSchema interface {
	Parse([]byte) (*Config, error)
	RootType() any
	TypesSources() []string
}

VersionSchema is the contract each config version must satisfy. The Parse method must return the latest Config type (converting if needed).

Directories

Path Synopsis
Package schema provides tag-driven defaults and validation for config structs.
Package schema provides tag-driven defaults and validation for config structs.
Package v1 defines the v1 config schema types for .mcpsmithy.yaml.
Package v1 defines the v1 config schema types for .mcpsmithy.yaml.

Jump to

Keyboard shortcuts

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