/** * Logseq Storage Adapter * * Writes and reads markdown files in a Logseq graph on disk. Like the * Obsidian adapter, this is filesystem-shaped — Logseq graphs are * directories of `.md` (or `.org`) files plus a `logseq/` config dir * we never touch. * * About the Logseq HTTP API: as of April 2025 the DB-backed Logseq * rewrite is still in development; file-backed graphs remain primary. * Logseq exposes an HTTP API at `http://127.0.0.1:12315/api` (with a * bearer token issued from Settings → Features → Developer mode), but * verifying its exact command surface requires hands-on Logseq access. * * What this adapter does: * - Reads / writes / lists / deletes markdown files via fs * - Optional HTTP API reachability probe (when `useApi: true`) — * emits a one-time stderr warning if `LOGSEQ_API_TOKEN` is unset or * the API is unreachable * - Refuses paths into the graph's `logseq/` config directory * - Transforms `WriteMeta.frontmatter` from YAML into Logseq's * page-level `property:: value` syntax * - Never writes block IDs (`id::`) — Logseq auto-assigns them * * Path layout (mirrors Logseq's on-disk conventions): * pages/