lmssh reference

Complete command-line flag reference, embedded OpenSSH client subcommands, host schema contexts and methods, standard lmcode_std_v3 REST and CLI interfaces, and exit codes for lmssh v0.1.1 (bundling OpenSSH 10.6p1).

Host and CLI flags

Flag or commandArgumentsDescription
--versionnonePrint the lmssh version string (lmssh 0.1.1) and exit 0.
--lmcode<file.dslb>... [-- args...]Load and execute one or more compiled LMScript bytecode files; arguments after -- are exposed via io.args().
--dry-run--lmcode <file.dslb>Print every ssh, sftp, scp, and ssh-keygen command to stderr as [dry-run] without spawning processes or modifying local files.
--lmcode-schema[--json]Print a human-readable schema signature summary, or exact embedded schema JSON bytes when --json is passed.
--lmcode-signaturesnonePrint all 334 canonical context, function, and method signatures (108 host + 226 standard library).
ssh[openssh-args...]Run the embedded OpenSSH 10.6p1 ssh client (also invoked when argv[0] is ssh or argv[1] starts with a single -).
sftp[openssh-args...]Run the embedded OpenSSH 10.6p1 sftp client using the lmssh binary as its underlying ssh transport.
scp[openssh-args...]Run the embedded OpenSSH 10.6p1 scp client using the lmssh binary as its underlying ssh transport.
ssh-keygen / keygen[openssh-args...]Run the embedded OpenSSH 10.6p1 ssh-keygen utility.

Ssh, Session, Result, and ResultList methods

Type / contextMethod signatureDescription
context ssh: Sshssh.connect(string) -> SessionCreate a Session for [user@]host or an ssh_config alias, inheriting current Ssh defaults.
Sshssh.each(StrList, string) -> ResultListExecute a command across all destinations in parallel (up to parallel(n)) and return results in input order.
Sshssh.shutdown() -> voidClose all active ControlMaster multiplex sockets and remove the temporary work directory early.
Ssh / Sessionport(int) | user(string) | identity(string) | config(string) | jump(string) -> Ssh / SessionConfigure SSH port (-p/-P), default user, identity key file (-i with IdentitiesOnly=yes), config file (-F), or ProxyJump (-J).
Ssh / Sessionknown_hosts(string) | strict_host_key(string) | option(string) -> Ssh / SessionSet UserKnownHostsFile, StrictHostKeyChecking (yes, accept-new, no), or repeatable -o Key=Value options.
Ssh / Sessionconnect_timeout(int) | timeout(int) | password(string) | reuse(bool) | parallel(int) -> Ssh / SessionSet ConnectTimeout seconds (default 30), per-step wall timeout seconds, askpass secret, ControlMaster reuse, or fan-out concurrency (1..256).
Sessions.exec(string) -> Result | s.exec(string, string) -> ResultRun a remote command (optionally piping the second argument to stdin) and return a Result without throwing on non-zero exit status.
Sessions.output(string) -> string | s.ok(string) -> boolRun a remote command and return stdout (throwing RUN_HOST if exit status != 0) or return true on exit status 0.
Sessions.put(string, string) | s.get(string, string) | s.put_dir(string, string) | s.get_dir(string, string) -> voidUpload or download a single file or recursive directory via scp, throwing RUN_HOST on failure.
Sessions.cat(string) -> string | s.write(string, string) -> voidRead a remote file into a string or write string content to a remote file via a private temporary file and scp.
Sessions.ls(string) -> StrList | s.exists(string) -> bool | s.mkdir(string) | s.rm(string) | s.rmdir(string) | s.rename(string, string) -> voidInspect or mutate remote filesystem paths over an SFTP batch session with wildcard-neutralized literal paths.
Sessions.sftp(string) -> Result | s.close() -> void | s.dest() -> stringRun a raw SFTP batch script on stdin (stripping sftp> echo lines), close this session's ControlMaster, or return the destination string.
Resultr.ok() -> bool | r.status() -> int | r.stdout() -> string | r.stderr() -> string | r.dest() -> string | r.timed_out() -> bool | r.require() -> ResultInspect remote execution status (status 124 on timeout) or throw RUN_HOST if the command failed or timed out.
ResultListrl.len() -> int | rl.at(int) -> Result | rl.failed() -> int | rl.require_all() -> ResultListInspect parallel fleet execution results or throw RUN_HOST listing every failed destination.

Keys, Key, Io, and Report methods

Type / contextMethod signatureDescription
context keys: Keyskeys.bits(int) -> KeysSet the key bit length (-b) for subsequent keys.generate calls.
Keyskeys.generate(string, string) -> Key | keys.generate(string, string, string, string) -> KeyGenerate a new SSH key at path with type (ed25519, rsa, ecdsa) and optional comment and passphrase; refuses to overwrite existing files.
Keyskeys.load(string) -> Key | keys.fingerprint(string) -> stringLoad an existing key metadata handle or return the SHA256:... fingerprint string of a key or certificate file.
Keyskeys.change_passphrase(string, string, string) | keys.set_comment(string, string, string) -> voidUpdate a private key's passphrase (-p) or comment (-c) via ssh-keygen.
Keyskeys.known_hosts_find(string, string) -> string | keys.known_hosts_remove(string, string) | keys.known_hosts_hash(string) -> voidFind (-F), remove (-R), or hash (-H) host entries in a known_hosts file.
Keyskeys.certify(string, string, string, string, string) -> stringSign a public key with a CA key (ca_key, pub_key, identity, principals, validity) and return the *-cert.pub path.
Keyskeys.sign(string, string, string) -> string | keys.verify(string, string, string, string, string) -> boolCreate a detached signature (key, namespace, file -> file.sig) or verify a signature against an allowed_signers file (-Y sign / -Y verify).
Keyk.path() | k.public() | k.public_with(string) | k.fingerprint() | k.type() | k.comment() -> string | k.bits() -> intInspect key path, OpenSSH public key line (from .pub or derived with passphrase), SHA256 fingerprint, algorithm type, comment, or bit size.
context io: Ioio.print(string) | io.eprint(string) | io.fail(string) -> voidWrite a line to stdout or stderr, or terminate the script with APP_FAIL (exit code 4).
Ioio.read(string) -> string | io.lines(string) -> StrList | io.write(string, string) | io.append(string, string) -> voidRead a local file as a string or line list, or write/append string content to a local path.
Ioio.exists(string) -> bool | io.mkdir(string) | io.remove(string) -> void | io.temp_dir() -> stringCheck local path existence, recursively create or delete directories, or allocate an auto-cleaned private temporary directory.
Ioio.env(string) -> string | io.args() -> StrList | io.sha256(string) -> string | io.sleep_ms(int) -> void | io.now() -> intRead an environment variable, script arguments after --, lowercase hex SHA-256 of a local file, sleep in ms, or read epoch seconds.
context report: Reportreport.add(string, string, int, string) -> void | report.count() -> int | report.text() -> stringRecord a structured finding (kind, host_or_file, status_or_line, message), count findings, or format findings as text.
Reportreport.print() | report.write_text(string) | report.write_json(string) | report.fail_if_any() -> voidPrint findings, export text or JSON finding reports, or exit with code 4 (APP_FAIL) if count() > 0.

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
0SuccessBytecode program or introspection command succeeded and all assertions passed.
2Usage errorInvalid command-line flag, missing --lmcode file argument, or malformed invocation.
3Load / host run errorBytecode corrupt, schema hash mismatch, unbound import, or runtime host error (RUN_HOST).
4Application verdictScript explicitly failed via io.fail(msg), report.fail_if_any(), or an assertion failure (APP_FAIL).
0..255Direct OpenSSH modeWhen invoked as lmssh ssh|sftp|scp|ssh-keygen, returns the exact exit code of the OpenSSH client tool.