lmcurl reference
Complete command-line flag reference, LDAPv3 CLI subcommands, host schema contexts and methods, standard lmcode_std_v3 REST and CLI interfaces, and exit codes for lmcurl v0.1.4.
Host and CLI flags
| Flag or command | Arguments | Description |
|---|---|---|
| --version | none | Print the lmcurl version string and exit 0. |
| --lmcode | <file.dslb> | Load and execute a compiled LMScript bytecode program against the embedded schema. |
| --lmcode-schema | [--json] | Print a human-readable schema summary, or exact embedded schema JSON bytes when --json is passed. |
| --lmcode-signatures | none | Print all 413 canonical context, function, and method signatures (187 host + 226 standard library). |
| ldap://... | [-u dn:pw] [-X METHOD] [-d BODY] [-i] | Execute a direct curl-style LDAPv3 URL request (/ping, /bind, /whoami, /compare, /search, /entry/DN, or RFC 4516 search URL). |
| ldap ping | [--host H] [--port P] | Send an anonymous Root DSE probe and return {"ok":true,"result":"PONG"}. |
| ldap bind | --dn DN --password PW [--host H] [--port P] | Perform an explicit LDAPv3 simple bind and report bind status. |
| ldap whoami | [--bind-dn DN] [--bind-pw PW] [--host H] [--port P] | Send an RFC 4532 Who Am I? extended request (OID 1.3.6.1.4.1.4203.1.11.3) and return authzId. |
| ldap search | --base-dn DN [--filter F] [--scope base|one|sub] [--attrs a,b] | Search directory entries with filter evaluation and optional attribute projection. |
| ldap get | <dn> [--attrs a,b] [--host H] [--port P] | Fetch a single directory entry by Distinguished Name (base-scope search). |
| ldap add | <dn> <json-attrs> [--bind-dn DN] [--bind-pw PW] | Create a new directory entry from a JSON object of attribute values. |
| ldap modify | <dn> <json-ops> [--bind-dn DN] [--bind-pw PW] | Apply add, replace, or delete attribute modifications from a JSON object. |
| ldap compare | <dn> <attr> <value> [--bind-dn DN] [--bind-pw PW] | Execute an RFC 4511 CompareRequest (tag 0x6e) and return {"match":true|false}. |
| ldap del | <dn> [--bind-dn DN] [--bind-pw PW] | Delete an entry by Distinguished Name. |
Host contexts and HTTP/LDAP methods
| Type / context | Method signature | Description |
|---|---|---|
| context curl: Curl | curl.session(string) -> Session | Create an HTTP, HTTPS, or LDAPv3 session rooted at the given base URL. |
| Curl | curl.suite(string) -> Suite | Create a named contract test suite. |
| Curl | curl.mock() -> Mock | Create or attach to the built-in loopback mock HTTP server. |
| Curl | curl.load(Request, int, float, int) -> LoadResult | Run a load test with virtual users, duration in seconds, and request limit. |
| Curl | curl.query_json(string, string) -> Query | Evaluate a JSONPath expression against a raw JSON string. |
| Curl | curl.query_text(string) -> Query | Wrap a plain text string in a Query object for assertions and transforms. |
| Curl | curl.schema_valid(string, string) -> bool | Validate a JSON string against a JSON Schema string. |
| Curl | curl.env(string) -> string | curl.version() -> string | Read an environment variable or return the lmcurl version string. |
| Mock | mock.url() -> string | mock.serve(string, string, int) -> void | mock.stop() -> void | Return the mock base URL, serve with ready/stop signal files and timeout_ms, or stop the listener. |
| Session | s.get(string) | s.post(string) | s.put(string) | s.delete(string) | s.patch(string) | s.head(string) -> Request | Create a Request for the specified HTTP method or LDAP path relative to the session base URL. |
| Session | s.request(string, string) -> Request | Create a Request with an explicit method name and path. |
| Session | s.header(string, string) -> Session | s.set(string, string) -> Session | s.get_var(string) -> string | Configure default session headers or store and retrieve session template variables. |
| Session | s.secret(string, string) -> Session | Store a named secret variable and register its value for automatic output redaction. |
| Request | req.header(string, string) | req.body(string) | req.json(string) | req.form(string, string) -> Request | Set request headers, raw body, JSON payload, or URL-encoded form fields. |
| Request | req.part(string, string) | req.upload(string, string, string) -> Request | Add multipart form fields or file uploads (field name, path, content type). |
| Request | req.basic(string, string) | req.digest(string, string) | req.bearer_env(string) -> Request | Configure Basic auth (or LDAP simple bind DN/password), Digest auth, or bearer token from an env var. |
| Request | req.cacert(string) | req.cert(string, string) | req.insecure(bool) | req.http2(bool) -> Request | Configure TLS CA bundle, client certificate and key, peer verification, or HTTP/2 negotiation. |
| Request | req.timeout(int) | req.limit(int) | req.retry(int, int) | req.follow(bool) -> Request | Set timeout in ms, response byte cap, retry count and backoff ms, or redirect following. |
| Request | req.proxy(string) | req.resolve(string) | req.stream(bool) | req.allow_error(bool) -> Request | Configure proxy URL ("" disables env proxies), custom host:port:ip resolution, SSE streaming, or non-throwing transport errors. |
| Request | req.send() -> Response | Execute the HTTP or LDAPv3 request and return the Response. |
| Response | resp.status() -> int | resp.body() -> string | resp.bytes() -> int | resp.url() -> string | Inspect the HTTP/LDAP status code, response body, byte length, or effective URL. |
| Response | resp.header(string) -> string | resp.cookie(string) -> string | resp.certificate() -> string | Read a response header, cookie value, or peer TLS certificate summary. |
| Response | resp.error() -> string | resp.attempts() -> int | resp.time(string) -> float | resp.sse_count() -> int | Inspect redacted transport error text, retry attempts, timing phase (dns, connect, tls, ttfb, total), or SSE event count. |
| Response | resp.json(string) -> Query | resp.xpath(string) -> Query | resp.query(string, string) -> Query | Query response body with JSONPath, XPath, or a named query kind. |
| Response | resp.assert_json_schema(string) -> bool | resp.assert_openapi(string, string, string) -> bool | Validate response JSON against a JSON Schema or an OpenAPI document, path, and method. |
| Response | resp.save(string) -> void | resp.snapshot(string, bool) -> bool | Save response body to disk or compare/update a named golden snapshot. |
Query, Suite, LoadResult, and LLM methods
| Type / context | Method signature | Description |
|---|---|---|
| Query | q.value() -> string | q.to_int() -> int | q.count() -> int | q.exists() -> bool | q.missing() -> bool | Extract projected scalar value, integer value, match count, or presence status. |
| Query | q.equals(string) | q.not_equals(string) | q.contains(string) | q.starts_with(string) | q.ends_with(string) | q.matches(string) -> bool | Evaluate string and POSIX ERE predicates on the projected query value. |
| Query | q.gt(string) | q.lt(string) | q.includes(string) | q.is_empty() | q.is_string() | q.is_integer() | q.is_collection() -> bool | Evaluate numeric comparisons, collection membership, and value-type predicates. |
| Query | q.nth(int) | q.split(string) | q.replace(string, string) | q.regex(string) | q.format(string) | q.url_decode() | q.html_escape() | q.to_date(string) -> Query | Transform query results through indexing, splitting, replacement, regex extraction, or escaping. |
| Suite | suite.test_request(string, Request) -> Test | suite.before(Request) | suite.after(Request) -> Suite | Register a named test case or suite setup and teardown requests. |
| Suite | suite.data_csv(string) | suite.data_json(string) | suite.filter(string) | suite.parallel(bool) | suite.fail_fast(bool) -> Suite | Drive tests from CSV/JSON rows, filter by tag, enable concurrent execution, or stop on first failure. |
| Suite / Report | suite.report() -> Report | rep.passed() | rep.failed() | rep.skipped() -> int | rep.assert_all() -> bool | Execute suite and inspect pass/fail counts or assert zero failures. |
| Report | rep.console() | rep.json() | rep.tap() -> string | rep.save(string) | rep.csv(string) | rep.junit(string) | rep.html(string) -> void | Render or export test suite reports as console text, JSON, TAP, CSV, JUnit XML, or standalone HTML. |
| Test | t.expect_status(int) | t.expect_status_in(int, int) | t.expect_body(string) | t.expect_exact(string) | t.expect_json(string, string) | t.expect_xpath(string, string) | t.expect_schema(string) -> Test | Attach status, substring, exact body, JSONPath, XPath, or JSON Schema assertions to a suite test. |
| Test | t.capture(string, string) | t.capture_secret(string, string) | t.poll_json(string, string, int, int) | t.retry(int, int) | t.timeout(int) | t.tag(string) -> Test | Capture JSONPath values into session variables or redacted secrets, poll until ready, or tag tests. |
| LoadResult | lr.requests() -> int | lr.error_rate() | lr.p50_ms() | lr.p95_ms() | lr.p99_ms() -> float | lr.threshold(float, float) -> bool | Inspect load test totals and latency percentiles or assert max error rate and p95 latency thresholds. |
| context llm: Llm | llm.openrouter(string) | llm.deepseek(string) | llm.ollama(string) | llm.mock(string) | llm.provider(string, string, string) -> Provider | Configure an LLM provider endpoint or deterministic local mock fixture. |
| Llm / functions | llm.ledger(string) -> void | llm_calls() -> int | llm_cost() -> float | Write cost ledger JSON and inspect cumulative LLM call count and estimated USD spend. |
| Provider / Chat | p.model(string) -> Provider | p.chat(string) -> Chat | p.matrix(string, string) -> Matrix | Select model, start a Chat request, or compare a prompt across a comma-separated model matrix. |
| Chat | c.system(string) | c.user(string) | c.assistant(string) | c.tool(string, string) | c.temperature(float) | c.max_tokens(int) | c.seed(int) | c.json_mode(bool) | c.stream(bool) | c.timeout(int) | c.cassette(string) | c.replay(string) -> Chat | Configure chat messages, tool declarations, sampling hyperparameters, streaming, and cassette recording/replay. |
| Chat / Result | c.send() -> Result | c.sample(int, float) -> Sample | res.text() | res.json() | res.tools() | res.model() | res.finish() -> string | res.status() | res.length() | res.input_tokens() | res.output_tokens() -> int | res.latency_ms() | res.estimated_cost() -> float | Execute completion or multi-run sampling and inspect output text, tokens, latency, and estimated cost. |
Standard lmcode_std_v3 REST and CLI interfaces
| Interface or function | Signature / annotation | Description |
|---|---|---|
| RestGet .. RestOptions | @"/path/:param" fn h(x: RestExchange) -> void implements RestGet | Bind an HTTP GET, POST, PUT, DELETE, PATCH, HEAD, or OPTIONS route handler. |
| RestHandler | @"/path" fn h(x: RestExchange) -> void implements RestHandler | Bind a method-agnostic HTTP route handler. |
| CliCommand | @"cmd" fn h(x: RestExchange) -> void implements CliCommand | Bind a named CLI subcommand dispatched by rest_cli. |
| CliOption | @"--flag" fn h(x: RestExchange) -> void implements CliOption | Bind a CLI option flag (--flag=val or --flag val) evaluated before the command handler. |
| rest_config | rest_config(key: string, value: string) -> void | Configure server or CLI settings such as host, port, and session (ephemeral or global). |
| rest_route | rest_route(method: string, path: string, handler: string) -> void | Dynamically register an HTTP method and route pattern to a handler function name. |
| rest_serve / rest_stop | rest_serve() -> void | rest_stop() -> void | Start or stop the embedded standard HTTP server loop. |
| rest_cli | rest_cli(args: StrList) -> string | Dispatch CLI options, commands, or path requests in-process without opening a socket. |
| RestExchange | x.method() | x.path() | x.body() | x.param(string) | x.query(string) | x.header(string) -> string | Read request method, path, body, :param segment, query parameter, or header. |
| RestExchange | x.has_query(string) | x.has_header(string) -> bool | Check whether a query parameter or request header is present. |
| RestExchange | x.status(int) | x.set_header(string, string) | x.send(string) | x.json(string) -> void | Set response status code and headers, and emit plain text or application/json bodies. |
| RestExchange | x.get(string) -> string | x.set(string, string) -> void | x.increment(string) -> int | Read, write, or atomically increment session state keys across global or ephemeral exchanges. |
Exit codes
| Exit code | Category | Meaning |
|---|---|---|
| 0 | Success | Command, LDAPv3 operation, or _lmcode_ program succeeded and all assertions passed. |
| 1 | Operation error | Direct CLI HTTP or LDAPv3 network, bind, or directory operation failed. |
| 2 | Usage error | Invalid command-line flag, retired flag name, or missing required CLI argument. |
| 3 | Host / load error | Bytecode format mismatch, schema binding failure, unhandled runtime error, or non-Linux platform stub refusal. |
| 4 | Contract failure | An assertion (assert, assert_eq, Report.assert_all) or test contract failed during execution. |