@bendyline/gezel-cli 1.2.8 → 1.2.9

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 CHANGED
@@ -57,7 +57,7 @@ Run `gezel --help`, or `--help` on any command, for every option.
57
57
  | Command | What it does |
58
58
  |---|---|
59
59
  | `gezel` | Open the interactive terminal app for this folder's project |
60
- | `gezel run [prompt…]` | One prompt, one reply, using this project's voorman unless you pass `--gezel <id>`. A sole `-` reads the prompt from stdin |
60
+ | `gezel run [prompt…]` | One prompt, one reply, using this project's crew lead unless you pass `--gezel <id>`. A sole `-` reads the prompt from stdin |
61
61
  | `gezel do <craftbook…>` | Start a craftbook as a task in this folder's project: its name, then required values, `key=value` parameters, and your request. `--wait` follows it to the end |
62
62
  | `gezel <craftbook> …` | Shorthand for `gezel do <craftbook> …`, matched exactly on the craftbook's command name; built-in commands always win |
63
63
  | `gezel craftbook list [words…]` | List the craftbooks `gezel do` can start in this folder's project (command name, title, category); words filter by command, title, and tags. `--json` for scripts |
@@ -478,6 +478,7 @@ import {
478
478
  gezelNamesInUse,
479
479
  pickUnusedGezelName,
480
480
  projectLeadGezelId,
481
+ roleForMatching,
481
482
  setLogLevel,
482
483
  setLogOutput
483
484
  } from "@bendyline/gezel";
@@ -17,6 +17,7 @@ import {
17
17
  gezelNamesInUse,
18
18
  pickUnusedGezelName,
19
19
  projectLeadGezelId,
20
+ roleForMatching,
20
21
  setLogLevel,
21
22
  setLogOutput
22
23
  } from "@bendyline/gezel";
@@ -325,7 +326,7 @@ function parseParamFlags(flags) {
325
326
  }
326
327
  function printPlan(plan) {
327
328
  const roles = plan.gezels.map(
328
- (gezel) => `${gezel.templateId}${gezel.voorman ? " (voorman" : " ("}${gezel.reuse ? ", reused)" : gezel.voorman ? ", new)" : "new)"}`
329
+ (gezel) => `${gezel.templateId}${gezel.voorman ? " (crew lead" : " ("}${gezel.reuse ? ", reused)" : gezel.voorman ? ", new)" : "new)"}`
329
330
  );
330
331
  if (roles.length > 0) console.log(` roles: ${roles.join(", ")}`);
331
332
  if (plan.scripts.length > 0) console.log(` scripts: ${plan.scripts.join(", ")}`);
@@ -71,6 +71,7 @@ import {
71
71
  gezelNamesInUse,
72
72
  pickUnusedGezelName,
73
73
  projectLeadGezelId,
74
+ roleForMatching,
74
75
  setLogLevel,
75
76
  setLogOutput
76
77
  } from "@bendyline/gezel";
@@ -735,7 +736,7 @@ async function ensureCliProjectLead(client, projectId) {
735
736
  }
736
737
  const { gezels } = await client.listGezels();
737
738
  let voorman = gezels.find(
738
- (gezel) => gezel.templateId === "voorman" || gezel.role?.trim().toLowerCase() === "voorman"
739
+ (gezel) => gezel.templateId === "voorman" || roleForMatching(gezel.role)?.trim().toLowerCase() === "voorman"
739
740
  );
740
741
  if (!voorman) {
741
742
  const { name, gender } = pickUnusedGezelName(gezelNamesInUse(gezels));
@@ -743,7 +744,7 @@ async function ensureCliProjectLead(client, projectId) {
743
744
  }
744
745
  const updated = await client.updateProject(projectId, { voormanGezelId: voorman.id });
745
746
  if (!updated.voormanGezelId) {
746
- throw new CliError(`project "${updated.name}" has no voorman`);
747
+ throw new CliError(`project "${updated.name}" has no crew lead`);
747
748
  }
748
749
  return updated.voormanGezelId;
749
750
  }
@@ -1984,7 +1985,7 @@ function registerMcpCommands(program2, connect, output = console.log) {
1984
1985
  if (status.state === "configured" && line) {
1985
1986
  lines.push(
1986
1987
  "",
1987
- `${status.label} reaches for its own search first. So it uses Gezel's, add this line to the ${HARNESS_AGENT_FILE[client]} file in a folder you work in:`,
1988
+ `${status.label} reaches for its own search first. So it uses Gezel's, add this line near the top of the ${HARNESS_AGENT_FILE[client]} file in a folder you work in (at the end of a long file it gets overlooked):`,
1988
1989
  "",
1989
1990
  ` ${line}`
1990
1991
  );
@@ -2240,20 +2241,32 @@ function stderrProgress() {
2240
2241
  // src/tui/gezel-picker.ts
2241
2242
  import {
2242
2243
  getProjectType,
2244
+ legacyRoleKey,
2245
+ plainRoleTitle,
2243
2246
  resolveProjectTypeId
2244
2247
  } from "@bendyline/gezel";
2245
2248
  function roleIdentity(value) {
2246
- return (value ?? "").trim().toLowerCase();
2249
+ const raw = (value ?? "").trim();
2250
+ return (legacyRoleKey(raw) ?? legacyRoleKey(raw.replace(/-/g, " ")) ?? raw).toLowerCase();
2251
+ }
2252
+ function argKeys(values) {
2253
+ return [
2254
+ ...new Set(
2255
+ values.flatMap((value) => [(value ?? "").trim().toLowerCase(), roleIdentity(value)])
2256
+ )
2257
+ ].filter(Boolean);
2247
2258
  }
2248
2259
  function resolveGezelArg(arg, inputs) {
2249
2260
  const query = arg.trim().toLowerCase();
2250
2261
  if (!query) return { kind: "unknown" };
2251
2262
  const { gezels, templates } = inputs;
2252
- const gezelKeys = (g) => [g.id, g.name, g.roleBasedName, g.role].map(roleIdentity).filter(Boolean);
2253
- const templateKeys = (t) => [t.id, t.role, t.name].map(roleIdentity).filter(Boolean);
2254
- const exactGezel = gezels.find((g) => gezelKeys(g).includes(query));
2263
+ const queryRole = roleIdentity(query);
2264
+ const gezelKeys = (g) => argKeys([g.id, g.name, g.roleBasedName, g.role]);
2265
+ const templateKeys = (t) => argKeys([t.id, t.role, t.name]);
2266
+ const exact = (keys) => keys.includes(query) || keys.includes(queryRole);
2267
+ const exactGezel = gezels.find((g) => exact(gezelKeys(g)));
2255
2268
  if (exactGezel) return { kind: "gezel", gezelId: exactGezel.id };
2256
- const exactTemplate = templates.find((t) => templateKeys(t).includes(query));
2269
+ const exactTemplate = templates.find((t) => exact(templateKeys(t)));
2257
2270
  if (exactTemplate) return { kind: "template", templateId: exactTemplate.id };
2258
2271
  const prefixGezels = gezels.filter((g) => gezelKeys(g).some((k) => k.startsWith(query)));
2259
2272
  if (prefixGezels.length === 1) return { kind: "gezel", gezelId: prefixGezels[0].id };
@@ -2263,7 +2276,7 @@ function resolveGezelArg(arg, inputs) {
2263
2276
  const prefixTemplates = templates.filter((t) => templateKeys(t).some((k) => k.startsWith(query)));
2264
2277
  if (prefixTemplates.length === 1) return { kind: "template", templateId: prefixTemplates[0].id };
2265
2278
  if (prefixTemplates.length > 1) {
2266
- return { kind: "ambiguous", labels: prefixTemplates.map((t) => t.name) };
2279
+ return { kind: "ambiguous", labels: prefixTemplates.map((t) => plainRoleTitle(t.name)) };
2267
2280
  }
2268
2281
  return { kind: "unknown" };
2269
2282
  }
@@ -3446,7 +3459,7 @@ program.command("mode [mode]").description("Show or set AI activity (read-only,
3446
3459
  const current = cliEngagementModeOption(updated.aiEngagementMode);
3447
3460
  console.log(`AI mode \u2192 ${current.name} \u2014 ${current.description}`);
3448
3461
  });
3449
- program.command("run [prompt...]").description("Run a prompt through a gezel and print the reply (use - to read stdin)").option("-g, --gezel <ref>", "gezel id or name (default: this project's voorman)").addHelpText(
3462
+ program.command("run [prompt...]").description("Run a prompt through a gezel and print the reply (use - to read stdin)").option("-g, --gezel <ref>", "gezel id or name (default: this project's crew lead)").addHelpText(
3450
3463
  "after",
3451
3464
  `
3452
3465
  Examples:
@@ -9,6 +9,7 @@ import { CatalogService } from "@bendyline/gezel-catalog";
9
9
  import {
10
10
  OG_CARD_HEIGHT,
11
11
  OG_CARD_WIDTH,
12
+ bundledGildeDataDir,
12
13
  createHandboekEngine,
13
14
  findHandboekContent,
14
15
  ogKicker,
@@ -1510,7 +1511,7 @@ async function runHandboekExport(opts) {
1510
1511
  "no handboek content tree found \u2014 run from a gezel checkout or install, or set GEZEL_HANDBOEK_DIR"
1511
1512
  );
1512
1513
  }
1513
- const catalog = new CatalogService();
1514
+ const catalog = new CatalogService(void 0, { contentRoot: bundledGildeDataDir });
1514
1515
  const engine = createHandboekEngine({
1515
1516
  catalog,
1516
1517
  device: siteDeviceInfo,
@@ -1561,7 +1562,13 @@ async function runHandboekExport(opts) {
1561
1562
  continue;
1562
1563
  }
1563
1564
  const depth = entry.id.split("/").length;
1564
- const markdown = rewriteSiteLinks(article.markdown, entry.id, ids, byStem);
1565
+ const markdown = rewriteSiteLinks(
1566
+ article.markdown,
1567
+ entry.id,
1568
+ ids,
1569
+ byStem,
1570
+ (asset) => existsSync2(join4(contentDir, asset))
1571
+ );
1565
1572
  const parsed = parseMarkdown(markdown);
1566
1573
  const demo = demos.get(entry.id);
1567
1574
  const art = entry.id.startsWith("craftbook/") ? site.craftbookArt.get(entry.id.slice("craftbook/".length)) : void 0;
@@ -1661,7 +1668,7 @@ function normalizeBase(base) {
1661
1668
  if (!trimmed) return void 0;
1662
1669
  return trimmed.endsWith("/") ? trimmed : `${trimmed}/`;
1663
1670
  }
1664
- function rewriteSiteLinks(markdown, pageId, ids, byStem) {
1671
+ function rewriteSiteLinks(markdown, pageId, ids, byStem, hasAsset = () => true) {
1665
1672
  const prefix = up(pageId.split("/").length);
1666
1673
  return markdown.replace(/\]\(([^()\s]+)\)/g, (whole, rawTarget) => {
1667
1674
  if (/^[a-z][a-z0-9+.-]*:/i.test(rawTarget) || rawTarget.startsWith("//") || rawTarget.startsWith("#")) {
@@ -1670,7 +1677,7 @@ function rewriteSiteLinks(markdown, pageId, ids, byStem) {
1670
1677
  const [path, suffix = ""] = splitLinkSuffix(rawTarget);
1671
1678
  const candidate = path.replace(/^(\.\.?\/)+/, "");
1672
1679
  if (candidate.startsWith("assets/")) {
1673
- return `](${prefix}${candidate}${suffix})`;
1680
+ return hasAsset(candidate) ? `](${prefix}${candidate}${suffix})` : `](${PUBLISHED_HANDBOEK}${candidate}${suffix})`;
1674
1681
  }
1675
1682
  const article = candidate.replace(/\.md$/, "");
1676
1683
  const target = ids.has(article) ? article : byStem.get(article.split("/").pop() ?? "");
@@ -1682,6 +1689,7 @@ function splitLinkSuffix(raw) {
1682
1689
  const idx = raw.search(/[?#]/);
1683
1690
  return idx === -1 ? [raw, ""] : [raw.slice(0, idx), raw.slice(idx)];
1684
1691
  }
1692
+ var PUBLISHED_HANDBOEK = "https://gezel.com/docs/";
1685
1693
  var up = (depth) => "../".repeat(depth);
1686
1694
  var esc = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1687
1695
  function extractBody(page) {
@@ -41,6 +41,7 @@ import {
41
41
  gezelNamesInUse,
42
42
  pickUnusedGezelName,
43
43
  projectLeadGezelId,
44
+ roleForMatching,
44
45
  setLogLevel,
45
46
  setLogOutput
46
47
  } from "@bendyline/gezel";
package/dist/tui/index.js CHANGED
@@ -23,6 +23,7 @@ import {
23
23
  gezelNamesInUse,
24
24
  pickUnusedGezelName,
25
25
  projectLeadGezelId,
26
+ roleForMatching,
26
27
  setLogLevel,
27
28
  setLogOutput
28
29
  } from "@bendyline/gezel";
@@ -84,7 +85,7 @@ async function ensureCliProjectLead(client, projectId) {
84
85
  }
85
86
  const { gezels } = await client.listGezels();
86
87
  let voorman = gezels.find(
87
- (gezel) => gezel.templateId === "voorman" || gezel.role?.trim().toLowerCase() === "voorman"
88
+ (gezel) => gezel.templateId === "voorman" || roleForMatching(gezel.role)?.trim().toLowerCase() === "voorman"
88
89
  );
89
90
  if (!voorman) {
90
91
  const { name, gender } = pickUnusedGezelName(gezelNamesInUse(gezels));
@@ -92,7 +93,7 @@ async function ensureCliProjectLead(client, projectId) {
92
93
  }
93
94
  const updated = await client.updateProject(projectId, { voormanGezelId: voorman.id });
94
95
  if (!updated.voormanGezelId) {
95
- throw new CliError(`project "${updated.name}" has no voorman`);
96
+ throw new CliError(`project "${updated.name}" has no crew lead`);
96
97
  }
97
98
  return updated.voormanGezelId;
98
99
  }
@@ -2334,6 +2335,8 @@ function craftbookStartRequest(book) {
2334
2335
  // src/tui/gezel-picker.ts
2335
2336
  import {
2336
2337
  getProjectType,
2338
+ legacyRoleKey,
2339
+ plainRoleTitle,
2337
2340
  resolveProjectTypeId
2338
2341
  } from "@bendyline/gezel";
2339
2342
  var GEZEL_VALUE_PREFIX = "gezel:";
@@ -2363,7 +2366,15 @@ function clip2(text, width) {
2363
2366
  return `${flat.slice(0, Math.max(1, width - 1)).trimEnd()}\u2026`;
2364
2367
  }
2365
2368
  function roleIdentity(value) {
2366
- return (value ?? "").trim().toLowerCase();
2369
+ const raw = (value ?? "").trim();
2370
+ return (legacyRoleKey(raw) ?? legacyRoleKey(raw.replace(/-/g, " ")) ?? raw).toLowerCase();
2371
+ }
2372
+ function argKeys(values) {
2373
+ return [
2374
+ ...new Set(
2375
+ values.flatMap((value) => [(value ?? "").trim().toLowerCase(), roleIdentity(value)])
2376
+ )
2377
+ ].filter(Boolean);
2367
2378
  }
2368
2379
  function displayName(gezel, roleBasedNameOnly) {
2369
2380
  if (roleBasedNameOnly) return gezel.roleBasedName ?? gezel.role ?? gezel.id;
@@ -2412,7 +2423,7 @@ function buildGezelPickerItems(inputs) {
2412
2423
  hint: clip2(gezelHint(gezel, templatesById, roleBasedNameOnly), hintWidth)
2413
2424
  });
2414
2425
  const templateItem = (template, reason) => ({
2415
- label: template.name,
2426
+ label: plainRoleTitle(template.name),
2416
2427
  value: `${TEMPLATE_VALUE_PREFIX}${template.id}`,
2417
2428
  hint: clip2(reason ?? template.description, hintWidth)
2418
2429
  });
@@ -2459,7 +2470,7 @@ function buildGezelPickerItems(inputs) {
2459
2470
  }
2460
2471
  const remaining = availableTemplates.filter((t) => !recommendedTemplateIds.has(t.id));
2461
2472
  const core = remaining.filter((t) => coreRank.has(t.id)).sort((a, b) => (coreRank.get(a.id) ?? 0) - (coreRank.get(b.id) ?? 0));
2462
- const more = remaining.filter((t) => !coreRank.has(t.id)).sort((a, b) => a.name.localeCompare(b.name));
2473
+ const more = remaining.filter((t) => !coreRank.has(t.id)).sort((a, b) => plainRoleTitle(a.name).localeCompare(plainRoleTitle(b.name)));
2463
2474
  for (const template of core) push(SECTION_CORE, templateItem(template));
2464
2475
  for (const template of more) push(SECTION_MORE, templateItem(template));
2465
2476
  return items;
@@ -2473,11 +2484,13 @@ function resolveGezelArg(arg, inputs) {
2473
2484
  const query = arg.trim().toLowerCase();
2474
2485
  if (!query) return { kind: "unknown" };
2475
2486
  const { gezels, templates } = inputs;
2476
- const gezelKeys = (g) => [g.id, g.name, g.roleBasedName, g.role].map(roleIdentity).filter(Boolean);
2477
- const templateKeys = (t) => [t.id, t.role, t.name].map(roleIdentity).filter(Boolean);
2478
- const exactGezel = gezels.find((g) => gezelKeys(g).includes(query));
2487
+ const queryRole = roleIdentity(query);
2488
+ const gezelKeys = (g) => argKeys([g.id, g.name, g.roleBasedName, g.role]);
2489
+ const templateKeys = (t) => argKeys([t.id, t.role, t.name]);
2490
+ const exact = (keys) => keys.includes(query) || keys.includes(queryRole);
2491
+ const exactGezel = gezels.find((g) => exact(gezelKeys(g)));
2479
2492
  if (exactGezel) return { kind: "gezel", gezelId: exactGezel.id };
2480
- const exactTemplate = templates.find((t) => templateKeys(t).includes(query));
2493
+ const exactTemplate = templates.find((t) => exact(templateKeys(t)));
2481
2494
  if (exactTemplate) return { kind: "template", templateId: exactTemplate.id };
2482
2495
  const prefixGezels = gezels.filter((g) => gezelKeys(g).some((k) => k.startsWith(query)));
2483
2496
  if (prefixGezels.length === 1) return { kind: "gezel", gezelId: prefixGezels[0].id };
@@ -2487,7 +2500,7 @@ function resolveGezelArg(arg, inputs) {
2487
2500
  const prefixTemplates = templates.filter((t) => templateKeys(t).some((k) => k.startsWith(query)));
2488
2501
  if (prefixTemplates.length === 1) return { kind: "template", templateId: prefixTemplates[0].id };
2489
2502
  if (prefixTemplates.length > 1) {
2490
- return { kind: "ambiguous", labels: prefixTemplates.map((t) => t.name) };
2503
+ return { kind: "ambiguous", labels: prefixTemplates.map((t) => plainRoleTitle(t.name)) };
2491
2504
  }
2492
2505
  return { kind: "unknown" };
2493
2506
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/gezel-cli",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
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.8",
48
- "@bendyline/gezel-app-sdk": "1.1.8",
49
- "@bendyline/gezel-catalog": "1.2.8",
50
- "@bendyline/gezel-client": "1.2.8",
51
- "@bendyline/gezel-knowledge": "1.2.8",
52
- "@bendyline/gezel-service": "1.2.8",
53
- "@bendyline/squisq": "2.13.1",
54
- "@bendyline/squisq-formats": "2.8.2",
55
- "@bendyline/squisq-react": "2.12.10",
47
+ "@bendyline/gezel": "1.2.9",
48
+ "@bendyline/gezel-app-sdk": "1.1.9",
49
+ "@bendyline/gezel-catalog": "1.2.9",
50
+ "@bendyline/gezel-client": "1.2.9",
51
+ "@bendyline/gezel-knowledge": "1.2.9",
52
+ "@bendyline/gezel-service": "1.2.9",
53
+ "@bendyline/squisq": "2.13.3",
54
+ "@bendyline/squisq-formats": "2.8.4",
55
+ "@bendyline/squisq-react": "2.12.12",
56
56
  "commander": "^15.0.0",
57
57
  "ink": "^7.1.1",
58
58
  "ink-text-input": "^6.0.0",
@@ -69,7 +69,7 @@
69
69
  "build": "tsup && node scripts/verify-build.mjs",
70
70
  "dev": "tsup --watch",
71
71
  "typecheck": "tsc --noEmit",
72
- "clean": "rm -rf dist .turbo",
72
+ "clean": "node ../../scripts/clean-dirs.mjs dist .turbo",
73
73
  "test": "vitest run"
74
74
  }
75
75
  }