nodejs-omnifocus-bridge
v0.1.1
Published
Standalone OmniFocus reader and CLI for local macOS installs and encrypted vaults.
Downloads
266
Maintainers
Readme
nodejs-omnifocus-bridge
nodejs-omnifocus-bridge is a read-only OmniFocus reader for Node.js and TypeScript.
It understands both OmniFocus database formats:
- the local macOS database used directly by the OmniFocus app
- the encrypted OmniFocus vault format used for synced and self-hosted setups
The package also recreates OmniFocus-style availability logic, so you can work with tasks the way OmniFocus presents them instead of just parsing raw XML.
What You Get
- a library for reading OmniFocus data into structured JavaScript objects
- a CLI for printing that data as JSON or as a terminal-friendly ASCII tree
- snapshot helpers for
available,remaining,completed,dropped, oralltask views
The project is intentionally read-only. It does not modify OmniFocus data.
Requirements
- Node.js 20+
- macOS for direct access to the local OmniFocus container
- encrypted vault reading also works on non-macOS systems
Install
Install the library in a project:
npm install nodejs-omnifocus-bridgeRun the CLI without a global install:
npx --package nodejs-omnifocus-bridge omnifocus-list --helpOr install the CLI globally:
npm install -g nodejs-omnifocus-bridgeCLI Quickstart
Show available tasks from the auto-detected source:
npx --package nodejs-omnifocus-bridge omnifocus-list --filter availableRead the local macOS database explicitly:
npx --package nodejs-omnifocus-bridge omnifocus-list --source localRead an encrypted vault from disk:
OMNIFOCUS_PASSWORD="secret" npx --package nodejs-omnifocus-bridge omnifocus-list --source vault --path /path/to/OmniFocus.ofocusGet structured JSON instead of the ASCII view:
npx --package nodejs-omnifocus-bridge omnifocus-list --jsonCLI Options
--filter <available|remaining|dropped|completed|all>--source <auto|local|vault>--path <path>--password <password>: supported, but avoid it because shell history and process lists can expose secrets--base-only--json-h, --help-v, --version
If a vault password is required and OMNIFOCUS_PASSWORD is not set, the CLI prompts for it in an interactive terminal.
Environment Variables
OMNIFOCUS_PASSWORDOMNIFOCUS_LOCAL_PATHOMNIFOCUS_VAULT_PATH
Auto mode resolves sources in this order:
--pathOMNIFOCUS_LOCAL_PATH- OmniFocus 4 default macOS container path
- OmniFocus 3 default macOS container path
OMNIFOCUS_VAULT_PATH
Library Quickstart
import {
createSnapshot,
readOmniFocus,
renderTaskChart
} from "nodejs-omnifocus-bridge";
const document = await readOmniFocus({
source: "local"
});
const snapshot = createSnapshot(document, "available");
console.log(`Available tasks: ${snapshot.filtered.tasks.length}`);
console.log(renderTaskChart(snapshot));Examples And Reference
- Runnable examples live in examples/README.md
- Public API reference lives in docs/reference.md
Example scripts included in this repository:
Public API
The root package export is intentionally focused on the main workflow:
readOmniFocusresolveOmniFocusSourcecreateSnapshotcreateContextTreecreateInboxTreecreateProjectTreerenderTaskChart
Advanced APIs are still available through explicit subpath imports:
import { OmniFocusDecryptor } from "nodejs-omnifocus-bridge/crypto";
import { TaskFilterService } from "nodejs-omnifocus-bridge/filter";
import { SaxOmniFocusParser } from "nodejs-omnifocus-bridge/parser";
import { OmniFocusReader } from "nodejs-omnifocus-bridge/reader";
import { LoggerService } from "nodejs-omnifocus-bridge/utils";Security And Privacy
- The tool reads OmniFocus data directly from your local filesystem; it does not send task data over the network.
- For encrypted vaults, prefer
OMNIFOCUS_PASSWORDor the interactive password prompt over--password. - Vaults are decrypted into a temporary directory while the command runs so the existing reader pipeline can process the files.
- The temporary directory is removed after normal execution and on common termination signals such as
SIGINTandSIGTERM. - If the process is force-killed, the operating system may leave temporary decrypted files behind in your temp directory.
macOS Permissions
If the CLI fails with EPERM or EACCES, give your terminal app:
- Full Disk Access
- Files and Folders access for the OmniFocus container path
This is especially common for:
~/Library/Containers/com.omnigroup.OmniFocus4/Data/Library/Application Support/OmniFocus/OmniFocus.ofocus~/Library/Containers/com.omnigroup.OmniFocus3/Data/Library/Application Support/OmniFocus/OmniFocus.ofocus
After updating permissions, restart the terminal and try again.
Development
Useful local commands:
npm run check
npm run test:coverage
npm run cli:list -- --help