# Set up Gin

You are a coding agent. Your person pasted a prompt with a one-time code like `GIN-XXXX-XXXX`. Gin (trygin.ai) turns
what they ship into posts for LinkedIn, X and other channels; they swipe right in the Gin app to publish. You set it up
here with the Gin CLI. Do the steps in order and end with the report in step 6.

Use the code only in the two commands below. Don't write it to a file and don't repeat it back. The CLI masks it.

## 1. Check whose account the code belongs to

Run this in the project's repo, with your person's code in place of `<CODE>`:

```sh
npx -y @winding-labs/gin@1 setup --code <CODE>
```

It doesn't use the code up. It prints the account and workspace (like `j***@acme.com (Acme)`) and stops. Ask your
person, in these words: "This connects Gin on this computer to <account> (<workspace>). Is this your account?" Go on
only after a clear yes. If they say no, or didn't get the code from trygin.ai themselves, stop and tell them not to use
it.

## 2. Install Gin, the plugin and the hooks

After the yes, run the same command with `--yes`:

```sh
npx -y @winding-labs/gin@1 setup --code <CODE> --yes
```

This one command does steps 2 to 5. It trades the code for two keys (one for the CLI, a send-only one for the hooks) and
keeps them in the OS keychain. It installs the CLI to `~/.gin/bin/gin` and Gin's plugin for Claude Code and Codex: a
skill, the `gin` MCP server, and a hook that sends each session's summary, commit subjects and PR links when it ends
(never diffs, never secrets). For Cursor it prints the config to add: add it for your person.

## 3. Products

The CLI reads the repo (package.json homepage, README, app configs, store links, CNAME, Worker routes) and adds each
product it's sure of, or matches one already in Gin, and links this repo to it. It lists unsure links as "Maybe also".
Ask your person about those and anything it missed, and add the right ones:

```sh
~/.gin/bin/gin products add https://docs.example.com
```

## 4. Channels

The CLI prints the channels Gin suggests and a one-time connect link for LinkedIn and for X (10 minutes each). Give
your person both links, as links. They open them while signed in to Gin and sign in to each network. You can't finish
that for them. For Bluesky or Dev.to, ask for an app password or API key and run
`~/.gin/bin/gin connect bluesky --handle <handle> --key <key>`.

## 5. Proof

The CLI sends a test message, "Gin setup check from <your agent>". It shows in Incoming in the Gin app and the
checklist on their setup page turns green. To check again later: `~/.gin/bin/gin verify`.

## 6. Report back with exactly this

```
Gin: ready | needs you (say what) | blocked (say why, and the fix)
Account: <account> (<workspace>)
Products: <each product, and whether this repo is linked>
Hooks: <each agent and whether its plugin is on>
Next: <the connect links to open, if any>; posts show up in the Gin app to swipe
```

The CLI's last line is the status: `Gin: ready`, `Gin: needs you. …` or `Gin: blocked. … Fix: …`. Use it.

## If something fails

- The code is used or expired: ask your person for a new one at https://trygin.ai/app/agents. Don't retry the old one.
- No network in your sandbox: ask your person to allow trygin.ai, or give them the step 2 command to run.
- `npx` missing: they need Node 20 or newer (https://nodejs.org).
- Codex: plugin hooks run only once trusted. Tell your person to open Codex, type `/hooks` and trust the Gin hook.
- The new hooks and MCP tools load in new sessions. Tell your person to restart their agent.

## Rules

- Never approve, publish, schedule, turn on autopilot, start a boost or touch billing. Gin's API refuses agent keys for
  those; only your person does them, in the app.
- Don't change the project's files. Gin writes only to `~/.gin`, `~/.config/gin`, the keychain and each agent's plugin
  settings.
- Tell your person in one line that Gin receives a short summary of each coding session in this repo (no code), and
  that they can revoke this computer's key on the Agents page.
