Skip to content
VaelJS Blog

Commands & Flags

Both vjs and vjs-lite execute ECMAScript modules (.js, .mjs, extensionless) and erasable TypeScript (.ts, .mts), run isolated test suites, and emit .d.ts declarations. vjs also provides the lsp Language Server Protocol subcommand and db migrate SQL migration CLI.

Terminal window
vjs [options] <file-or-url>
vjs-lite [options] <file-or-url>
  • Use -- before a filename that starts with - (e.g., vjs -- -script.ts).
  • vjs treats https://, http://, gh:, and github: inputs as URLs; vjs-lite treats https://, http://, gh:, github:, and jsr: inputs as URLs (gated by --allow-remote or VAELJS_ALLOW_REMOTE, with plaintext http:// always rejected by the loader).
  • Calling vjs or vjs-lite with no arguments prints an error and exits with code 2.
Terminal window
vjs test [options] <file-or-glob>...
vjs-lite test [options] <file-or-glob>...
  • Requires at least one file path or case-sensitive shell-style glob; there is no default file discovery.
  • Matching files are sorted and deduplicated, and each file runs in a fresh runtime.
  • Options (--config, --no-config, --no-node-compat, --allow-remote, --no-allow-remote, --no-npm, --frozen-lockfile, --offline) may appear before or after test in both vjs and vjs-lite.
  • Use -- to end option parsing before a pattern starting with -.
  • A file that registers zero tests, leaves a pending test("name"), leaves an unhandled rejection, or leaves unsettled work fails with exit code 1.
Terminal window
vjs types [--profile <v8|lite>] [--out-dir <dir>]
vjs-lite types [--profile <lite|v8>] [--out-dir <dir>]
  • --profile <v8|lite>: selects which runtime surface to emit (vjs defaults to v8; vjs-lite defaults to lite).
  • --out-dir <dir>: writes the multi-file types/ directory (index.d.ts, globals.d.ts, vael/*.d.ts, node/*.d.ts) instead of printing a single bundled .d.ts to stdout.
  • --help / -h after types prints types-specific help.
  • types rejects --config, --no-config, --no-node-compat, --allow-remote, --no-allow-remote, --no-npm, --frozen-lockfile, and --offline.
Terminal window
vjs lsp [options]

Starts the pure-Rust JSON-RPC 2.0 Language Server Protocol server over standard I/O without booting V8 or running guest JavaScript. Syntax parsing and AST extraction run in an isolated child worker (vjs lsp --parse-worker) so malformed or deeply nested edits cannot crash the long-lived LSP server.

lsp Option Behavior
--stdio Communicate over stdin/stdout (default transport).
--profile <v8|lite> Select runtime profile (v8 or lite, default v8) for embedded vaeljs-dts completions and module diagnostics.
--project <dir> Set an explicit project or workspace root directory (must exist; exits 2 otherwise).
--config <path> Use an explicit vael.jsonc manifest instead of upward discovery.
--no-config Disable vael.jsonc manifest discovery.
--no-node-compat Disable built-in node:* compatibility module resolution in diagnostics/completions.
-h, --help Print lsp-specific help.

lsp rejects --allow-remote, --no-allow-remote, --no-npm, --frozen-lockfile, and --offline.

Terminal window
vjs db migrate <subcommand> [options]
db migrate Subcommand Behavior & Specific Flags
new <name> Create the next sequential migration files (0001_name.up.sql and .down.sql). Options: --dir <path>, --single-file (NNNN_name.sql with -- migrate:up / -- migrate:down), --no-down, --config, --no-config, --json.
status Read-only inspection of applied, pending, drift, and dirty state without creating ledger tables. Supports --json.
plan Validate checksums and preview planned steps without executing SQL writes. Options: --direction <up|down> (default up), --step <n>, --to <version>, --show-sql, --json.
verify Verify local migration files and optionally validate consistency with the database ledger. Options: --offline, --json.
up Apply pending migrations. Options: --step <n>, --to <version>, --dry-run, --json.
down Roll back applied migrations (defaults to --step 1; never rolls back all implicitly). Options: --step <n>, --to <version> (0 reverts all non-baseline migrations), --dry-run, --json.
reset Roll back all applied migrations down to baseline (no-op on empty/uninitialized databases). Requires --yes; supports --dry-run, --json.
flatten Compact applied legacy migrations into an irreversible baseline (SQLite and PostgreSQL only). Requires --baseline <file> and --yes; optional --legacy-max <ver>, --json.
reconcile Clear a dirty migration marker on MySQL or MariaDB after manual operator inspection. Requires --outcome <applied|reverted> and --yes; supports --json.
Option Behavior
--config <path> / --no-config Use an explicit vael.jsonc manifest or disable upward discovery.
--url <dsn> / --url-env <VAR> Database DSN (sqlite:, postgres://, mysql://, mariadb://, mssql://) or env var holding the DSN. Cannot combine --url/--url-env with --driver, --host, --port, --database, or --user.
--driver <name> sqlite | postgres | mysql | mariadb | mssql.
--host <host>, --port <port>, --database <name>, --user <user> Individual connection overrides (or SQLite file path / ":memory:" via --database).
--password-env <VAR>, --password-file <path> Read database password from an environment variable or regular non-symlink UTF-8 file (<= 64 KiB). Cannot be combined or repeated.
--tls / --no-tls, --tls-mode <mode>, --ca-file <path> TLS mode (verifyFull | insecure | plaintext, defaults to verifyFull). --ca-file requires verifyFull.
--dir <path> Migrations directory (default ./migrations).
--table <name>, --schema <name>, --module <name> Ledger table name (default _vael_migrations), schema (public / dbo), and logical module identity (default app).
--baseline-version <n>, --lock-timeout-ms <ms> Flatten baseline version (>= 1) and lock wait timeout in ms (default 30000).
--managed-objects <csv>, --bind <key=ident> Comma-separated table or schema.table list checked on first registration; repeatable {{key}} identifier bindings.
--json Emit structured JSON on stdout (and JSON errors on stderr).

vjs db migrate enforces strict secret hygiene so credentials never leak into process argv or committed manifests:

  • --password is rejected: Passing --password or --password=... on the command line exits with code 2 without echoing the secret. Use --password-env <VAR>, --password-file <PATH>, or VAELJS_DB_PASSWORD.
  • Inline URL passwords on argv are rejected: Passing --url postgres://user:pass@host/db is rejected; use --url-env <VAR>, VAELJS_DB_URL / DATABASE_URL, or --password-env / --password-file.
  • No plaintext secrets in vael.jsonc: The "db" block accepts "passwordEnv" and rejects "password", "url", or inline ://user:pass@ strings (SecretInManifest).
  • Precedence: CLI flags > Environment variables (VAELJS_DB_URL / DATABASE_URL / VAELJS_DB_*) > vael.jsonc "db" section.
Option Runtimes Behavior
--config <path> / --config=<path> Both Load an explicit vael.jsonc manifest instead of upward discovery. Cannot combine with --no-config.
--no-config Both Disable automatic upward vael.jsonc discovery.
--no-node-compat Both Disable built-in node:* compatibility modules at runtime.
--allow-remote Both Enable https:, gh:, github:, jsr:, and network npm: fetches.
--no-allow-remote Both Force remote loading off, overriding VAELJS_ALLOW_REMOTE.
--frozen-lockfile Both Refuse any npm: or package.json resolution not pinned in vael.lock.
--offline Both Refuse network fetches for npm packages; resolve strictly from the verified CAS cache.
--no-npm Both Disable npm: specifiers and package.json dependency/#imports resolution.
-h, --help Both Print help (alone, after test, after types, after lsp in vjs, or after --allow-remote in vjs).
-V, --version Both Print <name> <version> (e.g., vjs 0.0.0-alpha.3).
-- Both End option parsing so a file or glob starting with - can be passed.

Both vjs and vjs-lite check VAELJS_ALLOW_REMOTE, and vjs db migrate checks VAELJS_DB_* / DATABASE_URL:

Variable Accepted Values Behavior
VAELJS_ALLOW_REMOTE 1, 0, true, false (case-insensitive) Enables or disables remote loading when neither --allow-remote nor --no-allow-remote is passed. Any invalid value is rejected at startup (exit code 2), even when an explicit flag overrides it.
VAELJS_DB_URL, DATABASE_URL Non-empty DSN string Connection URL for vjs db migrate (VAELJS_DB_URL takes precedence over DATABASE_URL).
VAELJS_DB_DRIVER, VAELJS_DB_HOST, VAELJS_DB_PORT, VAELJS_DB_NAME, VAELJS_DB_USER, VAELJS_DB_PASSWORD Driver / connection overrides Override vael.jsonc "db" connection fields for vjs db migrate (VAELJS_DB_PASSWORD supplies the password without argv exposure).
VAELJS_DB_TLS, VAELJS_DB_TLS_MODE, VAELJS_DB_CA_FILE Boolean / verifyFull | insecure | plaintext / path Override TLS settings for vjs db migrate.
VAELJS_DB_DIR, VAELJS_DB_TABLE, VAELJS_DB_SCHEMA, VAELJS_DB_MODULE, VAELJS_DB_LOCK_TIMEOUT_MS, VAELJS_DB_BASELINE_VERSION Path / identifiers / integers Override migration directory and ledger options for vjs db migrate.

Both vjs and vjs-lite use the same exit code contract:

Code Meaning
0 The entry module finished cleanly, every selected test file passed, or db migrate succeeded.
1 Runtime failure: module compile/load/strip error, uncaught exception, unhandled rejection, non-converging job queue, failing/pending test, a test file registering zero tests, or a migration/ledger/drift/database error in vjs db migrate.
2 Startup failure: invalid CLI flags or VAELJS_ALLOW_REMOTE, missing/invalid explicit --config, missing --project directory on lsp, unreadable or unsupported entry file, a test glob that failed to expand, or invalid db migrate usage / secret-hygiene rejection / missing --yes confirmation.

If the entry module exits via node:process (process.exit(code) or process.exitCode), the process exits with code & 0xff.

Both binaries inspect argv[0] at startup, extract the basename, and strip a trailing .exe suffix on Windows. If you symlink vjs as vael, usage lines and error prefixes automatically use vael: instead of vjs:.