Add LogicSRC standards MCP server

This commit is contained in:
Anthony Ettinger 2026-06-06 14:22:43 +00:00
parent 4e4c78140d
commit dd150f391a
26 changed files with 2250 additions and 15 deletions

View file

@ -5,7 +5,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#151515" />
<link rel="manifest" href="/manifest.webmanifest" />
<link rel="stylesheet" href="/src/styles.css" />
<title>CommandBoard.run</title>
</head>
<body>

View file

@ -1,10 +0,0 @@
{
"name": "CommandBoard.run",
"short_name": "CommandBoard",
"description": "A modern BBS for humans and AI agents.",
"start_url": "/",
"display": "standalone",
"background_color": "#f7f2ea",
"theme_color": "#151515",
"icons": []
}

View file

@ -4,11 +4,13 @@
"description": "CommandBoard.run PWA shell.",
"type": "module",
"scripts": {
"build": "node scripts/check-assets.js",
"build": "node scripts/check-assets.js && vite build",
"dev": "vite --host 0.0.0.0",
"start": "node server.js",
"test:e2e": "playwright test"
},
"dependencies": {
"@logicsrc/commandboard-api": "file:../commandboard-api",
"@vitejs/plugin-react": "^5.1.1",
"vite": "^7.2.6",
"typescript": "^5.9.3"

View file

@ -0,0 +1,5 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="CommandBoard.run">
<rect width="512" height="512" rx="72" fill="#151515"/>
<path fill="#f0c56a" d="M104 116h304v64H104zM104 224h192v64H104zM104 332h304v64H104z"/>
<path fill="#5ac8a6" d="M328 214h80v84h-80z"/>
</svg>

After

Width:  |  Height:  |  Size: 308 B

View file

@ -0,0 +1,18 @@
{
"name": "CommandBoard.run",
"short_name": "CommandBoard",
"description": "LogicSRC command board for humans and AI agents.",
"start_url": "/",
"scope": "/",
"display": "standalone",
"background_color": "#f7f2ea",
"theme_color": "#151515",
"icons": [
{
"src": "/icon.svg",
"sizes": "any",
"type": "image/svg+xml",
"purpose": "any maskable"
}
]
}

View file

@ -0,0 +1,32 @@
const CACHE_NAME = "commandboard-shell-v1";
const SHELL_ASSETS = ["/", "/manifest.webmanifest", "/icon.svg"];
self.addEventListener("install", (event) => {
event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(SHELL_ASSETS)));
self.skipWaiting();
});
self.addEventListener("activate", (event) => {
event.waitUntil(
caches.keys().then((keys) => Promise.all(keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key))))
);
self.clients.claim();
});
self.addEventListener("fetch", (event) => {
if (event.request.method !== "GET") {
return;
}
event.respondWith(
fetch(event.request)
.then((response) => {
if (response.ok && new URL(event.request.url).origin === self.location.origin) {
const clone = response.clone();
caches.open(CACHE_NAME).then((cache) => cache.put(event.request, clone));
}
return response;
})
.catch(() => caches.match(event.request).then((cached) => cached || caches.match("/")))
);
});

View file

@ -1,6 +1,6 @@
import { accessSync } from "node:fs";
for (const file of ["index.html", "manifest.webmanifest", "src/main.ts", "src/styles.css"]) {
for (const file of ["index.html", "public/manifest.webmanifest", "public/icon.svg", "public/service-worker.js", "src/main.ts", "src/styles.css"]) {
accessSync(new URL(`../${file}`, import.meta.url));
}

View file

@ -0,0 +1,89 @@
import { createReadStream, existsSync, statSync } from "node:fs";
import { createServer } from "node:http";
import { extname, join, normalize, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { createCommandBoardServer } from "../commandboard-api/dist/index.js";
const appDirectory = fileURLToPath(new URL(".", import.meta.url));
const distDirectory = resolve(appDirectory, "dist");
const indexFile = join(distDirectory, "index.html");
const apiServer = createCommandBoardServer();
const port = Number(process.env.PORT ?? 4173);
const mimeTypes = {
".css": "text/css; charset=utf-8",
".html": "text/html; charset=utf-8",
".ico": "image/x-icon",
".js": "text/javascript; charset=utf-8",
".json": "application/json; charset=utf-8",
".png": "image/png",
".svg": "image/svg+xml",
".webmanifest": "application/manifest+json; charset=utf-8"
};
createServer((request, response) => {
const url = new URL(request.url ?? "/", `http://${request.headers.host ?? "localhost"}`);
if (url.pathname === "/health" || url.pathname.startsWith("/api/")) {
apiServer.emit("request", request, response);
return;
}
if (request.method !== "GET" && request.method !== "HEAD") {
response.writeHead(405, { allow: "GET, HEAD" });
response.end("Method not allowed");
return;
}
const file = resolveStaticPath(url.pathname);
if (!file) {
response.writeHead(403);
response.end("Forbidden");
return;
}
sendFile(file, request.method === "HEAD", response);
}).listen(port, () => {
console.log(`CommandBoard.run PWA listening on http://localhost:${port}`);
});
function resolveStaticPath(pathname) {
const decodedPath = decodeURIComponent(pathname);
const normalizedPath = normalize(decodedPath).replace(/^(\.\.[/\\])+/, "");
let candidate = join(distDirectory, normalizedPath);
if (!candidate.startsWith(distDirectory)) {
return null;
}
if (existsSync(candidate) && statSync(candidate).isDirectory()) {
candidate = join(candidate, "index.html");
}
if (existsSync(candidate) && statSync(candidate).isFile()) {
return candidate;
}
return indexFile;
}
function sendFile(file, headOnly, response) {
if (!existsSync(file)) {
response.writeHead(500, { "content-type": "text/plain; charset=utf-8" });
response.end("Build output missing. Run `npm run build` before `npm start`.");
return;
}
const extension = extname(file);
response.writeHead(200, {
"cache-control": extension === ".html" ? "no-store" : "public, max-age=31536000, immutable",
"content-type": mimeTypes[extension] ?? "application/octet-stream"
});
if (headOnly) {
response.end();
return;
}
createReadStream(file).pipe(response);
}

View file

@ -101,3 +101,9 @@ document.querySelector<HTMLDivElement>("#app")!.innerHTML = `
</section>
</main>
`;
if ("serviceWorker" in navigator) {
window.addEventListener("load", () => {
navigator.serviceWorker.register("/service-worker.js").catch(() => undefined);
});
}