@bendyline/gezel-cli 1.2.14 → 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.
@@ -4,10 +4,6 @@
4
4
  import { basename as basename4, isAbsolute as isAbsolutePath, join as joinPath } from "path";
5
5
  import {
6
6
  GEZEL_VERSION,
7
- IMAGE_ASPECT_RATIOS,
8
- IMAGE_QUALITIES,
9
- ImageAspectRatioSchema,
10
- ImageQualitySchema,
11
7
  SCORECARD,
12
8
  evaluateApiCompat as evaluateApiCompat2,
13
9
  getLogLevel as getLogLevel2,
@@ -34,6 +30,11 @@ import { resolveOnDeviceProvider as resolveOnDeviceProvider3 } from "@bendyline/
34
30
  import { Command, Option } from "commander";
35
31
 
36
32
  // src/account-command.ts
33
+ import {
34
+ OLLAMA_EMULATION_PORT,
35
+ containerPublicBase,
36
+ ollamaEmulationAddresses
37
+ } from "@bendyline/gezel";
37
38
  import { GezelApiError as GezelApiError2, apiErrorMessage } from "@bendyline/gezel-client";
38
39
 
39
40
  // src/connection.ts
@@ -779,6 +780,175 @@ async function resolveTuiProject(client, globals) {
779
780
  return resolveCommandProject(client, globals);
780
781
  }
781
782
 
783
+ // src/settings-command.ts
784
+ import {
785
+ classifySecurityLevel,
786
+ projectManagedWorkspaceWritable,
787
+ resolveSecurityPolicy,
788
+ securityCapabilitiesOf,
789
+ securityPolicyForLevel
790
+ } from "@bendyline/gezel";
791
+ var SECURITY_LEVEL_LABELS = {
792
+ "super-lockdown": "Super Lockdown",
793
+ lockdown: "Lockdown",
794
+ free: "Unrestricted",
795
+ custom: "Custom"
796
+ };
797
+ function policyWithCapability(config, key, enabled) {
798
+ const caps = { ...securityCapabilitiesOf(resolveSecurityPolicy(config)), [key]: enabled };
799
+ return { level: classifySecurityLevel(caps), ...caps };
800
+ }
801
+ function policyWithExternalServices(config, enabled) {
802
+ return policyWithCapability(config, "allowExternalServices", enabled);
803
+ }
804
+ var SECURITY_SWITCHES = [
805
+ {
806
+ command: "external-services",
807
+ key: "allowExternalServices",
808
+ label: "External services",
809
+ description: "Show or set on/off for model-initiated external services, including web search"
810
+ },
811
+ {
812
+ command: "run-package-scripts",
813
+ key: "allowPackageScriptExecution",
814
+ label: "Run package scripts",
815
+ description: "Show or set on/off for Gezel running package scripts and installed package binaries (outside the sandbox, with network access)"
816
+ },
817
+ {
818
+ command: "edit-package-scripts",
819
+ key: "allowPackageScriptEdits",
820
+ label: "Edit package scripts",
821
+ description: "Show or set on/off for Gezel adding or changing the scripts in package.json"
822
+ }
823
+ ];
824
+ var CAPABILITY_LABELS = [
825
+ ["allowExternalChat", "Cloud models"],
826
+ ["allowFileEdits", "File edits and the model\u2019s Git tools"],
827
+ ["allowScriptExecution", "Sandboxed scripts"],
828
+ ["allowAppNetwork", "Update checks and the connector syncs you start"],
829
+ ["allowExternalServices", "Web search, mail and other outside services"],
830
+ ["allowPackageScriptExecution", "Run package scripts"],
831
+ ["allowPackageScriptEdits", "Edit package scripts"]
832
+ ];
833
+ var LEVEL_ALIASES = {
834
+ "super-lockdown": "super-lockdown",
835
+ superlockdown: "super-lockdown",
836
+ lockdown: "lockdown",
837
+ free: "free",
838
+ unrestricted: "free"
839
+ };
840
+ function parseSecurityLevel(input) {
841
+ const level = LEVEL_ALIASES[input.trim().toLowerCase()];
842
+ if (!level) {
843
+ throw new CliError(
844
+ `Unknown security level "${input}". Choose super-lockdown, lockdown, or free (shown as Unrestricted in Settings).`
845
+ );
846
+ }
847
+ return level;
848
+ }
849
+ function describeSecurityLevel(policy) {
850
+ const caps = securityCapabilitiesOf(resolveSecurityPolicy({ securityPolicy: policy }));
851
+ const level = classifySecurityLevel(caps);
852
+ const width = Math.max(...CAPABILITY_LABELS.map(([, label]) => label.length));
853
+ return [
854
+ `Security level: ${SECURITY_LEVEL_LABELS[level]}${level === "custom" ? "" : ` (${level})`}`,
855
+ ...CAPABILITY_LABELS.map(
856
+ ([key, label]) => ` ${label.padEnd(width)} ${caps[key] ? "on" : "off"}`
857
+ )
858
+ ];
859
+ }
860
+ function enabledValue(state) {
861
+ if (state === void 0) return void 0;
862
+ if (state === "on") return true;
863
+ if (state === "off") return false;
864
+ throw new CliError("Use on or off.");
865
+ }
866
+ function registerSecurityCommands(program2, connect) {
867
+ const security = program2.command("security").description("Inspect or explicitly change security settings");
868
+ security.command("level [action] [level]").description(
869
+ "Show the security level, or set a preset: `level set super-lockdown|lockdown|free`"
870
+ ).option("--json", "Output the level and its capabilities as JSON").action(
871
+ async (action, requested, options) => {
872
+ if (action !== void 0 && action !== "show" && action !== "set") {
873
+ throw new CliError("Use `gezel security level`, `level show`, or `level set <level>`.");
874
+ }
875
+ if (action === "set" && requested === void 0) {
876
+ throw new CliError("Name a level: super-lockdown, lockdown, or free.");
877
+ }
878
+ if (action !== "set" && requested !== void 0) {
879
+ throw new CliError("To change the level, use `gezel security level set <level>`.");
880
+ }
881
+ const next = action === "set" ? parseSecurityLevel(requested) : void 0;
882
+ const client = await connect();
883
+ const policy = next ? securityPolicyForLevel(next) : {
884
+ level: "custom",
885
+ ...securityCapabilitiesOf(resolveSecurityPolicy(await client.getConfig()))
886
+ };
887
+ if (next) await client.updateConfig({ securityPolicy: policy });
888
+ if (options.json) {
889
+ const caps = securityCapabilitiesOf(resolveSecurityPolicy({ securityPolicy: policy }));
890
+ console.log(JSON.stringify({ level: classifySecurityLevel(caps), ...caps }));
891
+ return;
892
+ }
893
+ for (const line of describeSecurityLevel(policy)) console.log(line);
894
+ }
895
+ );
896
+ for (const setting of SECURITY_SWITCHES) {
897
+ security.command(`${setting.command} [state]`).description(setting.description).option("--json", "Output the setting as JSON").action(async (state, options) => {
898
+ const enabled = enabledValue(state);
899
+ const client = await connect();
900
+ const config = await client.getConfig();
901
+ const policy = resolveSecurityPolicy(config);
902
+ if (enabled !== void 0) {
903
+ await client.updateConfig({
904
+ securityPolicy: policyWithCapability(config, setting.key, enabled)
905
+ });
906
+ }
907
+ const value = enabled ?? policy[setting.key];
908
+ console.log(
909
+ options.json ? JSON.stringify({ [setting.key]: value }) : `${setting.label}: ${value ? "on" : "off"}`
910
+ );
911
+ });
912
+ }
913
+ }
914
+ function registerGrowthCommand(program2, connect) {
915
+ program2.command("growth [state]").description("Show or set on/off for crew growth: XP and the level-ups it offers").option("--json", "Output the setting as JSON").action(async (state, options) => {
916
+ const enabled = enabledValue(state);
917
+ const client = await connect();
918
+ const config = enabled === void 0 ? await client.getConfig() : await client.updateConfig({ growth: { enabled } });
919
+ const value = config.growth?.enabled !== false;
920
+ console.log(
921
+ options.json ? JSON.stringify({ growthEnabled: value }) : `Growth (XP and level-ups): ${value ? "on" : "off"}`
922
+ );
923
+ });
924
+ }
925
+ function registerProjectSettingsCommands(env2, connect, projectFor) {
926
+ env2.command("indexing [state]").description("Show or set on/off for background workspace indexing in the current project").option("--json", "Output the project setting as JSON").action(async (state, options) => {
927
+ const enabled = enabledValue(state);
928
+ const client = await connect();
929
+ const projectId = await projectFor(client);
930
+ const project = enabled === void 0 ? await client.getProject(projectId) : await client.updateProject(projectId, { indexingEnabled: enabled });
931
+ const result = { projectId, indexingEnabled: project.indexingEnabled !== false };
932
+ console.log(
933
+ options.json ? JSON.stringify(result) : `${projectId}: workspace indexing ${result.indexingEnabled ? "on" : "off"}`
934
+ );
935
+ });
936
+ env2.command("edits [state]").description(
937
+ "Show or set on/off for Gezel changing files in the current project's folder (off for a folder until you allow it)"
938
+ ).option("--json", "Output the project setting as JSON").action(async (state, options) => {
939
+ const enabled = enabledValue(state);
940
+ const client = await connect();
941
+ const projectId = await projectFor(client);
942
+ const project = enabled === void 0 ? await client.getProject(projectId) : await client.updateProject(projectId, {
943
+ managedWorkspaceWritePolicy: enabled ? "allow" : "deny"
944
+ });
945
+ const result = { projectId, editsAllowed: projectManagedWorkspaceWritable(project) };
946
+ console.log(
947
+ options.json ? JSON.stringify(result) : `${projectId}: ${result.editsAllowed ? "Gezel may change files in this project" : "Gezel may not change files in this project (read-only)"}`
948
+ );
949
+ });
950
+ }
951
+
782
952
  // src/account-command.ts
783
953
  async function readNewPassword(options, input = process.stdin, write = (text) => process.stderr.write(text)) {
784
954
  if (options.passwordStdin) {
@@ -922,8 +1092,221 @@ function registerAccountCommands(program2, connect, output = console.log, input
922
1092
  ${url}` : `Setup code: ${code}`);
923
1093
  });
924
1094
  }
925
- function registerIntegrationCommands(program2, connect, output = console.log) {
926
- const token = program2.command("integrations").description("Connect other apps to this Gezel").command("token").description("Make or revoke an app key");
1095
+ var THIS_COMPUTER = {
1096
+ env: process.env,
1097
+ async ollamaAnswering() {
1098
+ try {
1099
+ const response = await fetch(`${ollamaEmulationAddresses().ollama}/api/version`, {
1100
+ signal: AbortSignal.timeout(1e3)
1101
+ });
1102
+ return response.ok && response.headers.get("x-gezel-ollama-emulation") === "1";
1103
+ } catch {
1104
+ return false;
1105
+ }
1106
+ }
1107
+ };
1108
+ function keyedAddress(client, env2) {
1109
+ if (env2.GEZEL_CONTAINER === "1") {
1110
+ return { baseUrl: `${containerPublicBase(env2)}/v1`, ownCertificate: false, container: true };
1111
+ }
1112
+ const base = client.getBaseUrl();
1113
+ return { baseUrl: `${base}/v1`, ownCertificate: base.startsWith("https://"), container: false };
1114
+ }
1115
+ var OWN_CERTIFICATE_NOTE = "It is served with Gezel's own certificate, which a program has to trust or skip checking.";
1116
+ var OLLAMA_SWITCH = "gezel integrations ollama on";
1117
+ function describeAppAddresses(input) {
1118
+ const { keyed, emulation } = input;
1119
+ const lines = [];
1120
+ if (!input.appsAllowed) {
1121
+ lines.push(
1122
+ 'Apps are not allowed to connect to this Gezel ("Allow apps to connect" is off in Settings \u2192 Integrations). These addresses answer once it is on.',
1123
+ ""
1124
+ );
1125
+ }
1126
+ lines.push('With an app key ("gezel integrations token create <app>"):', ` ${keyed.baseUrl}`);
1127
+ if (keyed.ownCertificate) lines.push(` ${OWN_CERTIFICATE_NOTE}`);
1128
+ if (keyed.container) return lines;
1129
+ const plain = ollamaEmulationAddresses();
1130
+ lines.push("");
1131
+ if (!emulation.on) {
1132
+ lines.push(
1133
+ `Without a key, over plain HTTP on a fixed port: off. "${OLLAMA_SWITCH}" turns it on:`,
1134
+ ` ${plain.openai}`
1135
+ );
1136
+ } else if (emulation.answering === false) {
1137
+ lines.push(
1138
+ `Ollama emulation is on, but Gezel is not answering on port ${OLLAMA_EMULATION_PORT}. Another program may hold the port (Ollama itself, or another person's Gezel); the service log says which.`
1139
+ );
1140
+ } else {
1141
+ lines.push(
1142
+ "Without a key, over plain HTTP on a fixed port (Ollama emulation is on):",
1143
+ ` ${plain.openai} OpenAI-style`,
1144
+ ` ${plain.ollama} Ollama`
1145
+ );
1146
+ }
1147
+ return lines;
1148
+ }
1149
+ function isThisComputer(baseUrl) {
1150
+ try {
1151
+ return ["127.0.0.1", "localhost", "[::1]"].includes(new URL(baseUrl).hostname);
1152
+ } catch {
1153
+ return false;
1154
+ }
1155
+ }
1156
+ var APP_ERRORS = {
1157
+ verification_code_required: "This request needs the code the app is showing. Add --code <code>.",
1158
+ verification_code_invalid: "That code does not match the one the app is showing.",
1159
+ verification_attempts_exceeded: "Too many wrong codes. Ask the app to connect again, then approve the new request.",
1160
+ grant_expired: "That request ran out. Ask the app to connect again.",
1161
+ grant_not_found: "That request is gone. Ask the app to connect again."
1162
+ };
1163
+ async function appsRequest(client, method, path, body) {
1164
+ const response = await client.getFetch()(`${client.getBaseUrl()}/v1/apps${path}`, {
1165
+ method,
1166
+ headers: {
1167
+ ...client.authHeader(),
1168
+ ...body === void 0 ? {} : { "content-type": "application/json" }
1169
+ },
1170
+ ...body === void 0 ? {} : { body: JSON.stringify(body) }
1171
+ });
1172
+ const data = await response.json().catch(() => ({}));
1173
+ if (!response.ok) {
1174
+ const code = typeof data.error === "string" ? data.error : "";
1175
+ throw new CliError(
1176
+ APP_ERRORS[code] ?? `Gezel refused (${response.status}${code ? `: ${code}` : ""}).`
1177
+ );
1178
+ }
1179
+ return data;
1180
+ }
1181
+ async function appRoster(client) {
1182
+ const roster = await appsRequest(client, "GET", "");
1183
+ if (!Array.isArray(roster.apps) || !Array.isArray(roster.grants)) {
1184
+ throw new CliError("This Gezel service did not answer with its connected apps.");
1185
+ }
1186
+ return roster;
1187
+ }
1188
+ function waitingRequests(roster) {
1189
+ return roster.grants.filter((grant) => grant.status === "pending" && grant.kind !== "device");
1190
+ }
1191
+ async function waitingRequestFor(client, appId) {
1192
+ const waiting = waitingRequests(await appRoster(client));
1193
+ const grant = waiting.find((candidate) => candidate.appId === appId);
1194
+ if (grant) return grant;
1195
+ throw new CliError(
1196
+ waiting.length > 0 ? `${appId} is not waiting for approval. Waiting now: ${waiting.map((g) => g.appId).join(", ")}.` : `No app is waiting for approval. A request lasts ten minutes; ask ${appId} to connect again.`
1197
+ );
1198
+ }
1199
+ function registerIntegrationCommands(program2, connect, output = console.log, host = THIS_COMPUTER) {
1200
+ const integrations = program2.command("integrations").description("Connect other apps to this Gezel");
1201
+ integrations.command("address").description("Show where other programs reach this Gezel's models").option("--json", "Output as JSON").action(async (options) => {
1202
+ const client = await connect();
1203
+ const endpoints = (await client.getConfig()).openaiEndpoints ?? {};
1204
+ const keyed = keyedAddress(client, host.env);
1205
+ const on = endpoints.emulateOllama === true;
1206
+ const answering = on && !keyed.container && isThisComputer(client.getBaseUrl()) ? await host.ollamaAnswering() : null;
1207
+ if (options.json) {
1208
+ return output(
1209
+ JSON.stringify({
1210
+ baseUrl: keyed.baseUrl,
1211
+ needsKey: true,
1212
+ ownCertificate: keyed.ownCertificate,
1213
+ appsAllowed: endpoints.enabled !== false,
1214
+ ...keyed.container ? {} : { ollamaEmulation: { on, answering, ...ollamaEmulationAddresses() } }
1215
+ })
1216
+ );
1217
+ }
1218
+ output(
1219
+ describeAppAddresses({
1220
+ keyed,
1221
+ appsAllowed: endpoints.enabled !== false,
1222
+ emulation: { on, answering }
1223
+ }).join("\n")
1224
+ );
1225
+ });
1226
+ integrations.command("ollama [state]").description(
1227
+ `Show or set on/off for a plain-HTTP port programs on this computer can use without a key (Ollama emulation, port ${OLLAMA_EMULATION_PORT})`
1228
+ ).option("--json", "Output as JSON").action(async (state, options) => {
1229
+ const wanted = enabledValue(state);
1230
+ const client = await connect();
1231
+ const endpoints = (await client.getConfig()).openaiEndpoints ?? {};
1232
+ let on = endpoints.emulateOllama === true;
1233
+ if (wanted !== void 0) {
1234
+ const { emulateOllama: _previous, ...rest } = endpoints;
1235
+ const updated = await plainly(
1236
+ () => client.updateConfig({
1237
+ openaiEndpoints: wanted ? { ...rest, emulateOllama: true } : rest
1238
+ })
1239
+ );
1240
+ on = updated.openaiEndpoints?.emulateOllama === true;
1241
+ if (wanted && !on) {
1242
+ throw new CliError("This build of Gezel does not offer the plain-HTTP port.");
1243
+ }
1244
+ }
1245
+ const plain = ollamaEmulationAddresses();
1246
+ if (options.json) {
1247
+ return output(JSON.stringify({ emulateOllama: on, ...on ? plain : {} }));
1248
+ }
1249
+ const lines = [`Ollama emulation: ${on ? "on" : "off"}`];
1250
+ if (on && endpoints.enabled === false) {
1251
+ lines.push(
1252
+ 'Apps are not allowed to connect to this Gezel, so the port stays closed. Turn on "Allow apps to connect" in Settings \u2192 Integrations.'
1253
+ );
1254
+ } else if (on && host.env.GEZEL_CONTAINER === "1") {
1255
+ lines.push(
1256
+ `In a container this port answers only inside the container. From outside, use ${keyedAddress(client, host.env).baseUrl} with an app key.`
1257
+ );
1258
+ } else if (on) {
1259
+ lines.push(
1260
+ "Programs on this computer can use your models without a key:",
1261
+ ` ${plain.openai} OpenAI-style`,
1262
+ ` ${plain.ollama} Ollama`,
1263
+ ...wanted ? ['It stays on until you run "gezel integrations ollama off".'] : []
1264
+ );
1265
+ }
1266
+ output(lines.join("\n"));
1267
+ });
1268
+ integrations.command("list").description("Show the apps connected to this Gezel and the ones waiting for your approval").option("--json", "Output as JSON").action(async (options) => {
1269
+ const roster = await appRoster(await connect());
1270
+ const waiting = waitingRequests(roster);
1271
+ const label = (app) => `${app.appId}${app.appName && app.appName !== app.appId ? ` ${app.appName}` : ""} (${app.scopes.join(", ")})`;
1272
+ const lines = [];
1273
+ if (waiting.length > 0) {
1274
+ lines.push("Waiting for your approval:");
1275
+ for (const grant of waiting) {
1276
+ lines.push(
1277
+ ` ${label(grant)}${grant.verificationRequired ? " needs the code it shows" : ""}`
1278
+ );
1279
+ }
1280
+ lines.push('Answer with "gezel integrations approve <appId>" or "deny <appId>".', "");
1281
+ }
1282
+ const connected = roster.apps.filter(
1283
+ (app) => !app.appId.startsWith("session:") && !app.appId.startsWith("harness:")
1284
+ );
1285
+ if (options.json) return output(JSON.stringify({ waiting, connected }));
1286
+ lines.push(connected.length > 0 ? "Connected:" : "No apps are connected.");
1287
+ for (const app of connected) lines.push(` ${label(app)}`);
1288
+ output(lines.join("\n"));
1289
+ });
1290
+ integrations.command("approve <appId>").description("Let an app that asked to connect use this Gezel").option("--code <code>", "The code the app shows, when it asks for more than model access").action(async (appId, options) => {
1291
+ const client = await connect();
1292
+ const grant = await waitingRequestFor(client, appId);
1293
+ await appsRequest(
1294
+ client,
1295
+ "POST",
1296
+ `/grant/${encodeURIComponent(grant.id)}/approve`,
1297
+ options.code ? { verificationCode: options.code } : {}
1298
+ );
1299
+ output(
1300
+ `${appId} is connected (${grant.scopes.join(", ")}). Revoke it with "gezel integrations token revoke ${appId}".`
1301
+ );
1302
+ });
1303
+ integrations.command("deny <appId>").description("Turn down an app that asked to connect").action(async (appId) => {
1304
+ const client = await connect();
1305
+ const grant = await waitingRequestFor(client, appId);
1306
+ await appsRequest(client, "POST", `/grant/${encodeURIComponent(grant.id)}/deny`);
1307
+ output(`${appId} was turned down.`);
1308
+ });
1309
+ const token = integrations.command("token").description("Make or revoke an app key");
927
1310
  token.command("create <appId>").description("Make a key for an app (OpenAI-compatible access by default)").option("--name <name>", "The name Integrations shows for the app").option(
928
1311
  "--scope <scope...>",
929
1312
  "What the key may do: openai, knowledge, images, product or cli (default: openai)"
@@ -935,14 +1318,19 @@ function registerIntegrationCommands(program2, connect, output = console.log) {
935
1318
  ...options.scope?.length ? { scopes: options.scope } : {}
936
1319
  })
937
1320
  );
938
- if (options.json) return output(JSON.stringify(created));
1321
+ const where = keyedAddress(client, host.env);
1322
+ if (options.json) return output(JSON.stringify({ ...created, baseUrl: where.baseUrl }));
939
1323
  output(
940
1324
  [
941
1325
  `Key for ${created.appId} (${created.scopes.join(", ")}):`,
942
1326
  ` ${created.token}`,
943
1327
  "",
944
- "Use it as the API key, with the base URL ending in /v1.",
945
- 'It is shown once. Revoke it with "gezel integrations token revoke".'
1328
+ "Use it as the API key, with this base URL:",
1329
+ ` ${where.baseUrl}`,
1330
+ ...where.ownCertificate ? [
1331
+ `${OWN_CERTIFICATE_NOTE} For plain HTTP on a fixed port, see "gezel integrations address".`
1332
+ ] : [],
1333
+ 'The key is shown once. Revoke it with "gezel integrations token revoke".'
946
1334
  ].join("\n")
947
1335
  );
948
1336
  });
@@ -1225,204 +1613,50 @@ async function ensureOneEngine(client, engine, llamaVariant, output) {
1225
1613
  case "verifying":
1226
1614
  output.writeProgress(`${engine}: verifying ${event.what}
1227
1615
  `);
1228
- break;
1229
- case "done":
1230
- output.writeProgress(
1231
- `${engine}: ready${event.cached ? " (cached)" : ` \u2014 ${event.binPath}`}
1232
- `
1233
- );
1234
- break;
1235
- case "error":
1236
- terminalError = event.error;
1237
- output.writeProgress(`${engine}: error \u2014 ${event.error}
1238
- `);
1239
- break;
1240
- }
1241
- };
1242
- try {
1243
- await client.ensureNativeEngine(
1244
- engine,
1245
- onEvent,
1246
- engine === "llama-server" ? llamaVariant : void 0
1247
- );
1248
- } catch (error) {
1249
- if (progressLineOpen) output.writeProgress("\n");
1250
- throw new CliError(
1251
- `native install failed for ${engine}: ${terminalError ?? errorMessage(error)}`
1252
- );
1253
- }
1254
- if (progressLineOpen) output.writeProgress("\n");
1255
- if (terminalError) {
1256
- throw new CliError(`native install failed for ${engine}: ${terminalError}`);
1257
- }
1258
- }
1259
- function formatProgress(engine, written, total) {
1260
- if (total <= 0) return `${engine}: ${formatBytes(written)} downloaded`;
1261
- const pct = Math.min(100, Math.floor(written / total * 100));
1262
- return `${engine}: ${String(pct).padStart(3)}% ${formatBytes(written)}/${formatBytes(total)}`;
1263
- }
1264
- function formatBytes(bytes) {
1265
- if (bytes < 1024) return `${bytes} B`;
1266
- if (bytes < 1024 ** 2) return `${(bytes / 1024).toFixed(1)} KiB`;
1267
- if (bytes < 1024 ** 3) return `${(bytes / 1024 ** 2).toFixed(1)} MiB`;
1268
- return `${(bytes / 1024 ** 3).toFixed(2)} GiB`;
1269
- }
1270
- function errorMessage(error) {
1271
- return error instanceof Error ? error.message : String(error);
1272
- }
1273
-
1274
- // src/settings-command.ts
1275
- import {
1276
- classifySecurityLevel,
1277
- resolveSecurityPolicy,
1278
- securityCapabilitiesOf,
1279
- securityPolicyForLevel
1280
- } from "@bendyline/gezel";
1281
- var SECURITY_LEVEL_LABELS = {
1282
- "super-lockdown": "Super Lockdown",
1283
- lockdown: "Lockdown",
1284
- free: "Unrestricted",
1285
- custom: "Custom"
1286
- };
1287
- function policyWithCapability(config, key, enabled) {
1288
- const caps = { ...securityCapabilitiesOf(resolveSecurityPolicy(config)), [key]: enabled };
1289
- return { level: classifySecurityLevel(caps), ...caps };
1290
- }
1291
- function policyWithExternalServices(config, enabled) {
1292
- return policyWithCapability(config, "allowExternalServices", enabled);
1293
- }
1294
- var SECURITY_SWITCHES = [
1295
- {
1296
- command: "external-services",
1297
- key: "allowExternalServices",
1298
- label: "External services",
1299
- description: "Show or set on/off for model-initiated external services, including web search"
1300
- },
1301
- {
1302
- command: "run-package-scripts",
1303
- key: "allowPackageScriptExecution",
1304
- label: "Run package scripts",
1305
- description: "Show or set on/off for gezels running package scripts and installed package binaries (outside the sandbox, with network access)"
1306
- },
1307
- {
1308
- command: "edit-package-scripts",
1309
- key: "allowPackageScriptEdits",
1310
- label: "Edit package scripts",
1311
- description: "Show or set on/off for gezels adding or changing the scripts in package.json"
1312
- }
1313
- ];
1314
- var CAPABILITY_LABELS = [
1315
- ["allowExternalChat", "Cloud models"],
1316
- ["allowFileEdits", "File edits and the model\u2019s Git tools"],
1317
- ["allowScriptExecution", "Sandboxed scripts"],
1318
- ["allowAppNetwork", "Update checks and the connector syncs you start"],
1319
- ["allowExternalServices", "Web search, mail and other outside services"],
1320
- ["allowPackageScriptExecution", "Run package scripts"],
1321
- ["allowPackageScriptEdits", "Edit package scripts"]
1322
- ];
1323
- var LEVEL_ALIASES = {
1324
- "super-lockdown": "super-lockdown",
1325
- superlockdown: "super-lockdown",
1326
- lockdown: "lockdown",
1327
- free: "free",
1328
- unrestricted: "free"
1329
- };
1330
- function parseSecurityLevel(input) {
1331
- const level = LEVEL_ALIASES[input.trim().toLowerCase()];
1332
- if (!level) {
1333
- throw new CliError(
1334
- `Unknown security level "${input}". Choose super-lockdown, lockdown, or free (shown as Unrestricted in Settings).`
1335
- );
1336
- }
1337
- return level;
1338
- }
1339
- function describeSecurityLevel(policy) {
1340
- const caps = securityCapabilitiesOf(resolveSecurityPolicy({ securityPolicy: policy }));
1341
- const level = classifySecurityLevel(caps);
1342
- const width = Math.max(...CAPABILITY_LABELS.map(([, label]) => label.length));
1343
- return [
1344
- `Security level: ${SECURITY_LEVEL_LABELS[level]}${level === "custom" ? "" : ` (${level})`}`,
1345
- ...CAPABILITY_LABELS.map(
1346
- ([key, label]) => ` ${label.padEnd(width)} ${caps[key] ? "on" : "off"}`
1347
- )
1348
- ];
1349
- }
1350
- function enabledValue(state) {
1351
- if (state === void 0) return void 0;
1352
- if (state === "on") return true;
1353
- if (state === "off") return false;
1354
- throw new CliError("Use on or off.");
1355
- }
1356
- function registerSecurityCommands(program2, connect) {
1357
- const security = program2.command("security").description("Inspect or explicitly change security settings");
1358
- security.command("level [action] [level]").description(
1359
- "Show the security level, or set a preset: `level set super-lockdown|lockdown|free`"
1360
- ).option("--json", "Output the level and its capabilities as JSON").action(
1361
- async (action, requested, options) => {
1362
- if (action !== void 0 && action !== "show" && action !== "set") {
1363
- throw new CliError("Use `gezel security level`, `level show`, or `level set <level>`.");
1364
- }
1365
- if (action === "set" && requested === void 0) {
1366
- throw new CliError("Name a level: super-lockdown, lockdown, or free.");
1367
- }
1368
- if (action !== "set" && requested !== void 0) {
1369
- throw new CliError("To change the level, use `gezel security level set <level>`.");
1370
- }
1371
- const next = action === "set" ? parseSecurityLevel(requested) : void 0;
1372
- const client = await connect();
1373
- const policy = next ? securityPolicyForLevel(next) : {
1374
- level: "custom",
1375
- ...securityCapabilitiesOf(resolveSecurityPolicy(await client.getConfig()))
1376
- };
1377
- if (next) await client.updateConfig({ securityPolicy: policy });
1378
- if (options.json) {
1379
- const caps = securityCapabilitiesOf(resolveSecurityPolicy({ securityPolicy: policy }));
1380
- console.log(JSON.stringify({ level: classifySecurityLevel(caps), ...caps }));
1381
- return;
1382
- }
1383
- for (const line of describeSecurityLevel(policy)) console.log(line);
1384
- }
1385
- );
1386
- for (const setting of SECURITY_SWITCHES) {
1387
- security.command(`${setting.command} [state]`).description(setting.description).option("--json", "Output the setting as JSON").action(async (state, options) => {
1388
- const enabled = enabledValue(state);
1389
- const client = await connect();
1390
- const config = await client.getConfig();
1391
- const policy = resolveSecurityPolicy(config);
1392
- if (enabled !== void 0) {
1393
- await client.updateConfig({
1394
- securityPolicy: policyWithCapability(config, setting.key, enabled)
1395
- });
1396
- }
1397
- const value = enabled ?? policy[setting.key];
1398
- console.log(
1399
- options.json ? JSON.stringify({ [setting.key]: value }) : `${setting.label}: ${value ? "on" : "off"}`
1400
- );
1401
- });
1616
+ break;
1617
+ case "done":
1618
+ output.writeProgress(
1619
+ `${engine}: ready${event.cached ? " (cached)" : ` \u2014 ${event.binPath}`}
1620
+ `
1621
+ );
1622
+ break;
1623
+ case "error":
1624
+ terminalError = event.error;
1625
+ output.writeProgress(`${engine}: error \u2014 ${event.error}
1626
+ `);
1627
+ break;
1628
+ }
1629
+ };
1630
+ try {
1631
+ await client.ensureNativeEngine(
1632
+ engine,
1633
+ onEvent,
1634
+ engine === "llama-server" ? llamaVariant : void 0
1635
+ );
1636
+ } catch (error) {
1637
+ if (progressLineOpen) output.writeProgress("\n");
1638
+ throw new CliError(
1639
+ `native install failed for ${engine}: ${terminalError ?? errorMessage(error)}`
1640
+ );
1641
+ }
1642
+ if (progressLineOpen) output.writeProgress("\n");
1643
+ if (terminalError) {
1644
+ throw new CliError(`native install failed for ${engine}: ${terminalError}`);
1402
1645
  }
1403
1646
  }
1404
- function registerGrowthCommand(program2, connect) {
1405
- program2.command("growth [state]").description("Show or set on/off for gezel growth: XP and the level-ups it offers").option("--json", "Output the setting as JSON").action(async (state, options) => {
1406
- const enabled = enabledValue(state);
1407
- const client = await connect();
1408
- const config = enabled === void 0 ? await client.getConfig() : await client.updateConfig({ growth: { enabled } });
1409
- const value = config.growth?.enabled !== false;
1410
- console.log(
1411
- options.json ? JSON.stringify({ growthEnabled: value }) : `Growth (XP and level-ups): ${value ? "on" : "off"}`
1412
- );
1413
- });
1647
+ function formatProgress(engine, written, total) {
1648
+ if (total <= 0) return `${engine}: ${formatBytes(written)} downloaded`;
1649
+ const pct = Math.min(100, Math.floor(written / total * 100));
1650
+ return `${engine}: ${String(pct).padStart(3)}% ${formatBytes(written)}/${formatBytes(total)}`;
1414
1651
  }
1415
- function registerProjectSettingsCommands(env2, connect, projectFor) {
1416
- env2.command("indexing [state]").description("Show or set on/off for background workspace indexing in the current project").option("--json", "Output the project setting as JSON").action(async (state, options) => {
1417
- const enabled = enabledValue(state);
1418
- const client = await connect();
1419
- const projectId = await projectFor(client);
1420
- const project = enabled === void 0 ? await client.getProject(projectId) : await client.updateProject(projectId, { indexingEnabled: enabled });
1421
- const result = { projectId, indexingEnabled: project.indexingEnabled !== false };
1422
- console.log(
1423
- options.json ? JSON.stringify(result) : `${projectId}: workspace indexing ${result.indexingEnabled ? "on" : "off"}`
1424
- );
1425
- });
1652
+ function formatBytes(bytes) {
1653
+ if (bytes < 1024) return `${bytes} B`;
1654
+ if (bytes < 1024 ** 2) return `${(bytes / 1024).toFixed(1)} KiB`;
1655
+ if (bytes < 1024 ** 3) return `${(bytes / 1024 ** 2).toFixed(1)} MiB`;
1656
+ return `${(bytes / 1024 ** 3).toFixed(2)} GiB`;
1657
+ }
1658
+ function errorMessage(error) {
1659
+ return error instanceof Error ? error.message : String(error);
1426
1660
  }
1427
1661
 
1428
1662
  // src/craftbook-setup.ts
@@ -1487,7 +1721,7 @@ ${lines.join("\n")}
1487
1721
  const to = SECURITY_LEVEL_LABELS[next.level];
1488
1722
  const change = from === to ? "" : ` This changes your security level from ${from} to ${to}.`;
1489
1723
  const yes = await prompter.confirm(
1490
- `Turn on External services, so gezels can search the web and read web pages?${change} [y/N] `
1724
+ `Turn on External services, so Gezel can search the web and read web pages?${change} [y/N] `
1491
1725
  );
1492
1726
  if (!yes) stop(gap);
1493
1727
  await client.updateConfig({ securityPolicy: next });
@@ -1499,7 +1733,7 @@ ${lines.join("\n")}
1499
1733
  const to = SECURITY_LEVEL_LABELS[next.level];
1500
1734
  const change = from === to ? "" : ` This changes your security level from ${from} to ${to}.`;
1501
1735
  const yes = await prompter.confirm(
1502
- `Let gezels run package scripts such as ${gap.commands[0]}? They run outside the sandbox, as your account, with network access, and Gezel asks before each new command.${change} [y/N] `
1736
+ `Let Gezel run package scripts such as ${gap.commands[0]}? They run outside the sandbox, as your account, with network access, and Gezel asks before each new command.${change} [y/N] `
1503
1737
  );
1504
1738
  if (!yes) stop(gap);
1505
1739
  await client.updateConfig({ securityPolicy: next });
@@ -1697,9 +1931,9 @@ function describeGap(gap, sizes) {
1697
1931
  const why = gap.reasons.length > 0 ? ` (${gap.reasons.join("; ")})` : "";
1698
1932
  switch (gap.kind) {
1699
1933
  case "external-services":
1700
- return `External services are off, so gezels cannot reach the web${why}.`;
1934
+ return `External services are off, so Gezel cannot reach the web${why}.`;
1701
1935
  case "package-scripts":
1702
- return `Run package scripts is off, so gezels cannot run ${gap.commands.join(", ")}${why}.`;
1936
+ return `Run package scripts is off, so Gezel cannot run ${gap.commands.join(", ")}${why}.`;
1703
1937
  case "web-search":
1704
1938
  return gap.keyMissing ? `Web search needs a Brave Search API key, and none is set${why}.` : `Web search is not set to Brave Search${why}.`;
1705
1939
  case "model": {
@@ -1785,30 +2019,33 @@ async function availableChatModels(client, engine) {
1785
2019
  if (engine === "ds4") {
1786
2020
  throw new CliError("`--available` lists mlx and llama-cpp models; pass one with --provider.");
1787
2021
  }
1788
- const [memory, catalog, installed, config] = await Promise.all([
2022
+ const [memory, catalog, installed, config, native2] = await Promise.all([
1789
2023
  client.getMemoryProfile(),
1790
2024
  client.listCatalogItems("chat-model"),
1791
2025
  installedChatModels(client, engine),
1792
- client.getConfig()
2026
+ client.getConfig(),
2027
+ client.getNativeEngineStatus?.().catch(() => void 0)
1793
2028
  ]);
1794
2029
  const pinned = config.defaultModel?.[engine];
2030
+ const gpuUnmeasured = engine === "llama-cpp" && memory.source === "system-ram-fallback" && !!native2?.platformKey && !native2.engines.some((entry) => entry.name === "llama-server" && entry.installed);
1795
2031
  return {
1796
2032
  ranked: rankChatModels(catalog.items, recoDevice(memory), engine),
1797
2033
  installed: new Set(installed),
1798
- ...pinned ? { pinned } : {}
2034
+ ...pinned ? { pinned } : {},
2035
+ ...gpuUnmeasured ? { gpuUnmeasured } : {}
1799
2036
  };
1800
2037
  }
1801
2038
  function formatAvailableChatModels(input) {
1802
- const { engine, ranked, installed, pinned, measured } = input;
2039
+ const { engine, ranked, installed, pinned, measured, gpuUnmeasured } = input;
1803
2040
  if (ranked.length === 0) return `(no ${engine} chat models in the catalog for this machine)`;
1804
2041
  const width = Math.max(...ranked.map((model2) => model2.id.length));
1805
2042
  const measuredWidth = measured ? Math.max("not measured".length, ...ranked.map((m) => (measured.get(m.id) ?? "").length)) : 0;
1806
2043
  const lines = [
1807
- `${engine} chat models for this machine, the recommended first download on top, then by catalog ranking:`
2044
+ gpuUnmeasured ? `${engine} chat models, ranked by this computer's main memory only (its graphics card is not measured yet):` : `${engine} chat models for this machine, the recommended first download on top, then by catalog ranking:`
1808
2045
  ];
1809
2046
  ranked.forEach((model2, index) => {
1810
2047
  const notes = [
1811
- index === 0 ? "recommended" : "",
2048
+ index === 0 && !gpuUnmeasured ? "recommended" : "",
1812
2049
  installed.has(model2.id) ? "installed" : "",
1813
2050
  model2.id === pinned ? "in use" : ""
1814
2051
  ].filter(Boolean);
@@ -1819,6 +2056,12 @@ function formatAvailableChatModels(input) {
1819
2056
  });
1820
2057
  const flag = providerFlag(engine, input.platformDefault);
1821
2058
  const smallest = [...ranked].sort((a, b) => a.approxSizeBytes - b.approxSizeBytes)[0];
2059
+ if (gpuUnmeasured) {
2060
+ lines.push(
2061
+ "",
2062
+ "Gezel reads a graphics card through its engine, which is not installed yet. Run `gezel native install`, then list again to see the model recommended for this computer."
2063
+ );
2064
+ }
1822
2065
  lines.push(
1823
2066
  "",
1824
2067
  `Download one with \`gezel model pull <id>${flag}\`. The smallest is ${smallest.id} (${formatDownloadSize(smallest.approxSizeBytes)}).`,
@@ -1908,7 +2151,9 @@ async function checkRunReadiness(client, gezelId, env2 = process.env) {
1908
2151
  const installed = provider === "mlx" ? await client.listMlxModels() : await client.listLlamaCppModels();
1909
2152
  const installedIds = installed.models.map((model2) => model2.id);
1910
2153
  const pinned = config.defaultModel?.[provider];
1911
- const engineMissing = provider === "llama-cpp" && !native2.engines.some((engine) => engine.name === "llama-server" && engine.installed);
2154
+ const engineMissing = !native2.engines.some(
2155
+ (engine) => engine.name === ENGINE_BINARY[provider] && engine.installed
2156
+ );
1912
2157
  const modelReady = pinned ? installedIds.includes(pinned) : installedIds.length > 0;
1913
2158
  if (!engineMissing && modelReady) return READY;
1914
2159
  return {
@@ -2549,9 +2794,14 @@ function detailText(details) {
2549
2794
  // src/craftbook-command.ts
2550
2795
  import { setTimeout as delay } from "timers/promises";
2551
2796
  import {
2797
+ PROJECT_EDITS_CLI_COMMAND,
2552
2798
  composeCraftbookLaunch,
2553
2799
  createAwakeTimeout,
2554
- paramAsksUser
2800
+ isRuntimeTemplateDefault,
2801
+ paramAsksUser,
2802
+ paramInputSpec,
2803
+ projectManagedWorkspaceWritable as projectManagedWorkspaceWritable2,
2804
+ stepWorkspaceDeliverableFiles
2555
2805
  } from "@bendyline/gezel";
2556
2806
 
2557
2807
  // src/tui/craftbook-start.ts
@@ -2633,13 +2883,19 @@ function checkParamValue(key, def, value) {
2633
2883
  if (typeof def.minLength === "number" && value.trim().length < def.minLength)
2634
2884
  throw new CliError(`${key} is too short`);
2635
2885
  }
2636
- function parseCraftbookArguments(book, tokens, named = []) {
2886
+ function craftbookBareSlots(book) {
2637
2887
  const schema = book.paramSchema ?? {};
2638
2888
  const properties = schema.properties ?? {};
2639
2889
  const required = new Set(Array.isArray(schema.required) ? schema.required : []);
2640
- const slots = Object.keys(properties).filter(
2890
+ return Object.keys(properties).filter(
2641
2891
  (key) => required.has(key) && properties[key].default === void 0 && paramAsksUser(properties[key], key)
2642
2892
  );
2893
+ }
2894
+ function parseCraftbookArguments(book, tokens, named = []) {
2895
+ const schema = book.paramSchema ?? {};
2896
+ const properties = schema.properties ?? {};
2897
+ const required = new Set(Array.isArray(schema.required) ? schema.required : []);
2898
+ const slots = craftbookBareSlots(book);
2643
2899
  const params = {};
2644
2900
  const requestWords = [];
2645
2901
  const set = (key, value, token) => {
@@ -2680,6 +2936,119 @@ function craftbookDoLaunch(craftbook2, { params, request }) {
2680
2936
  });
2681
2937
  return { description: launch.description, craftbookParams: launch.params };
2682
2938
  }
2939
+ function craftbookFolderFiles(craftbook2) {
2940
+ const files = /* @__PURE__ */ new Set();
2941
+ for (const step of craftbook2.steps ?? []) {
2942
+ for (const file of stepWorkspaceDeliverableFiles(step)) files.add(file);
2943
+ }
2944
+ return [...files];
2945
+ }
2946
+ function nameFolderFiles(files) {
2947
+ const named = files.filter((file) => !isRuntimeTemplateDefault(file));
2948
+ if (named.length === 0) return "its results";
2949
+ const rest = files.length - 1;
2950
+ return rest === 0 ? named[0] : `${named[0]} and ${rest} more file${rest === 1 ? "" : "s"}`;
2951
+ }
2952
+ async function ensureProjectEdits(client, options) {
2953
+ const files = craftbookFolderFiles(options.craftbook);
2954
+ if (files.length === 0) return;
2955
+ const project = await client.getProject(options.projectId);
2956
+ if (projectManagedWorkspaceWritable2(project)) return;
2957
+ const what = nameFolderFiles(files);
2958
+ const where = project.workingDir ?? "this project";
2959
+ const turnOn = async () => {
2960
+ await client.updateProject(options.projectId, { managedWorkspaceWritePolicy: "allow" });
2961
+ };
2962
+ if (options.allow) {
2963
+ await turnOn();
2964
+ options.write(`Gezel may now change files in ${where} (--allow-edits).
2965
+ `);
2966
+ return;
2967
+ }
2968
+ const saves = `${options.craftbook.name} saves ${what} into ${where}, and Gezel may not change files there yet.`;
2969
+ if (options.prompter) {
2970
+ if (await options.prompter.confirm(`${saves} Allow it? [y/N] `)) {
2971
+ await turnOn();
2972
+ options.write("Project edits: on\n");
2973
+ return;
2974
+ }
2975
+ }
2976
+ options.write(
2977
+ `${saves} If it stops for that, run \`${PROJECT_EDITS_CLI_COMMAND}\` here, or start it with --allow-edits.
2978
+ `
2979
+ );
2980
+ }
2981
+ function taskInputFailure(err, book, params) {
2982
+ if (!(err instanceof Error) || err.name !== "GezelApiError") return null;
2983
+ const details = err.details;
2984
+ if (!details || typeof details !== "object") return null;
2985
+ const { code, param, error } = details;
2986
+ if (code !== "task-input" || typeof param !== "string") return null;
2987
+ const value = params[param];
2988
+ const lines = [
2989
+ `${book.name} did not start: ${typeof error === "string" ? error : `${param} is not usable.`}`
2990
+ ];
2991
+ if (value && /\s/.test(value.trim())) {
2992
+ lines.push(
2993
+ `It read "${value}" as ${param}, which comes before your request:`,
2994
+ ` gezel do ${book.command} <${param}> "your request"`
2995
+ );
2996
+ }
2997
+ lines.push(`\`gezel craftbook show ${book.command}\` lists what it takes.`);
2998
+ return new CliError(lines.join("\n"));
2999
+ }
3000
+ function firstParagraph(text) {
3001
+ return (text ?? "").split(/\n\s*\n/)[0]?.replace(/\s+/g, " ").trim() ?? "";
3002
+ }
3003
+ function paramAccepts(property) {
3004
+ const input = paramInputSpec(property);
3005
+ if (input) {
3006
+ const kinds = input.accept ? ` (${input.accept.join(", ")})` : "";
3007
+ return input.kind === "folder" ? "a folder or file in this project" : `a file in this project${kinds}`;
3008
+ }
3009
+ if (Array.isArray(property.enum)) return `one of: ${property.enum.map(String).join(", ")}`;
3010
+ if (property.type === "boolean") return "true or false";
3011
+ if (property.type === "number" || property.type === "integer") return "a number";
3012
+ return "text";
3013
+ }
3014
+ function describeCraftbook(book, craftbook2) {
3015
+ const schema = craftbook2.paramSchema ?? {};
3016
+ const properties = schema.properties ?? {};
3017
+ const required = new Set(Array.isArray(schema.required) ? schema.required : []);
3018
+ const slots = craftbookBareSlots(craftbook2);
3019
+ const asked = Object.keys(properties).filter((key) => paramAsksUser(properties[key], key));
3020
+ const lines = [`${book.command} \u2014 ${book.name}`];
3021
+ const about = firstParagraph(craftbook2.description);
3022
+ if (about) lines.push(about);
3023
+ lines.push("", "Start it:");
3024
+ lines.push(
3025
+ ` gezel do ${[book.command, ...slots.map((key) => `<${key}>`)].join(" ")} "your request"`
3026
+ );
3027
+ if (asked.length > 0) {
3028
+ const width = Math.max(...asked.map((key) => key.length));
3029
+ lines.push("", "Takes:");
3030
+ for (const key of asked) {
3031
+ const property = properties[key];
3032
+ const need = required.has(key) && property.default === void 0 ? "required" : "optional";
3033
+ const fallback = property.default !== void 0 && !isRuntimeTemplateDefault(property.default) ? `, default ${String(property.default)}` : "";
3034
+ const note = firstParagraph(
3035
+ typeof property.title === "string" ? property.title : typeof property.description === "string" ? property.description : ""
3036
+ );
3037
+ lines.push(
3038
+ ` ${key.padEnd(width)} ${need}, ${paramAccepts(property)}${fallback}${note ? ` \u2014 ${note}` : ""}`
3039
+ );
3040
+ }
3041
+ const named = asked.filter((key) => !slots.includes(key));
3042
+ if (named.length > 0)
3043
+ lines.push(`Set the optional ones by name, for example ${named[0]}=value.`);
3044
+ }
3045
+ const files = craftbookFolderFiles(craftbook2);
3046
+ lines.push(
3047
+ "",
3048
+ files.length > 0 ? `Saves ${nameFolderFiles(files)} into the project folder, so the project must allow edits (\`${PROJECT_EDITS_CLI_COMMAND}\`, or --allow-edits).` : "Saves its results in the task's own folder; add --out <dir> to copy them out."
3049
+ );
3050
+ return lines.join("\n");
3051
+ }
2683
3052
  var READ_RETRY_DELAYS = [250, 750, 1500];
2684
3053
  function transientTaskReadError(error) {
2685
3054
  const codes = /ECONNRESET|ECONNREFUSED|ECONNABORTED|EPIPE|ETIMEDOUT|EHOSTUNREACH|ENETUNREACH|EAI_AGAIN|UND_ERR_(?:SOCKET|CONNECT_TIMEOUT)|NGHTTP2_ENHANCE_YOUR_CALM|Connect Timeout Error|socket hang up|other side closed/;
@@ -2780,15 +3149,22 @@ function summarizeTaskNote(text, maxLength = 240) {
2780
3149
  const summary = heading && sentence ? `${heading}: ${sentence}` : heading || sentence;
2781
3150
  return summary.length > maxLength ? `${summary.slice(0, maxLength - 1).trimEnd()}\u2026` : summary;
2782
3151
  }
2783
- async function blockedTaskReason(client, result) {
2784
- if (result.outcome !== "blocked") return void 0;
3152
+ async function blockedTaskDetails(client, result) {
3153
+ if (result.outcome !== "blocked") return {};
2785
3154
  if (result.questionIds?.length) {
2786
- return "A gezel is waiting for your answer to a question. Answer it in the Gezel app or the interactive `gezel` terminal.";
3155
+ return {
3156
+ reason: "Gezel is waiting for your answer to a question. Answer it in the Gezel app or the interactive `gezel` terminal."
3157
+ };
3158
+ }
3159
+ if (result.task.status === "draft") {
3160
+ return { reason: "The task is still a draft and has not started." };
2787
3161
  }
2788
- if (result.task.status === "draft") return "The task is still a draft and has not started.";
2789
3162
  const { notes } = await client.listTaskNotes(result.task.projectId, result.task.num).catch(() => ({ notes: [] }));
2790
3163
  const latest = [...notes].sort((a, b) => a.at.localeCompare(b.at)).at(-1);
2791
- return latest ? summarizeTaskNote(latest.text) || void 0 : void 0;
3164
+ if (!latest) return {};
3165
+ const reason = summarizeTaskNote(latest.text) || void 0;
3166
+ const hint = latest.text.includes(PROJECT_EDITS_CLI_COMMAND) ? `Allow it with \`${PROJECT_EDITS_CLI_COMMAND}\` in the project's folder, then continue with \`gezel task resume ${result.task.ref}\`.` : void 0;
3167
+ return { ...reason ? { reason } : {}, ...hint ? { hint } : {} };
2792
3168
  }
2793
3169
  function filterCraftbooks(books, words) {
2794
3170
  const needles = words.map((word) => word.trim().toLowerCase()).filter(Boolean);
@@ -2905,7 +3281,8 @@ var CHECK_LABELS = {
2905
3281
  toolRoundTrip: "answers a tool call",
2906
3282
  throughput: "decodes fast enough",
2907
3283
  reasoningBudget: "bounded reasoning",
2908
- contextFit: "room for a prompt"
3284
+ contextFit: "room for a prompt",
3285
+ coherence: "writes readable replies"
2909
3286
  };
2910
3287
  function renderFitness(entry, probing) {
2911
3288
  if (probing) return ["fitness check: running now"];
@@ -3021,7 +3398,7 @@ var CLI_ENGAGEMENT_MODES = [
3021
3398
  name: "full-play",
3022
3399
  mode: "proactive",
3023
3400
  label: "Full play",
3024
- description: "Everything runs, including proactive nudges and cross-gezel work."
3401
+ description: "Everything runs, including proactive nudges and handoffs."
3025
3402
  }
3026
3403
  ];
3027
3404
  var MODE_ALIASES = {
@@ -3048,6 +3425,14 @@ var CLI_ENGAGEMENT_MODE_USAGE = CLI_ENGAGEMENT_MODES.map((option) => option.name
3048
3425
  "|"
3049
3426
  );
3050
3427
 
3428
+ // src/generate-command.ts
3429
+ import {
3430
+ IMAGE_ASPECT_RATIOS,
3431
+ IMAGE_QUALITIES,
3432
+ ImageAspectRatioSchema,
3433
+ ImageQualitySchema
3434
+ } from "@bendyline/gezel";
3435
+
3051
3436
  // src/generate.ts
3052
3437
  import { mkdir as mkdir2, readFile as readFile4, writeFile as writeFile3 } from "fs/promises";
3053
3438
  import { basename as basename2, dirname as dirname2, resolve as resolve2 } from "path";
@@ -3087,6 +3472,19 @@ function floatOpt(name, v) {
3087
3472
  if (!Number.isFinite(n)) throw new CliError(`--${name} must be a number (got "${v}").`);
3088
3473
  return n;
3089
3474
  }
3475
+ async function readPictureOpt(path) {
3476
+ let data;
3477
+ try {
3478
+ data = await readFile4(path);
3479
+ } catch (err) {
3480
+ throw new CliError(
3481
+ `could not read --image ${path}: ${err instanceof Error ? err.message : String(err)}`
3482
+ );
3483
+ }
3484
+ const ext = path.toLowerCase().split(".").pop();
3485
+ const mimeType = ext === "jpg" || ext === "jpeg" ? "image/jpeg" : ext === "webp" ? "image/webp" : ext === "gif" ? "image/gif" : "image/png";
3486
+ return { data: data.toString("base64"), mimeType };
3487
+ }
3090
3488
  async function saveArtifact(client, projectId, artifactPath, output) {
3091
3489
  const rel = artifactPath.replace(/^artifacts\//, "");
3092
3490
  const blob = await client.fetchProjectArtifactBlob(projectId, rel);
@@ -3097,6 +3495,127 @@ async function saveArtifact(client, projectId, artifactPath, output) {
3097
3495
  return dest;
3098
3496
  }
3099
3497
 
3498
+ // src/generate-command.ts
3499
+ function registerGenerateCommands(program2, connect) {
3500
+ program2.command("create-image [prompt...]").description("Generate an image from a prompt (or --file) via the configured image engine").option("-f, --file <path>", "read the prompt from a text file instead of the argument").option("-m, --model <id>", "image model catalog id (default: the engine default)").option("-n, --negative <text>", "negative prompt").option("-W, --width <px>", "width in pixels").option("-H, --height <px>", "height in pixels").option("-a, --aspect <ratio>", `aspect ratio: ${IMAGE_ASPECT_RATIOS.join(", ")}`).option("-q, --quality <tier>", `size tier: ${IMAGE_QUALITIES.join(", ")} (default: standard)`).option("-s, --steps <n>", "sampler steps (default: the model recommendation)").option("--seed <n>", "seed for reproducible output").option("-p, --project <id>", "project to write the artifact under", "default").option("-o, --output <path>", "write the image here (default: ./<artifact name>)").action(
3501
+ async (promptParts, opts) => {
3502
+ const aspect = enumOpt("aspect", opts.aspect, ImageAspectRatioSchema);
3503
+ const quality = enumOpt("quality", opts.quality, ImageQualitySchema);
3504
+ const prompt = await resolvePromptText(promptParts, opts.file, "prompt");
3505
+ const client = await connect();
3506
+ const projectId = opts.project ?? "default";
3507
+ const width = intOpt("width", opts.width);
3508
+ const height = intOpt("height", opts.height);
3509
+ const steps = intOpt("steps", opts.steps);
3510
+ const seed = intOpt("seed", opts.seed);
3511
+ console.error(`generating image${opts.model ? ` (model ${opts.model})` : ""}...`);
3512
+ let res;
3513
+ try {
3514
+ res = await client.generateImage({
3515
+ prompt,
3516
+ projectId,
3517
+ ...opts.model ? { model: opts.model } : {},
3518
+ ...opts.negative ? { negativePrompt: opts.negative } : {},
3519
+ ...width !== void 0 ? { width } : {},
3520
+ ...height !== void 0 ? { height } : {},
3521
+ ...aspect ? { aspectRatio: aspect } : {},
3522
+ ...quality ? { quality } : {},
3523
+ ...steps !== void 0 ? { steps } : {},
3524
+ ...seed !== void 0 ? { seed } : {}
3525
+ });
3526
+ } catch (err) {
3527
+ throw new CliError(
3528
+ `image generation failed: ${err instanceof Error ? err.message : String(err)}`
3529
+ );
3530
+ }
3531
+ const dest = await saveArtifact(client, projectId, res.artifactPath, opts.output);
3532
+ const m = res.meta;
3533
+ console.log(dest);
3534
+ console.error(
3535
+ ` model=${m.model} seed=${m.seed} steps=${m.steps} size=${m.widthPx}x${m.heightPx} time=${(m.durationMs / 1e3).toFixed(1)}s`
3536
+ );
3537
+ }
3538
+ );
3539
+ program2.command("create-video [prompt...]").description(
3540
+ "Generate a video from a prompt (or --file), or animate a picture (--image), via the configured video engine"
3541
+ ).option("-f, --file <path>", "read the prompt from a text file instead of the argument").option("-m, --model <id>", "video model catalog id (default: the engine default)").option("-n, --negative <text>", "negative prompt").option("-W, --width <px>", "width in pixels").option("-H, --height <px>", "height in pixels").option("-i, --image <path>", "a picture to animate; it becomes the first frame").option("-a, --aspect <ratio>", `aspect ratio: ${IMAGE_ASPECT_RATIOS.join(", ")}`).option("--frames <n>", "number of frames").option("--fps <n>", "frames per second").option("-s, --steps <n>", "sampler steps").option("--seed <n>", "seed for reproducible output").option("-p, --project <id>", "project to write the artifact under", "default").option("-o, --output <path>", "write the video here (default: ./<artifact name>)").action(
3542
+ async (promptParts, opts) => {
3543
+ const prompt = await resolvePromptText(promptParts, opts.file, "prompt");
3544
+ const aspect = enumOpt("aspect", opts.aspect, ImageAspectRatioSchema);
3545
+ const picture = opts.image ? await readPictureOpt(opts.image) : void 0;
3546
+ const client = await connect();
3547
+ const projectId = opts.project ?? "default";
3548
+ const width = intOpt("width", opts.width);
3549
+ const height = intOpt("height", opts.height);
3550
+ const numFrames = intOpt("frames", opts.frames);
3551
+ const fps = intOpt("fps", opts.fps);
3552
+ const steps = intOpt("steps", opts.steps);
3553
+ const seed = intOpt("seed", opts.seed);
3554
+ console.error(
3555
+ `generating video${opts.model ? ` (model ${opts.model})` : ""} \u2014 this can take a while...`
3556
+ );
3557
+ let res;
3558
+ try {
3559
+ res = await client.generateVideo({
3560
+ prompt,
3561
+ projectId,
3562
+ ...opts.model ? { model: opts.model } : {},
3563
+ ...opts.negative ? { negativePrompt: opts.negative } : {},
3564
+ ...width !== void 0 ? { width } : {},
3565
+ ...height !== void 0 ? { height } : {},
3566
+ ...aspect ? { aspectRatio: aspect } : {},
3567
+ ...picture ? { inputImage: picture, requireImageToVideo: true } : {},
3568
+ ...numFrames !== void 0 ? { numFrames } : {},
3569
+ ...fps !== void 0 ? { fps } : {},
3570
+ ...steps !== void 0 ? { steps } : {},
3571
+ ...seed !== void 0 ? { seed } : {}
3572
+ });
3573
+ } catch (err) {
3574
+ throw new CliError(
3575
+ `video generation failed: ${err instanceof Error ? err.message : String(err)}`
3576
+ );
3577
+ }
3578
+ const dest = await saveArtifact(client, projectId, res.artifactPath, opts.output);
3579
+ const m = res.meta;
3580
+ console.log(dest);
3581
+ console.error(
3582
+ ` model=${m.model} seed=${m.seed} ${m.widthPx}x${m.heightPx} frames=${m.numFrames} fps=${m.fps} time=${(m.durationMs / 1e3).toFixed(1)}s`
3583
+ );
3584
+ for (const note of m.settingsNotes ?? []) console.error(` note: ${note}`);
3585
+ }
3586
+ );
3587
+ program2.command("create-audio [text...]").description("Synthesize speech from text (or --file) via the configured TTS engine").option("-f, --file <path>", "read the text from a file instead of the argument").option("-m, --model <id>", "TTS model catalog id (default: the engine default)").option("--voice <id>", "voice id (default: the model or crew member default)").option("--speed <x>", "speed multiplier, 0.25-4 (default: 1.0)").option("-p, --project <id>", "project to write the artifact under", "default").option("-o, --output <path>", "write the audio here (default: ./<artifact name>)").action(
3588
+ async (textParts, opts) => {
3589
+ const text = await resolvePromptText(textParts, opts.file, "text");
3590
+ const client = await connect();
3591
+ const projectId = opts.project ?? "default";
3592
+ const speed = floatOpt("speed", opts.speed);
3593
+ console.error("synthesizing speech...");
3594
+ let res;
3595
+ try {
3596
+ res = await client.synthesizeSpeech({
3597
+ text,
3598
+ projectId,
3599
+ ...opts.model ? { model: opts.model } : {},
3600
+ ...opts.voice ? { voice: opts.voice } : {},
3601
+ ...speed !== void 0 ? { speed } : {}
3602
+ });
3603
+ } catch (err) {
3604
+ throw new CliError(
3605
+ `speech synthesis failed: ${err instanceof Error ? err.message : String(err)}`
3606
+ );
3607
+ }
3608
+ if (!res.artifactPath) throw new CliError("speech synthesis returned no saved audio");
3609
+ const dest = await saveArtifact(client, projectId, res.artifactPath, opts.output);
3610
+ const m = res.meta;
3611
+ console.log(dest);
3612
+ console.error(
3613
+ ` voice=${m.voice} model=${m.model} ${m.durationSeconds.toFixed(1)}s @ ${m.sampleRate}Hz`
3614
+ );
3615
+ }
3616
+ );
3617
+ }
3618
+
3100
3619
  // src/knowledge-install.ts
3101
3620
  import { existsSync as existsSync2 } from "fs";
3102
3621
  import { resolve as resolve3 } from "path";
@@ -3443,11 +3962,13 @@ async function resolveRunGezel(client, ref) {
3443
3962
  const candidates = gezels.filter((gezel) => match.labels.includes(gezel.name));
3444
3963
  throw ambiguous(ref, candidates);
3445
3964
  }
3446
- throw new CliError(`No gezel matches "${ref}". Run \`gezel agent list\` to see your gezels.`);
3965
+ throw new CliError(`No crew member matches "${ref}". Run \`gezel agent list\` to see your crew.`);
3447
3966
  }
3448
3967
  function ambiguous(ref, candidates) {
3449
3968
  const listed = candidates.map((gezel) => `${gezel.name} (${gezel.id})`).join(", ");
3450
- return new CliError(`"${ref}" matches more than one gezel: ${listed}. Pass the id instead.`);
3969
+ return new CliError(
3970
+ `"${ref}" matches more than one crew member: ${listed}. Pass the id instead.`
3971
+ );
3451
3972
  }
3452
3973
 
3453
3974
  // src/run-progress.ts
@@ -3952,7 +4473,7 @@ function formatBackupPlan(plan) {
3952
4473
  byKind.set(item.kind, bucket);
3953
4474
  }
3954
4475
  const labels = {
3955
- gezel: "gezels",
4476
+ gezel: "crew members",
3956
4477
  project: "projects",
3957
4478
  "document-root": "documents",
3958
4479
  "memory-root": "memories about you",
@@ -3974,7 +4495,8 @@ function formatRestoreReview(review) {
3974
4495
  ];
3975
4496
  for (const item of review.items) {
3976
4497
  const flag = item.conflict === "exists" ? " [already here]" : "";
3977
- lines.push(` ${pad(formatBytes2(item.bytes), 10)} ${item.kind}: ${item.label}${flag}`);
4498
+ const kind = item.kind === "gezel" ? "crew member" : item.kind;
4499
+ lines.push(` ${pad(formatBytes2(item.bytes), 10)} ${kind}: ${item.label}${flag}`);
3978
4500
  }
3979
4501
  if (review.items.length === 0) lines.push(" (this backup is empty)");
3980
4502
  if (review.warnings.length > 0) {
@@ -4003,23 +4525,32 @@ function resolveRestoreSelection(review, opts) {
4003
4525
  }
4004
4526
 
4005
4527
  // src/task-output.ts
4006
- import { mkdir as mkdir3, writeFile as writeFile4 } from "fs/promises";
4528
+ import { constants } from "fs";
4529
+ import { access, mkdir as mkdir3, writeFile as writeFile4 } from "fs/promises";
4007
4530
  import { dirname as dirname4, isAbsolute as isAbsolute2, join as join4, relative, resolve as resolve5, sep } from "path";
4531
+ import { taskDeliverableCandidates } from "@bendyline/gezel";
4532
+ function madeFiles(files, artifactDir) {
4533
+ const made = [];
4534
+ for (const file of files) {
4535
+ if (file.isDirectory) continue;
4536
+ const name = relative(artifactDir, file.path).split(sep).join("/");
4537
+ if (!name || name.startsWith("..") || isAbsolute2(name)) continue;
4538
+ if (name === "inputs" || name.startsWith("inputs/")) continue;
4539
+ made.push({ path: file.path, name });
4540
+ }
4541
+ return made;
4542
+ }
4008
4543
  async function copyTaskOutput(client, projectId, artifactDir, outDir) {
4009
4544
  const root = resolve5(outDir);
4010
4545
  const listing = await client.listProjectArtifacts(projectId, artifactDir, true);
4011
4546
  const copied = [];
4012
- for (const file of listing.files) {
4013
- if (file.isDirectory) continue;
4014
- const rel = relative(artifactDir, file.path).split(sep).join("/");
4015
- if (!rel || rel.startsWith("..") || isAbsolute2(rel)) continue;
4016
- if (rel === "inputs" || rel.startsWith("inputs/")) continue;
4017
- const target = join4(root, rel);
4547
+ for (const { path, name } of madeFiles(listing.files, artifactDir)) {
4548
+ const target = join4(root, name);
4018
4549
  if (relative(root, target).startsWith("..")) continue;
4019
- const blob = await client.fetchProjectArtifactBlob(projectId, file.path);
4550
+ const blob = await client.fetchProjectArtifactBlob(projectId, path);
4020
4551
  await mkdir3(dirname4(target), { recursive: true });
4021
4552
  await writeFile4(target, Buffer.from(await blob.arrayBuffer()));
4022
- copied.push(rel);
4553
+ copied.push(name);
4023
4554
  }
4024
4555
  if (listing.truncated) {
4025
4556
  throw new CliError(
@@ -4028,6 +4559,113 @@ async function copyTaskOutput(client, projectId, artifactDir, outDir) {
4028
4559
  }
4029
4560
  return copied;
4030
4561
  }
4562
+ var LOCATE_LIMIT = 100;
4563
+ async function describeTaskOutput(client, task2, canRead = readableHere) {
4564
+ const folderRelativePath = task2.artifactDir ?? null;
4565
+ const made = folderRelativePath ? madeFiles(
4566
+ (await client.listProjectArtifacts(task2.projectId, folderRelativePath, true)).files,
4567
+ folderRelativePath
4568
+ ) : [];
4569
+ const madePaths = new Set(made.map((file) => file.path.toLowerCase()));
4570
+ const locate = async (file) => client.resolveReferenceFileLocation(task2.projectId, file).then((located) => located.path).catch(() => null);
4571
+ let deliverable = null;
4572
+ for (const candidate of taskDeliverableCandidates(
4573
+ task2,
4574
+ made.map((file) => ({ kind: "artifact", path: file.path }))
4575
+ ).slice(0, 5)) {
4576
+ if (candidate.kind === "artifact") {
4577
+ if (!madePaths.has(candidate.path.toLowerCase())) continue;
4578
+ deliverable = { file: candidate, path: await locate(candidate) };
4579
+ break;
4580
+ }
4581
+ const path = await locate(candidate);
4582
+ if (path) {
4583
+ deliverable = { file: candidate, path };
4584
+ break;
4585
+ }
4586
+ }
4587
+ const files = [];
4588
+ const add = async (file, path, isDeliverable) => files.push({
4589
+ kind: file.kind,
4590
+ relativePath: file.path,
4591
+ path,
4592
+ readable: path !== null && await canRead(path),
4593
+ deliverable: isDeliverable
4594
+ });
4595
+ if (deliverable) await add(deliverable.file, deliverable.path, true);
4596
+ let folder = null;
4597
+ for (const file of made) {
4598
+ const ref = { kind: "artifact", path: file.path };
4599
+ if (deliverable?.file.kind === "artifact" && sameFile(deliverable.file.path, file.path)) {
4600
+ folder ??= hostFolder(deliverable.path, file.name);
4601
+ continue;
4602
+ }
4603
+ const path = files.length < LOCATE_LIMIT ? await locate(ref) : null;
4604
+ folder ??= hostFolder(path, file.name);
4605
+ await add(ref, path, false);
4606
+ }
4607
+ return {
4608
+ folderRelativePath,
4609
+ folder,
4610
+ folderReadable: folder !== null && await canRead(folder),
4611
+ files
4612
+ };
4613
+ }
4614
+ function withCopiedOutput(output, outDir) {
4615
+ const folder = resolve5(outDir);
4616
+ const prefix = output.folderRelativePath ? `${output.folderRelativePath}/` : null;
4617
+ return {
4618
+ ...output,
4619
+ folder,
4620
+ folderReadable: true,
4621
+ files: output.files.map(
4622
+ (file) => file.kind === "artifact" && prefix && file.relativePath.startsWith(prefix) ? {
4623
+ ...file,
4624
+ path: join4(folder, ...file.relativePath.slice(prefix.length).split("/")),
4625
+ readable: true
4626
+ } : file
4627
+ )
4628
+ };
4629
+ }
4630
+ function formatTaskOutput(output, ref, opts = {}) {
4631
+ const lines = [];
4632
+ const result = output.files.find((file) => file.deliverable);
4633
+ if (result) {
4634
+ lines.push(
4635
+ result.readable && result.path ? `Result: ${result.path}` : `Result: ${result.relativePath}, kept by the Gezel service`
4636
+ );
4637
+ }
4638
+ const prefix = output.folderRelativePath ? `${output.folderRelativePath}/` : "";
4639
+ const others = output.files.filter((file) => !file.deliverable && file.kind === "artifact").map(
4640
+ (file) => prefix && file.relativePath.startsWith(prefix) ? file.relativePath.slice(prefix.length) : file.relativePath
4641
+ );
4642
+ if (others.length > 0) {
4643
+ const shown = others.length > 6 ? [...others.slice(0, 5), `and ${others.length - 5} more`] : others;
4644
+ lines.push(`${result ? "Also made" : "Made"}: ${shown.join(", ")}`);
4645
+ }
4646
+ const inFolder = output.files.some((file) => file.kind === "artifact");
4647
+ if (inFolder && output.folder && output.folderReadable) lines.push(`Folder: ${output.folder}`);
4648
+ const hint = inFolder && !opts.copied ? `${output.folderReadable ? "Copy them next to you" : "They are kept by the Gezel service; copy them here"} with \`gezel task wait ${ref} --out <folder>\`.` : null;
4649
+ return { lines, hint };
4650
+ }
4651
+ function sameFile(a, b) {
4652
+ return a.toLowerCase() === b.toLowerCase();
4653
+ }
4654
+ function hostFolder(path, nameInFolder) {
4655
+ if (!path) return null;
4656
+ let end = path.length;
4657
+ for (let depth = nameInFolder.split("/").length; depth > 0; depth -= 1) {
4658
+ end = Math.max(path.lastIndexOf("/", end - 1), path.lastIndexOf("\\", end - 1));
4659
+ if (end <= 0) return null;
4660
+ }
4661
+ return path.slice(0, end);
4662
+ }
4663
+ async function readableHere(path) {
4664
+ return access(path, constants.R_OK).then(
4665
+ () => true,
4666
+ () => false
4667
+ );
4668
+ }
4031
4669
 
4032
4670
  // src/unknown-command.ts
4033
4671
  function unknownCommandMessage(operands, known) {
@@ -4189,7 +4827,7 @@ Install Node.js ${MINIMUM_NODE_MAJOR} or later from https://nodejs.org, then run
4189
4827
 
4190
4828
  // src/bin/gezel.ts
4191
4829
  var program = new Command();
4192
- program.name("gezel").description("Gezel \u2014 assemble a team of AI companions (gezels) and put them to work.").addHelpText(
4830
+ program.name("gezel").description("Gezel \u2014 put AI to work on your files and projects, from your own computer.").addHelpText(
4193
4831
  "after",
4194
4832
  "\nAny craftbook also runs by name: `gezel <craftbook> \u2026` is `gezel do <craftbook> \u2026`."
4195
4833
  ).version(GEZEL_VERSION).option(
@@ -4706,7 +5344,7 @@ program.command("mode [mode]").description("Show or set AI activity (read-only,
4706
5344
  const current = cliEngagementModeOption(updated.aiEngagementMode);
4707
5345
  console.log(`AI mode \u2192 ${current.name} \u2014 ${current.description}`);
4708
5346
  });
4709
- 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(
5347
+ program.command("run [prompt...]").description("Send a prompt to Gezel and print the reply (use - to read stdin)").option("-g, --gezel <ref>", "crew member id or name (default: this project's crew lead)").addHelpText(
4710
5348
  "after",
4711
5349
  `
4712
5350
  Examples:
@@ -4812,10 +5450,17 @@ program.command("do <craftbook...>").description(
4812
5450
  `
4813
5451
  Bare values fill the craftbook's required parameters in order; key=value sets any
4814
5452
  parameter; every other word is your request, which becomes the task description.
4815
- \`gezel craftbook list\` shows the craftbooks you can start here.
5453
+ \`gezel craftbook list\` shows the craftbooks you can start here, and
5454
+ \`gezel craftbook show <craftbook>\` what one takes and where it saves.
5455
+
5456
+ A folder Gezel was pointed at starts read-only. A craftbook that saves into the
5457
+ folder asks first at a terminal; in a script, add --allow-edits.
5458
+
5459
+ When a task completes, --wait prints where its result is; --out <dir> also
5460
+ copies everything it made into that folder.
4816
5461
 
4817
5462
  Examples:
4818
- gezel do summarize-long "Summarize notes.txt for the board"
5463
+ gezel do summarize-long "Summarize notes.txt for the board" --out ./board-summary
4819
5464
  gezel do ship feature/login --wait
4820
5465
  gezel do powerpoint-deck "A deck about Delft" audience=investors`
4821
5466
  ).option(
@@ -4824,6 +5469,9 @@ Examples:
4824
5469
  (value, values) => [...values, value],
4825
5470
  []
4826
5471
  ).option("--wait", "wait for completion; exit nonzero when blocked, canceled, or timed out").option("--timeout <seconds>", "wait budget in seconds; timeout leaves the task running", "7200").option("--out <dir>", "wait, then copy what the task made into this folder").option("--json", "emit one JSON result on stdout").option(
5472
+ "--allow-edits",
5473
+ "let Gezel change files in this project's folder, when the craftbook saves into it"
5474
+ ).option(
4827
5475
  "--strict-sandbox",
4828
5476
  "require OS network isolation for custom scripts (CLI launches otherwise trust this recipe snapshot)"
4829
5477
  ).addOption(new Option(SHORTHAND_FLAG).hideHelp()).action(
@@ -4904,23 +5552,24 @@ Examples:
4904
5552
  return;
4905
5553
  }
4906
5554
  await setUp();
5555
+ await ensureProjectEdits(client, {
5556
+ projectId,
5557
+ craftbook: craftbook2,
5558
+ allow: opts.allowEdits === true,
5559
+ prompter: terminalPrompter(),
5560
+ write: stderrProgress()
5561
+ });
4907
5562
  const created = await client.createTask(projectId, {
4908
5563
  ...craftbookStartRequest(book),
4909
5564
  ...craftbookDoLaunch(craftbook2, parsed),
4910
5565
  trustScripts: !opts.strictSandbox,
4911
5566
  roleBasedNameOnlyMode: true
5567
+ }).catch((err) => {
5568
+ throw taskInputFailure(err, book, parsed.params) ?? err;
4912
5569
  });
4913
5570
  if (opts.wait || opts.out) {
4914
5571
  console.error(`started ${created.ref} \u2014 ${created.title}`);
4915
- const waited = await printTaskWait(client, created.ref, { ...opts, timeoutMs });
4916
- if (opts.out && waited.outcome === "complete") {
4917
- const dir = waited.task.artifactDir;
4918
- if (!dir) throw new CliError(`${created.ref} finished without a task folder to copy.`);
4919
- const copied = await copyTaskOutput(client, projectId, dir, opts.out);
4920
- console.error(
4921
- `copied ${copied.length} file${copied.length === 1 ? "" : "s"} to ${opts.out}`
4922
- );
4923
- }
5572
+ await printTaskWait(client, created.ref, { ...opts, timeoutMs });
4924
5573
  } else
4925
5574
  console.log(
4926
5575
  opts.json ? JSON.stringify(created) : `started ${created.ref} \u2014 ${created.title}`
@@ -4953,16 +5602,54 @@ function printWorkflowResult(result, json) {
4953
5602
  async function printTaskWait(client, ref, opts) {
4954
5603
  const result = await waitForTask(client, ref, {
4955
5604
  timeoutMs: opts.timeoutMs,
4956
- onProgress: (task2) => console.error(
4957
- `${task2.ref}: ${task2.status}${task2.activeStepId ? ` (${task2.activeStepId})` : ""}`
4958
- )
5605
+ onProgress: (task2) => {
5606
+ if (task2.status === "complete" || task2.status === "canceled") return;
5607
+ console.error(
5608
+ `${task2.ref}: ${task2.status}${task2.activeStepId ? ` (${task2.activeStepId})` : ""}`
5609
+ );
5610
+ }
4959
5611
  });
4960
- const reason = await blockedTaskReason(client, result);
4961
- console.log(
4962
- opts.json ? JSON.stringify({ ...result, ...reason ? { reason } : {} }) : `${result.task.ref}: ${result.outcome}`
4963
- );
5612
+ const { reason, hint } = await blockedTaskDetails(client, result);
5613
+ let copied;
5614
+ let output;
5615
+ if (result.outcome === "complete") {
5616
+ if (opts.out) {
5617
+ const dir = result.task.artifactDir;
5618
+ if (!dir) throw new CliError(`${result.task.ref} finished without a task folder to copy.`);
5619
+ const files = await copyTaskOutput(client, result.task.projectId, dir, opts.out);
5620
+ copied = { folder: resolvePath(opts.out), files };
5621
+ if (!opts.json)
5622
+ console.error(
5623
+ `copied ${files.length} file${files.length === 1 ? "" : "s"} to ${copied.folder}`
5624
+ );
5625
+ }
5626
+ output = await describeTaskOutput(client, result.task).catch(() => void 0);
5627
+ }
5628
+ if (opts.json) {
5629
+ console.log(
5630
+ JSON.stringify({
5631
+ ...result,
5632
+ ...reason ? { reason } : {},
5633
+ ...hint ? { hint } : {},
5634
+ ...output ? { output } : {},
5635
+ ...copied ? { copied } : {}
5636
+ })
5637
+ );
5638
+ } else {
5639
+ console.log(`${result.task.ref}: ${result.outcome}`);
5640
+ if (output) {
5641
+ const shown = formatTaskOutput(
5642
+ copied ? withCopiedOutput(output, copied.folder) : output,
5643
+ result.task.ref,
5644
+ { copied: copied !== void 0 }
5645
+ );
5646
+ for (const line of shown.lines) console.log(line);
5647
+ if (shown.hint) console.error(shown.hint);
5648
+ }
5649
+ }
4964
5650
  if (!opts.json && result.outcome === "blocked") {
4965
5651
  if (reason) console.error(reason);
5652
+ if (hint) console.error(hint);
4966
5653
  console.error(`See its notes with \`gezel task notes ${result.task.ref}\`.`);
4967
5654
  }
4968
5655
  process.exitCode = result.exitCode;
@@ -5005,13 +5692,33 @@ craftbook.command("list [words...]").description(
5005
5692
  }
5006
5693
  const width = Math.min(32, Math.max(...books.map((book) => book.command.length)) + 2);
5007
5694
  for (const book of books) console.log(`${book.command.padEnd(width)}${book.name}`);
5008
- console.error(`
5009
- Start one with \`gezel do <command> "<your request>"\`.`);
5695
+ console.error(
5696
+ `
5697
+ Start one with \`gezel do <command> "<your request>"\`. \`gezel craftbook show <command>\` says what it takes first.`
5698
+ );
5699
+ });
5700
+ craftbook.command("show <command...>").description("Show what a craftbook does, what it takes, and the command that starts it").option("--json", "emit the craftbook as JSON").option("--no-start", "Use a running service only; never start one").action(async (words, opts) => {
5701
+ const client = await connectForInspection(opts);
5702
+ const preview = await previewRunProject(client, cliGlobals());
5703
+ const projectId = preview.projectId ?? "default";
5704
+ const [config, result] = await Promise.all([
5705
+ client.getConfig(),
5706
+ client.listProjectCraftbooks(projectId)
5707
+ ]);
5708
+ const books = normalizeCraftbooks(result.items, config.showWorkInProgressFeatures === true);
5709
+ const { book, args } = resolveCraftbookInvocation(books, words);
5710
+ if (args.length > 0) throw new CliError(`craftbook not found: ${words.join(" ")}`);
5711
+ const { craftbook: full } = await client.getCraftbook(book.id, {
5712
+ projectId,
5713
+ source: book.source,
5714
+ version: book.version
5715
+ });
5716
+ console.log(opts.json ? JSON.stringify(full) : describeCraftbook(book, full));
5010
5717
  });
5011
- var agent = program.command("agent").description("Manage your gezels (your AI companions)");
5718
+ var agent = program.command("agent").description("Manage your crew (your AI companions)");
5012
5719
  agent.command("output-limit <id> [tokens]").description(
5013
- "Show or set one gezel's output-token limit, including reasoning; auto clears its override"
5014
- ).option("--json", "Output the per-gezel override as JSON").action(async (id, tokens, opts) => {
5720
+ "Show or set one crew member's output-token limit, including reasoning; auto clears its override"
5721
+ ).option("--json", "Output the override as JSON").action(async (id, tokens, opts) => {
5015
5722
  if (tokens !== void 0 && tokens !== "auto" && (!/^\d+$/.test(tokens) || !Number.isSafeInteger(Number(tokens)) || Number(tokens) < 1)) {
5016
5723
  throw new CliError("Output limit must be a positive integer, or auto.");
5017
5724
  }
@@ -5031,22 +5738,22 @@ agent.command("output-limit <id> [tokens]").description(
5031
5738
  opts.json ? JSON.stringify(result) : `${id}: ${result.outputTokens === null ? "auto (inherits model/profile defaults)" : `${result.outputTokens} output tokens, including reasoning`}`
5032
5739
  );
5033
5740
  });
5034
- agent.command("list").description("List your gezels").action(async () => {
5741
+ agent.command("list").description("List your crew").action(async () => {
5035
5742
  const client = await connectOwned(cliGlobals());
5036
5743
  const res = await client.listGezels();
5037
5744
  for (const a of res.gezels) {
5038
5745
  console.log(`${a.id.padEnd(20)} ${a.name}`);
5039
5746
  }
5040
5747
  });
5041
- agent.command("create <name>").description("Create a new gezel").option("-d, --description <text>", "description").option("-m, --model <model>", "model identifier").action(async (name, opts) => {
5748
+ agent.command("create <name>").description("Add a crew member").option("-d, --description <text>", "description").option("-m, --model <model>", "model identifier").action(async (name, opts) => {
5042
5749
  const client = await connectOwned(cliGlobals());
5043
5750
  const created = await client.createGezel({ name, ...opts });
5044
- console.log(`created gezel ${created.id}`);
5751
+ console.log(`created crew member ${created.id}`);
5045
5752
  });
5046
- agent.command("show <id>").description("Show one gezel").action(async (id) => {
5753
+ agent.command("show <id>").description("Show one crew member").action(async (id) => {
5047
5754
  const client = await connectOwned(cliGlobals());
5048
5755
  const a = await client.getGezel(id).catch((err) => {
5049
- throw isNotFound(err) ? new CliError(`No gezel with id "${id}". Run \`gezel agent list\` to see your gezels.`) : err;
5756
+ throw isNotFound(err) ? new CliError(`No crew member with id "${id}". Run \`gezel agent list\` to see your crew.`) : err;
5050
5757
  });
5051
5758
  console.log(a.parsed.source);
5052
5759
  });
@@ -5157,8 +5864,8 @@ skills.command("convert <path>").description("Convert a SKILL.md file to a craft
5157
5864
  for (const note of result.notes) console.error(`note: ${note}`);
5158
5865
  if (result.persona) console.error(`persona: ${result.persona.role}`);
5159
5866
  });
5160
- var handboek = program.command("handboek").description("The built-in documentation (Handboek)");
5161
- handboek.command("export").description("Render the Handboek as a static HTML site for gezel.com (no daemon)").requiredOption("--out <dir>", "output directory").option(
5867
+ var handboek = program.command("handboek").description("The built-in documentation (Help)");
5868
+ handboek.command("export").description("Render Help as a static HTML site for gezel.com (no daemon)").requiredOption("--out <dir>", "output directory").option(
5162
5869
  "--css <href>",
5163
5870
  "extra stylesheet to link on every page; relative hrefs resolve against the export root. Repeatable.",
5164
5871
  (href, prior) => [...prior, href],
@@ -5197,7 +5904,7 @@ handboek.command("export").description("Render the Handboek as a static HTML sit
5197
5904
  appsOut: opts.appsOut,
5198
5905
  openInGezel: opts.openInGezel === true
5199
5906
  });
5200
- console.log(`Handboek exported: ${result.pages} pages \u2192 ${result.out}`);
5907
+ console.log(`Help exported: ${result.pages} pages \u2192 ${result.out}`);
5201
5908
  if (result.apps) {
5202
5909
  console.log(`Apps library: ${result.apps.apps} apps, ${result.apps.demos} with demos`);
5203
5910
  }
@@ -5475,7 +6182,7 @@ for (const verb of ["wait", "resume"]) {
5475
6182
  "--timeout <seconds>",
5476
6183
  "wait budget in seconds; timeout leaves the task running",
5477
6184
  "7200"
5478
- ).option("--json", "emit one JSON result on stdout").action(async (ref, opts) => {
6185
+ ).option("--out <dir>", "when it completes, copy what the task made into this folder").option("--json", "emit one JSON result on stdout").action(async (ref, opts) => {
5479
6186
  const timeoutMs = positiveSeconds(opts.timeout);
5480
6187
  const client = await connectOwned(cliGlobals());
5481
6188
  if (verb === "resume") {
@@ -5499,7 +6206,7 @@ task.command("list").description("List tasks across every project").option("-s,
5499
6206
  );
5500
6207
  }
5501
6208
  });
5502
- task.command("create <projectId> <title>").description("Create a task with a single phase").option("-a, --assignee <gezelId>", "gezel id to assign (default: user)").option("-p, --phase <name>", "first phase name", "Main").option("-d, --description <text>", "task description \u2014 what done looks like (min 40 chars)").action(
6209
+ task.command("create <projectId> <title>").description("Create a task with a single phase").option("-a, --assignee <gezelId>", "crew member id to assign (default: user)").option("-p, --phase <name>", "first phase name", "Main").option("-d, --description <text>", "task description \u2014 what done looks like (min 40 chars)").action(
5503
6210
  async (projectId, title, opts) => {
5504
6211
  const description = opts.description ?? `${title} \u2014 fill in the task description. Cover what done looks like, key constraints, and any links the assignee will need.`;
5505
6212
  const client = await connectOwned(cliGlobals());
@@ -5546,114 +6253,7 @@ ${warning.text}`)
5546
6253
  ].join("\n\n") || "(no task notes)"
5547
6254
  );
5548
6255
  });
5549
- program.command("create-image [prompt...]").description("Generate an image from a prompt (or --file) via the configured image engine").option("-f, --file <path>", "read the prompt from a text file instead of the argument").option("-m, --model <id>", "image model catalog id (default: the engine default)").option("-n, --negative <text>", "negative prompt").option("-W, --width <px>", "width in pixels").option("-H, --height <px>", "height in pixels").option("-a, --aspect <ratio>", `aspect ratio: ${IMAGE_ASPECT_RATIOS.join(", ")}`).option("-q, --quality <tier>", `size tier: ${IMAGE_QUALITIES.join(", ")} (default: standard)`).option("-s, --steps <n>", "sampler steps (default: the model recommendation)").option("--seed <n>", "seed for reproducible output").option("-p, --project <id>", "project to write the artifact under", "default").option("-o, --output <path>", "write the image here (default: ./<artifact name>)").action(
5550
- async (promptParts, opts) => {
5551
- const aspect = enumOpt("aspect", opts.aspect, ImageAspectRatioSchema);
5552
- const quality = enumOpt("quality", opts.quality, ImageQualitySchema);
5553
- const prompt = await resolvePromptText(promptParts, opts.file, "prompt");
5554
- const client = await connectOwned(cliGlobals());
5555
- const projectId = opts.project ?? "default";
5556
- const width = intOpt("width", opts.width);
5557
- const height = intOpt("height", opts.height);
5558
- const steps = intOpt("steps", opts.steps);
5559
- const seed = intOpt("seed", opts.seed);
5560
- console.error(`generating image${opts.model ? ` (model ${opts.model})` : ""}...`);
5561
- let res;
5562
- try {
5563
- res = await client.generateImage({
5564
- prompt,
5565
- projectId,
5566
- ...opts.model ? { model: opts.model } : {},
5567
- ...opts.negative ? { negativePrompt: opts.negative } : {},
5568
- ...width !== void 0 ? { width } : {},
5569
- ...height !== void 0 ? { height } : {},
5570
- ...aspect ? { aspectRatio: aspect } : {},
5571
- ...quality ? { quality } : {},
5572
- ...steps !== void 0 ? { steps } : {},
5573
- ...seed !== void 0 ? { seed } : {}
5574
- });
5575
- } catch (err) {
5576
- throw new CliError(
5577
- `image generation failed: ${err instanceof Error ? err.message : String(err)}`
5578
- );
5579
- }
5580
- const dest = await saveArtifact(client, projectId, res.artifactPath, opts.output);
5581
- const m = res.meta;
5582
- console.log(dest);
5583
- console.error(
5584
- ` model=${m.model} seed=${m.seed} steps=${m.steps} size=${m.widthPx}x${m.heightPx} time=${(m.durationMs / 1e3).toFixed(1)}s`
5585
- );
5586
- }
5587
- );
5588
- program.command("create-video [prompt...]").description("Generate a video from a prompt (or --file) via the configured video engine").option("-f, --file <path>", "read the prompt from a text file instead of the argument").option("-m, --model <id>", "video model catalog id (default: the engine default)").option("-n, --negative <text>", "negative prompt").option("-W, --width <px>", "width in pixels").option("-H, --height <px>", "height in pixels").option("--frames <n>", "number of frames").option("--fps <n>", "frames per second").option("-s, --steps <n>", "sampler steps").option("--seed <n>", "seed for reproducible output").option("-p, --project <id>", "project to write the artifact under", "default").option("-o, --output <path>", "write the video here (default: ./<artifact name>)").action(
5589
- async (promptParts, opts) => {
5590
- const prompt = await resolvePromptText(promptParts, opts.file, "prompt");
5591
- const client = await connectOwned(cliGlobals());
5592
- const projectId = opts.project ?? "default";
5593
- const width = intOpt("width", opts.width);
5594
- const height = intOpt("height", opts.height);
5595
- const numFrames = intOpt("frames", opts.frames);
5596
- const fps = intOpt("fps", opts.fps);
5597
- const steps = intOpt("steps", opts.steps);
5598
- const seed = intOpt("seed", opts.seed);
5599
- console.error(
5600
- `generating video${opts.model ? ` (model ${opts.model})` : ""} \u2014 this can take a while...`
5601
- );
5602
- let res;
5603
- try {
5604
- res = await client.generateVideo({
5605
- prompt,
5606
- projectId,
5607
- ...opts.model ? { model: opts.model } : {},
5608
- ...opts.negative ? { negativePrompt: opts.negative } : {},
5609
- ...width !== void 0 ? { width } : {},
5610
- ...height !== void 0 ? { height } : {},
5611
- ...numFrames !== void 0 ? { numFrames } : {},
5612
- ...fps !== void 0 ? { fps } : {},
5613
- ...steps !== void 0 ? { steps } : {},
5614
- ...seed !== void 0 ? { seed } : {}
5615
- });
5616
- } catch (err) {
5617
- throw new CliError(
5618
- `video generation failed: ${err instanceof Error ? err.message : String(err)}`
5619
- );
5620
- }
5621
- const dest = await saveArtifact(client, projectId, res.artifactPath, opts.output);
5622
- const m = res.meta;
5623
- console.log(dest);
5624
- console.error(
5625
- ` model=${m.model} seed=${m.seed} ${m.widthPx}x${m.heightPx} frames=${m.numFrames} fps=${m.fps} time=${(m.durationMs / 1e3).toFixed(1)}s`
5626
- );
5627
- }
5628
- );
5629
- program.command("create-audio [text...]").description("Synthesize speech from text (or --file) via the configured TTS engine").option("-f, --file <path>", "read the text from a file instead of the argument").option("-m, --model <id>", "TTS model catalog id (default: the engine default)").option("--voice <id>", "voice id (default: the model/gezel default)").option("--speed <x>", "speed multiplier, 0.25-4 (default: 1.0)").option("-p, --project <id>", "project to write the artifact under", "default").option("-o, --output <path>", "write the audio here (default: ./<artifact name>)").action(async (textParts, opts) => {
5630
- const text = await resolvePromptText(textParts, opts.file, "text");
5631
- const client = await connectOwned(cliGlobals());
5632
- const projectId = opts.project ?? "default";
5633
- const speed = floatOpt("speed", opts.speed);
5634
- console.error("synthesizing speech...");
5635
- let res;
5636
- try {
5637
- res = await client.synthesizeSpeech({
5638
- text,
5639
- projectId,
5640
- ...opts.model ? { model: opts.model } : {},
5641
- ...opts.voice ? { voice: opts.voice } : {},
5642
- ...speed !== void 0 ? { speed } : {}
5643
- });
5644
- } catch (err) {
5645
- throw new CliError(
5646
- `speech synthesis failed: ${err instanceof Error ? err.message : String(err)}`
5647
- );
5648
- }
5649
- if (!res.artifactPath) throw new CliError("speech synthesis returned no saved audio");
5650
- const dest = await saveArtifact(client, projectId, res.artifactPath, opts.output);
5651
- const m = res.meta;
5652
- console.log(dest);
5653
- console.error(
5654
- ` voice=${m.voice} model=${m.model} ${m.durationSeconds.toFixed(1)}s @ ${m.sampleRate}Hz`
5655
- );
5656
- });
6256
+ registerGenerateCommands(program, () => connectOwned(cliGlobals()));
5657
6257
  var native = program.command("native").description("Manage native engine binaries");
5658
6258
  native.command("install").description(
5659
6259
  "Download, verify, and activate the native inference toolkit (or one engine with --engine)"
@@ -5853,6 +6453,7 @@ model.command("pull <id>").description(
5853
6453
  const client = await connectOwned(cliGlobals());
5854
6454
  const provider = resolveModelProvider(opts.provider);
5855
6455
  const progress = stderrProgress();
6456
+ await ensureModelEngines(client, [provider], progress);
5856
6457
  await pullChatModel(client, provider, id, progress);
5857
6458
  if (provider === "mlx") await waitForMlxRuntime(client, progress);
5858
6459
  if (await pinPulledModel(client, provider, id) === "pinned") {
@@ -6022,7 +6623,7 @@ program.command("cleanup").description("Show or reclaim the space Gezel is using
6022
6623
  console.log(formatCleanupResult(job));
6023
6624
  if (job.status === "error") process.exitCode = 1;
6024
6625
  });
6025
- program.command("backup <file>").description("Write your gezels, projects, and documents to a backup file").option("--no-workspaces", "Leave project working files out of the backup").option("--dry-run", "Show what would be included without writing the file").action(async (file, opts) => {
6626
+ program.command("backup <file>").description("Write your crew, projects, and documents to a backup file").option("--no-workspaces", "Leave project working files out of the backup").option("--dry-run", "Show what would be included without writing the file").action(async (file, opts) => {
6026
6627
  const client = await connectOwned(cliGlobals());
6027
6628
  const outPath = resolvePath(file);
6028
6629
  const excludeWorkspaces = opts.workspaces === false;
@@ -6041,12 +6642,12 @@ program.command("backup <file>").description("Write your gezels, projects, and d
6041
6642
  console.log(`
6042
6643
  Wrote ${outPath}`);
6043
6644
  });
6044
- program.command("restore <file>").description("Restore gezels, projects, and documents from a backup file").option("--list", "Show what the backup holds without restoring anything").option(
6645
+ program.command("restore <file>").description("Restore your crew, projects, and documents from a backup file").option("--list", "Show what the backup holds without restoring anything").option(
6045
6646
  "--only <item...>",
6046
6647
  "Restore just these items, by id (repeatable, e.g. --only tamsin roof-survey)"
6047
6648
  ).option("--replace", "Overwrite items that already exist here").option(
6048
6649
  "--settings",
6049
- "Also restore which gezels hold roles such as the meester (never providers, folders or security)"
6650
+ "Also restore which crew members hold roles such as the Meester (never providers, folders or security)"
6050
6651
  ).action(
6051
6652
  async (file, opts) => {
6052
6653
  const client = await connectOwned(cliGlobals());