mirror of
https://github.com/runbear-io/beardrive.git
synced 2026-08-25 08:08:08 +02:00
Adds web/docs — the public product documentation, built with Astro + Starlight and deployed on its own rather than embedded in the binary. Why a standalone site in the OSS repo, rather than a section of the cloud landing page: - Docs change far more often than the binary does. Embedding them would mean a Go rebuild and redeploy to fix a typo, and would ship a Pagefind search index inside every self-hoster's install. - Self-hosting instructions and the CLI reference document the OSS project, so "edit this page" should resolve to something an outside contributor can open a PR against. - Design tokens get easier, not harder: scripts/tokens.mjs generates src/styles/tokens.gen.css from the @theme block in the hub frontend's tw.css, so there is one source of truth and nothing to police. (The cloud landing sits across a module edge and has to keep a *copy*, guarded by its own check-tokens.mjs.) custom.css maps Starlight's --sl-color-* onto those tokens and invents no colors of its own. Content is seeded from README.md, docs/self-hosting.md, and the plugin skill. Guides deliberately cover agent workflows — connecting an agent, the two-file AGENTS.md orientation pattern, artifacts and links, read heat, scoping the folder — rather than re-teaching the CLI, which lives in Reference. starlight-llms-txt emits /llms.txt at build. Convention wants that at the root domain, so beardrive.ai/llms.txt should point here; that redirect belongs to the cloud landing and is the one cross-repo coordination point this split introduces. Claude-Session: https://claude.ai/code/session_018GcqsM6prjdv9rUrhVVEiC Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
51 lines
1.9 KiB
JavaScript
51 lines
1.9 KiB
JavaScript
// Generates src/styles/tokens.gen.css from the hub frontend's design tokens.
|
|
//
|
|
// The hub's Tailwind entry (internal/webapp/frontend/src/tw.css) is the single
|
|
// source of truth for the BearDrive palette. It can't be imported directly:
|
|
// `@theme { … }` is Tailwind syntax, and this site deliberately doesn't run
|
|
// Tailwind. So we read that one block and re-emit it as plain custom
|
|
// properties on :root.
|
|
//
|
|
// This is why the docs site lives in the OSS repo. The cloud landing page sits
|
|
// in a different Go module and has to keep a *copy* of these tokens, policed by
|
|
// cloud/web/landing/scripts/check-tokens.mjs. Here there is no copy to police —
|
|
// the file below is generated, gitignored, and cannot drift.
|
|
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
import { dirname, resolve, relative } from "node:path";
|
|
|
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
const SOURCE = resolve(here, "../../../internal/webapp/frontend/src/tw.css");
|
|
const OUT = resolve(here, "../src/styles/tokens.gen.css");
|
|
|
|
const src = readFileSync(SOURCE, "utf8");
|
|
const block = src.match(/@theme\s*\{([\s\S]*?)\n\}/);
|
|
if (!block) {
|
|
throw new Error(`no @theme block found in ${SOURCE}`);
|
|
}
|
|
|
|
// Declarations only — comments and blank lines don't survive the trip.
|
|
const decls = block[1]
|
|
.split("\n")
|
|
.map((line) => line.trim())
|
|
.filter((line) => line.startsWith("--"))
|
|
.map((line) => ` ${line}`);
|
|
|
|
if (decls.length === 0) {
|
|
throw new Error(`@theme block in ${SOURCE} declared no custom properties`);
|
|
}
|
|
|
|
mkdirSync(dirname(OUT), { recursive: true });
|
|
writeFileSync(
|
|
OUT,
|
|
[
|
|
`/* GENERATED by scripts/tokens.mjs from ${relative(resolve(here, "../../.."), SOURCE)} — do not edit. */`,
|
|
":root {",
|
|
...decls,
|
|
"}",
|
|
"",
|
|
].join("\n"),
|
|
);
|
|
|
|
console.log(`tokens: wrote ${decls.length} properties to src/styles/tokens.gen.css`);
|