file

package
v8.166.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

func AddImport(content []byte, importPath string) []byte

AddImport returns content with an import of importPath on its first line, unless content imports it already.

func AgentsBlockBody added in v8.166.0

func AgentsBlockBody(p params.Params) (string, error)

AgentsBlockBody renders the content of the devctl-managed block in AGENTS.md.

func CheckManagedBlock added in v8.166.0

func CheckManagedBlock(content []byte) (found bool, problem string)

CheckManagedBlock reports whether content has a devctl-managed block, or what is wrong with its markers.

func IsInvalidManagedBlock added in v8.166.0

func IsInvalidManagedBlock(err error) bool

IsInvalidManagedBlock asserts invalidManagedBlockError.

func MergeManagedBlock added in v8.166.0

func MergeManagedBlock(existing []byte, body string) ([]byte, error)

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.

Jump to

Keyboard shortcuts

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