Changeset 0.17.3 (#78)

This commit is contained in:
2026-02-28 15:20:23 +00:00
parent a008dac488
commit 12e316c234
29 changed files with 3347 additions and 65 deletions

View File

@@ -2,6 +2,92 @@
All notable changes to Chat Switchboard.
## [0.17.3] — 2026-02-28
### Added
- **Wikilink bi-directional linking.** Notes support `[[Title]]` and
`[[Title|display text]]` syntax. Links are extracted on save via regex,
resolved to target note IDs by case-insensitive title match, and stored
in a `note_links` junction table. Dangling links (references to notes
that don't exist yet) are preserved and automatically resolved when a
matching note is created later.
- **Transclusion embeds.** `![[Title]]` syntax renders embedded note content
inline in read mode. Content is fetched asynchronously with a recursion
guard (max depth 1 — nested transclusions render as plain text references).
Transclusion links are visually distinct in both the editor (border-left,
italic) and the graph (dashed edges).
- **Backlinks panel.** Read mode shows a collapsible "Linked mentions" panel
below the note content listing all notes that link to the current note.
Each backlink is clickable to navigate directly. Count badge updates on
every note open.
- **Knowledge graph visualization.** Canvas-based force-directed graph with
no external dependencies (~480 lines). Physics: O(n²) Coulomb repulsion,
Hooke spring attraction on edges, center gravity. Interaction: pan, zoom
(0.154.0x toward cursor), drag nodes, hover highlights node + neighbors.
Click opens note editor. Nodes sized by √(link_count), colored by folder
path (10-color palette). Ghost nodes for unresolved `[[links]]` with
toggle button. Energy-based pause (stops rAF when total kinetic energy
falls below threshold). ResizeObserver for responsive canvas sizing.
- **CM6 note editor.** New `CM.noteEditor()` factory function with live
markdown preview (heading sizes for h1h3, blockquote styling, fenced code
block decorations), `[[wikilink]]` autocomplete triggered by `[[` with
async title search, and clickable wikilink chip rendering. Falls back to
plain `<textarea>` if CM6 bundle is unavailable.
- **Wikilink autocomplete.** Typing `[[` in the note editor triggers an
async completion popup backed by `GET /notes/search-titles?q=`. Results
are fetched via `ILIKE` title match, limited to 8 suggestions. Selecting
a result inserts the full `[[Title]]` syntax.
- **Daily notes.** "Today" button in the notes toolbar creates or opens a
daily note titled `Daily — YYYY-MM-DD` in the `/daily/` folder with a
starter template (Tasks + Notes sections). Idempotent — repeated clicks
navigate to the existing daily note.
- **Save-to-note from chat.** "Note" button in message action bar captures
the full message content (or the current text selection within that message)
into a new note with pre-filled title extracted from the first line.
Provenance is tracked via `source_message_id` column on the notes table,
enabling future jump-to-source navigation.
- **API endpoints.** Three new authenticated endpoints:
- `GET /notes/search-titles?q=&limit=` — lightweight title search for
autocomplete (returns `[{id, title}]`).
- `GET /notes/:id/backlinks` — notes linking to the specified note, with
display text and metadata.
- `GET /notes/graph` — full graph topology: nodes (with inbound/outbound
link counts), resolved edges, and unresolved (dangling) link titles.
- **`note_links` table.** New junction table with `source_note_id`,
`target_note_id` (nullable for dangling links), `target_title`,
`display_text`, `is_transclusion`, and `created_at`. Primary key on
`(source_note_id, target_title)`. Index on `target_note_id` for backlink
queries. Migrations for both Postgres and SQLite.
- **`source_message_id` column.** New nullable UUID column on `notes` table
for chat-to-note provenance tracking.
- **Wikilink extraction package.** Standalone `notelinks/` package with
regex-based parser handling `[[Title]]`, `[[Title|Display]]`,
`![[Title]]`, and `![[Title|Display]]`. Deduplicates by lowercase title,
preserves first occurrence. 10 unit tests covering edge cases.
### Changed
- Notes editor replaces `<textarea>` with CM6 `noteEditor` instance. The
container `#noteEditorContentContainer` is lazily initialized on first
edit; destroyed on panel close to avoid stale state.
- Note create and update handlers now extract wikilinks from content and
call `ReplaceLinks()` (transactional DELETE + batch INSERT). Create also
calls `ResolveByTitle()` to fix dangling links from other notes.
- `showNotesList()` destroys the CM6 editor instance and hides graph view.
- `saveNote()` and `deleteNote()` call `invalidateNoteGraph()` to clear
the cached graph data.
- Read mode renders `[[wikilinks]]` as styled clickable chips via post-
processing of the formatted HTML. Clicking navigates to the linked note
or offers to create it if not found.
- `ARCHITECTURE.md` updated with `notelinks/` package, `note-graph.js`,
`CM.noteEditor()` factory, and expanded notes description covering the
linking model.
- `ROADMAP.md` updated with full v0.17.3 section including all checklist
items.
- CM6 bundle entrypoint (`index.mjs`) exports `noteEditor` alongside
existing `chatInput` and `codeEditor`.
- `theme.mjs` adds `noteEditorTheme` with full-height layout (min 200px,
max 60vh), heading size decorations, and blockquote styling.
## [0.17.2] — 2026-02-28
### Added