@livon/cli
Purpose
CLI for syncing schema AST from a running server and generating/updating client outputs.
Best for
Use this package when you want generated client APIs to stay in sync during local development and CI.
Install
pnpm add -D @livon/cli
Recommended command (sync + app)
livon \
--endpoint ws://127.0.0.1:3002/ws \
--out src/generated/api.ts \
--poll 2000 \
-- pnpm dev
Generated output mode
livon always runs in rslib mode after sync.
- default output:
esm + cjs + d.ts - use
--esmor--cjsto build only the selected format - use
--jswhen you only needesm + cjsand want to skip declaration files
With --out src/generated/api.ts, compiled files are written to src/generated/dist.
livon also writes src/generated/package.json with conditional exports, so import { api } from './generated' resolves to the matching build output.
Linked process lifecycle
If the linked command exits, livon exits too.
If livon exits, it terminates the linked command.
If your linked command starts with flags, use -- before it:
livon --endpoint ws://127.0.0.1:3002/ws --out src/generated/api.ts -- --some-command --flag
Parameters
--endpoint <ws-url>(string): websocket endpoint used to fetch schema explain data (required unless--portis used).--port <number>(number): overrides endpoint port when endpoint host/path stay unchanged.--out <file>(string): output file path for generated API module.--poll <ms>(number): polling interval for repeated sync runs.--timeout <ms>(number): request timeout per sync call.--event <name>(string): schema explain event name (default:$explain).--method <GET|POST>(string): request method for explain fetch.--header key:value(string, repeatable): additional request header.--payload <json>(string): raw JSON payload body for explain request.--esm(boolean): build only ESM output (dist/index.js).--cjs(boolean): build only CJS output (dist/index.cjs).--js(boolean): builds onlyesm + cjs(skips.d.tsoutput).--no-event(boolean): disables event wrapping behavior for transports expecting plain request mode.--(delimiter): separates livon flags from linked command arguments.
Typical workflow
- Start server with
schemaModule(..., { explain: true }). - Run CLI in watch/poll mode during client development.
- Use generated API module in the client runtime.