Documentation
¶
Index ¶
- func DefaultDBPath(workDir string) string
- func ExactTitleMatch(query string, note Note) bool
- func FuzzyMatchNote(query string, note Note) int
- type ActionType
- type AutoSaveTickMsg
- 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) Commands() []plugin.Command
- func (p *Plugin) ConsumesTextInput() bool
- func (p *Plugin) FocusContext() string
- 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) 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
- 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) 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. It checks for .td-root link file first, which points to a shared td root.
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 ActionType ¶
type ActionType string
ActionType represents the type of action performed.
const ( ActionCreate ActionType = "create" ActionUpdate ActionType = "update" ActionDelete ActionType = "delete" )
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 InlineAutoSaveResultMsg ¶
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 ¶
InlineEditStartedMsg is sent when inline edit mode starts successfully.
type Note ¶
type Note struct {
ID string `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Pinned bool `json:"pinned"`
Archived bool `json:"archived"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
}
Note represents a single 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 ¶
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 ¶
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 ¶
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) ConsumesTextInput ¶
ConsumesTextInput reports whether notes currently has an active text-entry surface and should receive printable keys directly.
func (*Plugin) FocusContext ¶
FocusContext returns the current focus context.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store handles SQLite operations for notes.
func NewStore ¶
NewStore creates a new Store with the given database path and session ID. If sessionID is empty, it checks TD_SESSION_ID env var, then falls back to "sidecar".
func (*Store) ListArchived ¶
ListArchived retrieves only archived notes (not deleted), ordered by updated_at.
func (*Store) ListDeleted ¶
ListDeleted retrieves only soft-deleted notes, ordered by deleted_at (most recent first).
func (*Store) NotePath ¶
NotePath returns the path to the note file for external editor. Since notes are stored in SQLite, this creates a temporary file. Returns empty string if note doesn't exist or on error.
func (*Store) ToggleArchive ¶
ToggleArchive toggles the archived state of a note.
func (*Store) UpdateContent ¶
UpdateContent updates the content of a note.
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" )