Skip to content

stark-ai-de/agent-skills / plugins/stark-ai-developer/skills/visual-reports

visual-reports

Verified

Create and update visual reports with optional native interaction, one guided topic at a time, useful diagrams, concise points, joint comparisons and complete offline HTML/Markdown/JSON exports. Use when richer output helps an authorized answer or the user asks for a visual report; keep small answers in chat. Not production application UI or clinical advice.

FileKindSize
SKILL.mdskill md11.5 KB
agents/openai.yamlconfig779 B
assets/completion-example.mdmarkdown3.2 KB
assets/graphite-grain/configurator.htmlother17.7 KB
assets/graphite-grain/configurator.mjsscript6.9 KB
assets/graphite-grain/relaxed.cssother4.2 KB
assets/openai-icon.pngbinary10.3 KB
assets/openai-icon.svgother318 B
assets/preview.jsscript3.4 KB
assets/report-recipes.mjsscript19.2 KB
assets/report-runtime.cssother16.4 KB
assets/report-runtime.jsscript23.9 KB
assets/report-shell.htmlother14.1 KB
references/comparisons.mdmarkdown4.8 KB
references/filesystem-handoff.mdmarkdown4.7 KB
references/managed-reports.mdmarkdown5.2 KB
references/markdown-input.mdmarkdown3.9 KB
references/model-v2.mdmarkdown10.1 KB
references/renderer.mdmarkdown24.5 KB
references/report-contract.mdmarkdown33.1 KB
references/selection.mdmarkdown4.8 KB
scripts/benchmark.mjsscript2.2 KB
scripts/cache_icon.pyscript9.2 KB
scripts/export-assets.mjsscript4.1 KB
scripts/lib/blocks-v2.mjsscript21.7 KB
scripts/lib/cli.mjsscript3.7 KB
scripts/lib/export-path.mjsscript1.6 KB
scripts/lib/generator-entry.mjsscript472 B
scripts/lib/markdown-input.mjsscript9.8 KB
scripts/lib/preview.mjsscript4.9 KB
scripts/lib/report-state.mjsscript13.4 KB
scripts/lib/report-store.mjsscript7.0 KB
scripts/lib/templates.mjsscript4.7 KB
scripts/render-report.mjsscript40.0 KB
tests/browser-delivery.mjsscript25.4 KB
tests/browser-smoke.pyscript15.5 KB
tests/browser-topics.mjsscript21.1 KB
tests/cache-icon.test.mjsscript5.0 KB
tests/export-assets.test.mjsscript5.5 KB
tests/render-report.test.mjsscript14.3 KB
tests/report-state.test.mjsscript11.7 KB
tests/topics.test.mjsscript6.4 KB
tests/v2.test.mjsscript21.1 KB

scripts/lib/preview.mjs

View on GitHub
// Read-only session-owned loopback preview. SPDX-License-Identifier: Apache-2.0
import http from "node:http";
import { readFile } from "node:fs/promises";
import { createHash } from "node:crypto";
import { currentRevision, history, readRevision } from "./report-store.mjs";
export async function serveReport(directory, { port = 0 } = {}) {
  if (!Number.isInteger(port) || port < 0 || port > 65535)
    throw new TypeError("Invalid preview port");
  if (!(await currentRevision(directory)))
    throw new Error("Create a managed report before previewing it");
  const runtime = await readFile(new URL("../../assets/preview.js", import.meta.url), "utf8");
  const digest = createHash("sha256").update(runtime).digest("base64");
  const page = `<!doctype html><html lang="de"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Visual Reports · Vorschau</title><style>html,body{margin:0;height:100%;font:15px system-ui;background:#202124;color:#e7e7e5}body{display:flex;flex-direction:column}footer{padding:.7rem 1rem;display:flex;gap:.6rem;flex-wrap:wrap;align-items:center;border-top:1px dashed #666}button,select{font:inherit;color:inherit;background:#292b2f;border:1px solid #888;padding:.4rem}a{color:#a9d9cf}iframe{flex:1;width:100%;border:0;min-height:0}#notice{margin:.35rem 0;font-size:.85rem;color:#b6b7ba}details>summary{cursor:pointer;font-size:.85rem}details .controls{display:flex;gap:.6rem;flex-wrap:wrap;align-items:center;margin-top:.6rem}.tool-caption{font-size:.85rem;color:#b6b7ba}button:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid #a9d9cf}label{display:flex;gap:.4rem;align-items:center}</style><iframe id="report" title="Vollständiger Report"></iframe><footer aria-label="Vorschau-Tooling"><details id="preview-toolbox"><summary>Vorschau-Werkzeuge · Versionen &amp; Export</summary><p class="tool-caption">Bedienung der Vorschau, kein Teil des Reportinhalts.</p><div class="controls"><label>Version <select id="versions" aria-label="Version"></select></label><button id="apply">Übernehmen</button><button id="draft">Entwurf exportieren</button><label><input id="discard" type="checkbox">Ungesicherten Entwurf verwerfen</label><a id="html" target="_blank" rel="noopener">HTML einzeln öffnen</a><a id="md">Markdown</a><a id="json">JSON</a></div></details><p id="notice" role="status" aria-live="polite">Wird geladen …</p></footer><script>${runtime}</script></html>`;
  const server = http.createServer(async (req, res) => {
    const headers = {
      "Cache-Control": "no-store",
      "X-Content-Type-Options": "nosniff",
      "Referrer-Policy": "no-referrer",
    };
    try {
      if (req.method !== "GET" && req.method !== "HEAD") {
        res.writeHead(405, headers);
        res.end();
        return;
      }
      if (!/^(?:localhost|127\.0\.0\.1):\d+$/.test(req.headers.host ?? "")) {
        res.writeHead(403, headers);
        res.end("Loopback Host required");
        return;
      }
      const url = new URL(req.url, "http://localhost");
      let body, type;
      if (url.pathname === "/") {
        body = page;
        type = "text/html; charset=utf-8";
        headers["Content-Security-Policy"] =
          `default-src 'none'; script-src 'sha256-${digest}'; style-src 'unsafe-inline'; frame-src 'self'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'self'`;
      } else if (url.pathname === "/current") {
        const current = await currentRevision(directory);
        // History derives from the same pointer; a concurrent update appears next poll.
        const entries = await history(directory, { head: current?.revision ?? null });
        body = JSON.stringify({ ...current, history: entries });
        type = "application/json";
      } else {
        const match = url.pathname.match(
          /^\/revision\/(\d{13}-[a-f0-9-]{36})\/report\.(html|md|json)$/,
        );
        if (!match) {
          res.writeHead(404, headers);
          res.end("Not found");
          return;
        }
        const output = await readRevision(directory, match[1]);
        body = output[match[2]];
        type = {
          html: "text/html; charset=utf-8",
          md: "text/plain; charset=utf-8",
          json: "application/json",
        }[match[2]];
      }
      res.writeHead(200, { ...headers, "Content-Type": type });
      res.end(req.method === "HEAD" ? undefined : body);
    } catch (e) {
      res.writeHead(500, { ...headers, "Content-Type": "text/plain" });
      res.end(
        `Preview unavailable: ${e.code ?? e.name}. Inspect the local CLI for the store state.`,
      );
    }
  });
  await new Promise((resolve, reject) => {
    server.once("error", reject);
    server.listen(port, "127.0.0.1", resolve);
  });
  return {
    server,
    url: `http://localhost:${server.address().port}/`,
    close: () => new Promise((resolve, reject) => server.close((e) => (e ? reject(e) : resolve()))),
  };
}
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall