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.56 kB
/** * Obsidian Storage Adapter * * Writes and reads markdown files in an Obsidian vault on disk. The * adapter is filesystem-shaped — Obsidian vaults are directories of * `.md` files plus a hidden `.obsidian/` config dir we never touch. * * About the official Obsidian CLI: as of Feb 2026 Obsidian ships an * official CLI for vault interactions. Its primary surface is opening * notes / running commands against a *running* Obsidian instance, not * arbitrary external file writes. Obsidian's own file watcher handles * picking up external markdown changes within a few seconds, so direct * fs writes work cleanly when Obsidian is closed and converge quickly * when it's open. * * What this adapter does: * - Reads / writes / lists / deletes markdown files via fs * - Optional CLI reachability probe (when `useCli: true`) — emits a * one-time warning if the user opted into CLI mode but the * `obsidian` binary is missing * - Refuses paths that resolve into the vault's `.obsidian/` config * - Forwards `WriteMeta.frontmatter` into the markdown's YAML * frontmatter when provided * - Does NOT implement `query()` — Obsidian's search is not exposed * via the CLI as of research date * * @design @.aiwg/architecture/storage-design.md (§5.2) * @issue #934 * @issue #957 */ import type { ObsidianBackendConfig, StorageAdapter, StorageEntry, WriteMeta } from '../types.js'; export declare class ObsidianAdapter implements StorageAdapter { /** Absolute path to the root the adapter writes into (vault[/folder]). */ private readonly root; /** Absolute path to the vault — used to enforce the .obsidian/ guard. */ private readonly vault; private readonly useCli; /** Cached result of the CLI reachability probe so we only warn once. */ private cliWarned; constructor(config: ObsidianBackendConfig); /** * Validate a subsystem-relative path. Rejects traversal, absolute * paths, backslashes, and any path that resolves into the vault's * `.obsidian/` config directory. */ private resolveSafe; init(): Promise<void>; /** * One-shot best-effort `obsidian --version` probe. We only warn * (never fail) — direct fs writes still work without the CLI. */ private probeCli; 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=obsidian.d.ts.map