Documentation
¶
Overview ¶
Package agentinit implements `locksql init <agent>`: it writes the files that connect a coding agent to locksql inside one project, and prints the steps for any file outside it.
Init writes project files only. It never overwrites a file the human may have edited: an existing skill or rule is kept, an MCP config gets the locksql 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 path is resolved through symlinks and refused if it leaves the project.
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.
Index ¶
Constants ¶
const ( StatusCreated = "created" // the file did not exist StatusUpdated = "updated" // locksql was merged into an existing file StatusUnchanged = "unchanged" // the file already holds the locksql content StatusKept = "kept" // the file differs and was left as the human wrote it )
Action statuses.
Variables ¶
This section is empty.
Functions ¶
func PendingUser ¶ added in v0.1.2
PendingUser reports whether InitUser would write or run anything.
func ProjectRoot ¶
ProjectRoot returns the directory init writes to: the nearest ancestor of cwd holding .locksql/config.toml, else the nearest one holding .git, else cwd itself.
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 Init did to one file.
type Env ¶ added in v0.1.2
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 init 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 Init.