overview
Psychic and Dream both provide a CLI for interfacing with underlying bin scripts. These scripts are useful for doing things like database operations, syncing types, listing your routes, etc. To see the available list of commands, you can use the --help flag:
pnpm psy --help
Commands
Generators
generate:migration|g:migration [options] <migrationName> [columnsWithTypes...]- Generates a new migration file (prefer g:resource or g:model if creating a table for a new model).generate:model|g:model [options] <modelName> [columnsWithTypes...]- Generates a Dream model with corresponding spec factory, serializer, and migration.generate:sti-child|g:sti-child [options] <childModelName> <extends> <parentModelName> [columnsWithTypes...]- Generates a Dream model that extends another Dream model, leveraging STI (single table inheritance), with corresponding spec factory, serializer, and migration.generate:resource|g:resource [options] <path> <modelName> [columnsWithTypes...]- Generates a Dream model with corresponding spec factory, serializer, migration, and controller with the inheritance chain leading to that controller, with fleshed out specs for each resourceful action in the controller.generate:controller|g:controller <controllerName> [actions...]- Generates a controller and the inheritance chain leading to that controller, and a spec skeleton for the controller.
Database Commands
db:create- Creates a new database.db:integrity-check- Fails if migrations need to be run.db:migrate [options]- Runs any outstanding database migrations.db:rollback [options]- Rolls back the specified number of migration steps (defaults to 1).db:drop- Drops the database.db:reset- Runs db:drop (safely), db:create, db:migrate, and db:seed.db:seed- Seeds the database using the file located in db/seed.ts.
Inspection & Utilities
inspect:serialization|i:serialization <globalName> [serializerKey]- Displays a serialization map to help understand the rendering logic for a particular model.routes- Prints a list of routes defined by the application, including path arguments and the controller/action reached by the route.
Setup Commands
setup:sync:enums [options] <outfile>- Generates an initializer in your app for syncing enums to a particular path.setup:sync:openapi-redux [options]- Generates openapi redux bindings to connect one of your openapi files to one of your clients.setup:sync:openapi-typescript [options] <openapiFilepath> <outfile>- Generates an initializer in your app for converting one of your openapi files to typescript.
Sync Commands
sync [options]- Generates types from the current state of the database. Generates OpenAPI specs from @OpenAPI decorated controller actions. Additional sync actions may be customized withon('cli:sync', async () => {})in conf/app.ts or in an initializer inconf/initializers/.watch [dir]- Watches your app for changes, and re-syncs any time they happen.post-sync- An internal command that runs as the second stage of thesynccommand, since after types are rebuilt, the application needs to be reloaded before autogenerating certain files, since those files will need to leverage the updated types.sync:routes- Reads the routes generated by your app and generates a cache file, which is then used to give autocomplete support to the route helper and other things.sync:openapi- Syncs openapi.json file to current state of all psychic controllers within the app.sync:ai-rules- Syncs the latest AGENTS.md, preserving custom rules added at the bottom of the local file.
For detailed documentation on each command, use pnpm psy <command> --help or see the specific command documentation pages.