See how your app actually fits together. An interactive, plain-English map of your codebase, drawn by Claude or Codex.
JavaScript ai-codingarchitecture-diagramclaudeclaude-codeclaude-code-plugincodebase-visualizationcodexcodex-plugindeveloper-toolsonboardingopenaivibe-coding
Floorplan Cloud waitlist
Hayden Smithda2cbe119880
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0f7309a..52af21f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,10 @@# Changelog+## Unreleased++- **Floorplan Cloud waitlist:** once a map has been open for two minutes, a corner card asks, once, whether you'd like an email when Floorplan Cloud (shared, synced team maps) launches. Nothing is sent unless you click **Notify me**, and then only your email and "just me" or "with my team". **Use my Claude email** fills in your Claude account's address, and you see it before anything is sent. **Don't ask again**, or `FLOORPLAN_NO_PROMPTS=1`, turns it off. See [Privacy and security](docs/privacy-and-security.md#floorplan-cloud-waitlist).+- The waitlist service's code is in `services/waitlist/`: rate-limited per IP address and overall, write-only, and capped.+## 0.1.1 (2026-10-27)- **More connections found:** requests made through small helpers imported from an API client, like `post("/orders", …)` in a Python job, are now matched to the endpoints they reach.diff --git a/README.md b/README.mdindex bcf6401..3186736 100644--- a/README.md+++ b/README.md@@ -194,6 +194,7 @@ A `floorplan/` folder holding the map, plus a short section in `CLAUDE.local.md`- The scan, the map and its small local server all run on your computer. The server only accepts connections from your own machine.- Questions on the map go to your own Claude account, through the Claude Code CLI.- The Health check never stores or shows secret values, only where they are.+- No analytics or tracking. The map may ask once whether you'd like an email when Floorplan Cloud launches. Nothing is sent unless you sign up, and then only your email and "just me" or "with my team".More in [Privacy and security](docs/privacy-and-security.md).@@ -214,7 +215,7 @@ More in [Privacy and security](docs/privacy-and-security.md).<details><summary><b>Does my code leave my computer?</b></summary>-Only the way Claude Code always works: Claude reads the files it needs to describe your app, through your own account. The map itself is a local file and its server only listens on your machine. If you choose to open the map in the Claude app instead, Claude uploads the map (names, descriptions and structure, not your source code) to your private claude.ai account, and asks first.+Only the way Claude Code always works: Claude reads the files it needs to describe your app, through your own account. The map itself is a local file and its server only listens on your machine. If you choose to open the map in the Claude app instead, Claude uploads the map (names, descriptions and structure, not your source code) to your private claude.ai account, and asks first. The one thing Floorplan itself ever sends is your email, and only if you sign up for the [Floorplan Cloud waitlist](docs/privacy-and-security.md#floorplan-cloud-waitlist).</details><details>diff --git a/docs/development.md b/docs/development.mdindex 6a48385..6eb3683 100644--- a/docs/development.md+++ b/docs/development.md@@ -24,11 +24,12 @@ skills/floorplan/lib/ extraction, import resolution, route matching, Health, screens, helpersassets/viewer.html the map (template the build fills in)- ui/ viewer extensions: glossary, Health, recent work, screens, tour+ ui/ viewer extensions: glossary, Health, recent work, screens, tour, waitlist cardgraph-query.js shared map lookups (viewer, query.mjs, Ask instructions)serve.mjs copied into each project's floorplan/ folderquery-cli.mjs becomes floorplan/query.mjslogo.png, favicon.png+services/waitlist/ the opt-in Floorplan Cloud waitlist (Cloud Run → Google Sheet)docs/ these guides```diff --git a/docs/privacy-and-security.md b/docs/privacy-and-security.mdindex e7cebd6..2bf6203 100644--- a/docs/privacy-and-security.md+++ b/docs/privacy-and-security.md@@ -10,8 +10,9 @@| The map's server (`serve.mjs`) | your computer, listening on `127.0.0.1` only | nothing on its own || Asking questions (Claude Code CLI) | a `claude -p` session on your computer, with your account | your question, and the files Claude chooses to read || Asking questions (Claude app) | your claude.ai account | the map (names, descriptions, structure), never your source code. Claude asks before publishing it there |+| Floorplan Cloud waitlist (only if you sign up) | the map's server, to Floorplan's waitlist service | the email you typed or chose, and "just me" or "with my team". See [below](#floorplan-cloud-waitlist) |-Floorplan has no analytics or telemetry, and no servers of its own.+Floorplan has no analytics or telemetry. Its only server is the opt-in waitlist below, and nothing reaches it unless you sign up.To keep the map fully offline, put `elk.bundled.js` (elkjs 0.9.x) in `skills/floorplan/assets/vendor/`. The build then inlines it into the map instead of loading it from a CDN.@@ -22,6 +23,39 @@ To keep the map fully offline, put `elk.bundled.js` (elkjs 0.9.x) in `skills/flo- Questions run Claude with **read-only** tools: reading files, searching, and the map's own lookup script. It can't edit files or run other commands.- It stops by itself two hours after the last tab closes, and `node floorplan/serve.mjs --stop` stops it immediately.+## Floorplan Cloud waitlist++Once a map has been open for two minutes, a card in its bottom-left corner asks whether you'd like an email when **Floorplan Cloud** launches. It's a hosted version with one shared map per team, kept in sync with GitHub. It asks once:+- **Not now** asks again in two weeks.+- **Don't ask again** and signing up both stop it for good, in every project.++Nothing is sent unless you click **Notify me**.++**What's sent:** only the email address in the box, and whether you'd use Floorplan Cloud just yourself or with a team. Nothing about you, your project or your code goes with it.++**Use my Claude email:** this button fills the box with the email of the Claude account your Claude Code is signed in with. Claude Code is asked only at that moment, and you see the address before anything is sent. Nothing is read when you don't click it.++**Where it goes:**+- The map's local server sends it to a small service on Google Cloud Run. Its code is in [`services/waitlist/server.mjs`](../services/waitlist/server.mjs).+- That service adds a row to a private Google Sheet that only Floorplan's maker, [Hayden Smith](https://github.com/haydenschmitty), can see. The row holds the date, the email and your answer.++**What it's used for:** only to email you when Floorplan Cloud launches, and to gauge whether it's worth building. The list is never sold or shared. Every email on it will include a way to unsubscribe, and you can ask to be removed at any time by emailing [[email protected]](mailto:[email protected]).++**Your IP address** is used briefly to rate-limit sign-ups and is never written to the sheet. Google Cloud keeps its standard request logs, which include IP addresses, for 30 days.++**Turning it off:**+- Click **Don't ask again**, or+- set the environment variable `FLOORPLAN_NO_PROMPTS=1`.++Your answer is kept in `~/.floorplan/settings.json`.++**How the service is protected:** its address is in Floorplan's public code, so it's built to be harmless if abused.+- It only accepts new sign-ups, and never returns anything from the list.+- A repeat sign-up looks the same as a new one, so nobody can check whether an address is on the list.+- Input is checked strictly and saved as plain text.+- Sign-ups are limited per IP address and overall, and the list has a size cap.+- It runs as a single small instance, so a flood of requests can't run up costs.+## SecretsThe Health check looks for passwords, API keys and private keys in your code, and for `.env` files that would be committed. When it finds one, it records only the file, the line, the kind of secret, and a masked hint like "starts AKIA…, 20 characters". **Secret values are never stored in the map, printed, or sent anywhere**, and Claude is instructed never to repeat them.diff --git a/services/waitlist/README.md b/services/waitlist/README.mdnew file mode 100644index 0000000..a269b49--- /dev/null+++ b/services/waitlist/README.md@@ -0,0 +1,67 @@+# Floorplan Cloud waitlist service++A tiny service on Google Cloud Run that adds opt-in sign-ups from the map's corner card to a private Google Sheet. What users are told about it is in [Privacy and security](../../docs/privacy-and-security.md#floorplan-cloud-waitlist).++Its address ships in the plugin's public code, so it's built to be harmless when found.++| Protection | How |+|---|---|+| Write-only | Never returns anything from the sheet. A repeat sign-up gets the same reply as a new one, so nobody can check whether an address is listed. |+| Strict input | `POST /` only, a 1 KB body, `{ "email", "use": "solo" \| "team" }`. Values are written as plain text (`valueInputOption=RAW`), and emails must start with a letter or digit, so nothing becomes a formula. |+| Per-IP limit | `PER_IP_HOUR` requests per address per hour, valid or not (default 5). IPv6 is limited by /64. The address comes from the last `X-Forwarded-For` entry, the one Google's front end adds, so a client can't fake it. |+| Overall limits | `GLOBAL_MINUTE` (30) and `GLOBAL_DAY` (2000) sign-ups, and `MAX_ROWS` (20000) in total. |+| Cost cap | Deployed with `--max-instances 1`. That also keeps the limits exact, since they're kept in memory. |+| Least privilege | Runs as its own service account with no project roles. Its only access is editor on the one sheet. |+| No IPs stored | Addresses are held in memory for rate limiting and never written to the sheet. |++There are no dependencies: it needs Node 20+.++## Run it locally++```bash+DRY_RUN=1 PORT=8099 node services/waitlist/server.mjs+```++`DRY_RUN=1` logs sign-ups instead of writing them. To point a map's server at it:++```bash+FLOORPLAN_WAITLIST_URL=http://127.0.0.1:8099/ node floorplan/serve.mjs+```++## Deploy++Every command uses the `floorplan` gcloud configuration, so it never touches your other projects.++1. **Create a Google Sheet** and copy its ID from its URL (`/d/<ID>/edit`). The service adds the headings itself. Note the tab's name (`Sheet1` unless you rename it).+2. **Create a project and link billing.** Cloud Run needs billing, but this stays inside the free tier.+ ```bash+ gcloud projects create <PROJECT> --configuration floorplan+ gcloud billing projects link <PROJECT> --billing-account <BILLING_ACCOUNT> --configuration floorplan+ gcloud config set project <PROJECT> --configuration floorplan+ ```+3. **Turn on the APIs it needs:**+ ```bash+ gcloud services enable run.googleapis.com cloudbuild.googleapis.com artifactregistry.googleapis.com sheets.googleapis.com --configuration floorplan+ ```+4. **Create two service accounts.**+ - The service runs as one with no roles. Share the sheet with `waitlist@<PROJECT>.iam.gserviceaccount.com` as an **Editor**.+ - The other builds the container, with only the Cloud Run builder role, so the project's default account isn't widened.+ ```bash+ gcloud iam service-accounts create waitlist --display-name "Floorplan waitlist" --configuration floorplan+ gcloud iam service-accounts create waitlist-build --display-name "Floorplan waitlist builds" --configuration floorplan+ gcloud projects add-iam-policy-binding <PROJECT> --member serviceAccount:waitlist-build@<PROJECT>.iam.gserviceaccount.com --role roles/run.builder --condition=None --configuration floorplan+ ```+5. **Deploy:**+ ```bash+ gcloud run deploy waitlist --source services/waitlist --region us-central1 --allow-unauthenticated \+ --build-service-account projects/<PROJECT>/serviceAccounts/waitlist-build@<PROJECT>.iam.gserviceaccount.com \+ --service-account waitlist@<PROJECT>.iam.gserviceaccount.com \+ --max-instances 1 --concurrency 40 --cpu 1 --memory 256Mi --timeout 10 \+ --set-env-vars SHEET_ID=<SHEET_ID>,SHEET_TAB=<TAB> --configuration floorplan+ ```+ If making it public fails with "do not belong to a permitted customer", your Google Workspace organization's "Domain restricted sharing" policy is blocking public access. Turn off the invoker check for just this service:+ ```bash+ gcloud run services update waitlist --no-invoker-iam-check --region us-central1 --configuration floorplan+ ```+6. **Set a budget alert**, for example $5, under Billing → Budgets & alerts.+7. **Point the plugin at it:** put the service URL in `WAITLIST_URL` in [`serve.mjs`](../../skills/floorplan/assets/serve.mjs).diff --git a/services/waitlist/package.json b/services/waitlist/package.jsonnew file mode 100644index 0000000..f8866a8--- /dev/null+++ b/services/waitlist/package.json@@ -0,0 +1,9 @@+{+ "name": "floorplan-waitlist",+ "private": true,+ "description": "Opt-in Floorplan Cloud waitlist: adds sign-ups to a Google Sheet. Runs on Cloud Run.",+ "type": "module",+ "license": "MIT",+ "engines": { "node": ">=20" },+ "scripts": { "start": "node server.mjs" }+}diff --git a/services/waitlist/server.mjs b/services/waitlist/server.mjsnew file mode 100644index 0000000..1044937--- /dev/null+++ b/services/waitlist/server.mjs@@ -0,0 +1,126 @@+// Floorplan Cloud waitlist: a tiny Cloud Run service that adds opt-in sign-ups to a Google Sheet.+//+// Its address is in the plugin's public code, so it's built to be harmless when someone finds it:+// - write-only: it never returns anything from the sheet, and a repeat sign-up looks exactly like a new+// one, so nobody can check whether an address is on the list;+// - strict input: POST only, a 1 KB body, an email address and "solo" or "team", nothing else;+// values are written as plain text, never as formulas;+// - rate limits per IP address (IPv6 by /64) and overall, a cap on total rows, and short timeouts;+// - deployed with max-instances 1, so the limits hold across all requests and the cost can't run away.+// IP addresses are only held in memory for the rate limits, never written to the sheet.+//+// Zero dependencies: Node 20+. Talks to Google Sheets with the service's own identity, from the metadata+// server. DRY_RUN=1 logs sign-ups instead of writing them, for local testing.+import http from 'node:http';+import crypto from 'node:crypto';++const num = (v, d) => (Number(v) > 0 ? Number(v) : d);+const SHEET_ID = process.env.SHEET_ID || '';+const TAB = process.env.SHEET_TAB || 'Waitlist';+const DRY_RUN = process.env.DRY_RUN === '1';+const MAX_ROWS = num(process.env.MAX_ROWS, 20000);+const PER_IP_HOUR = num(process.env.PER_IP_HOUR, 5); // requests per IP per hour, valid or not+const GLOBAL_MINUTE = num(process.env.GLOBAL_MINUTE, 30); // sign-ups per minute, everyone together+const GLOBAL_DAY = num(process.env.GLOBAL_DAY, 2000); // sign-ups per day, everyone together+const EMAIL = /^[A-Za-z0-9][^\s@]{0,63}@[^\s@]+\.[^\s@]{2,}$/;++// ---------- rate limits ----------+const HOUR = 3600e3, MIN = 60e3, DAY = 86400e3;+const perIp = new Map(); // key -> timestamps in the last hour+const writes = []; // timestamps of sign-ups in the last day+function ipKey(req) {+ // Cloud Run appends the real client address last; anything before it was sent by the client+ const ip = String(req.headers['x-forwarded-for'] || req.socket.remoteAddress || '').split(',').pop().trim().replace(/^::ffff:/, '');+ if (!ip.includes(':')) return ip;+ // IPv6: one household or server usually has a whole /64, so limit by that+ const [head, tail = ''] = ip.split('::');+ const a = head ? head.split(':') : [], b = tail ? tail.split(':') : [];+ const full = [...a, ...Array(Math.max(0, 8 - a.length - b.length)).fill('0'), ...b];+ return full.slice(0, 4).join(':') + '::/64';+}+function allowIp(key, now) {+ const hits = (perIp.get(key) || []).filter((t) => now - t < HOUR);+ if (hits.length >= PER_IP_HOUR) { perIp.set(key, hits); return false; }+ hits.push(now); perIp.set(key, hits);+ return true;+}+function allowWrite(now) {+ while (writes.length && now - writes[0] > DAY) writes.shift();+ const lastMinute = writes.filter((t) => now - t < MIN).length;+ return lastMinute < GLOBAL_MINUTE && writes.length < GLOBAL_DAY;+}+// forget old addresses; if a flood fills memory anyway, start over rather than run out+setInterval(() => {+ const now = Date.now();+ for (const [k, v] of perIp) if (!v.some((t) => now - t < HOUR)) perIp.delete(k);+}, 5 * MIN).unref();+const trimIps = () => { if (perIp.size > 100000) perIp.clear(); };++// ---------- Google Sheets ----------+let token = null, tokenExp = 0;+async function accessToken() {+ if (token && Date.now() < tokenExp) return token;+ const r = await fetch('http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token?scopes=https://www.googleapis.com/auth/spreadsheets', { headers: { 'Metadata-Flavor': 'Google' }, signal: AbortSignal.timeout(5000) });+ if (!r.ok) throw new Error(`metadata token: ${r.status}`);+ const j = await r.json();+ token = j.access_token; tokenExp = Date.now() + (j.expires_in - 60) * 1000;+ return token;+}+async function sheets(method, range, suffix = '', body) {+ const url = `https://sheets.googleapis.com/v4/spreadsheets/${SHEET_ID}/values/${encodeURIComponent(range)}${suffix}`;+ const r = await fetch(url, { method, headers: { Authorization: `Bearer ${await accessToken()}`, 'Content-Type': 'application/json' }, body: body && JSON.stringify(body), signal: AbortSignal.timeout(8000) });+ if (!r.ok) throw new Error(`sheets ${method}: ${r.status} ${(await r.text()).slice(0, 200)}`);+ return r.json();+}++// who's already on the list, as hashes, so repeats don't add rows+const known = new Set();+let rows = 0;+const hash = (email) => crypto.createHash('sha256').update(email.toLowerCase()).digest('hex');+async function loadKnown() {+ if (DRY_RUN) return;+ const r = await sheets('GET', `${TAB}!B2:B`);+ for (const [e] of r.values || []) if (e) known.add(hash(e));+ rows = (r.values || []).length;+ // a brand-new sheet: add the headings+ if (!rows) await sheets('POST', `${TAB}!A1:C1`, ':append?valueInputOption=RAW', { values: [['Signed up', 'Email', 'How they would use it']] });+}+async function append(email, use) {+ const row = [new Date().toISOString(), email, use === 'team' ? 'With my team' : 'Just me'];+ if (DRY_RUN) { console.log('sign-up (dry run):', row[0], row[2]); return; }+ await sheets('POST', `${TAB}!A:C`, ':append?valueInputOption=RAW&insertDataOption=INSERT_ROWS', { values: [row] });+}++// ---------- http ----------+const reply = (res, status, data) => { res.writeHead(status, { 'Content-Type': 'application/json', 'Cache-Control': 'no-store' }); res.end(JSON.stringify(data)); };+const server = http.createServer((req, res) => {+ if (req.method !== 'POST' || new URL(req.url, 'http://x').pathname !== '/') return reply(res, 404, { ok: false, error: 'not_found' });+ const now = Date.now();+ trimIps();+ if (!allowIp(ipKey(req), now)) return reply(res, 429, { ok: false, error: 'rate_limited' });+ let raw = '';+ req.setEncoding('utf8');+ req.on('data', (d) => { raw += d; if (raw.length > 1024) { reply(res, 413, { ok: false, error: 'too_large' }); req.destroy(); } });+ req.on('end', async () => {+ if (res.writableEnded) return;+ let body = null; try { body = JSON.parse(raw); } catch {}+ const email = typeof body?.email === 'string' ? body.email.trim() : '';+ const use = body?.use === 'team' ? 'team' : body?.use === 'solo' ? 'solo' : null;+ if (!use || email.length > 254 || !EMAIL.test(email)) return reply(res, 400, { ok: false, error: 'bad_email' });+ const key = hash(email);+ if (known.has(key)) return reply(res, 200, { ok: true });+ if (!allowWrite(now) || rows >= MAX_ROWS) return reply(res, 429, { ok: false, error: 'rate_limited' });+ // claim it before the await, so two requests at once can't both add a row+ known.add(key); writes.push(now); rows++;+ try { await append(email, use); reply(res, 200, { ok: true }); }+ catch (e) { known.delete(key); rows--; console.error(e.message); reply(res, 503, { ok: false, error: 'unavailable' }); }+ });+});+server.requestTimeout = 10000;+server.headersTimeout = 5000;++if (!SHEET_ID && !DRY_RUN) { console.error('Set SHEET_ID (or DRY_RUN=1).'); process.exit(1); }+// read the list at start; if the sheet isn't reachable yet (not shared, wrong tab name), keep trying+const load = () => loadKnown().then(() => true, (e) => { console.error('couldn\'t read the sheet yet:', e.message); return false; });+if (!(await load())) { const retry = setInterval(async () => { if (await load()) clearInterval(retry); }, MIN); retry.unref(); }+server.listen(num(process.env.PORT, 8080), () => console.log(`waitlist listening on ${server.address().port}${DRY_RUN ? ' (dry run)' : ''}`));diff --git a/skills/floorplan/assets/serve.mjs b/skills/floorplan/assets/serve.mjsindex 1cf9ec7..2ad20a4 100644--- a/skills/floorplan/assets/serve.mjs+++ b/skills/floorplan/assets/serve.mjs@@ -68,6 +68,12 @@ function resolveClaude() {return null;}const claude = resolveClaude();+// Started from inside a Claude Code session? Don't let the CLI think it's nested in it.+function claudeEnv() {+ const env = { ...process.env };+ for (const k of Object.keys(env)) if (/^CLAUDE_?CODE_(SESSION|ENTRYPOINT|CHILD|MESSAGING|HOST|SDK)|^CLAUDECODE$/.test(k)) delete env[k];+ return env;+}let version = null;if (claude) { try { version = execFileSync(claude.cmd, [...claude.args, '--version'], { encoding: 'utf8', timeout: 15000, stdio: ['ignore', 'pipe', 'ignore'] }).trim(); } catch {} }@@ -106,6 +112,48 @@ if (idleExit) setInterval(() => { if (!tabs.size && !running.size && Date.now()const flowsFile = path.join(here, 'custom-flows.json');const readFlows = () => { try { return JSON.parse(fs.readFileSync(flowsFile, 'utf8')).flows || []; } catch { return []; } };+// ---------- Floorplan Cloud waitlist (opt-in) ----------+// The map may ask, once, whether you want an email when Floorplan Cloud launches. Nothing is sent unless+// you click "Notify me", and then only the email you see in the box and whether it's for you or a team.+// Where it goes: a Google Sheet, through the script in docs/waitlist/Code.gs. Your answer (joined, later,+// never) is kept in ~/.floorplan/settings.json so every project's map remembers it.+// FLOORPLAN_NO_PROMPTS=1 turns the question off.+const WAITLIST_URL = process.env.FLOORPLAN_WAITLIST_URL || 'https://floorplan-waitlist-690500262396.us-central1.run.app/';+const settingsFile = path.join(process.env.HOME || process.env.USERPROFILE || here, '.floorplan', 'settings.json');+const readSettings = () => { try { return JSON.parse(fs.readFileSync(settingsFile, 'utf8')); } catch { return {}; } };+function saveCloud(cloud) {+ try { fs.mkdirSync(path.dirname(settingsFile), { recursive: true }); fs.writeFileSync(settingsFile, JSON.stringify({ ...readSettings(), cloud }, null, 2) + '\n'); } catch {}+}+function cloudPrompt() {+ if (!WAITLIST_URL || /^(1|true|yes)$/i.test(process.env.FLOORPLAN_NO_PROMPTS || '')) return false;+ const c = readSettings().cloud || {};+ return !c.status || (c.status === 'later' && Date.now() > Date.parse(c.until || 0));+}+/** The email of the claude.ai account Claude Code is signed in with, or null (API key, Bedrock, not signed in). */+function claudeEmail() {+ if (!claude) return null;+ try {+ const out = execFileSync(claude.cmd, [...claude.args, 'auth', 'status', '--json'], { encoding: 'utf8', timeout: 15000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true, env: claudeEnv() });+ const email = JSON.parse(out).email;+ return typeof email === 'string' && EMAIL.test(email) ? email : null;+ } catch { return null; }+}+// starts with a letter or digit, so a spreadsheet never reads it as a formula+const EMAIL = /^[A-Za-z0-9][^\s@]{0,63}@[^\s@]+\.[^\s@]{2,}$/;+async function joinWaitlist(body) {+ const email = String(body.email || '').trim();+ const use = body.use === 'team' ? 'team' : 'solo';+ if (!WAITLIST_URL) return { ok: false, error: 'not_configured' };+ if (email.length > 254 || !EMAIL.test(email)) return { ok: false, error: 'bad_email' };+ try {+ const r = await fetch(WAITLIST_URL, { method: 'POST', headers: { 'Content-Type': 'text/plain' }, body: JSON.stringify({ email, use }), redirect: 'follow', signal: AbortSignal.timeout(20000) });+ const out = await r.json().catch(() => ({}));+ if (!r.ok || !out.ok) return { ok: false, error: out.error || 'send_failed' };+ } catch { return { ok: false, error: 'send_failed' }; }+ saveCloud({ status: 'joined', at: new Date().toISOString() });+ return { ok: true };+}+// ---------- asking ----------const nameFor = (id) => { try { return core.q.brief(id)?.name || id; } catch { return id; } };const running = new Map();@@ -143,10 +191,7 @@ function ask(req, res, body) {'--tools', 'Read,Grep,Glob,Bash', '--allowedTools', 'Bash(node floorplan/query.mjs:*)', 'Read', 'Grep', 'Glob'];if (body.session) args.push('--resume', String(body.session));if (model) args.push('--model', model);- // Started from inside a Claude Code session? Don't let the child think it's nested in it.- const env = { ...process.env };- for (const k of Object.keys(env)) if (/^CLAUDE_?CODE_(SESSION|ENTRYPOINT|CHILD|MESSAGING|HOST|SDK)|^CLAUDECODE$/.test(k)) delete env[k];- const child = spawn(claude.cmd, args, { cwd: root, env, stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });+ const child = spawn(claude.cmd, args, { cwd: root, env: claudeEnv(), stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });const id = crypto.randomBytes(6).toString('hex');running.set(id, child);send('start', { id });@@ -214,6 +259,26 @@ const server = http.createServer((req, res) => {return;}}+ if (url.pathname.startsWith('/api/cloud/')) {+ const json = (data) => { res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify(data)); };+ if (req.method === 'GET' && url.pathname === '/api/cloud/prompt') return json({ show: cloudPrompt() });+ if (req.method === 'POST') {+ let raw = '';+ req.on('data', (d) => { raw += d; if (raw.length > 2000) req.destroy(); });+ req.on('end', async () => {+ let body = {}; try { body = JSON.parse(raw); } catch {}+ // read only when the person clicks "Use my Claude email"+ if (url.pathname === '/api/cloud/claude-email') return json({ email: claudeEmail() });+ if (url.pathname === '/api/cloud/join') return json(await joinWaitlist(body));+ if (url.pathname === '/api/cloud/dismiss') {+ saveCloud(body.forever ? { status: 'never' } : { status: 'later', until: new Date(Date.now() + 14 * 864e5).toISOString() });+ return json({ ok: true });+ }+ res.writeHead(404); res.end();+ });+ return;+ }+ }if (req.method === 'POST' && url.pathname === '/api/cancel') { for (const c of running.values()) c.kill(); res.writeHead(204); return res.end(); }if (req.method === 'POST' && url.pathname === '/api/ask') {let raw = '';diff --git a/skills/floorplan/assets/ui/40-tour.js b/skills/floorplan/assets/ui/40-tour.jsindex 5924aa0..2520ae9 100644--- a/skills/floorplan/assets/ui/40-tour.js+++ b/skills/floorplan/assets/ui/40-tour.js@@ -167,5 +167,5 @@SC.on('ready', maybeAuto);if (SC.state.layout) maybeAuto();- window.FloorplanTour = { start, end };+ window.FloorplanTour = { start, end, active };})();diff --git a/skills/floorplan/assets/ui/50-cloud.js b/skills/floorplan/assets/ui/50-cloud.jsnew file mode 100644index 0000000..c2db8a5--- /dev/null+++ b/skills/floorplan/assets/ui/50-cloud.js@@ -0,0 +1,130 @@+// Floorplan Cloud waitlist: after the map has been open a couple of minutes, a corner card asks once+// whether you'd like an email when Floorplan Cloud launches. Nothing leaves your machine unless you+// click "Notify me", and then only the email in the box and "just me" or "with my team". Only shown+// when the map is served by serve.mjs, which keeps the answer in ~/.floorplan/settings.json.+(() => {+ const SC = window.Floorplan;+ const S = window.FLOORPLAN_SERVER;+ if (!SC || !S) return;+ const { h } = SC;+ const AFTER = 120; // seconds of the map being on screen+ const PRIVACY = 'https://github.com/haydenschmitty/floorplan/blob/main/docs/privacy-and-security.md#floorplan-cloud-waitlist';+ const api = (p, body) => fetch('/api/cloud/' + p, { method: body ? 'POST' : 'GET', headers: { 'content-type': 'application/json', 'x-floorplan-token': S.token }, ...(body ? { body: JSON.stringify(body) } : {}) }).then((r) => r.json());++ const style = document.createElement('style');+ style.textContent = `+ #cloud-card { position: fixed; left: 16px; bottom: 70px; width: 320px; z-index: 20; padding: 18px 18px 16px; border-radius: var(--r-panel);+ animation: sheetIn .45s var(--ease); transition: opacity .25s var(--ease); }+ #cloud-card.tucked { opacity: 0; pointer-events: none; }+ #cloud-card .cx { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; }+ #cloud-card .ce { font-size: 11.5px; font-weight: 600; color: var(--recent); letter-spacing: .02em; }+ #cloud-card h3 { margin: 4px 0 0; font-size: 16px; font-weight: 600; color: var(--text); padding-right: 24px; }+ #cloud-card p { margin: 8px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.55; }+ #cloud-card .ca { display: flex; gap: 6px; margin-top: 14px; align-items: center; flex-wrap: wrap; }+ #cloud-card .ca .btn { height: 32px; font-size: 13px; }+ #cloud-card .cl { background: none; border: 0; padding: 0; color: var(--text-3); font: inherit; font-size: 12px; cursor: pointer; margin-left: auto; }+ #cloud-card .cl:hover { color: var(--text-2); }+ #cloud-card .co { display: grid; gap: 6px; margin-top: 12px; }+ #cloud-card .co button { text-align: left; border: 0; border-radius: 14px; padding: 10px 12px; background: rgba(255, 255, 255, .05); color: var(--text); cursor: pointer; font: inherit; transition: background .2s var(--ease); }+ #cloud-card .co button:hover { background: rgba(255, 255, 255, .1); }+ #cloud-card .co b { display: block; font-size: 13.5px; font-weight: 500; }+ #cloud-card .co span { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }+ #cloud-card input { width: 100%; box-sizing: border-box; margin-top: 12px; height: 38px; padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--hair-2);+ background: rgba(0, 0, 0, .25); color: var(--text); font: inherit; font-size: 13.5px; outline: none; }+ #cloud-card input:focus { border-color: rgba(255, 255, 255, .3); }+ #cloud-card .cm { margin-top: 8px; font-size: 12px; color: var(--text-3); min-height: 0; }+ #cloud-card .cm.err { color: #f28b8b; }+ #cloud-card .cf { margin-top: 12px; font-size: 11.5px; line-height: 1.5; color: var(--text-3); }+ #cloud-card .cf a { color: var(--text-2); }+ `;+ document.head.appendChild(style);++ let card = null;+ const answer = { use: null };+ const close = () => { card?.remove(); card = null; };+ const later = () => { api('dismiss', { forever: false }).catch(() => {}); close(); };+ const never = () => { api('dismiss', { forever: true }).catch(() => {}); close(); };++ function view(html, bind) {+ card.innerHTML = `<button class="btn icon cx" data-x title="Close">${SC.iconI('x')}</button>${html}`;+ card.querySelector('[data-x]').onclick = card.dataset.done ? close : later;+ bind?.(card);+ }++ function pitch() {+ view(`<div class="ce">Coming soon</div><h3>Floorplan Cloud</h3>+ <p>One shared map for your whole team: notes everyone can see, kept in sync with GitHub and updated on every push.</p>+ <p>Want an email when it launches?</p>+ <div class="ca"><button class="btn primary" data-yes>Let me know</button><button class="btn soft" data-later>Not now</button><button class="cl" data-never>Don't ask again</button></div>`,+ (el) => { el.querySelector('[data-yes]').onclick = use; el.querySelector('[data-later]').onclick = later; el.querySelector('[data-never]').onclick = never; });+ }++ function use() {+ view(`<div class="ce">Floorplan Cloud</div><h3>How would you use it?</h3>+ <div class="co"><button data-use="solo"><b>Just me</b><span>A map of my own projects</span></button><button data-use="team"><b>With my team</b><span>One shared map we all work from</span></button></div>`,+ (el) => el.querySelectorAll('[data-use]').forEach((b) => b.onclick = () => { answer.use = b.dataset.use; email(); }));+ }++ function email() {+ view(`<div class="ce">Floorplan Cloud</div><h3>Where should we email you?</h3>+ <input type="email" placeholder="[email protected]" autocomplete="email" spellcheck="false" maxlength="254">+ <div class="cm"></div>+ <div class="ca"><button class="btn primary" data-send>Notify me</button>${S.cli ? '<button class="btn soft" data-claude>Use my Claude email</button>' : ''}</div>+ <div class="cf">Only this email and your answer (${answer.use === 'team' ? 'with my team' : 'just me'}) are sent, to a private Google Sheet kept by Floorplan's maker. It's used only to tell you when Floorplan Cloud launches. <a href="${PRIVACY}" target="_blank" rel="noopener">Details</a></div>`,+ (el) => {+ const input = el.querySelector('input'), msg = el.querySelector('.cm'), send = el.querySelector('[data-send]');+ const say = (t, err) => { msg.textContent = t || ''; msg.classList.toggle('err', !!err); };+ const mine = el.querySelector('[data-claude]');+ if (mine) mine.onclick = async () => {+ mine.disabled = true; say('Looking up your Claude Code account…');+ try {+ const r = await api('claude-email', {});+ if (r.email) { input.value = r.email; say(''); input.focus(); } else say('Claude Code isn\'t signed in with a Claude account here. Type an email instead.');+ } catch { say('Couldn\'t ask Claude Code. Type an email instead.'); }+ mine.disabled = false;+ };+ const submit = async () => {+ const v = input.value.trim();+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(v)) { say('That doesn\'t look like an email address.', true); input.focus(); return; }+ send.disabled = true; say('Sending…');+ try {+ const r = await api('join', { email: v, use: answer.use });+ if (r.ok) return done(v);+ say(r.error === 'bad_email' ? 'That doesn\'t look like an email address.' : r.error === 'rate_limited' ? 'Too many sign-ups right now. Try again in a little while.' : 'Couldn\'t send that. Check your connection and try again.', true);+ } catch { say('Couldn\'t send that. Check your connection and try again.', true); }+ send.disabled = false;+ };+ send.onclick = submit;+ input.onkeydown = (ev) => { ev.stopPropagation(); if (ev.key === 'Enter') submit(); };+ input.focus();+ });+ }++ function done(v) {+ card.dataset.done = '1';+ view(`<div class="ce">Floorplan Cloud</div><h3>You're on the list</h3><p>We'll email <b>${h(v)}</b> when Floorplan Cloud launches. Thanks!</p>`);+ setTimeout(close, 8000);+ }++ // busy with something else? wait: a tour, a flow, a question, a dialog or search+ const busy = () => window.FloorplanTour?.active?.() || SC.state.flow || document.querySelector('#ask .stop, #modal.open, #palette.open');+ let seen = 0, asked = false;+ const timer = setInterval(async () => {+ if (card) { card.classList.toggle('tucked', !!(document.querySelector('#ask-sheet') && !document.querySelector('#ask-sheet').hidden)); return; }+ if (asked || document.visibilityState !== 'visible' || ++seen < AFTER || busy()) return;+ asked = true;+ // another tab may have answered in the meantime+ const ok = await api('prompt').then((r) => r.show).catch(() => false);+ if (!ok || card) { clearInterval(timer); return; }+ card = document.createElement('div');+ card.id = 'cloud-card'; card.className = 'glass';+ card.addEventListener('keydown', (ev) => ev.stopPropagation());+ document.body.appendChild(card);+ pitch();+ }, 1000);+ // nothing to ask (already answered, or turned off): stop counting+ api('prompt').then((r) => { if (!r.show) clearInterval(timer); }).catch(() => clearInterval(timer));++ // for testing and demos: ask now instead of after two minutes+ window.FloorplanCloud = { show: () => { seen = AFTER; } };+})();