/**
* rGov module — Modular governance decision circuits (GovMods).
*
* Do-ocratic circuit components for multiplayer collaboration around
* shared goals. Wire together governance primitives on a shared canvas:
* signoff gates, resource thresholds, tunable knobs, project aggregators,
* and amendable circuits.
*/
import { Hono } from "hono";
import { renderShell } from "../../server/shell";
import { getModuleInfoList } from "../../shared/module";
import type { RSpaceModule } from "../../shared/module";
import { renderLanding } from "./landing";
const routes = new Hono();
// ── Module page (within a space) ──
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 — GovMods
Do-ocratic circuit components for multiplayer collaboration
Build governance decision circuits by wiring GovMods together on the canvas:
- Signoff Gates — Yes/No approval checkpoints
- Thresholds — Numeric targets (hours, dollars, signatures)
- Knobs — Tunable parameters with temporal viscosity
- Projects — Circuit aggregators showing "X of Y gates satisfied"
- Amendments — Propose in-place circuit modifications
Open Canvas →
`,
}));
});
// ── API: list gov shapes in a space ──
routes.get("/api/shapes", (c) => {
return c.json({
info: "Gov shapes are stored in the space's Automerge document. Query the canvas shapes map for types listed below.",
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: "Modular governance decision circuits (GovMods)",
routes,
scoping: { defaultScope: "space", userConfigurable: false },
landingPage: renderLanding,
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",
],
onboardingActions: [
{ label: "Build a Circuit", icon: "⚖️", description: "Create a governance decision circuit on the canvas", type: 'create', href: '/rgov' },
],
};