feat(web): generate the og card and add static assets

og.mjs renders an HTML card in headless Chromium at a fixed 1200x630 and screenshots
it. The heading and install command are read from hero.json and site.json — the
same files the page renders from — because those are exactly the two strings that
drift.

The card spent a while advertising a headline the page had stopped using and an
install command for somebody else's package, which is what a picture of copy gets
you when nothing checks it.
This commit is contained in:
Nayan
2026-08-09 21:44:00 +05:30
parent d216fe3d20
commit fa6d0c1240
7 changed files with 281 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
<!--
Airship's brand mark. The canonical copy, and the geometry of record.
The overlay does NOT load this file — it carries the same path inline in
`packages/overlay/src/icons.ts` (as `logo`), because it inlines every glyph
rather than fetching any. The two must be changed together, and that file is
where the construction is explained.
Paint: `fill="currentColor"` with a `<style>` that supplies the colour, so the
same file works in a README, a docs page or a dark terminal preview. The
presentation attribute alone would resolve to black when this is loaded
standalone or via <img>, which is invisible on exactly the dark backgrounds
this mark spends most of its life on.
If you ever inline this file's markup into an HTML document, drop the <style>
block: its `svg { color }` rule would reach every other svg on the page, and
inline is the one context where inheriting the surrounding text colour is
what you want anyway.
-->
<svg
aria-label="Airship"
fill="none"
height="24"
role="img"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
>
<style>
svg {
color: #1b1f24;
}
@media (prefers-color-scheme: dark) {
svg {
color: #ffffff;
}
}
</style>
<path
d="M12 5.1L20 18.9H15.47L9.73 9.01ZM7.47 12.92H12L8.53 18.9H4Z"
fill="currentColor"
fill-opacity="0.9"
/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

+63
View File
@@ -0,0 +1,63 @@
# airship
> A visual editor for the web app you are already running. Airship puts an
> infinite design canvas in front of your dev server — no plugin, no config.
> Point at any element, describe the change in plain English, and Claude Code,
> OpenAI Codex or OpenCode edits the source file, with streaming status, inline
> diffs and undo.
## What it is
A CLI. `npx @airshiplabs/cli --target 3000` starts a universal reverse proxy in
front of the dev server you already have and opens the editor on the next port.
Nothing is added to your dependencies, your config or your bundle.
## How it works
- **Reverse proxy, not a plugin.** Works with Vite, Next, Remix, Rails —
anything serving HTML over HTTP. `--target` is the only flag most projects
need, and it is detected from your package.json when you leave it off.
- **Frames are real viewports.** Each frame is a same-origin iframe at a device
size, so a 393px frame reports `innerWidth === 393` at any zoom. Media and
container queries fire per frame.
- **Edits go to source.** A picked element resolves back to the file and line
that rendered it. Your prompt, the selection and any inspector tweaks reach
the agent, which edits the file; you get the diff and an undo.
- **Inline mode.** `?__airship=inline` injects the overlay straight into the
app's own page instead of the canvas shell.
## Agents
Selected with `--agent`, or switched per turn from the composer. They are not
equivalent:
- **claude** (default) — token-level streaming, hook-based diff capture,
`--max-turns` and `--max-budget` enforced, native file checkpointing.
- **codex** — the only backend that confines writes at the OS level under
`--safe`. Whole-message streaming; diffs reconstructed from the git HEAD blob.
- **opencode** — native session fork and snapshot-backed revert; ignores
`--effort`. A separate install, found on PATH.
## Safety
By default there is no sandbox: the agent can write anywhere you can and reach
the network. `--safe` confines edits to the project and screens destructive
commands — but only `codex` enforces this at the OS level. On claude and
opencode the screen matches paths and command patterns rather than parsing
shell, so a write redirected out of the project is not caught.
## Privacy
Airship runs entirely on localhost and adds no service of its own: no account,
no telemetry, no server. Whatever your chosen agent sends to its provider is
what it would send from your terminal, under credentials you already gave it.
## Requirements
Node 22.13 or later, and one of Claude Code, OpenAI Codex or OpenCode.
## Links
- Source: https://github.com/0xnyn/airship
- Issues: https://github.com/0xnyn/airship/issues
- Releases: https://github.com/0xnyn/airship/releases
Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

+4
View File
@@ -0,0 +1,4 @@
User-agent: *
Allow: /
Sitemap: https://airship.design/sitemap.xml
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
One page, one URL. Written by hand rather than generated: a sitemap route
would be a server function, a build step and a cache-header decision, all to
emit eleven lines that only change when a second page appears.
-->
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://airship.design/</loc>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>
</urlset>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

+157
View File
@@ -0,0 +1,157 @@
/*
* Regenerates public/og.png.
*
* The card used to be a hand-made binary with the headline and the install
* command painted into it, which is exactly how it ended up advertising
* "The visual editor for the app you're already running" and `npx airship`
* long after the page had stopped saying either. A picture of copy is still
* copy, and nothing checks it.
*
* So the two strings that actually drift — the heading and the install
* command — are read from the same content files the page renders from, and
* the card is a screenshot. Change the copy, run `make web:og`, commit the png.
*
* The blurb below is NOT read from content on purpose: a social card has room
* for about a dozen words, and every descriptive string in content/ is written
* for a page that can afford three lines. Keeping it here, short, beats
* force-fitting hero.sub into a space it does not fit.
*/
import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import pw from "playwright";
const HERE = dirname(fileURLToPath(import.meta.url));
const WEB = join(HERE, "..");
const TOKENS = join(WEB, "../../packages/site-tokens/dist");
const WIDTH = 1200;
const HEIGHT = 630;
/** The one line of copy this file owns. See the note above. */
const BLURB =
"Point at any element, describe the change, and Claude Code, Codex or OpenCode edits the source file.";
const site = JSON.parse(
readFileSync(join(WEB, "src/content/site.json"), "utf8")
);
const hero = JSON.parse(
readFileSync(join(WEB, "src/content/hero.json"), "utf8")
);
/** The install command, with hero.json's `{{installCommand}}` resolved. */
const install = hero.installCommand.replace(
/\{\{installCommand\}\}/g,
site.installCommand
);
function font(file) {
try {
return readFileSync(join(TOKENS, "fonts", file)).toString("base64");
} catch (cause) {
throw new Error(
`Missing ${file}. Build the tokens first: pnpm turbo run build --filter=@airship/site-tokens`,
{ cause }
);
}
}
const inter = font("inter-variable.woff2");
const mono = font("jetbrains-mono-400.woff2");
/*
* The brand mark, inlined from assets/logo.svg. The <style> block in that file
* is dropped deliberately — its `svg { color }` rule is scoped to the document,
* not the element, so it would repaint anything else on the page. Inline is the
* one context where inheriting the surrounding colour is what you want.
*/
const LOGO_PATH = "M12 5.1L20 18.9H15.47L9.73 9.01ZM7.47 12.92H12L8.53 18.9H4Z";
const html = `<!doctype html>
<meta charset="utf-8">
<style>
@font-face {
font-family: "Inter";
font-weight: 100 900;
src: url(data:font/woff2;base64,${inter}) format("woff2");
}
@font-face {
font-family: "JetBrains Mono";
font-weight: 400;
src: url(data:font/woff2;base64,${mono}) format("woff2");
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
width: ${WIDTH}px;
height: ${HEIGHT}px;
display: flex;
flex-direction: column;
justify-content: center;
gap: 28px;
padding: 0 88px;
font-family: "Inter", system-ui, sans-serif;
/* --pk-color-surface-page, under the hero band's warm accent (#e2603a). */
background:
radial-gradient(58% 88% at 84% 76%,
rgba(226, 96, 58, 0.30) 0%,
rgba(226, 96, 58, 0.11) 40%,
rgba(226, 96, 58, 0) 72%),
#fafaf9;
color: #1c1917;
-webkit-font-smoothing: antialiased;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand svg { width: 30px; height: 30px; }
.brand span { font-size: 25px; font-weight: 600; letter-spacing: -0.01em; }
h1 {
font-size: 68px;
font-weight: 600;
line-height: 1.06;
letter-spacing: -0.032em;
max-width: 15ch;
}
p {
font-size: 25px;
line-height: 1.45;
/* --pk-color-text-muted */
color: #57534e;
max-width: 30ch;
}
code {
align-self: flex-start;
margin-top: 6px;
font-family: "JetBrains Mono", monospace;
font-size: 22px;
color: #1c1917;
/* --pk-color-surface-input / --pk-color-border-default */
background: #f5f5f4;
border: 1px solid #e7e5e4;
border-radius: 9px;
padding: 13px 19px;
}
</style>
<div class="brand">
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="${LOGO_PATH}" fill="#1c1917" fill-opacity="0.9" />
</svg>
<span>${site.name}</span>
</div>
<h1>${hero.heading}.</h1>
<p>${BLURB}</p>
<code>${install}</code>
`;
const browser = await pw.chromium.launch();
const page = await browser.newPage({
deviceScaleFactor: 1,
viewport: { height: HEIGHT, width: WIDTH },
});
await page.setContent(html, { waitUntil: "load" });
await page.evaluate(() => document.fonts.ready);
const out = join(WEB, "public/og.png");
await page.screenshot({ path: out });
await browser.close();
process.stdout.write(`og: wrote ${out} (${WIDTH}x${HEIGHT})\n`);