Skip to content

CLI reference ​

CommandWhat it does
crykit init <app_name>Create a new application with routes, views, styles, and macOS packaging files
crykit devCompile and run an application with assets served from disk
crykit dev --watchRun with source watching, live updates, and rebuilds
crykit buildBuild an executable with embedded assets
crykit distPackage a macOS .app bundle
crykit --helpList commands and options; also accepts -h
crykit --versionPrint the CLI version; also accepts -v

Build the executable with Install the CLI.

init ​

Create and run a new application:

sh
crykit init my_app
cd my_app
shards install
crykit dev --watch

<app_name> is the new directory name or path. Its parent directory must exist; the target must not already exist. init writes the project files; run shards install separately to install dependencies.

Generated file or directoryPurpose
shard.ymlApplication target, CryKit dependency, and version
crykit.ymlApplication name, entry, bundle ID, and development settings
src/main.crApplication entry point
src/application/app.crApplication configuration, menus, assets, and initial window
src/handlers/app_handler.crRoutes
src/views/index.cr, src/views/templates/index.ecrStarter view and template
src/layouts/main_layout.cr, src/layouts/templates/layout.ecrDocument layout
src/assets/main.cssStylesheet
targets/dist.cr, targets/macos/Distribution recipe, macOS target, and editable plist template
.gitignore, .editorconfigRepository and editor defaults

dev ​

sh
crykit dev
crykit dev --watch
crykit dev -f path/to/crykit.yml
OptionDefaultEffect
-f FILE, --file FILE./crykit.ymlSelect the application configuration
-w, --watchOffWatch development.watch paths for live updates or rebuilds

Plain dev compiles and runs once, inherits terminal input/output, and returns the application's exit code. Assets stay on disk and asset hotreload is enabled.

With --watch, eligible CSS and template edits update the running app. Other source changes rebuild and restart it, resetting application state. A compiler error keeps the current app running until a later edit succeeds. See development updates for supported edits and watch behavior.

build ​

sh
crykit build
crykit build --release
crykit build -f path/to/crykit.yml -o ./dist/my_app
OptionDefaultEffect
-f FILE, --file FILE./crykit.ymlSelect the application configuration
-o FILE, --output FILEbin/<app.name.underscore> beside the configChoose the executable path
--releaseOffEnable Crystal release optimizations

Builds an executable without running it. Assets declared with app.assets = CryKit::Assets.directory("assets") are embedded and served through the same /assets/ URLs. See assets.

dist ​

sh
crykit dist
crykit dist -f path/to/crykit.yml -o ./dist/MyApp.app
crykit dist --skip-release
OptionDefaultEffect
-f FILE, --file FILE./crykit.ymlSelect the application configuration
-o FILE, --output FILEdist/<app.name>.app beside the configChoose the bundle path
--skip-releaseOffDisable the release optimizations enabled by default

Packages an ad hoc signed macOS application with embedded assets. Requires the targets/dist.cr recipe and macOS files generated by init. See Distribution for metadata, icons, plist customization, and signing scope.

Help and version ​

InvocationOutput
crykit --help, crykit -hAvailable commands and global options
crykit <command> --helpOptions for that command
crykit --version, crykit -vCryKit v<version>, embedded in the executable

Help and version exit without reading app configuration or requiring build tools. Running crykit without arguments shows help.

CLI configuration ​

dev, build, and dist read ./crykit.yml, or the file selected with -f. Missing files and omitted fields use defaults.

FieldDefaultPurpose
app.nameMyAppDisplay name; its underscored form names the executable
app.entry./src/main.crCrystal entry point
app.idUnsetApplication bundle identifier; required for dist
app.versionNearest ancestor shard.yml version, or unsetApplication version; required for dist
app.build_number"1"macOS bundle build number
app.iconUnsetSquare PNG or .icns file for dist
macos.min_system_version"26.0"Minimum macOS version for dist
development.watch["./**/*.cr", "./**/*.ecr"]Files, recursive directories, or globs watched by dev --watch
yaml
app:
  name: MyApp
  entry: ./src/main.cr
  id: com.example.my-app
development:
  watch:
    - ./src

Paths and version resolution ​

  • Entry, icon, and watch paths resolve beside the selected configuration file.
  • Compilation and application execution use the config directory as their working directory.
  • Explicit build -o and dist -o paths resolve from the caller's directory.
  • An explicit app.version takes precedence. Otherwise, the CLI runs shards version using the nearest ancestor manifest. A failed lookup for an existing shard reports an error; without a shard, the version stays unset.

From a CryKit source checkout, replace crykit with crystal run src/cli.cr --, for example:

sh
crystal run src/cli.cr -- dev -f examples/demo/crykit.yml

Runtime environment ​

API or settingMeaning
CryKit.envCurrent environment; production by default
CryKit.env.dev?, CryKit.env.prod?Check the active environment
crykit devSelect development mode for the application
CRYKIT_ENV=dev crystal run src/main.crSelect development mode without the CLI

Environment selection is separate from asset hotreload, source hotpatch, and source hotreload. Custom runners use the manual configuration.

Errors and exit status ​

Expected argument, configuration, filesystem, and tool failures print Error: <message> to standard error and exit with status 1. This includes distribution recipe loading and packaging. Unexpected internal exceptions retain their stack traces.

dev, build, and dist require the resolved entry to be a file. init, help, and version requests skip this check.

Built with Crystal. Documented with VitePress.