Documentation
¶
Overview ¶
User scope: wires agents through files under the home directory (and `claude mcp add --scope user`). Symlinks are followed: these are the human's own files, often managed as dotfiles.
Package agentwire connects coding agents (Claude Code, Codex, Cursor, Gemini CLI) to a product's MCP server: in one project (`<name> init <agent>`) or for the user's account in every project (bare `<name>`, `<name> doctor --fix`). The product supplies its texts and its MCP command (Assets); agentwire owns the file mechanics.
It never overwrites a file the human may have edited: an existing skill or rule is kept, an MCP config gets the product's entry merged in (other servers and keys are kept), and a Markdown instructions file gets one marked section appended. Running it again changes nothing. Every change is computed and checked before the first write. In a project every path is resolved through symlinks and refused if it leaves the project; in the user scope symlinks are followed (dotfiles) but a file of another account is never replaced.
Index ¶
Constants ¶
const ( StatusCreated = "created" // the file did not exist StatusUpdated = "updated" // the product's entry was merged into an existing file StatusUnchanged = "unchanged" // the file already holds the product's content StatusKept = "kept" // the file differs and was left as the human wrote it )
Action statuses.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct {
Path string // slash-separated, relative to the project root (or ~/... in the user scope)
Status string
Detail string // why a file was kept, when it was
}
Action reports what wiring did to one file.
type Assets ¶
type Assets struct {
// MCPCommand starts the product's MCP server ({"lockmq", "mcp"}).
MCPCommand []string
// Skill is the Claude Code skill (skills/<name>/SKILL.md).
Skill []byte
// Instructions are the shared agent instructions: the marked section of
// AGENTS.md and GEMINI.md, and the body of the Cursor rule.
Instructions []byte
// CursorFrontMatter starts the Cursor rule (.cursor/rules/<name>.mdc).
CursorFrontMatter []byte
// ProjectConfig is the commented example .<name>/config.toml a project
// init creates when there is none; nil creates none.
ProjectConfig []byte
// ClaudeAllow are the calls merged into Claude Code's
// permissions.allow at user scope, and listed in the project notes:
// only calls that never touch data without the console's approval.
ClaudeAllow []string
// ClaudeNote ends the Claude Code notes of a project init (optional).
ClaudeNote string
}
Assets are a product's texts and command. agentwire writes them as they are.
type Env ¶
type Env struct {
Home string
Getenv func(string) string
LookPath func(string) (string, error)
// Run runs a command and returns its combined output.
Run func(name string, args ...string) ([]byte, error)
}
Env is the user account wiring works on, and how it looks for and runs the agents' commands.
type Result ¶
type Result struct {
Root string
Actions []Action
Notes string // agent-specific steps for the human, such as a global file to edit
}
Result is the outcome of a wiring.
type Wiring ¶
Wiring wires agents to one product.
func (Wiring) Init ¶
Init writes the integration files of agent into the project at root. An invalid existing file or an escaping symlink leaves the project untouched.
func (Wiring) PendingUser ¶
PendingUser reports whether InitUser would write or run anything.