UNPKG

aiwg

Version:

Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo

58 lines 2.44 kB
/** * 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/<title>.md regular pages * journals/YYYY_MM_DD.md journal entries * logseq/* REFUSED (Logseq config) * * @design @.aiwg/architecture/storage-design.md (§5.3) * @issue #934 * @issue #958 */ import type { LogseqBackendConfig, StorageAdapter, StorageEntry, WriteMeta } from '../types.js'; export declare class LogseqAdapter implements StorageAdapter { /** Absolute path to the Logseq graph root. */ private readonly graph; private readonly apiUrl; private readonly useApi; private apiWarned; constructor(config: LogseqBackendConfig); init(): Promise<void>; /** * One-shot API reachability probe. Warns once on missing token or * unreachable endpoint. Direct fs writes still work without it. */ private probeApi; /** * Validate a subsystem-relative path. Rejects traversal, absolute * paths, backslashes, and any path inside the graph's `logseq/` dir. */ private resolveSafe; read(path: string): Promise<string | null>; write(path: string, content: string, meta?: WriteMeta): Promise<void>; list(prefix: string): Promise<StorageEntry[]>; delete(path: string): Promise<void>; } //# sourceMappingURL=logseq.d.ts.map