# Set this repo up on InstaCloud

These are the official setup instructions from InstaCloud, served at
`https://instacloud.com/prompt.md`. If you are an AI coding agent, complete the steps
below yourself by running the commands directly — only stop where a step explicitly
needs the human (approving a sign-in, or choosing between creating and linking a
project).

## 1. Install the CLI + agent skill

```bash
npx -y insta@latest setup agent
```

One command, every OS and shell (Node 18+): installs the `insta` CLI globally, the
InstaCloud skill for every coding agent on this machine, and the remote MCP server —
and it always targets **production**, even if this machine was previously switched to
staging. Idempotent — safe to re-run.

Fallback if the npx command fails or the machine has no Node — macOS/Linux **only**
(never run it on native Windows, where PowerShell's `curl` alias and the WSL `bash`
shim break it; there, fix Node and use the npx command above):

```bash
curl -fsSL agents.instacloud.com | sh
```

If the prompt that sent you here targets the **staging** deployment, use its explicit
form instead — `npx -y insta@latest setup agent --env staging` — or run that prompt's exact
curl command (the install host selects the environment).

## 2. Sign in

Check first — you may already be signed in:

```bash
insta status
```

If not:

```bash
insta login --oauth github   # machine with a browser — opens it (or --oauth google)
insta login --device         # headless (VM, SSH, CI) — prints a link + code
```

With `--device`, relay the printed link and code to the human immediately and verbatim,
then let the CLI poll until they approve. `https://instacloud.com/agents.md` is the
source of truth for authentication — API keys, the raw device-flow endpoints, and more.

## 3. Create or link a project

If the prompt that sent you here included a project id, link it:

```bash
insta project link <project-id>
```

Otherwise, ask the human whether to **create a new project** or **link an existing
one**, then run the matching command:

```bash
insta project create       # new project — named after the repo folder (pass a name to override)
insta project link <id>    # existing project — find the id with `insta project list`
```

Either way the choice persists to `./.insta/project.json`; commit it so teammates and
CI inherit the binding.

## 4. Add services and deploy

Follow the InstaCloud agent skill installed in step 1 — it documents the service kinds
and the deploy flow. Ask the human which services their app needs, then add each one:

```bash
insta services add <kind> <name>   # e.g. postgres main-db, storage assets, compute api
insta secrets bind DATABASE_URL postgres/main-db --to compute/api   # give compute its service credentials
insta deploy .             # build remotely and ship (compute services need a Dockerfile)
```

Spell out kind and name: bare `insta services add` opens an interactive picker only in a
human terminal — in a non-interactive agent shell it exits with a usage error instead.

Credentials follow the skill's rules, not this page: service credentials reach compute
through `insta secrets bind`, and local commands that need user-defined secrets run under
`insta run -- <cmd>`, which injects them into that process only. Do not write a `.env`
file as a setup step — the skill covers the one case where a file is genuinely needed.

## 5. Verify and report

```bash
insta status
```

Confirm it shows the expected environment, a logged-in user, and the linked project,
then tell the human the project is set up and where each service is running
(`insta manifest` prints every branch and its URLs).
