joakim f5f7bc3ad7 feat: Complete key:value format implementation and fix tag sync
Implement complete key:value format parsing for change log entries and fix
critical tag synchronization issue from server to client.

Key Changes:

1. Shared Key:Value Parser (NEW: internal/engine/parser.go)
   - Created ParseKeyValueFormat() for both edit and sync operations
   - Supports flexible whitespace: 'key:value' and 'key: value'
   - Handles comment skipping for edit files
   - Consolidates parsing logic (DRY principle)

2. Database Triggers - Tags Support (internal/engine/database.go)
   - Added tags to track_task_create trigger
   - Added tags to track_task_update trigger
   - Tags sorted alphabetically via SQL ORDER BY
   - Format: 'tags: alpha,bravo,charlie'

3. Task Creation - Tag Update Fix (internal/engine/task.go)
   - CreateTaskWithModifier() now triggers update after adding tags
   - Ensures tags appear in change log (UPDATE entry)
   - Fixes missing tags in initial CREATE entries

4. Edit Command - Use Shared Parser (cmd/edit.go)
   - Replaced custom parseEditedFile() with shared ParseKeyValueFormat()
   - Added tag sorting in parseTags()
   - Removed ~30 lines, improved maintainability

5. Sync Client - Complete Implementation (internal/sync/client.go)
   - NEW: applyChangeDataToTask() - parses all fields from change log
   - NEW: Helper functions for status, priority, tag parsing
   - FIXED: parseChanges() - sort by timestamp+ID before grouping
   - Added parent/child task ordering (prevents FK violations)
   - Enhanced tag sync in merge loop with task reload
   - Specific validation error messages per field

Critical Bug Fix:
- When CREATE and UPDATE have same timestamp, old code kept CREATE (no tags)
- New code sorts by ID as tiebreaker, ensuring UPDATE (with tags) is used
- Verified: Server->client tag sync now works correctly

Validation:
- Description must not be empty (both edit and sync)
- Recurrence validated (not negative, max 100 years)
- All timestamps parsed correctly (Unix epoch)
- Tags sorted alphabetically in all contexts

Testing:
- Fresh pull from server:  All tags present
- API-created tasks:  Tags sync correctly
- Local->server->client round-trip:  No data loss
- Same-second CREATE+UPDATE:  Correct entry processed
- Parent/child tasks:  Correct ordering

Files Changed:
- NEW: internal/engine/parser.go (+44 lines)
- Modified: internal/engine/database.go (+10 lines)
- Modified: internal/engine/task.go (+8 lines)
- Modified: cmd/edit.go (-25 lines net)
- Modified: internal/sync/client.go (+280 lines)
- Modified: srv/README.md (+1 line)

Total: +318 lines added, -25 removed, net +293 lines

This completes Phase 6: Full bidirectional sync with complete tag support.
2026-01-05 18:56:17 +01:00
2026-01-01 21:54:36 +01:00

Notr

Simple Go application for organizing and referencing notes. Loosely based on Obsidian.

Implementation: See jade-depo/ directory for the CLI tool.

Workflow

I take notes in two primary ways:

Phone

  • Quick notes, on the go.
  • View and search notes.

Workstation

  • Using NeoVim for notetaking

Other infrastructure

  • I host a VPS with a Nextcloud and Gitea instances.

What I want

  • A Obsidian Vault like structure. A folder where notes live.
  • A file is a note
  • Can also store attachments, such as images. These files can then be referenced in the relevant notes.
  • Directories is the main organization method, although tags and links can seam-lesly cross directories boundries.
  • Markdown syntax (this can be handled by NeoVim and a markdown editor on other devices.)
  • Tags: Syntax +tag
  • Note links for referencing other notes or any other vault files. Syntax uncertain. Obsidian uses ?
  • See reports about the vault. Tag report
  • At some point I would like to have a web-app and host it on my server. This would integrate with my authentik service for auth, and would be a live view of a users vault
  • OCR would be great.

Implementation

I have a tendency to scope creep and never actually getting a usable product, so an important goal here is practicing getting a usable app up and running. This should not have to be the biggest project, so I'll try to predict the process:

Version 0.1

Here I use other tools for the note-taking and accept that any searching is on a directory basis only.

  • I create a directory in Nextcloud. This I will start using immediately.
  • Find a good Markdown editor for android.
  • Adopt any crutial Obsidian notes

Version 1.0 ✓

This is where I can use Notr to find and search notes on my workstation. CLI implementation complete!

  • Process notes. Metadata and diffs
  • Search and Filter by tags
  • Search and Filter by content
  • Add, edit, delete notes
  • List all notes and tags

Version 2.0

Here I can do the same on my phone.

Also:

  • OCR

Metadata approach

Multiple approaches possible.

S
Description
Personal productivity tools
Readme 999 KiB
Languages
Go 75.3%
Svelte 17.5%
JavaScript 5.3%
CSS 1.2%
HTML 0.4%
Other 0.3%