apply

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: 14 Imported by: 0

Documentation

Overview

Package apply routes context updates to the appropriate handler for writing entries or completing tasks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyUpdate

func ApplyUpdate(update core.ContextUpdate) error

ApplyUpdate routes a context update to the appropriate handler.

Dispatches based on the update type to add entries to context files or mark tasks complete. For learnings and decisions, uses structured fields (context, lesson, application, rationale, consequence) if provided in the XML attributes.

Parameters:

  • update: ContextUpdate containing type, content, and optional metadata

Returns:

  • error: Non-nil if type is unknown or the handler fails

func RunAddSilent

func RunAddSilent(update core.ContextUpdate) error

RunAddSilent appends an entry to a context file without output.

Used by the watch command to silently apply updates detected in the input stream. Uses shared validation and write logic from the add package to ensure consistent behavior with `ctx add`.

Parameters:

  • update: The parsed ContextUpdate with type, content, and required structured fields (context, lesson, application for learnings; context, rationale, consequence for decisions)

Returns:

  • error: Non-nil if validation fails, type is unknown, or file operations fail

func RunCompleteSilent

func RunCompleteSilent(args []string) error

RunCompleteSilent marks a task as complete without output.

Used by the watch command to silently complete tasks detected in the input stream. Searches for an unchecked task matching the query and marks it as done by changing [ ] to [x].

Parameters:

  • args: Slice where args[0] is the search query to match against task descriptions (case-insensitive substring match)

Returns:

  • error: Non-nil if args is empty, no matching task is found, or file operations fail

Types

This section is empty.

Jump to

Keyboard shortcuts

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