rules

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package rules provides import/export of AI coding rules between different tool formats (hawk, Cursor, Claude Code, Copilot, Gemini).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect(dir string) map[Format]string

Detect finds which AI tool rule files exist in dir. It returns a map from Format to the path of the first matching file found.

func Export

func Export(dir string, to Format, rules []Rule) error

Export writes rules to the target format inside dir.

Types

type Format

type Format string

Format identifies an AI tool's rule file format.

const (
	FormatHawk       Format = "hawk"       // .hawk/rules/*.md
	FormatCursor     Format = "cursor"     // .cursorrules or .cursor/rules/*.mdc
	FormatClaudeCode Format = "claudecode" // CLAUDE.md
	FormatCopilot    Format = "copilot"    // .github/copilot-instructions.md
	FormatGemini     Format = "gemini"     // .gemini/style-guide.md
)

type Rule

type Rule struct {
	Name    string
	Content string
	Source  Format
}

Rule is a single coding rule with its name, content, and originating format.

func Import

func Import(dir string, from Format) ([]Rule, error)

Import reads rules from the given format in dir and returns them.

type UnsupportedFormatError

type UnsupportedFormatError struct {
	Format Format
}

UnsupportedFormatError is returned when an unknown Format is given.

func (*UnsupportedFormatError) Error

func (e *UnsupportedFormatError) Error() string

Jump to

Keyboard shortcuts

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