quickadd

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package quickadd normalizes the natural-language conventions people type into a task's text — across the CLI, TUI, web, and MCP add paths — so they all behave identically. It resolves inline date keys (due:, t:) through dateparse (so "due:fri" becomes a real date instead of the literal string "fri", the bug where the web quick-add silently corrupted task structure) and lifts a leading/standalone priority marker ("!high", "!a") onto the task.

It is deliberately conservative: it only acts on explicit, unambiguous tokens (a recognized key with a parseable value, or a "!"-prefixed priority word) and never guesses a date from free prose, so literal description text is never mangled and the todo.txt round-trip stays lossless.

Index

Constants

View Source
const LongCaptureThreshold = 240

LongCaptureThreshold is the rune count past which a captured task is treated as paragraph-length and split into a short clause title on the task plus a linked note holding the full text. It is deliberately HIGH: the UX/PKM evidence (see the title-length research) says verbose single sentences should be tidied by the agent guidance + display clamp, not by silently minting a near-duplicate note per task (the collector's-fallacy / orphan-note risk). So this gates only genuine multi-sentence "the agent pasted a paragraph" dumps; a normal title — even a wordy one — sits well under it. Gates only the MCP nt_add path.

Variables

This section is empty.

Functions

func Apply

func Apply(t *task.Task)

Apply normalizes an already-parsed task in place (inline date keys resolved, priority marker lifted). New calls it; surfaces that build a task another way can call it directly.

func New

func New(text string) *task.Task

New builds a task from a raw quick-add string, applying the natural-language conventions. Unlike task.New (which keeps the whole string as the description for callers that compose text from flags), it parses inline tokens the way a todo.txt line is parsed — so "pay rent due:fri @home !high" yields a task with a real due date, an @home context, and priority A. The task is assigned an id.

func SplitLong added in v0.10.0

func SplitLong(text string) (title, body string, ok bool)

SplitLong decides whether a captured task's text is paragraph-length and should be split into a short, actionable task title plus a note body holding the full text. It returns the short title, the body (the original text), and true when text exceeds the threshold; otherwise "", "", false. It is pure — the caller creates the note and links the task.

Types

This section is empty.

Jump to

Keyboard shortcuts

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