Documentation
¶
Overview ¶
Package entry provides the domain API for adding entries to context files. It owns the EntryParams type, validation, formatting, and write logic. CLI commands and external consumers (mcp, watch, memory) import this package instead of reaching into cli/add subpackages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
Validate checks that required fields are present for the given entry type.
Parameters:
- params: Entry parameters to validate
- examplesFn: Function returning example text for a given type (pass nil to omit examples from error messages)
Returns:
- error: Non-nil with details about missing fields, nil if valid
func ValidateAndWrite ¶
ValidateAndWrite validates the entry params, writes the entry, and returns the target context file name.
Parameters:
- params: entry parameters with type, content, and optional fields
Returns:
- string: the context file name the entry was written to
- error: validation or write error
func Write ¶
Write formats and writes an entry to the appropriate context file.
Handles the complete the write cycle: read existing content, format the entry, append it, write back, and update the index if needed.
Parameters:
- params: Params containing type, content, and optional fields
Returns:
- error: Non-nil if the type is unknown, the file doesn't exist, or write fails