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 ¶
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.