90 lines
2.9 KiB
TypeScript
90 lines
2.9 KiB
TypeScript
/**
|
|
* rGov module — Multiplayer governance decision circuits.
|
|
*
|
|
* Visual circuit builder where people assemble governance decision-making
|
|
* systems from drag-and-drop components: binary gates, thresholds, knobs,
|
|
* projects, and amendments.
|
|
*/
|
|
|
|
import { Hono } from "hono";
|
|
import { renderShell } from "../../server/shell";
|
|
import { getModuleInfoList } from "../../shared/module";
|
|
import type { RSpaceModule } from "../../shared/module";
|
|
|
|
const routes = new Hono();
|
|
|
|
// ── Landing page ──
|
|
|
|
routes.get("/", (c) => {
|
|
const space = c.req.param("space") || "demo";
|
|
|
|
return c.html(renderShell({
|
|
title: `${space} — rGov | rSpace`,
|
|
moduleId: "rgov",
|
|
spaceSlug: space,
|
|
modules: getModuleInfoList(),
|
|
theme: "dark",
|
|
body: `
|
|
<div style="max-width:640px;margin:60px auto;padding:0 24px;color:#e2e8f0;font-family:system-ui,sans-serif;">
|
|
<h1 style="font-size:28px;margin-bottom:8px;">⚖️ rGov</h1>
|
|
<p style="color:#94a3b8;margin-bottom:24px;">Multiplayer governance decision circuits</p>
|
|
<p style="color:#cbd5e1;line-height:1.6;margin-bottom:16px;">
|
|
Build decision-making systems by wiring together governance components on the canvas:
|
|
</p>
|
|
<ul style="color:#cbd5e1;line-height:1.8;margin-bottom:24px;padding-left:20px;">
|
|
<li><strong>Binary Gates</strong> — Yes/No signoff checkpoints</li>
|
|
<li><strong>Thresholds</strong> — Numeric targets (hours, dollars, signatures)</li>
|
|
<li><strong>Knobs</strong> — Adjustable parameters with optional cooldowns</li>
|
|
<li><strong>Projects</strong> — Circuit aggregators showing overall progress</li>
|
|
<li><strong>Amendments</strong> — Propose changes to any gate in the circuit</li>
|
|
</ul>
|
|
<a href="/${space}/rspace" style="display:inline-block;background:#1d4ed8;color:white;padding:10px 20px;border-radius:8px;text-decoration:none;font-weight:600;">
|
|
Open Canvas →
|
|
</a>
|
|
</div>
|
|
`,
|
|
}));
|
|
});
|
|
|
|
// ── API: list gov shapes in a space ──
|
|
|
|
routes.get("/api/shapes", (c) => {
|
|
// This is a lightweight endpoint — actual shape data lives in Automerge.
|
|
// Client-side code queries the shapes map directly.
|
|
return c.json({
|
|
info: "Gov shapes are stored in the space's Automerge document. Query the canvas shapes map for types: folk-gov-binary, folk-gov-threshold, folk-gov-knob, folk-gov-project, folk-gov-amendment.",
|
|
types: [
|
|
"folk-gov-binary",
|
|
"folk-gov-threshold",
|
|
"folk-gov-knob",
|
|
"folk-gov-project",
|
|
"folk-gov-amendment",
|
|
],
|
|
});
|
|
});
|
|
|
|
// ── Module export ──
|
|
|
|
export const govModule: RSpaceModule = {
|
|
id: "rgov",
|
|
name: "rGov",
|
|
icon: "⚖️",
|
|
description: "Multiplayer governance decision circuits",
|
|
routes,
|
|
scoping: { defaultScope: "space", userConfigurable: false },
|
|
canvasShapes: [
|
|
"folk-gov-binary",
|
|
"folk-gov-threshold",
|
|
"folk-gov-knob",
|
|
"folk-gov-project",
|
|
"folk-gov-amendment",
|
|
],
|
|
canvasToolIds: [
|
|
"create_binary_gate",
|
|
"create_threshold",
|
|
"create_gov_knob",
|
|
"create_gov_project",
|
|
"create_amendment",
|
|
],
|
|
};
|