routing

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package routing defines which environment variables agentmod routes while a project is active (IMPLEMENTATION_PLAN §8) and the names of agentmod's own bookkeeping variables (FABLE_PLAN §14). `agentmod env` emits these on activation; doctor later audits shells against the same single source.

layout defines what init CREATES on disk; this package defines what the shell hook ROUTES to those locations. Paths that exist only as routing targets (node/bin, npm-cache, the XDG roots) are named here.

Index

Constants

View Source
const (
	// EnvActive is "1" while a project's routing is applied in this shell.
	EnvActive = "AGENTMOD_ACTIVE"
	// EnvProjectRoot is the project root the routing was applied for.
	EnvProjectRoot = "AGENTMOD_PROJECT_ROOT"
	// EnvRoot is the .agentmod directory of that project.
	EnvRoot = "AGENTMOD_ROOT"
	// EnvVarsList records, space-separated, which routed variables were set
	// at activation. Deactivation restores exactly this list, so it stays
	// correct even if agentmod.toml changes (or disappears) while inside
	// the project.
	EnvVarsList = "AGENTMOD_VARS"
	// SavedPrefix prefixes the saved pre-activation value of a routed
	// variable (D006). Absence of AGENTMOD_SAVED_<VAR> means <VAR> was
	// unset before activation, so deactivation unsets it.
	SavedPrefix = "AGENTMOD_SAVED_"
)

Bookkeeping variables owned by agentmod (uppercase per FABLE_PLAN §14).

Variables

This section is empty.

Functions

func NodeBinDir

func NodeBinDir(agentmodDir string) string

NodeBinDir is the single PATH entry agentmod manages: prepended once on activation (when node routing is enabled), stripped on deactivation.

func RoutedNames

func RoutedNames() []string

RoutedNames returns the name of every variable agentmod can ever route, independent of any particular project's config (single source: Vars with every agent and XDG opt-in enabled). Doctor uses it to detect routed values lingering in shells that are outside any project.

Types

type Var

type Var struct {
	Name  string
	Value string
}

Var is one routed environment variable.

func Vars

func Vars(agentmodDir string, cfg config.Config) []Var

Vars returns the variables to route for a project with the given .agentmod directory and config, in stable emission order. Disabled agents contribute nothing. PATH is handled separately (prepend/strip, not set/restore).

Jump to

Keyboard shortcuts

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