Help us shape the future of Go! Take the 2026 Go Developer Survey

adapters

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package adapters defines the contract every AI-agent integration implements. Adapters only translate: agent JSON ↔ hookapi types, and desired config edits → install.Plan. All decision logic lives in the core packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(a Agent)

Register adds an adapter; called from each adapter package's init().

Types

type Agent

type Agent interface {
	// Name is the agent identifier used on the command line (--agent).
	Name() hookapi.Agent

	// Detect reports whether the agent appears installed for env's HOME.
	Detect(env install.Env) bool

	// ParseEvent converts a raw hook payload into the neutral event.
	// event is the event name graphmaster was invoked with; env is os.Environ().
	ParseEvent(event hookapi.Event, payload []byte, env []string) (hookapi.HookEvent, error)

	// RenderDecision converts a neutral decision into the agent's wire format.
	RenderDecision(ev hookapi.HookEvent, d hookapi.Decision) HookOutput

	// InstallPlan describes every config edit needed for MCP registration,
	// hooks and instructions at user level.
	InstallPlan(env install.Env, opts InstallOptions) (install.Plan, error)

	// Notes returns human-facing post-install reminders (e.g. Codex /hooks trust).
	Notes(env install.Env) []string
}

Agent is implemented by each package under internal/adapters/<agent>.

func All

func All() []Agent

All returns registered adapters in hookapi.AllAgents order.

func Get

func Get(name hookapi.Agent) (Agent, bool)

Get returns the adapter for name.

type HookOutput

type HookOutput struct {
	Stdout   []byte
	Stderr   []byte
	ExitCode int
}

HookOutput is what the hook dispatcher writes back to the agent process.

type InstallOptions

type InstallOptions struct {
	// Binary is the stable absolute path of the graphmaster executable.
	Binary string
	// Instructions is the agent-neutral steering text placed in the agent's
	// instruction file (CLAUDE.md, AGENTS.md, ...).
	Instructions string
}

InstallOptions carries what an adapter needs to build its install plan.

Directories

Path Synopsis
Package claude adapts Claude Code to graphmaster: it parses Claude's hook payloads, renders decisions as hookSpecificOutput JSON and builds the user-level install plan (~/.claude.json, ~/.claude/settings.json and ~/.claude/CLAUDE.md).
Package claude adapts Claude Code to graphmaster: it parses Claude's hook payloads, renders decisions as hookSpecificOutput JSON and builds the user-level install plan (~/.claude.json, ~/.claude/settings.json and ~/.claude/CLAUDE.md).
Package codex adapts the OpenAI Codex CLI to graphmaster.
Package codex adapts the OpenAI Codex CLI to graphmaster.
Package cursor adapts graphmaster to the Cursor editor's agent.
Package cursor adapts graphmaster to the Cursor editor's agent.
Package opencode integrates graphmaster with OpenCode (v1.x).
Package opencode integrates graphmaster with OpenCode (v1.x).

Jump to

Keyboard shortcuts

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