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 commandArgumentsDescription
--versionnonePrint 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-signaturesnonePrint 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 / contextMethod signatureDescription
context curl: Curlcurl.session(string) -> SessionCreate an HTTP, HTTPS, or LDAPv3 session rooted at the given base URL.
Curlcurl.suite(string) -> SuiteCreate a named contract test suite.
Curlcurl.mock() -> MockCreate or attach to the built-in loopback mock HTTP server.
Curlcurl.load(Request, int, float, int) -> LoadResultRun a load test with virtual users, duration in seconds, and request limit.
Curlcurl.query_json(string, string) -> QueryEvaluate a JSONPath expression against a raw JSON string.
Curlcurl.query_text(string) -> QueryWrap a plain text string in a Query object for assertions and transforms.
Curlcurl.schema_valid(string, string) -> boolValidate a JSON string against a JSON Schema string.
Curlcurl.env(string) -> string | curl.version() -> stringRead an environment variable or return the lmcurl version string.
Mockmock.url() -> string | mock.serve(string, string, int) -> void | mock.stop() -> voidReturn the mock base URL, serve with ready/stop signal files and timeout_ms, or stop the listener.
Sessions.get(string) | s.post(string) | s.put(string) | s.delete(string) | s.patch(string) | s.head(string) -> RequestCreate a Request for the specified HTTP method or LDAP path relative to the session base URL.
Sessions.request(string, string) -> RequestCreate a Request with an explicit method name and path.
Sessions.header(string, string) -> Session | s.set(string, string) -> Session | s.get_var(string) -> stringConfigure default session headers or store and retrieve session template variables.
Sessions.secret(string, string) -> SessionStore a named secret variable and register its value for automatic output redaction.
Requestreq.header(string, string) | req.body(string) | req.json(string) | req.form(string, string) -> RequestSet request headers, raw body, JSON payload, or URL-encoded form fields.
Requestreq.part(string, string) | req.upload(string, string, string) -> RequestAdd multipart form fields or file uploads (field name, path, content type).
Requestreq.basic(string, string) | req.digest(string, string) | req.bearer_env(string) -> RequestConfigure Basic auth (or LDAP simple bind DN/password), Digest auth, or bearer token from an env var.
Requestreq.cacert(string) | req.cert(string, string) | req.insecure(bool) | req.http2(bool) -> RequestConfigure TLS CA bundle, client certificate and key, peer verification, or HTTP/2 negotiation.
Requestreq.timeout(int) | req.limit(int) | req.retry(int, int) | req.follow(bool) -> RequestSet timeout in ms, response byte cap, retry count and backoff ms, or redirect following.
Requestreq.proxy(string) | req.resolve(string) | req.stream(bool) | req.allow_error(bool) -> RequestConfigure proxy URL ("" disables env proxies), custom host:port:ip resolution, SSE streaming, or non-throwing transport errors.
Requestreq.send() -> ResponseExecute the HTTP or LDAPv3 request and return the Response.
Responseresp.status() -> int | resp.body() -> string | resp.bytes() -> int | resp.url() -> stringInspect the HTTP/LDAP status code, response body, byte length, or effective URL.
Responseresp.header(string) -> string | resp.cookie(string) -> string | resp.certificate() -> stringRead a response header, cookie value, or peer TLS certificate summary.
Responseresp.error() -> string | resp.attempts() -> int | resp.time(string) -> float | resp.sse_count() -> intInspect redacted transport error text, retry attempts, timing phase (dns, connect, tls, ttfb, total), or SSE event count.
Responseresp.json(string) -> Query | resp.xpath(string) -> Query | resp.query(string, string) -> QueryQuery response body with JSONPath, XPath, or a named query kind.
Responseresp.assert_json_schema(string) -> bool | resp.assert_openapi(string, string, string) -> boolValidate response JSON against a JSON Schema or an OpenAPI document, path, and method.
Responseresp.save(string) -> void | resp.snapshot(string, bool) -> boolSave response body to disk or compare/update a named golden snapshot.

Query, Suite, LoadResult, and LLM methods

Type / contextMethod signatureDescription
Queryq.value() -> string | q.to_int() -> int | q.count() -> int | q.exists() -> bool | q.missing() -> boolExtract projected scalar value, integer value, match count, or presence status.
Queryq.equals(string) | q.not_equals(string) | q.contains(string) | q.starts_with(string) | q.ends_with(string) | q.matches(string) -> boolEvaluate string and POSIX ERE predicates on the projected query value.
Queryq.gt(string) | q.lt(string) | q.includes(string) | q.is_empty() | q.is_string() | q.is_integer() | q.is_collection() -> boolEvaluate numeric comparisons, collection membership, and value-type predicates.
Queryq.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) -> QueryTransform query results through indexing, splitting, replacement, regex extraction, or escaping.
Suitesuite.test_request(string, Request) -> Test | suite.before(Request) | suite.after(Request) -> SuiteRegister a named test case or suite setup and teardown requests.
Suitesuite.data_csv(string) | suite.data_json(string) | suite.filter(string) | suite.parallel(bool) | suite.fail_fast(bool) -> SuiteDrive tests from CSV/JSON rows, filter by tag, enable concurrent execution, or stop on first failure.
Suite / Reportsuite.report() -> Report | rep.passed() | rep.failed() | rep.skipped() -> int | rep.assert_all() -> boolExecute suite and inspect pass/fail counts or assert zero failures.
Reportrep.console() | rep.json() | rep.tap() -> string | rep.save(string) | rep.csv(string) | rep.junit(string) | rep.html(string) -> voidRender or export test suite reports as console text, JSON, TAP, CSV, JUnit XML, or standalone HTML.
Testt.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) -> TestAttach status, substring, exact body, JSONPath, XPath, or JSON Schema assertions to a suite test.
Testt.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) -> TestCapture JSONPath values into session variables or redacted secrets, poll until ready, or tag tests.
LoadResultlr.requests() -> int | lr.error_rate() | lr.p50_ms() | lr.p95_ms() | lr.p99_ms() -> float | lr.threshold(float, float) -> boolInspect load test totals and latency percentiles or assert max error rate and p95 latency thresholds.
context llm: Llmllm.openrouter(string) | llm.deepseek(string) | llm.ollama(string) | llm.mock(string) | llm.provider(string, string, string) -> ProviderConfigure an LLM provider endpoint or deterministic local mock fixture.
Llm / functionsllm.ledger(string) -> void | llm_calls() -> int | llm_cost() -> floatWrite cost ledger JSON and inspect cumulative LLM call count and estimated USD spend.
Provider / Chatp.model(string) -> Provider | p.chat(string) -> Chat | p.matrix(string, string) -> MatrixSelect model, start a Chat request, or compare a prompt across a comma-separated model matrix.
Chatc.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) -> ChatConfigure chat messages, tool declarations, sampling hyperparameters, streaming, and cassette recording/replay.
Chat / Resultc.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() -> floatExecute completion or multi-run sampling and inspect output text, tokens, latency, and estimated cost.

Standard lmcode_std_v3 REST and CLI interfaces

Interface or functionSignature / annotationDescription
RestGet .. RestOptions@"/path/:param" fn h(x: RestExchange) -> void implements RestGetBind an HTTP GET, POST, PUT, DELETE, PATCH, HEAD, or OPTIONS route handler.
RestHandler@"/path" fn h(x: RestExchange) -> void implements RestHandlerBind a method-agnostic HTTP route handler.
CliCommand@"cmd" fn h(x: RestExchange) -> void implements CliCommandBind a named CLI subcommand dispatched by rest_cli.
CliOption@"--flag" fn h(x: RestExchange) -> void implements CliOptionBind a CLI option flag (--flag=val or --flag val) evaluated before the command handler.
rest_configrest_config(key: string, value: string) -> voidConfigure server or CLI settings such as host, port, and session (ephemeral or global).
rest_routerest_route(method: string, path: string, handler: string) -> voidDynamically register an HTTP method and route pattern to a handler function name.
rest_serve / rest_stoprest_serve() -> void | rest_stop() -> voidStart or stop the embedded standard HTTP server loop.
rest_clirest_cli(args: StrList) -> stringDispatch CLI options, commands, or path requests in-process without opening a socket.
RestExchangex.method() | x.path() | x.body() | x.param(string) | x.query(string) | x.header(string) -> stringRead request method, path, body, :param segment, query parameter, or header.
RestExchangex.has_query(string) | x.has_header(string) -> boolCheck whether a query parameter or request header is present.
RestExchangex.status(int) | x.set_header(string, string) | x.send(string) | x.json(string) -> voidSet response status code and headers, and emit plain text or application/json bodies.
RestExchangex.get(string) -> string | x.set(string, string) -> void | x.increment(string) -> intRead, write, or atomically increment session state keys across global or ephemeral exchanges.

Exit codes

Exit codeCategoryMeaning
0SuccessCommand, LDAPv3 operation, or _lmcode_ program succeeded and all assertions passed.
1Operation errorDirect CLI HTTP or LDAPv3 network, bind, or directory operation failed.
2Usage errorInvalid command-line flag, retired flag name, or missing required CLI argument.
3Host / load errorBytecode format mismatch, schema binding failure, unhandled runtime error, or non-Linux platform stub refusal.
4Contract failureAn assertion (assert, assert_eq, Report.assert_all) or test contract failed during execution.