# Move a ChatGPT Sites site to Hettie (guide for AI agents)

You are an AI agent (Codex, Claude Code or similar) moving a site built with ChatGPT Sites onto Hettie. Follow these steps in order. Do not skip the check in step 6. Never change the owner's DNS.

## Rules
- Keep the design, text, images and URLs the same. Do not add features.
- Hettie sites are Astro. Pages are static; only the blog renders on request.
- `/forms/*` and `/_hettie/*` are reserved paths.
- Run every Hettie command with `npx hettie`. Add `--json` when you need to read the output.

## 1. Read the old site
- The current folder is the ChatGPT Sites project (a Git repo). Run `git log -1` and list the files.
- Write down: every page and its URL, every form (fields, where it posts), every image or file, and any data the site stores (D1 tables, R2 files).

## 2. Start a Hettie site next to it
- `npx hettie new hettie-site` creates an Astro project from the Hettie template.
- Read `hettie-site/CLAUDE.md` and follow it. If your tool reads AGENTS.md, copy it: `cp hettie-site/CLAUDE.md hettie-site/AGENTS.md`.

## 3. Rebuild the pages
- Recreate each page in `hettie-site/src/pages/` with the same path (`/about` becomes `src/pages/about.astro`).
- Move shared layout to `src/layouts/Base.astro`, styles to Tailwind or `src/styles/global.css`.
- Server code (API routes, D1 queries) does not move. Replace it with static pages or Hettie features (forms, posts). If something cannot be replaced, stop and tell the owner.
- Old URLs that change: add lines to `public/_redirects` (`/old /new 301`).

## 4. Forms become Hettie leads
- Each form: `<form method="post" action="/forms/<name>">`. Name: lowercase letters, numbers, dashes (for example `contact`, `order`).
- Keep the old field names. Keep the hidden honeypot `<input type="text" name="_hp" hidden tabindex="-1" autocomplete="off">`.
- Optional `<input type="hidden" name="_redirect" value="/thanks">`. The visitor returns with `?sent=1`; show a thank you message for it.
- Buttons or links that count as leads (call, WhatsApp, book): add `data-hettie-lead="<name>"`.
- Old submissions stored in ChatGPT Sites cannot be imported yet. Export them to `old-leads.csv` and tell the owner where it is.

## 5. Images and files
- Upload each file: `for f in public-old/*; do npx hettie media upload "$f"; done` (one file per call).
- Reference them as `/_hettie/media/<name>`. Small icons and the favicon can stay in `public/`.
- Blog posts, if any: one Markdown file each, then `npx hettie posts new post.md`. They arrive as drafts; the owner presses Publish.

## 6. Check locally
- `npx hettie dev` and open every page. Compare with the live site. Fix differences before going on.

## 7. Publish a test version
- In `hettie-site`: `npx hettie publish --site <site> --message "Moved from ChatGPT Sites"` (`<site>` = site name from the prompt).
- The first Hettie command asks the owner to sign in: show them the code and link it prints. In a cloud sandbox without a browser, ask the owner for a key and set `HETTIE_KEY`.
- Output: `Version N of <site> is live at https://<site>.xtwelve.io`.

## 8. Hand over
Tell the owner, in a short message:
- The test link, and that the old site is still live.
- What you could not move (old leads file, server features).
- To go live: in Hettie, Domain, add `www.<domain>` (or run `npx hettie domain add www.<domain>`), then add the CNAME to `sites.xtwelve.io` and the TXT records it shows at their registrar. Check with `npx hettie domain status`.
Do not change DNS yourself.
