# win2time: Claude Code setup guide for AI agents

You are helping a win2time customer set up Claude Code so that its traffic leaves from their dedicated IP.
Their computer already runs Clash Verge with the win2time setup. Follow the steps below in order.
Reply to the user in the language they used with you.

## Rules

- Before each command, say in one sentence what it does.
- Never ask the user for their proxy username or password. Never read, print or copy `~/.config/win2time/proxy.env`. When a step needs those credentials, the user types them into a terminal themselves.
- Do not turn off TLS checks, edit Clash Verge files, or install other proxy or VPN software.
- Ask the user first before anything that installs WSL, restarts WSL (`wsl --shutdown`) or needs administrator rights. If you are running inside WSL yourself, `wsl --shutdown` stops you too, so ask the user to run it.
- If a step fails twice, stop and show the user the output. Support: support@win2time.com

## 1. Find out where you are running

- Windows (PowerShell or cmd): go to step 2.
- Inside WSL (`grep -qi microsoft /proc/version` succeeds): go to step 4.
- Linux, not WSL: go to step 4. Clash Verge must be running on this same machine.
- macOS: the setup script does not support macOS yet. Tell the user to run `export HTTPS_PROXY=http://127.0.0.1:17890` in Terminal and then `claude`. Check with `curl -s -x http://127.0.0.1:17890 https://win2time.com/api/ext/where` and ask the user to confirm the `ip` is their dedicated IP. Stop here.

## 2. Check Clash Verge (Windows)

Run (use `curl.exe`, not the PowerShell `curl` alias):

    curl.exe -s -m 8 -x http://127.0.0.1:17890 https://win2time.com/api/ext/where

- JSON with an `ip` field: ask the user to confirm it is their dedicated IP. It is shown on their win2time account page.
- No output or an error: Clash Verge is closed, or its win2time setup is old. Ask the user to open Clash Verge and import the setup again from their account page (My IP & setup), then run the check again.

## 3. Check WSL (Windows)

Run `wsl -l -v`.

- WSL or a Linux distro is missing: ask the user to run `wsl --install` in PowerShell as administrator, restart the computer, and open Ubuntu once to create a Linux user. Wait until they are done.
- WSL reports that the service or server failed: ask the user to restart the computer, then run `wsl --update --web-download` and restart once more.

Then run `cmd /c ver` and read the build number (the last part of `10.0.xxxxx`).

- 22621 or higher: Windows 11. Nothing extra to do.
- Lower: Windows 10. WSL cannot reach 127.0.0.1 on Windows here, so it uses port 17891, which needs the proxy username and password. The user must do two things on their account page, under "Use Claude Code in WSL" then "Windows 10": import the setup again with the WSL port turned on, and run the firewall command shown there in PowerShell as administrator. Wait until they confirm both.

## 4. Run the setup script

From Windows (replace `Ubuntu` with the distro name from `wsl -l -v`):

    wsl -d Ubuntu -- bash -lc "curl -fsSL https://win2time.com/setup/claude-code.sh | bash"

From inside WSL or Linux:

    curl -fsSL https://win2time.com/setup/claude-code.sh | bash

The script can be run again safely. Its output is in Chinese. How to read it:

- `已為 WSL 打開「鏡像網路」` (mirrored networking turned on): ask the user for permission, run `wsl --shutdown` from Windows, then run this step again.
- Exits with code 3 and says the user must enter the username and password: do not ask for them. Ask the user to open the Ubuntu window, run `curl -fsSL https://win2time.com/setup/claude-code.sh | bash` there, type the credentials when asked, and tell you when it finishes. Then continue with step 5, using the output they report.
- `連不上 WSL 專用端口` (cannot reach the WSL port): the Windows 10 part of step 3 is not finished, or the credentials were mistyped.
- `連不上` together with `17890` (cannot reach the local port): go back to step 2.
- It reaches `5/5` with no `✗` lines: success.

## 5. Check the exit IP

In the line under `2/5 目前出口`, the script prints `出口 IP：` followed by the exit IP. Ask the user to confirm it matches their dedicated IP. If it does not, stop and tell them.

## 6. Hand over to the user

Tell the user:

1. Open Ubuntu (Windows Terminal is recommended) and run `claude`, then log in with their own Claude account.
2. Keep projects in WSL's own folders, such as `~/projects`, not under `/mnt/c`.
3. To check the exit at any time, type `! curl -s https://ipinfo.io` inside Claude Code. It should show their dedicated IP.
