entry

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

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

func Validate(params Params, examplesFn func(string) string) error

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

func ValidateAndWrite(params Params) (string, error)

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

func Write(params Params) error

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

Types

type Params

type Params = entity.EntryParams

Params is the shared entry parameter type.

Jump to

Keyboard shortcuts

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