flop-guild 0.2.4 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/autopilot.js +129 -28
- package/dist/content.js +256 -0
- package/dist/flop.js +55 -17
- package/dist/minerpage.js +7 -9
- package/dist/server.js +131 -118
- package/dist/shell.js +144 -0
- package/dist/sync-docs.js +19 -0
- package/package.json +2 -2
- package/site/copy.js +3 -1
- package/site/fonts/Inter-LICENSE.txt +93 -0
- package/site/fonts/SpaceMono-LICENSE.txt +93 -0
- package/site/fonts/inter-latin-400-normal.woff2 +0 -0
- package/site/fonts/inter-latin-600-normal.woff2 +0 -0
- package/site/fonts/space-mono-latin-700-normal.woff2 +0 -0
- package/site/guides/agent-quickstart.md +23 -5
- package/site/guides/autopilot.md +10 -5
- package/site/guides/claude-vps.md +134 -0
- package/site/guides/manual-pc.md +65 -0
- package/site/index.html +19 -18
- package/site/llms.txt +7 -4
- package/site/skill.md +16 -1
- package/site/start.html +17 -7
- package/site/tabs.js +80 -0
- package/skill.md +153 -0
package/dist/server.js
CHANGED
|
@@ -5,8 +5,10 @@ import { createServer } from "node:http";
|
|
|
5
5
|
import { readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
6
6
|
import { dirname, join } from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
|
-
import { GUILD_ROOM,
|
|
8
|
+
import { GUILD_ROOM, publicHost, render } from "./config.js";
|
|
9
9
|
import { networksPath } from "./net.js";
|
|
10
|
+
import { esc, ICONS, page } from "./shell.js";
|
|
11
|
+
import { expand, GUIDES, guidesHtml, mdToHtml, ROLES, roleMd, rolesHtml, rolesMd } from "./content.js";
|
|
10
12
|
const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
11
13
|
const SITE = join(ROOT, "site");
|
|
12
14
|
const VERSION = JSON.parse(readFileSync(join(ROOT, "package.json"), "utf8")).version;
|
|
@@ -19,107 +21,7 @@ const guideNames = readdirSync(join(SITE, "guides"))
|
|
|
19
21
|
function guideMd(name) {
|
|
20
22
|
if (!guideNames.includes(name))
|
|
21
23
|
return undefined;
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
const esc = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
25
|
-
/** Small Markdown subset: headings, paragraphs, lists, indented code, inline code and links. */
|
|
26
|
-
function mdToHtml(md) {
|
|
27
|
-
const inline = (s) => esc(s)
|
|
28
|
-
.replace(/`([^`]+)`/g, "<code>$1</code>")
|
|
29
|
-
.replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+|\/[^)\s]*)\)/g, '<a href="$2">$1</a>');
|
|
30
|
-
const out = [];
|
|
31
|
-
let para = [];
|
|
32
|
-
let list = [];
|
|
33
|
-
let ordered = false;
|
|
34
|
-
let code = [];
|
|
35
|
-
const flush = () => {
|
|
36
|
-
if (para.length)
|
|
37
|
-
out.push(`<p>${inline(para.join(" "))}</p>`), (para = []);
|
|
38
|
-
if (list.length)
|
|
39
|
-
out.push(`<${ordered ? "ol" : "ul"}>${list.map((l) => `<li>${inline(l)}</li>`).join("")}</${ordered ? "ol" : "ul"}>`), (list = []);
|
|
40
|
-
if (code.length)
|
|
41
|
-
out.push(`<pre><code>${esc(code.join("\n"))}</code></pre>`), (code = []);
|
|
42
|
-
};
|
|
43
|
-
for (const line of md.split("\n")) {
|
|
44
|
-
if (/^ {4}/.test(line) && !list.length) {
|
|
45
|
-
if (para.length)
|
|
46
|
-
flush();
|
|
47
|
-
code.push(line.slice(4));
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (code.length && line.trim() === "") {
|
|
51
|
-
code.push("");
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
if (code.length) {
|
|
55
|
-
while (code.at(-1) === "")
|
|
56
|
-
code.pop();
|
|
57
|
-
flush();
|
|
58
|
-
}
|
|
59
|
-
const h = line.match(/^(#{1,3}) (.*)$/);
|
|
60
|
-
const li = line.match(/^(?:- |(\d+)\. )(.*)$/);
|
|
61
|
-
if (h)
|
|
62
|
-
flush(), out.push(`<h${h[1].length}>${inline(h[2])}</h${h[1].length}>`);
|
|
63
|
-
else if (li) {
|
|
64
|
-
if (para.length)
|
|
65
|
-
flush();
|
|
66
|
-
ordered = !!li[1];
|
|
67
|
-
list.push(li[2]);
|
|
68
|
-
}
|
|
69
|
-
else if (line.trim() === "")
|
|
70
|
-
flush();
|
|
71
|
-
else if (list.length && /^ {2,}/.test(line))
|
|
72
|
-
list[list.length - 1] += " " + line.trim();
|
|
73
|
-
else
|
|
74
|
-
para.push(line.trim());
|
|
75
|
-
}
|
|
76
|
-
while (code.at(-1) === "")
|
|
77
|
-
code.pop();
|
|
78
|
-
flush();
|
|
79
|
-
return out.join("\n");
|
|
80
|
-
}
|
|
81
|
-
export const RUN_IN_SHELL = "Run in: Ubuntu, macOS Terminal, or WSL on Windows (not PowerShell)";
|
|
82
|
-
export const RUN_IN_POWERSHELL = "Run in: PowerShell";
|
|
83
|
-
export const FILE_CONTENTS = "File contents, not a command: save as the file named above";
|
|
84
|
-
/** Label for a code block: JSON is file contents, $env: means PowerShell, anything else is a POSIX shell. */
|
|
85
|
-
function codeLabel(html) {
|
|
86
|
-
const t = html.trim();
|
|
87
|
-
if (/^[{[]/.test(t))
|
|
88
|
-
return FILE_CONTENTS;
|
|
89
|
-
if (/\$env:/i.test(t))
|
|
90
|
-
return RUN_IN_POWERSHELL;
|
|
91
|
-
return RUN_IN_SHELL;
|
|
92
|
-
}
|
|
93
|
-
/** Put a muted label above every code block and mark it for /copy.js. */
|
|
94
|
-
function decorateCode(body) {
|
|
95
|
-
return body.replace(/<pre><code>([\s\S]*?)<\/code><\/pre>/g, (_m, code) => `<div class="codebox"><p class="runin">${esc(codeLabel(code))}</p><pre class="copyable"><code>${code}</code></pre></div>`);
|
|
96
|
-
}
|
|
97
|
-
function page(title, body, o = {}) {
|
|
98
|
-
body = decorateCode(body);
|
|
99
|
-
const copy = body.includes('class="copyable"') ? '<script defer src="/copy.js"></script>' : "";
|
|
100
|
-
return `<!doctype html>
|
|
101
|
-
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
|
|
102
|
-
<title>${esc(title)}</title>
|
|
103
|
-
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
|
104
|
-
<style>
|
|
105
|
-
:root{--bg:#fbfaf7;--fg:#1d1c1a;--muted:#5d5a54;--line:#e4e0d8;--accent:#2f5d50;--code:#f1eee7}
|
|
106
|
-
@media (prefers-color-scheme: dark){:root{--bg:#141412;--fg:#ecebe6;--muted:#a3a097;--line:#2c2b28;--accent:#8cc5b1;--code:#1f1e1b}}
|
|
107
|
-
body{margin:0;background:var(--bg);color:var(--fg);font:16px/1.6 system-ui,sans-serif}
|
|
108
|
-
main{max-width:44rem;margin:0 auto;padding:2rem 16px 3rem}
|
|
109
|
-
a{color:var(--accent)}h1,h2,h3{line-height:1.25}
|
|
110
|
-
code{background:var(--code);padding:.1em .3em;border-radius:4px;font-size:.92em;overflow-wrap:anywhere}
|
|
111
|
-
pre{background:var(--code);padding:.8rem 1rem;border-radius:6px;overflow-x:auto}pre code{padding:0}
|
|
112
|
-
nav{margin-bottom:1.5rem}.brand{display:inline-flex;align-items:center;gap:.5rem;color:var(--fg);text-decoration:none}
|
|
113
|
-
.brand img{display:block;border-radius:5px}.wm{font-size:1.2rem;letter-spacing:-.03em}.wm b{font-weight:600}.wm span{font-weight:400}footer{border-top:1px solid var(--line);margin-top:2.5rem;padding-top:1rem;color:var(--muted);font-size:.9rem}
|
|
114
|
-
.codebox{position:relative;margin:0 0 1rem}.runin{margin:.8rem 0 .2rem;color:var(--muted);font-size:.85rem}
|
|
115
|
-
.codebox button.copy{position:absolute;right:.4rem;bottom:.4rem;font:inherit;font-size:.8rem;padding:.15rem .55rem;border-radius:5px;border:1px solid var(--line);background:var(--bg);color:var(--fg);cursor:pointer}
|
|
116
|
-
.codebox pre{padding-right:5rem;margin:0}
|
|
117
|
-
${o.style ?? ""}
|
|
118
|
-
</style>${copy}${o.script ? `<script ${o.module ? 'type="module"' : "defer"} src="${o.script}"></script>` : ""}</head><body><main>
|
|
119
|
-
<nav><a class="brand" href="/" aria-label="flopguild home"><img src="/logo.svg" alt="" width="26" height="26"><span class="wm"><span>flop</span><b>guild</b></span></a></nav>
|
|
120
|
-
${body}
|
|
121
|
-
<footer>${o.footerNote ? `<p>${esc(o.footerNote)}</p>` : ""}via flop-guild · <a href="${GUILD_ROOM_URL}">join the guild room ${GUILD_ROOM}</a></footer>
|
|
122
|
-
</main></body></html>`;
|
|
24
|
+
return expand(readFileSync(join(SITE, "guides", `${name}.md`), "utf8"));
|
|
123
25
|
}
|
|
124
26
|
// ---------- read-only MCP tools ----------
|
|
125
27
|
const cache = new Map();
|
|
@@ -206,14 +108,16 @@ function autopilotInstall() {
|
|
|
206
108
|
const tools = [
|
|
207
109
|
{
|
|
208
110
|
name: "get_guide",
|
|
209
|
-
description: `Return a flop-guild guide as Markdown.
|
|
210
|
-
inputSchema: { type: "object", properties: { name: { type: "string", enum: [...guideNames, "skill", "llms"] } }, required: ["name"] },
|
|
111
|
+
description: `Return a flop-guild guide as Markdown, the same text as the website. Guides: ${GUIDES.map((g) => `${g.slug} (${g.title})`).join("; ")}. Also: roles (Agent, Miner and Validator steps), skill, llms.`,
|
|
112
|
+
inputSchema: { type: "object", properties: { name: { type: "string", enum: [...new Set([...GUIDES.map((g) => g.slug), ...guideNames]), "roles", "skill", "llms"] } }, required: ["name"] },
|
|
211
113
|
run: async (a) => {
|
|
212
114
|
const n = String(a.name ?? "");
|
|
115
|
+
if (n === "roles")
|
|
116
|
+
return expand(rolesMd(2));
|
|
213
117
|
if (n === "skill")
|
|
214
|
-
return
|
|
118
|
+
return expand(readFileSync(join(SITE, "skill.md"), "utf8"));
|
|
215
119
|
if (n === "llms")
|
|
216
|
-
return
|
|
120
|
+
return expand(readFileSync(join(SITE, "llms.txt"), "utf8"));
|
|
217
121
|
const g = guideMd(n);
|
|
218
122
|
if (!g)
|
|
219
123
|
throw new Error(`unknown guide "${n}"`);
|
|
@@ -226,6 +130,17 @@ const tools = [
|
|
|
226
130
|
inputSchema: { type: "object", properties: { network: { type: "string", description: "default devnet" } } },
|
|
227
131
|
run: (a) => networkStatus(String(a.network ?? "devnet")),
|
|
228
132
|
},
|
|
133
|
+
{
|
|
134
|
+
name: "get_role_steps",
|
|
135
|
+
description: `What you need and the numbered steps for one role (${ROLES.map((r) => r.id).join(", ")}), the same text as the website's role tabs.`,
|
|
136
|
+
inputSchema: { type: "object", properties: { role: { type: "string", enum: ROLES.map((r) => r.id) } }, required: ["role"] },
|
|
137
|
+
run: async (a) => {
|
|
138
|
+
const r = ROLES.find((x) => x.id === String(a.role ?? ""));
|
|
139
|
+
if (!r)
|
|
140
|
+
throw new Error(`unknown role; known: ${ROLES.map((x) => x.id).join(", ")}`);
|
|
141
|
+
return expand(roleMd(r, 2));
|
|
142
|
+
},
|
|
143
|
+
},
|
|
229
144
|
{
|
|
230
145
|
name: "join_guild",
|
|
231
146
|
description: "How to join the open flop-guild room on technocore.chat.",
|
|
@@ -285,26 +200,111 @@ const START_CSP = [
|
|
|
285
200
|
"script-src 'self'",
|
|
286
201
|
"style-src 'unsafe-inline'",
|
|
287
202
|
"img-src 'self'",
|
|
203
|
+
"font-src 'self'",
|
|
288
204
|
"connect-src https://technocore.chat",
|
|
289
205
|
"base-uri 'none'",
|
|
290
206
|
"form-action 'none'",
|
|
291
207
|
"frame-ancestors 'none'",
|
|
292
208
|
].join("; ");
|
|
293
209
|
const START_STYLE = `
|
|
294
|
-
.grid{display:grid;grid-template-columns:
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
.
|
|
210
|
+
.start-grid{display:grid;gap:1rem;grid-template-columns:minmax(0,1fr)}
|
|
211
|
+
@media (min-width:900px){.start-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.start-grid .wide{grid-column:1/-1}}
|
|
212
|
+
.start-grid .card{margin:0}.card h2{display:flex;align-items:center;gap:.6rem}
|
|
213
|
+
.num{display:inline-grid;place-items:center;width:1.6rem;height:1.6rem;border-radius:50%;border:1px solid var(--line-2);font:700 .8rem/1 var(--display);color:var(--accent);flex:none}
|
|
214
|
+
.didline{font-size:.9rem;color:var(--muted)}#did,#signed-sig,#signed-msg{word-break:break-all}
|
|
215
|
+
ol.next{list-style:none;padding:0;margin:0;counter-reset:n}ol.next>li{counter-increment:n;position:relative;padding-left:2.2rem;margin-bottom:.9rem}
|
|
216
|
+
ol.next>li::before{content:counter(n);position:absolute;left:0;top:.05rem;width:1.6rem;height:1.6rem;border-radius:50%;border:1px solid var(--line-2);display:grid;place-items:center;font:700 .8rem/1 var(--display);color:var(--accent)}`;
|
|
217
|
+
const HOME_STYLE = `
|
|
218
|
+
.stats{display:grid;gap:.8rem;grid-template-columns:repeat(auto-fit,minmax(15rem,1fr));margin:0 0 1.6rem}
|
|
219
|
+
.stat{margin:0;display:flex;flex-direction:column;gap:.45rem}
|
|
220
|
+
.stat-top{display:flex;align-items:center;gap:.6rem}.stat-label{font-size:.82rem;color:var(--muted);flex:1;min-width:0}
|
|
221
|
+
.live{display:inline-flex;align-items:center;gap:.3rem;font:600 .6rem/1 var(--mono);letter-spacing:.08em;color:var(--dim);white-space:nowrap}
|
|
222
|
+
.live::before{content:"";width:.42rem;height:.42rem;border-radius:50%;background:var(--dim)}
|
|
223
|
+
.live.on{color:var(--accent)}.live.on::before{background:var(--accent);box-shadow:0 0 0 3px rgba(140,197,177,.15)}
|
|
224
|
+
.stat-value{font:700 1.45rem/1.15 var(--display);letter-spacing:-.02em;overflow-wrap:anywhere}.stat-value.text{font-size:1.02rem;line-height:1.35}
|
|
225
|
+
.stat-sub{font-size:.8rem;color:var(--muted)}
|
|
226
|
+
.roles{display:flex;gap:.8rem;overflow-x:auto;scroll-snap-type:x mandatory;padding:.15rem .15rem .5rem;margin:0 -.15rem .6rem;scrollbar-width:thin}
|
|
227
|
+
.role{flex:1 0 15.5rem;scroll-snap-align:start;display:flex;flex-direction:column;gap:.5rem;text-align:left;font:inherit;color:var(--fg);background:var(--card);border:1px solid var(--line);border-radius:12px;padding:1rem 1.1rem;cursor:pointer}
|
|
228
|
+
.role:hover{border-color:var(--line-2)}.role[aria-selected=true]{border-color:var(--accent);background:var(--card-2)}
|
|
229
|
+
.role-top{display:flex;align-items:center;gap:.6rem}.role-name{font:700 1.05rem/1 var(--display)}
|
|
230
|
+
.role-sub{font-size:.84rem;color:var(--muted)}
|
|
231
|
+
.prog{display:flex;flex-direction:column;gap:.35rem;margin-top:.2rem}.prog-text{font-size:.75rem;color:var(--muted)}
|
|
232
|
+
.bar{display:block;height:3px;border-radius:2px;background:var(--line-2);overflow:hidden}.fill{display:block;height:100%;width:0;background:var(--accent);transition:width .2s}
|
|
233
|
+
.panel{margin-top:.6rem}.panel-title{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
234
|
+
.panel-grid{display:grid;gap:1rem;grid-template-columns:minmax(0,1fr)}
|
|
235
|
+
@media (min-width:900px){.panel-grid{grid-template-columns:minmax(0,21rem) minmax(0,1fr);align-items:start}.need-card{position:sticky;top:5rem}}
|
|
236
|
+
.need-card{margin:0}table.need{font-size:.88rem}table.need th{width:5.8rem;font-weight:600;color:var(--muted);white-space:nowrap}
|
|
237
|
+
.timeline{list-style:none;margin:0;padding:0;counter-reset:step;position:relative}
|
|
238
|
+
.timeline::before{content:"";position:absolute;left:.95rem;top:.6rem;bottom:.6rem;width:1px;background:var(--line-2)}
|
|
239
|
+
.step{counter-increment:step;position:relative;padding-left:2.9rem;margin-bottom:.8rem}
|
|
240
|
+
.step::before{content:counter(step);position:absolute;left:0;top:.85rem;width:1.95rem;height:1.95rem;border-radius:50%;background:var(--bg);border:1px solid var(--line-2);display:grid;place-items:center;font:700 .8rem/1 var(--display);color:var(--muted)}
|
|
241
|
+
.step.done::before{content:"\\2713";background:var(--accent-deep);border-color:var(--accent);color:#e6f6ef}
|
|
242
|
+
.step-card{margin:0;padding:.85rem 1rem}.step-card>:last-child{margin-bottom:0}.step-card p{margin:.5rem 0 0}
|
|
243
|
+
.step-head{display:flex;align-items:flex-start;gap:.7rem}.step-head h3{margin:0;font:600 .95rem/1.4 "Inter",system-ui,sans-serif}
|
|
244
|
+
.step.done .step-head h3{color:var(--muted)}
|
|
245
|
+
.step-done{appearance:none;-webkit-appearance:none;flex:none;width:1.15rem;height:1.15rem;margin:.12rem 0 0;border:1.5px solid var(--line-2);border-radius:4px;background:#0b1222;cursor:pointer;display:grid;place-items:center}
|
|
246
|
+
.step-done:checked{background:var(--accent);border-color:var(--accent)}
|
|
247
|
+
.step-done:checked::after{content:"";width:.3rem;height:.55rem;border:solid var(--on-accent);border-width:0 2px 2px 0;transform:translateY(-1px) rotate(45deg)}
|
|
248
|
+
.notes{margin-top:.2rem}
|
|
249
|
+
@media (max-width:640px){.step{padding-left:2.4rem}.step::before{width:1.7rem;height:1.7rem}.timeline::before{left:.83rem}.step-card{padding:.75rem .8rem}}
|
|
250
|
+
.section-title{margin:2.2rem 0 .8rem}
|
|
251
|
+
.agent-links{display:grid;gap:.8rem;grid-template-columns:repeat(auto-fit,minmax(15rem,1fr))}
|
|
252
|
+
.link-card{display:flex;gap:.7rem;align-items:flex-start;margin:0;color:var(--fg)}.link-card:hover{text-decoration:none;border-color:var(--line-2)}
|
|
253
|
+
.link-card b{display:block;font-weight:600;margin-bottom:.15rem}.link-card .small{display:block}`;
|
|
299
254
|
const STATIC_JS = {
|
|
300
255
|
"/start.js": { file: "start.js", type: "text/javascript; charset=utf-8" },
|
|
301
256
|
"/start-core.js": { file: "start-core.js", type: "text/javascript; charset=utf-8" },
|
|
302
257
|
"/vendor/noble-ed25519-3.2.0.js": { file: "vendor/noble-ed25519-3.2.0.js", type: "text/javascript; charset=utf-8" },
|
|
303
258
|
"/vendor/noble-ed25519-LICENSE.txt": { file: "vendor/noble-ed25519-LICENSE.txt", type: "text/plain; charset=utf-8" },
|
|
304
259
|
"/copy.js": { file: "copy.js", type: "text/javascript; charset=utf-8" },
|
|
260
|
+
"/tabs.js": { file: "tabs.js", type: "text/javascript; charset=utf-8" },
|
|
305
261
|
"/logo.svg": { file: "logo.svg", type: "image/svg+xml" },
|
|
306
262
|
"/favicon.svg": { file: "favicon.svg", type: "image/svg+xml" },
|
|
307
263
|
};
|
|
264
|
+
const FONTS = ["inter-latin-400-normal.woff2", "inter-latin-600-normal.woff2", "space-mono-latin-700-normal.woff2"];
|
|
265
|
+
// ---------- home stats: only values the kit already reads; a dash when there is none ----------
|
|
266
|
+
let limitsCache;
|
|
267
|
+
let limitsInflight;
|
|
268
|
+
/** Faucet /limits (the same endpoint network_status reads). Never blocks a page for more than 1.5 s. */
|
|
269
|
+
async function faucetLimits() {
|
|
270
|
+
const net = JSON.parse(readFileSync(networksPath(), "utf8")).devnet;
|
|
271
|
+
if ((!limitsCache || Date.now() - limitsCache.at > 60_000) && !limitsInflight && net?.faucet) {
|
|
272
|
+
limitsInflight = getJson(`${net.faucet}/limits`)
|
|
273
|
+
.then((v) => void (limitsCache = { at: Date.now(), v }))
|
|
274
|
+
.catch(() => { })
|
|
275
|
+
.finally(() => (limitsInflight = undefined));
|
|
276
|
+
}
|
|
277
|
+
if (!limitsCache && limitsInflight)
|
|
278
|
+
await Promise.race([limitsInflight, new Promise((r) => setTimeout(r, 1500))]);
|
|
279
|
+
return limitsCache?.v;
|
|
280
|
+
}
|
|
281
|
+
const DASH = "\u2013";
|
|
282
|
+
function stat(icon, label, value, sub, live, liveText, textValue = false) {
|
|
283
|
+
return `<div class="card stat"><div class="stat-top"><span class="tile">${icon}</span><span class="stat-label">${esc(label)}</span><span class="live ${live}">${esc(liveText)}</span></div>
|
|
284
|
+
<div class="stat-value${textValue ? " text" : ""}">${esc(value)}</div><div class="stat-sub">${sub}</div></div>`;
|
|
285
|
+
}
|
|
286
|
+
async function homeStats() {
|
|
287
|
+
const mp = await import("./minerpage.js");
|
|
288
|
+
const [v, limits] = await Promise.all([mp.demand(undefined, 0).catch(() => undefined), faucetLimits().catch(() => undefined)]);
|
|
289
|
+
const nets = JSON.parse(readFileSync(networksPath(), "utf8"));
|
|
290
|
+
const devnet = '<span class="tag">devnet</span>';
|
|
291
|
+
const d = v?.shown;
|
|
292
|
+
const miners = d
|
|
293
|
+
? stat(ICONS.miner, "Miners on devnet", d.minerCount.toLocaleString("en-US"), `active in the last 7 days${d.complete ? "" : ", partial read"} ${devnet}`, "on", "LIVE")
|
|
294
|
+
: stat(ICONS.miner, "Miners on devnet", DASH, `explorer read in progress, refresh in a minute ${devnet}`, "off", "NO DATA");
|
|
295
|
+
const validators = stat(ICONS.validator, "Validators", DASH, `not read by this kit yet ${devnet}`, "off", "NO DATA");
|
|
296
|
+
const cap = Number(limits?.faucet?.dailyCap?.limitFlop);
|
|
297
|
+
const grant = Number(limits?.faucet?.anonymous?.grantFlop);
|
|
298
|
+
const hours = Number(limits?.faucet?.anonymous?.addressCooldownSeconds) / 3600;
|
|
299
|
+
const faucet = Number.isFinite(cap) && cap > 0
|
|
300
|
+
? stat(ICONS.faucet, "Faucet daily limit", `${cap.toLocaleString("en-US")} FLOP`, `whole faucet per day${Number.isFinite(grant) && grant > 0 ? `, ${grant} FLOP per address${Number.isFinite(hours) && hours > 0 ? ` every ${hours} h` : ""}` : ""} ${devnet}`, "on", "LIVE")
|
|
301
|
+
: stat(ICONS.faucet, "Faucet daily limit", DASH, `faucet did not answer ${devnet}`, "off", "NO DATA");
|
|
302
|
+
const t = nets.testnet ?? {};
|
|
303
|
+
const testnet = t.rpc && t.genesis
|
|
304
|
+
? stat(ICONS.clock, "Testnet status", "Endpoints configured", "from networks.json in this kit", "off", "CONFIG", true)
|
|
305
|
+
: stat(ICONS.clock, "Testnet status", "Waiting for Flop endpoints", "no testnet endpoints in networks.json yet", "off", "CONFIG", true);
|
|
306
|
+
return `<div class="stats">${miners}${validators}${faucet}${testnet}</div>`;
|
|
307
|
+
}
|
|
308
308
|
// ---------- HTTP ----------
|
|
309
309
|
function send(res, status, type, body, extra = {}) {
|
|
310
310
|
res.writeHead(status, {
|
|
@@ -312,7 +312,7 @@ function send(res, status, type, body, extra = {}) {
|
|
|
312
312
|
"cache-control": "public, max-age=300",
|
|
313
313
|
"x-content-type-options": "nosniff",
|
|
314
314
|
"referrer-policy": "no-referrer",
|
|
315
|
-
"content-security-policy": "default-src 'none'; style-src 'unsafe-inline'; img-src 'self'; script-src 'self'; connect-src 'self'",
|
|
315
|
+
"content-security-policy": "default-src 'none'; style-src 'unsafe-inline'; img-src 'self'; font-src 'self'; script-src 'self'; connect-src 'self'",
|
|
316
316
|
...extra,
|
|
317
317
|
});
|
|
318
318
|
res.end(body);
|
|
@@ -384,6 +384,13 @@ export function startServer(port, host = "0.0.0.0") {
|
|
|
384
384
|
"cache-control": "no-store",
|
|
385
385
|
});
|
|
386
386
|
}
|
|
387
|
+
const font = path.match(/^\/fonts\/([a-z0-9-]+\.woff2)$/);
|
|
388
|
+
if (font && FONTS.includes(font[1])) {
|
|
389
|
+
res.writeHead(200, { "content-type": "font/woff2", "cache-control": "public, max-age=86400", "x-content-type-options": "nosniff" });
|
|
390
|
+
return res.end(readFileSync(join(SITE, "fonts", font[1])));
|
|
391
|
+
}
|
|
392
|
+
if (path === "/fonts/Inter-LICENSE.txt" || path === "/fonts/SpaceMono-LICENSE.txt")
|
|
393
|
+
return send(res, 200, "text/plain; charset=utf-8", readFileSync(join(SITE, path.slice(1)), "utf8"));
|
|
387
394
|
if (STATIC_JS[path])
|
|
388
395
|
return send(res, 200, STATIC_JS[path].type, readFileSync(join(SITE, STATIC_JS[path].file), "utf8"), { "cache-control": "no-store" });
|
|
389
396
|
if (path === "/miner" || path === "/miner.js" || path === "/api/miner-stats") {
|
|
@@ -400,19 +407,25 @@ export function startServer(port, host = "0.0.0.0") {
|
|
|
400
407
|
: { error: mp.demandError() ?? "loading, try again in a minute", disclaimer: mp.MINER_FOOTER };
|
|
401
408
|
return send(res, d ? 200 : 503, "application/json", JSON.stringify(body, null, 2), fresh);
|
|
402
409
|
}
|
|
403
|
-
return send(res, 200, "text/html; charset=utf-8", page("Miner economics", mp.minerPage(v, mp.demandError()), { footerNote: mp.MINER_FOOTER, style: mp.MINER_STYLE, script: "/miner.js" }), fresh);
|
|
410
|
+
return send(res, 200, "text/html; charset=utf-8", page("Miner economics", mp.minerPage(v, mp.demandError()), { footerNote: mp.MINER_FOOTER, style: mp.MINER_STYLE, script: "/miner.js", cards: true }), fresh);
|
|
411
|
+
}
|
|
412
|
+
if (path === "/") {
|
|
413
|
+
const body = render(readFileSync(join(SITE, "index.html"), "utf8"))
|
|
414
|
+
.replace(/\{\{icon:([a-z]+)\}\}/g, (_m, k) => ICONS[k] ?? "")
|
|
415
|
+
.replace("{{ROLES}}", render(rolesHtml(ICONS)))
|
|
416
|
+
.replace("{{GUIDES}}", guidesHtml(ICONS.doc))
|
|
417
|
+
.replace("{{STATS}}", await homeStats());
|
|
418
|
+
return send(res, 200, "text/html; charset=utf-8", page("flopguild: pick your role", body, { footerNote: START_FOOTER, style: HOME_STYLE, script: "/tabs.js" }), { "cache-control": "public, max-age=60" });
|
|
404
419
|
}
|
|
405
|
-
if (path === "/")
|
|
406
|
-
return send(res, 200, "text/html; charset=utf-8", page("flop-guild", render(readFileSync(join(SITE, "index.html"), "utf8"))));
|
|
407
420
|
if (path === "/llms.txt")
|
|
408
|
-
return send(res, 200, "text/plain; charset=utf-8",
|
|
421
|
+
return send(res, 200, "text/plain; charset=utf-8", expand(readFileSync(join(SITE, "llms.txt"), "utf8")));
|
|
409
422
|
if (path === "/skill.md")
|
|
410
|
-
return send(res, 200, "text/markdown; charset=utf-8",
|
|
423
|
+
return send(res, 200, "text/markdown; charset=utf-8", expand(readFileSync(join(SITE, "skill.md"), "utf8")));
|
|
411
424
|
const g = path.match(/^\/guides\/([a-z0-9-]+)(\.md)?$/);
|
|
412
425
|
if (g) {
|
|
413
426
|
const md = guideMd(g[1]);
|
|
414
427
|
if (md)
|
|
415
|
-
return g[2] ? send(res, 200, "text/markdown; charset=utf-8", md) : send(res, 200, "text/html; charset=utf-8", page(md.split("\n")[0].replace(/^# /, ""), mdToHtml(md)));
|
|
428
|
+
return g[2] ? send(res, 200, "text/markdown; charset=utf-8", md) : send(res, 200, "text/html; charset=utf-8", page(md.split("\n")[0].replace(/^# /, ""), mdToHtml(md), { cards: true }));
|
|
416
429
|
}
|
|
417
430
|
return send(res, 404, "text/plain", "not found\n");
|
|
418
431
|
}
|
package/dist/shell.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// Shared page shell for the site: top bar, cards, terminal-style code blocks, fonts. Dark only.
|
|
2
|
+
// Everything is served from this site: fonts from /fonts, scripts from /copy.js and page scripts.
|
|
3
|
+
import { GUILD_ROOM, GUILD_ROOM_URL } from "./config.js";
|
|
4
|
+
export const esc = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
5
|
+
export const RUN_IN_SHELL = "Run in: Ubuntu, macOS Terminal, or WSL on Windows (not PowerShell)";
|
|
6
|
+
export const RUN_IN_POWERSHELL = "Run in: PowerShell";
|
|
7
|
+
export const FILE_CONTENTS = "File contents, not a command: save as the file named above";
|
|
8
|
+
/** Label for a code block: JSON is file contents, $env: means PowerShell, anything else is a POSIX shell. */
|
|
9
|
+
function codeLabel(html) {
|
|
10
|
+
const t = html.trim();
|
|
11
|
+
if (/^[{[]/.test(t))
|
|
12
|
+
return FILE_CONTENTS;
|
|
13
|
+
if (/\$env:/i.test(t))
|
|
14
|
+
return RUN_IN_POWERSHELL;
|
|
15
|
+
return RUN_IN_SHELL;
|
|
16
|
+
}
|
|
17
|
+
/** Every code block becomes a small terminal card: label strip on top (copy.js adds the button), code below. */
|
|
18
|
+
export function decorateCode(body) {
|
|
19
|
+
return body.replace(/<pre(?: data-runin="([^"]*)")?><code>([\s\S]*?)<\/code><\/pre>/g, (_m, runin, code) => {
|
|
20
|
+
const label = runin ?? esc(codeLabel(code));
|
|
21
|
+
const isCommand = label.startsWith("Run in") && !/prompt/i.test(label); // a Claude Code prompt gets no "$"
|
|
22
|
+
let heredoc; // lines inside a heredoc are file contents, not commands
|
|
23
|
+
const lines = isCommand
|
|
24
|
+
? code
|
|
25
|
+
.split("\n")
|
|
26
|
+
.map((l) => {
|
|
27
|
+
if (heredoc) {
|
|
28
|
+
if (l.trim() === heredoc)
|
|
29
|
+
heredoc = undefined;
|
|
30
|
+
return l;
|
|
31
|
+
}
|
|
32
|
+
const h = l.match(/<<-?\s*'?"?([A-Z_]+)'?"?/);
|
|
33
|
+
if (h)
|
|
34
|
+
heredoc = h[1];
|
|
35
|
+
return l.trim() ? `<span class="ln">${l}</span>` : l;
|
|
36
|
+
})
|
|
37
|
+
.join("\n")
|
|
38
|
+
: code;
|
|
39
|
+
return `<div class="term"><div class="term-bar"><span class="runin">${label}</span></div><pre class="copyable${isCommand ? " cmd" : ""}"><code>${lines}</code></pre></div>`;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/** Guide and miner pages: the h1 block stays as the page header, every h2 section becomes a card. */
|
|
43
|
+
export function cardify(body) {
|
|
44
|
+
const parts = body.split(/(?=<h2[ >])/);
|
|
45
|
+
const head = parts.shift() ?? "";
|
|
46
|
+
return `<header class="page-head">${head}</header>\n${parts.map((p) => `<section class="card prose">${p}</section>`).join("\n")}`;
|
|
47
|
+
}
|
|
48
|
+
const FONT_CSS = `
|
|
49
|
+
@font-face{font-family:"Inter";font-style:normal;font-weight:400;font-display:swap;src:url(/fonts/inter-latin-400-normal.woff2) format("woff2")}
|
|
50
|
+
@font-face{font-family:"Inter";font-style:normal;font-weight:600;font-display:swap;src:url(/fonts/inter-latin-600-normal.woff2) format("woff2")}
|
|
51
|
+
@font-face{font-family:"Space Mono";font-style:normal;font-weight:700;font-display:swap;src:url(/fonts/space-mono-latin-700-normal.woff2) format("woff2")}`;
|
|
52
|
+
export const SHELL_CSS = `${FONT_CSS}
|
|
53
|
+
:root{color-scheme:dark;--bg:#0a1020;--panel:#0f1729;--card:#121c31;--card-2:#17223a;--line:#1f2b44;--line-2:#2a3856;
|
|
54
|
+
--fg:#e6ebf4;--muted:#8d99b0;--dim:#64708a;--accent:#8cc5b1;--accent-deep:#2f5d50;--on-accent:#08130f;--warn:#e0b25c;--bad:#ef8a80;
|
|
55
|
+
--display:"Space Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;--mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace}
|
|
56
|
+
*,*::before,*::after{box-sizing:border-box}
|
|
57
|
+
html{-webkit-text-size-adjust:100%}
|
|
58
|
+
body{margin:0;background:var(--bg);color:var(--fg);font:15px/1.6 "Inter",system-ui,-apple-system,"Segoe UI",sans-serif;overflow-x:hidden}
|
|
59
|
+
a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}
|
|
60
|
+
h1,h2,h3{font-family:var(--display);font-weight:700;line-height:1.2;letter-spacing:-.01em;margin:0 0 .6rem}
|
|
61
|
+
h1{font-size:1.6rem}h2{font-size:1.15rem}h3{font-size:.95rem;color:var(--fg)}
|
|
62
|
+
p{margin:0 0 .8rem}ul,ol{padding-left:1.2rem}
|
|
63
|
+
code{font-family:var(--mono);font-size:.86em;background:var(--card-2);border:1px solid var(--line);padding:.05em .35em;border-radius:5px;overflow-wrap:anywhere}
|
|
64
|
+
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
|
|
65
|
+
.wrap{max-width:76rem;margin:0 auto;padding:0 16px}
|
|
66
|
+
/* top bar */
|
|
67
|
+
.topbar{border-bottom:1px solid var(--line);background:var(--panel);position:sticky;top:0;z-index:5}
|
|
68
|
+
.topbar .wrap{display:flex;align-items:center;gap:.5rem 1.2rem;flex-wrap:wrap;min-height:3.6rem;padding-top:.5rem;padding-bottom:.5rem}
|
|
69
|
+
.brand{display:inline-flex;align-items:center;gap:.55rem;color:var(--fg)}.brand:hover{text-decoration:none}
|
|
70
|
+
.brand img{display:block;border-radius:6px}.wm{font-size:1.15rem;letter-spacing:-.03em}.wm b{font-weight:600}.wm span{font-weight:400}
|
|
71
|
+
.pill{display:inline-flex;align-items:center;gap:.35rem;font:600 .68rem/1 var(--mono);letter-spacing:.08em;color:var(--warn);border:1px solid #4a3d22;background:#1d1a12;border-radius:99px;padding:.3rem .55rem}
|
|
72
|
+
.pill::before{content:"";width:.4rem;height:.4rem;border-radius:50%;background:currentColor}
|
|
73
|
+
.nav{display:flex;gap:.2rem 1.1rem;flex-wrap:wrap;font-size:.9rem;margin-left:auto}.nav a{color:var(--muted)}.nav a:hover{color:var(--fg);text-decoration:none}
|
|
74
|
+
.btn{display:inline-block;font:600 .88rem/1 "Inter",system-ui,sans-serif;background:var(--accent);color:var(--on-accent);border:1px solid var(--accent);border-radius:8px;padding:.6rem .9rem;cursor:pointer;white-space:nowrap}
|
|
75
|
+
.btn:hover{text-decoration:none;filter:brightness(1.08)}
|
|
76
|
+
.btn.ghost{background:transparent;color:var(--fg);border-color:var(--line-2)}
|
|
77
|
+
@media (max-width:640px){.topbar{position:static}.nav{order:3;width:100%;margin-left:0}.topbar .btn{margin-left:auto}}
|
|
78
|
+
main.wrap{padding-top:1.8rem;padding-bottom:3rem}
|
|
79
|
+
/* cards */
|
|
80
|
+
.card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:1.1rem 1.2rem;margin:0 0 1rem;min-width:0}
|
|
81
|
+
.card>:last-child{margin-bottom:0}
|
|
82
|
+
.page-head{margin:0 0 1.4rem;max-width:48rem}.page-head p{color:var(--muted)}
|
|
83
|
+
.prose{max-width:52rem}
|
|
84
|
+
.muted,.note{color:var(--muted)}.small{font-size:.85rem}
|
|
85
|
+
.tile{display:inline-grid;place-items:center;width:2rem;height:2rem;border-radius:8px;background:var(--card-2);border:1px solid var(--line-2);color:var(--accent);flex:none}
|
|
86
|
+
.tile svg{width:1.05rem;height:1.05rem}
|
|
87
|
+
.tag,.prov{display:inline-block;font:600 .62rem/1.5 var(--mono);letter-spacing:.06em;padding:0 .4rem;border-radius:4px;vertical-align:.12em;text-transform:uppercase;white-space:nowrap}
|
|
88
|
+
.tag{background:var(--accent-deep);color:#d8efe6}.prov{border:1px solid #4a3d22;color:var(--warn)}
|
|
89
|
+
table{border-collapse:collapse;width:100%}th,td{text-align:left;vertical-align:top;padding:.45rem .5rem .45rem 0;border-bottom:1px solid var(--line)}
|
|
90
|
+
tr:last-child>th,tr:last-child>td{border-bottom:0}
|
|
91
|
+
/* terminal code blocks */
|
|
92
|
+
.term{border:1px solid var(--line-2);border-radius:10px;overflow:hidden;margin:.6rem 0 1rem;background:#070c18;min-width:0}
|
|
93
|
+
.term-bar{display:flex;align-items:center;justify-content:space-between;gap:.6rem;padding:.35rem .4rem .35rem .75rem;background:var(--card-2);border-bottom:1px solid var(--line-2)}
|
|
94
|
+
.runin{font-size:.75rem;color:var(--muted);line-height:1.35;min-width:0}
|
|
95
|
+
.term pre{margin:0;padding:.75rem .9rem;overflow-x:auto;font:13px/1.65 var(--mono);color:#dfe6f2}
|
|
96
|
+
.term pre code{background:none;border:0;padding:0;font-size:inherit;overflow-wrap:normal;white-space:pre}
|
|
97
|
+
.term pre.cmd .ln::before{content:"$ ";color:var(--accent);user-select:none}
|
|
98
|
+
button.copy{font:600 .72rem/1 "Inter",system-ui,sans-serif;color:var(--fg);background:transparent;border:1px solid var(--line-2);border-radius:6px;padding:.35rem .6rem;cursor:pointer;flex:none}
|
|
99
|
+
button.copy:hover{border-color:var(--accent);color:var(--accent)}
|
|
100
|
+
/* forms */
|
|
101
|
+
input[type=text],input[type=password],input[type=number]{font:inherit;color:var(--fg);background:#0b1222;border:1px solid var(--line-2);border-radius:8px;padding:.5rem .6rem;margin-top:.3rem;width:100%;min-width:0}
|
|
102
|
+
input:focus{outline:none;border-color:var(--accent)}
|
|
103
|
+
label{display:flex;flex-direction:column;font-size:.85rem;color:var(--muted)}label.inline{flex-direction:row;gap:.5rem;align-items:center}
|
|
104
|
+
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(13rem,1fr));gap:.8rem 1rem}
|
|
105
|
+
main button:not(.copy):not([role=tab]){font:600 .88rem/1 "Inter",system-ui,sans-serif;background:var(--accent);color:var(--on-accent);border:1px solid var(--accent);border-radius:8px;padding:.6rem .9rem;cursor:pointer}
|
|
106
|
+
.msg{color:var(--muted)}.msg.bad{color:var(--bad)}
|
|
107
|
+
/* footer */
|
|
108
|
+
.foot{border-top:1px solid var(--line);color:var(--dim);font-size:.82rem}.foot .wrap{padding-top:1.2rem;padding-bottom:2rem}.foot p{margin:0 0 .3rem}`;
|
|
109
|
+
const NAV = `<nav class="nav" aria-label="Main"><a href="/start">Start</a><a href="/miner">Miner calculator</a><a href="${GUILD_ROOM_URL}">Guild room</a></nav>`;
|
|
110
|
+
export function page(title, body, o = {}) {
|
|
111
|
+
body = decorateCode(o.cards ? cardify(body) : body);
|
|
112
|
+
const copy = body.includes("copyable") ? '<script defer src="/copy.js"></script>' : "";
|
|
113
|
+
return `<!doctype html>
|
|
114
|
+
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
|
|
115
|
+
<title>${esc(title)}</title>
|
|
116
|
+
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
|
117
|
+
<link rel="preload" href="/fonts/space-mono-latin-700-normal.woff2" as="font" type="font/woff2" crossorigin>
|
|
118
|
+
<style>${SHELL_CSS}
|
|
119
|
+
${o.style ?? ""}
|
|
120
|
+
</style>${copy}${o.script ? `<script ${o.module ? 'type="module"' : "defer"} src="${o.script}"></script>` : ""}</head><body>
|
|
121
|
+
<header class="topbar"><div class="wrap">
|
|
122
|
+
<a class="brand" href="/" aria-label="flopguild home"><img src="/logo.svg" alt="" width="28" height="28"><span class="wm"><span>flop</span><b>guild</b></span></a>
|
|
123
|
+
<span class="pill" title="The kit runs on the Flop devnet until testnet endpoints are published">DEVNET</span>
|
|
124
|
+
${NAV}
|
|
125
|
+
<a class="btn" href="/#agent">Start your agent</a>
|
|
126
|
+
</div></header>
|
|
127
|
+
<main class="wrap">
|
|
128
|
+
${body}
|
|
129
|
+
</main>
|
|
130
|
+
<footer class="foot"><div class="wrap">${o.footerNote ? `<p>${esc(o.footerNote)}</p>` : ""}<p>via flop-guild · <a href="${GUILD_ROOM_URL}">join the guild room ${GUILD_ROOM}</a></p></div></footer>
|
|
131
|
+
</body></html>`;
|
|
132
|
+
}
|
|
133
|
+
/** Small line icons for tiles. stroke = currentColor. */
|
|
134
|
+
const svg = (d) => `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;
|
|
135
|
+
export const ICONS = {
|
|
136
|
+
agent: svg('<rect x="3" y="4.5" width="18" height="15" rx="2.5"/><path d="M7.5 10l3 2.5-3 2.5M12.5 15h4"/>'),
|
|
137
|
+
miner: svg('<rect x="6" y="6" width="12" height="12" rx="2"/><rect x="9.5" y="9.5" width="5" height="5" rx=".8"/><path d="M9 3v3M15 3v3M9 18v3M15 18v3M3 9h3M3 15h3M18 9h3M18 15h3"/>'),
|
|
138
|
+
validator: svg('<rect x="4" y="4" width="16" height="5" rx="1.5"/><rect x="4" y="11" width="16" height="5" rx="1.5"/><path d="M8 20h8M7 6.5h.01M7 13.5h.01"/>'),
|
|
139
|
+
faucet: svg('<path d="M12 3.5c3 3.6 5 6.4 5 9a5 5 0 0 1-10 0c0-2.6 2-5.4 5-9z"/>'),
|
|
140
|
+
clock: svg('<circle cx="12" cy="12" r="8.5"/><path d="M12 7.5V12l3 2"/>'),
|
|
141
|
+
doc: svg('<path d="M7 3.5h7l4 4v13H7z"/><path d="M14 3.5v4h4M9.5 12h6M9.5 15.5h6"/>'),
|
|
142
|
+
plug: svg('<path d="M9 3v5M15 3v5M6.5 8h11v3a5.5 5.5 0 0 1-11 0zM12 16.5V21"/>'),
|
|
143
|
+
chat: svg('<path d="M4 5h16v10.5H9.5L5.5 19v-3.5H4z"/>'),
|
|
144
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Build step: copy the shared role steps and guide list (src/content.ts) into the packaged skill.md,
|
|
2
|
+
// between the generated markers, so the npm package says the same as the website.
|
|
3
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { expand } from "./content.js";
|
|
7
|
+
const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
const START = "<!-- generated from src/content.ts by npm run build: do not edit -->";
|
|
9
|
+
const END = "<!-- end generated -->";
|
|
10
|
+
const path = join(ROOT, "skill.md");
|
|
11
|
+
const text = readFileSync(path, "utf8");
|
|
12
|
+
const a = text.indexOf(START);
|
|
13
|
+
const b = text.indexOf(END);
|
|
14
|
+
if (a < 0 || b < a)
|
|
15
|
+
throw new Error("skill.md: generated markers not found");
|
|
16
|
+
const body = expand("## Roles\n\n{{ROLES_MD}}\n## Guides\n\n{{GUIDES_MD}}\n");
|
|
17
|
+
const next = `${text.slice(0, a)}${START}\n\n${body.trim()}\n\n${text.slice(b)}`;
|
|
18
|
+
if (next !== text)
|
|
19
|
+
writeFileSync(path, next);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flop-guild",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Technocore guild kit: Ed25519 did:key signing CLI for technocore.chat rooms, plus an agent identity scaffold.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"LICENSE"
|
|
34
34
|
],
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "tsc -p tsconfig.json",
|
|
36
|
+
"build": "tsc -p tsconfig.json && node dist/sync-docs.js",
|
|
37
37
|
"test": "node --test \"dist/test/*.test.js\"",
|
|
38
38
|
"start": "node dist/server.js",
|
|
39
39
|
"prepublishOnly": "npm run build && npm test"
|
package/site/copy.js
CHANGED
|
@@ -31,6 +31,8 @@
|
|
|
31
31
|
clearTimeout(timer);
|
|
32
32
|
timer = setTimeout(() => (btn.textContent = "Copy"), 1500);
|
|
33
33
|
});
|
|
34
|
-
pre.
|
|
34
|
+
const bar = pre.previousElementSibling;
|
|
35
|
+
if (bar && bar.classList.contains("term-bar")) bar.appendChild(btn);
|
|
36
|
+
else pre.parentElement.insertBefore(btn, pre);
|
|
35
37
|
}
|
|
36
38
|
})();
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|