CLI
The hyper-sql CLI provides two subcommands: pull and emit.
hyper-sql pull [--check] [-p tsconfig.json]
hyper-sql emit [-p tsconfig.json]Run either command from your project directory, or pass -p <path> to point at a specific tsconfig.json (defaults to tsconfig.json in the current directory).
pull
hyper-sql pull reads your project options from tsconfig.json, asks the database to describe every query, and writes the lock file. On success it prints <lock file> written: N tables, M statements.
| Exit code | Meaning |
|---|---|
0 | Success. |
1 | A query or schema error occurred, the lock is stale (with --check), or the project config couldn't be read. Diagnostics and SQL locations are printed to stderr. |
2 | Invalid CLI arguments. |
Pass --check in CI to verify that sql.lock is up to date without modifying any files: it prints <lock file> is fresh and exits 0 when current, or exits 1 when stale. See The lock file and hyper-sql pull.
For Postgres projects, hyper-sql pull connects using the connection string in DATABASE_URL.
emit
hyper-sql emit writes a .sql.gen.ts file beside each .sql file and removes stale .sql.gen.ts files whose source .sql files have been deleted, then prints a summary count. Use emit whenever a bundler, test runner, or editor tool doesn't support TypeScript 7.1 content mappers directly.