# AutoIP AI Agent Setup & Operations Guide (v0.2.0) This document is written specifically for AI coding assistants and autonomous agents (Claude Code, Cursor, Codex, Antigravity, Windsurf, OpenClaw, etc.) to install, configure, verify, and troubleshoot **AutoIP** on behalf of a user. ## Golden Rules for Agents 1. **Always pass `--json`** on every `autoip` command to get clean, deterministic JSON output without ANSI escape codes. 2. **Start with discovery** (`autoip status --json`) before mutating anything. 3. **Always dry-run before applying** (`autoip sync --dry-run --json` → inspect planned creates/updates/deletes → `autoip sync --json`). 4. **Always save and display `recovery_code`** to the user immediately after claiming a free `.m.asia` subdomain (`autoip domain claim-free`). It is only shown once. 5. **Never pass `--yes`** to destructive commands (`autoip domain remove`, `autoip network remove`) without explicit user confirmation. 6. **Never echo or log user API secrets** unnecessarily. Stored secrets are write-only in AutoIP and never returned by any command. --- ## Step 0: Check Installation & Running Service Verify whether `autoip` is installed and its local daemon / Desktop app is running: ```bash autoip version --json autoip status --json ``` If `autoip` is not installed yet: - **Windows**: Download `AutoIP-Setup-v0.2.0-windows-amd64.exe` (or `arm64`) or `AutoIP-Portable-v0.2.0-windows-amd64.zip` from the AutoIP website. - **macOS**: Download `AutoIP-Desktop-v0.2.0-darwin-universal.dmg` (or CLI `autoip-v0.2.0-darwin-arm64` / `amd64`). - **Linux**: Download `autoip-v0.2.0-linux-amd64` (or `arm64`) or `autoip-desktop-v0.2.0-linux-amd64`, then `chmod +x autoip`. If `autoip status --json` reports the local service is not running: - **Desktop mode**: Launch **AutoIP Desktop** (it runs the local engine and stays in the system tray). - **Headless / Server mode (Linux)**: ```bash sudo ./autoip service install sudo systemctl start autoip ``` - **Windows Background Service**: ```powershell .\autoip.exe service install ``` - **Built-in up-to-date CLI manual**: Run `autoip agent-guide` at any time to print the exact command schema supported by the installed binary version. --- ## Step 1: Ensure at Least One Domain Is Configured Check existing domains: ```bash autoip domain list --json ``` ### Option A: Claim a Free `.m.asia` Subdomain (No Domain Needed) 1. Check available free root domains: ```bash autoip domain catalog --json ``` 2. Claim a free subdomain (custom prefix must be at least 4 characters, lowercase letters/digits/hyphens, or omit `--prefix` for an automatic random prefix): ```bash autoip domain claim-free --prefix myhome --json ``` 3. **CRITICAL**: Present the returned `fqdn` (e.g. `myhome.m.asia`) and `recovery_code` clearly to the user and remind them to save the recovery code safely. 4. If the user already has a recovery code from another machine, import it instead of claiming a new one: ```bash autoip domain import-free --code "" --json ``` ### Option B: Connect the User's Own Domain (14+ Providers) Supported `--provider-type` values include: `cloudflare`, `alidns`, `tencentcloud`, `dnspod`, `huaweicloud`, `baidudns`, `godaddy`, `porkbun`, `spaceship`, `cloudns`, `nowcn`, `tnethk`, `eranet`, `custom`. - **Token-only provider (e.g. Cloudflare)**: ```bash autoip domain add example.com --provider-type cloudflare --secret "" --json ``` - **Key ID + Secret provider (e.g. Aliyun / Tencent / DNSPod / NowCN / TnetHK)**: ```bash autoip domain add example.com --provider-type alidns --key-id "" --secret "" --json ``` --- ## Step 2A: Configure Dynamic Public WAN IP (DDNS) 1. Probe the machine's real public IPv4 / IPv6 (AutoIP races multiple built-in endpoints and filters proxy/Fake-IP/private addresses automatically): ```bash autoip ddns probe --json ``` 2. Bind the public IP to a subdomain label (use `@` for the zone apex, or e.g. `home` for `home.myhome.m.asia`): ```bash autoip ddns set home --zone myhome.m.asia --type A --ttl 300 --json ``` *(If only 1 domain is enabled, `--zone` may be omitted. For dual-stack IPv6, also add `--type AAAA`.)* 3. Inspect / toggle / remove DDNS records: ```bash autoip ddns list --json autoip ddns disable home.myhome.m.asia --json autoip ddns enable home.myhome.m.asia --json autoip ddns remove home.myhome.m.asia --json ``` --- ## Step 2B: Bind Tailscale Devices to DNS 1. Check whether local Tailscale is installed and logged in: ```bash autoip network local-check --json ``` 2. Connect local Tailscale without needing any API key (up to 1 `local_cli` source): ```bash autoip network add --name Home --mode local_cli --json ``` *(To connect additional Tailscale tailnets via OAuth client credentials that never expire:)* ```bash autoip network add --name Work --mode oauth --oauth-id "" --oauth-secret "" --json ``` 3. List discovered Tailscale devices: ```bash autoip node list --online --json ``` 4. Bind a device by hostname (default creates IPv4 `A` record; pass `--type auto` for A+AAAA or `--prefix` for a custom subdomain label): ```bash autoip node bind nas --zone myhome.m.asia --json autoip node bind mac-mini --zone myhome.m.asia --prefix studio --type A --json ``` *(If two networks share the same hostname, pass `--network ` and `--prefix ` to disambiguate.)* 5. Batch enable/disable or unbind: ```bash autoip node enable --all --zone myhome.m.asia --json autoip node disable --all --zone myhome.m.asia --json autoip node unbind nas --zone myhome.m.asia --json ``` --- ## Step 3: Safe Preview, Sync & Diagnostics 1. Always preview planned cloud DNS changes before applying: ```bash autoip sync --dry-run --json ``` 2. Verify there are no unexpected deletes or errors, then apply: ```bash autoip sync --json ``` 3. Inspect recent execution logs / troubleshoot failures: ```bash autoip audit --limit 20 --json autoip audit --limit 20 --result failed --json ``` 4. View or adjust sync interval and proxy settings: ```bash autoip settings get --json autoip settings set --interval 300 --proxy-mode system --json ``` --- ## Reporting Back to the User After completing setup, always report: 1. The exact bound domain(s) and record types/IPs (e.g. `home.myhome.m.asia -> 203.0.113.10 (A)`). 2. The `recovery_code` (if a free `.m.asia` subdomain was claimed). 3. Confirmation that `autoip sync --json` succeeded and background auto-sync is active.