metadata

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(metadata *Metadata) ([]byte, error)

Marshal converts metadata to TOML bytes

func ParseDependency

func ParseDependency(dep string) (name string, constraint string, err error)

ParseDependency parses a dependency string (e.g., "package>=1.0.0,<2.0.0") Returns the package name and version constraint

func ValidateDependencyConstraint

func ValidateDependencyConstraint(constraint string) error

ValidateDependencyConstraint validates a version constraint string Supports: >=X.Y.Z, ~=X.Y.Z, ~X.Y.Z, and comma-separated constraints

func Write

func Write(metadata *Metadata, filePath string) error

Write writes metadata to a file path

Types

type AgentConfig

type AgentConfig struct {
	PromptFile string   `toml:"prompt-file"`
	Triggers   []string `toml:"triggers,omitempty"`
	Requires   []string `toml:"requires,omitempty"`
}

AgentConfig represents the [agent] section

func (*AgentConfig) Validate

func (a *AgentConfig) Validate() error

Validate validates the [agent] section

type Asset

type Asset struct {
	Name          string     `toml:"name"`
	Version       string     `toml:"version"`
	Type          asset.Type `toml:"type"`
	Description   string     `toml:"description,omitempty"`
	License       string     `toml:"license,omitempty"`
	Authors       []string   `toml:"authors,omitempty"`
	Keywords      []string   `toml:"keywords,omitempty"`
	Homepage      string     `toml:"homepage,omitempty"`
	Repository    string     `toml:"repository,omitempty"`
	Documentation string     `toml:"documentation,omitempty"`
	Readme        string     `toml:"readme,omitempty"`
	Dependencies  []string   `toml:"dependencies,omitempty"`
}

Asset represents the asset section (formerly [artifact])

func (*Asset) Validate

func (a *Asset) Validate() error

Validate validates the asset section

type CommandConfig

type CommandConfig struct {
	PromptFile   string   `toml:"prompt-file"`
	Aliases      []string `toml:"aliases,omitempty"`
	RequiresAuth bool     `toml:"requires-auth,omitempty"`
	Dangerous    bool     `toml:"dangerous,omitempty"`
}

CommandConfig represents the [command] section

func (*CommandConfig) Validate

func (c *CommandConfig) Validate() error

Validate validates the [command] section

type HookConfig

type HookConfig struct {
	Event       string `toml:"event"`
	ScriptFile  string `toml:"script-file"`
	Async       bool   `toml:"async,omitempty"`
	FailOnError bool   `toml:"fail-on-error,omitempty"`
	Timeout     int    `toml:"timeout,omitempty"`
}

HookConfig represents the [hook] section

func (*HookConfig) Validate

func (h *HookConfig) Validate() error

Validate validates the [hook] section

type MCPConfig

type MCPConfig struct {
	Command      string            `toml:"command"`
	Args         []string          `toml:"args"`
	Env          map[string]string `toml:"env,omitempty"`
	Timeout      int               `toml:"timeout,omitempty"`
	Capabilities []string          `toml:"capabilities,omitempty"`
}

MCPConfig represents the [mcp] section (for both mcp and mcp-remote)

func (*MCPConfig) Validate

func (m *MCPConfig) Validate() error

Validate validates the [mcp] section

type Metadata

type Metadata struct {
	MetadataVersion string `toml:"metadata-version,omitempty"`
	Asset           Asset  `toml:"asset"`

	// Type-specific sections (only one should be present based on asset.type)
	Skill   *SkillConfig           `toml:"skill,omitempty"`
	Command *CommandConfig         `toml:"command,omitempty"`
	Agent   *AgentConfig           `toml:"agent,omitempty"`
	Hook    *HookConfig            `toml:"hook,omitempty"`
	MCP     *MCPConfig             `toml:"mcp,omitempty"`
	Custom  map[string]interface{} `toml:"custom,omitempty"`
}

Metadata represents the complete metadata.toml structure

func Parse

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

Parse parses metadata from bytes Supports both new asset and old [artifact] section names

func ParseFile

func ParseFile(filePath string) (*Metadata, error)

ParseFile parses metadata from a file path

func (*Metadata) GetTypeConfig

func (m *Metadata) GetTypeConfig() interface{}

GetTypeConfig returns the type-specific configuration section

func (*Metadata) Validate

func (m *Metadata) Validate() error

Validate validates the entire metadata structure

func (*Metadata) ValidateWithFiles

func (m *Metadata) ValidateWithFiles(fileList []string) error

ValidateWithFiles validates metadata and checks that required files exist in the provided file list

type SkillConfig

type SkillConfig struct {
	PromptFile         string   `toml:"prompt-file"`
	Triggers           []string `toml:"triggers,omitempty"`
	Requires           []string `toml:"requires,omitempty"`
	SupportedLanguages []string `toml:"supported-languages,omitempty"`
}

SkillConfig represents the [skill] section

func (*SkillConfig) Validate

func (s *SkillConfig) Validate() error

Validate validates the [skill] section

Jump to

Keyboard shortcuts

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