metadata

package
v0.14.10 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const CurrentMetadataVersion = "1.0"

CurrentMetadataVersion is the current version of the metadata format

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 ClaudeCodePluginConfig added in v0.8.0

type ClaudeCodePluginConfig struct {
	ManifestFile     string `toml:"manifest-file,omitempty"`      // Default: .claude-plugin/plugin.json
	AutoEnable       *bool  `toml:"auto-enable,omitempty"`        // Default: true
	Marketplace      string `toml:"marketplace,omitempty"`        // Optional marketplace name
	MinClientVersion string `toml:"min-client-version,omitempty"` // Optional minimum Claude Code version
}

ClaudeCodePluginConfig represents the [claude-code-plugin] section

func (*ClaudeCodePluginConfig) Validate added in v0.8.0

func (c *ClaudeCodePluginConfig) Validate() error

Validate validates the [claude-code-plugin] 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"`
	ClaudeCodePlugin *ClaudeCodePluginConfig `toml:"claude-code-plugin,omitempty"`
	Rule             *RuleConfig             `toml:"rule,omitempty"`
	Custom           map[string]any          `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() any

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 RuleConfig added in v0.9.0

type RuleConfig struct {
	Title       string         `toml:"title,omitempty"`       // Title/heading for the rule (defaults to asset name)
	PromptFile  string         `toml:"prompt-file,omitempty"` // Defaults to RULE.md
	Description string         `toml:"description,omitempty"` // Rule description (used in frontmatter)
	Globs       []string       `toml:"globs,omitempty"`       // File patterns this rule applies to
	Cursor      map[string]any `toml:"cursor,omitempty"`      // Cursor-specific settings
	ClaudeCode  map[string]any `toml:"claude-code,omitempty"` // Claude Code-specific settings
}

RuleConfig represents the [rule] section

func (*RuleConfig) Validate added in v0.9.0

func (r *RuleConfig) Validate() error

Validate validates the [rule] section

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