@bendyline/gezel-cli 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/app-author-command.js +464 -0
- package/dist/app-command.js +685 -0
- package/dist/bin/gezel-main.js +423 -25
- package/dist/handboek-export.js +713 -30
- package/dist/knowledge-command.js +351 -0
- package/dist/tui/index.js +372 -51
- package/package.json +10 -9
package/dist/tui/index.js
CHANGED
|
@@ -198,6 +198,236 @@ function useBufferedState(initial, intervalMs) {
|
|
|
198
198
|
return [rendered, setImmediate, setBuffered];
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
// src/tui/managed-apps.ts
|
|
202
|
+
var MANAGED_APP_TARGETS = [
|
|
203
|
+
{
|
|
204
|
+
id: "vscode",
|
|
205
|
+
label: "VS Code",
|
|
206
|
+
aliases: ["vscode", "code", "vs-code"],
|
|
207
|
+
description: "add Gezel to VS Code\u2019s built-in model picker"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
id: "pi",
|
|
211
|
+
label: "pi",
|
|
212
|
+
aliases: ["pi"],
|
|
213
|
+
description: "add Gezel models and the managed pi extension"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: "opencode",
|
|
217
|
+
label: "OpenCode",
|
|
218
|
+
aliases: ["opencode", "open-code"],
|
|
219
|
+
description: "add Gezel settings and the managed OpenCode plugin"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
id: "codex",
|
|
223
|
+
label: "Codex",
|
|
224
|
+
aliases: ["codex"],
|
|
225
|
+
description: "add a managed Gezel profile to Codex"
|
|
226
|
+
}
|
|
227
|
+
];
|
|
228
|
+
var ManagedAppCommandError = class extends Error {
|
|
229
|
+
constructor(message) {
|
|
230
|
+
super(message);
|
|
231
|
+
this.name = "ManagedAppCommandError";
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
function resolveManagedApp(value) {
|
|
235
|
+
const normalized = value.trim().toLowerCase();
|
|
236
|
+
return MANAGED_APP_TARGETS.find((target) => target.aliases.includes(normalized))?.id ?? null;
|
|
237
|
+
}
|
|
238
|
+
function managedAppUsage(command) {
|
|
239
|
+
return `usage: /${command} ${MANAGED_APP_TARGETS.map((target) => target.id).join("|")}`;
|
|
240
|
+
}
|
|
241
|
+
async function connectManagedApp(client, app) {
|
|
242
|
+
switch (app) {
|
|
243
|
+
case "vscode":
|
|
244
|
+
return connectVSCode(client);
|
|
245
|
+
case "pi":
|
|
246
|
+
return connectPi(client);
|
|
247
|
+
case "opencode":
|
|
248
|
+
return connectOpenCode(client);
|
|
249
|
+
case "codex":
|
|
250
|
+
return connectCodex(client);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
async function disconnectManagedApp(client, app) {
|
|
254
|
+
switch (app) {
|
|
255
|
+
case "vscode": {
|
|
256
|
+
const status = await client.getVSCodeSetupStatus();
|
|
257
|
+
if (!status.canRemove) return { app, message: "VS Code is not connected to Gezel." };
|
|
258
|
+
await client.removeVSCodeSetup();
|
|
259
|
+
return { app, message: "disconnected VS Code; other providers and conversations were kept." };
|
|
260
|
+
}
|
|
261
|
+
case "pi": {
|
|
262
|
+
const status = await client.getPiSetupStatus();
|
|
263
|
+
if (!status.canRemove && !status.extension.canRemove) {
|
|
264
|
+
return { app, message: "pi is not connected to Gezel." };
|
|
265
|
+
}
|
|
266
|
+
await client.removePiSetup();
|
|
267
|
+
return {
|
|
268
|
+
app,
|
|
269
|
+
message: "disconnected pi; its Gezel roster, credential, and managed extension were removed."
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
case "opencode": {
|
|
273
|
+
const status = await client.getOpenCodeSetupStatus();
|
|
274
|
+
if (!status.canRemove && !status.plugin.canRemove) {
|
|
275
|
+
return { app, message: "OpenCode is not connected to Gezel." };
|
|
276
|
+
}
|
|
277
|
+
await client.removeOpenCodeSetup();
|
|
278
|
+
return {
|
|
279
|
+
app,
|
|
280
|
+
message: "disconnected OpenCode; Gezel\u2019s settings, credential, and managed plugin were removed."
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
case "codex": {
|
|
284
|
+
const status = await client.getCodexSetupStatus();
|
|
285
|
+
if (!status.canRemove) return { app, message: "Codex is not connected to Gezel." };
|
|
286
|
+
await client.removeCodexSetup();
|
|
287
|
+
return {
|
|
288
|
+
app,
|
|
289
|
+
message: "disconnected Codex; other profiles, settings, and conversations were kept."
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
async function listConnectedManagedApps(client) {
|
|
295
|
+
const [vscode, pi, opencode, codex] = await Promise.all([
|
|
296
|
+
client.getVSCodeSetupStatus(),
|
|
297
|
+
client.getPiSetupStatus(),
|
|
298
|
+
client.getOpenCodeSetupStatus(),
|
|
299
|
+
client.getCodexSetupStatus()
|
|
300
|
+
]);
|
|
301
|
+
return [
|
|
302
|
+
...vscode.canRemove ? ["vscode"] : [],
|
|
303
|
+
...pi.canRemove || pi.extension.canRemove ? ["pi"] : [],
|
|
304
|
+
...opencode.canRemove || opencode.plugin.canRemove ? ["opencode"] : [],
|
|
305
|
+
...codex.canRemove ? ["codex"] : []
|
|
306
|
+
];
|
|
307
|
+
}
|
|
308
|
+
async function connectVSCode(client) {
|
|
309
|
+
let status = await client.getVSCodeSetupStatus();
|
|
310
|
+
const enabled = await enableConnectedAppsIfNeeded(client, status.endpointsEnabled);
|
|
311
|
+
if (enabled) status = await client.getVSCodeSetupStatus();
|
|
312
|
+
if (status.state !== "configured") {
|
|
313
|
+
assertSafeToConfigure(status, "VS Code");
|
|
314
|
+
const profile2 = status.profiles.find((candidate) => candidate.id === status.configuredProfileId) ?? status.profiles[0];
|
|
315
|
+
if (!profile2) throw new ManagedAppCommandError("VS Code has no profile Gezel can configure.");
|
|
316
|
+
status = await client.configureVSCode({ profileId: profile2.id });
|
|
317
|
+
}
|
|
318
|
+
const profile = status.profiles.find((candidate) => candidate.id === status.configuredProfileId) ?? status.profiles[0];
|
|
319
|
+
return {
|
|
320
|
+
app: "vscode",
|
|
321
|
+
message: [
|
|
322
|
+
`connected VS Code${profile ? ` (${profile.label})` : ""} to Gezel at ${status.bridge.baseUrl}.`,
|
|
323
|
+
enabled ? "Connected Apps serving was enabled." : "",
|
|
324
|
+
"If VS Code is open, run \u201CDeveloper: Reload Window\u201D once to load the provider."
|
|
325
|
+
].filter(Boolean).join(" ")
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
async function connectPi(client) {
|
|
329
|
+
let status = await client.getPiSetupStatus();
|
|
330
|
+
const enabled = await enableConnectedAppsIfNeeded(client, status.endpointsEnabled);
|
|
331
|
+
if (enabled) status = await client.getPiSetupStatus();
|
|
332
|
+
if (status.state !== "configured") {
|
|
333
|
+
assertSafeToConfigure(status, "pi");
|
|
334
|
+
const model = preferredModel(status);
|
|
335
|
+
status = await client.configurePi({ model: model.id });
|
|
336
|
+
}
|
|
337
|
+
let extensionNote = "";
|
|
338
|
+
if (status.extension.canInstall && !status.extension.canReplace) {
|
|
339
|
+
status = await client.installPiExtension();
|
|
340
|
+
extensionNote = "The managed pi extension was installed.";
|
|
341
|
+
} else if (status.extension.canReplace) {
|
|
342
|
+
extensionNote = "A conflicting pi extension was preserved; use the desktop Settings flow to review it.";
|
|
343
|
+
} else if (status.extension.state === "unsupported") {
|
|
344
|
+
extensionNote = "pi was not found, so use the launch command after installing it.";
|
|
345
|
+
}
|
|
346
|
+
return {
|
|
347
|
+
app: "pi",
|
|
348
|
+
message: integrationSuccessMessage("pi", status, enabled, extensionNote)
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
async function connectOpenCode(client) {
|
|
352
|
+
let status = await client.getOpenCodeSetupStatus();
|
|
353
|
+
const enabled = await enableConnectedAppsIfNeeded(client, status.endpointsEnabled);
|
|
354
|
+
if (enabled) status = await client.getOpenCodeSetupStatus();
|
|
355
|
+
if (status.state !== "configured") {
|
|
356
|
+
assertSafeToConfigure(status, "OpenCode");
|
|
357
|
+
const model = preferredModel(status);
|
|
358
|
+
status = await client.configureOpenCode({ model: model.id });
|
|
359
|
+
}
|
|
360
|
+
let pluginNote = "";
|
|
361
|
+
if (status.plugin.canInstall && !status.plugin.canReplace) {
|
|
362
|
+
status = await client.installOpenCodePlugin();
|
|
363
|
+
pluginNote = "The managed OpenCode plugin was installed.";
|
|
364
|
+
} else if (status.plugin.canReplace) {
|
|
365
|
+
pluginNote = "A conflicting OpenCode plugin was preserved; use the desktop Settings flow to review it.";
|
|
366
|
+
} else if (status.plugin.state === "unsupported") {
|
|
367
|
+
pluginNote = "OpenCode was not found, so use the launch command after installing it.";
|
|
368
|
+
}
|
|
369
|
+
return {
|
|
370
|
+
app: "opencode",
|
|
371
|
+
message: integrationSuccessMessage("OpenCode", status, enabled, pluginNote)
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
async function connectCodex(client) {
|
|
375
|
+
let status = await client.getCodexSetupStatus();
|
|
376
|
+
const enabled = await enableConnectedAppsIfNeeded(client, status.endpointsEnabled);
|
|
377
|
+
if (enabled) status = await client.getCodexSetupStatus();
|
|
378
|
+
if (status.state !== "configured") {
|
|
379
|
+
assertSafeToConfigure(status, "Codex");
|
|
380
|
+
const model = preferredModel(status);
|
|
381
|
+
status = await client.configureCodex({ model: model.id });
|
|
382
|
+
}
|
|
383
|
+
return {
|
|
384
|
+
app: "codex",
|
|
385
|
+
message: integrationSuccessMessage("Codex", status, enabled)
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
async function enableConnectedAppsIfNeeded(client, endpointsEnabled) {
|
|
389
|
+
if (endpointsEnabled) return false;
|
|
390
|
+
const config = await client.getConfig();
|
|
391
|
+
await client.updateConfig({
|
|
392
|
+
openaiEndpoints: {
|
|
393
|
+
...config.openaiEndpoints,
|
|
394
|
+
enabled: true
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
function preferredModel(status) {
|
|
400
|
+
const model = status.models.find((candidate) => candidate.id === status.configuredModel) ?? status.models.find((candidate) => candidate.id === status.recommendedModel) ?? status.models[0];
|
|
401
|
+
if (!model) {
|
|
402
|
+
throw new ManagedAppCommandError(
|
|
403
|
+
"No compatible local gezel or tool-capable model is available for this integration."
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
return model;
|
|
407
|
+
}
|
|
408
|
+
function assertSafeToConfigure(status, label) {
|
|
409
|
+
if (status.state === "conflict") {
|
|
410
|
+
throw new ManagedAppCommandError(
|
|
411
|
+
`${label} setup has a conflict${status.message ? `: ${status.message}` : "."} Nothing was overwritten; use Settings \u2192 Connected Apps to review and repair it.`
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
if (status.state === "unavailable" || !status.canConfigure) {
|
|
415
|
+
const reason = status.message ?? status.reasons[0];
|
|
416
|
+
throw new ManagedAppCommandError(
|
|
417
|
+
reason ? `${label} cannot be connected: ${reason}` : `${label} cannot be connected right now.`
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
function integrationSuccessMessage(label, status, enabled, extra = "") {
|
|
422
|
+
const selected = status.models.find((candidate) => candidate.id === status.configuredModel);
|
|
423
|
+
return [
|
|
424
|
+
`connected ${label} to Gezel at ${status.bridge.baseUrl}${selected ? `; default ${selected.label}` : ""}.`,
|
|
425
|
+
enabled ? "Connected Apps serving was enabled." : "",
|
|
426
|
+
extra,
|
|
427
|
+
`Start it with: ${status.launchCommand}`
|
|
428
|
+
].filter(Boolean).join(" ");
|
|
429
|
+
}
|
|
430
|
+
|
|
201
431
|
// src/tui/open-command.ts
|
|
202
432
|
var MAX_RECENT_REFERENCES = 12;
|
|
203
433
|
function rememberCliOpenReferences(current, observed, max = MAX_RECENT_REFERENCES) {
|
|
@@ -325,6 +555,8 @@ var SLASH_COMMANDS = [
|
|
|
325
555
|
{ name: "do", description: "do a task from a craftbook" },
|
|
326
556
|
{ name: "continue", description: "process due and active project tasks" },
|
|
327
557
|
{ name: "nightshift", description: "start, stop, or list night-shift work" },
|
|
558
|
+
{ name: "connect", description: "connect a local app to Gezel" },
|
|
559
|
+
{ name: "disconnect", description: "remove Gezel from a connected local app" },
|
|
328
560
|
{ name: "focus", description: "send into another active chat" },
|
|
329
561
|
{ name: "cli", description: "make bare input run shell commands" },
|
|
330
562
|
{ name: "chat", description: "make bare input message your gezel" },
|
|
@@ -381,6 +613,20 @@ function parseProjectPermissionName(input) {
|
|
|
381
613
|
return PROJECT_PERMISSIONS.find((permission) => permission.name === normalized)?.name;
|
|
382
614
|
}
|
|
383
615
|
function suggestSlashWordwheel(input, craftbooks, recentReferences = []) {
|
|
616
|
+
const appMatch = input.match(/^\/(connect|disconnect)\s+(.*)$/i);
|
|
617
|
+
if (appMatch) {
|
|
618
|
+
const command = (appMatch[1] ?? "").toLowerCase();
|
|
619
|
+
const query = (appMatch[2] ?? "").trim().toLowerCase();
|
|
620
|
+
return MANAGED_APP_TARGETS.filter(
|
|
621
|
+
(target) => target.id.startsWith(query) || target.aliases.some((alias) => alias.startsWith(query))
|
|
622
|
+
).map((target) => ({
|
|
623
|
+
key: `${command}:${target.id}`,
|
|
624
|
+
label: `/${command} ${target.id}`,
|
|
625
|
+
description: command === "connect" ? target.description : `remove Gezel\u2019s managed ${target.label} setup`,
|
|
626
|
+
submit: `/${command} ${target.id}`,
|
|
627
|
+
completion: `/${command} ${target.id}`
|
|
628
|
+
}));
|
|
629
|
+
}
|
|
384
630
|
const openMatch = input.match(/^\/open\s+(.*)$/i);
|
|
385
631
|
if (openMatch) {
|
|
386
632
|
const query = normalizeCliOpenLookup(openMatch[1] ?? "");
|
|
@@ -1260,16 +1506,16 @@ var TABLE_LOGO = [
|
|
|
1260
1506
|
" | /|____________|\\",
|
|
1261
1507
|
" o /_| |_\\"
|
|
1262
1508
|
].join("\n");
|
|
1263
|
-
var
|
|
1264
|
-
user: "white",
|
|
1265
|
-
pending: "yellow",
|
|
1266
|
-
assistant: "cyan",
|
|
1267
|
-
thinking: "
|
|
1268
|
-
write: "yellow",
|
|
1269
|
-
tool: "yellow",
|
|
1270
|
-
note: "magenta",
|
|
1271
|
-
error: "red",
|
|
1272
|
-
shell: void 0
|
|
1509
|
+
var CHAT_FEED_ROW_STYLES = {
|
|
1510
|
+
user: { color: "white", dimColor: false },
|
|
1511
|
+
pending: { color: "yellow", dimColor: true },
|
|
1512
|
+
assistant: { color: "cyan", dimColor: false },
|
|
1513
|
+
thinking: { color: "magentaBright", dimColor: false },
|
|
1514
|
+
write: { color: "yellow", dimColor: true },
|
|
1515
|
+
tool: { color: "yellow", dimColor: false },
|
|
1516
|
+
note: { color: "magenta", dimColor: false },
|
|
1517
|
+
error: { color: "red", dimColor: false },
|
|
1518
|
+
shell: { color: void 0, dimColor: false }
|
|
1273
1519
|
};
|
|
1274
1520
|
function ChatFeed(props) {
|
|
1275
1521
|
const { rows, gezels, boring, focusedSessionId, visible = 16 } = props;
|
|
@@ -1286,6 +1532,7 @@ function ChatFeed(props) {
|
|
|
1286
1532
|
/* @__PURE__ */ jsx(Text, { dimColor: true, children: "/help for commands" })
|
|
1287
1533
|
] })
|
|
1288
1534
|
] }) : shown.map((row) => {
|
|
1535
|
+
const rowStyle = CHAT_FEED_ROW_STYLES[row.kind];
|
|
1289
1536
|
if (row.kind === "shell" && row.sessionId.startsWith("term-")) {
|
|
1290
1537
|
return /* @__PURE__ */ jsx(Text, { wrap: "wrap", children: clip(row.text) }, row.key);
|
|
1291
1538
|
}
|
|
@@ -1294,20 +1541,13 @@ function ChatFeed(props) {
|
|
|
1294
1541
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "row", children: [
|
|
1295
1542
|
/* @__PURE__ */ jsx(Text, { dimColor: !isFocused, color: isFocused ? "green" : void 0, children: isFocused ? "\u258E" : " " }),
|
|
1296
1543
|
/* @__PURE__ */ jsxs(Text, { wrap: "wrap", children: [
|
|
1297
|
-
/* @__PURE__ */ jsxs(Text, { bold: true, color:
|
|
1544
|
+
/* @__PURE__ */ jsxs(Text, { bold: true, color: rowStyle.color, children: [
|
|
1298
1545
|
who,
|
|
1299
1546
|
": "
|
|
1300
1547
|
] }),
|
|
1301
|
-
/* @__PURE__ */ jsx(
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
color: KIND_COLOR[row.kind],
|
|
1305
|
-
dimColor: row.kind === "pending" || row.kind === "thinking" || row.kind === "write",
|
|
1306
|
-
children: clip(
|
|
1307
|
-
row.taskEvent ? taskEventText(row, gezels, boring) : row.kind === "assistant" ? humanizeToolMarkup(row.text) : row.text
|
|
1308
|
-
)
|
|
1309
|
-
}
|
|
1310
|
-
)
|
|
1548
|
+
/* @__PURE__ */ jsx(Text, { color: rowStyle.color, dimColor: rowStyle.dimColor, children: clip(
|
|
1549
|
+
row.taskEvent ? taskEventText(row, gezels, boring) : row.kind === "assistant" ? humanizeToolMarkup(row.text) : row.text
|
|
1550
|
+
) })
|
|
1311
1551
|
] })
|
|
1312
1552
|
] }, row.key);
|
|
1313
1553
|
}) });
|
|
@@ -1696,7 +1936,7 @@ function StandardQuestionPrompt(props) {
|
|
|
1696
1936
|
const visibleOptions = options.slice(windowStart, windowStart + QUESTION_OPTION_WINDOW_SIZE);
|
|
1697
1937
|
const submit = async (body) => {
|
|
1698
1938
|
if (submitting) return;
|
|
1699
|
-
if (!body.writeIn && (!body.selectedChoices || body.selectedChoices.length === 0)) {
|
|
1939
|
+
if (!body.writeIn && (!body.selectedChoices || body.selectedChoices.length === 0) && body.declined !== true && body.silentSkip !== true) {
|
|
1700
1940
|
setError("Choose an option or supply your own response.");
|
|
1701
1941
|
return;
|
|
1702
1942
|
}
|
|
@@ -1724,12 +1964,20 @@ function StandardQuestionPrompt(props) {
|
|
|
1724
1964
|
(input, key) => {
|
|
1725
1965
|
if (submitting) return;
|
|
1726
1966
|
if (writing) {
|
|
1727
|
-
if (key.escape
|
|
1728
|
-
|
|
1729
|
-
|
|
1967
|
+
if (key.escape) {
|
|
1968
|
+
if (choices.length > 0) {
|
|
1969
|
+
setWriting(false);
|
|
1970
|
+
setError(null);
|
|
1971
|
+
} else {
|
|
1972
|
+
void submit({ silentSkip: true });
|
|
1973
|
+
}
|
|
1730
1974
|
}
|
|
1731
1975
|
return;
|
|
1732
1976
|
}
|
|
1977
|
+
if (key.escape) {
|
|
1978
|
+
void submit({ silentSkip: true });
|
|
1979
|
+
return;
|
|
1980
|
+
}
|
|
1733
1981
|
if (key.upArrow) {
|
|
1734
1982
|
setOptionIndex((index) => index <= 0 ? Math.max(0, options.length - 1) : index - 1);
|
|
1735
1983
|
return;
|
|
@@ -1777,7 +2025,7 @@ function StandardQuestionPrompt(props) {
|
|
|
1777
2025
|
] }),
|
|
1778
2026
|
/* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
|
|
1779
2027
|
"Enter submit",
|
|
1780
|
-
choices.length > 0 ? " \xB7 Esc return to choices" : ""
|
|
2028
|
+
choices.length > 0 ? " \xB7 Esc return to choices" : " \xB7 Esc skip"
|
|
1781
2029
|
] })
|
|
1782
2030
|
] }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1783
2031
|
visibleOptions.map((option, visibleIndex) => {
|
|
@@ -1794,7 +2042,8 @@ function StandardQuestionPrompt(props) {
|
|
|
1794
2042
|
"\u2191/\u2193 choose \xB7 Enter ",
|
|
1795
2043
|
multiSelect ? "toggle/submit" : "answer",
|
|
1796
2044
|
multiSelect ? " \xB7 Space toggle" : "",
|
|
1797
|
-
options.length > QUESTION_OPTION_WINDOW_SIZE ? ` \xB7 ${activeOptionIndex + 1}/${options.length}` : ""
|
|
2045
|
+
options.length > QUESTION_OPTION_WINDOW_SIZE ? ` \xB7 ${activeOptionIndex + 1}/${options.length}` : "",
|
|
2046
|
+
" \xB7 Esc skip"
|
|
1798
2047
|
] })
|
|
1799
2048
|
] }),
|
|
1800
2049
|
submitting ? /* @__PURE__ */ jsx4(Text5, { color: "yellow", children: "Submitting\u2026" }) : null,
|
|
@@ -1817,10 +2066,18 @@ function NpmInstallApprovalPrompt(props) {
|
|
|
1817
2066
|
const [submitting, setSubmitting] = useState4(false);
|
|
1818
2067
|
const [error, setError] = useState4(null);
|
|
1819
2068
|
const currentPackage = packages[packageIndex];
|
|
1820
|
-
const
|
|
2069
|
+
const answer = async (body) => {
|
|
1821
2070
|
if (submitting) return;
|
|
1822
2071
|
setError(null);
|
|
1823
2072
|
setSubmitting(true);
|
|
2073
|
+
try {
|
|
2074
|
+
onAnswered(await client.answerQuestion(question.id, body));
|
|
2075
|
+
} catch (err) {
|
|
2076
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
2077
|
+
setSubmitting(false);
|
|
2078
|
+
}
|
|
2079
|
+
};
|
|
2080
|
+
const submit = (nextDecisions) => {
|
|
1824
2081
|
const body = packages.length === 0 ? { declined: true } : {
|
|
1825
2082
|
npmInstallDecisions: packages.map((entry, index) => ({
|
|
1826
2083
|
package: entry.package,
|
|
@@ -1828,18 +2085,17 @@ function NpmInstallApprovalPrompt(props) {
|
|
|
1828
2085
|
decision: nextDecisions[index] ?? "decline"
|
|
1829
2086
|
}))
|
|
1830
2087
|
};
|
|
1831
|
-
|
|
1832
|
-
onAnswered(await client.answerQuestion(question.id, body));
|
|
1833
|
-
} catch (err) {
|
|
1834
|
-
setError(err instanceof Error ? err.message : String(err));
|
|
1835
|
-
setSubmitting(false);
|
|
1836
|
-
}
|
|
2088
|
+
void answer(body);
|
|
1837
2089
|
};
|
|
1838
2090
|
useInput3(
|
|
1839
2091
|
(_input, key) => {
|
|
1840
2092
|
if (submitting) return;
|
|
2093
|
+
if (key.escape) {
|
|
2094
|
+
void answer({ silentSkip: true });
|
|
2095
|
+
return;
|
|
2096
|
+
}
|
|
1841
2097
|
if (!currentPackage) {
|
|
1842
|
-
if (key.return)
|
|
2098
|
+
if (key.return) submit([]);
|
|
1843
2099
|
return;
|
|
1844
2100
|
}
|
|
1845
2101
|
if (key.upArrow) {
|
|
@@ -1869,7 +2125,7 @@ function NpmInstallApprovalPrompt(props) {
|
|
|
1869
2125
|
nextDecisions[packageIndex] = decision;
|
|
1870
2126
|
setDecisions(nextDecisions);
|
|
1871
2127
|
if (packageIndex >= packages.length - 1) {
|
|
1872
|
-
|
|
2128
|
+
submit(nextDecisions);
|
|
1873
2129
|
return;
|
|
1874
2130
|
}
|
|
1875
2131
|
const nextPackageIndex = packageIndex + 1;
|
|
@@ -1912,12 +2168,13 @@ function NpmInstallApprovalPrompt(props) {
|
|
|
1912
2168
|
}),
|
|
1913
2169
|
/* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
|
|
1914
2170
|
"\u2191/\u2193 choose \xB7 Enter answer",
|
|
1915
|
-
packageIndex > 0 ? " \xB7 \u2190 previous package" : ""
|
|
2171
|
+
packageIndex > 0 ? " \xB7 \u2190 previous package" : "",
|
|
2172
|
+
" \xB7 Esc skip"
|
|
1916
2173
|
] })
|
|
1917
2174
|
] }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
1918
2175
|
/* @__PURE__ */ jsx4(Text5, { color: "red", children: "This approval has no package details." }),
|
|
1919
2176
|
/* @__PURE__ */ jsx4(Text5, { color: "cyan", children: "\u203A Decline and dismiss" }),
|
|
1920
|
-
/* @__PURE__ */ jsx4(Text5, { dimColor: true, children: "Enter dismiss" })
|
|
2177
|
+
/* @__PURE__ */ jsx4(Text5, { dimColor: true, children: "Enter dismiss \xB7 Esc skip" })
|
|
1921
2178
|
] }),
|
|
1922
2179
|
submitting ? /* @__PURE__ */ jsx4(Text5, { color: "yellow", children: "Submitting\u2026" }) : null,
|
|
1923
2180
|
error ? /* @__PURE__ */ jsx4(Text5, { color: "red", children: error }) : null
|
|
@@ -1932,7 +2189,10 @@ function toggleSet(current, value) {
|
|
|
1932
2189
|
|
|
1933
2190
|
// src/tui/craftbook-start.ts
|
|
1934
2191
|
import {
|
|
2192
|
+
CRAFTBOOK_CATEGORY_FAMILY_META,
|
|
2193
|
+
CRAFTBOOK_CATEGORY_META,
|
|
1935
2194
|
CRAFTBOOK_ROLE_META,
|
|
2195
|
+
resolveCraftbookCategory,
|
|
1936
2196
|
visibleCatalogItems
|
|
1937
2197
|
} from "@bendyline/gezel";
|
|
1938
2198
|
function normalizeCraftbooks(items, showWorkInProgressFeatures = false) {
|
|
@@ -1950,7 +2210,8 @@ function normalizeCraftbooks(items, showWorkInProgressFeatures = false) {
|
|
|
1950
2210
|
source: item.sourceId === "project" ? "project" : item.sourceId === "local" ? "local" : "bundled",
|
|
1951
2211
|
stepCount: manifest.steps.length,
|
|
1952
2212
|
tags: manifest.tags ?? [],
|
|
1953
|
-
role: manifest.role ?? "general"
|
|
2213
|
+
role: manifest.role ?? "general",
|
|
2214
|
+
category: resolveCraftbookCategory(manifest)
|
|
1954
2215
|
});
|
|
1955
2216
|
}
|
|
1956
2217
|
return [...byId.values()].sort((left, right) => left.name.localeCompare(right.name));
|
|
@@ -1978,15 +2239,34 @@ function craftbookCategories(books, suggestedIds, projectType) {
|
|
|
1978
2239
|
bookIds: projectBooks
|
|
1979
2240
|
});
|
|
1980
2241
|
}
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
2242
|
+
const starterMeta = CRAFTBOOK_ROLE_META.find((role) => role.id === "project-starter");
|
|
2243
|
+
if (starterMeta) {
|
|
2244
|
+
const bookIds = new Set(
|
|
2245
|
+
books.filter((book) => book.role === "project-starter").map((book) => book.id)
|
|
2246
|
+
);
|
|
2247
|
+
if (bookIds.size > 0) {
|
|
2248
|
+
categories.push({
|
|
2249
|
+
id: `role:${starterMeta.id}`,
|
|
2250
|
+
label: starterMeta.label,
|
|
2251
|
+
hint: countLabel(bookIds.size),
|
|
2252
|
+
bookIds
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
for (const family of CRAFTBOOK_CATEGORY_FAMILY_META) {
|
|
2257
|
+
for (const meta of CRAFTBOOK_CATEGORY_META) {
|
|
2258
|
+
if (meta.family !== family.id) continue;
|
|
2259
|
+
const bookIds = new Set(
|
|
2260
|
+
books.filter((book) => book.category === meta.id).map((book) => book.id)
|
|
2261
|
+
);
|
|
2262
|
+
if (bookIds.size === 0) continue;
|
|
2263
|
+
categories.push({
|
|
2264
|
+
id: `category:${meta.id}`,
|
|
2265
|
+
label: meta.label,
|
|
2266
|
+
hint: family.id === "universal" ? countLabel(bookIds.size) : `${family.label} \xB7 ${countLabel(bookIds.size)}`,
|
|
2267
|
+
bookIds
|
|
2268
|
+
});
|
|
2269
|
+
}
|
|
1990
2270
|
}
|
|
1991
2271
|
categories.push({
|
|
1992
2272
|
id: "all",
|
|
@@ -2604,6 +2884,8 @@ var HELP = [
|
|
|
2604
2884
|
"/do \u2014 choose a craftbook and start it as a task",
|
|
2605
2885
|
"/continue \u2014 process due schedules and active tasks in this project",
|
|
2606
2886
|
"/nightshift start|stop|list \u2014 manage Night Shift",
|
|
2887
|
+
"/connect vscode|pi|opencode|codex \u2014 connect a local app to Gezel",
|
|
2888
|
+
"/disconnect [vscode|pi|opencode|codex] \u2014 remove one managed app setup",
|
|
2607
2889
|
"/focus \u2014 send into another active chat /cli \u2014 CLI mode /chat \u2014 chat mode",
|
|
2608
2890
|
"!cmd \u2014 run shell @tools \u2014 list tools @tool <name> {json} \u2014 run a tool",
|
|
2609
2891
|
"/clear \u2014 clear feed /quit \u2014 exit",
|
|
@@ -3659,6 +3941,44 @@ function App(props) {
|
|
|
3659
3941
|
}
|
|
3660
3942
|
return;
|
|
3661
3943
|
}
|
|
3944
|
+
case "connect": {
|
|
3945
|
+
const app = resolveManagedApp(rest);
|
|
3946
|
+
if (!app) return note(managedAppUsage("connect"), "error");
|
|
3947
|
+
note(`connecting ${app}\u2026`);
|
|
3948
|
+
try {
|
|
3949
|
+
const result = await connectManagedApp(client, app);
|
|
3950
|
+
note(result.message);
|
|
3951
|
+
} catch (err) {
|
|
3952
|
+
note(`could not connect ${app}: ${errMsg(err)}`, "error");
|
|
3953
|
+
}
|
|
3954
|
+
return;
|
|
3955
|
+
}
|
|
3956
|
+
case "disconnect": {
|
|
3957
|
+
let app = resolveManagedApp(rest);
|
|
3958
|
+
if (!rest.trim()) {
|
|
3959
|
+
try {
|
|
3960
|
+
const connected = await listConnectedManagedApps(client);
|
|
3961
|
+
if (connected.length === 0) return note("no managed local apps are connected.");
|
|
3962
|
+
if (connected.length > 1) {
|
|
3963
|
+
return note(
|
|
3964
|
+
`more than one app is connected (${connected.join(", ")}); ${managedAppUsage("disconnect")}`,
|
|
3965
|
+
"error"
|
|
3966
|
+
);
|
|
3967
|
+
}
|
|
3968
|
+
app = connected[0] ?? null;
|
|
3969
|
+
} catch (err) {
|
|
3970
|
+
return note(`could not inspect connected apps: ${errMsg(err)}`, "error");
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
if (!app) return note(managedAppUsage("disconnect"), "error");
|
|
3974
|
+
try {
|
|
3975
|
+
const result = await disconnectManagedApp(client, app);
|
|
3976
|
+
note(result.message);
|
|
3977
|
+
} catch (err) {
|
|
3978
|
+
note(`could not disconnect ${app}: ${errMsg(err)}`, "error");
|
|
3979
|
+
}
|
|
3980
|
+
return;
|
|
3981
|
+
}
|
|
3662
3982
|
case "focus":
|
|
3663
3983
|
return setOverlay("focus");
|
|
3664
3984
|
case "cli":
|
|
@@ -3849,6 +4169,7 @@ function App(props) {
|
|
|
3849
4169
|
return;
|
|
3850
4170
|
}
|
|
3851
4171
|
if (key.escape) {
|
|
4172
|
+
if (pendingQuestion) return;
|
|
3852
4173
|
if (turns.size > 0 || activeRuns.size > 0) {
|
|
3853
4174
|
void cancelActiveRef.current().then((did) => did && note("interrupted."));
|
|
3854
4175
|
} else if (pendingInput) {
|
|
@@ -3861,9 +4182,7 @@ function App(props) {
|
|
|
3861
4182
|
}
|
|
3862
4183
|
}
|
|
3863
4184
|
},
|
|
3864
|
-
{
|
|
3865
|
-
isActive: overlay === null && (!pendingQuestion || pendingInput !== null || taskPrompt !== null)
|
|
3866
|
-
}
|
|
4185
|
+
{ isActive: overlay === null }
|
|
3867
4186
|
);
|
|
3868
4187
|
if (status) {
|
|
3869
4188
|
return /* @__PURE__ */ jsx5(Box6, { flexDirection: "column", padding: 1, children: /* @__PURE__ */ jsx5(Text6, { color: status.startsWith("Failed") ? "red" : "cyan", children: status }) });
|
|
@@ -4924,6 +5243,8 @@ function nativeLabel(engine) {
|
|
|
4924
5243
|
return "local runtime helper";
|
|
4925
5244
|
case "ds4-server":
|
|
4926
5245
|
return "ds4";
|
|
5246
|
+
case "duckdb":
|
|
5247
|
+
return "data query engine";
|
|
4927
5248
|
}
|
|
4928
5249
|
}
|
|
4929
5250
|
function accessoryKindLabel(model) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/gezel-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "The `gezel` command-line tool.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -44,14 +44,15 @@
|
|
|
44
44
|
"!dist/**/*.map"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@bendyline/gezel": "1.0.
|
|
48
|
-
"@bendyline/gezel-app-sdk": "1.0.
|
|
49
|
-
"@bendyline/gezel-catalog": "1.0.
|
|
50
|
-
"@bendyline/gezel-client": "1.0.
|
|
51
|
-
"@bendyline/gezel-
|
|
52
|
-
"@bendyline/
|
|
53
|
-
"@bendyline/squisq
|
|
54
|
-
"@bendyline/squisq-
|
|
47
|
+
"@bendyline/gezel": "1.0.7",
|
|
48
|
+
"@bendyline/gezel-app-sdk": "1.0.7",
|
|
49
|
+
"@bendyline/gezel-catalog": "1.0.7",
|
|
50
|
+
"@bendyline/gezel-client": "1.0.7",
|
|
51
|
+
"@bendyline/gezel-knowledge": "1.0.7",
|
|
52
|
+
"@bendyline/gezel-service": "1.0.7",
|
|
53
|
+
"@bendyline/squisq": "2.10.0",
|
|
54
|
+
"@bendyline/squisq-formats": "2.5.1",
|
|
55
|
+
"@bendyline/squisq-react": "2.10.1",
|
|
55
56
|
"commander": "^15.0.0",
|
|
56
57
|
"ink": "^7.1.1",
|
|
57
58
|
"ink-text-input": "^6.0.0",
|