Skip to content
refs
371 lines · 20.7 KBRaw
1import {
2 ArrowRightIcon,
3 CaretRightIcon,
4 CheckIcon,
5 CopyIcon,
6 GithubIcon,
7} from "@refs/design-system/icons";
8import { CodeGlobe, LinkButton, SwapIcon, ThemeMenu, Wordmark } from "@refs/design-system";
9import { useEffect, useRef, useState } from "react";
10import mergeLines from "../assets/merge-lines.webp";
11import { AgentLanes, ApproveLoop, BranchLoop, ChallengeLoop, DecisionFold, MentionLoop, MergeNotify, PLATFORM_ART, PushRoute, artFrame, BuildAgentArt, KeysArt } from "./landing-scenes";
12
13const AGENT = "@agent/7c1e";
14const INSTALL_PARTS = ["curl -fsSL", "https://useref.dev/install | sh"] as const;
15const MCP = "https://useref.dev/mcp";
16
17function Mention({ id = AGENT }: { id?: string }) {
18 return <span className="agent-mention shrink-0">{id}</span>;
19}
20
21function Sha({ value }: { value: string }) {
22 return <span className="font-mono text-xs text-muted">{value}</span>;
23}
24
25function Command({ parts, label, lines = false, prompt = true }: { parts: readonly string[]; label: string; lines?: boolean; prompt?: boolean }) {
26 const [copied, setCopied] = useState(false);
27 const timer = useRef<ReturnType<typeof setTimeout>>(undefined);
28 useEffect(() => () => clearTimeout(timer.current), []);
29 const shown = lines ? parts : [parts.join(" ")];
30 const copy = async () => {
31 try {
32 await navigator.clipboard.writeText(shown.join("\n"));
33 setCopied(true);
34 clearTimeout(timer.current);
35 timer.current = setTimeout(() => setCopied(false), 2000);
36 } catch {
37 setCopied(false);
38 }
39 };
40 return (
41 <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)]">
42 <code className="min-w-0 flex-1 overflow-x-auto py-1 font-mono text-xs leading-relaxed whitespace-pre">
43 {shown.map((line) => (
44 <span key={line} className="block">
45 {prompt && <span className="text-faint select-none">$ </span>}
46 {line}
47 </span>
48 ))}
49 </code>
50 <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">
51 <SwapIcon active={copied} on={<CheckIcon size={14} />} off={<CopyIcon size={14} />} />
52 </button>
53 <span className="sr-only" role="status">{copied ? `${label}: copied` : ""}</span>
54 </div>
55 );
56}
57
58
59const SOURCE = "https://useref.dev/refs/source";
60const GITHUB = "https://github.com/thisisamank/refs";
61const DEPLOY = [`git clone ${SOURCE}.git`, "cd source && npm install", "npm run deploy"] as const;
62
63const STACK = ["Workflows", "Containers", "Cron Triggers", "Workers KV", "Email Service", "Rate Limiting", "Observability"] as const;
64
65const DOCS = [
66 { href: "/docs/quickstart", title: "Quickstart", line: "Create a repository and connect your first agent." },
67 { href: "/docs/pull-requests", title: "Review a pull request", line: "Read the reasoning, steer and branch." },
68 { href: "/docs/hosted-agents", title: "Use hosted agents", line: "Mention an agent, or run one in CI." },
69 { href: "/docs/decision-records", title: "Decision records", line: "What agents write, and how refs checks it." },
70] as const;
71
72const BUILT_IN = [
73 { handle: "@reviewer", line: "Lists real problems, the most severe first." },
74 { handle: "@security", line: "Finds missing checks, injection and leaked secrets." },
75 { handle: "@tests", line: "Finds changed behavior that no test covers." },
76 { handle: "@perf", line: "Finds queries in loops and unbounded work." },
77 { handle: "@explain", line: "Explains the change, or answers a question." },
78 { handle: "@docs", line: "Finds docs that the change makes wrong." },
79] as const;
80
81const CI_AGENT = ["jobs:", " review:", " agent: reviewer", " prompt: Check error handling."] as const;
82
83const PLATFORM = [
84 { art: "git", title: "Git hosting", line: "Public and private repositories, forks and imports.", href: "/docs/git", cf: "Artifacts" },
85 { art: "map", title: "Code map", line: "Zoom from folders to code, and see what calls a change.", href: "/docs/pull-requests#use-the-code-map", cf: "Artifacts · D1" },
86 { art: "ci", title: "CI", line: "Pipelines run in containers on each push and pull request.", href: "/docs/ci", cf: "Containers · Workflows · Queues" },
87 { art: "secrets", title: "Secrets and environments", line: "Sealed secrets. A deploy job waits for a person.", href: "/docs/ci#protect-deploys-with-environments", cf: "Workers · D1" },
88 { art: "tasks", title: "Tasks", line: "A plain tracker with labels, assignees and comments.", href: "/docs/tasks", cf: "D1 · Durable Objects" },
89 { art: "orgs", title: "Organizations", line: "Owner, admin and member roles. Invite by email.", href: "/docs/organizations", cf: "D1 · Email Service" },
90 { art: "cli", title: "refs CLI", line: "Pull requests, tasks and CI runs from the terminal.", href: "/docs/cli", cf: "Workers" },
91 { art: "mcp", title: "MCP server", line: "Claude Code, Codex, OpenCode and any MCP client.", href: "/docs/connect-an-agent", cf: "Workers OAuth · KV" },
92] as const;
93
94const CLIENTS = ["Claude Code", "Codex", "OpenCode", "Any MCP client"] as const;
95
96function Stage({ children, className = "" }: { children: React.ReactNode; className?: string }) {
97 return <div className={`landing-stage rounded-sheet ${className}`}>{children}</div>;
98}
99
100const TILES = [
101 { title: "See every agent at work.", line: "Each agent shows its person, its client and its branch.", scene: AgentLanes },
102 { title: "Steer any decision.", line: "The agent answers with a decision that replaces the old one.", scene: ChallengeLoop },
103 { title: "Branch from any step.", line: "Try a different path on a new branch, from any commit.", scene: BranchLoop },
104 { title: "Approve before it runs.", line: "A tool request comes to your browser. Allow or deny it.", scene: ApproveLoop },
105] as const;
106
107function Hero() {
108 return (
109 <section className="relative isolate flex min-h-[calc(100svh-52px)] flex-col overflow-hidden">
110 <div className="absolute inset-0 -z-10">
111 <CodeGlobe glow className="landing-globe rise-in block size-full [--delay:250ms] [--rise:0px] [--rise-duration:1200ms]" />
112 </div>
113 <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">
114 <h1 className="rise-in m-0 text-[clamp(3rem,10vw,6rem)] leading-[0.98] font-semibold tracking-[-0.04em] text-balance [--rise-duration:600ms] [--rise:16px]">
115 Stop reading diffs.
116 <br />
117 <span className="text-muted">Start reading decisions.</span>
118 </h1>
119 <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]">
120 Your agents push thousands of lines. refs shows you the few choices that matter, so you can steer, branch or merge in minutes. Open source, and ready to deploy on your own Cloudflare account.
121 </p>
122 <div className="rise-in mt-9 flex flex-wrap items-center justify-center gap-x-8 gap-y-4 [--delay:190ms] [--rise:10px]">
123 <LinkButton variant="primary" size="lg" href="/signup" className="min-w-[11rem] justify-center">Try hosted refs</LinkButton>
124 <a href="#deploy" className="inline-flex items-center gap-1.5 text-callout font-medium text-accent-text transition-colors duration-150 hover:text-accent-hover">
125 Deploy your own <ArrowRightIcon size={14} />
126 </a>
127 </div>
128 <ul aria-label="Works with" className="rise-in m-0 mt-10 flex list-none flex-wrap items-center justify-center gap-2 p-0 [--delay:260ms] [--rise:6px]">
129 {CLIENTS.map((client) => (
130 <li key={client} className="material-chrome rounded-full px-3 py-1 font-mono text-xs text-muted shadow-[inset_0_0_0_1px_var(--hairline)]">{client}</li>
131 ))}
132 </ul>
133 </div>
134 </section>
135 );
136}
137
138function Statement({ title, line }: { title: React.ReactNode; line?: string }) {
139 return (
140 <div className="scroll-reveal mx-auto mb-14 flex max-w-3xl flex-col items-center gap-5 text-center">
141 <h2 className="m-0 text-[clamp(2.5rem,6vw,4.5rem)] leading-[1.04] font-semibold tracking-[-0.04em] text-balance">{title}</h2>
142 {line && <p className="m-0 max-w-2xl text-[clamp(1.125rem,2vw,1.375rem)] leading-snug text-muted text-pretty">{line}</p>}
143 </div>
144 );
145}
146
147export function SiteHeader({ wide = false, signedIn = false }: { wide?: boolean; signedIn?: boolean }) {
148 return (
149 <header className="material-chrome scroll-edge sticky top-0 z-20">
150 <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]"}`}>
151 <Wordmark />
152 <div className="ml-auto flex items-center gap-2">
153 <LinkButton variant="ghost" href="/docs">Docs</LinkButton>
154 <LinkButton variant="ghost" shape="square" href={GITHUB} aria-label="View refs on GitHub" icon={<GithubIcon />} />
155 <ThemeMenu />
156 {signedIn ? (
157 <LinkButton variant="secondary" href="/">Go to app</LinkButton>
158 ) : (
159 <>
160 <LinkButton variant="ghost" href="/login">Sign in</LinkButton>
161 <LinkButton variant="secondary" href={SOURCE} className="max-sm:hidden">View source</LinkButton>
162 </>
163 )}
164 </div>
165 </nav>
166 </header>
167 );
168}
169
170export function Landing() {
171 return (
172 <div className="landing">
173 <SiteHeader />
174
175 <main className="landing-rails">
176 <Hero />
177
178 <section id="reasoning" className="landing-band scroll-mt-20">
179 <div className="mx-auto max-w-[1080px] px-4 py-28 md:px-8 md:py-40">
180 <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." />
181 <Stage className="scroll-reveal p-4 sm:p-8 lg:p-12">
182 <DecisionFold />
183 </Stage>
184 </div>
185 </section>
186
187 <section id="agents" className="landing-band scroll-mt-20 bg-rail">
188 <div className="mx-auto max-w-[1080px] px-4 py-28 md:px-8 md:py-40">
189 <Statement title={<>Agents do the work.<br />You make the decisions.</>} />
190 <ul className="landing-cells scroll-reveal m-0 list-none grid-cols-1 p-0 md:grid-cols-2">
191 {TILES.map(({ title, line, scene: Scene }) => (
192 <li key={title} className="flex min-w-0 flex-col gap-5 p-5 sm:p-8">
193 <span className="flex flex-col gap-1">
194 <h3 className="m-0 text-heading leading-tight font-semibold tracking-[-0.02em]">{title}</h3>
195 <span className="text-compact text-muted">{line}</span>
196 </span>
197 <Stage className="mt-auto p-4 sm:p-6">
198 <Scene />
199 </Stage>
200 </li>
201 ))}
202 </ul>
203 </div>
204 </section>
205
206 <section id="hosted-agents" className="landing-band scroll-mt-20">
207 <div className="mx-auto max-w-[1080px] px-4 py-28 md:px-8 md:py-40">
208 <Statement title="Agents on call." line="Six agents come built in, and you can build your own. Mention one on a pull request, and it answers in one short comment." />
209 <Stage className="scroll-reveal p-4 sm:p-8 lg:p-12">
210 <div className="grid grid-cols-1 gap-4 md:gap-5 lg:grid-cols-[minmax(0,7fr)_minmax(0,5fr)] [&>*]:min-w-0">
211 <MentionLoop />
212 <div className="rounded-panel bg-panel shadow-card">
213 <div className="px-5 py-3 text-compact font-medium shadow-[inset_0_-1px_0_var(--hairline)]">Built into every repository</div>
214 <ul className="m-0 list-none p-0">
215 {BUILT_IN.map((agent) => (
216 <li key={agent.handle} className="flex items-baseline gap-3 px-5 py-2.5 not-last:shadow-[inset_0_-1px_0_var(--hairline)]">
217 <span className="w-20 shrink-0 font-mono text-xs text-ink">{agent.handle}</span>
218 <span className="min-w-0 text-compact text-muted">{agent.line}</span>
219 </li>
220 ))}
221 </ul>
222 </div>
223 </div>
224 </Stage>
225 <ul className="landing-cells scroll-reveal m-0 mt-4 list-none grid-cols-1 p-0 md:mt-5 lg:grid-cols-3">
226 <li className="flex min-w-0 flex-col gap-4 p-5 sm:p-6">
227 <span className="flex flex-col gap-1">
228 <h3 className="m-0 text-headline font-semibold">Build your own agent.</h3>
229 <span className="text-compact text-muted">Give it a handle and instructions, for one repository or for every repository in your organization.</span>
230 </span>
231 <Stage className={`${artFrame} mt-auto h-44`}><BuildAgentArt /></Stage>
232 </li>
233 <li className="flex min-w-0 flex-col gap-4 p-5 sm:p-6">
234 <span className="flex flex-col gap-1">
235 <h3 className="m-0 text-headline font-semibold">Bring your own keys.</h3>
236 <span className="text-compact text-muted">Agents run on Workers AI by default. Add an Anthropic, OpenAI or OpenRouter key to use your model. refs stores it encrypted.</span>
237 </span>
238 <Stage className={`${artFrame} mt-auto h-44`}><KeysArt /></Stage>
239 </li>
240 <li className="flex min-w-0 flex-col gap-4 p-5 sm:p-6">
241 <span className="flex flex-col gap-1">
242 <h3 className="m-0 text-headline font-semibold">Run one in CI.</h3>
243 <span className="text-compact text-muted">Add an agent job to your pipeline, and it reviews each pull request.</span>
244 </span>
245 <div className="mt-auto">
246 <Command parts={CI_AGENT} label="Copy CI agent job" lines prompt={false} />
247 </div>
248 </li>
249 </ul>
250 </div>
251 </section>
252
253 <section id="merge" className="landing-band scroll-mt-20 bg-rail">
254 <div className="mx-auto max-w-[1080px] px-4 py-28 md:px-8 md:py-40">
255 <Statement title="Merge once. Every agent knows." />
256 <Stage className="scroll-reveal p-4 sm:p-8 lg:p-12">
257 <MergeNotify />
258 </Stage>
259 </div>
260 </section>
261
262 <section id="platform" className="landing-band scroll-mt-20">
263 <div className="mx-auto max-w-[1080px] px-4 py-28 md:px-8 md:py-40">
264 <Statement title="Everything around the code." line="Hosting, CI, tasks and teams, in the same place as your agents. Built on Cloudflare." />
265 <ul className="landing-cells scroll-reveal m-0 list-none grid-cols-1 p-0 sm:grid-cols-2 lg:grid-cols-4">
266 {PLATFORM.map(({ art, title, line, href, cf }) => {
267 const Art = PLATFORM_ART[art];
268 return (
269 <li key={title}>
270 <a href={href} className="group flex h-full flex-col gap-4 p-4 transition-colors duration-150 hover:bg-hover">
271 <Stage className={artFrame}>
272 <Art />
273 </Stage>
274 <span className="flex flex-col gap-1 px-1 pb-1">
275 <span className="flex items-center gap-1 text-callout font-medium">
276 {title}
277 <CaretRightIcon size={14} className="text-faint transition-[color,translate] duration-150 group-hover:translate-x-0.5 group-hover:text-ink" />
278 </span>
279 <span className="text-compact text-muted text-pretty">{line}</span>
280 <span className="mt-1 text-xs text-faint">{cf}</span>
281 </span>
282 </a>
283 </li>
284 );
285 })}
286 </ul>
287 </div>
288 </section>
289
290 <section id="deploy" className="landing-band scroll-mt-12 bg-rail">
291 <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">
292 <div className="scroll-reveal flex flex-col items-start gap-6">
293 <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>
294 <p className="m-0 max-w-md text-[clamp(1.125rem,2vw,1.375rem)] leading-snug text-muted text-pretty">Open source. Three commands put refs on your own Cloudflare account. Your code and its decisions stay with you.</p>
295 <div className="mt-4 flex w-full max-w-md flex-col gap-3">
296 <Command parts={DEPLOY} label="Copy deploy commands" lines />
297 <LinkButton variant="secondary" href={SOURCE} className="self-start">View the source</LinkButton>
298 </div>
299 </div>
300 <Stage className="scroll-reveal p-6 sm:p-10">
301 <div className="rounded-panel bg-ground p-6 shadow-card">
302 <PushRoute />
303 <p className="m-0 mt-6 pt-5 text-compact text-muted shadow-[inset_0_1px_0_var(--hairline)]">
304 Also on Cloudflare: {STACK.join(", ")}.
305 </p>
306 </div>
307 </Stage>
308 </div>
309 </section>
310
311 <section id="start" className="landing-band scroll-mt-20">
312 <div className="mx-auto max-w-[1080px] px-4 py-28 md:px-8 md:py-40">
313 <Stage className="scroll-reveal px-6 pt-14 pb-40 text-center sm:px-12 md:pt-20 md:pb-56">
314 <div aria-hidden="true" className="landing-art" style={{ "--art": `url(${mergeLines})` } as React.CSSProperties} />
315 <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">
316 Let agents write the code. Keep the decisions.
317 </h2>
318 <div className="mx-auto mt-12 grid max-w-lg grid-cols-1 gap-6 text-left">
319 <div className="flex flex-col gap-2">
320 <span className="caption text-muted">Claude Code, OpenCode</span>
321 <Command parts={INSTALL_PARTS} label="Copy install command" />
322 </div>
323 <div className="flex flex-col gap-2">
324 <span className="caption text-muted">Codex, any MCP client</span>
325 <Command parts={[MCP]} label="Copy MCP URL" prompt={false} />
326 </div>
327 </div>
328 <LinkButton variant="ghost" href="/signup" className="mt-8">Not sure yet? Try it at useref.dev</LinkButton>
329 </Stage>
330 </div>
331 </section>
332
333 <section id="docs" className="landing-band scroll-mt-20">
334 <div className="mx-auto max-w-[1080px] px-4 py-28 md:px-8 md:py-32">
335 <div className="scroll-reveal mb-8 flex flex-wrap items-end justify-between gap-4">
336 <h2 className="m-0 text-[clamp(2rem,4.5vw,3rem)] leading-[1.05] font-semibold tracking-[-0.04em]">Read the docs.</h2>
337 <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">
338 All docs <ArrowRightIcon size={14} />
339 </a>
340 </div>
341 <ul className="landing-cells scroll-reveal m-0 list-none grid-cols-1 p-0 sm:grid-cols-2 lg:grid-cols-4">
342 {DOCS.map((doc) => (
343 <li key={doc.href}>
344 <a href={doc.href} className="flex h-full flex-col gap-2 p-5 transition-colors duration-150 hover:bg-hover">
345 <span className="text-headline font-semibold">{doc.title}</span>
346 <span className="text-compact text-muted">{doc.line}</span>
347 </a>
348 </li>
349 ))}
350 </ul>
351 </div>
352 </section>
353 </main>
354
355 <footer className="shadow-[inset_0_1px_0_var(--hairline)]">
356 <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">
357 <Wordmark />
358 <span>Open source · Runs on Cloudflare</span>
359 <span className="ml-auto">
360 <ThemeMenu side="top" />
361 </span>
362 <a href="/docs" className="transition-colors duration-150 hover:text-ink">Docs</a>
363 <a href="/login" className="transition-colors duration-150 hover:text-ink">Sign in</a>
364 <a href={SOURCE} className="transition-colors duration-150 hover:text-ink">Source</a>
365 <a href={GITHUB} className="inline-flex items-center gap-1.5 transition-colors duration-150 hover:text-ink"><GithubIcon />GitHub</a>
366 <a href="/signup" className="transition-colors duration-150 hover:text-ink">Hosted refs</a>
367 </div>
368 </footer>
369 </div>
370 );
371}