Documentation
¶
Index ¶
- Constants
- func AddImport(content []byte, importPath string) []byte
- func AgentsBlockBody(p params.Params) (string, error)
- func CheckManagedBlock(content []byte) (found bool, problem string)
- func IsInvalidManagedBlock(err error) bool
- func MergeManagedBlock(existing []byte, body string) ([]byte, error)
- func MoveInstructions(content []byte, dir string, exists func(rel string) bool, ...) []byte
Constants ¶
const ManagedBlockFix = "keep exactly one begin marker followed by one end marker, or remove both markers to have the block added again"
ManagedBlockFix tells how to repair the markers that CheckManagedBlock reports a problem with.
Variables ¶
This section is empty.
Functions ¶
func AddImport ¶ added in v8.166.0
AddImport returns content with an import of importPath on its first line, unless content imports it already.
func AgentsBlockBody ¶ added in v8.166.0
AgentsBlockBody renders the content of the devctl-managed block in AGENTS.md.
func CheckManagedBlock ¶ added in v8.166.0
CheckManagedBlock reports whether content has a devctl-managed block, or what is wrong with its markers.
func IsInvalidManagedBlock ¶ added in v8.166.0
IsInvalidManagedBlock asserts invalidManagedBlockError.
func MergeManagedBlock ¶ added in v8.166.0
MergeManagedBlock returns the content of an AGENTS.md with body as its devctl-managed block. Without existing content, the result is the block followed by an empty section for the repository's own instructions. Existing content without a block keeps every byte, below the new block. An existing block is replaced in place, keeping every byte around it. The block uses the line ending of the file's first line, and a byte order mark stays first.
func MoveInstructions ¶ added in v8.166.0
func MoveInstructions(content []byte, dir string, exists func(rel string) bool, instructionFiles []string) []byte
MoveInstructions returns content moved from dir to the root AGENTS.md. Relative imports and links that resolve to an existing path from dir are rewritten to resolve to it from the root; other text after an @, such as a team mention, is kept. Imports of instructionFiles are removed, because from AGENTS.md they would import AGENTS.md again: a line with only the import is dropped, and an import in a sentence becomes a mention of the path.
Types ¶
This section is empty.