lauf run
Execute a script by its qualified name.
Usage
lauf run [script] [--arg=value ...]Parameters
| Parameter | Required | Description |
|---|---|---|
script | No | Qualified script name (e.g., @my-org/api/generate-types) |
If the script name is omitted, an interactive prompt lets you select from all discovered scripts.
Arguments
Arguments are passed as CLI flags after the script name:
lauf run @my-org/api/generate-types --outDir=./src --verbose=trueSupported Formats
--key=value # explicit assignment
--key value # space-separated
--flag # boolean true (no value)Type Coercion
Values are automatically coerced before validation:
| Input | Result |
|---|---|
"true" | true |
"false" | false |
"42", "3.14" | 42, 3.14 |
| everything else | stays a string |
Hex strings (0x...) and scientific notation (1e10) are not coerced -- they remain strings.
Environment Variables
Pass --env KEY=VALUE to set environment variables for the script:
lauf run @my-org/api/seed --env DATABASE_URL=postgres://localhost/dev --env NODE_ENV=testBoth --env KEY=VALUE and --env=KEY=VALUE forms are supported. CLI env vars override config-level and script-level env vars.
Merge priority (later overwrites earlier): base env (sandbox) < config env < script env < CLI --env
Inline Help
Pass --help or -h after the script name to see its arguments without running it:
lauf run @my-org/api/generate-types --helpThis is equivalent to running lauf info @my-org/api/generate-types.
Behavior
- Loads the nearest
lauf.config.ts - Resolves the script by qualified name (or prompts for selection)
- Parses trailing CLI flags into arguments
- Validates arguments against the script's Zod schema
- Executes the script in an isolated process
- Reports the exit code
Error Cases
| Scenario | Message |
|---|---|
| Config load failure | Failed to load lauf config: <error> |
| Script not found | Script not found: <name> |
| Non-zero exit | <script> exited with code <n> |
| Positional arguments | Warning: Positional arguments were ignored... |
Notes
- Each script runs in its own process, so it cannot crash the CLI
- Scripts have full access to Node.js APIs
- Scripts control their own spinner via
ctx.spinner