# Install and sign in to the tartan CLI

_For tartan 0.9.36._

Install tartan on a Windows computer, sign in with your passkey, and run your first command.

Install `tartan` on a Windows computer, sign in with your passkey, and run your first command.

The CLI answers in JSON for scripts and AIs. It signs in with Windows'
passkey prompt, so run it on Windows.

## 1. Install it

Each release is published with a `manifest.json` that lists every file's SHA-256. This installs one version into
your own folder, checks it against the manifest, and puts it on your user PATH. Set `$v` to the CLI version you want:

```powershell
$v = "<version>"; $d = "$env:LOCALAPPDATA\Tartan\cli"; New-Item -ItemType Directory -Force $d | Out-Null
$base = "https://dl.tartannetworks.com/releases/cli/$v"
$m = Invoke-RestMethod "$base/manifest.json"; $f = $m.files.'windows-amd64'
Invoke-WebRequest "$base/$($f.name)" -OutFile "$d\tartan.exe"
if ((Get-FileHash "$d\tartan.exe" -Algorithm SHA256).Hash.ToLower() -ne $f.sha256) { Remove-Item "$d\tartan.exe"; throw "sha256 mismatch: not installed" }
$p = [Environment]::GetEnvironmentVariable("Path", "User"); if (($p -split ';') -notcontains $d) { [Environment]::SetEnvironmentVariable("Path", "$p;$d", "User") }
```

Open a new terminal so the PATH change applies, then:

```sh
tartan version
```

It prints the version and its commit.

## 2. Sign in

**With an invite link** (the usual way). An Admin of your organization sends you the link
([Invite people](invite-people.md)). Paste it into your own terminal:

```sh
tartan join "<invite link>"
```

The join shows the control (Tartan's control plane), the organization, the passkey's website and any SSO provider
the link names, and asks `Join? [y/N]` before it sends anything. Check them, answer `y`, sign in to your SSO in the browser if your
organization uses one, then create your passkey when Windows asks. It ends with what it did and one `Next:` line.

**A new organization of your own:** [Create your org](create-org.md).

The CLI keeps one sign-in for you on this computer, in the same place the console reads, and it reaches every
organization where you hold a role: add `--org` to pick one. Signed in once, both use it.

## 3. Sign in again later

A session lasts 16 hours by default; an organization may set a shorter one. After that:

```sh
tartan login
```

Windows asks for your passkey; your SSO page opens too when your organization uses one. When you step away:

```sh
tartan session end
```

The next command asks for your passkey again.

## Check it worked

```sh
tartan me show --json
tartan device list --org acme --json
```

`me show` names you, your organizations and your role in each. A computer that is new to the organization reads at once.
A change from it waits for an Admin to approve it as an admin device (`tartan admin-device approve`) when the
organization approves admin computers by hand or the join didn't approve it, and the refusal says so. When your
organization's SSO sign-in approves admin computers, it is approved already. A command that changes something shows what
it approves, and Windows asks for your passkey when it steps up.

Keep the CLI as new as your control. This compares the two, and `missing_here` lists what this CLI lacks:

```sh
tartan version --server --json
```

## Ask the CLI

```sh
tartan help --json
tartan device list --help
```

Add `--json` to a command and it answers `{ok, result, error, code}`.

## Next

- [Your first device](first-device.md)
- [Hand it to your AI](your-ai.md)
- [Reading the CLI's answers](cli-answers.md)
