CLI Overview
The Spaceport Command-Line Interface (CLI) is the primary way to start, configure, and maintain a Spaceport application. All commands are invoked through the Spaceport JAR file.
Basic Usage
java -jar spaceport.jar <command> [arguments]
If you have a wrapper script on your PATH, you can use:
spaceport <command> [arguments]
Commands
--start
Start the Spaceport server using a manifest configuration file.
java -jar spaceport.jar --start /path/to/config.spaceport
This is the primary command for running your application. It performs the following sequence:
- Reads and parses the YAML manifest file
- Merges user configuration over built-in defaults (deep merge)
- Substitutes and types environment values, then validates framework configuration
- Applies metaclass enhancements to Groovy types
- Initializes the CouchDB connection
- Fails if the database is unreachable unless interactive confirmation or
--continuepermits continuing - Displays a debug mode warning if
debug: true - Loads stowaway JARs into the classpath
- Runs ignition scripts once, then scans and compiles source modules
- Starts the Jetty HTTP server and WebSocket handler
--start --no-manifest
Start the Spaceport server with default configuration, without a manifest file.
java -jar spaceport.jar --start --no-manifest
This mode uses built-in defaults:
| Setting | Default Value |
|---|---|
| Host address | 127.0.0.1 |
| Port | 10000 |
| Debug mode | true |
| Source modules | modules/* |
| Static assets | assets/* at /assets/ |
| CouchDB address | http://127.0.0.1:5984 |
| Logging | Disabled |
| Stowaways | Enabled, from stowaways/* |
This is useful for rapid prototyping or when you want to run a minimal application without any configuration overhead.
Unattended Startup and Migration Options
java -jar spaceport.jar --start config.spaceport --headless
java -jar spaceport.jar --start config.spaceport --headless --continue
java -jar spaceport.jar --migrate config.spaceport --headless '{"migration":"001-seed.groovy","inputs":{"tenant":"acme"}}'
java -jar spaceport.jar --migrate config.spaceport --headless @migration.json
Place the manifest path before --headless: its next non-flag argument is consumed as the optional JSON value.
--headlessforces non-interactive operation even when a terminal is attached. Prompts fail rather than waiting for input.--continueexplicitly permits startup or migration to proceed when the main database cannot authenticate. Without it, an attached terminal offers a continue/exit choice; unattended execution exits with status1.- Without a terminal (systemd, cron, pipes), output goes to stdout and prompts fail automatically.
- Migration JSON accepts a
migrationfilename and aninputsobject.@filereads that JSON from disk. Migration scripts receivereport,inputs, andinteractivebindings; supplied inputs do not answerCommandprompts automatically. - A single migration is selected automatically without a terminal. With multiple migrations, supply its filename. Unknown filenames, malformed JSON, prompt attempts without a terminal, and migration failures exit with status
1.
--migrate
Run database migration scripts without fully booting the server.
java -jar spaceport.jar --migrate /path/to/config.spaceport
java -jar spaceport.jar --migrate --no-manifest
The migrate command:
- Reads the manifest (or uses defaults with
--no-manifest) - Merges configuration over defaults and substitutes environment variables
- Connects to CouchDB
- Scans the migrations directory for
.groovyfiles - Presents an interactive menu to select a migration
- Executes the selected migration script using a
GroovyScriptEngine
The migrations directory defaults to migrations/ relative to the Spaceport root, or can be configured via the migrations.path manifest key.
--db
Open the Spaceport Database Console (not yet implemented).
java -jar spaceport.jar --db /path/to/config.spaceport
This command is reserved for a future interactive database management tool.
--help
Display usage information and available commands.
java -jar spaceport.jar --help
Prints the Spaceport version, ASCII logo, and a summary of all available commands with their syntax.
--color
Display all available terminal color combinations.
java -jar spaceport.jar --color
This diagnostic command renders every color and color combination available in the Command class color system. Useful for verifying terminal color support or choosing colors for custom output.
Common Usage Patterns
Local Development
# Start with your project config
java -jar spaceport.jar --start config.spaceport
# Or start with zero config for quick testing
java -jar spaceport.jar --start --no-manifest
Running Migrations
# Run a migration using your project config
java -jar spaceport.jar --migrate config.spaceport
Creating a New Project
Use Create Spaceport App for AI-assisted setup, clone a starter kit, or create a project manually. See Scaffolds Overview.
git clone https://github.com/spaceport-dev/create-spaceport-app my-project
cd my-project
Follow the repository's documentation-fetch instructions, then its BOOTSTRAP.md workflow. Download the framework JAR separately.
Environment-Specific Startup
# Development
java -jar spaceport.jar --start config.spaceport
# Staging
java -jar spaceport.jar --start config.staging.spaceport
# Production
java -jar spaceport.jar --start config.production.spaceport
Exit Behavior
--help,--color: Exit immediately after output--migrate: Exit after the interactive process completes (viaSystem.exit(0))--start: Runs indefinitely until the process is terminated (the Jetty server blocks onserver.join())CTRL+Cduring interactive commands: Terminal settings are restored before exiting (macOS/Linux only)
See Also
- CLI API Reference — Full Command class API and color system
- Scaffolds Overview — Current project creation options
- Manifest Overview — Configuration file format and options
Make the docs better.Edit this page on GitHub