Skip to content
TypeScript
5.0 KB
Raw Blame
/**
 * GitHub Pages 사이트 빌드 (report gallery).
 * mock 데모 비교를 1회 실행 → 생성된 self-contained report.html/graph.html 을 site/ 로 복사하고,
 * 알파인(Olympus) 테마의 index.html(랜딩 + 갤러리)을 만든다. 외부 리소스 0(브랜딩 인라인).
 * 실행: `npm run build:site` (tsx scripts/build-site.ts).
 */
import { copyFileSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
import { mkdtempSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { PHILOSOPHY, TAGLINE, THEME, principles, svgWordmark } from "../src/brand";
import { execute } from "../src/orchestrator";

const SITE = "site";
const REPO = "https://github.com/olympusresearch/theseus";

async function main(): Promise<void> {
  rmSync(SITE, { recursive: true, force: true });
  mkdirSync(SITE, { recursive: true });

  const out = mkdtempSync(join(tmpdir(), "theseus-site-"));
  const res = await execute({
    models: ["opus4.8", "gpt5.5"],
    agents: ["cc", "opencode", "codex"],
    harnesses: ["none", "omc", "omo", "ponytail"],
    bench: "subagent",
    tasks: 6,
    runs: 1,
    seed: 7,
    runner: "mock",
    concurrency: 4,
    timeoutS: 30,
    outDir: out,
    judge: "none",
    score: true,
    balanced: false,
    language: "en",
  });

  copyFileSync(res.reportPath, join(SITE, "report.html"));
  copyFileSync(res.graphPath, join(SITE, "graph.html"));
  writeFileSync(join(SITE, ".nojekyll"), "");
  writeFileSync(join(SITE, "index.html"), indexHtml());
  // 보기 좋은 로그
  process.stdout.write(`site built → ${SITE}/ (report.html, graph.html, index.html)\n`);
}

function card(href: string, title: string, body: string): string {
  return `<a class="card" href="${href}">
    <h2>${title}</h2>
    <p>${body}</p>
    <span class="go">open →</span>
  </a>`;
}

function indexHtml(): string {
  return `<!doctype html><html lang="en"><head><meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>theseus — compare model × agent × harness</title>
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='6' fill='%230a0b0d'/%3E%3Cpath d='M5 24 L12 10 L15 15 L19 7 L23 16 L27 24 Z' fill='%23eef0f2'/%3E%3C/svg%3E">
<style>
:root{color-scheme:dark}
body{font-family:ui-sans-serif,system-ui,sans-serif;background:${THEME.sea};color:${THEME.sail};margin:0;padding:0;line-height:1.5}
.wrap{max-width:860px;margin:0 auto;padding:40px 24px 64px}
header{display:flex;align-items:center;gap:16px;margin-bottom:8px}
.tag{opacity:.85}
.phil{color:${THEME.foam};font-style:italic;margin:18px 0 28px;border-left:3px solid ${THEME.rope};padding-left:14px}
.cards{display:grid;grid-template-columns:1fr 1fr;gap:16px}
@media(max-width:620px){.cards{grid-template-columns:1fr}}
.card{display:block;background:${THEME.hull};border:1px solid rgba(255,255,255,.08);border-radius:14px;padding:18px 20px;text-decoration:none;color:${THEME.sail};transition:.15s}
.card:hover{border-color:${THEME.rope};transform:translateY(-2px)}
.card h2{margin:0 0 6px;font-size:17px}
.card p{margin:0 0 10px;font-size:13px;opacity:.85}
.go{color:${THEME.rope};font-weight:700;font-size:13px}
.banner{background:rgba(205,159,90,.12);border:1px solid #8a6a3a;color:#d9b98a;padding:9px 13px;border-radius:9px;font-size:13px;margin:24px 0}
.links{margin-top:28px;font-size:13px}
.links a{color:${THEME.rope};text-decoration:none;font-weight:600}
.principles{margin-top:36px;color:#565b62;font-size:10px;letter-spacing:.18em;text-align:center}
.foot{margin-top:16px;color:${THEME.mist};font-size:12px}
code{font-family:ui-monospace,monospace;background:rgba(255,255,255,.06);padding:1px 6px;border-radius:5px}
</style></head><body><div class="wrap">
<header>${svgWordmark()}<span class="tag">${TAGLINE.en}</span></header>
<p class="phil">▲ ${PHILOSOPHY.en}</p>

<div class="banner">This gallery is a <b>mock</b> (offline, deterministic) demo run — synthetic numbers, not real measurements. Run it yourself with <code>theseus --runner mock …</code>.</div>

<div class="cards">
  ${card("./report.html", "Comparison report", "Accuracy, efficiency, cost/accuracy Pareto frontier, task pass/fail matrix, failure causes — one self-contained page.")}
  ${card("./graph.html", "Subagent flow graph", "Per-combo call-flow card tree: main loop → subagents, depth, tokens, cost, with expandable per-node detail.")}
</div>

<div class="links">
  → <a href="${REPO}">Source &amp; docs on GitHub</a>
  &nbsp;·&nbsp; <a href="${REPO}/blob/main/docs/visualization.md">Visualization modes</a>
  &nbsp;·&nbsp; <a href="${REPO}/blob/main/docs/brand.md">Philosophy</a>
</div>

<div class="principles">${principles("en")
    .map(([t]) => t.toUpperCase())
    .join("&nbsp;&nbsp;·&nbsp;&nbsp;")}</div>
<p class="foot">Generated by <code>npm run build:site</code> · regenerated by CI on every push to <code>main</code>.</p>
</div></body></html>`;
}

main().catch((e) => {
  process.stderr.write(`build-site failed: ${(e as Error).message}\n`);
  process.exitCode = 1;
});