rules

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClaudeCodeConfig = Config{
	Dir:       ".claude/rules",
	Extension: ".md",
	GlobField: "globs",
}

ClaudeCodeConfig is the rules configuration for Claude Code.

View Source
var ClineConfig = Config{
	Dir:       ".clinerules",
	Extension: ".md",
	GlobField: "paths",
}

ClineConfig is the rules configuration for Cline.

View Source
var CopilotConfig = Config{
	Dir:       ".github/instructions",
	Extension: ".md",
	GlobField: "applyTo",
}

CopilotConfig is the rules configuration for GitHub Copilot.

View Source
var CursorConfig = Config{
	Dir:              ".cursor/rules",
	Extension:        ".mdc",
	GlobField:        "globs",
	AlwaysApplyField: "alwaysApply",
}

CursorConfig is the rules configuration for Cursor.

View Source
var DroidConfig = Config{
	Dir:       ".factory/rules",
	Extension: ".md",
	GlobField: "",
}

DroidConfig is the rules configuration for Factory Droid.

View Source
var KiroConfig = Config{
	Dir:       ".kiro/steering",
	Extension: ".md",
	GlobField: "fileMatchPattern",
}

KiroConfig is the rules configuration for Kiro. Kiro calls rules "steering" and uses .kiro/steering/ directory.

View Source
var WindsurfConfig = Config{
	Dir:       ".windsurf/rules",
	Extension: ".md",
	GlobField: "",
}

WindsurfConfig is the rules configuration for Windsurf.

Functions

This section is empty.

Types

type BaseRulesManager added in v0.1.7

type BaseRulesManager struct {
	// contains filtered or unexported fields
}

BaseRulesManager implements RulesManager with configurable directory paths, file extensions, and frontmatter field names. It handles stamped content, version guards, and safe uninstall for any agent that supports modular rules.

func NewBaseRulesManager added in v0.1.7

func NewBaseRulesManager(cfg Config) *BaseRulesManager

NewBaseRulesManager creates a rules manager with the given agent-specific config.

func NewBaseRulesManagerWithEnv added in v0.1.7

func NewBaseRulesManagerWithEnv(cfg Config, env agentx.Environment) *BaseRulesManager

NewBaseRulesManagerWithEnv creates a rules manager with a custom environment.

func NewClaudeCodeRulesManager

func NewClaudeCodeRulesManager() *BaseRulesManager

NewClaudeCodeRulesManager creates a rules manager for Claude Code (.claude/rules/*.md).

func NewClaudeCodeRulesManagerWithEnv

func NewClaudeCodeRulesManagerWithEnv(env agentx.Environment) *BaseRulesManager

NewClaudeCodeRulesManagerWithEnv creates a Claude Code rules manager with a custom environment.

func NewClineRulesManager added in v0.1.7

func NewClineRulesManager() *BaseRulesManager

NewClineRulesManager creates a rules manager for Cline (.clinerules/*.md).

func NewClineRulesManagerWithEnv added in v0.1.7

func NewClineRulesManagerWithEnv(env agentx.Environment) *BaseRulesManager

NewClineRulesManagerWithEnv creates a Cline rules manager with a custom environment.

func NewCopilotRulesManager added in v0.1.7

func NewCopilotRulesManager() *BaseRulesManager

NewCopilotRulesManager creates a rules manager for Copilot (.github/instructions/*.md).

func NewCopilotRulesManagerWithEnv added in v0.1.7

func NewCopilotRulesManagerWithEnv(env agentx.Environment) *BaseRulesManager

NewCopilotRulesManagerWithEnv creates a Copilot rules manager with a custom environment.

func NewCursorRulesManager added in v0.1.7

func NewCursorRulesManager() *BaseRulesManager

NewCursorRulesManager creates a rules manager for Cursor (.cursor/rules/*.mdc).

func NewCursorRulesManagerWithEnv added in v0.1.7

func NewCursorRulesManagerWithEnv(env agentx.Environment) *BaseRulesManager

NewCursorRulesManagerWithEnv creates a Cursor rules manager with a custom environment.

func NewDroidRulesManager added in v0.1.7

func NewDroidRulesManager() *BaseRulesManager

NewDroidRulesManager creates a rules manager for Droid (.factory/rules/*.md).

func NewDroidRulesManagerWithEnv added in v0.1.7

func NewDroidRulesManagerWithEnv(env agentx.Environment) *BaseRulesManager

NewDroidRulesManagerWithEnv creates a Droid rules manager with a custom environment.

func NewKiroRulesManager added in v0.1.7

func NewKiroRulesManager() *BaseRulesManager

NewKiroRulesManager creates a rules manager for Kiro (.kiro/steering/*.md).

func NewKiroRulesManagerWithEnv added in v0.1.7

func NewKiroRulesManagerWithEnv(env agentx.Environment) *BaseRulesManager

NewKiroRulesManagerWithEnv creates a Kiro rules manager with a custom environment.

func NewWindsurfRulesManager added in v0.1.7

func NewWindsurfRulesManager() *BaseRulesManager

NewWindsurfRulesManager creates a rules manager for Windsurf (.windsurf/rules/*.md).

func NewWindsurfRulesManagerWithEnv added in v0.1.7

func NewWindsurfRulesManagerWithEnv(env agentx.Environment) *BaseRulesManager

NewWindsurfRulesManagerWithEnv creates a Windsurf rules manager with a custom environment.

func (*BaseRulesManager) Install added in v0.1.7

func (m *BaseRulesManager) Install(_ context.Context, projectRoot string, rules []agentx.RuleFile, overwrite bool) ([]string, error)

Install writes rule files to the agent's rules directory. Each file is stamped with a content hash and version on the first line. If the rule has Globs set and the agent supports glob scoping, YAML frontmatter is prepended with the agent-specific field name.

func (*BaseRulesManager) RulesDir added in v0.1.7

func (m *BaseRulesManager) RulesDir(projectRoot string) string

RulesDir returns the absolute path to the rules directory for a project.

func (*BaseRulesManager) Uninstall added in v0.1.7

func (m *BaseRulesManager) Uninstall(_ context.Context, projectRoot string, prefix string) ([]string, error)

Uninstall removes rule files matching the prefix from the rules directory. Only removes files with a recognized stamp (preserves user-created files).

func (*BaseRulesManager) Validate added in v0.1.7

func (m *BaseRulesManager) Validate(_ context.Context, projectRoot string, rules []agentx.RuleFile) (missing []string, stale []string, err error)

Validate checks which expected rule files are missing or stale.

type Config added in v0.1.7

type Config struct {
	// Dir is the rules directory relative to project root (e.g., ".claude/rules").
	Dir string

	// Extension is the file extension including dot (e.g., ".md", ".mdc").
	Extension string

	// GlobField is the YAML frontmatter field name for glob patterns.
	// Examples: "globs" (Claude, Cursor), "paths" (Cline), "applyTo" (Copilot),
	// "fileMatchPattern" (Kiro). Empty means glob scoping is not supported.
	GlobField string

	// AlwaysApplyField is an optional YAML field for "always load this rule"
	// behavior. Example: "alwaysApply" (Cursor). Empty if not supported.
	AlwaysApplyField string
}

Config holds per-agent rules directory configuration.

Jump to

Keyboard shortcuts

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