rules

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Filename       = "COMMITBRIEF.md"
	OutputFilename = "OUTPUT.md"
	LocalSubdir    = ".commitbrief"
)

Variables

This section is empty.

Functions

func Build

func Build(rulesLoaded, outputLoaded Loaded, langRes lang.Resolution) (system, userTpl string)

Build assembles the system prompt from rule content and output-format content, then appends the language directive and the prompt-injection guard. Both blocks are wrapped in XML-style tags so the prompt-injection guard can refer to them by name.

Types

type Loaded

type Loaded struct {
	Content string
	Source  Source
	Path    string
	Hash    string
}

func Default

func Default() Loaded

func DefaultOutput

func DefaultOutput() Loaded

func Load

func Load(repoRoot string) (Loaded, error)

func LoadOutput

func LoadOutput(repoRoot, userHome string) (Loaded, error)

LoadOutput resolves the output-format template through a three-tier fallback: repo-local (<repoRoot>/.commitbrief/OUTPUT.md) → user-level (<userHome>/.commitbrief/OUTPUT.md) → binary-embedded default. Both path segments are gitignored by `commitbrief setup --local`, so the override is per-user rather than team-shared — output convention is considered a personal preference; team-shared review content stays in COMMITBRIEF.md.

Pass userHome == "" to skip the user-level layer (test injection); the CLI passes os.UserHomeDir() as resolved at startup.

type Source

type Source int
const (
	SourceDefault Source = iota
	SourceFile
	SourceUserFile
)

func (Source) String

func (s Source) String() string

Jump to

Keyboard shortcuts

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