diff --git a/dashboard/e2e/support.spec.ts b/dashboard/e2e/support.spec.ts index 1830f169..34cf27cc 100644 --- a/dashboard/e2e/support.spec.ts +++ b/dashboard/e2e/support.spec.ts @@ -395,3 +395,61 @@ test.describe("the platform admin's support queue", () => { await shot(page, "support-queue-phone"); }); }); + +// Settings, hosted only: "Move to your own AWS account" opens Contact us with +// the move preset and files a normal ticket. A person helps with the move. +test.describe("moving to your own AWS account", () => { + for (const vp of [ + { name: "desktop", width: 1440, height: 900 }, + { name: "phone", width: 390, height: 844 }, + ]) { + test(`the Settings card files a "Move to self-host" ticket with the answers (${vp.name})`, async ({ page }) => { + await page.setViewportSize({ width: vp.width, height: vp.height }); + const db = await mockApi(page); + await page.goto("/settings/"); + const card = page.getByTestId("move-to-selfhost"); + await expect(card).toContainText("Move to your own AWS account"); + await expect(card).toContainText("We'll help you plan the move and bring your settings and data over."); + await card.scrollIntoViewIfNeeded(); + await noSideScroll(page); + await card.screenshot({ path: path.join(SHOTS_DIR, `move-card-${vp.width}.png`) }); + await shot(page, `move-settings-${vp.width}`); + + await card.getByRole("link", { name: "Talk to us about moving" }).click(); + await expect(page).toHaveURL(/\/support\/?\?new=1&type=selfhost/); + await expect(page.getByRole("heading", { level: 1, name: "Move to your own AWS account" })).toBeVisible(); + await expect(page.getByLabel("Subject")).toHaveValue("Move to self-host"); + await page.getByLabel("Team size").selectOption("11 to 50 people"); + await page.getByLabel("AWS region").selectOption("eu-west-1"); + await page.getByLabel("Settings and instructions").check(); + await page.getByLabel("Knowledge and data sources").check(); + await noSideScroll(page); + await shot(page, `move-form-${vp.width}`); + + // Notes are optional for a move: the answers are the ticket. + await page.getByRole("button", { name: "Send to support" }).click(); + await expect(page).toHaveURL(/\/support\/ticket\/?\?id=/); + const post = db.posts.find((p) => p.path === "/api/support/tickets"); + expect(post?.body.subject).toBe("Move to self-host"); + expect(post?.body.body).toBe( + "**Topic:** Move to self-host\n**Team size:** 11 to 50 people\n**AWS region:** eu-west-1\n**What to bring over:** Settings and instructions, Knowledge and data sources", + ); + }); + } + + test("a self-hosted install never shows the card, and the move link is plain help there", async ({ page }) => { + await page.route((url) => url.pathname === "/runtime-config.js", (route) => + route.fulfill({ contentType: "text/javascript", body: `window.__CODERHELM_CONFIG__ = ${JSON.stringify({ selfHosted: true })};` }), + ); + await mockApi(page); + await page.goto("/settings/"); + await expect(page.getByRole("heading", { level: 1, name: "Settings" })).toBeVisible(); + await expect(page.getByRole("link", { name: /Notifications/ }).first()).toBeVisible(); + await expect(page.getByTestId("move-to-selfhost")).toHaveCount(0); + await expect(page.getByText("Move to your own AWS account")).toHaveCount(0); + + await page.goto("/support/?new=1&type=selfhost"); + await expect(page.getByRole("heading", { level: 1, name: "Get help" })).toBeVisible(); + await expect(page.getByTestId("move-form")).toHaveCount(0); + }); +}); diff --git a/dashboard/src/app/settings/page.tsx b/dashboard/src/app/settings/page.tsx index ceca9363..e75f69e7 100644 --- a/dashboard/src/app/settings/page.tsx +++ b/dashboard/src/app/settings/page.tsx @@ -7,7 +7,7 @@ import { useToast } from "@/components/toast"; import { Callout } from "@/components/callout"; import { StatusPill } from "@/components/status-pill"; import { Skeleton } from "@/components/skeleton"; -import { ChevronRightIcon } from "@/components/icons"; +import { ChevronRightIcon, CloudIcon } from "@/components/icons"; import { dangerButton, focusRing, inputClass, secondaryButton } from "@/components/ui"; import { Modal, modalActions } from "@/components/modal"; import { SETTINGS_GROUPS, type SettingsItem } from "@/components/settings-items"; @@ -85,6 +85,8 @@ export default function SettingsPage() { ))} + {me && !isSelfHosted() && } + {me && can(me, "reset") && } ); @@ -122,6 +124,32 @@ function SettingsRow({ item, readOnly, status }: { item: SettingsItem; readOnly: ); } +/** + * Hosted only: moving the team to its own AWS account starts as a support + * ticket. A person helps plan the move and bring settings and data over. + */ +function MoveToSelfHost() { + return ( + + + Hosting + + + + + + + Move to your own AWS account + Run Coderhelm in your own AWS account. We'll help you plan the move and bring your settings and data over. + + Talk to us about moving + + + + + ); +} + function DangerZone() { const [open, setOpen] = useState(false); const [confirmText, setConfirmText] = useState(""); diff --git a/dashboard/src/app/support/page.tsx b/dashboard/src/app/support/page.tsx index 777156b2..74dd50dd 100644 --- a/dashboard/src/app/support/page.tsx +++ b/dashboard/src/app/support/page.tsx @@ -21,6 +21,7 @@ import { Field } from "@/components/settings"; import { MarkdownEditor, clearDraft } from "@/components/markdown-editor"; import { Segmented } from "@/components/segmented"; import { buttonClass, focusRing, fullWidthOnPhone, primaryButton, secondaryButton } from "@/components/ui"; +import { isSelfHosted } from "@/lib/runtime-config"; import { List, ListEmpty, ListError, ListRow, ListSkeleton, ListToolbar, StatusText, useListParams } from "@/components/list"; const KINDS: SupportItemKind[] = ["run", "review", "release", "plan", "alert", "data_source"]; @@ -43,6 +44,32 @@ const BODY_TIPS = [ const NEW_TICKET_DRAFT = "support:new-ticket"; +// "Move to your own AWS account" (Settings, hosted only): a normal ticket +// whose subject names the topic and whose body carries these answers. A +// person helps with the move; nothing is copied automatically. +const MOVE_TOPIC = "Move to self-host"; +const TEAM_SIZES = ["1 to 10 people", "11 to 50 people", "51 to 200 people", "More than 200 people"]; +const AWS_REGIONS = ["us-east-1", "us-east-2", "us-west-2", "ca-central-1", "eu-west-1", "eu-west-2", "eu-central-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1"]; +const BRING_OVER = [ + "Settings and instructions", + "Repositories and their settings", + "Knowledge and data sources", + "Memory and what Coderhelm learned", + "Run and review history", + "People and roles", +]; + +/** The ticket body for a move: the answers first, then anything else they wrote. */ +function moveTicketBody(a: { size: string; region: string; bring: string[]; notes: string }): string { + const lines = [ + `**Topic:** ${MOVE_TOPIC}`, + `**Team size:** ${a.size || "Not given"}`, + `**AWS region:** ${a.region || "Not sure yet"}`, + `**What to bring over:** ${a.bring.length ? a.bring.join(", ") : "Not sure yet"}`, + ]; + return a.notes.trim() ? `${lines.join("\n")}\n\n${a.notes.trim()}` : lines.join("\n"); +} + export default function SupportPageWithParams() { return ( ([]); const [priority, setPriority] = useState("normal"); const [busy, setBusy] = useState(false); const [error, setError] = useState(""); @@ -253,10 +288,11 @@ function NewTicket() { }; const submit = async () => { - if (!subject.trim() || !body.trim() || busy) return; + if (!subject.trim() || (!isMove && !body.trim()) || busy) return; setBusy(true); setError(""); - const req: NewSupportTicket = { subject: subject.trim(), body: body.trim(), priority }; + const text = isMove ? moveTicketBody({ size, region, bring, notes: body }) : body.trim(); + const req: NewSupportTicket = { subject: subject.trim(), body: text, priority }; if (page) req.page = page; if (items.length > 0) req.items = items.map((i) => ({ kind: i.kind, id: i.id, label: i.label || undefined, repo: i.repo || undefined })); if (people.length > 0) req.people = people.map((p) => (p.outside ? { email: p.email } : { user_id: p.user_id })); @@ -293,7 +329,44 @@ function NewTicket() { placeholder={intro.placeholder} autoFocus /> - + {isMove && ( + + About your move + + setSize(e.target.value)}> + Choose one + {TEAM_SIZES.map((t) => ( + {t} + ))} + + setRegion(e.target.value)}> + Not sure yet + {AWS_REGIONS.map((r) => ( + {r} + ))} + + + + What to bring over + + {BRING_OVER.map((b) => ( + + + setBring((now) => (now.includes(b) ? now.filter((x) => x !== b) : [...now, b]))} + className="h-4 w-4 shrink-0 accent-emerald-500" + /> + {b} + + + ))} + + + + )} + {(ids) => ( void submit()} /> @@ -398,7 +471,7 @@ function NewTicket() { Cancel - + {busy ? "Sending…" : "Send to support"} diff --git a/docs/components/install/wizard.tsx b/docs/components/install/wizard.tsx index 5a1cc477..f35aea9b 100644 --- a/docs/components/install/wizard.tsx +++ b/docs/components/install/wizard.tsx @@ -12,6 +12,7 @@ // answers decide the screen. import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { MOVE_TO_SELF_HOST_URL } from '@/lib/shared'; import { type Check, type DnsRecord, @@ -531,6 +532,17 @@ function Toggle({ checked, onChange, title, help, testId }: { checked: boolean; ); } +/** One line for teams coming from the hosted service: a person helps them move. */ +function MovingNote({ className = '' }: { className?: string }) { + return ( + + Moving from CoderHelm cloud?{' '} + Talk to us{' '} + and we'll help move your data. + + ); +} + /** What will be created, where it will answer and what it costs, before anyone opens AWS. */ function Summary({ s, cost }: { s: InstallState; cost: { low: number; high: number; model: string } }) { const address = s.domainChoice === 'coderhelm' @@ -565,6 +577,7 @@ function Summary({ s, cost }: { s: InstallState; cost: { low: number; high: numb A small team's estimate; most of it scales with use. Not included: {cost.model.charAt(0).toLowerCase() + cost.model.slice(1)}. + ); } @@ -1551,6 +1564,7 @@ export function InstallWizard() { ))} + ); } diff --git a/docs/e2e/install.spec.ts b/docs/e2e/install.spec.ts index d2d5304c..df69e0fc 100644 --- a/docs/e2e/install.spec.ts +++ b/docs/e2e/install.spec.ts @@ -453,6 +453,10 @@ test('ready: the optional setup list, each with its check and one action', async await expect(list.locator('[data-optional="updates"]')).toHaveAttribute('data-state', 'done'); await expect(list.locator('[data-optional="backups"]')).toContainText('Done by the install'); await expect(page.getByTestId('optional-invite-action')).toHaveAttribute('href', `${INSTALL}/settings/people/`); + // Teams moving from the hosted service: a person helps, by email to support. + const moving = page.getByTestId('screen-ready').getByTestId('moving-note'); + await expect(moving).toHaveText("Moving from CoderHelm cloud? Talk to us and we'll help move your data."); + await expect(moving.getByRole('link', { name: 'Talk to us' })).toHaveAttribute('href', 'mailto:support@coderhelm.com?subject=Moving%20to%20self-hosted%20CoderHelm'); assertPrivate(m); }); @@ -634,6 +638,7 @@ test('hybrid: pick the setup, the name is checked as you type, and AWS opens wit await expect(page.getByTestId('name-picker-status')).toHaveText('Available: example-co.coderhelm.com is free. It’s claimed for you once your install answers.'); await expect(page.getByTestId('summary')).toContainText('example-co.coderhelm.com'); await expect(page.getByTestId('summary')).toContainText('CoderHelm’s app'); + await expect(page.getByTestId('summary').getByTestId('moving-note').getByRole('link', { name: 'Talk to us' })).toHaveAttribute('href', /^mailto:support@coderhelm\.com\?subject=Moving/); await page.getByLabel('Your email').fill('ada@example.com'); await page.getByTestId('launch').click(); await expect(page.getByTestId('step-title')).toHaveText('Waiting for AWS'); diff --git a/docs/lib/shared.ts b/docs/lib/shared.ts index 808288c2..4a4a69d5 100644 --- a/docs/lib/shared.ts +++ b/docs/lib/shared.ts @@ -23,6 +23,13 @@ export const gitConfig = { contentDir: 'docs/content/docs', }; +/** + * "Moving from CoderHelm cloud?": an email to support with the topic in the + * subject. A person helps with the move; there is no automatic migration tool. + * coderhelm.com's /self-host/ page uses the same address. + */ +export const MOVE_TO_SELF_HOST_URL = 'mailto:support@coderhelm.com?subject=Moving%20to%20self-hosted%20CoderHelm'; + /** The JSON Schema for plugin manifests, served at a stable URL. */ export const PLUGIN_SCHEMA_PATH = '/schema/plugin-manifest.v1.json'; diff --git a/src/content/site.ts b/src/content/site.ts index 209dba71..3f15e6e3 100644 --- a/src/content/site.ts +++ b/src/content/site.ts @@ -16,6 +16,11 @@ export const SITE = { docsUrl: "https://docs.coderhelm.com", installUrl: "https://docs.coderhelm.com/self-host/install/", email: "support@coderhelm.com", + // "Talk to us about moving": the site has no contact form, so moving from + // the hosted service to a self-hosted install starts as an email to support + // with the topic in the subject. A person answers; there is no automatic + // migration tool. + moveUrl: "mailto:support@coderhelm.com?subject=Moving%20to%20self-hosted%20CoderHelm", tagline: "Ship code, not tickets. The AI engineer that stays on the code after the pull request.", // The one sentence that defines the product, used word for word in the home // page, the meta description, JSON-LD and llms.txt. @@ -270,6 +275,10 @@ const home: Page = { type: "note", text: "The first public self-host release is not out yet. Until it is, you can read through the guide, but an install cannot finish.", }, + { + type: "p", + text: `Moving from CoderHelm cloud? [Talk to us](${SITE.moveUrl}) and we'll help move your settings and data.`, + }, { type: "shot", shot: "setup", caption: "The Setup page of a self hosted install: each check passing, or saying what is wrong and how to fix it. Example data." }, ], }, @@ -885,6 +894,20 @@ const selfHost: Page = { }, ], }, + { + id: "moving", + heading: "Moving from CoderHelm cloud?", + blocks: [ + { + type: "p", + text: "We'll help you plan the move and bring your settings and data over to your own AWS account. Tell us about your team and a person from CoderHelm will work through it with you.", + }, + { + type: "actions", + items: [{ label: "Talk to us about moving", href: SITE.moveUrl }], + }, + ], + }, { id: "after", heading: "It keeps checking itself",
Move to your own AWS account
Run Coderhelm in your own AWS account. We'll help you plan the move and bring your settings and data over.
What to bring over
+ Moving from CoderHelm cloud?{' '} + Talk to us{' '} + and we'll help move your data. +
A small team's estimate; most of it scales with use. Not included: {cost.model.charAt(0).toLowerCase() + cost.model.slice(1)}.