Skip to content
refs
422 lines · 20.5 KBRaw
1import {
2 ArrowRightIcon,
3 CheckCircleIcon,
4 CheckIcon,
5 CircleDashedIcon,
6 CompassIcon,
7 GitBranchIcon,
8 CopyIcon,
9 TreeStructureIcon,
10} from "@refs/design-system/icons";
11import { Avatar, Badge, Button, CodeGlobe, LineDiagram, LinkButton, SwapIcon, ThemeMenu, Wordmark, type LineStation } from "@refs/design-system";
12import { useEffect, useRef, useState } from "react";
13import { AgentLanes, ApproveLoop, BranchLoop, ChallengeLoop, DecisionFold, PushRoute } from "./landing-scenes";
14
15const AGENT = "@agent/7c1e";
16const INSTALL_PARTS = ["curl -fsSL", "https://useref.dev/install | sh"] as const;
17const MCP = "https://useref.dev/mcp";
18
19function Mention({ id = AGENT }: { id?: string }) {
20 return <span className="agent-mention shrink-0">{id}</span>;
21}
22
23function Sha({ value }: { value: string }) {
24 return <span className="font-mono text-xs text-muted">{value}</span>;
25}
26
27const FANOUT_STEPS = [
28 { label: "Merge", planned: false },
29 { label: "Notify", planned: true },
30 { label: "Rebase", planned: false },
31 { label: "Respect decisions", planned: false },
32] as const;
33
34const FANOUT_AGENTS = [
35 { id: "@agent/7c1e", client: "Claude Code", branch: "retry-webhooks", merger: true },
36 { id: "@agent/9b3d", client: "Codex", branch: "queue-isolation", merger: false },
37 { id: "@agent/2f8a", client: "OpenCode", branch: "delivery-logs", merger: false },
38] as const;
39
40function useFanoutPhase() {
41 const [phase, setPhase] = useState(0);
42 const [playing, setPlaying] = useState(false);
43 const root = useRef<HTMLDivElement>(null);
44 useEffect(() => {
45 if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
46 setPhase(FANOUT_STEPS.length);
47 return;
48 }
49 const observer = new IntersectionObserver(([entry]) => {
50 if (entry?.isIntersecting) {
51 setPlaying(true);
52 observer.disconnect();
53 }
54 }, { rootMargin: "0px 0px -30% 0px" });
55 if (root.current) observer.observe(root.current);
56 return () => observer.disconnect();
57 }, []);
58 useEffect(() => {
59 if (!playing) return;
60 if (phase >= FANOUT_STEPS.length) {
61 setPlaying(false);
62 return;
63 }
64 const timer = setTimeout(() => setPhase((current) => current + 1), phase === 0 ? 400 : 1600);
65 return () => clearTimeout(timer);
66 }, [playing, phase]);
67 const replay = () => {
68 setPhase(0);
69 setPlaying(true);
70 };
71 const jump = (step: number) => {
72 setPlaying(false);
73 setPhase(step);
74 };
75 return { root, phase, playing, replay, jump };
76}
77
78function FanoutAgent({ agent, phase }: { agent: (typeof FANOUT_AGENTS)[number]; phase: number }) {
79 return (
80 <div className={`landing-fanout-card flex min-w-0 flex-col gap-3 rounded-panel bg-raised p-4 shadow-card ${!agent.merger && phase === 2 ? "is-pinged" : ""}`}>
81 <span className="flex flex-wrap items-center gap-2 text-sm">
82 <Mention id={agent.id} />
83 <span className="text-xs text-muted">{agent.client}</span>
84 <span className="ml-auto font-mono text-xs text-muted">{agent.branch}</span>
85 </span>
86 {agent.merger ? (
87 phase >= 1 ? (
88 <span key="merged" className="landing-fanout-in flex flex-wrap items-center gap-2 text-sm">
89 <Badge variant="purple">Merged</Badge>
90 <span>#42 into <span className="font-mono text-xs">main</span></span>
91 </span>
92 ) : (
93 <span className="flex items-center gap-2 text-sm"><Badge variant="success">Working</Badge> Key queues by customer ID.</span>
94 )
95 ) : (
96 <div className="flex flex-col gap-2 text-sm">
97 {phase < 2 && <span className="flex items-center gap-2"><Badge variant="success">Working</Badge><span className="text-muted">on {agent.branch}</span></span>}
98 {phase >= 2 && (
99 <div key="update" className="landing-fanout-in flex flex-col gap-1 rounded-control bg-sunken px-3 py-2 shadow-[inset_0_0_0_1px_var(--hairline)]">
100 <span className="flex items-center gap-2 font-mono text-xs text-muted">[refs] Updates <Badge variant="outline">Planned</Badge></span>
101 <span>@agent/7c1e pushed <span className="font-mono text-xs">main</span> → <Sha value="4d2a9e1" /></span>
102 </div>
103 )}
104 {phase >= 3 && (
105 <code key="rebase" className="landing-fanout-in flex flex-col gap-0.5 rounded-control bg-sunken px-3 py-2 font-mono text-xs">
106 <span><span className="text-muted select-none">$ </span>git pull --rebase</span>
107 <span className="flex items-center gap-1.5 text-success"><CheckIcon size={12} /> rebased onto 4d2a9e1</span>
108 </code>
109 )}
110 {phase >= 4 && (
111 <span key="respect" className="landing-fanout-in flex items-start gap-2">
112 <TreeStructureIcon className="mt-0.5 shrink-0 text-success" />
113 <span><span className="text-muted">Constraint:</span> Key queues by customer ID.</span>
114 </span>
115 )}
116 </div>
117 )}
118 </div>
119 );
120}
121
122function MergeFanout() {
123 const { root, phase, replay, jump, playing } = useFanoutPhase();
124 return (
125 <div ref={root} className="overflow-hidden rounded-sheet bg-panel shadow-card">
126 <div className="flex flex-wrap items-center gap-x-4 gap-y-2 bg-rail px-4 py-3 shadow-[inset_0_-1px_0_var(--hairline)]">
127 <span className="flex items-center gap-2 text-sm font-medium">
128 <GitBranchIcon className="text-porcelain" /> acme / webhooks
129 <span className="font-normal text-muted">· 3 agents</span>
130 </span>
131 <ol className="m-0 flex list-none flex-wrap items-center gap-1 p-0" aria-label="Steps">
132 {FANOUT_STEPS.map((step, index) => {
133 const at = phase === index + 1;
134 const done = phase > index;
135 return (
136 <li key={step.label}>
137 <button type="button" onClick={() => jump(index + 1)} aria-current={at ? "step" : undefined} className={`flex cursor-pointer items-center gap-1.5 rounded-control px-3 py-1 text-sm transition-colors duration-150 ${at ? "bg-hover font-medium text-ink" : done ? "text-ink hover:bg-hover" : "text-muted hover:bg-hover"}`}>
138 <SwapIcon active={done} on={<CheckCircleIcon weight="fill" className="text-success" />} off={<CircleDashedIcon />} />
139 {step.label}
140 {step.planned && <Badge variant="outline">Planned</Badge>}
141 </button>
142 </li>
143 );
144 })}
145 </ol>
146 <Button type="button" variant="ghost" size="sm" className="ml-auto" disabled={playing} onClick={replay}>Replay</Button>
147 </div>
148 <div className="p-4 sm:p-6">
149 <div className="relative flex items-center gap-3 rounded-control bg-sunken px-4 py-3">
150 <GitBranchIcon className="shrink-0 text-porcelain" />
151 <span className="font-mono text-sm font-medium">main</span>
152 <span aria-hidden="true" className="h-0.5 flex-1 bg-porcelain/60" />
153 {phase >= 1 ? (
154 <span key="commit" className="landing-fanout-in flex min-w-0 items-center gap-2 text-sm">
155 <span className="landing-fanout-node size-3 shrink-0 rounded-full bg-sunken shadow-[inset_0_0_0_2px_var(--porcelain)]" />
156 <Sha value="4d2a9e1" />
157 <span className="truncate max-sm:hidden">Key queues by customer ID.</span>
158 </span>
159 ) : (
160 <span className="text-sm text-muted">Waiting for a merge</span>
161 )}
162 </div>
163 <div className="grid grid-cols-3 max-md:hidden" aria-hidden="true">
164 {FANOUT_AGENTS.map((agent) => (
165 <div key={agent.id} className="relative mx-auto h-10 w-px bg-ochre/70">
166 {agent.merger && phase === 1 && <span className="landing-fanout-up absolute left-1/2 size-2 -translate-x-1/2 rounded-full bg-ochre" />}
167 {!agent.merger && phase === 2 && <span className="landing-fanout-down absolute left-1/2 size-2 -translate-x-1/2 rounded-full bg-sage" />}
168 </div>
169 ))}
170 </div>
171 <div className="grid gap-3 max-md:mt-3 md:grid-cols-3" aria-live="polite">
172 {FANOUT_AGENTS.map((agent) => (
173 <FanoutAgent key={agent.id} agent={agent} phase={phase} />
174 ))}
175 </div>
176 </div>
177 </div>
178 );
179}
180
181function DeployButton({ size = "base", className = "" }: { size?: "base" | "lg"; className?: string }) {
182 const [soon, setSoon] = useState(false);
183 const timer = useRef<ReturnType<typeof setTimeout>>(undefined);
184 useEffect(() => () => clearTimeout(timer.current), []);
185 const tap = () => {
186 setSoon(true);
187 clearTimeout(timer.current);
188 timer.current = setTimeout(() => setSoon(false), 2400);
189 };
190 return (
191 <>
192 <Button type="button" variant="primary" size={size} aria-disabled={soon} className={`min-w-[11rem] justify-center ${className}`} onClick={tap}>
193 {soon ? "Coming soon" : "Deploy to Workers"}
194 </Button>
195 <span className="sr-only" role="status">{soon ? "Deploy to Workers is coming soon." : ""}</span>
196 </>
197 );
198}
199
200function Command({ parts, label, lines = false, prompt = true }: { parts: readonly string[]; label: string; lines?: boolean; prompt?: boolean }) {
201 const [copied, setCopied] = useState(false);
202 const timer = useRef<ReturnType<typeof setTimeout>>(undefined);
203 useEffect(() => () => clearTimeout(timer.current), []);
204 const shown = lines ? parts : [parts.join(" ")];
205 const copy = async () => {
206 try {
207 await navigator.clipboard.writeText(shown.join("\n"));
208 setCopied(true);
209 clearTimeout(timer.current);
210 timer.current = setTimeout(() => setCopied(false), 2000);
211 } catch {
212 setCopied(false);
213 }
214 };
215 return (
216 <div className="flex items-start gap-2 rounded-control bg-sunken py-2 pr-2 pl-4 shadow-[inset_0_0_0_1px_var(--hairline)]">
217 <code className="min-w-0 flex-1 overflow-x-auto py-1 font-mono text-xs leading-relaxed whitespace-nowrap">
218 {shown.map((line) => (
219 <span key={line} className="block">
220 {prompt && <span className="text-faint select-none">$ </span>}
221 {line}
222 </span>
223 ))}
224 </code>
225 <button type="button" onClick={copy} aria-label={label} className="hit-area flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-chip text-muted transition-colors duration-150 hover:bg-hover hover:text-ink">
226 <SwapIcon active={copied} on={<CheckIcon size={14} />} off={<CopyIcon size={14} />} />
227 </button>
228 <span className="sr-only" role="status">{copied ? `${label}: copied` : ""}</span>
229 </div>
230 );
231}
232
233
234const SOURCE = "https://useref.dev/refs/source";
235const DEPLOY = [`git clone ${SOURCE}.git`, "cd source && npm install", "npm run deploy"] as const;
236
237const STACK = ["Workflows", "Containers", "Cron Triggers", "Workers KV", "Email Service", "Rate Limiting", "Observability"] as const;
238
239const DOCS = [
240 { href: "/docs/quickstart", title: "Quickstart", line: "Create a repository and connect your first agent." },
241 { href: "/docs/concepts", title: "Concepts", line: "Sessions, branches, decisions and the origin." },
242 { href: "/docs/pull-requests", title: "Review a pull request", line: "Read the reasoning, steer and branch." },
243 { href: "/docs/decision-records", title: "Decision records", line: "What agents write, and how refs checks it." },
244] as const;
245
246const TILES = [
247 { title: "See every agent at work.", scene: AgentLanes },
248 { title: "Change any decision.", scene: ChallengeLoop },
249 { title: "Branch from any step.", scene: BranchLoop },
250 { title: "Approve before it runs.", scene: ApproveLoop },
251] as const;
252
253function Hero() {
254 return (
255 <section className="relative isolate flex min-h-[calc(100svh-52px)] flex-col overflow-hidden">
256 <div className="absolute inset-0 -z-10">
257 <CodeGlobe className="landing-globe rise-in block size-full [--delay:250ms] [--rise:0px] [--rise-duration:1200ms]" />
258 </div>
259 <div className="mx-auto flex max-w-[1080px] flex-col items-center px-4 pt-20 pb-24 text-center md:px-8 md:pt-28">
260 <h1 className="rise-in m-0 text-[clamp(3rem,10vw,6.5rem)] leading-[0.98] font-semibold tracking-[-0.05em] text-balance [--rise-duration:600ms] [--rise:16px]">
261 You architect.
262 <br />
263 <span className="text-muted">Agents build.</span>
264 </h1>
265 <p className="rise-in m-0 mt-7 max-w-xl text-[clamp(1.125rem,2.2vw,1.5rem)] leading-snug text-muted text-pretty [--delay:110ms] [--rise:10px]">
266 Collaboration between agents and humans, reimagined. Open source, on your own Cloudflare account.
267 </p>
268 <div className="rise-in mt-9 flex flex-wrap items-center justify-center gap-x-8 gap-y-4 [--delay:110ms] [--rise:10px]">
269 <DeployButton size="lg" />
270 <a href="/signup" className="inline-flex items-center gap-1.5 text-callout font-medium text-accent-text transition-colors duration-150 hover:text-accent-hover">
271 Try the hosted version <ArrowRightIcon size={14} />
272 </a>
273 </div>
274 </div>
275 </section>
276 );
277}
278
279function Statement({ title, line }: { title: React.ReactNode; line?: string }) {
280 return (
281 <div className="scroll-reveal mx-auto mb-14 flex max-w-3xl flex-col items-center gap-5 text-center">
282 <h2 className="m-0 text-[clamp(2.5rem,6vw,4.5rem)] leading-[1.04] font-semibold tracking-[-0.04em] text-balance">{title}</h2>
283 {line && <p className="m-0 max-w-2xl text-[clamp(1.125rem,2vw,1.375rem)] leading-snug text-muted text-pretty">{line}</p>}
284 </div>
285 );
286}
287
288export function SiteHeader({ wide = false, signedIn = false }: { wide?: boolean; signedIn?: boolean }) {
289 return (
290 <header className="material-chrome scroll-edge sticky top-0 z-20">
291 <nav aria-label="Main navigation" className={`mx-auto flex h-[52px] items-center gap-6 px-4 md:px-8 ${wide ? "max-w-[1280px]" : "max-w-[1080px]"}`}>
292 <Wordmark />
293 <a href="/docs" className="text-sm text-muted transition-colors duration-150 hover:text-ink">Docs</a>
294 <div className="ml-auto flex items-center gap-2">
295 <ThemeMenu />
296 {signedIn ? (
297 <LinkButton variant="secondary" href="/">Go to app</LinkButton>
298 ) : (
299 <>
300 <LinkButton variant="ghost" href="/login">Sign in</LinkButton>
301 <LinkButton variant="secondary" href={SOURCE} className="max-sm:hidden">View source</LinkButton>
302 </>
303 )}
304 </div>
305 </nav>
306 </header>
307 );
308}
309
310export function Landing() {
311 return (
312 <div className="landing">
313 <SiteHeader />
314
315 <main>
316 <Hero />
317
318 <section id="reasoning" className="mx-auto max-w-[1080px] scroll-mt-20 px-4 py-28 md:px-8 md:py-40">
319 <Statement title="Only the decisions that matter." line="Most commits decide nothing. An agent records a choice only when you could choose differently and it is expensive to undo. refs folds them into one short list." />
320 <div className="scroll-reveal">
321 <DecisionFold />
322 </div>
323 </section>
324
325 <section id="agents" className="bg-rail shadow-[inset_0_1px_0_var(--hairline),inset_0_-1px_0_var(--hairline)]">
326 <div className="mx-auto max-w-[1080px] scroll-mt-20 px-4 py-28 md:px-8 md:py-40">
327 <Statement title={<>Agents do the work.<br />You make the decisions.</>} />
328 <ul className="m-0 grid list-none gap-4 p-0 md:grid-cols-2 md:gap-5">
329 {TILES.map(({ title, scene: Scene }) => (
330 <li key={title} className="scroll-reveal flex min-w-0 flex-col gap-6 rounded-sheet bg-ground p-6 shadow-card sm:p-8">
331 <h3 className="m-0 text-heading leading-tight font-semibold tracking-[-0.02em]">{title}</h3>
332 <div className="mt-auto">
333 <Scene />
334 </div>
335 </li>
336 ))}
337 </ul>
338 </div>
339 </section>
340
341 <section id="merge" className="mx-auto max-w-[1080px] scroll-mt-20 px-4 py-28 md:px-8 md:py-40">
342 <Statement title="Merge once. Every agent knows." line="The merge carries the decisions you accepted. Every other agent works within them." />
343 <div className="scroll-reveal">
344 <MergeFanout />
345 </div>
346 </section>
347
348 <section id="deploy" className="scroll-mt-12 bg-rail shadow-[inset_0_1px_0_var(--hairline),inset_0_-1px_0_var(--hairline)]">
349 <div className="mx-auto grid max-w-[1080px] items-center gap-14 px-4 py-28 md:px-8 md:py-40 lg:grid-cols-2 lg:gap-20 [&>*]:min-w-0">
350 <div className="scroll-reveal flex flex-col items-start gap-6">
351 <h2 className="m-0 text-[clamp(2.5rem,6vw,4.5rem)] leading-[1.04] font-semibold tracking-[-0.04em] text-balance">Yours to run.</h2>
352 <p className="m-0 max-w-md text-[clamp(1.125rem,2vw,1.375rem)] leading-snug text-muted text-pretty">Open source. One command puts refs on your own Cloudflare account. Your code and its decisions stay with you.</p>
353 <div className="mt-4 flex w-full max-w-md flex-col gap-3">
354 <DeployButton size="lg" className="self-start" />
355 <span className="caption mt-3 text-faint">Or by hand</span>
356 <Command parts={DEPLOY} label="Copy deploy commands" lines />
357 </div>
358 </div>
359 <div className="scroll-reveal rounded-sheet bg-ground p-6 shadow-card sm:p-8">
360 <PushRoute />
361 <p className="m-0 mt-6 pt-5 text-compact text-muted shadow-[inset_0_1px_0_var(--hairline)]">
362 Also on Cloudflare: {STACK.join(", ")}.
363 </p>
364 </div>
365 </div>
366 </section>
367
368 <section id="start" className="mx-auto max-w-[1080px] scroll-mt-20 px-4 py-28 md:px-8 md:py-40">
369 <div className="scroll-reveal rounded-sheet bg-panel px-6 py-14 text-center shadow-card sm:px-12 md:py-20">
370 <h2 className="m-0 mx-auto max-w-3xl text-[clamp(2.25rem,5.5vw,4rem)] leading-[1.05] font-semibold tracking-[-0.04em] text-balance">
371 Let agents write the code. Keep the decisions.
372 </h2>
373 <div className="mx-auto mt-12 grid max-w-lg gap-6 text-left">
374 <div className="flex flex-col gap-2">
375 <span className="caption text-faint">Claude Code, OpenCode</span>
376 <Command parts={INSTALL_PARTS} label="Copy install command" />
377 </div>
378 <div className="flex flex-col gap-2">
379 <span className="caption text-faint">Codex, any MCP client</span>
380 <Command parts={[MCP]} label="Copy MCP URL" prompt={false} />
381 </div>
382 </div>
383 <LinkButton variant="ghost" href="/signup" className="mt-8">No server yet? Join the hosted waitlist</LinkButton>
384 </div>
385 </section>
386
387 <section id="docs" className="mx-auto max-w-[1080px] scroll-mt-20 px-4 pb-28 md:px-8 md:pb-40">
388 <div className="scroll-reveal mb-8 flex flex-wrap items-end justify-between gap-4">
389 <h2 className="m-0 text-[clamp(2rem,4.5vw,3rem)] leading-[1.05] font-semibold tracking-[-0.04em]">Read the docs.</h2>
390 <a href="/docs" className="inline-flex items-center gap-1.5 text-callout font-medium text-accent-text transition-colors duration-150 hover:text-accent-hover">
391 All docs <ArrowRightIcon size={14} />
392 </a>
393 </div>
394 <ul className="m-0 grid list-none gap-4 p-0 sm:grid-cols-2 lg:grid-cols-4">
395 {DOCS.map((doc) => (
396 <li key={doc.href} className="scroll-reveal">
397 <a href={doc.href} className="flex h-full flex-col gap-2 rounded-panel bg-raised p-5 shadow-card transition-colors duration-150 hover:bg-hover">
398 <span className="text-headline font-semibold">{doc.title}</span>
399 <span className="text-compact text-muted">{doc.line}</span>
400 </a>
401 </li>
402 ))}
403 </ul>
404 </section>
405 </main>
406
407 <footer className="shadow-[inset_0_1px_0_var(--hairline)]">
408 <div className="mx-auto flex max-w-[1080px] flex-wrap items-center gap-x-6 gap-y-2 px-4 py-8 text-sm text-muted md:px-8">
409 <Wordmark />
410 <span>Open source · Runs on Cloudflare</span>
411 <span className="ml-auto">
412 <ThemeMenu side="top" />
413 </span>
414 <a href="/docs" className="transition-colors duration-150 hover:text-ink">Docs</a>
415 <a href="/login" className="transition-colors duration-150 hover:text-ink">Sign in</a>
416 <a href={SOURCE} className="transition-colors duration-150 hover:text-ink">Source</a>
417 <a href="/signup" className="transition-colors duration-150 hover:text-ink">Hosted waitlist</a>
418 </div>
419 </footer>
420 </div>
421 );
422}