Appearance
CLI
The scripts/cli/ directory contains the SafeCall CLI tool, which is bundled into the installer and deployed to production servers.
Overview
The CLI is a Commander-based TypeScript application that manages SafeCall installations. It is bundled into a single file by build/generators/installer.ts and embedded in the installer shell script.
cli/
├── main.ts Entry point (Commander setup, all commands)
├── system.ts Install, update, repair, uninstall, service, status
├── config.ts Config show, edit, set, reset
├── setup.ts Phase 2 guided setup wizard
├── nginx.ts Nginx + self-signed certificate setup
├── selftest.ts Deployment health checks
├── test.ts Test command (selftest, full VM suite, cleanup)
├── user.ts User create, delete, reset password
├── monit.ts Monit monitoring setup
├── cron.ts Automatic update cron job
└── helpers.ts Shared prompt utilities (input, password, select)Commands
Installation
| Command | Description |
|---|---|
safecall install | Phase 1: download binary, scripts, and default config |
safecall setup | Phase 2: guided wizard for service configuration |
safecall setup --defaults | Accept all defaults without prompting |
Configuration
| Command | Description |
|---|---|
safecall config | Pretty-print current main.config.json |
safecall config edit | Open config in $EDITOR or nano, restart service after save |
safecall config set <key> <value> | Set a single config key and restart |
safecall config reset | Overwrite with default config |
System Management
| Command | Description |
|---|---|
safecall service | Set up systemd service |
safecall nginx | Generate nginx config and self-signed cert |
safecall cron | Set up daily update cron job |
safecall monit | Install and configure monit monitoring |
safecall status | Check status of service, monit, cron, and CLI |
User Management
| Command | Description |
|---|---|
safecall user --create | Create a new user |
safecall user --delete | Delete a user by email |
safecall user --reset-password | Reset the default user's password |
Maintenance
| Command | Description |
|---|---|
safecall update | Update to the latest version |
safecall repair | Repair a broken installation |
safecall uninstall | Stop service and remove all files |
safecall selftest | Run deployment health checks |
safecall test --selftest | Quick health check (same as selftest) |
safecall test --full | Full VM test suite |
safecall test --clean | Clean up test artifacts |
Architecture
The CLI entry point (main.ts) registers all commands with Commander and delegates to handler functions in the other modules. Each module is self-contained with its own imports.
At build time, build/generators/installer.ts bundles all CLI modules into a single minified JavaScript file using Bun.build(). This bundle is embedded in build/templates/installer.sh along with a util.sh wrapper script. The installer extracts both files to the installation directory, where the compiled SafeCall binary runs util.ts (the bundled CLI) in Bun mode.