Skip to content

CLI

Commands

CommandArgumentsDescription
build[<folder>] [--serve [--watch]] [--no-plugins] [--allow-plugins] [--wait-plugins] [--strict] [--site-url=<url>]Build the site with plugins. With no folder, builds the site containing the current directory, as moss history finds it. --serve starts a local preview server when the build finishes, on port 8080 or the next free port (there is no --port flag; set MOSS_PREVIEW_PORT_BASE= to start the search elsewhere), and --watch, which only works with --serve, rebuilds on every file change and refreshes the preview. Use --no-plugins for fast CI/CD builds. A plugin that came with the folder and was never allowed in the moss app is refused unless --allow-plugins is passed. --strict exits 1 if the build reported any problems (they are printed to stderr and summarized as moss: N problems …); without it a build with warnings still exits 0.
deploy<folder> [--prebuilt=<dir>] [--site-id=<name>] [--email <address>] [--allow-plugins] [--overwrite-newer] [--dry-run [--json]] [--accept-removals] [--accept-stale-content] [--retry-copies=<channel>] [--copies-of=<file>]Build the folder and publish it: a prebuilt directory if one is set (--prebuilt=), else through a [hooks] deploy plugin, else to the moss host. A first publish to the moss host: moss env <staging|production|local> <folder>, then moss deploy <folder> --site-id=<name> --email <address>, which emails a link that signs the folder in, waits up to 15 minutes for it to be opened, and publishes the site as . A site name can't be given back, and no email is sent without --email. A folder that isn't signed in is refused with the command that signs it in. Other refusals and their ways out: a plugin that came with the folder and was never allowed on this computer (--allow-plugins); a live site published from another copy of this folder since this copy last published (bring this folder up to date, or --overwrite-newer); an address the site would stop serving that you didn't delete (add the printed line under [redirects] in .moss/config.toml, or --accept-removals); changed pages older than what is published (restore them, or --accept-stale-content); two sources with one address (no override: give each its own). --dry-run builds as a deploy does, sends and records nothing, prints what would change and whether a deploy would be refused (exit 1), and asks the server once whether this folder's key may publish its site and whether another copy published since (no answer refuses nothing and says why). --dry-run --json prints the whole report: refusal is {kind, text}, kind one of unresolved_inputs, missing_references, drafts_linked, links_in_cloud, links_in_flight, pending_derivations, build_unfinished, removals, stale_content, output_collision, no_environment, foreign_inputs, not_signed_in, not_owner, stale_copy; owner is {state: answered, site, access: authorized, not_owner, not_signed_in or not_found} or {state: unchecked, reason}; pending_removals lists each refused address with its cause (none with --prebuilt, whose refused files are transfer.removed_output_paths); redirects_to_add holds the [redirects] lines; a failure prints {"error"}. An output_path is a file of the build output, an address or moved_to is what a visitor asks for, a source_path is a file in the folder. After a publish, moss posts each new page to the channels its syndicate: names (at most ten per channel per run, never twice) and adds each copy's address to the page's syndicated:; --retry-copies= resends copies whose send was cut off; with --copies-of=, which sends only that page's copies, it also hands over again a copy you post yourself.
preview<path>Open a GUI preview window, in moss desktop (which moss desktop install provides). may be a folder or a .md/.markdown file.
edit[folder] [--serve] [--no-browser] [--port <n>] [--public-url <https origin> [--public-preview-port <n>]]Open the editor in moss desktop when installed and stdin is a terminal. With --serve, --no-browser or --port, without a terminal, or without desktop, build, watch and serve the editor and preview. A terminal opens a sign-in link in the default browser; --no-browser or piped stdin prints a link and QR. --port selects the UI port, and the preview takes the next one. --public-url names the HTTPS origin a reverse proxy serves the UI at, for another device; it needs --port, and the proxy serves the preview at the same host on the next port or on --public-preview-port, forwarding each to the port moss edit prints. The folder defaults to the current directory. A second edit requests a fresh sign-in link from the live owner.
sessions[revoke <id> | revoke --all]List browser sessions (id, created, last seen, user agent), revoke one session by id, or revoke all sessions on this machine.
desktopinstallInstall moss desktop, the GUI editor and preview app. Downloads the signed release from the same update channel the app itself uses and installs it into /Applications. macOS only for now; elsewhere it says where to get moss desktop. It asks before downloading, so it refuses when stdin is not a terminal.
domain<list|link|status> <folder> [<domain>] [--json]List, link or check custom domains for a project's site; link prints the DNS records to set.
sitetransfer <folder> (--to <email> [--keep-publishing] [--dry-run] | --cancel) [--json]Hand a project's hosted site to another email address. The receiver gets one link by email and accepts from it within 72 hours; the address, files, subscribers and history stay with the site, and this folder's key can no longer publish it. With --keep-publishing the receiver may also take this folder's key, on its own button, so this folder keeps publishing the site as them; it is refused when the key has published another site of yours. --dry-run shows what would move and sends nothing; --cancel withdraws a pending transfer.
env<staging|production|local> <folder> | <folder>Set or show which seta environment (staging / production / local) a project publishes to.
describe[--json] [--css <selector>]Print the moss contract surface (tokens, components, custom properties, frontmatter, plugin hooks, slots, CLI). --json for machine-readable output. --css prints the default CSS rules mentioning that selector or custom property, with their enclosing media queries and the comments explaining them — what a theme override has to displace.
render--jsonRender standalone Markdown documents from newline-delimited JSON on stdin. Each {id, source} request returns {id, html, css}; malformed requests return an error and do not stop later lines. Input is limited to 8 MiB per line. Raw HTML is preserved in the returned HTML and must be sanitized by the embedding application before displaying untrusted documents.
toolsdownload <ffmpeg|git>Download a command-line tool moss needs, into moss's own cache (~/.moss/bin). Running it is the consent: moss downloads nothing else without asking. The download is checked against a pinned SHA-256 before it is used. Exits 0 when the tool is available, 1 when the download or check fails.
root<path> --jsonPrint the moss site that owns a path, and the address it is live at, as {"root": string|null, "address": string|null}; address is null before a first publish and left out when it cannot be read (a settings file still in the cloud or from a newer moss). Uses the canonical .moss ownership check, stops at the home directory, and does not scan or change files.
pluginhash <plugin-dir> [--json] | install <id> [<folder>] | secret set <plugin> <key> [<folder>]install puts a plugin into the existing site at and allows it. An explicit folder must be the site root with its own .moss directory; without a folder, moss finds the site containing the current directory. Plugins come from the plugin registry, or are copied out of moss when moss ships them. Typing the command is the consent, so it prints one line saying the plugin is approved for this user on this machine; the approval is kept in moss's per-user app data (the same store the moss app reads), never in the site folder. The registry catalog is fetched on every install so a withdrawn version is not installed; when it cannot be reached the last cached catalog is used and its age is printed, and with none cached the install fails naming the network error. Exits 1 on failure, 2 on bad arguments. hash prints the code hash of a plugin directory: the value moss records when a plugin is allowed and the registry pins per version. Needs no site. Prints the hex digest, or with --json {"id", "version", "code_sha256"}. Exits 1 when the directory has no readable manifest.json or entry file. secret set stores a credential the plugin's manifest asks the user for (an app password, a token), read from standard input, in moss's secret store outside every site folder, where the app's credential prompt keeps it too; empty input removes it. The key must be one the manifest declares.
import<url> [<folder>] [-r|--recursive] | <url> <folder> --export <export.xml> | <export.xml> [<folder>] | --list <file> [<folder>] [-r|--recursive] | <folder> [-r|--recursive] [--with <derivation-id>] [--allow-plugins] | --status [<site>] [--json] [--allow-plugins]Import a URL (or batch of URLs) into a project folder as markdown. A WordPress export file (Tools → Export) is read after a crawl of the site it names, or of the address --export adds it to: pages the crawl wrote keep their body and gain the export's drafts, dates, terms, menu and old addresses where absent; pages the crawl could not see are written from the export. Importing again into the same folder keeps one page per address. Given an existing folder instead, show the files in it that an installed plugin can turn into pages (for example documents): records the choice in .moss/config.toml and writes a page beside each file, never overwriting one; --with picks a derivation when several accept the folder. -r/--recursive covers the folder and every folder beneath it (hidden folders and .moss skipped): each folder holding files the derivation accepts and with no decision yet is shown and gets its pages, a folder already decided (shown or kept, by its own entry or an ancestor's) keeps its decision, and a shown one still gets any pages it lacks, and one line per folder (folder, what was done, pages written) plus a total is printed. A plugin the site carries runs only if allowed, as in a build: without --allow-plugins a plugin not yet allowed in the app is refused with the same sentence a build prints, and nothing is written. --status lists every folder holding such files with its decision (undecided, show, keep), file count, pages still missing and files a plugin declined; --json prints {"folders": [{folder, derivation_id, noun_one, noun_other, count, decision, stubs_missing, skipped: [{file, reason, message}], failed: [{file, message}]}]}.
agentssync | initsync writes the pointer to moss's guidance for the coding agents installed here or in your home folder (.claude/skills/moss/SKILL.md for Claude Code, .cursor/rules/moss.mdc for Cursor); a build never creates these, only keeps them current once written. init does the same and seeds .moss/AGENTS.md with this site's own conventions. moss's own guidance is moss guide.
guide[<topic>|all|--list]Print moss's agent guidance: project conventions, the four styling rungs, the hard rules, and the checks that tell you whether a change worked. No argument prints the entry point; --list names each topic with the line saying when to read it; all prints every topic as one document. Reads nothing but the binary, so it needs neither a project nor a network — and unlike a copy written into a project folder, it cannot describe a different moss than the one running it.
rename<old_path> <new_path>Rename a file or folder and rewrite every wikilink and text that points at it, project-wide. Scriptable, so it is the safe way to bulk-rename (e.g. localizing filenames) without breaking links. mv is an alias.
new<folder> [--template <id>] [--lang <code>] [--title "<title>"] [--json] | --translation <page.md> --lang <code> [--json] | --list [--json]Make a page from a template, or a page's version in another language. is a folder in the site; with --template the page starts from that template and lands in the template's own folder when it names one, and --title names the file and sets its title. --translation writes the page's version in at the mirrored path (work/x.md becomes zh-hans/work/x.md), copies its facts across, starts from the template for that language, and links the two with translationKey. --list prints the site's templates, language folders and default language; --list --json is the machine-readable form. Refuses rather than guesses: a template whose folder is gone creates nothing.
expand<page.md|folder> [--dry-run] [--allow-plugins]Write embeds out as text. Each line holding only a ![[file.ext#fragment]] embed of a file a plugin derives text from (once its text has been derived; missing text is derived first) or only a ![[note]] / ![[note#heading]] transclusion is replaced with the text it stands for, so the page can be edited as plain markdown. Embeds whose text is not available (skipped, unreadable, unresolved) are left as written, frontmatter is kept byte for byte, and a file is written only when something changed. --dry-run reports without writing. A plugin that derives the text must be allowed, as in a build: without --allow-plugins one not yet allowed in the app is refused with the same sentence a build prints.
fetch<folder>Download every file in a folder that is still only in the cloud (Google Drive, iCloud Drive, Dropbox, OneDrive), so the folder can be copied or backed up without each read blocking on the provider. moss's own cache (.moss/cache/) is left in the cloud, since a build downloads what it needs again: exclude it from a copy (rsync --exclude .moss/cache). Reads and lists only: it writes nothing in the folder. Progress goes to stderr. Exits 0 when every file but the cache is on this device, and 1 when the provider stops delivering (nothing arrives for 90 seconds), naming the provider, how many files are still in the cloud with a short sample, and what to do. moss build makes the same check first and exits 1 the same way.
doctor--math [<folder>] | --surface [<folder>] [--all] [--json]Audit a vault without changing it. --math reports every $-span moss would parse as math (these render as their LaTeX source; moss does not typeset math yet), so an imported corpus can be checked before publishing. Escape false positives as $. --surface lists markdown constructs a cleaner form could replace: classed divs repeated on three or more pages (a fact a frontmatter field could hold), theme rules that match no element on any page of the last build, theme selectors keyed on a page address (they break when the page is renamed), and the class names the theme invents that moss does not write, each marked as used in pages or nowhere (theme_own_classes in --json). --all lists every classed div, even one on a single page, to check that a migration left none. --json prints the surface report as JSON.
migrate[<folder>] [--apply] [--json] | [<folder>] --lift <class> --as <field> --place <place> [--apply] [--json]Rewrite what moss doctor --surface finds. Without --apply it prints the change as a diff and writes nothing; with --apply it first saves a version of the site (undo with moss history --restore), then writes, changing only the frontmatter lines it names. With no --lift it removes a translationKey the page's path already implies, and only when a scratch copy of the site builds to the same output with and without it. --lift --as --place moves each ::: {.class} div holding one paragraph of plain text into its page's frontmatter as and declares the field in .moss/config.toml; --place says where moss draws it instead of the div (eyebrow, subtitle, key-figure or facts), or none to keep it in the frontmatter only (it sets the field's place for the whole site, so none also removes a place the field already has); a page whose div holds more than plain text, holds it twice, or whose frontmatter already gives a different value is left as written and listed. --json prints the changes, skipped pages and saved version as JSON.
list[<folder>] [--json]List every document the last build parsed: source file, the URL it publishes at, the BCP-47 tag it will carry in <html lang>, kind, date, title, and — in the HIDDEN column — why it is absent from generated listings (draft, unlisted, nav-item, slot). The LANG column is how you confirm a new language tree registered: an unrecognized folder name is treated as ordinary content and the build succeeds either way (moss describe --json lists the recognized codes under languages). Reports the last build, so run moss build first. Use --json to filter the same rows programmatically.
history[<folder>] [<path>] [--json] | [<folder>] --save [<name>] [--json] | [<folder>] <path> --restore --at <id> [--copy] | [<folder>] --restore --at <id> --yesmoss's own version history, kept inside the site at .moss/history (not git — a git user already has their own history, and this store never adds commits): every landed publish gets a snapshot, and --save takes one on demand. With no path, lists the site's timeline newest first: when, whether it was a publish or a named save, a live marker on the version currently published, and what changed. With a path, lists that one page's timeline instead, noting when its content was not kept (over the size ceiling, or unreadable at publish time). A page's timeline also lists each outside edit kept when the editor saved the person's text over lines another writer had changed ("trigger": "displaced" in --json); restore one with <path> --restore --at <id>. --save [<name>] saves the files currently on disk without running a build, ending with one line naming the version saved; --save --json prints that one version as a single JSON object on stdout instead (diagnostics go to stderr), so a script can read the saved id directly. --restore --at <id> restores that version — a path restores just that page (--copy writes it beside the current file instead of overwriting it); with no path it restores the whole site, which needs --yes since it can move pages added since that version to the Trash. <id> is a version's id from the timeline, or an unambiguous prefix of one. With no folder, this command operates on the site containing the current directory; pass <folder> — a directory that already contains .moss — to act on a site from outside it, the same as moss build <folder>.
mapbbox [<folder>] [--json]Print the frame the site's places need, for a [map.layers] table. bbox prints west,south,east,north in degrees, computed from the places in .moss/places.toml that pages name in the place-typed kind's fields, plus 10% of each side (at least 0.01 degree), and a suggested max_zoom line: the zoom at which the frame's longer side spans about 1024 px, plus 3, kept within 10..19. --json prints {"bbox": [w, s, e, n], "max_zoom": n, "places": k}. Reads only the folder and writes nothing. With no folder, it acts on the site containing the current directory. Exits 1 when the site has no place-typed kind or no page names a place with coordinates.
commentslist [<folder>] [--json] | hide [<folder>] <id>... [--source <name>] [--json] | unhide [<folder>] <id>... [--source <name>] [--json] | adopt-key [<folder>] <pubkey> [--json]Review and hide a site's comments. list prints every comment, newest first: id, source, the page it is on (address and title once a build has run, otherwise the page uid), author, time, the first 60 characters of its text, and whether it is hidden; it needs no build. hide takes one or more ids from list and removes those comments, and the replies under them, from the site at the next publish; unhide reverses it. Nothing is erased and nothing is sent anywhere: a hide is a signed event in .moss/data/social/moderation.jsonl, signed with the site's own key in .moss/identity, which moss never creates for this (no key, no hide). A call validates every id first, so an unknown id changes nothing; an id that exists under two sources needs --source <name>; an already-hidden comment is left alone. Nothing reviews new comments before they go live, so list them before publishing and hide the spam. --json prints rows, or {"changed": [...], "unchanged": [...]} for hide and unhide, and failures as {"error": ...}. A hide keeps applying when the folder gets a new key: the key it replaced is remembered in .moss/identity/previous-keys.jsonl. When that file was lost with the key, list names the earlier key and adopt-key <pubkey> trusts it again; it refuses a key that signed nothing here or signed for another site. With no folder, this command operates on the site containing the current directory.

CI and automation

moss works headless:

moss build /path/to/folder --no-plugins

The build output is a self-contained static site in .moss/build.nosync/current/ — standard HTML, CSS, and JS that can be deployed anywhere. A page marked draft: true is built there too, so the preview can show it; moss deploy leaves it out, but a folder you upload by hand includes it, so delete the draft pages first (moss list shows which they are). (.moss/build.nosync/current/ is a symlink to the latest generation under .moss/build.nosync/generations/.)

Import

moss import <url> [folder] [-r] converts a live page to markdown. Only http and https URLs are supported. Images land in assets/imported/. Pass -r to crawl the same domain and path prefix, capped at 200 pages.

Import extracts content and discards the original CSS. Recreate the look in .moss/theme/style.css.

Development

For contributors working on moss itself:

# Start dev server with hot reload
npm run dev

# Preview a folder via CLI (routes to running dev instance)
npm run moss -- preview ~/Sites/my-blog

# Switch folders without restarting
npm run moss -- preview ~/Sites/other-folder

The single-instance plugin routes CLI commands to the running dev instance, so you can switch folders without recompilation.