rule

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 6 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") - legacy
	Paths    []string `yaml:"paths,omitempty"`    // File patterns for conditional rules (Claude Code style)
	Globs    []string `yaml:"globs,omitempty"`    // File patterns for conditional rules (Cursor style)
}

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
	Tool  string `json:"-"` // Which tool owns this (e.g., "claude", "gemini", "agentctl")
}

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 (recursively includes subdirectories)

func (*Rule) InspectContent added in v0.3.0

func (r *Rule) InspectContent() string

InspectContent returns the formatted content for the inspector viewport

func (*Rule) InspectTitle added in v0.3.0

func (r *Rule) InspectTitle() string

InspectTitle returns the display name for the inspector modal header

Jump to

Keyboard shortcuts

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