@bendyline/gezel-cli 1.2.12 → 1.2.14
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/README.md +9 -2
- package/dist/app-author-command.js +7 -3
- package/dist/app-command.js +2 -0
- package/dist/app-guide.js +128 -0
- package/dist/bin/gezel-main.js +1896 -1660
- package/dist/handboek-export.js +175 -53
- package/dist/knowledge-command.js +2 -0
- package/dist/tui/index.js +62 -9
- package/package.json +9 -9
package/dist/handboek-export.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// src/handboek-export.ts
|
|
4
4
|
import { existsSync as existsSync2 } from "fs";
|
|
5
5
|
import { cp, mkdir as mkdir4, writeFile as writeFile4 } from "fs/promises";
|
|
6
|
-
import { join as join5, resolve as resolve2 } from "path";
|
|
7
|
-
import { SCORECARD_DATA_ATTRS as SCORECARD_DATA_ATTRS3 } from "@bendyline/gezel";
|
|
6
|
+
import { dirname as dirname3, join as join5, resolve as resolve2 } from "path";
|
|
7
|
+
import { SCORECARD_DATA_ATTRS as SCORECARD_DATA_ATTRS3, isGezelDeepLink } from "@bendyline/gezel";
|
|
8
8
|
import { CatalogService } from "@bendyline/gezel-catalog";
|
|
9
9
|
import {
|
|
10
10
|
OG_CARD_HEIGHT,
|
|
@@ -104,6 +104,32 @@ async function writePageDemo(directory, files, config, shared) {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
// src/site-open-in-gezel.ts
|
|
108
|
+
import { gezelDeepLinkUrl } from "@bendyline/gezel";
|
|
109
|
+
var OPEN_IN_GEZEL_ATTR = "data-gezel-open";
|
|
110
|
+
function openInGezelHtml(opts) {
|
|
111
|
+
return `<span class="open-in-gezel" ${OPEN_IN_GEZEL_ATTR} hidden><a class="${opts.buttonClass}" href="${gezelDeepLinkUrl(opts.link)}">${opts.label}</a><span class="${opts.noteClass}" hidden>Nothing opened? Opening from this site needs the latest Gezel. <a href="${opts.downloadHref}">Get Gezel</a></span></span>`;
|
|
112
|
+
}
|
|
113
|
+
var OPEN_IN_GEZEL_JS = `(function () {
|
|
114
|
+
if (/Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent)) return;
|
|
115
|
+
var wrappers = document.querySelectorAll('[${OPEN_IN_GEZEL_ATTR}]');
|
|
116
|
+
Array.prototype.forEach.call(wrappers, function (wrapper) {
|
|
117
|
+
var link = wrapper.querySelector('a');
|
|
118
|
+
var note = wrapper.querySelector('span');
|
|
119
|
+
if (!link || !note) return;
|
|
120
|
+
wrapper.hidden = false;
|
|
121
|
+
link.addEventListener('click', function () {
|
|
122
|
+
var timer = setTimeout(function () {
|
|
123
|
+
if (document.hasFocus() && document.visibilityState === 'visible') note.hidden = false;
|
|
124
|
+
}, 2500);
|
|
125
|
+
var left = function () { clearTimeout(timer); };
|
|
126
|
+
window.addEventListener('blur', left, { once: true });
|
|
127
|
+
document.addEventListener('visibilitychange', left, { once: true });
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
})();
|
|
131
|
+
`;
|
|
132
|
+
|
|
107
133
|
// src/apps-site.ts
|
|
108
134
|
var CATEGORIES = [
|
|
109
135
|
["home", "Home & Family"],
|
|
@@ -235,7 +261,7 @@ function masthead() {
|
|
|
235
261
|
<a href="/apps/" aria-current="page">Apps</a>
|
|
236
262
|
<a href="/docs/">Docs</a>
|
|
237
263
|
<a href="/docs/model-scorecard/">Model scorecard</a>
|
|
238
|
-
<a href="/platform/">
|
|
264
|
+
<a href="/platform/">Platform</a>
|
|
239
265
|
<a href="https://github.com/bendyline/gezel">GitHub</a>
|
|
240
266
|
</nav>
|
|
241
267
|
</header>`;
|
|
@@ -243,7 +269,7 @@ function masthead() {
|
|
|
243
269
|
function footer(ctx) {
|
|
244
270
|
return `<footer>
|
|
245
271
|
<p>\xA9 2026 Bendyline \xB7 Free and open source under the MIT license</p>
|
|
246
|
-
<p><a href="https://github.com/bendyline/gezel">GitHub</a><span class="sep" aria-hidden="true">\xB7</span><a href="/platform/">
|
|
272
|
+
<p><a href="https://github.com/bendyline/gezel">Star on GitHub</a><span class="sep" aria-hidden="true">\xB7</span><a href="/platform/">Platform</a><span class="sep" aria-hidden="true">\xB7</span><a href="${esc(ctx.docsBase)}craftbooks-index/">Craftbooks</a><span class="sep" aria-hidden="true">\xB7</span><a href="https://github.com/bendyline/gilde">Contribute an app</a></p>
|
|
247
273
|
</footer>`;
|
|
248
274
|
}
|
|
249
275
|
function mark(app, size, href) {
|
|
@@ -381,7 +407,13 @@ ${mark(app, 200, "logo.webp")}
|
|
|
381
407
|
<div>
|
|
382
408
|
<h1>${esc(m.name)}</h1>
|
|
383
409
|
<p class="lede">${esc(m.description)}</p>
|
|
384
|
-
<p class="app-actions"
|
|
410
|
+
<p class="app-actions">${ctx.openInGezel ? `${openInGezelHtml({
|
|
411
|
+
link: { kind: "app", id: m.id },
|
|
412
|
+
label: "Open in Gezel",
|
|
413
|
+
buttonClass: "button",
|
|
414
|
+
noteClass: "open-in-gezel-note",
|
|
415
|
+
downloadHref: "/#download"
|
|
416
|
+
})}<a class="button button-quiet" href="/#download">Get Gezel</a>` : '<a class="button" href="/#download">Get Gezel</a>'}<a class="text-link" href="${esc(docs)}project-type/${esc(m.id)}/">Read about it in the docs<span aria-hidden="true"> \u2192</span></a><a class="text-link" href="/platform/#ai-apps">Make one like this<span aria-hidden="true"> \u2192</span></a></p>
|
|
385
417
|
</div>
|
|
386
418
|
</section>
|
|
387
419
|
${demo}
|
|
@@ -402,7 +434,9 @@ ${more.length ? `<section class="more" aria-labelledby="more"><h2 id="more">More
|
|
|
402
434
|
</main>
|
|
403
435
|
${footer(ctx)}
|
|
404
436
|
</div>
|
|
405
|
-
|
|
437
|
+
${ctx.openInGezel ? `<script>
|
|
438
|
+
${OPEN_IN_GEZEL_JS}</script>
|
|
439
|
+
` : ""}</body>
|
|
406
440
|
</html>
|
|
407
441
|
`;
|
|
408
442
|
}
|
|
@@ -487,6 +521,11 @@ header.masthead { display: flex; align-items: center; justify-content: space-bet
|
|
|
487
521
|
.app-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin: 1.2rem 0 0; }
|
|
488
522
|
.button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 6px; background: var(--action-bg); color: var(--action-ink); font-weight: 600; box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 2px rgba(0,0,0,0.15); }
|
|
489
523
|
.button:hover { color: var(--action-ink); filter: brightness(1.06); }
|
|
524
|
+
.button-quiet { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--accent-line); }
|
|
525
|
+
.button-quiet:hover { color: var(--accent); filter: none; box-shadow: inset 0 0 0 2px var(--accent); }
|
|
526
|
+
.open-in-gezel { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
|
|
527
|
+
.open-in-gezel[hidden], .open-in-gezel-note[hidden] { display: none; }
|
|
528
|
+
.open-in-gezel-note { flex-basis: 100%; font-size: 0.86rem; color: var(--muted-strong); }
|
|
490
529
|
.demo { margin: 8px 0 48px; }
|
|
491
530
|
.demo-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
|
|
492
531
|
.demo h2, .inside h2, .steps h2, .more h2 { font-size: 1.6rem; margin: 0 0 0.4rem; }
|
|
@@ -1413,6 +1452,39 @@ ${DATA_TABLE_LOGIC_JS}
|
|
|
1413
1452
|
})();
|
|
1414
1453
|
`;
|
|
1415
1454
|
|
|
1455
|
+
// src/handboek-links.ts
|
|
1456
|
+
var PUBLISHED_HANDBOEK = "https://gezel.com/docs/";
|
|
1457
|
+
var up = (depth) => "../".repeat(depth);
|
|
1458
|
+
function rewriteSiteLinks(markdown, pageId, ids, byStem, hasAsset = () => true, base) {
|
|
1459
|
+
const prefix = base ?? up(pageId.split("/").length);
|
|
1460
|
+
return markdown.replace(/\]\(([^()\s]+)\)/g, (whole, rawTarget) => {
|
|
1461
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(rawTarget) || rawTarget.startsWith("//") || rawTarget.startsWith("#")) {
|
|
1462
|
+
return whole;
|
|
1463
|
+
}
|
|
1464
|
+
const [path, suffix = ""] = splitLinkSuffix(rawTarget);
|
|
1465
|
+
const candidate = path.replace(/^(\.\.?\/)+/, "");
|
|
1466
|
+
if (candidate.startsWith("assets/")) {
|
|
1467
|
+
return hasAsset(candidate) ? `](${prefix}${candidate}${suffix})` : `](${PUBLISHED_HANDBOEK}${candidate}${suffix})`;
|
|
1468
|
+
}
|
|
1469
|
+
const article = candidate.replace(/\.md$/, "");
|
|
1470
|
+
const target = ids.has(article) ? article : byStem.get(article.split("/").pop() ?? "");
|
|
1471
|
+
if (!target) return whole;
|
|
1472
|
+
return `](${prefix}${target}/${suffix})`;
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1475
|
+
function siteLinkIndex(entryIds) {
|
|
1476
|
+
const byStem = /* @__PURE__ */ new Map();
|
|
1477
|
+
for (const id of entryIds) {
|
|
1478
|
+
const stem = id.split("/").pop();
|
|
1479
|
+
if (stem && !byStem.has(stem)) byStem.set(stem, id);
|
|
1480
|
+
}
|
|
1481
|
+
return { ids: new Set(entryIds), byStem };
|
|
1482
|
+
}
|
|
1483
|
+
function splitLinkSuffix(raw) {
|
|
1484
|
+
const idx = raw.search(/[?#]/);
|
|
1485
|
+
return idx === -1 ? [raw, ""] : [raw.slice(0, idx), raw.slice(idx)];
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1416
1488
|
// src/handboek-og-cards.ts
|
|
1417
1489
|
import { createHash as createHash3 } from "crypto";
|
|
1418
1490
|
import { existsSync } from "fs";
|
|
@@ -2668,6 +2740,26 @@ th[aria-sort='descending'] .hb-data-table-sort::after { content: ' \u2193'; opac
|
|
|
2668
2740
|
}
|
|
2669
2741
|
.hb-demo-open { font-size: 0.9rem; }
|
|
2670
2742
|
|
|
2743
|
+
/* "Run this in Gezel": a gezel:// link under a craftbook's or app's title.
|
|
2744
|
+
Hidden until open-in-gezel.js shows it, on computers only. */
|
|
2745
|
+
.hb-open { margin: 0 0 1.5rem; }
|
|
2746
|
+
.open-in-gezel { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; }
|
|
2747
|
+
.open-in-gezel[hidden], .hb-open-note[hidden] { display: none; }
|
|
2748
|
+
.hb-open-button {
|
|
2749
|
+
display: inline-flex;
|
|
2750
|
+
align-items: center;
|
|
2751
|
+
min-height: 40px;
|
|
2752
|
+
padding: 0 1rem;
|
|
2753
|
+
border-radius: var(--hb-radius-sm);
|
|
2754
|
+
background: var(--hb-accent);
|
|
2755
|
+
color: #fff;
|
|
2756
|
+
font-family: var(--hb-font-ui);
|
|
2757
|
+
font-weight: 600;
|
|
2758
|
+
text-decoration: none;
|
|
2759
|
+
}
|
|
2760
|
+
.hb-open-button:hover { background: var(--hb-accent-hover); color: #fff; }
|
|
2761
|
+
.hb-open-note { flex-basis: 100%; font-size: 0.86rem; color: var(--hb-ink-muted); }
|
|
2762
|
+
|
|
2671
2763
|
/* Craftbook marks: one under each craftbook's title, and a gallery shelf.
|
|
2672
2764
|
Marks are transparent cut-outs, so the image's own background is the
|
|
2673
2765
|
colored paper the app paints behind them, picked by data-ground. Cream
|
|
@@ -2784,13 +2876,26 @@ ${groundRules}
|
|
|
2784
2876
|
var NAV_INLINE_MAX = 40;
|
|
2785
2877
|
var SCORECARD_SCRIPT = "scorecard.js";
|
|
2786
2878
|
var PLAYER_SCRIPT = "squisq-player.js";
|
|
2879
|
+
var OPEN_IN_GEZEL_SCRIPT = "open-in-gezel.js";
|
|
2787
2880
|
function pageScripts(body) {
|
|
2788
2881
|
return [
|
|
2789
2882
|
...body.includes(SCORECARD_DATA_ATTRS3.root) ? [SCORECARD_SCRIPT] : [],
|
|
2883
|
+
...body.includes(OPEN_IN_GEZEL_ATTR) ? [OPEN_IN_GEZEL_SCRIPT] : [],
|
|
2790
2884
|
// Deferred scripts run in order: the player must exist before the mount.
|
|
2791
2885
|
...body.includes(DATA_TABLE_ATTR) ? [PLAYER_SCRIPT, DATA_TABLE_SCRIPT] : []
|
|
2792
2886
|
];
|
|
2793
2887
|
}
|
|
2888
|
+
function openInGezelSection(entryId, siteUrl) {
|
|
2889
|
+
const [area, id] = entryId.split("/");
|
|
2890
|
+
const target = area === "craftbook" && id ? { link: { kind: "craftbook", id }, label: "Run this in Gezel" } : area === "project-type" && id ? { link: { kind: "app", id }, label: "Open in Gezel" } : void 0;
|
|
2891
|
+
if (!target || !isGezelDeepLink(target.link)) return void 0;
|
|
2892
|
+
return `<p class="hb-open">${openInGezelHtml({
|
|
2893
|
+
...target,
|
|
2894
|
+
buttonClass: "hb-open-button",
|
|
2895
|
+
noteClass: "hb-open-note",
|
|
2896
|
+
downloadHref: `${esc2(siteUrl)}#download`
|
|
2897
|
+
})}</p>`;
|
|
2898
|
+
}
|
|
2794
2899
|
var AREA_BLURBS = {
|
|
2795
2900
|
conceptual: "What gezel is, who your crew are, and how the pieces fit together.",
|
|
2796
2901
|
"gezel-roles": "The roles a gezel can take, and what each one is good at.",
|
|
@@ -2835,15 +2940,12 @@ async function runHandboekExport(opts) {
|
|
|
2835
2940
|
...areas.flatMap((a) => a.entries),
|
|
2836
2941
|
...site.pages.filter((p) => !p.listed && !p.replaces).map((p) => p.entry)
|
|
2837
2942
|
];
|
|
2838
|
-
const ids =
|
|
2839
|
-
const
|
|
2840
|
-
for (const e of entries) {
|
|
2841
|
-
const stem = e.id.split("/").pop();
|
|
2842
|
-
if (stem && !byStem.has(stem)) byStem.set(stem, e.id);
|
|
2843
|
-
}
|
|
2943
|
+
const { ids, byStem } = siteLinkIndex(entries.map((e) => e.id));
|
|
2944
|
+
const twinBase = normalizeBase(opts.canonicalBase) ?? PUBLISHED_HANDBOEK;
|
|
2844
2945
|
await mkdir4(join5(out, "assets"), { recursive: true });
|
|
2845
2946
|
await writeFile4(join5(out, "assets", PLAYER_SCRIPT), PLAYER_BUNDLE, "utf8");
|
|
2846
2947
|
await writeFile4(join5(out, "assets", SCORECARD_SCRIPT), SCORECARD_FILTER_JS, "utf8");
|
|
2948
|
+
await writeFile4(join5(out, "assets", OPEN_IN_GEZEL_SCRIPT), OPEN_IN_GEZEL_JS, "utf8");
|
|
2847
2949
|
await writeFile4(join5(out, "assets", DATA_TABLE_SCRIPT), DATA_TABLE_JS, "utf8");
|
|
2848
2950
|
const skipped = [];
|
|
2849
2951
|
const warnings = [];
|
|
@@ -2859,18 +2961,22 @@ async function runHandboekExport(opts) {
|
|
|
2859
2961
|
title: entry.title,
|
|
2860
2962
|
markdown: sitePage.markdown,
|
|
2861
2963
|
defaultDuration: void 0
|
|
2862
|
-
} : await engine.article(entry.id, { mode: "site" });
|
|
2964
|
+
} : await engine.article(entry.id, { mode: "site", inlineIncludes: true });
|
|
2863
2965
|
if (!article) {
|
|
2864
2966
|
skipped.push(entry.id);
|
|
2865
2967
|
continue;
|
|
2866
2968
|
}
|
|
2867
2969
|
const depth = entry.id.split("/").length;
|
|
2868
|
-
const
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
(
|
|
2970
|
+
const hasAsset = (asset) => existsSync2(join5(contentDir, asset));
|
|
2971
|
+
const markdown = rewriteSiteLinks(article.markdown, entry.id, ids, byStem, hasAsset);
|
|
2972
|
+
await mkdir4(dirname3(join5(out, `${entry.id}.md`)), { recursive: true });
|
|
2973
|
+
await writeFile4(
|
|
2974
|
+
join5(out, `${entry.id}.md`),
|
|
2975
|
+
markdownTwin(
|
|
2976
|
+
entry.title,
|
|
2977
|
+
rewriteSiteLinks(article.markdown, entry.id, ids, byStem, hasAsset, twinBase)
|
|
2978
|
+
),
|
|
2979
|
+
"utf8"
|
|
2874
2980
|
);
|
|
2875
2981
|
const parsed = parseMarkdown(markdown);
|
|
2876
2982
|
const doc = markdownToDoc(parsed, {
|
|
@@ -2892,6 +2998,8 @@ ${sitePage.html}`;
|
|
|
2892
2998
|
const appsPage = opts.appsOut ? `/apps/${demo.projectTypeId}/` : void 0;
|
|
2893
2999
|
rendered = insertDemoSection(rendered, demoSectionHtml(demo, entry.title, appsPage));
|
|
2894
3000
|
}
|
|
3001
|
+
const open = siteUrl && opts.openInGezel ? openInGezelSection(entry.id, siteUrl) : void 0;
|
|
3002
|
+
if (open) rendered = insertAfterTitle(rendered, open);
|
|
2895
3003
|
if (art) rendered = insertAfterTitle(rendered, craftbookArtHtml(entry.title, art.ground));
|
|
2896
3004
|
const { html: body, headings } = withHeadingIds(rendered);
|
|
2897
3005
|
const dir = join5(out, ...entry.id.split("/"));
|
|
@@ -2936,7 +3044,7 @@ ${sitePage.html}`;
|
|
|
2936
3044
|
await writeFile4(
|
|
2937
3045
|
join5(dir, "watch.html"),
|
|
2938
3046
|
generateExternalHtml(doc, {
|
|
2939
|
-
playerScriptPath: `${
|
|
3047
|
+
playerScriptPath: `${up2(depth)}assets/${PLAYER_SCRIPT}`,
|
|
2940
3048
|
mode: "slideshow",
|
|
2941
3049
|
title: article.title,
|
|
2942
3050
|
autoPlay: true,
|
|
@@ -2960,6 +3068,11 @@ ${sitePage.html}`;
|
|
|
2960
3068
|
}
|
|
2961
3069
|
await writeFile4(join5(out, "index.html"), landingPage(areas, css, siteUrl, landingSocial), "utf8");
|
|
2962
3070
|
pages += 1;
|
|
3071
|
+
const written = areas.map((a) => ({
|
|
3072
|
+
...a,
|
|
3073
|
+
entries: a.entries.filter((e) => !skipped.includes(e.id))
|
|
3074
|
+
}));
|
|
3075
|
+
await writeFile4(join5(out, "llms.txt"), llmsTxt(written, twinBase), "utf8");
|
|
2963
3076
|
const assetsSrc = join5(contentDir, "assets");
|
|
2964
3077
|
if (existsSync2(assetsSrc)) {
|
|
2965
3078
|
await cp(assetsSrc, join5(out, "assets"), { recursive: true });
|
|
@@ -2979,7 +3092,8 @@ ${sitePage.html}`;
|
|
|
2979
3092
|
const apps = opts.appsOut ? await writeAppsSite(catalog, site, {
|
|
2980
3093
|
out: resolve2(opts.appsOut),
|
|
2981
3094
|
docsBase: "/docs/",
|
|
2982
|
-
...canonicalBase ? { siteOrigin: new URL(canonicalBase).origin } : {}
|
|
3095
|
+
...canonicalBase ? { siteOrigin: new URL(canonicalBase).origin } : {},
|
|
3096
|
+
...opts.openInGezel ? { openInGezel: true } : {}
|
|
2983
3097
|
}) : void 0;
|
|
2984
3098
|
return { out, pages, skipped, warnings, cards, apps };
|
|
2985
3099
|
}
|
|
@@ -2989,29 +3103,34 @@ function normalizeBase(base) {
|
|
|
2989
3103
|
if (!trimmed) return void 0;
|
|
2990
3104
|
return trimmed.endsWith("/") ? trimmed : `${trimmed}/`;
|
|
2991
3105
|
}
|
|
2992
|
-
function
|
|
2993
|
-
const
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
const candidate = path.replace(/^(\.\.?\/)+/, "");
|
|
3000
|
-
if (candidate.startsWith("assets/")) {
|
|
3001
|
-
return hasAsset(candidate) ? `](${prefix}${candidate}${suffix})` : `](${PUBLISHED_HANDBOEK}${candidate}${suffix})`;
|
|
3002
|
-
}
|
|
3003
|
-
const article = candidate.replace(/\.md$/, "");
|
|
3004
|
-
const target = ids.has(article) ? article : byStem.get(article.split("/").pop() ?? "");
|
|
3005
|
-
if (!target) return whole;
|
|
3006
|
-
return `](${prefix}${target}/${suffix})`;
|
|
3007
|
-
});
|
|
3106
|
+
function markdownTwin(title, markdown) {
|
|
3107
|
+
const body = markdown.trimStart();
|
|
3108
|
+
const titled = body.startsWith("# ") ? body : `# ${title}
|
|
3109
|
+
|
|
3110
|
+
${body}`;
|
|
3111
|
+
return `${titled.trimEnd()}
|
|
3112
|
+
`;
|
|
3008
3113
|
}
|
|
3009
|
-
function
|
|
3010
|
-
const
|
|
3011
|
-
|
|
3114
|
+
function llmsTxt(areas, base) {
|
|
3115
|
+
const lines = [
|
|
3116
|
+
"# Gezel Handboek",
|
|
3117
|
+
"",
|
|
3118
|
+
"> Gezel is a free, open-source app and platform for running a crew of AI agents on your own computer, with local models or a cloud plan you already have. Every article below is plain markdown.",
|
|
3119
|
+
"",
|
|
3120
|
+
`To build a Gezel app, read [Build a Gezel app: the complete guide](${base}${APP_GUIDE_ID}.md) first. It holds the working loop, the rules, and the four app-building guides in full.`
|
|
3121
|
+
];
|
|
3122
|
+
for (const area of areas) {
|
|
3123
|
+
lines.push("", `## ${area.title}`, "");
|
|
3124
|
+
for (const entry of area.entries) {
|
|
3125
|
+
const summary = entry.summary ? `: ${entry.summary.replace(/\s+/g, " ").trim()}` : "";
|
|
3126
|
+
lines.push(`- [${entry.title}](${base}${entry.id}.md)${summary}`);
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
return `${lines.join("\n")}
|
|
3130
|
+
`;
|
|
3012
3131
|
}
|
|
3013
|
-
var
|
|
3014
|
-
var
|
|
3132
|
+
var APP_GUIDE_ID = "build-a-gezel-app";
|
|
3133
|
+
var up2 = (depth) => "../".repeat(depth);
|
|
3015
3134
|
var esc2 = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
3016
3135
|
function extractBody(page) {
|
|
3017
3136
|
const match = page.match(/<body[^>]*>([\s\S]*)<\/body>/i);
|
|
@@ -3052,10 +3171,10 @@ function resolveCssHref(href, depth) {
|
|
|
3052
3171
|
if (/^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//") || href.startsWith("/")) {
|
|
3053
3172
|
return href;
|
|
3054
3173
|
}
|
|
3055
|
-
return `${
|
|
3174
|
+
return `${up2(depth)}${href}`;
|
|
3056
3175
|
}
|
|
3057
3176
|
function cssLinks(css, depth) {
|
|
3058
|
-
return [`${
|
|
3177
|
+
return [`${up2(depth)}assets/handboek.css`, ...css.map((h) => resolveCssHref(h, depth))].map((href) => `<link rel="stylesheet" href="${esc2(href)}">`).join("\n");
|
|
3059
3178
|
}
|
|
3060
3179
|
function socialTags(description, social) {
|
|
3061
3180
|
const title = social.title;
|
|
@@ -3101,12 +3220,12 @@ function masthead2(areas, depth, siteUrl, currentArea) {
|
|
|
3101
3220
|
const links = areas.map((a) => {
|
|
3102
3221
|
const target = areaLanding(a);
|
|
3103
3222
|
const current = a.area === currentArea ? ' aria-current="true"' : "";
|
|
3104
|
-
return `<a${current} href="${
|
|
3223
|
+
return `<a${current} href="${up2(depth)}${esc2(target)}/">${esc2(a.title)}</a>`;
|
|
3105
3224
|
}).join("\n");
|
|
3106
3225
|
const wordmark = siteUrl ? `<a class="hb-wordmark" href="${esc2(siteUrl)}">${WORDMARK}</a>
|
|
3107
3226
|
` : "";
|
|
3108
3227
|
return `<header class="hb-masthead">
|
|
3109
|
-
${wordmark}<a class="hb-brand" href="${
|
|
3228
|
+
${wordmark}<a class="hb-brand" href="${up2(depth)}">Gezel Handboek</a>
|
|
3110
3229
|
<nav class="hb-areanav">
|
|
3111
3230
|
${links}
|
|
3112
3231
|
</nav>
|
|
@@ -3125,8 +3244,8 @@ function sidebar(areas, entry, depth) {
|
|
|
3125
3244
|
const isCurrent = area.area === entry.area;
|
|
3126
3245
|
const items = isCurrent && area.entries.length <= NAV_INLINE_MAX ? area.entries : isCurrent ? dedupeById([...area.entries.filter((e) => e.id === areaLanding(area)), entry]) : [];
|
|
3127
3246
|
const list = items.length ? sidebarEntryList(items, entry.id, depth) : "";
|
|
3128
|
-
const more = isCurrent && area.entries.length > NAV_INLINE_MAX ? `<p class="hb-more"><a href="${
|
|
3129
|
-
const heading = isCurrent ? `<h2 class="hb-current">${esc2(area.title)}</h2>` : `<h2><a href="${
|
|
3247
|
+
const more = isCurrent && area.entries.length > NAV_INLINE_MAX ? `<p class="hb-more"><a href="${up2(depth)}${esc2(areaLanding(area))}/">All ${articleCount(area)} ${esc2(area.title.toLowerCase())}</a></p>` : "";
|
|
3248
|
+
const heading = isCurrent ? `<h2 class="hb-current">${esc2(area.title)}</h2>` : `<h2><a href="${up2(depth)}${esc2(areaLanding(area))}/">${esc2(area.title)}</a></h2>`;
|
|
3130
3249
|
return `<section>
|
|
3131
3250
|
${heading}
|
|
3132
3251
|
${list}
|
|
@@ -3171,7 +3290,7 @@ ${items.join("\n")}
|
|
|
3171
3290
|
}
|
|
3172
3291
|
function sidebarEntryLink(entry, currentId, depth) {
|
|
3173
3292
|
const current = entry.id === currentId ? ' class="hb-current" aria-current="page"' : "";
|
|
3174
|
-
return `<li><a${current} href="${
|
|
3293
|
+
return `<li><a${current} href="${up2(depth)}${esc2(entry.id)}/">${esc2(entry.title)}</a></li>`;
|
|
3175
3294
|
}
|
|
3176
3295
|
function dedupeById(list) {
|
|
3177
3296
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -3193,7 +3312,7 @@ function articlePage(args) {
|
|
|
3193
3312
|
const { entry, body, headings, areas, depth, css, siteUrl, social, scripts } = args;
|
|
3194
3313
|
const area = areas.find((a) => a.area === entry.area);
|
|
3195
3314
|
const aside = onThisPage(headings);
|
|
3196
|
-
const scriptTags = scripts.map((name) => `<script defer src="${
|
|
3315
|
+
const scriptTags = scripts.map((name) => `<script defer src="${up2(depth)}assets/${esc2(name)}"></script>`).join("\n");
|
|
3197
3316
|
return `${head2(`${entry.title} \u2014 Gezel Handboek`, css, depth, entry.summary, social)}
|
|
3198
3317
|
<body class="hb hb-article-page">
|
|
3199
3318
|
${masthead2(areas, depth, siteUrl, entry.area)}
|
|
@@ -3201,12 +3320,12 @@ ${masthead2(areas, depth, siteUrl, entry.area)}
|
|
|
3201
3320
|
${sidebar(areas, entry, depth)}
|
|
3202
3321
|
<main class="hb-main">
|
|
3203
3322
|
<nav class="hb-breadcrumb" aria-label="Breadcrumb">
|
|
3204
|
-
<a href="${
|
|
3323
|
+
<a href="${up2(depth)}">Handboek</a>${area ? ` <span>/</span> <a href="${up2(depth)}${esc2(areaLanding(area))}/">${esc2(area.title)}</a>` : ""}
|
|
3205
3324
|
</nav>
|
|
3206
3325
|
<article class="hb-article">
|
|
3207
3326
|
${body}
|
|
3208
3327
|
</article>
|
|
3209
|
-
<p class="hb-watch"><a href="watch.html">Watch this article as a slideshow</a></p>
|
|
3328
|
+
<p class="hb-watch"><a href="watch.html">Watch this article as a slideshow</a> \xB7 <a href="../${esc2(entry.id.split("/").pop() ?? entry.id)}.md">Read it as markdown, for AI agents</a></p>
|
|
3210
3329
|
</main>
|
|
3211
3330
|
${aside}
|
|
3212
3331
|
</div>
|
|
@@ -3217,7 +3336,7 @@ ${scriptTags}
|
|
|
3217
3336
|
}
|
|
3218
3337
|
function footer2(depth) {
|
|
3219
3338
|
return `<footer class="hb-footer">
|
|
3220
|
-
<p><a href="${
|
|
3339
|
+
<p><a href="${up2(depth)}">Gezel Handboek</a> \u2014 documentation for gezel, a crew of AI companions that works for you, from your own computer.</p>
|
|
3221
3340
|
</footer>`;
|
|
3222
3341
|
}
|
|
3223
3342
|
function landingPage(areas, css, siteUrl, social) {
|
|
@@ -3266,6 +3385,9 @@ ${footer2(0)}
|
|
|
3266
3385
|
}
|
|
3267
3386
|
export {
|
|
3268
3387
|
extractBody,
|
|
3388
|
+
llmsTxt,
|
|
3389
|
+
markdownTwin,
|
|
3390
|
+
openInGezelSection,
|
|
3269
3391
|
pageScripts,
|
|
3270
3392
|
resolveCssHref,
|
|
3271
3393
|
rewriteSiteLinks,
|
|
@@ -34,6 +34,7 @@ import { createHash, randomUUID } from "crypto";
|
|
|
34
34
|
import { chmod, mkdir, readFile, realpath, rm, writeFile } from "fs/promises";
|
|
35
35
|
import { homedir } from "os";
|
|
36
36
|
import { basename, dirname, join, resolve } from "path";
|
|
37
|
+
import { fileURLToPath } from "url";
|
|
37
38
|
import {
|
|
38
39
|
evaluateApiCompat,
|
|
39
40
|
getLogLevel,
|
|
@@ -51,6 +52,7 @@ import {
|
|
|
51
52
|
authorizeLocalOwner
|
|
52
53
|
} from "@bendyline/gezel-app-sdk";
|
|
53
54
|
import {
|
|
55
|
+
DaemonInAnotherNamespaceError,
|
|
54
56
|
GezelApiError,
|
|
55
57
|
GezelClient,
|
|
56
58
|
LiveDaemonUnhealthyError,
|
package/dist/tui/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { createHash, randomUUID } from "crypto";
|
|
|
17
17
|
import { chmod, mkdir, readFile, realpath, rm, writeFile } from "fs/promises";
|
|
18
18
|
import { homedir } from "os";
|
|
19
19
|
import { basename, dirname, join, resolve } from "path";
|
|
20
|
+
import { fileURLToPath } from "url";
|
|
20
21
|
import {
|
|
21
22
|
evaluateApiCompat,
|
|
22
23
|
getLogLevel,
|
|
@@ -34,6 +35,7 @@ import {
|
|
|
34
35
|
authorizeLocalOwner
|
|
35
36
|
} from "@bendyline/gezel-app-sdk";
|
|
36
37
|
import {
|
|
38
|
+
DaemonInAnotherNamespaceError,
|
|
37
39
|
GezelApiError,
|
|
38
40
|
GezelClient,
|
|
39
41
|
LiveDaemonUnhealthyError,
|
|
@@ -2535,6 +2537,25 @@ var NATIVE_TOOLKIT = [
|
|
|
2535
2537
|
"whisper-server",
|
|
2536
2538
|
"llama-server"
|
|
2537
2539
|
];
|
|
2540
|
+
function nativeEngineUse(engine) {
|
|
2541
|
+
switch (engine) {
|
|
2542
|
+
case "llama-server":
|
|
2543
|
+
return "runs chat models on this computer";
|
|
2544
|
+
case "uv":
|
|
2545
|
+
return "runs local helpers such as voices and image reading";
|
|
2546
|
+
case "sd-server":
|
|
2547
|
+
return "makes images";
|
|
2548
|
+
case "whisper-server":
|
|
2549
|
+
return "turns speech into text";
|
|
2550
|
+
case "ds4-server":
|
|
2551
|
+
return "runs DeepSeek V4 models";
|
|
2552
|
+
case "duckdb":
|
|
2553
|
+
return "queries spreadsheets and data files";
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
function nativeToolkitTitle(missing, provider) {
|
|
2557
|
+
return missing.includes(provider === "mlx" ? "uv" : "llama-server") ? "The engine Gezel needs to run chat models on this computer is not installed yet" : "Some optional Gezel engines are not installed yet";
|
|
2558
|
+
}
|
|
2538
2559
|
function recoDevice(memory) {
|
|
2539
2560
|
return {
|
|
2540
2561
|
platform: memory.platform,
|
|
@@ -4759,8 +4780,17 @@ async function settledFirstRunConfig(client, options = {}) {
|
|
|
4759
4780
|
// src/tui/components/BootstrapGate.tsx
|
|
4760
4781
|
import { Fragment as Fragment4, jsx as jsx6, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4761
4782
|
var MAX_ALTERNATIVE_MODELS = 6;
|
|
4783
|
+
var SKIP_HINTS = {
|
|
4784
|
+
tui: "open the TUI without a local model",
|
|
4785
|
+
run: "stop without running your request"
|
|
4786
|
+
};
|
|
4787
|
+
var CONTINUE_OPTIONS = {
|
|
4788
|
+
tui: { label: "Continue to Gezel", hint: "configure this later" },
|
|
4789
|
+
run: { label: "Stop here", hint: "set this up later" }
|
|
4790
|
+
};
|
|
4762
4791
|
function BootstrapGate(props) {
|
|
4763
4792
|
const { client, children } = props;
|
|
4793
|
+
const nextStep = props.nextStep ?? "tui";
|
|
4764
4794
|
const { exit } = useApp2();
|
|
4765
4795
|
const [screen, setScreen] = useState6({
|
|
4766
4796
|
kind: "loading",
|
|
@@ -5041,25 +5071,22 @@ function BootstrapGate(props) {
|
|
|
5041
5071
|
] });
|
|
5042
5072
|
}
|
|
5043
5073
|
if (screen.kind === "native-choice") {
|
|
5044
|
-
|
|
5045
|
-
return /* @__PURE__ */ jsxs7(BootstrapFrame, { title: "The Gezel native toolkit -- needed to run AI models locally -- is not installed yet", children: [
|
|
5074
|
+
return /* @__PURE__ */ jsxs7(BootstrapFrame, { title: nativeToolkitTitle(screen.missing, screen.context.provider), children: [
|
|
5046
5075
|
/* @__PURE__ */ jsx6(Text7, { children: `Gezel can install the verified Gezel native toolkit (native-v${screen.context.nativeStatus.release}) for this device.` }),
|
|
5047
5076
|
/* @__PURE__ */ jsxs7(Text7, { children: [
|
|
5048
5077
|
"Downloaded from",
|
|
5049
5078
|
" ",
|
|
5050
5079
|
/* @__PURE__ */ jsx6(Text7, { bold: true, color: "cyan", children: "https://github.com/bendyline/gezel/releases/" })
|
|
5051
5080
|
] }),
|
|
5052
|
-
/* @__PURE__ */
|
|
5053
|
-
|
|
5054
|
-
labels
|
|
5055
|
-
] }),
|
|
5081
|
+
/* @__PURE__ */ jsx6(Text7, { dimColor: true, children: "Not installed:" }),
|
|
5082
|
+
screen.missing.map((engine) => /* @__PURE__ */ jsx6(Text7, { dimColor: true, children: ` - ${nativeLabel(engine)}: ${nativeEngineUse(engine)}` }, engine)),
|
|
5056
5083
|
/* @__PURE__ */ jsx6(
|
|
5057
5084
|
BootstrapChoiceList,
|
|
5058
5085
|
{
|
|
5059
5086
|
options: [
|
|
5060
5087
|
{
|
|
5061
5088
|
label: "Install the Gezel native toolkit",
|
|
5062
|
-
hint:
|
|
5089
|
+
hint: `recommended \xB7 ${screen.missing.length === 1 ? "the engine" : `the ${screen.missing.length} engines`} above`,
|
|
5063
5090
|
value: "install"
|
|
5064
5091
|
},
|
|
5065
5092
|
{ label: "Not now", hint: "continue to model choices", value: "skip" }
|
|
@@ -5113,7 +5140,7 @@ function BootstrapGate(props) {
|
|
|
5113
5140
|
hint: `${formatDownloadSize(model.approxSizeBytes)} \xB7 ${fitLabel(model.fit)}`,
|
|
5114
5141
|
value: `chat:${model.id}`
|
|
5115
5142
|
})),
|
|
5116
|
-
{ label: "Not now", hint:
|
|
5143
|
+
{ label: "Not now", hint: SKIP_HINTS[nextStep], value: "skip" }
|
|
5117
5144
|
];
|
|
5118
5145
|
return /* @__PURE__ */ jsxs7(
|
|
5119
5146
|
BootstrapFrame,
|
|
@@ -5154,7 +5181,7 @@ function BootstrapGate(props) {
|
|
|
5154
5181
|
{
|
|
5155
5182
|
options: [
|
|
5156
5183
|
...screen.retry ? [{ label: "Try again", hint: "resume setup", value: "retry" }] : [],
|
|
5157
|
-
{
|
|
5184
|
+
{ ...CONTINUE_OPTIONS[nextStep], value: "continue" }
|
|
5158
5185
|
],
|
|
5159
5186
|
onSelect: (value) => {
|
|
5160
5187
|
if (value === "retry") screen.retry?.();
|
|
@@ -5164,6 +5191,15 @@ function BootstrapGate(props) {
|
|
|
5164
5191
|
)
|
|
5165
5192
|
] });
|
|
5166
5193
|
}
|
|
5194
|
+
function ExitWhenReady(props) {
|
|
5195
|
+
const { onReady } = props;
|
|
5196
|
+
const { exit } = useApp2();
|
|
5197
|
+
useEffect5(() => {
|
|
5198
|
+
onReady();
|
|
5199
|
+
exit();
|
|
5200
|
+
}, [exit, onReady]);
|
|
5201
|
+
return null;
|
|
5202
|
+
}
|
|
5167
5203
|
function BootstrapFrame(props) {
|
|
5168
5204
|
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 1, paddingY: 1, children: [
|
|
5169
5205
|
/* @__PURE__ */ jsx6(Text7, { bold: true, color: "cyan", children: "gezel \xB7 first-time setup" }),
|
|
@@ -5539,6 +5575,23 @@ async function launchTui(opts) {
|
|
|
5539
5575
|
await diagnostics.stop();
|
|
5540
5576
|
}
|
|
5541
5577
|
}
|
|
5578
|
+
async function launchRunSetup(opts) {
|
|
5579
|
+
let finished = false;
|
|
5580
|
+
const instance = render(
|
|
5581
|
+
/* @__PURE__ */ jsx7(BootstrapGate, { client: opts.client, nextStep: "run", children: /* @__PURE__ */ jsx7(
|
|
5582
|
+
ExitWhenReady,
|
|
5583
|
+
{
|
|
5584
|
+
onReady: () => {
|
|
5585
|
+
finished = true;
|
|
5586
|
+
}
|
|
5587
|
+
}
|
|
5588
|
+
) }),
|
|
5589
|
+
{ stdout: process.stderr, exitOnCtrlC: false }
|
|
5590
|
+
);
|
|
5591
|
+
await instance.waitUntilExit();
|
|
5592
|
+
return finished;
|
|
5593
|
+
}
|
|
5542
5594
|
export {
|
|
5595
|
+
launchRunSetup,
|
|
5543
5596
|
launchTui
|
|
5544
5597
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/gezel-cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
4
4
|
"description": "The gezel command-line tool: chat with your gezels, run craftbooks, and manage local models from the terminal.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"!dist/**/*.map"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@bendyline/gezel": "1.2.
|
|
48
|
-
"@bendyline/gezel-app-sdk": "1.1.
|
|
49
|
-
"@bendyline/gezel-catalog": "1.2.
|
|
50
|
-
"@bendyline/gezel-client": "1.2.
|
|
47
|
+
"@bendyline/gezel": "1.2.14",
|
|
48
|
+
"@bendyline/gezel-app-sdk": "1.1.14",
|
|
49
|
+
"@bendyline/gezel-catalog": "1.2.14",
|
|
50
|
+
"@bendyline/gezel-client": "1.2.14",
|
|
51
51
|
"@bendyline/gezel-knowledge": "1.2.10",
|
|
52
|
-
"@bendyline/gezel-service": "1.2.
|
|
53
|
-
"@bendyline/squisq": "2.13.
|
|
54
|
-
"@bendyline/squisq-formats": "2.8.
|
|
55
|
-
"@bendyline/squisq-react": "2.12.
|
|
52
|
+
"@bendyline/gezel-service": "1.2.14",
|
|
53
|
+
"@bendyline/squisq": "2.13.12",
|
|
54
|
+
"@bendyline/squisq-formats": "2.8.14",
|
|
55
|
+
"@bendyline/squisq-react": "2.12.24",
|
|
56
56
|
"commander": "^15.0.0",
|
|
57
57
|
"ink": "^7.1.1",
|
|
58
58
|
"ink-text-input": "^6.0.0",
|