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>]Build and deploy the site. Where it goes is the folder's to say: a prebuilt directory wins, then a [hooks] deploy plugin, otherwise seta, Symbiosis Lab's hosting service. moss also publishes to any other target a deploy plugin reaches. A folder publishing for the first time needs moss env <staging|production|local> first, and then registers a site named after the folder (or --site-id) — a site ID cannot be un-minted, so moss will not pick one for a folder that never named an environment. A first publish is refused until this folder's key is linked to an account whose email has been confirmed; pass --email
to be sent a sign-in link, wait for it to be opened (up to 15 minutes), and continue. The address must be the account the site should belong to: a wrong one can leave this folder's key linked to the wrong account. No message is sent without --email. A plugin that came with the folder and was never allowed in the moss app is refused unless --allow-plugins is passed, exactly as in moss build. A publish to that hosting destination, --prebuilt included, is refused when the live site was published from another copy after this folder last published — deploying would undo that publish. Bring this folder up to date with that copy (for example, git pull) and deploy again, or pass --overwrite-newer to replace the live site anyway. A publish that would stop serving an address the site has served, for a reason other than you deleting its source (a moved page or file with no redirect, a generated file no longer produced), is refused with each address and its cause; add the redirect it shows under [redirects] in .moss/config.toml, or pass --accept-removals to accept losing exactly those addresses. Sources that share an output address are reported as build warnings and refuse publishing; give each source a unique address. There is no override for an output collision. Changed pages with older source timestamps or an older published content hash are refused; restore the current files, or use --accept-stale-content for a deliberate revert. An image derivative (.webp) that stops being produced while its picture is still served needs neither: moss keeps its address as a redirect to the picture, and --dry-run lists it as kept. Run with --dry-run first to see what a deploy would do: it builds exactly as a deploy builds, including any plugin the flags allow (the build may use the network as any build does: a plugin's requests, and link previews fetched from third-party sites), and prints the pages added, edited and deleted, the addresses that would go offline, the upload and remove counts measured against this folder's last publish record (unknown when there is none), and whether the publish check passes. It uploads nothing and records nothing, runs the checks a deploy makes locally (the folder has a site, the config is not from a newer moss), says when a deploy would register a site, create a signing key or need --email to verify the folder, exits 1 where those or the removed-address check would refuse the deploy, and asks the server once, with the read a deploy starts with: whether this folder's key may publish its site (not the owner refuses and names --email; no answer, offline or a skewed clock, refuses nothing and says why) and whether another copy published since (refused unless --overwrite-newer). Its lists stop at 20 lines; --dry-run --json prints the same report as JSON with every list in full: refusal is {kind, text}, kind one of unresolved_inputs, missing_references, drafts_linked, links_in_cloud, links_in_flight, pending_derivations, removals, stale_content, output_collision, no_environment, foreign_inputs, not_owner, stale_copy; owner is {state: answered, site, access: authorized, not_owner or not_found} or {state: unchecked, reason}; pending_removals lists each refused address with its cause (with --prebuilt there is no cause, and the refused files are transfer.removed_output_paths); redirects_to_add holds the [redirects] lines that keep every moved address working, ready for .moss/config.toml; and a failure, local setup included (plugin credentials, a config from a newer moss, an invalid site id), prints {"error"}. An output_path is a file of the build output, an address or moved_to is what a visitor asks for, and a source_path is a file in the site folder. After a publish lands, moss posts a copy of each new page to the channels its syndicate: names (one record per copy in .moss/deploy/copies/, never posted twice), at most ten per channel per run, and adds each copy's address to the page's syndicated:; it prints one line per copy. While one run sends a folder's copies, another run in that folder sends none and leaves them due. A copy whose send stopped before the network answered is not retried on a network that cannot retry safely; --retry-copies= sends those again.
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, 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 as {"root": string|null}. 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 site containing (default: the current directory) and allows it: from the plugin registry, or copied out of moss when moss ships it. 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] | --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. 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.