@bendyline/gezel-cli 1.2.13 → 1.3.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.
@@ -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/">For developers</a>
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/">For developers</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>
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) {
@@ -271,15 +297,15 @@ ${mark(app, 160, `${prefix}${id}/logo.webp`)}
271
297
  function indexHtml(apps, ctx) {
272
298
  const present = CATEGORIES.filter(([id]) => apps.some((a) => a.category === id));
273
299
  const demos = apps.filter((a) => a.demo).length;
274
- const description = `${apps.length} Gezel apps: an interface paired with AI crew members, the plans they follow, and the actions they take. Try ${demos} of them in your browser.`;
275
- return `${head("Gezel apps \u2014 a page you use, and a crew that works it", description, "/apps/", ctx)}
300
+ const description = `${apps.length} Gezel apps: an interface paired with AI that knows the job, the plans it follows, and the actions it takes. Try ${demos} of them in your browser.`;
301
+ return `${head("Gezel apps \u2014 a page you use, and Gezel working behind it", description, "/apps/", ctx)}
276
302
  <body>
277
303
  <div class="wrap">
278
304
  ${masthead()}
279
305
  <main>
280
306
  <section class="hero">
281
- <h1><span class="title">Gezel apps</span><span class="tagline">A page you use, and a crew that works it.</span></h1>
282
- <p class="lede">Each app pairs an interface with AI crew members who know the job, the step-by-step plans they follow, and actions that change the app\u2019s own files. Try ${demos} of them right here on sample data, with a scripted conversation. In Gezel they run on your computer, on your files, with the model you choose.</p>
307
+ <h1><span class="title">Gezel apps</span><span class="tagline">A page you use, and Gezel working behind it.</span></h1>
308
+ <p class="lede">Each app pairs an interface with AI that knows the job, the step-by-step plans it follows, and actions that change the app\u2019s own files. Try ${demos} of them right here on sample data, with a scripted conversation. In Gezel they run on your computer, on your files, with the model you choose.</p>
283
309
  </section>
284
310
  <div class="filter">
285
311
  <div class="tray" role="radiogroup" aria-label="Show apps for">
@@ -293,7 +319,7 @@ ${apps.map((a) => card(a)).join("\n")}
293
319
  </ul>
294
320
  <section class="band">
295
321
  <h2>Make your own</h2>
296
- <p>An app is plain files: an HTML page, the crew it hires, the craftbooks they follow, and small scripts for its actions. Build one for yourself, or contribute it to the catalog everyone installs from.</p>
322
+ <p>An app is plain files: an HTML page, its crew, the craftbooks they follow, and small scripts for its actions. Build one for yourself, or contribute it to the catalog everyone installs from.</p>
297
323
  <p class="band-links"><a href="${esc(ctx.docsBase)}building-ai-apps-inside-gezel/">Building AI apps inside Gezel</a><a href="${esc(ctx.docsBase)}gezel-page-apis/">The page APIs</a><a href="https://github.com/bendyline/gilde">The gilde catalog on GitHub</a></p>
298
324
  </section>
299
325
  </main>
@@ -364,7 +390,7 @@ function appHtml(app, apps, ctx) {
364
390
  (s) => s.night ? `Runs ${esc(s.name)} overnight, once you agree.` : `Runs ${esc(s.name)} on a schedule, once you agree.`
365
391
  ).join(" ")}</p>` : ""}</section>` : "";
366
392
  const shown = actions.slice(0, 8);
367
- const tools = actions.length ? `<section class="inside-card"><h3>Actions the crew can take</h3><ul class="plain">${shown.map(
393
+ const tools = actions.length ? `<section class="inside-card"><h3>Actions Gezel can take</h3><ul class="plain">${shown.map(
368
394
  (t) => `<li><strong>${esc(humanizeTool(t.name))}</strong><span>${esc(firstSentence(t.description ?? ""))}</span></li>`
369
395
  ).join(
370
396
  ""
@@ -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"><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></p>
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}
@@ -395,14 +427,16 @@ ${demo}
395
427
  <li><a href="/#download">Download Gezel</a> for Mac, Windows or Linux. It\u2019s free.</li>
396
428
  <li>Choose <strong>New project</strong>, then <strong>${esc(label)}</strong>, then <strong>${esc(m.name)}</strong>.</li>
397
429
  ${questions.length ? `<li>Answer ${questions.length === 1 ? "its question" : "a few questions"}: ${questions.map((q) => `<em>${esc(q)}</em>`).join(" ")}</li>` : ""}
398
- <li>${lead ? `Your ${esc(lead.role.toLowerCase())} takes it from there, on the model you choose.` : "Your crew takes it from there, on the model you choose."}</li>
430
+ <li>${lead ? `Your ${esc(lead.role.toLowerCase())} takes it from there, on the model you choose.` : "Gezel takes it from there, on the model you choose."}</li>
399
431
  </ol>
400
432
  </section>
401
433
  ${more.length ? `<section class="more" aria-labelledby="more"><h2 id="more">More apps to try</h2><ul class="app-grid app-grid-small">${more.map((a) => card(a, "../")).join("")}</ul></section>` : ""}
402
434
  </main>
403
435
  ${footer(ctx)}
404
436
  </div>
405
- </body>
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";
@@ -1621,7 +1693,7 @@ async function buildSiteCatalog(catalog, scorecard = SCORECARD) {
1621
1693
  title: "Add-on toolsets and connectors",
1622
1694
  area: "technical",
1623
1695
  order: 4.5,
1624
- summary: "Toolsets you can add to a gezel, and connectors that bring outside data into a project.",
1696
+ summary: "Toolsets you can add to a crew member, and connectors that bring outside data into a project.",
1625
1697
  generated: true,
1626
1698
  subcategory: HOW_GEZEL_WORKS
1627
1699
  },
@@ -1655,15 +1727,15 @@ async function buildSiteCatalog(catalog, scorecard = SCORECARD) {
1655
1727
  {
1656
1728
  entry: {
1657
1729
  id: "craftbooks-index",
1658
- title: "Every craftbook",
1730
+ title: "Every plan",
1659
1731
  area: "craftbooks",
1660
1732
  order: 0,
1661
1733
  generated: true
1662
1734
  },
1663
1735
  markdown: [
1664
- "# Every craftbook",
1736
+ "# Every plan",
1665
1737
  "",
1666
- `Craftbooks are step-by-step plans your crew follows to produce a real piece of work. Each one names its steps, who runs them, and the checks the result must pass. There are ${craftbooks.length} of them, grouped here by the kind of work they do.`
1738
+ `Plans are step-by-step procedures Gezel follows to produce a real piece of work. Each one names its steps, the role that runs each, and the checks the result must pass. There are ${craftbooks.length} of them, grouped here by the kind of work they do.`
1667
1739
  ].join("\n"),
1668
1740
  html: craftbookGalleryHtml(craftbooks, craftbookArt),
1669
1741
  listed: false,
@@ -1694,7 +1766,7 @@ function modelCatalogMarkdown(chat, images, videos, scorecard) {
1694
1766
  "",
1695
1767
  `## Chat models (${chat.length})`,
1696
1768
  "",
1697
- "The models your gezels think and write with, recommended first. **Measured** is the share of tasks the model (or another build of it) passed in its most recent full [scorecard](model-scorecard) round, preferring the general set, with the machine that round ran on. Follow it to every round on the model\u2019s page. Rounds are not comparable with each other, and a number from a workstation is not a promise about a laptop.",
1769
+ "The models Gezel thinks and writes with, recommended first. **Measured** is the share of tasks the model (or another build of it) passed in its most recent full [scorecard](model-scorecard) round, preferring the general set, with the machine that round ran on. Follow it to every round on the model\u2019s page. Rounds are not comparable with each other, and a number from a workstation is not a promise about a laptop.",
1698
1770
  "",
1699
1771
  "| Model | Measured | Size | Context | Tools | Best for | Runs on | License |",
1700
1772
  "| --- | --- | --- | --- | --- | --- | --- | --- |",
@@ -1716,7 +1788,7 @@ function modelCatalogMarkdown(chat, images, videos, scorecard) {
1716
1788
  "",
1717
1789
  `## Image models (${images.length})`,
1718
1790
  "",
1719
- "Models your crew can use to draw pictures, icons and illustrations. Gezel works out what each one needs from its files and offers only the ones your machine can run.",
1791
+ "Models Gezel can use to draw pictures, icons and illustrations. Gezel works out what each one needs from its files and offers only the ones your machine can run.",
1720
1792
  "",
1721
1793
  "| Model | Size | Commercial use | License |",
1722
1794
  "| --- | --- | --- | --- |",
@@ -1841,7 +1913,7 @@ function chatModelMarkdown(m, scorecard) {
1841
1913
  "| --- | --- |",
1842
1914
  ...facts.filter(([, v]) => v).map(([k, v]) => row([k, cell(v)])),
1843
1915
  "",
1844
- "Gezel downloads this model the first time a gezel needs it, checks the file against its published hash, and applies tuned settings for it.",
1916
+ "Gezel downloads this model the first time it is needed, checks the file against its published hash, and applies tuned settings for it.",
1845
1917
  "",
1846
1918
  ...measuredResultsMarkdown(scorecard, m.id)
1847
1919
  ];
@@ -1857,14 +1929,14 @@ function toolsetCatalogMarkdown(addOns, connectors, communityCount) {
1857
1929
  const lines = [
1858
1930
  "# Add-on toolsets and connectors",
1859
1931
  "",
1860
- "Every gezel starts with the built-in tool groups that fit its role, described in [Tools and toolsets](tools-and-toolsets). This page lists what you can add on top."
1932
+ "Every crew member starts with the built-in tool groups that fit their role, described in [Tools and toolsets](tools-and-toolsets). This page lists what you can add on top."
1861
1933
  ];
1862
1934
  if (addOns.length > 0) {
1863
1935
  lines.push(
1864
1936
  "",
1865
1937
  "## Add-on toolsets",
1866
1938
  "",
1867
- "Extra tools from Gezel\u2019s own catalog. Add one to a gezel from its Toolsets tab.",
1939
+ "Extra tools from Gezel\u2019s own catalog. Add one to a crew member from their Toolsets tab.",
1868
1940
  "",
1869
1941
  "| Toolset | What it does |",
1870
1942
  "| --- | --- |",
@@ -1876,7 +1948,7 @@ function toolsetCatalogMarkdown(addOns, connectors, communityCount) {
1876
1948
  "",
1877
1949
  "## Connectors",
1878
1950
  "",
1879
- "Connectors copy data from outside services, such as mail, calendars and issue trackers, into a project as searchable files. Your crew works on that local copy, never on the live account.",
1951
+ "Connectors copy data from outside services, such as mail, calendars and issue trackers, into a project as searchable files. Gezel works on that local copy, never on the live account.",
1880
1952
  "",
1881
1953
  "| Connector | What it brings in |",
1882
1954
  "| --- | --- |",
@@ -1888,7 +1960,7 @@ function toolsetCatalogMarkdown(addOns, connectors, communityCount) {
1888
1960
  "",
1889
1961
  "## Community servers",
1890
1962
  "",
1891
- `Gezel\u2019s toolset browser also lists about ${roundDown(communityCount).toLocaleString("en-US")} MCP servers from the public community registry, marked **Community**. They are third-party projects, so review one before you add it to a crew. You can also bring your own: see [Custom MCP toolsets](tools-and-toolsets#custom-mcp-toolsets).`
1963
+ `Gezel\u2019s toolset browser also lists about ${roundDown(communityCount).toLocaleString("en-US")} MCP servers from the public community registry, marked **Community**. They are third-party projects, so review one before you add it. You can also bring your own: see [Custom MCP toolsets](tools-and-toolsets#custom-mcp-toolsets).`
1892
1964
  );
1893
1965
  }
1894
1966
  return lines.join("\n");
@@ -1897,7 +1969,7 @@ function roleCatalogMarkdown(roles) {
1897
1969
  return [
1898
1970
  "# Every role template",
1899
1971
  "",
1900
- "A role template is a ready-made character for your crew: a name, a job, and a working style that shapes how they think and talk. The Meester picks from these when it builds a crew, and you can add any of them yourself with **New Gezel**. The core roles each have their own page in [Roles](roles-index).",
1972
+ "A role template is a ready-made character for your crew: a name, a job, and a working style that shapes how they think and talk. The Meester picks from these when a job calls for one, and you can add any of them yourself with **New crew member**. The core roles each have their own page in [Roles](roles-index).",
1901
1973
  "",
1902
1974
  "| Role | What they do |",
1903
1975
  "| --- | --- |",
@@ -1909,14 +1981,14 @@ function roleCatalogMarkdown(roles) {
1909
1981
  function roleTemplateMarkdown(r, about) {
1910
1982
  const lines = [`# ${r.name}`, "", r.description.trim()];
1911
1983
  if (r.meesterCandidate) {
1912
- lines.push("", "This character can also act as your Meester, the gezel who runs the crew.");
1984
+ lines.push("", "This character can also act as your Meester, the one you talk to first.");
1913
1985
  }
1914
1986
  if (about?.trim()) {
1915
1987
  lines.push(
1916
1988
  "",
1917
1989
  "## How they work",
1918
1990
  "",
1919
- "This is the character brief Gezel gives the model, word for word. It shapes how this gezel thinks, works and talks.",
1991
+ "This is the character brief Gezel gives the model, word for word. It shapes how this character thinks, works and talks.",
1920
1992
  "",
1921
1993
  demoteHeadings(about.trim())
1922
1994
  );
@@ -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,17 +2876,30 @@ ${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
- conceptual: "What gezel is, who your crew are, and how the pieces fit together.",
2796
- "gezel-roles": "The roles a gezel can take, and what each one is good at.",
2797
- craftbooks: "Step-by-step recipes your crew can run \u2014 one per job.",
2900
+ conceptual: "What gezel is, who does the work, and how the pieces fit together.",
2901
+ "gezel-roles": "The roles on a crew, and what each one is good at.",
2902
+ craftbooks: "Step-by-step plans Gezel can follow \u2014 one per job.",
2798
2903
  "project-types": "Ready-made project setups, each with a crew and a bench.",
2799
2904
  technical: "Architecture, file layout, providers, security, and the CLI.",
2800
2905
  "whats-new": "What changed in each release, in plain language."
@@ -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 = new Set(entries.map((e) => e.id));
2839
- const byStem = /* @__PURE__ */ new Map();
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 markdown = rewriteSiteLinks(
2869
- article.markdown,
2870
- entry.id,
2871
- ids,
2872
- byStem,
2873
- (asset) => existsSync2(join5(contentDir, asset))
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: `${up(depth)}assets/${PLAYER_SCRIPT}`,
3047
+ playerScriptPath: `${up2(depth)}assets/${PLAYER_SCRIPT}`,
2940
3048
  mode: "slideshow",
2941
3049
  title: article.title,
2942
3050
  autoPlay: true,
@@ -2948,18 +3056,23 @@ ${sitePage.html}`;
2948
3056
  }
2949
3057
  const landingSocial = canonicalBase ? {
2950
3058
  url: canonicalBase,
2951
- title: "The Gezel Handboek",
3059
+ title: "Gezel Help",
2952
3060
  image: ogBase ? `${ogBase}${ogCardPath(LANDING_CARD_ID)}` : void 0
2953
3061
  } : void 0;
2954
3062
  if (ogBase) {
2955
3063
  cardPlans.push({
2956
3064
  id: LANDING_CARD_ID,
2957
- kicker: `${WORDMARK} \xB7 Handboek`,
2958
- headline: "The Gezel Handboek"
3065
+ kicker: `${WORDMARK} \xB7 Help`,
3066
+ headline: "Gezel Help"
2959
3067
  });
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 rewriteSiteLinks(markdown, pageId, ids, byStem, hasAsset = () => true) {
2993
- const prefix = up(pageId.split("/").length);
2994
- return markdown.replace(/\]\(([^()\s]+)\)/g, (whole, rawTarget) => {
2995
- if (/^[a-z][a-z0-9+.-]*:/i.test(rawTarget) || rawTarget.startsWith("//") || rawTarget.startsWith("#")) {
2996
- return whole;
2997
- }
2998
- const [path, suffix = ""] = splitLinkSuffix(rawTarget);
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 splitLinkSuffix(raw) {
3010
- const idx = raw.search(/[?#]/);
3011
- return idx === -1 ? [raw, ""] : [raw.slice(0, idx), raw.slice(idx)];
3114
+ function llmsTxt(areas, base) {
3115
+ const lines = [
3116
+ "# Gezel Help",
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 PUBLISHED_HANDBOEK = "https://gezel.com/docs/";
3014
- var up = (depth) => "../".repeat(depth);
3132
+ var APP_GUIDE_ID = "build-a-gezel-app";
3133
+ var up2 = (depth) => "../".repeat(depth);
3015
3134
  var esc2 = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
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 `${up(depth)}${href}`;
3174
+ return `${up2(depth)}${href}`;
3056
3175
  }
3057
3176
  function cssLinks(css, depth) {
3058
- return [`${up(depth)}assets/handboek.css`, ...css.map((h) => resolveCssHref(h, depth))].map((href) => `<link rel="stylesheet" href="${esc2(href)}">`).join("\n");
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="${up(depth)}${esc2(target)}/">${esc2(a.title)}</a>`;
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="${up(depth)}">Gezel Handboek</a>
3228
+ ${wordmark}<a class="hb-brand" href="${up2(depth)}">Gezel Help</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="${up(depth)}${esc2(areaLanding(area))}/">All ${articleCount(area)} ${esc2(area.title.toLowerCase())}</a></p>` : "";
3129
- const heading = isCurrent ? `<h2 class="hb-current">${esc2(area.title)}</h2>` : `<h2><a href="${up(depth)}${esc2(areaLanding(area))}/">${esc2(area.title)}</a></h2>`;
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}
@@ -3134,7 +3253,7 @@ ${more}
3134
3253
  </section>`;
3135
3254
  });
3136
3255
  return `<aside class="hb-sidebar">
3137
- <nav aria-label="Handboek sections">
3256
+ <nav aria-label="Help sections">
3138
3257
  ${sections.join("\n")}
3139
3258
  </nav>
3140
3259
  </aside>`;
@@ -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="${up(depth)}${esc2(entry.id)}/">${esc2(entry.title)}</a></li>`;
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,20 +3312,20 @@ 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="${up(depth)}assets/${esc2(name)}"></script>`).join("\n");
3197
- return `${head2(`${entry.title} \u2014 Gezel Handboek`, css, depth, entry.summary, social)}
3315
+ const scriptTags = scripts.map((name) => `<script defer src="${up2(depth)}assets/${esc2(name)}"></script>`).join("\n");
3316
+ return `${head2(`${entry.title} \u2014 Gezel Help`, css, depth, entry.summary, social)}
3198
3317
  <body class="hb hb-article-page">
3199
3318
  ${masthead2(areas, depth, siteUrl, entry.area)}
3200
3319
  <div class="hb-layout">
3201
3320
  ${sidebar(areas, entry, depth)}
3202
3321
  <main class="hb-main">
3203
3322
  <nav class="hb-breadcrumb" aria-label="Breadcrumb">
3204
- <a href="${up(depth)}">Handboek</a>${area ? ` <span>/</span> <a href="${up(depth)}${esc2(areaLanding(area))}/">${esc2(area.title)}</a>` : ""}
3323
+ <a href="${up2(depth)}">Help</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="${up(depth)}">Gezel Handboek</a> \u2014 documentation for gezel, a crew of AI companions that works for you, from your own computer.</p>
3339
+ <p><a href="${up2(depth)}">Gezel Help</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) {
@@ -3247,12 +3366,12 @@ ${list}
3247
3366
  <p class="hb-more"><a href="${esc2(landing)}/">Browse all ${articleCount(area)} ${esc2(area.title.toLowerCase())}</a></p>
3248
3367
  </section>`;
3249
3368
  }).join("\n");
3250
- return `${head2("Gezel Handboek", css, 0, "Documentation for gezel \u2014 a crew of AI companions that works for you, from your own computer.", social)}
3369
+ return `${head2("Gezel Help", css, 0, "Documentation for gezel \u2014 a crew of AI companions that works for you, from your own computer.", social)}
3251
3370
  <body class="hb hb-home">
3252
3371
  ${masthead2(areas, 0, siteUrl)}
3253
3372
  <main class="hb-main hb-home-main">
3254
3373
  <section class="hb-hero">
3255
- <h1>The Gezel Handboek</h1>
3374
+ <h1>Gezel Help</h1>
3256
3375
  <p class="hb-lede">Gezel lets you assemble a crew of AI companions and put them to work \u2014 on your own computer, with your own files. This is their handboek: what they are, what they can do, and how to work with them.</p>
3257
3376
  </section>
3258
3377
  ${startBlock}
@@ -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,