| title | CLI |
|---|---|
| order | 20 |
| date | 2026-03-20 |
| summary | Command-line entrypoints for local preview, index generation, and Cloudflare bundles. |
Recommended install:
npm install -g mdoriginProject-local install also works:
npm install --save-dev mdoriginMain commands:
mdorigin dev --root <content-dir>mdorigin dev --root <content-dir> --search <search-dir>mdorigin build index --root <content-dir> --config <config-file>mdorigin build search --root <content-dir> --config <config-file>mdorigin build search --root <content-dir> --embedding-backend hashingmdorigin build search --root <content-dir> --incrementalmdorigin build cloudflare --root <content-dir> --config <config-file> --search <search-dir> --binary-mode externalmdorigin init cloudflare --dir . --r2-bucket <bucket-name>mdorigin sync cloudflare-r2 --dir <cloudflare-out-dir> --bucket <bucket-name>mdorigin search --index <search-dir> --meta type=post <query>
With a project-local install, run the same commands via npx --no-install mdorigin ....
Useful defaults:
dev,build index,build search, andbuild cloudflareall accept--configbuild searchwrites todist/searchunless--outis providedbuild searchdefaults to themodel2vecembedding backendbuild search --incrementalkeeps anindexbindcache beside the output directory to speed up repeated rebuildsbuild cloudflarewrites todist/cloudflare/worker.mjsunless--outis providedbuild cloudflaredefaults to--binary-mode inline; use--binary-mode externalto stage binaries outside the Worker bundle- when
build cloudflareis given--search, search files are always staged outside the Worker bundle for Cloudflare and still use--assets-max-bytes/--r2-binding init cloudflarepoints todist/cloudflare/worker.mjsby defaultinit cloudflarederives the Worker name fromsiteTitlewhen--nameis omittedsync cloudflare-r2uploads all R2-staged files, including externalized search files, and skips unchanged uploads unless--forceis set
Search commands require the optional indexbind package:
npm install indexbindFor indexbind runtime and indexing details, see:
- Docs: https://indexbind.jolestar.workers.dev
- Repository: https://github.com/holon-run/indexbind
To force the older lightweight backend:
mdorigin build search --root docs/site --embedding-backend hashingWhen dev or build cloudflare is given --search, the site exposes:
/api/search?q=.../api/openapi.json
Search metadata filters are available through:
- repeated CLI flags such as
mdorigin search --index dist/search --meta type=post --meta section=guides "cloudflare" - query parameters such as
/api/search?q=cloudflare&meta.type=post&meta.section=guides
Content traversal ignores dotfiles and dot-directories. .gitignore does not affect publishing behavior.