# CLI

Requires Bun 1.4.4+ and the [installed npm package](install.md). Commands below use the installed `linksys` command; from a source checkout, use `bun run linksys` instead.

## Connect once

```sh
linksys login --host 192.168.1.1 --save
```

Run this in your own terminal. Inspect the router's certificate fingerprint and enter the password at the hidden prompt. `--save` is optional: it stores a plaintext credential in your private application configuration directory. Alternatively, inject `LINKSYS_PASSWORD` through your environment. Never put a password in command arguments or chat.

## Query

```sh
linksys info
linksys devices list --online
linksys devices show 02:00:00:00:00:30
linksys dhcp reservations list
linksys forwards list
linksys doctor
```

The MAC above is a synthetic example. Use an observed device ID or MAC. Device connections come from the router's records; reservations are configured assignments; port mappings do not prove external reachability.

Add `--json` for structured output, `--lang zh-CN` for Chinese terminal messages, or `--profile office` to select another configured router.

## Plan a fixed address

```sh
linksys dhcp reservations add \
  --ip 192.168.1.30 --mac 02:00:00:00:00:30 --name Printer \
  --plan printer.plan.json
linksys plan show printer.plan.json
```

Replace the example with independently verified device details. Planning only writes a local file. After reviewing it and arranging a network interruption window:

```sh
linksys apply printer.plan.json --allow-network-reload
```

Real DHCP writes remain unverified. Keep any deferred plan unapplied. Port-forwarding changes, Wi-Fi changes and reboot commands are not implemented. See the [interface contract](interface.md) for errors and write safeguards.

<!-- vim: set wrap: -->
