# cln-commando-cli

`cln-commando` is a tiny command-line client for calling Core Lightning RPC
methods over Commando using the Lightning transport.

It is intended as a remote `lightning-cli`-style probe/tool when you have:

- the target node id,
- a reachable host/port,
- a Commando rune.

The transport and Commando implementation come from [`lnsocket`](https://docs.rs/lnsocket).

## Install

```sh
cargo install cln-commando-cli
```

Or from a checkout:

```sh
cargo install --path .
```

## Usage

```sh
cln-commando \
  --connect 02abc...def@example.com:9735 \
  --rune "$RUNE" \
  getinfo
```

With JSON params:

```sh
cln-commando -c 02abc...def@example.com -r "$RUNE" listfunds '{}'
cln-commando -c 02abc...def@example.com -r "$RUNE" listpeers '{"id":"02..."}'
cln-commando -c 02abc...def@example.com -r "$RUNE" invoice '[1000,"label","description"]'
```

Read params from stdin or a file:

```sh
echo '{"id":"02..."}' | cln-commando -c 02abc...def@example.com -r "$RUNE" listpeers -
cln-commando -c 02abc...def@example.com -r "$RUNE" listpeers @params.json
```

Environment variables are also supported:

```sh
export CLN_COMMANDO_CONNECT=02abc...def@example.com:9735
export CLN_COMMANDO_RUNE=...
cln-commando --pretty listfunds
```

If your rune restricts the caller identity with an `id=` restriction, provide a
persistent client identity:

```sh
export CLN_COMMANDO_SECRET_KEY=0123...deadbeef
cln-commando -c 02abc...def@example.com -r "$RUNE" getinfo
```

Without `--secret-key`, a fresh random client key is generated for each run.

## Monitoring probe example

```sh
cln-commando \
  --connect "$NODE_ID@$HOST:9735" \
  --rune "$READONLY_RUNE" \
  --timeout 10 \
  --retries 0 \
  getinfo >/dev/null
```

That checks that the node accepts a fresh Lightning transport connection, runs
Commando, validates the rune, and can execute the chosen RPC.

## License

MIT
