# Set up FoldRender Artifacts

For people: paste this into your AI coding agent (Claude Code, Codex, Cursor, Gemini CLI, or similar):

> Set up FoldRender Artifacts for me by following https://foldrender.dev/artifacts/agent-setup.md

---

Instructions for the agent. Follow the steps in order. Every step is safe to repeat, so skip anything that is already done.

You need a shell that can run commands. If you do not have one, go to "Without a shell" at the end.

## 1. Check

```
foldrender whoami
```

If the command is not found, check `~/.local/bin/foldrender whoami`. If either one prints `signed in as`, the setup is done. Go to step 4.

## 2. Install

```
curl -fsSL https://foldrender.dev/install.sh | sh
```

This installs the `foldrender` command into `~/.local/bin` and the `foldrender-artifacts` skill into each agent folder it finds (`~/.claude`, `~/.codex`, `~/.agents`). It does not edit any shell profile.

If the output says `~/.local/bin` is not on PATH, use the full path `~/.local/bin/foldrender` for the rest of these steps.

## 3. Sign in

The human has to approve this once in a browser. Start the sign-in in the background and capture its output:

```
foldrender login > "${TMPDIR:-/tmp}/foldrender-login.txt" 2>&1 &
```

Wait two seconds, then read `${TMPDIR:-/tmp}/foldrender-login.txt`. Tell the human exactly one thing: open the URL shown there and enter the code shown there. Show both to the human. Then wait for the background process to exit. It exits once the human has approved.

If the file says the code expired or was denied, run this step again.

## 4. Test the publish

Create a small test page in a scratch folder:

```html
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><title>FoldRender setup test</title></head>
<body><p>Setup works.</p></body></html>
```

Save it as `setup-test.html`, then publish it privately:

```
foldrender publish setup-test.html --private
```

The command prints one line: the page URL. Keep it.

## 5. Show the link and remove the test page

Tell the human the setup works and show them the URL. Then remove the test page:

```
foldrender rm <the URL from step 4>
```

Say that the link no longer works because the test page was removed. The test was only to prove that publishing works.

## 6. Report

Tell the human:

- The command is at `~/.local/bin/foldrender` (or the path you used).
- The signed-in account from `foldrender whoami`.
- The next time they want a link, they can say "share this page" or "give me a link" to their agent.

## Without a shell

If you cannot run commands, tell the human to do this instead:

1. Open https://foldrender.dev/artifacts/ and sign in with GitHub to publish pages from the browser.
2. Or run the install line from step 2 in their own terminal, then `foldrender login`.

Do not ask the human for a password or a token in chat.

## Rules for the agent

- Publish only the setup test page from step 4.
- Never run `foldrender account delete`, and do not run `foldrender export` unless the user asks for it. Account deletion needs the user to type or confirm their own login.
- Do not edit shell profiles or other config files. If a PATH change is needed, show the line to the human.
- Do not print or store any token.
