/**
* 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: `
⚖️ rGov
Multiplayer governance decision circuits
Build decision-making systems by wiring together governance components on the canvas:
- Binary Gates — Yes/No signoff checkpoints
- Thresholds — Numeric targets (hours, dollars, signatures)
- Knobs — Adjustable parameters with optional cooldowns
- Projects — Circuit aggregators showing overall progress
- Amendments — Propose changes to any gate in the circuit
Open Canvas →
`,
}));
});
// ── 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",
],
};