guards

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package guards turns institutional gotchas into candidate enforcement: for a gotcha with a concrete anti-pattern, the BYOAI LLM proposes a grep-style pre-commit check (pattern + file globs + message). The human pastes the ones that fit into the hook, closing the loop from "we learned this" to "the repo enforces it". BYOAI via the existing llm.Client (claude -p); the model proposes, the human decides.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShellSnippet

func ShellSnippet(guards []Guard) string

ShellSnippet renders applicable guards as a copy-paste bash block for a pre-commit hook: each greps the staged-relevant globs for its pattern and fails with the message. Only guards that applies==true and have a pattern + globs are emitted.

Types

type Guard

type Guard struct {
	GotchaID string `json:"gotcha_id"`
	Title    string `json:"title"`
	Applies  bool   `json:"applies"`  // false = not mechanically checkable (judgment/architecture)
	Pattern  string `json:"pattern"`  // RE2/grep -E regex flagging the anti-pattern
	Globs    string `json:"globs"`    // comma file globs the check applies to (e.g. "*.go,*.ts" or "Dockerfile")
	Message  string `json:"message"`  // one-line failure message
	Severity string `json:"severity"` // block | warn
	Reason   string `json:"reason"`   // why applies is true/false
}

Guard is a proposed enforcement for a gotcha.

func Suggest

func Suggest(ctx context.Context, client llm.Client, g index.GotchaRow) (Guard, error)

Suggest asks the model to propose a guard for one gotcha.

Jump to

Keyboard shortcuts

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