rule

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Save

func Save(r *Rule, dir string) error

Save saves a rule to a directory as a markdown file

Types

type Frontmatter

type Frontmatter struct {
	Priority int      `yaml:"priority,omitempty"` // Rule priority (higher = more important)
	Tools    []string `yaml:"tools,omitempty"`    // Which tools this rule applies to
	Applies  string   `yaml:"applies,omitempty"`  // File pattern this rule applies to (e.g., "*.ts")
}

Frontmatter represents the optional YAML frontmatter in a rule file

type Rule

type Rule struct {
	Name        string       `json:"name"`
	Frontmatter *Frontmatter `json:"frontmatter,omitempty"`
	Content     string       `json:"content"` // Markdown content
	Path        string       `json:"path"`    // Source file path

	// Runtime fields (not serialized)
	Scope string `json:"-"` // "local" or "global" - where this rule came from
}

Rule represents a rule/instruction configuration

func Load

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

Load loads a rule from a markdown file, parsing optional frontmatter

func LoadAll

func LoadAll(dir string) ([]*Rule, error)

LoadAll loads all rules from a directory

Jump to

Keyboard shortcuts

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