Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/landing/app/docs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import Link from "next/link";
import { Fragment } from "react";
import { Footer, Nav } from "@/components/Chrome";
import { ProviderLogo } from "@/components/brand";
import { Command, CopyButton } from "@/components/CopyButton";
import { Command, CopyButton, CopyPrompt } from "@/components/CopyButton";
import { type DocsGroup, DocsNav } from "@/components/DocsNav";
import { Topology } from "@/components/Topology";
import { copy } from "@/lib/copy";
import { commands, deployToCloudflare, github, install, providers } from "@/lib/data";
import { agentPrompt } from "@/lib/prompt";
import { openGraph, site } from "@/lib/site";
import { cloudflareButton, innerPad, primaryButton, railShell, secondaryButton } from "@/lib/styles";

Expand Down Expand Up @@ -186,6 +187,7 @@ export default function Docs() {
{copy.docs.faq}
<HugeiconsIcon icon={ArrowRight01Icon} size={15} className="transition-transform duration-150 group-hover:translate-x-0.5" />
</Link>
<CopyPrompt prompt={agentPrompt} />
<a href={github} className={secondaryButton}>
<HugeiconsIcon icon={GithubIcon} size={15} />
{copy.nav.github}
Expand Down
27 changes: 26 additions & 1 deletion apps/landing/components/CopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
"use client";

import { Copy01Icon, Tick02Icon } from "@hugeicons/core-free-icons";
import { AiChat02Icon, Copy01Icon, Tick02Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { Fragment, useState } from "react";
import { copy } from "@/lib/copy";
import { secondaryButton } from "@/lib/styles";
import { UrlText } from "./TerminalWindow";

/** A small icon button that copies text; the copy and tick icons cross-fade on swap. */
Expand Down Expand Up @@ -78,3 +80,26 @@ export function Command({ text, className = "" }: { text: string; className?: st
</div>
);
}

/** A button that copies the setup prompt for a coding agent (lib/prompt.ts, passed in from a server component). */
export function CopyPrompt({ prompt }: { prompt: string }) {
const [copied, setCopied] = useState(false);
return (
<button
type="button"
className={secondaryButton}
onClick={async () => {
await navigator.clipboard.writeText(prompt);
setCopied(true);
setTimeout(() => setCopied(false), 2000);
}}
>
<HugeiconsIcon icon={copied ? Tick02Icon : AiChat02Icon} size={15} className={copied ? "text-primary" : ""} />
{/* Both labels share one cell, so the button keeps its width when the label swaps. */}
<span className="grid text-left" aria-live="polite">
<span className={`col-start-1 row-start-1 ${copied ? "invisible" : ""}`}>{copy.agentPrompt.copy}</span>
<span className={`col-start-1 row-start-1 ${copied ? "" : "invisible"}`}>{copy.agentPrompt.copied}</span>
</span>
</button>
);
}
4 changes: 3 additions & 1 deletion apps/landing/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import Link from "next/link";
import { copy } from "@/lib/copy";
import { deployToCloudflare, github, install } from "@/lib/data";
import { cloudflareButton, innerPad, primaryButton, secondaryButton } from "@/lib/styles";
import { Command } from "./CopyButton";
import { agentPrompt } from "@/lib/prompt";
import { Command, CopyPrompt } from "./CopyButton";
import { Topology } from "./Topology";

/**
Expand Down Expand Up @@ -46,6 +47,7 @@ export function Hero() {
className="transition-transform duration-150 group-hover:translate-x-0.5"
/>
</Link>
<CopyPrompt prompt={agentPrompt} />
<a href={github} className={secondaryButton}>
<HugeiconsIcon icon={GithubIcon} size={15} />
{copy.nav.github}
Expand Down
4 changes: 3 additions & 1 deletion apps/landing/components/Install.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import Link from "next/link";
import { copy } from "@/lib/copy";
import { github, install } from "@/lib/data";
import { primaryButton, secondaryButton } from "@/lib/styles";
import { Command } from "./CopyButton";
import { agentPrompt } from "@/lib/prompt";
import { Command, CopyPrompt } from "./CopyButton";
import { Section } from "./Section";

/** The closing install block: heading and body left, the full-width command and buttons right. */
Expand All @@ -17,6 +18,7 @@ export function Install() {
{copy.install.docs}
<HugeiconsIcon icon={ArrowRight01Icon} size={15} className="transition-transform duration-150 group-hover:translate-x-0.5" />
</Link>
<CopyPrompt prompt={agentPrompt} />
<a href={github} className={secondaryButton}>
<HugeiconsIcon icon={GithubIcon} size={15} />
{copy.nav.github}
Expand Down
3 changes: 3 additions & 0 deletions apps/landing/lib/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export const copy = {
hint: "Click a VM to sleep or wake it",
},

/** The button that copies lib/prompt.ts, beside every install command. 30 each. */
agentPrompt: { copy: "Copy prompt for your agent", copied: "Copied, paste it in" },

/** Labels on the diagram of devices, VM Bridge and VMs. 16 each. */
diagram: {
devices: "Devices",
Expand Down
33 changes: 33 additions & 0 deletions apps/landing/lib/prompt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { github, install } from "./data";
import { site } from "./site";

/**
* The prompt the "Copy prompt for your agent" buttons copy: it has a coding agent install VM Bridge, set it up and open
* the dashboard, asking the user first. Agents run commands without a terminal, so `vmbridge password` and the setup
* link (both terminal only, see apps/cli/src/index.ts) can't work for them. The password comes from VMBRIDGE_PASSWORD
* instead, which `vmbridge` and `vmbridge service install` save on a first install. Server only, like site.ts.
*/
export const agentPrompt = `Help me install VM Bridge on this computer and get it running. VM Bridge is a free, open source server that runs T3 Code agents on cloud VMs. Docs: ${site.url}/docs. Source: ${github}.

1. Check that this is macOS or Linux. VM Bridge does not run on Windows, so if it is Windows, tell me and stop.
2. Tell me in a few lines what you will do (download one file to ~/.local/bin, start it, open its dashboard in my browser) and ask if I want to go ahead. Stop if I say no.
3. Ask me these questions together, in one message:
- What should the dashboard password be? It needs at least 8 characters. If I would rather not type it here, I can run \`vmbridge password\` in my own terminal once it is installed.
- Should VM Bridge run in the background and start again at login (recommended), or only for now?
If ~/.vmbridge already exists, VM Bridge was set up here before, so ask if it already has a password instead. If it does, leave it alone.
4. Install it:
${install}
If ~/.local/bin is not on my PATH, use ~/.local/bin/vmbridge in the commands below, and ask before you change my shell profile.
If I chose to set the password myself, wait for me to say it is done.
5. Start it. Pass the password only in the command's environment: never write it to a file or repeat it back to me.
- In the background: VMBRIDGE_PASSWORD='<password>' vmbridge service install
- Only for now: VMBRIDGE_PASSWORD='<password>' nohup vmbridge run > /tmp/vmbridge.log 2>&1 &
Leave out VMBRIDGE_PASSWORD if the password is already set.
6. Wait up to 30 seconds for http://127.0.0.1:3774/dashboard to answer. If it doesn't, show me the end of the log and stop. The background service logs to ~/.vmbridge/vmbridge.log on macOS and to \`journalctl --user -u vmbridge\` on Linux. The other way logs to /tmp/vmbridge.log.
7. Open http://127.0.0.1:3774/dashboard in my browser, with \`open\` on macOS or \`xdg-open\` on Linux.

Then tell me:
- The dashboard address, and that I log in with my password.
- If the output says saved keys are encrypted with a new key, where that key is, and that I should back it up.
- What to do next in the dashboard: add a cloud provider and its API key, and sign in Codex, Claude Code or OpenCode. Then under Settings, Devices, create a pairing link and paste it into T3 Code as a remote environment.
- How to stop it (\`vmbridge stop\`) and update it (\`vmbridge update\`).`;