agentsinv

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package agentsinv is a process-wide registry of agent-onboarding snippets contributed by batteries and the framework root.

Each contributing package embeds its own `agents.md`, then registers it from an init() so that:

  • importing the battery == including the snippet in the generated AGENTS.md (no central allow-list to maintain),
  • the generator in cmd/gofastr can dump the inventory by importing blank (`_ "...battery/admin"`) the packages it wants in scope.

The contract is intentionally tiny — just enough to drive AGENTS.md generation. Per-battery prose lives in the package's own `agents.md`, not in this registry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(e Entry)

Register adds e to the inventory. Safe to call from init().

If Markdown is empty (missing or stale `//go:embed agents.md`), the entry is recorded in MissingMarkdown() but NOT added to All(). This is a soft warning by design — a panic from package init would kill the entire gofastr binary for every subcommand (build / dev / migrate / version), and one mis-shipped battery shouldn't prevent users from running unrelated commands. The `gofastr agents` family surfaces the warning where it's actionable.

func Reset

func Reset(_ *testing.T)

Reset clears the registry. The *testing.T parameter is a discipline marker — production code can technically pass nil since `testing` is in stdlib, so this is convention, not enforcement.

Types

type Entry

type Entry struct {
	// Name identifies the snippet. For batteries: the directory name
	// (e.g. "admin"). For framework: a sub-area name (e.g. "auditlog").
	Name string
	// Kind is "framework" or "battery".
	Kind Kind
	// ImportPath is the canonical Go import path of the package that
	// registered the entry.
	ImportPath string
	// Markdown is the embedded contents of the package's agents.md.
	// MUST be non-empty — a missing file would silently drop the
	// entry from generated AGENTS.md.
	Markdown string
}

Entry describes a single agent-onboarding snippet.

func All

func All() []Entry

All returns a sorted copy of the inventory. Framework entries come first (so the generated AGENTS.md leads with framework primitives before battery-specific sections), then batteries; alphabetical by Name within each kind.

func MissingMarkdown

func MissingMarkdown() []Entry

MissingMarkdown returns entries that registered with empty Markdown. Callers of `gofastr agents init/sync` print these as warnings so a developer who forgot to embed the file fixes it before the doc generator silently ships an incomplete AGENTS.md.

type Kind

type Kind string

Kind discriminates framework-root helpers from individual batteries.

const (
	// KindFramework is the framework root + its subpackages (audit,
	// dev/livereload, dotenv, etc.).
	KindFramework Kind = "framework"
	// KindBattery is a single battery/* package.
	KindBattery Kind = "battery"
)

Jump to

Keyboard shortcuts

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