@bendyline/gilde 0.1.79 → 0.1.80
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/data/gezel-templates/ar/archivaris/manifest.json +1 -1
- package/data/gezel-templates/ar/archivaris/versions/1.0.1/about.md +26 -0
- package/data/gezel-templates/ar/archivaris/versions/1.0.1/manifest.json +10 -0
- package/data/gezel-templates/index.json +1 -1
- package/data/gezel-templates/pe/penningmeester/versions/1.0.1/about.md +23 -0
- package/data/gezel-templates/pe/penningmeester/versions/1.0.1/manifest.json +10 -0
- package/data/gezel-templates/raw-index.json +1 -1
- package/data/gezel-templates/zo/zorgcoordinator/manifest.json +1 -1
- package/data/gezel-templates/zo/zorgcoordinator/versions/1.0.1/about.md +23 -0
- package/data/gezel-templates/zo/zorgcoordinator/versions/1.0.1/manifest.json +10 -0
- package/data/project-types/ca/caregiving-binder/manifest.json +1 -1
- package/data/project-types/ca/caregiving-binder/versions/1.1.1/about.md +7 -0
- package/data/project-types/ca/caregiving-binder/versions/1.1.1/care.json +4 -0
- package/data/project-types/ca/caregiving-binder/versions/1.1.1/manifest.json +178 -0
- package/data/project-types/ca/caregiving-binder/versions/1.1.1/meds.json +8 -0
- package/data/project-types/ca/caregiving-binder/versions/1.1.1/mission.md +7 -0
- package/data/project-types/ca/caregiving-binder/versions/1.1.1/pages/dashboard/index.html +265 -0
- package/data/project-types/ho/household-budget/manifest.json +1 -1
- package/data/project-types/ho/household-budget/versions/1.0.2/about.md +6 -0
- package/data/project-types/ho/household-budget/versions/1.0.2/ledger.json +5 -0
- package/data/project-types/ho/household-budget/versions/1.0.2/manifest.json +163 -0
- package/data/project-types/ho/household-budget/versions/1.0.2/mission.md +5 -0
- package/data/project-types/ho/household-budget/versions/1.0.2/pages/dashboard/index.html +233 -0
- package/data/project-types/index.json +1 -1
- package/data/project-types/li/life-binder/manifest.json +1 -1
- package/data/project-types/li/life-binder/versions/1.0.2/about.md +7 -0
- package/data/project-types/li/life-binder/versions/1.0.2/documents.json +145 -0
- package/data/project-types/li/life-binder/versions/1.0.2/manifest.json +137 -0
- package/data/project-types/li/life-binder/versions/1.0.2/mission.md +6 -0
- package/data/project-types/li/life-binder/versions/1.0.2/pages/dashboard/index.html +147 -0
- package/data/project-types/raw-index.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"releasedAt": "2026-10-01T22:30:17Z",
|
|
5
|
+
"meesterManaged": false,
|
|
6
|
+
"params": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"person": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"title": "Who is the care for?",
|
|
12
|
+
"description": "A first name is enough — e.g. 'Mom', 'Jan'.",
|
|
13
|
+
"default": "Mom"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": [
|
|
17
|
+
"person"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"nameTemplate": "Caregiving Binder",
|
|
21
|
+
"aboutTemplate": "about.md",
|
|
22
|
+
"missionTemplate": "mission.md",
|
|
23
|
+
"gezels": [
|
|
24
|
+
{
|
|
25
|
+
"templateId": "zorgcoordinator",
|
|
26
|
+
"voorman": true
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"tools": [
|
|
30
|
+
{
|
|
31
|
+
"name": "add_med",
|
|
32
|
+
"description": "Record a medication (name, dose/schedule, prescriber).",
|
|
33
|
+
"script": "care-store",
|
|
34
|
+
"inputs": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": {
|
|
37
|
+
"name": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"dose": {
|
|
41
|
+
"type": "string"
|
|
42
|
+
},
|
|
43
|
+
"prescriber": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"required": [
|
|
48
|
+
"name",
|
|
49
|
+
"dose"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"bind": {
|
|
53
|
+
"action": "add_med"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "stop_med",
|
|
58
|
+
"description": "Mark a medication stopped (with why, when known).",
|
|
59
|
+
"script": "care-store",
|
|
60
|
+
"inputs": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"properties": {
|
|
63
|
+
"id": {
|
|
64
|
+
"type": "string"
|
|
65
|
+
},
|
|
66
|
+
"name": {
|
|
67
|
+
"type": "string"
|
|
68
|
+
},
|
|
69
|
+
"note": {
|
|
70
|
+
"type": "string"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"bind": {
|
|
75
|
+
"action": "stop_med"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "log_entry",
|
|
80
|
+
"description": "Add a journal entry — a note, a symptom observation, an update.",
|
|
81
|
+
"script": "care-store",
|
|
82
|
+
"inputs": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"properties": {
|
|
85
|
+
"kind": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"enum": [
|
|
88
|
+
"note",
|
|
89
|
+
"symptom",
|
|
90
|
+
"update"
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
"note": {
|
|
94
|
+
"type": "string"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"required": [
|
|
98
|
+
"note"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"bind": {
|
|
102
|
+
"action": "log_entry"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"name": "log_appointment",
|
|
107
|
+
"description": "Record an appointment (what and when, ISO).",
|
|
108
|
+
"script": "care-store",
|
|
109
|
+
"inputs": {
|
|
110
|
+
"type": "object",
|
|
111
|
+
"properties": {
|
|
112
|
+
"note": {
|
|
113
|
+
"type": "string"
|
|
114
|
+
},
|
|
115
|
+
"when": {
|
|
116
|
+
"type": "string"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"required": [
|
|
120
|
+
"note",
|
|
121
|
+
"when"
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"bind": {
|
|
125
|
+
"action": "log_appointment"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "care_status",
|
|
130
|
+
"description": "Active meds, upcoming appointments, journal count.",
|
|
131
|
+
"script": "care-store",
|
|
132
|
+
"inputs": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"properties": {}
|
|
135
|
+
},
|
|
136
|
+
"bind": {
|
|
137
|
+
"action": "status"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "visit_prep",
|
|
142
|
+
"description": "The one-page brief for the next doctor visit: meds + what happened since the last one.",
|
|
143
|
+
"script": "care-store",
|
|
144
|
+
"inputs": {
|
|
145
|
+
"type": "object",
|
|
146
|
+
"properties": {}
|
|
147
|
+
},
|
|
148
|
+
"bind": {
|
|
149
|
+
"action": "visit_prep"
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"craftbooks": [
|
|
154
|
+
"visit-prep"
|
|
155
|
+
],
|
|
156
|
+
"schedules": [],
|
|
157
|
+
"pages": {
|
|
158
|
+
"entry": "dashboard/index.html",
|
|
159
|
+
"api": 1,
|
|
160
|
+
"reads": [
|
|
161
|
+
{
|
|
162
|
+
"source": "workspace",
|
|
163
|
+
"path": "meds.json"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"source": "workspace",
|
|
167
|
+
"path": "care.json"
|
|
168
|
+
}
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
"workspaceSeed": [
|
|
172
|
+
"meds.json",
|
|
173
|
+
"care.json"
|
|
174
|
+
],
|
|
175
|
+
"scripts": {
|
|
176
|
+
"care-store": "import { type InferredInput, defineScript, gezel } from '@bendyline/gezel-sdk';\nimport { logStore, rosterStore } from '@bendyline/gezel-sdk/stores';\n\nexport const meta = defineScript({\n name: 'care-store',\n description:\n \"Read and update the care record: medications (meds.json) and the care journal (care.json). Call action:'status' for active meds + upcoming appointments; 'add_med' / 'stop_med' on changes; 'log_entry' for journal notes and symptoms; 'log_appointment' with when (ISO); 'visit_prep' before a doctor visit.\",\n inputs: {\n action: {\n type: 'string',\n description:\n \"One of 'status', 'add_med', 'stop_med', 'log_entry', 'log_appointment', or 'visit_prep'.\",\n required: true,\n },\n name: { type: 'string', description: 'Medication name.' },\n dose: { type: 'string', description: \"Dose and schedule, e.g. '10mg mornings'.\" },\n prescriber: { type: 'string', description: 'Who prescribed it.' },\n id: { type: 'string', description: \"Medication id, e.g. 'med-2'.\" },\n kind: { type: 'string', description: \"Journal kind: 'note', 'symptom', or 'update'.\" },\n note: { type: 'string', description: 'The journal entry or appointment description.' },\n when: { type: 'string', description: 'Appointment time (ISO), e.g. 2026-08-02T14:00.' },\n },\n outputs: {\n meds: { type: 'number', description: 'Active medications.' },\n upcoming: { type: 'number', description: 'Upcoming appointments.' },\n summary: { type: 'string', description: 'The care picture (or the visit prep).' },\n },\n requires: ['workspace.read', 'workspace.write'],\n} as const);\n\nconst input = gezel.input as InferredInput<typeof meta>;\n\n// ── care-rules-start ──\n// Pure derivations: upcoming appointments (journal events kind\n// 'appointment' with data.whenAt in the future) and the since-last-visit\n// window for visit prep.\n\nfunction upcomingAppointments(events, nowMs) {\n return events\n .filter(function (e) {\n var when = e.data && typeof e.data.whenAt === 'string' ? Date.parse(e.data.whenAt) : NaN;\n return e.kind === 'appointment' && isFinite(when) && when >= nowMs;\n })\n .sort(function (a, b) {\n return Date.parse(a.data.whenAt) - Date.parse(b.data.whenAt);\n });\n}\n\nfunction lastVisitMs(events, nowMs) {\n var past = events.filter(function (e) {\n var when = e.data && typeof e.data.whenAt === 'string' ? Date.parse(e.data.whenAt) : NaN;\n return e.kind === 'appointment' && isFinite(when) && when < nowMs;\n });\n if (past.length === 0) return null;\n return Math.max.apply(\n null,\n past.map(function (e) {\n return Date.parse(e.data.whenAt);\n }),\n );\n}\n\nfunction sinceWindow(events, nowMs) {\n var last = lastVisitMs(events, nowMs);\n return events.filter(function (e) {\n return e.kind !== 'appointment' && (last === null || Date.parse(e.at) > last);\n });\n}\n// ── care-rules-end ──\n\nconst meds = rosterStore(gezel.fs, 'meds.json', {\n stages: ['active', 'stopped'],\n idPrefix: 'med',\n});\nconst journal = logStore(gezel.fs, 'care.json');\n\nasync function resolveMed(): Promise<string> {\n if (input.id) return input.id;\n if (input.name) {\n const wanted = input.name.toLowerCase();\n const matches = (await meds.list({ status: 'active' })).filter(\n (r) => String(r.fields.name ?? '').toLowerCase() === wanted,\n );\n if (matches.length === 1) return matches[0]!.id;\n }\n throw new Error(\"Pass 'id' (e.g. 'med-2') or an exact active medication 'name'.\");\n}\n\nif (input.action === 'add_med') {\n if (!input.name || !input.dose) throw new Error(\"add_med needs 'name' and 'dose'.\");\n await meds.add({\n status: 'active',\n fields: {\n name: input.name,\n dose: input.dose,\n ...(input.prescriber ? { prescriber: input.prescriber } : {}),\n },\n });\n await journal.append({ kind: 'update', note: `Started ${input.name} (${input.dose}).` });\n} else if (input.action === 'stop_med') {\n const id = await resolveMed();\n const med = await meds.get(id);\n await meds.transition(id, 'stopped', input.note ? { note: input.note } : {});\n await journal.append({\n kind: 'update',\n note: `Stopped ${String(med?.fields.name ?? id)}${input.note ? ` — ${input.note}` : ''}.`,\n });\n} else if (input.action === 'log_entry') {\n if (!input.note) throw new Error(\"log_entry needs 'note'.\");\n const kind = input.kind === 'symptom' || input.kind === 'update' ? input.kind : 'note';\n await journal.append({ kind, note: input.note });\n} else if (input.action === 'log_appointment') {\n if (!input.note || !input.when) throw new Error(\"log_appointment needs 'note' and 'when' (ISO).\");\n await journal.append({ kind: 'appointment', note: input.note, data: { whenAt: input.when } });\n} else if (input.action !== 'status' && input.action !== 'visit_prep') {\n throw new Error(\n `Unknown action '${input.action}'. Use status, add_med, stop_med, log_entry, log_appointment, or visit_prep.`,\n );\n}\n\nconst activeMeds = await meds.list({ status: 'active' });\nconst events = await journal.list();\nconst nowMs = Date.now();\nconst upcoming = upcomingAppointments(events, nowMs);\n\nlet summary: string;\nif (input.action === 'visit_prep') {\n const since = sinceWindow(events, nowMs);\n const medLines = activeMeds\n .map((m) => `- ${String(m.fields.name)} ${String(m.fields.dose ?? '')}`.trim())\n .join('\\n');\n const noteLines = since\n .map((e) => `- [${e.kind}] ${String(e.at).slice(0, 10)}: ${e.note ?? ''}`)\n .join('\\n');\n summary = `VISIT PREP\\nActive medications:\\n${medLines || '- none recorded'}\\nSince the last visit:\\n${noteLines || '- quiet — nothing logged'}\\nUpcoming:\\n${upcoming.map((e) => `- ${String(e.data?.whenAt).slice(0, 16)} ${e.note ?? ''}`).join('\\n') || '- none scheduled'}`;\n} else {\n const next = upcoming[0];\n summary = `${activeMeds.length} active medication(s). ${upcoming.length} upcoming appointment(s)${\n next ? ` — next: ${String(next.data?.whenAt).slice(0, 16)} ${next.note ?? ''}` : ''\n }. ${events.filter((e) => e.kind !== 'appointment').length} journal entr(ies).`;\n}\n\ngezel.output({\n meds: activeMeds.length,\n upcoming: upcoming.length,\n summary,\n});\n"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
- The medication list is always current — starts, stops, and dose changes
|
|
2
|
+
recorded the day they happen.
|
|
3
|
+
- Every doctor visit is walked into prepared: the since-last-visit brief in
|
|
4
|
+
hand.
|
|
5
|
+
- The journal captures observations in plain words; anything urgent-sounding
|
|
6
|
+
gets the call-the-doctor-now line, never a diagnosis.
|
|
7
|
+
- Family updates are one ask away — honest, warm, no needless alarm.
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="gezel-demo" content="standalone" />
|
|
7
|
+
<title>Caregiving binder</title>
|
|
8
|
+
<style>
|
|
9
|
+
:root {
|
|
10
|
+
color-scheme: light dark;
|
|
11
|
+
--bg: #faf7f2; --card: #fff; --ink: #2b2620; --muted: #7a7166;
|
|
12
|
+
--accent: #b5651d; --track: #ece5da; --good: #4a7c59; --warn: #a4552e;
|
|
13
|
+
}
|
|
14
|
+
:root[data-theme='dark'] {
|
|
15
|
+
--bg: #1c1a17; --card: #262320; --ink: #efe9e0; --muted: #a59a8c;
|
|
16
|
+
--accent: #e0894a; --track: #3a352f; --good: #7fae8d; --warn: #d98a63;
|
|
17
|
+
}
|
|
18
|
+
@media (prefers-color-scheme: dark) {
|
|
19
|
+
:root:not([data-theme='light']) {
|
|
20
|
+
--bg: #1c1a17; --card: #262320; --ink: #efe9e0; --muted: #a59a8c;
|
|
21
|
+
--accent: #e0894a; --track: #3a352f; --good: #7fae8d; --warn: #d98a63;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
* { box-sizing: border-box; }
|
|
25
|
+
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--ink); padding: 1.5rem 1.25rem; }
|
|
26
|
+
main { max-width: 680px; margin: 0 auto; }
|
|
27
|
+
h1 { font-family: Georgia, 'PT Serif', 'Times New Roman', serif; font-size: 1.35rem; font-weight: 600; margin: 0 0 0.15rem; }
|
|
28
|
+
.sub { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.9rem; }
|
|
29
|
+
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
|
|
30
|
+
.panel { background: var(--card); border: 1px solid var(--track); border-radius: 10px; padding: 0.85rem 1rem; font-size: 0.9rem; }
|
|
31
|
+
.panel h2 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 0.5rem; }
|
|
32
|
+
.panel ul { margin: 0; padding-left: 1.05rem; }
|
|
33
|
+
.panel li { margin: 0.25rem 0; }
|
|
34
|
+
.panel .meta { color: var(--muted); font-size: 0.78rem; }
|
|
35
|
+
.journal { margin-top: 0.6rem; }
|
|
36
|
+
.journal li { color: var(--muted); }
|
|
37
|
+
.journal li strong { color: var(--ink); font-weight: 600; }
|
|
38
|
+
.kind { display: inline-block; border: 1px solid var(--track); border-radius: 4px; padding: 0 0.3rem; font-size: 0.7rem; line-height: 1.4; margin-right: 0.3rem; color: var(--muted); }
|
|
39
|
+
.kind.symptom { color: var(--warn); border-color: var(--warn); }
|
|
40
|
+
.empty { color: var(--muted); font-style: italic; }
|
|
41
|
+
.privacy { color: var(--muted); font-size: 0.78rem; text-align: center; margin-top: 0.75rem; }
|
|
42
|
+
@media (max-width: 640px) { .cols { grid-template-columns: 1fr; } }
|
|
43
|
+
.demo-banner {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
gap: 0.75rem;
|
|
48
|
+
margin: 0 0 0.85rem;
|
|
49
|
+
padding: 0.5rem 0.65rem;
|
|
50
|
+
border: 1px solid var(--accent);
|
|
51
|
+
border-radius: 6px;
|
|
52
|
+
background: color-mix(in srgb, var(--card) 88%, var(--accent));
|
|
53
|
+
color: var(--ink);
|
|
54
|
+
font-size: 0.8rem;
|
|
55
|
+
}
|
|
56
|
+
.demo-banner[hidden] { display: none; }
|
|
57
|
+
.demo-banner strong { font-weight: 700; }
|
|
58
|
+
.demo-reset {
|
|
59
|
+
flex: none;
|
|
60
|
+
padding: 0.25rem 0.5rem;
|
|
61
|
+
border: 1px solid var(--accent);
|
|
62
|
+
border-radius: 6px;
|
|
63
|
+
background: var(--card);
|
|
64
|
+
color: var(--ink);
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
font: inherit;
|
|
67
|
+
}
|
|
68
|
+
.demo-reset:hover { border-color: var(--ink); }
|
|
69
|
+
</style>
|
|
70
|
+
</head>
|
|
71
|
+
<body>
|
|
72
|
+
<main>
|
|
73
|
+
<div class="demo-banner" data-gezel-demo-banner hidden>
|
|
74
|
+
<span><strong>Demo mode</strong> — sample data stays in this page.</span>
|
|
75
|
+
<button type="button" class="demo-reset" onclick="location.reload()">Reset demo</button>
|
|
76
|
+
</div>
|
|
77
|
+
<h1>Caregiving binder</h1>
|
|
78
|
+
<p class="sub" id="sub">Loading the record…</p>
|
|
79
|
+
<div class="cols">
|
|
80
|
+
<div class="panel">
|
|
81
|
+
<h2>Active medications</h2>
|
|
82
|
+
<ul id="meds"><li class="empty">None recorded yet.</li></ul>
|
|
83
|
+
<h2 style="margin-top: 0.9rem">Upcoming</h2>
|
|
84
|
+
<ul id="upcoming"><li class="empty">Nothing scheduled.</li></ul>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="panel">
|
|
87
|
+
<h2>Recent journal</h2>
|
|
88
|
+
<ul class="journal" id="journal"><li class="empty">The journal is empty — a quiet start.</li></ul>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
<p class="privacy">This record is stored in the project's files.</p>
|
|
92
|
+
</main>
|
|
93
|
+
<script>
|
|
94
|
+
/* gezel-page-demo-stub v1 */
|
|
95
|
+
/*
|
|
96
|
+
* The canonical demo stub for Gezel type pages. MIT License.
|
|
97
|
+
*
|
|
98
|
+
* Paste this file's bytes verbatim into a <script> block ahead of the
|
|
99
|
+
* page's own code, then call makeDemoGezel({ page, tools, data }) with the
|
|
100
|
+
* page's demo handlers. Served by Gezel, the real window.gezel is already
|
|
101
|
+
* injected and the stub steps aside; opened as a raw file (the live demos
|
|
102
|
+
* on gezelgilde.com), it installs a window.gezel whose tools and data are
|
|
103
|
+
* the page-supplied handler maps — one code path in every mode. `tools`
|
|
104
|
+
* and `data` map a tool name / declared read path to a function; data
|
|
105
|
+
* handlers back read() and list(), and url() returns the handler's value
|
|
106
|
+
* or passes a data: URI through. See docs/page-authoring.md.
|
|
107
|
+
*/
|
|
108
|
+
(function () {
|
|
109
|
+
'use strict';
|
|
110
|
+
window.makeDemoGezel = function (opts) {
|
|
111
|
+
if (window.gezel) return window.gezel;
|
|
112
|
+
var page = (opts && opts.page) || {};
|
|
113
|
+
var tools = (opts && opts.tools) || {};
|
|
114
|
+
var data = (opts && opts.data) || {};
|
|
115
|
+
var themeListeners = [];
|
|
116
|
+
var media = window.matchMedia ? window.matchMedia('(prefers-color-scheme: dark)') : null;
|
|
117
|
+
var ui = {
|
|
118
|
+
theme: { mode: media && media.matches ? 'dark' : 'light' },
|
|
119
|
+
onTheme: function (cb) {
|
|
120
|
+
themeListeners.push(cb);
|
|
121
|
+
return function () {
|
|
122
|
+
var at = themeListeners.indexOf(cb);
|
|
123
|
+
if (at >= 0) themeListeners.splice(at, 1);
|
|
124
|
+
};
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
if (media && media.addEventListener) {
|
|
128
|
+
media.addEventListener('change', function (ev) {
|
|
129
|
+
ui.theme = { mode: ev.matches ? 'dark' : 'light' };
|
|
130
|
+
themeListeners.slice().forEach(function (cb) { cb(ui.theme); });
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function fail(code, message) {
|
|
134
|
+
var err = new Error(message);
|
|
135
|
+
err.code = code;
|
|
136
|
+
return Promise.reject(err);
|
|
137
|
+
}
|
|
138
|
+
function run(map, key, arg) {
|
|
139
|
+
if (!Object.prototype.hasOwnProperty.call(map, key)) return null;
|
|
140
|
+
return Promise.resolve().then(function () { return map[key](arg); });
|
|
141
|
+
}
|
|
142
|
+
window.gezel = {
|
|
143
|
+
page: {
|
|
144
|
+
api: 1,
|
|
145
|
+
projectId: 'demo',
|
|
146
|
+
source: 'type',
|
|
147
|
+
entry: page.entry || 'index.html',
|
|
148
|
+
typeName: page.typeName || 'demo',
|
|
149
|
+
params: page.params || {},
|
|
150
|
+
mode: 'demo',
|
|
151
|
+
},
|
|
152
|
+
tools: {
|
|
153
|
+
list: function () { return Promise.resolve(Object.keys(tools)); },
|
|
154
|
+
invoke: function (name, input) {
|
|
155
|
+
var call = run(tools, name, input || {});
|
|
156
|
+
if (!call) return fail('not-allowed', "The demo does not handle the tool '" + name + "'.");
|
|
157
|
+
return call.then(function (output) { return { output: output }; });
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
data: {
|
|
161
|
+
read: function (path, o) {
|
|
162
|
+
return run(data, path, o || {}) || fail('not-allowed', "The demo has no data for '" + path + "'.");
|
|
163
|
+
},
|
|
164
|
+
list: function (path, o) {
|
|
165
|
+
return run(data, path, o || {}) || Promise.resolve([]);
|
|
166
|
+
},
|
|
167
|
+
watch: function () { return function () {}; },
|
|
168
|
+
url: function (path) {
|
|
169
|
+
if (Object.prototype.hasOwnProperty.call(data, path)) return String(data[path]({}));
|
|
170
|
+
return typeof path === 'string' && path.indexOf('data:') === 0 ? path : '';
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
ui: ui,
|
|
174
|
+
refresh: function () {},
|
|
175
|
+
};
|
|
176
|
+
return window.gezel;
|
|
177
|
+
};
|
|
178
|
+
})();
|
|
179
|
+
</script>
|
|
180
|
+
<script>
|
|
181
|
+
(function () {
|
|
182
|
+
'use strict';
|
|
183
|
+
|
|
184
|
+
// ── demo record (used only when the page opens as a raw file) ──
|
|
185
|
+
var demoNow = Date.now();
|
|
186
|
+
var demoMeds = { records: [
|
|
187
|
+
{ id: 'med-1', status: 'active', fields: { name: 'Lisinopril', dose: '10 mg each morning', prescriber: 'Dr. Chen' } },
|
|
188
|
+
{ id: 'med-2', status: 'active', fields: { name: 'Vitamin D', dose: '1 tablet with lunch' } },
|
|
189
|
+
] };
|
|
190
|
+
// Append order, oldest first — the shape logStore writes to care.json.
|
|
191
|
+
var demoCare = { events: [
|
|
192
|
+
{ kind: 'update', at: new Date(demoNow - 6 * 86400000).toISOString(), note: 'Blood pressure readings added to the visit notes.' },
|
|
193
|
+
{ kind: 'note', at: new Date(demoNow - 3 * 86400000).toISOString(), note: 'Refill collected; pill organizer set for the week.' },
|
|
194
|
+
{ kind: 'symptom', at: new Date(demoNow - 86400000).toISOString(), note: 'Energy was better after an afternoon walk.' },
|
|
195
|
+
{ kind: 'appointment', at: new Date(demoNow).toISOString(), note: 'Primary care follow-up', data: { whenAt: new Date(demoNow + 12 * 86400000).toISOString() } },
|
|
196
|
+
] };
|
|
197
|
+
|
|
198
|
+
makeDemoGezel({
|
|
199
|
+
page: { entry: 'dashboard/index.html', typeName: 'Caregiving Binder' },
|
|
200
|
+
data: {
|
|
201
|
+
'meds.json': function () { return demoMeds; },
|
|
202
|
+
'care.json': function () { return demoCare; },
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// ── one code path from here: window.gezel exists in every mode ──
|
|
207
|
+
var demoMode = gezel.page.mode === 'demo';
|
|
208
|
+
|
|
209
|
+
function applyTheme(mode) {
|
|
210
|
+
document.documentElement.setAttribute('data-theme', mode === 'dark' ? 'dark' : 'light');
|
|
211
|
+
}
|
|
212
|
+
applyTheme(gezel.ui.theme.mode);
|
|
213
|
+
gezel.ui.onTheme(function (theme) { applyTheme(theme.mode); });
|
|
214
|
+
|
|
215
|
+
if (demoMode) document.querySelector('[data-gezel-demo-banner]').hidden = false;
|
|
216
|
+
|
|
217
|
+
function esc(s) { return String(s).replace(/[&<>"]/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"' }[c]; }); }
|
|
218
|
+
|
|
219
|
+
function render(meds, care) {
|
|
220
|
+
var active = ((meds && meds.records) || []).filter(function (r) { return r.status === 'active'; });
|
|
221
|
+
var events = (care && care.events) || [];
|
|
222
|
+
var now = Date.now();
|
|
223
|
+
var upcoming = events.filter(function (e) {
|
|
224
|
+
var when = e.data && e.data.whenAt ? Date.parse(e.data.whenAt) : NaN;
|
|
225
|
+
return e.kind === 'appointment' && isFinite(when) && when >= now;
|
|
226
|
+
}).sort(function (a, b) { return Date.parse(a.data.whenAt) - Date.parse(b.data.whenAt); });
|
|
227
|
+
|
|
228
|
+
document.getElementById('sub').textContent =
|
|
229
|
+
active.length + ' active medication(s) · ' + upcoming.length + ' upcoming appointment(s)';
|
|
230
|
+
|
|
231
|
+
if (active.length) {
|
|
232
|
+
document.getElementById('meds').innerHTML = active.map(function (m) {
|
|
233
|
+
var f = m.fields || {};
|
|
234
|
+
return '<li>' + esc(f.name || m.id) + ' <span class="meta">' + esc(f.dose || '') +
|
|
235
|
+
(f.prescriber ? ' · ' + esc(f.prescriber) : '') + '</span></li>';
|
|
236
|
+
}).join('');
|
|
237
|
+
}
|
|
238
|
+
if (upcoming.length) {
|
|
239
|
+
document.getElementById('upcoming').innerHTML = upcoming.slice(0, 4).map(function (e) {
|
|
240
|
+
return '<li>' + esc(String(e.data.whenAt).slice(0, 16).replace('T', ' ')) + ' <span class="meta">' + esc(e.note || '') + '</span></li>';
|
|
241
|
+
}).join('');
|
|
242
|
+
}
|
|
243
|
+
var recent = events.filter(function (e) { return e.kind !== 'appointment'; }).slice(-6).reverse();
|
|
244
|
+
if (recent.length) {
|
|
245
|
+
document.getElementById('journal').innerHTML = recent.map(function (e) {
|
|
246
|
+
return '<li><span class="kind ' + esc(e.kind) + '">' + esc(e.kind) + '</span>' +
|
|
247
|
+
'<strong>' + esc(String(e.at).slice(0, 10)) + '</strong> — ' + esc(e.note || '') + '</li>';
|
|
248
|
+
}).join('');
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function loadRecord() {
|
|
253
|
+
return Promise.all([
|
|
254
|
+
gezel.data.read('meds.json').catch(function () { return { records: [] }; }),
|
|
255
|
+
gezel.data.read('care.json').catch(function () { return { events: [] }; }),
|
|
256
|
+
]).then(function (results) { render(results[0], results[1]); });
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
loadRecord();
|
|
260
|
+
gezel.data.watch('meds.json', function () { loadRecord(); });
|
|
261
|
+
gezel.data.watch('care.json', function () { loadRecord(); });
|
|
262
|
+
})();
|
|
263
|
+
</script>
|
|
264
|
+
</body>
|
|
265
|
+
</html>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"kind": "project-type",
|
|
4
4
|
"id": "household-budget",
|
|
5
5
|
"name": "Household Budget",
|
|
6
|
-
"description": "Know where the money actually goes. A calm Penningmeester (\"treasurer\") keeps the ledger, closes each month in minutes, and the live dashboard shows in, out, net, and the categories that matter
|
|
6
|
+
"description": "Know where the money actually goes. A calm Penningmeester (\"treasurer\") keeps the ledger, closes each month in minutes, and the live dashboard shows in, out, net, and the categories that matter.",
|
|
7
7
|
"tags": [
|
|
8
8
|
"budget",
|
|
9
9
|
"money",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
The household ledger, kept honest. Tell your Penningmeester when money moves —
|
|
2
|
+
"14.20 on groceries", "salary landed" — and it goes straight into the ledger on
|
|
3
|
+
this machine.
|
|
4
|
+
|
|
5
|
+
The **Output** tab shows the month at a glance: in, out, net ({{currency}}), the
|
|
6
|
+
biggest categories, and a quick-add box for the receipt in your hand.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"releasedAt": "2026-10-01T22:30:17Z",
|
|
5
|
+
"meesterManaged": false,
|
|
6
|
+
"params": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"currency": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"title": "Currency",
|
|
12
|
+
"description": "Shown on the dashboard; entries are unit-agnostic.",
|
|
13
|
+
"default": "USD"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"required": [
|
|
17
|
+
"currency"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"nameTemplate": "Household Budget",
|
|
21
|
+
"aboutTemplate": "about.md",
|
|
22
|
+
"missionTemplate": "mission.md",
|
|
23
|
+
"gezels": [
|
|
24
|
+
{
|
|
25
|
+
"templateId": "penningmeester",
|
|
26
|
+
"voorman": true
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"tools": [
|
|
30
|
+
{
|
|
31
|
+
"name": "add_expense",
|
|
32
|
+
"description": "Record spending the moment it happens (amount in ordinary units).",
|
|
33
|
+
"script": "budget-store",
|
|
34
|
+
"inputs": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"properties": {
|
|
37
|
+
"amount": {
|
|
38
|
+
"type": "number"
|
|
39
|
+
},
|
|
40
|
+
"category": {
|
|
41
|
+
"type": "string"
|
|
42
|
+
},
|
|
43
|
+
"note": {
|
|
44
|
+
"type": "string"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"required": [
|
|
48
|
+
"amount",
|
|
49
|
+
"category"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"bind": {
|
|
53
|
+
"action": "add_expense"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "add_income",
|
|
58
|
+
"description": "Record money coming in.",
|
|
59
|
+
"script": "budget-store",
|
|
60
|
+
"inputs": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"properties": {
|
|
63
|
+
"amount": {
|
|
64
|
+
"type": "number"
|
|
65
|
+
},
|
|
66
|
+
"category": {
|
|
67
|
+
"type": "string"
|
|
68
|
+
},
|
|
69
|
+
"note": {
|
|
70
|
+
"type": "string"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"required": [
|
|
74
|
+
"amount",
|
|
75
|
+
"category"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"bind": {
|
|
79
|
+
"action": "add_income"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "budget_status",
|
|
84
|
+
"description": "This month's shape: in, out, net, and the biggest categories.",
|
|
85
|
+
"script": "budget-store",
|
|
86
|
+
"inputs": {
|
|
87
|
+
"type": "object",
|
|
88
|
+
"properties": {}
|
|
89
|
+
},
|
|
90
|
+
"bind": {
|
|
91
|
+
"action": "status"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "month_summary",
|
|
96
|
+
"description": "Summarize any month ('YYYY-MM').",
|
|
97
|
+
"script": "budget-store",
|
|
98
|
+
"inputs": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"properties": {
|
|
101
|
+
"month": {
|
|
102
|
+
"type": "string"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"required": [
|
|
106
|
+
"month"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"bind": {
|
|
110
|
+
"action": "month_summary"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "record_expense",
|
|
115
|
+
"description": "The dashboard's quick-add expense entry.",
|
|
116
|
+
"script": "budget-store",
|
|
117
|
+
"inputs": {
|
|
118
|
+
"type": "object",
|
|
119
|
+
"properties": {
|
|
120
|
+
"amount": {
|
|
121
|
+
"type": "number"
|
|
122
|
+
},
|
|
123
|
+
"category": {
|
|
124
|
+
"type": "string"
|
|
125
|
+
},
|
|
126
|
+
"note": {
|
|
127
|
+
"type": "string"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"required": [
|
|
131
|
+
"amount",
|
|
132
|
+
"category"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
"bind": {
|
|
136
|
+
"action": "add_expense"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"craftbooks": [
|
|
141
|
+
"subscription-audit",
|
|
142
|
+
"month-close"
|
|
143
|
+
],
|
|
144
|
+
"schedules": [],
|
|
145
|
+
"pages": {
|
|
146
|
+
"entry": "dashboard/index.html",
|
|
147
|
+
"reads": [
|
|
148
|
+
{
|
|
149
|
+
"source": "workspace",
|
|
150
|
+
"path": "ledger.json"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"tools": [
|
|
154
|
+
"record_expense"
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
"workspaceSeed": [
|
|
158
|
+
"ledger.json"
|
|
159
|
+
],
|
|
160
|
+
"scripts": {
|
|
161
|
+
"budget-store": "import { type InferredInput, defineScript, gezel } from '@bendyline/gezel-sdk';\nimport { ledgerStore } from '@bendyline/gezel-sdk/stores';\n\nexport const meta = defineScript({\n name: 'budget-store',\n description:\n \"Read and update the household ledger (ledger.json). Call action:'status' for this month's shape (in/out/net, top categories); 'add_expense' or 'add_income' the moment money moves (amount in ordinary units, e.g. 12.50); 'month_summary' with month 'YYYY-MM' for any past month.\",\n inputs: {\n action: {\n type: 'string',\n description: \"One of 'status', 'add_expense', 'add_income', or 'month_summary'.\",\n required: true,\n },\n amount: { type: 'number', description: 'Amount in ordinary currency units, e.g. 12.50.' },\n category: { type: 'string', description: \"Category, e.g. 'groceries', 'rent', 'salary'.\" },\n note: { type: 'string', description: 'Short note on the entry.' },\n month: { type: 'string', description: \"Month for month_summary, e.g. '2026-06'.\" },\n },\n outputs: {\n entries: { type: 'number', description: 'Total ledger entries.' },\n summary: { type: 'string', description: 'Human-readable money summary.' },\n netCents: { type: 'number', description: 'Net for the summarized month, in cents.' },\n },\n requires: ['workspace.read', 'workspace.write'],\n} as const);\n\nconst input = gezel.input as InferredInput<typeof meta>;\n\n// ── budget-rules-start ──\n// Pure derivations shared with tests: cents conversion and the month\n// summary line, kept engine-side so the dashboard, the tools, and the\n// tests agree on one rendering.\n\nfunction toCents(amount) {\n if (typeof amount !== 'number' || !isFinite(amount) || amount <= 0) return null;\n return Math.round(amount * 100);\n}\n\nfunction fmtCents(cents) {\n var sign = cents < 0 ? '-' : '';\n var abs = Math.abs(cents);\n return sign + Math.floor(abs / 100) + '.' + String(abs % 100).padStart(2, '0');\n}\n\nfunction topCategories(byCategory, kind, limit) {\n return Object.entries(byCategory)\n .map(function (pair) {\n return { category: pair[0], cents: kind === 'out' ? pair[1].outCents : pair[1].inCents };\n })\n .filter(function (row) {\n return row.cents > 0;\n })\n .sort(function (a, b) {\n return b.cents - a.cents;\n })\n .slice(0, limit);\n}\n\nfunction monthLine(month, totals) {\n var top = topCategories(totals.byCategory, 'out', 3)\n .map(function (row) {\n return row.category + ' ' + fmtCents(row.cents);\n })\n .join(', ');\n return (\n month +\n ': in ' +\n fmtCents(totals.inCents) +\n ', out ' +\n fmtCents(totals.outCents) +\n ', net ' +\n fmtCents(totals.netCents) +\n (top ? '. Biggest: ' + top + '.' : '. No spending recorded.')\n );\n}\n// ── budget-rules-end ──\n\nconst ledger = ledgerStore(gezel.fs, 'ledger.json');\nconst currentMonth = new Date().toISOString().slice(0, 7);\n\nif (input.action === 'add_expense' || input.action === 'add_income') {\n const cents = toCents(input.amount);\n if (cents === null) throw new Error(\"Pass a positive 'amount' in ordinary units, e.g. 12.50.\");\n if (!input.category) throw new Error(\"Pass a 'category', e.g. 'groceries' or 'salary'.\");\n await ledger.add({\n amountCents: cents,\n kind: input.action === 'add_expense' ? 'out' : 'in',\n category: input.category.toLowerCase(),\n ...(input.note ? { note: input.note } : {}),\n });\n} else if (input.action !== 'status' && input.action !== 'month_summary') {\n throw new Error(\n `Unknown action '${input.action}'. Use status, add_expense, add_income, or month_summary.`,\n );\n}\n\nconst month =\n input.action === 'month_summary' && input.month ? input.month : currentMonth;\nconst totals = await ledger.totals({ month });\nconst all = await ledger.list();\n\ngezel.output({\n entries: all.length,\n summary: monthLine(month, totals),\n netCents: totals.netCents,\n});\n"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
- Every expense and income lands in the ledger the day it happens.
|
|
2
|
+
- The month gets closed with a twenty-minute review: in, out, net, biggest
|
|
3
|
+
categories, one observation.
|
|
4
|
+
- Quiet leaks get surfaced — recurring charges and drifting categories, with
|
|
5
|
+
figures attached, never a lecture.
|