Kalpasan CLI

kalpasan is the project's command-line companion. It scaffolds models, controllers and services, runs migrations and seeders, and starts a development server with file watching.

Installing

The binary lives at vendors/Garvan/kalpasan. A symlink at the project root makes it convenient to call:

ln -s vendors/Garvan/kalpasan kalpasan
./kalpasan --help

Scaffolding & DB commands

./kalpasan make:model User           # scaffold app/models/User.{h,cpp}
./kalpasan make:controller User      # scaffold app/controllers/UserController.{h,cpp}
./kalpasan make:service User         # scaffold app/services/UserService.{h,cpp}
./kalpasan make:migration create_users

./kalpasan db:migrate                # delegates to garvan-migrate up
./kalpasan db:rollback               # delegates to garvan-migrate down
./kalpasan db:seed                   # run files in db/seeders/

./kalpasan serve --watch             # rebuild + restart on .cpp/.h change

All commands respect the active .env file so they target the right database.

Runtime verbs (jobs, events, config)

These verbs talk to a running app via HTTP (libcurl). They read KALPASAN_ADMIN_URL (default http://127.0.0.1:9090) and KALPASAN_ADMIN_TOKEN from .env, then hit the bearer-guarded admin endpoints in routes/AdminRoute.cpp.

./kalpasan job:list                                # GET /api/admin/jobs
./kalpasan job:dispatch SendTestMail \              # POST /api/admin/jobs/dispatch
    --field to=you@x.com \
    --field subject="Hi" \
    --field body="<h1>Hello</h1>"

./kalpasan event:list                              # GET /api/admin/events
./kalpasan event:fire UserRegistered \             # POST /api/admin/events/fire
    --field id=42 \
    --field email=you@x.com \
    --field name="Ada"

./kalpasan route:list                              # print HTTP routes
./kalpasan config:show                             # dump .env
./kalpasan config:get MAIL_HOST                    # read one key
./kalpasan config:set MAIL_HOST smtp.new.com       # rewrite one key
./kalpasan config:key:generate                     # new APP_KEY (base64 32-byte)
Admin auth guard

AdminRoute refuses the request unless three conditions hold: KALPASAN_ADMIN_TOKEN is non-empty in .env, the request comes from loopback (127.0.0.1 or ::1), and the Authorization: Bearer <token> header matches. Otherwise you get a JSON error with status 401 / 403 / 503 (see routes/AdminRoute.cpp:55-82).

See Jobs, Events and Events & Jobs walkthrough.