CLI

build, dev, routes, new — and the flags they share.

Updated 2 min read

cataract build      scan routes, generate sources, compile a binary
cataract dev        rebuild and restart on change
cataract routes     print the route table in match order
cataract new NAME   scaffold an application

Shared flags

FlagMeaning
--root <dir>Project root, default .
--config <file>Config file relative to the root, default cataract.toml
--port <n>Override server.port for this invocation
--watch-ms <n>Dev poll interval in milliseconds, default 400
--notesInclude notes in diagnostic output

build

Four stages, each a checkpoint that aborts if errors were recorded:

scan      walk app/routes, read each module, build a route manifest
assets    copy public/, hash each file, concatenate the island bundle
codegen   emit CataractAssets, GeneratedRoutes and CataractMain
compile   invoke chpl over the runtime, the generated modules and app/

Diagnostics are collected rather than thrown, so one build reports every problem at once instead of stopping at the first.

dev

cataract dev rebuilds, restarts and waits for the next change. Rebuilds are content-hashed rather than timestamped: an editor that rewrites a file with identical bytes does not trigger a rebuild, and a checkout that rolls timestamps backwards does. Generated files whose content is unchanged are not rewritten, so chpl does not rebuild the world.

The dev server runs with --devMode=true, which disables the static file cache.

routes

cataract routes

Prints the compiled table in match order without invoking chpl. Use it to answer "what does this tree route?" and "which file will this request reach?".

new

cataract new blog

Scaffolds cataract.toml, a root layout, an index page, a health API route, a stylesheet and a .gitignore. It is the smallest project that compiles, and it is meant to be edited immediately.