markdown

package
v0.0.37 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseFrontMatter

type BaseFrontMatter struct {
	// URN is an optional unique identifier for the prompt in URN format (e.g. urn:agents:task:<name>)
	// Automatically inferred from filename if not specified in frontmatter
	// In YAML frontmatter, "id" is accepted as an alias for "urn".
	URN *urn.URN `yaml:"urn,omitempty" json:"urn,omitempty"`

	// Name is the skill identifier
	// Must be 1-64 characters, lowercase alphanumeric and hyphens only
	Name string `yaml:"name,omitempty" json:"name,omitempty"`

	// Description explains what the prompt does and when to use it
	// Must be 1-1024 characters
	Description string `yaml:"description,omitempty" json:"description,omitempty"`

	Content map[string]any `json:"-" yaml:",inline"`
}

BaseFrontMatter represents parsed YAML frontmatter from markdown files

func (*BaseFrontMatter) UnmarshalYAML added in v0.0.37

func (b *BaseFrontMatter) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML supports "id" as an alias for URN and parses string values into *urn.URN.

type CommandFrontMatter

type CommandFrontMatter struct {
	BaseFrontMatter `yaml:",inline"`

	// ExpandParams controls whether parameter expansion should occur
	// Defaults to true if not specified
	ExpandParams *bool `yaml:"expand,omitempty" json:"expand,omitempty"`

	// Selectors contains additional custom selectors for filtering rules
	// When a command is used in a task, its selectors are combined with task selectors
	Selectors map[string]any `yaml:"selectors,omitempty" json:"selectors,omitempty"`
}

CommandFrontMatter represents the frontmatter fields for command files. Previously this was an empty placeholder struct, but now supports the expand field to control parameter expansion behavior in command content.

func (*CommandFrontMatter) UnmarshalJSON

func (c *CommandFrontMatter) UnmarshalJSON(data []byte) error

UnmarshalJSON custom unmarshaler that populates both typed fields and Content map

type Markdown

type Markdown[T any] struct {
	FrontMatter T      // Parsed YAML frontmatter
	Content     string // Expanded content of the markdown
	Tokens      int    // Estimated token count
}

Markdown represents a markdown file with frontmatter and content

func ParseMarkdownFile

func ParseMarkdownFile[T any](path string, frontMatter *T) (Markdown[T], error)

ParseMarkdownFile parses a markdown file into frontmatter and content

type RuleFrontMatter

type RuleFrontMatter struct {
	BaseFrontMatter `yaml:",inline"`

	// TaskNames specifies which task(s) this rule applies to
	// Array of task names for OR logic
	TaskNames []string `yaml:"task_names,omitempty" json:"task_names,omitempty"`

	// Languages specifies which programming language(s) this rule applies to
	// Array of languages for OR logic (e.g., ["go", "python"])
	Languages []string `yaml:"languages,omitempty" json:"languages,omitempty"`

	// Agent specifies which AI agent this rule is intended for
	Agent string `yaml:"agent,omitempty" json:"agent,omitempty"`

	// MCPServer specifies a single MCP server configuration
	// Metadata only, does not filter
	MCPServer mcp.MCPServerConfig `yaml:"mcp_server,omitempty" json:"mcp_server,omitempty"`

	// ExpandParams controls whether parameter expansion should occur
	// Defaults to true if not specified
	ExpandParams *bool `yaml:"expand,omitempty" json:"expand,omitempty"`

	// Bootstrap contains a shell script to execute before including the rule
	// This is preferred over file-based bootstrap scripts
	Bootstrap string `yaml:"bootstrap,omitempty" json:"bootstrap,omitempty"`
}

RuleFrontMatter represents the standard frontmatter fields for rule files

func (*RuleFrontMatter) UnmarshalJSON

func (r *RuleFrontMatter) UnmarshalJSON(data []byte) error

UnmarshalJSON custom unmarshaler that populates both typed fields and Content map

type RuleMarkdown

type RuleMarkdown = Markdown[RuleFrontMatter]

RuleMarkdown is a Markdown with RuleFrontMatter

type SkillFrontMatter added in v0.0.33

type SkillFrontMatter struct {
	BaseFrontMatter `yaml:",inline"`

	// License specifies the license applied to the skill (optional)
	License string `yaml:"license,omitempty" json:"license,omitempty"`

	// Compatibility indicates environment requirements (optional)
	// Max 500 characters
	Compatibility string `yaml:"compatibility,omitempty" json:"compatibility,omitempty"`

	// Metadata contains arbitrary key-value pairs (optional)
	Metadata map[string]string `yaml:"metadata,omitempty" json:"metadata,omitempty"`

	// AllowedTools is a space-delimited list of pre-approved tools (optional, experimental)
	AllowedTools string `yaml:"allowed-tools,omitempty" json:"allowed-tools,omitempty"`
}

SkillFrontMatter represents the standard frontmatter fields for skill files

func (*SkillFrontMatter) UnmarshalJSON added in v0.0.33

func (s *SkillFrontMatter) UnmarshalJSON(data []byte) error

UnmarshalJSON custom unmarshaler that populates both typed fields and Content map

type TaskFrontMatter

type TaskFrontMatter struct {
	BaseFrontMatter `yaml:",inline"`

	// Agent specifies the default agent if not specified via -a flag
	// This is not used for selecting tasks or rules, only as a default
	Agent string `yaml:"agent,omitempty" json:"agent,omitempty"`

	// Languages specifies the programming language(s) for filtering rules
	// Array of languages for OR logic (e.g., ["go", "python"])
	Languages []string `yaml:"languages,omitempty" json:"languages,omitempty"`

	// Model specifies the AI model identifier
	// Does not filter rules, metadata only
	Model string `yaml:"model,omitempty" json:"model,omitempty"`

	// SingleShot indicates whether the task runs once or multiple times
	// Does not filter rules, metadata only
	SingleShot bool `yaml:"single_shot,omitempty" json:"single_shot,omitempty"`

	// Timeout specifies the task timeout in time.Duration format (e.g., "10m", "1h")
	// Does not filter rules, metadata only
	Timeout string `yaml:"timeout,omitempty" json:"timeout,omitempty"`

	// Resume indicates if this task should be resumed
	Resume bool `yaml:"resume,omitempty" json:"resume,omitempty"`

	// Selectors contains additional custom selectors for filtering rules
	Selectors map[string]any `yaml:"selectors,omitempty" json:"selectors,omitempty"`

	// ExpandParams controls whether parameter expansion should occur
	// Defaults to true if not specified
	ExpandParams *bool `yaml:"expand,omitempty" json:"expand,omitempty"`
}

TaskFrontMatter represents the standard frontmatter fields for task files

func (*TaskFrontMatter) UnmarshalJSON

func (t *TaskFrontMatter) UnmarshalJSON(data []byte) error

UnmarshalJSON custom unmarshaler that populates both typed fields and Content map

type TaskMarkdown

type TaskMarkdown = Markdown[TaskFrontMatter]

TaskMarkdown is a Markdown with TaskFrontMatter

Jump to

Keyboard shortcuts

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