mdbase-cli
v0.1.0
Published
CLI tool for mdbase collections — validate, query, CRUD, and execute Obsidian .base files
Readme
mdbase-cli
Command-line tool for working with mdbase collections. Validates, queries, and performs CRUD operations on markdown document collections. Can also execute Obsidian .base files.
Install
Requires Node.js 22+ and the mdbase library.
git clone https://github.com/callumalpass/mdbase.git
git clone https://github.com/callumalpass/mdbase-cli.git
cd mdbase && npm ci && cd ..
cd mdbase-cli && npm ci && npm run buildThe CLI is available as mdbase via the bin entry, or run directly with:
node dist/cli.jsUsage
mdbase <command> [options]Global option:
-C, --collection <alias>Run a command against a registered collection alias (frommdbase collections add).
Core commands
| Command | Description |
|------------|--------------------------------------------------|
| validate | Validate documents against their type schemas |
| query | Query documents with filters and sorting |
| read | Read a single document by path or ID |
| create | Create a new document |
| update | Update an existing document |
| delete | Delete a document |
| rename | Rename a document |
| types | List or inspect registered types |
Obsidian Bases
| Command | Description |
|------------|--------------------------------------------------|
| base run | Execute an Obsidian .base file |
Additional commands
| Command | Description |
|------------|--------------------------------------------------|
| init | Initialize a new mdbase collection |
| lint | Lint documents for common issues |
| fmt | Format document frontmatter |
| export | Export documents to CSV or JSON |
| import | Import documents from CSV or JSON |
| graph | Show link graph between documents |
| stats | Print collection statistics |
| watch | Watch for file changes and re-validate |
| diff | Show differences between document versions |
| schema | Generate or inspect type schemas |
| collections | Manage named collection registry entries |
Fuzzy picker
mdbase-fzf provides an interactive two-step picker powered by fzf:
- Choose a type (includes
untypefor files without a type). - Browse matching files with key fields (display/title-style fields are prioritized), preview, then open in your editor.
Requirements: fzf and jq on PATH.
mdbase-fzfExamples
Validate all documents in the current directory:
mdbase validate .Query documents of a given type:
mdbase query "status = published" --types note --sort created --limit 10Execute an Obsidian .base file:
mdbase base run my-view.baseExport to CSV:
mdbase export . --type note --format csv -o notes.csvInitialize and register a collection alias:
mdbase init --register workList markdown files from all registered collections:
mdbase collections files --format pathsExample applications
| Project | Description | |---------|-------------| | mdbase-workouts | Workout tracker with chat interface, built on mdbase |
Spec
mdbase-cli implements the mdbase specification.
License
MIT
