agentinit

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package agentinit renders the files "init" writes into a project: app.yaml, AGENTS.md and .mcp.json. All product and binary names come from Names, so nothing here hardcodes a brand.

Index

Constants

View Source
const (
	ModeReadOnly  = "read-only"
	ModeStandard  = "standard"
	ModeFull      = "full"
	ModeAgentCore = "agent-core"
)

MCP modes init accepts. ModeAgentCore selects the small tool profile rather than a class mode.

View Source
const TokenEnvVar = "APP_API_TOKEN" //nolint:gosec // env var name, not a credential

TokenEnvVar is the env var the MCP config references for the API token.

View Source
const URLEnvVar = "APP_API_URL"

URLEnvVar is the env var that overrides the API URL.

Variables

This section is empty.

Functions

func AgentsMD

func AgentsMD(o Options) (string, error)

AgentsMD renders the AGENTS.md instructions.

func AppYAML

func AppYAML(st stackdetect.Stack) (string, error)

AppYAML renders an app.yaml for st and validates it with the platform's own spec parser before returning it.

func Diff

func Diff(old, next string) string

Diff returns a line diff from old to next ("-" removed, "+" added, " " unchanged context omitted), empty when they are equal. It is a plain LCS diff, good enough for the small files init writes.

func MCPArgs

func MCPArgs(mode string) []string

MCPArgs returns the MCP server arguments for mode.

func MCPJSON

func MCPJSON(o Options) (string, error)

MCPJSON renders a stdio .mcp.json that references the token through an env var and never embeds it.

func ValidMode

func ValidMode(m string) bool

ValidMode reports whether m is an accepted MCP mode.

Types

type Names

type Names struct {
	// Product is the display name.
	Product string
	// CLI is the command name (os.Args[0]).
	CLI string
	// MCPBinary is the MCP server binary name.
	MCPBinary string
	// ServerKey is the key under mcpServers in .mcp.json.
	ServerKey string
}

Names carries every user-visible name, resolved by the caller.

type Options

type Options struct {
	Names
	// APIURL is the control plane URL, empty when unknown.
	APIURL string
	// Mode is one of the Mode constants; empty means ModeAgentCore.
	Mode string
	// App is the service name to use in AGENTS.md examples.
	App string
}

Options is everything the renderers need.

Jump to

Keyboard shortcuts

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