@davidbalzan/groundwork-console 0.1.0
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/bin/groundwork-console.mjs +47 -0
- package/dist/answered.js +34 -0
- package/dist/auth.js +47 -0
- package/dist/bus.js +79 -0
- package/dist/config.js +40 -0
- package/dist/docwrite.js +66 -0
- package/dist/env.js +23 -0
- package/dist/events.js +170 -0
- package/dist/extensions.js +31 -0
- package/dist/gitinfo.js +69 -0
- package/dist/groundwork.js +34 -0
- package/dist/kitresolve.js +79 -0
- package/dist/knowledge.js +72 -0
- package/dist/mcp.js +106 -0
- package/dist/notify.js +85 -0
- package/dist/provision.js +124 -0
- package/dist/runs.js +46 -0
- package/dist/seam.js +125 -0
- package/dist/seamwrite.js +87 -0
- package/dist/server.js +818 -0
- package/dist/skills.js +48 -0
- package/dist/tmux.js +36 -0
- package/dist/uploads.js +40 -0
- package/groundwork-console.rules.json +85 -0
- package/package.json +49 -0
- package/public/assets/abnfDiagram-N423BO3Z-DPhyKd1N.js +1 -0
- package/public/assets/arc-DmkLmHHi.js +1 -0
- package/public/assets/architecture-TIHT7OUA-MgcjoiPc.js +1 -0
- package/public/assets/architectureDiagram-T3A2C74G-BXFkjpze.js +36 -0
- package/public/assets/array-BifhSqXX.js +1 -0
- package/public/assets/blockDiagram-VBNYF7ZC-Ddhca5b4.js +132 -0
- package/public/assets/c4Diagram-5PPSVZJV-D4M2Oz2j.js +10 -0
- package/public/assets/channel-BAs2g7Wn.js +1 -0
- package/public/assets/chunk-2GRJ4B5K-B2cLnEJA.js +1 -0
- package/public/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/public/assets/chunk-4I5QYGJK-CVuqmZe1.js +1 -0
- package/public/assets/chunk-5RXB4S5H-CAj33Qry.js +231 -0
- package/public/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/public/assets/chunk-6Q2QTUOP-B6kTvnZS.js +88 -0
- package/public/assets/chunk-7BUUIJ7U-Bb538aSH.js +1 -0
- package/public/assets/chunk-7Z6QIM7H-BCYMaGkK.js +10 -0
- package/public/assets/chunk-GF5L2VYU-eAfQwP-A.js +206 -0
- package/public/assets/chunk-I66GZJ75-DyWmv43M.js +127 -0
- package/public/assets/chunk-JQJVKLGR-xpwVLHiM.js +156 -0
- package/public/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/public/assets/chunk-KBJHAD2P-BsIw_3BM.js +1 -0
- package/public/assets/chunk-KEIR6QF5-BICK3FdT.js +161 -0
- package/public/assets/chunk-NSK5VX7P-Dy4p7ORp.js +2 -0
- package/public/assets/chunk-QR6OTTB3-D8k2NFkq.js +62 -0
- package/public/assets/chunk-RYQCIY6F-TbGMiTbW.js +1 -0
- package/public/assets/chunk-UBXNYLIW-By3VqDlw.js +1 -0
- package/public/assets/chunk-W5SLKNZC-B6TSWP8U.js +1 -0
- package/public/assets/chunk-WRU74C26-CqCOF3fo.js +70 -0
- package/public/assets/chunk-XXDRQBXY-B6BeKGFV.js +1 -0
- package/public/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/public/assets/classDiagram-JCYQIIEL-D8vKmZUF.js +1 -0
- package/public/assets/classDiagram-v2-OCEON4UE-D8vKmZUF.js +1 -0
- package/public/assets/cose-bilkent-JH36ORCC-2ieLCSa1.js +1 -0
- package/public/assets/cynefin-VYW2F7L2-BfajhBFb.js +1 -0
- package/public/assets/cynefinDiagram-MW4NZA55-DZFY7WjS.js +62 -0
- package/public/assets/cytoscape.esm-C2x7inlt.js +321 -0
- package/public/assets/dagre-Buvkdvvj.js +1 -0
- package/public/assets/dagre-VZM6K2ZE-DECeuEL2.js +4 -0
- package/public/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/public/assets/diagram-7IWD3JNH-DA6fCDep.js +30 -0
- package/public/assets/diagram-B4RE2ZJO-Dj8QoIQR.js +3 -0
- package/public/assets/diagram-LBJQPF4R-9JYAugOO.js +24 -0
- package/public/assets/diagram-Q27KOJAE-ecTfssa6.js +24 -0
- package/public/assets/diagram-UB23O5K3-DOGgwSDm.js +41 -0
- package/public/assets/dist-DTWyzWtG.js +1 -0
- package/public/assets/ebnfDiagram-BXEA7PRR-BGmWK80p.js +1 -0
- package/public/assets/erDiagram-JOGREHBK-CNl1QvhN.js +85 -0
- package/public/assets/eventmodeling-45OFAUF4-GcvHanur.js +1 -0
- package/public/assets/flowDiagram-UKHOOZJN-DdgmWP6g.js +1 -0
- package/public/assets/ganttDiagram-PKOTCBZU-C01y-MjT.js +292 -0
- package/public/assets/gitGraph-TEB2WS4Q-BW4zQmf5.js +1 -0
- package/public/assets/gitGraphDiagram-DS77QQ5N-CnlU6XMJ.js +106 -0
- package/public/assets/graphlib-DS17s2tU.js +1 -0
- package/public/assets/index-C3zhnM_H.css +2 -0
- package/public/assets/index-DrqxoBmk.js +40 -0
- package/public/assets/info-DKCQHKI2--A5cJC9V.js +1 -0
- package/public/assets/infoDiagram-6WML65LV-Cz2UOAMW.js +2 -0
- package/public/assets/init-C-OQMol4.js +1 -0
- package/public/assets/ishikawaDiagram-WSZJBQD7-B4Iqm47_.js +70 -0
- package/public/assets/journeyDiagram-NVQOT4AX-BU0js6EE.js +139 -0
- package/public/assets/kanban-definition-27J2QSJJ-DmeEPzz0.js +89 -0
- package/public/assets/katex-CXMH3UgJ.js +257 -0
- package/public/assets/line-Dxi6NubD.js +1 -0
- package/public/assets/linear-tama2Fqh.js +1 -0
- package/public/assets/map-BaFkSB1l.js +1 -0
- package/public/assets/mermaid-parser.core-bGhrBY9T.js +7 -0
- package/public/assets/mermaid.core-_OoTZaAK.js +42 -0
- package/public/assets/mindmap-definition-FAOFIHXS-BRJt4F9_.js +96 -0
- package/public/assets/ordinal-BDEzSJ7C.js +1 -0
- package/public/assets/packet-7NZHBO7P-DAZsca60.js +1 -0
- package/public/assets/path-fybaL0A-.js +1 -0
- package/public/assets/pegDiagram-VL7TDLO6-2k0rcz9N.js +1 -0
- package/public/assets/pie-RZYD4A2V-ojW1YX_G.js +1 -0
- package/public/assets/pieDiagram-7S7Q4E2Y-CrrciDrS.js +39 -0
- package/public/assets/quadrantDiagram-CIZ2JOQS-Dj5lMd95.js +7 -0
- package/public/assets/radar-I7S5WNFK-flsKqrK_.js +1 -0
- package/public/assets/railroad-3IZDKUUU-BX9H_OcC.js +1 -0
- package/public/assets/railroad-abnf-AHOZXSZD-DD8mz__c.js +1 -0
- package/public/assets/railroad-ebnf-EBAXGLYW-CWer5P7V.js +1 -0
- package/public/assets/railroad-peg-LSFZ7HO6-DDrRJYYw.js +1 -0
- package/public/assets/railroadDiagram-AXF67PYL-BRNOv6Sh.js +1 -0
- package/public/assets/requirementDiagram-LRYGKXZP-BqJbwH3b.js +84 -0
- package/public/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/public/assets/sankeyDiagram-W5VNT64P-BE7fRCAN.js +40 -0
- package/public/assets/sequenceDiagram-SI44F4Z6-Cwt-L1ko.js +162 -0
- package/public/assets/sizeCapture-X5ZJPWSS-B0uUizjq.js +1 -0
- package/public/assets/src-Bc2f8joo.js +1 -0
- package/public/assets/stateDiagram-OKZ733FA-etLHG0qi.js +1 -0
- package/public/assets/stateDiagram-v2-UEYNNEHI-Crgtg4pC.js +1 -0
- package/public/assets/swimlanes-SLNWSIFB-B06NxeYI.js +2 -0
- package/public/assets/swimlanesDiagram-ULZ7WXOC-C8S-XAyy.js +8 -0
- package/public/assets/timeline-definition-Z64GVDOM-BihNR1uq.js +120 -0
- package/public/assets/treeView-QDETBFTQ-CImTfOYf.js +1 -0
- package/public/assets/treemap-6X3UGDF4-DBRjbghn.js +1 -0
- package/public/assets/vennDiagram-T6HMQDX7-HcbmXJRd.js +34 -0
- package/public/assets/wardley-OPB4EBWU-xY5d-6YU.js +1 -0
- package/public/assets/wardleyDiagram-T6FBY63Y-B6KN3TYi.js +78 -0
- package/public/assets/xychartDiagram-ELKLHX3M-AAW8Pwrl.js +7 -0
- package/public/favicon.svg +1 -0
- package/public/fonts/JetBrainsMono-400.woff2 +0 -0
- package/public/fonts/JetBrainsMono-500.woff2 +0 -0
- package/public/fonts/JetBrainsMono-600.woff2 +0 -0
- package/public/fonts/SourceSans3-400.woff2 +0 -0
- package/public/fonts/SourceSans3-500.woff2 +0 -0
- package/public/fonts/SourceSans3-600.woff2 +0 -0
- package/public/fonts/SourceSans3-700.woff2 +0 -0
- package/public/fonts/SourceSerif4-600.woff2 +0 -0
- package/public/icons.svg +24 -0
- package/public/index.html +14 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* v0.2 seam writes — the ONLY way the console changes seam files. Rules:
|
|
2
|
+
1. parse → render must reproduce the file byte-for-byte BEFORE we touch it (else refuse: hand-edit).
|
|
3
|
+
2. The change is expressed as seam records and rendered by the seam (renderWorkDoc / upsertFact), never by string surgery on the doc.
|
|
4
|
+
3. Re-parse after write and assert the record is present.
|
|
5
|
+
4. Scope check (list_scopes): allowed when the doc is unscoped, or owner ∈ {any, david, human, aide, liaison, curator} — David is the aide's principal. */
|
|
6
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { parseWorkDoc, renderWorkDoc, queueItemsOf, upsertFact, parseFactsDoc } from "@davidbalzan/groundwork-seam";
|
|
9
|
+
const DAVID_MAY = new Set(["any", "david", "human", "aide", "liaison", "curator", "groundwork-console", "kit-console"]);
|
|
10
|
+
export function scopeAllows(scopes, docPath) {
|
|
11
|
+
const sc = scopes[docPath];
|
|
12
|
+
if (!sc)
|
|
13
|
+
return { ok: true, reason: "unscoped (no scopes.json entry)" };
|
|
14
|
+
if (DAVID_MAY.has(sc.owner.toLowerCase()))
|
|
15
|
+
return { ok: true, reason: `scope owner ${sc.owner} · ${sc.mode ?? "shared"} — David is the principal` };
|
|
16
|
+
return { ok: false, reason: `scope owner is ${sc.owner} (${sc.mode ?? "shared"}) — write it through that role` };
|
|
17
|
+
}
|
|
18
|
+
function roundTrips(source) {
|
|
19
|
+
const doc = parseWorkDoc(source);
|
|
20
|
+
const back = renderWorkDoc(doc);
|
|
21
|
+
if (back === source)
|
|
22
|
+
return { ok: true, doc };
|
|
23
|
+
const a = source.split("\n"), b = back.split("\n");
|
|
24
|
+
const at = a.findIndex((l, i) => l !== b[i]);
|
|
25
|
+
return { ok: false, doc, diffAt: at + 1 };
|
|
26
|
+
}
|
|
27
|
+
/** Append a queue.v1 item under the last `## Queue` block (or the `## Queue` heading if the list is empty). */
|
|
28
|
+
export function addQueueItem(projectPath, item, log) {
|
|
29
|
+
const file = path.join(projectPath, "docs/QUEUE.md");
|
|
30
|
+
if (!existsSync(file))
|
|
31
|
+
throw new Error("docs/QUEUE.md missing — run /kickstart");
|
|
32
|
+
const src = readFileSync(file, "utf8");
|
|
33
|
+
const rt = roundTrips(src);
|
|
34
|
+
if (!rt.ok)
|
|
35
|
+
throw new Error(`QUEUE.md does not round-trip through the seam (first divergence at line ${rt.diffAt}) — refusing to write; fix the file by hand first`);
|
|
36
|
+
log("round-trip: byte-identical ✓");
|
|
37
|
+
const doc = rt.doc;
|
|
38
|
+
const text = item.text.trim().replace(/\r?\n/g, " ");
|
|
39
|
+
if (!text)
|
|
40
|
+
throw new Error("empty item");
|
|
41
|
+
const newItem = { id: `q-${Date.now().toString(36)}`, priority: item.priority, text, done: false };
|
|
42
|
+
const lastQueue = [...doc.blocks].reverse().find((b) => b.kind === "queue");
|
|
43
|
+
if (lastQueue) {
|
|
44
|
+
lastQueue.items.push(newItem);
|
|
45
|
+
log(`append to existing queue block (${lastQueue.items.length} items)`);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const idx = doc.blocks.findIndex((b) => b.kind === "text" && b.lines.some((l) => /^## Queue\b/.test(l)));
|
|
49
|
+
if (idx < 0)
|
|
50
|
+
throw new Error("no `## Queue` section in QUEUE.md");
|
|
51
|
+
const tb = doc.blocks[idx];
|
|
52
|
+
const h = tb.lines.findIndex((l) => /^## Queue\b/.test(l));
|
|
53
|
+
const before = tb.lines.slice(0, h + 1), after = tb.lines.slice(h + 1);
|
|
54
|
+
// keep a blank line after the heading if the source had one
|
|
55
|
+
const lead = after[0] === "" ? [""] : [];
|
|
56
|
+
const rest = after[0] === "" ? after.slice(1) : after;
|
|
57
|
+
doc.blocks.splice(idx, 1, { kind: "text", lines: [...before, ...lead] }, { kind: "queue", items: [newItem] }, ...(rest.length ? [{ kind: "text", lines: rest }] : []));
|
|
58
|
+
log("no queue items yet — inserted a queue block under ## Queue");
|
|
59
|
+
}
|
|
60
|
+
const out = renderWorkDoc(doc);
|
|
61
|
+
writeFileSync(file, out);
|
|
62
|
+
const check = queueItemsOf(parseWorkDoc(readFileSync(file, "utf8"))).some((q) => q.text === text && q.priority === item.priority && !q.done);
|
|
63
|
+
if (!check)
|
|
64
|
+
throw new Error("post-write verification failed: item not found after re-parse");
|
|
65
|
+
log(`wrote docs/QUEUE.md (+1 item, ${out.length - src.length} bytes)`);
|
|
66
|
+
return { file: "docs/QUEUE.md", line: renderWorkDocLine(newItem), bytesDelta: out.length - src.length };
|
|
67
|
+
}
|
|
68
|
+
const renderWorkDocLine = (q) => `- [ ] (${q.priority}) ${q.text}`;
|
|
69
|
+
/** Re-verify (or add) a fact: seam upsertFact with a fresh timestamp. */
|
|
70
|
+
export function reverifyFact(projectPath, entry, log) {
|
|
71
|
+
const file = path.join(projectPath, "docs/FACTS.md");
|
|
72
|
+
if (!existsSync(file))
|
|
73
|
+
throw new Error("docs/FACTS.md missing — run `groundwork update --docs`");
|
|
74
|
+
const src = readFileSync(file, "utf8");
|
|
75
|
+
const parsed = parseFactsDoc(src);
|
|
76
|
+
const existing = parsed.entries.find((e) => e.id === entry.id);
|
|
77
|
+
if (!existing && !entry.claim)
|
|
78
|
+
throw new Error(`fact ${entry.id} not found and no claim given`);
|
|
79
|
+
const claim = entry.claim ?? existing.claim;
|
|
80
|
+
const out = upsertFact(src, { id: entry.id, claim, by: entry.by, method: entry.method });
|
|
81
|
+
writeFileSync(file, out);
|
|
82
|
+
const after = parseFactsDoc(readFileSync(file, "utf8")).entries.find((e) => e.id === entry.id);
|
|
83
|
+
if (!after || after.by !== entry.by)
|
|
84
|
+
throw new Error("post-write verification failed");
|
|
85
|
+
log(`upsertFact ${entry.id} · verified now · by ${entry.by} · ${entry.method}`);
|
|
86
|
+
return { file: "docs/FACTS.md", entry: after };
|
|
87
|
+
}
|