# Set up linksys-cli for an AI agent

This is the operational onboarding entry point. The user wants to use the CLI, not develop it. Complete the setup that is possible with the available access, then run the requested read-only queries. Repository development conventions remain in [AGENTS.md](https://github.com/dev-agent-io/linksys-cli/blob/main/AGENTS.md).

## 1. Find or install the CLI

Check for an existing `linksys` command and verify its `--version` and `--help`. Reuse it and its profile if it is the current CLI. Otherwise, reuse an authorized `dev-agent-io/linksys-cli` checkout when present, or install the public `@dev-agent-io/linksys-cli` package after checking Bun in the next step:

```sh
npm install --global @dev-agent-io/linksys-cli
```

The package does not require GitHub access. The source repository remains private; do not request GitHub credentials just to install the CLI or change repository visibility. Installation options are in [the installation guide](install.md).

Read the package's README and `skills/linksys-router/SKILL.md`. Installed packages include both the skill and referenced docs. For npm global installs, locate the package beneath `npm root --global`; preserve relative references. For a source checkout, use `bun run linksys` in place of the installed `linksys` command below. Preserve existing wrappers and local changes.

## 2. Check the runtime and load the skill

Check for Bun 1.4.4 or newer. Reuse the user's existing Bun installation. If missing, install it through the user's approved installation workflow, respecting local package, network and approval rules. Do not rewrite shell configuration or install a second runtime unnecessarily.

The CLI has no third-party runtime dependencies. Running it from source does not require installing development dependencies. Verify the selected installation:

```sh
linksys --version
linksys --help
```

Use the invocation verified above throughout setup; do not overwrite an existing command. A global wrapper is optional.

Load `skills/linksys-router/SKILL.md` into the current task. If the agent has a documented skill installation mechanism, register or symlink the whole skill directory there, preserving existing skills. Prefer a directory symlink to the checkout so relative references and updates stay valid. Do not guess an agent's discovery directory or copy only SKILL.md away from its referenced files. If persistent discovery is unavailable, continue using the loaded instructions and report that persistence is not configured. Some agents require a reload or new session to discover a newly installed skill; do not confuse file creation with successful discovery.

## 3. Reuse authentication or arrange first login

Use the user's existing profile and supplied `LINKSYS_PASSWORD` environment variable or saved application credential. Never dump environment variables or credential files. Permission to use this repository is not permission to inspect a separate personal configuration repository or password store.

The CLI also accepts `--profile NAME`. Reuse the selected profile and try a read-only command before asking for setup information. The standard router address is `192.168.1.1`; use a known user-provided address or existing profile when different. Do not search unrelated networks.

If certificate trust or credentials are missing, give the user this command to run in their own terminal:

```sh
linksys login --host <router-address> --save
```

Explain that `--save` is optional and stores the password in a private local plaintext credential file. The command displays the certificate fingerprint for explicit trust and hides password input. Alternatively, the user can supply `LINKSYS_PASSWORD` through their own environment. Do not ask for the password in chat, put it on the command line, or automatically accept an unknown or changed certificate. Windows file-based credential saving is not yet supported; use environment injection there.

After the user completes login, resume the read-only checks. If the agent is running in the cloud without a route to the home LAN, explain that it needs a local execution environment or an already authorized VPN path. Do not expose router management to the Internet or alter networking as part of onboarding.

## 4. Verify with actual queries

Use the verified CLI invocation, adding the selected `--profile` when needed:

```sh
linksys info --json
linksys devices list --online --json
linksys dhcp reservations list --json
linksys forwards list --json
```

Inspect each JSON envelope and exit status. Summarize device names, IP/MAC addresses, configured reservations and forwarding rules in the user's language. Router-reported connection state is not a fresh host probe; a forwarding rule is not proof of a successful WireGuard handshake.

First onboarding does not authorize DHCP writes, rebooting, Wi-Fi changes, applying existing plans, credential disclosure or publishing anything. Honor any earlier user deferral. Do not run tests against the live router to prove setup succeeded; the queries above are sufficient.

## Optional MCP connection

If the user wants MCP tools, follow [MCP setup](mcp.md) after CLI login. Start `linksys mcp --profile NAME` through the client's stdio configuration. It exposes only read operations; first connection does not authorize any router changes. For skill installation and public discovery, see [Skill setup](skill.md).

## Completion

Report the checkout location, working invocation, skill loading status, authentication status and verified queries. Separate missing access or unsupported capabilities from successful checks. Do not claim persistent skill discovery or working router access merely because the files are present.

After successful setup, follow the user's concrete requests through the CLI and the bundled skill. Mutations still require the reviewed plan/apply workflow and the user's authorized scope.

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