Documentation
¶
Index ¶
- func DefaultDBPath(workDir string) string
- func ExactTitleMatch(query string, note Note) bool
- func FuzzyMatchNote(query string, note Note) int
- type AutoSaveTickMsg
- type ExternalEditorPreparedMsg
- type FocusPane
- type InlineAutoSaveResultMsg
- type InlineAutoSaveTickMsg
- type InlineEditExitedMsg
- type InlineEditStartedMsg
- type Note
- type NoteArchiveToggledMsg
- type NoteContentSavedMsg
- type NoteDeletedMsg
- type NoteFilter
- type NoteMatch
- type NotePinToggledMsg
- type NoteRestoredMsg
- type NoteSavedMsg
- type NotesLoadedMsg
- type Plugin
- func (p *Plugin) BlocksGlobalKeys() bool
- func (p *Plugin) Commands() []plugin.Command
- func (p *Plugin) ConsumesTextInput() bool
- func (p *Plugin) Cursor() *tea.Cursor
- func (p *Plugin) FocusContext() string
- func (p *Plugin) FooterStatus() (string, bool)
- func (p *Plugin) ID() string
- func (p *Plugin) Icon() string
- func (p *Plugin) Init(ctx *plugin.Context) error
- func (p *Plugin) IsFocused() bool
- func (p *Plugin) Name() string
- func (p *Plugin) PreferredMouseMode() tea.MouseMode
- func (p *Plugin) SetFocused(f bool)
- func (p *Plugin) Start() tea.Cmd
- func (p *Plugin) Stop()
- func (p *Plugin) Update(msg tea.Msg) (plugin.Plugin, tea.Cmd)
- func (p *Plugin) View(width, height int) string
- func (p *Plugin) WheelAtBoundary(msg tea.MouseWheelMsg) bool
- type Store
- func (s *Store) Close() error
- func (s *Store) Create(title, content string) (*Note, error)
- func (s *Store) Delete(id string) error
- func (s *Store) Get(id string) (*Note, error)
- func (s *Store) List(includeArchived bool) ([]Note, error)
- func (s *Store) ListArchived() ([]Note, error)
- func (s *Store) ListDeleted() ([]Note, error)
- func (s *Store) NotePath(id string) string
- func (s *Store) Restore(id string) error
- func (s *Store) SaveContent(id, content string) (*Note, error)
- func (s *Store) ToggleArchive(id string) error
- func (s *Store) TogglePin(id string) error
- func (s *Store) Unarchive(id string) error
- func (s *Store) Update(note *Note) error
- func (s *Store) UpdateContent(id, content string) error
- type TaskCreatedMsg
- type UndoAction
- type UndoActionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultDBPath ¶
DefaultDBPath returns the default database path for a given workdir.
func ExactTitleMatch ¶
ExactTitleMatch returns true if query matches a note's title exactly (case-insensitive).
func FuzzyMatchNote ¶
FuzzyMatchNote scores how well query matches a note's title and content. Returns score (0 = no match). Scoring:
- Consecutive matches: bonus per consecutive char
- Word start matches: large bonus
- Title match bonus: prefer title matches over content
- Shorter text: small bonus
Types ¶
type AutoSaveTickMsg ¶
type AutoSaveTickMsg struct {
// ID identifies which auto-save timer this is (for debounce check)
ID int
}
AutoSaveTickMsg is sent when the auto-save debounce timer fires.
type ExternalEditorPreparedMsg ¶ added in v1.0.3
type ExternalEditorPreparedMsg struct {
ID string
Path string
Err error
Epoch uint64
RequestID uint64
}
ExternalEditorPreparedMsg carries an asynchronously-created note export. NotePath may invoke td, so preparing it must never run on Bubble Tea Update.
func (ExternalEditorPreparedMsg) GetEpoch ¶ added in v1.0.3
func (m ExternalEditorPreparedMsg) GetEpoch() uint64
type InlineAutoSaveResultMsg ¶
type InlineAutoSaveResultMsg struct {
Err error
Epoch uint64
Activation uint64
Generation int
Content string
Saved bool
Skipped bool
Sequence uint64
}
InlineAutoSaveResultMsg is sent after an inline auto-save completes.
func (InlineAutoSaveResultMsg) GetEpoch ¶
func (m InlineAutoSaveResultMsg) GetEpoch() uint64
GetEpoch returns the epoch for staleness detection.
type InlineAutoSaveTickMsg ¶
type InlineAutoSaveTickMsg struct {
// Generation identifies which auto-save timer this is (for staleness check)
Generation int
}
InlineAutoSaveTickMsg is sent periodically during inline edit mode for auto-save.
type InlineEditExitedMsg ¶
InlineEditExitedMsg is sent when inline edit mode exits.
type InlineEditStartedMsg ¶
type InlineEditStartedMsg struct {
SessionName string
NoteID string
NotePath string
Editor string
Activation uint64
Epoch uint64
}
InlineEditStartedMsg is sent when inline edit mode starts successfully.
type Note ¶
Note is the plugin's view of a td note.
func FindExactTitleMatch ¶
FindExactTitleMatch returns the note with exact title match, or nil if none.
type NoteArchiveToggledMsg ¶
NoteArchiveToggledMsg is sent when a note's archived state is toggled.
func (NoteArchiveToggledMsg) GetEpoch ¶
func (m NoteArchiveToggledMsg) GetEpoch() uint64
GetEpoch returns the epoch for staleness detection.
type NoteContentSavedMsg ¶
type NoteContentSavedMsg struct {
ID string
Err error
Epoch uint64
EditorActivation uint64 // Non-zero only for an inline-editor save lifecycle.
Generation int // Built-in autosave generation captured at save start.
SaveActivation uint64 // Built-in save lifecycle captured at save start.
RequestID uint64 // Built-in request identity; only one may own completion.
Content string // Bytes this save wrote; empty for inline/export paths.
Note *Note // Canonical note returned by td when available.
External bool // $EDITOR read-back; not a built-in buffer save.
Skipped bool // In-flight write skipped because a newer persist won.
ExportPath string // Retained until an external/inline save is acknowledged.
ExportRequestID uint64 // Owns the retained export save attempt.
WriteSequence uint64 // Orders all content writes for this note.
}
NoteContentSavedMsg is sent when a note's content is saved from the editor.
func (NoteContentSavedMsg) GetEpoch ¶
func (m NoteContentSavedMsg) GetEpoch() uint64
GetEpoch returns the epoch for staleness detection.
type NoteDeletedMsg ¶
NoteDeletedMsg is sent when a note is deleted.
func (NoteDeletedMsg) GetEpoch ¶
func (m NoteDeletedMsg) GetEpoch() uint64
GetEpoch returns the epoch for staleness detection.
type NoteFilter ¶
type NoteFilter int
NoteFilter represents the current note filter view.
const ( FilterActive NoteFilter = iota FilterArchived FilterDeleted )
func (NoteFilter) String ¶
func (f NoteFilter) String() string
String returns the display name for the filter.
type NoteMatch ¶
NoteMatch represents a note matching the search query.
func FilterNotes ¶
FilterNotes filters and scores notes against a query. Returns matches sorted by score descending.
type NotePinToggledMsg ¶
NotePinToggledMsg is sent when a note's pinned state is toggled.
func (NotePinToggledMsg) GetEpoch ¶
func (m NotePinToggledMsg) GetEpoch() uint64
GetEpoch returns the epoch for staleness detection.
type NoteRestoredMsg ¶
NoteRestoredMsg is sent when a note is restored (undo delete/archive).
func (NoteRestoredMsg) GetEpoch ¶
func (m NoteRestoredMsg) GetEpoch() uint64
GetEpoch returns the epoch for staleness detection.
type NoteSavedMsg ¶
type NoteSavedMsg struct {
Note *Note
Err error
Epoch uint64
EditorActivation uint64 // Non-zero only for an inline-editor save lifecycle.
}
NoteSavedMsg is sent when a note is created or updated.
func (NoteSavedMsg) GetEpoch ¶
func (m NoteSavedMsg) GetEpoch() uint64
GetEpoch returns the epoch for staleness detection.
type NotesLoadedMsg ¶
type NotesLoadedMsg struct {
Notes []Note
Err error
RecoveryErr error
Epoch uint64
RequestID uint64
Filter NoteFilter
}
NotesLoadedMsg is sent when notes are loaded from the database.
func (NotesLoadedMsg) GetEpoch ¶
func (m NotesLoadedMsg) GetEpoch() uint64
GetEpoch returns the epoch for staleness detection.
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
Plugin implements the notes plugin.
func (*Plugin) BlocksGlobalKeys ¶ added in v0.96.0
BlocksGlobalKeys reports whether a plugin-owned modal has keyboard focus.
func (*Plugin) ConsumesTextInput ¶
ConsumesTextInput reports whether notes currently has an active text-entry surface and should receive printable keys directly.
func (*Plugin) Cursor ¶ added in v0.88.0
Cursor exposes the inline editor's native cursor in plugin-local coordinates.
func (*Plugin) FocusContext ¶
FocusContext returns the current focus context.
func (*Plugin) FooterStatus ¶ added in v1.0.3
FooterStatus keeps slow/failed saves visible after the transient toast.
func (*Plugin) PreferredMouseMode ¶ added in v0.88.0
PreferredMouseMode reduces idle hover traffic only while the inline terminal owns input. Modal and ordinary notes views retain all-motion hover.
func (*Plugin) WheelAtBoundary ¶ added in v1.0.0
func (p *Plugin) WheelAtBoundary(msg tea.MouseWheelMsg) bool
WheelAtBoundary implements plugin.WheelBoundaryConsumer for the Notes list and markdown preview. It mirrors handleMouseScroll's routing without moving the cursor, loading a note, or rendering.
Textarea edit mode stays unknown: ScrollYOffset is readable but the last reachable offset is not a public contract, so inventing a boundary would mis-report. Keep this false rather than guessing. The inline tmux editor's wheel belongs to the embedded application and is not translated into textarea rules. Open modals are answered by the modal itself, in the same precedence Update uses, and never by the panes underneath.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists notes through the td CLI. Sidecar must never open .todos/issues.db itself — a second long-lived SQLite writer alongside transient td processes corrupts the WAL (td-adbf16). Tests use the in-process backend via NewTestStore against an isolated database.
func NewStore ¶
NewStore returns a lazy CLI-backed store rooted at the project directory. It deliberately does no PATH or database I/O: plugin Init runs before the first frame, while the first List call runs in a tea.Cmd and reports any missing td binary/database asynchronously. baseDir is the project root (not the issues.db path). sessionID, when non-empty, is exported as TD_SESSION_ID for attribution.
func NewTestStore ¶ added in v1.0.0
NewTestStore creates an isolated in-process td database for tests.
func (*Store) Get ¶
Get retrieves a note by ID, including soft-deleted rows. Missing notes return (nil, nil) to match the previous store contract.
func (*Store) ListArchived ¶
ListArchived retrieves archived, non-deleted notes.
func (*Store) ListDeleted ¶
ListDeleted retrieves soft-deleted notes.
func (*Store) NotePath ¶
NotePath writes the note to a unique 0600 temp file for an external editor.
func (*Store) SaveContent ¶ added in v1.0.3
SaveContent updates only the body and returns td's canonical updated note. Production deliberately performs one td invocation: `td note edit` already validates that the note exists and is live. The in-process test adapter must read the current title because the package API takes title and content.
func (*Store) ToggleArchive ¶
ToggleArchive toggles the archived state of a note.
func (*Store) Update ¶
Update writes title and content. Pin/archive changes should use TogglePin / ToggleArchive — td's Update does not touch those flags.
func (*Store) UpdateContent ¶
UpdateContent updates the body of a note and leaves Title unchanged. Title is set at create time (NV query / first line); content-only saves must not clobber a title written via td note edit --title.
type TaskCreatedMsg ¶
TaskCreatedMsg is sent when a task is created from a note.
func (TaskCreatedMsg) GetEpoch ¶
func (m TaskCreatedMsg) GetEpoch() uint64
GetEpoch returns the epoch for staleness detection.
type UndoAction ¶
type UndoAction struct {
Type UndoActionType
NoteID string
Title string // For toast message
}
UndoAction represents an undoable action.
type UndoActionType ¶
type UndoActionType string
UndoActionType represents the type of undoable action.
const ( UndoDelete UndoActionType = "delete" UndoArchive UndoActionType = "archive" )