CLI Reference
This page collects the full sprag CLI surface in one place. Command names and flags below mirror sprag/dev/cli.py.
sprag new
Create a new SPRAG project.
Usage
sprag new <name> [--output-dir PATH] [--template default|bare|labs]
Flags
name— project directory name to create--output-dir— parent directory for the new project--template— scaffold template; current options aredefault,bare, andlabs
Example
sprag new myapp --template bare
sprag dev
Build a local preview, watch the project for changes, and start the dev server.
Usage
sprag dev [--port 8000] [--host 127.0.0.1] [--interval 1.0] [--server-mode wsgi|websocket]
Flags
--port— port to bind--host— host/interface to bind--interval— file-watch polling interval in seconds--server-mode— forcewsgiorwebsocket; otherwise SPRAG resolves it from the app--app— explicit app import target--project-root— project root to load from--output— preview build directory used by the dev server
Example
sprag dev --host 0.0.0.0 --port 9000 --server-mode websocket
If you use websocket mode from a spragkit install, also install gevent-websocket.
sprag build
Build the app into a deployable artifact.
Usage
sprag build [static] [--output dist]
Flags
static— optional mode that emits a pure static site instead of a full dist bundle--output— output directory--app— explicit app import target--project-root— project root to load from
Examples
sprag build
sprag build static --output dist
sprag pack
Optimize an existing dist/ directory for production deployment.
Usage
sprag pack [--dist dist] [--zip] [--dry-run] [--verbose]
Flags
--dist— dist directory to optimize--zip— also create a ZIP archive--dry-run— preview changes without writing them--verbose— print detailed optimization logs--skip-images— skip image optimization--skip-minify— skip CSS/JS minification--skip-bytecode— skip Python bytecode compilation--skip-gzip— skip pre-gzip compression--skip-fingerprint— skip content-hash fingerprinting--no-webp— skip WebP generation--no-srcset— skip responsive image variants--image-quality— image compression quality--image-max-width— max width for generated image variants
Example
sprag pack --dist dist --zip --skip-images
sprag add route
Scaffold a new route under app/routes/.
Usage
sprag add route <name> [--mode document|hybrid]
Flags
name— route name such asdashboardoradmin/reports--mode— route mode;hybridis the default--project-root— project root to scaffold into
Example
sprag add route dashboard --mode hybrid
sprag add mount
Scaffold a browser-owned mount under app/mounts/.
Usage
sprag add mount <name>
Flags
name— mount name such asadmin/console--project-root— project root to scaffold into
Example
sprag add mount dashboard
sprag add content
Scaffold a markdown-backed content collection with index and article routes.
Usage
sprag add content <name>
Flags
name— collection name such aspostsordocs/guides--project-root— project root to scaffold into
Example
sprag add content posts
See Content Collections for the generated file layout and static_paths behavior.
sprag routes
List discovered routes, mounts, actions, and schemas.
Usage
sprag routes
Flags
--app— explicit app import target--project-root— project root to load from--output— output directory used for generated preview data
Example
sprag routes
sprag inspect
Inspect the built output for a concrete route or mount path.
Usage
sprag inspect /path [--rebuild] [--open-files]
Flags
target— concrete route or mount path, such as/counter--rebuild— rebuild preview output before inspecting--open-files— print generated file paths instead of dumping compiled source--app— explicit app import target--project-root— project root to load from--output— preview build directory to inspect
Example
sprag inspect /counter --rebuild
sprag doctor
Run structural and build diagnostics against the current SPRAG app.
Usage
sprag doctor [--verbose]
Flags
--verbose— include traceback details for failing checks--app— explicit app import target--project-root— project root to load from--output— preview output directory used during checks
Example
sprag doctor --verbose