n8n reference
Complete reference for n8n orchestrator commands, lmflow-host CLI flags, environment variables, lmflow_host_v1 schema types and functions, JSON schemas, and exit codes.
Orchestrator commands and npm scripts
| Command | Purpose |
|---|---|
| npm ci --ignore-scripts --no-audit --no-fund | Install pinned @lmctl-ai/lmctl (0.2.454) and @lmctl-ai/lmmock (0.1.117) dependencies |
| npm run build | Compile ./cmd/lmflow-host to ./build/lmflow-host with CGO_ENABLED=0 and -trimpath |
| npm run demo | Build lmflow-host and run examples/telegram.workflow.json through tests/telegram-mock.lms (lmmock) |
| npm test | Run static lmscript syntax checks, Go unit tests, schema parity checks, and all 63 integration scenarios |
| npm run check | Syntax-check all .lms files (src/run.lms, test.lms, and tests/*.lms) with lmscript --check |
| npm run test:unit | Run Go unit tests across ./internal/host and ./cmd/lmflow-host |
| npm run test:integration | Build lmflow-host and run the full LMScript test driver test.lms |
| npm run check:memory | Verify durable-memory index and formatting constraints |
| lmscript src/run.lms WORKFLOW.json CONNECTOR.json CREDENTIALS.json | Validate and execute a linear workflow with the specified connector and credentials JSON files |
lmflow-host CLI flags
| Flag or invocation | Purpose |
|---|---|
| ./build/lmflow-host --lmcode-schema --json | Print exact embedded internal/host/schema.json (lmflow_host_v1) bytes to stdout and exit 0 |
| ./build/lmflow-host --lmcode-signatures | Print canonical sorted registry signatures (including lmcode_std_v3 and lmflow_host_v1) and exit 0 |
| ./build/lmflow-host --lmcode FILE --workflow WF.json --connector CONN.json --credentials CRED.json [--base-url URL] | Load workflow, connector, and credentials JSON, verify bytecode against lmflow_host_v1, and execute the workflow |
Environment variables
| Variable | Default | Description |
|---|---|---|
| LMFLOW_HOST | ./build/lmflow-host | Path to the compiled Go LMCode host executable invoked by src/run.lms |
| LMFLOW_BASE_URL | unset | Explicit base URL override passed to lmflow-host via --base-url (takes precedence over LMMOCK_URL) |
| LMMOCK_URL | unset | Loopback mock server URL supplied automatically by lmmock during integration tests and demos |
| NODE | node | Node.js executable used by test.lms to invoke lmscript and lmmock |
| LMCODE_INVOCATION_FILE | unset | Internal SDK invocation envelope path supplied automatically by run_lmcode |
Host types and methods (lmflow_host_v1)
| Type | Method signature | Description |
|---|---|---|
| HttpResponse | HttpResponse.status() -> int | Return the HTTP status code of the provider response |
| HttpResponse | HttpResponse.json() -> Json | Return the parsed JSON body of the provider response |
Host global functions (lmflow_host_v1)
| Function signature | Description |
|---|---|
| input(name: string) -> Json | Return the loaded "workflow" or "connector" JSON document supplied via CLI flags |
| credential(id: string, field: string) -> string | Return the non-empty secret string for credential ID and field name from the credentials JSON file |
| base_url(default_url: string) -> string | Return the active base URL (--base-url override if set, otherwise default_url) |
| json_put(object: Json, key: string, value: Json) -> Json | Return a copy of JSON object with key set to scalar Json value |
| http_post_json(url: string, body: Json) -> HttpResponse | Execute a bounded 10s, 1 MiB HTTP POST request with application/json body and no redirects |
| workflow_fail(message: string) -> void | Halt workflow execution immediately with a run-phase failure carrying message |
Validation schemas and result contract
| Schema or contract | Path | Rules enforced |
|---|---|---|
| Workflow schema v1 | schema/workflow-v1.schema.json | Requires name, non-empty nodes array (id, name, type, parameters, optional credentials), and connections object |
| Connector schema v1 | schema/connector-v1.schema.json | Requires specVersion: 1, name, documentation, baseUrl (https://), nodeType, credentialType, credentialField, successField, errorField, and POST operations |
| Host result contract | internal/host/schema.json | Requires $return to be assigned a non-nullable Json value representing the final node output |
Exit codes
| Exit code | Component | Meaning |
|---|---|---|
| 0 | src/run.lms and lmflow-host | Workflow validation, bytecode execution, HTTP status checks, and result contract verification succeeded |
| 1 | lmscript (src/run.lms) | Pre-flight workflow/connector validation failed or require(result.ok) rejected a host failure |
| 2 | lmflow-host (cli phase) | Missing or invalid CLI flags (--lmcode, --workflow, --connector, --credentials) or invocation envelope error |
| 3 | lmflow-host (load / run phase) | Bytecode load error, malformed JSON config/credentials, missing credential ID/field, HTTP transport error, or workflow_fail() |
| 4 | lmflow-host (app / I/O) | Application failure or stdout write error |