agentmode

package
v0.270.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 3 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 agentmode decides whether the CLI is being driven by a coding agent and should default to compact, prompt-free, colorless machine output.

Index

Constants

View Source
const EnvOverride = "OPENFGA_AGENT_MODE"

EnvOverride is the explicit switch: 1 forces agent mode on, 0 keeps it off even when a coding agent is detected.

Variables

This section is empty.

Functions

func EnvVars

func EnvVars() []string

EnvVars lists OPENFGA_AGENT_MODE plus every detector variable.

Types

type State

type State struct {
	Enabled bool `json:"enabled" yaml:"enabled"`
	// Reason is "--agent", "--agent=false", "OPENFGA_AGENT_MODE=1",
	// "OPENFGA_AGENT_MODE=0", "<DETECTOR>=1", or "" when nothing decided.
	Reason string `json:"reason" yaml:"reason"`
}

State is the resolved agent-mode decision and why it was made.

func Resolve

func Resolve(flag *bool, getenv func(string) string) State

Resolve applies the precedence: the --agent flag (nil when not given), then OPENFGA_AGENT_MODE (unparsable values are ignored), then detector variables, then off.

func (State) Refuse

func (s State) Refuse(thing string) error

Refuse is the usage error for an interactive feature (thing, e.g. "the playground") that cannot run while agent mode is on.

Jump to

Keyboard shortcuts

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