agentinit

package
v0.1.1 Latest Latest
Warning

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

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

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.

Index

Constants

View Source
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.

View Source
const NextSteps = `` /* 155-byte string literal not displayed */

NextSteps tells the human how to finish the set-up; print it once after the notes of every agent.

Variables

This section is empty.

Functions

func Agents

func Agents() []string

Agents returns the supported agent names.

func ProjectRoot

func ProjectRoot(cwd string) string

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
	Status string
	Detail string // why a file was kept, when it was
}

Action reports what Init did to one file.

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.

func Init

func Init(root, agent string) (Result, error)

Init writes the integration files of agent into the project at root. Every change is computed and checked before the first write, so an invalid existing file or an escaping symlink leaves the project untouched.

Jump to

Keyboard shortcuts

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