@simonfestl/husky-cli 0.9.6 → 1.0.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.
- package/README.md +19 -13
- package/dist/commands/chat.d.ts +2 -0
- package/dist/commands/chat.js +162 -0
- package/dist/commands/completion.js +0 -9
- package/dist/commands/interactive/tasks.js +93 -9
- package/dist/commands/interactive.js +0 -5
- package/dist/commands/llm-context.d.ts +0 -4
- package/dist/commands/llm-context.js +9 -15
- package/dist/commands/task.js +101 -15
- package/dist/index.js +7 -5
- package/dist/lib/project-resolver.d.ts +26 -0
- package/dist/lib/project-resolver.js +111 -0
- package/package.json +1 -1
- package/dist/commands/interactive/jules-sessions.d.ts +0 -1
- package/dist/commands/interactive/jules-sessions.js +0 -460
- package/dist/commands/jules.d.ts +0 -2
- package/dist/commands/jules.js +0 -593
- package/dist/commands/services.d.ts +0 -2
- package/dist/commands/services.js +0 -381
|
@@ -1,460 +0,0 @@
|
|
|
1
|
-
import { select, input, confirm } from "@inquirer/prompts";
|
|
2
|
-
import { ensureConfig, pressEnterToContinue, truncate, formatDate } from "./utils.js";
|
|
3
|
-
const STATUS_LABELS = {
|
|
4
|
-
pending: "Pending",
|
|
5
|
-
planning: "Planning",
|
|
6
|
-
awaiting_approval: "Awaiting Approval",
|
|
7
|
-
executing: "Executing",
|
|
8
|
-
completed: "Completed",
|
|
9
|
-
failed: "Failed",
|
|
10
|
-
cancelled: "Cancelled",
|
|
11
|
-
};
|
|
12
|
-
export async function julesSessionsMenu() {
|
|
13
|
-
const config = ensureConfig();
|
|
14
|
-
const menuItems = [
|
|
15
|
-
{ name: "List all sessions", value: "list" },
|
|
16
|
-
{ name: "View session details", value: "view" },
|
|
17
|
-
{ name: "Create new session", value: "create" },
|
|
18
|
-
{ name: "Send message", value: "message" },
|
|
19
|
-
{ name: "Approve/Reject plan", value: "approve" },
|
|
20
|
-
{ name: "View activities", value: "activities" },
|
|
21
|
-
{ name: "View sources", value: "sources" },
|
|
22
|
-
{ name: "Delete session", value: "delete" },
|
|
23
|
-
{ name: "Back to main menu", value: "back" },
|
|
24
|
-
];
|
|
25
|
-
const choice = await select({
|
|
26
|
-
message: "Jules Sessions:",
|
|
27
|
-
choices: menuItems,
|
|
28
|
-
});
|
|
29
|
-
switch (choice) {
|
|
30
|
-
case "list":
|
|
31
|
-
await listJulesSessions(config);
|
|
32
|
-
break;
|
|
33
|
-
case "view":
|
|
34
|
-
await viewJulesSession(config);
|
|
35
|
-
break;
|
|
36
|
-
case "create":
|
|
37
|
-
await createJulesSession(config);
|
|
38
|
-
break;
|
|
39
|
-
case "message":
|
|
40
|
-
await sendMessage(config);
|
|
41
|
-
break;
|
|
42
|
-
case "approve":
|
|
43
|
-
await approvePlan(config);
|
|
44
|
-
break;
|
|
45
|
-
case "activities":
|
|
46
|
-
await viewActivities(config);
|
|
47
|
-
break;
|
|
48
|
-
case "sources":
|
|
49
|
-
await viewSources(config);
|
|
50
|
-
break;
|
|
51
|
-
case "delete":
|
|
52
|
-
await deleteJulesSession(config);
|
|
53
|
-
break;
|
|
54
|
-
case "back":
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
async function fetchJulesSessions(config) {
|
|
59
|
-
const res = await fetch(`${config.apiUrl}/api/jules-sessions`, {
|
|
60
|
-
headers: config.apiKey ? { "x-api-key": config.apiKey } : {},
|
|
61
|
-
});
|
|
62
|
-
if (!res.ok)
|
|
63
|
-
throw new Error(`API returned ${res.status}`);
|
|
64
|
-
const data = await res.json();
|
|
65
|
-
return data.sessions || [];
|
|
66
|
-
}
|
|
67
|
-
async function fetchJulesSources(config) {
|
|
68
|
-
const res = await fetch(`${config.apiUrl}/api/jules-sessions/sources`, {
|
|
69
|
-
headers: config.apiKey ? { "x-api-key": config.apiKey } : {},
|
|
70
|
-
});
|
|
71
|
-
if (!res.ok)
|
|
72
|
-
throw new Error(`API returned ${res.status}`);
|
|
73
|
-
return res.json();
|
|
74
|
-
}
|
|
75
|
-
async function selectJulesSession(config, message) {
|
|
76
|
-
const sessions = await fetchJulesSessions(config);
|
|
77
|
-
if (sessions.length === 0) {
|
|
78
|
-
console.log("\n No Jules sessions found.\n");
|
|
79
|
-
await pressEnterToContinue();
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
const choices = sessions.map((s) => ({
|
|
83
|
-
name: `[${STATUS_LABELS[s.status]}] ${truncate(s.name, 30)} (${s.sourceName || s.sourceId})`,
|
|
84
|
-
value: s.id,
|
|
85
|
-
}));
|
|
86
|
-
choices.push({ name: "Cancel", value: "__cancel__" });
|
|
87
|
-
const sessionId = await select({ message, choices });
|
|
88
|
-
if (sessionId === "__cancel__")
|
|
89
|
-
return null;
|
|
90
|
-
return sessions.find((s) => s.id === sessionId) || null;
|
|
91
|
-
}
|
|
92
|
-
async function listJulesSessions(config) {
|
|
93
|
-
try {
|
|
94
|
-
const sessions = await fetchJulesSessions(config);
|
|
95
|
-
console.log("\n JULES SESSIONS");
|
|
96
|
-
console.log(" " + "-".repeat(80));
|
|
97
|
-
if (sessions.length === 0) {
|
|
98
|
-
console.log(" No Jules sessions found.");
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
for (const session of sessions) {
|
|
102
|
-
const status = STATUS_LABELS[session.status] || session.status;
|
|
103
|
-
console.log(` [${status}] ${truncate(session.name, 40)}`);
|
|
104
|
-
console.log(` ID: ${session.id}`);
|
|
105
|
-
console.log(` Source: ${session.sourceName || session.sourceId}`);
|
|
106
|
-
if (session.prUrl) {
|
|
107
|
-
console.log(` PR: ${session.prUrl}`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
console.log("");
|
|
112
|
-
await pressEnterToContinue();
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
console.error("\n Error fetching Jules sessions:", error);
|
|
116
|
-
await pressEnterToContinue();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
async function viewJulesSession(config) {
|
|
120
|
-
try {
|
|
121
|
-
const session = await selectJulesSession(config, "Select session to view:");
|
|
122
|
-
if (!session)
|
|
123
|
-
return;
|
|
124
|
-
const res = await fetch(`${config.apiUrl}/api/jules-sessions/${session.id}`, {
|
|
125
|
-
headers: config.apiKey ? { "x-api-key": config.apiKey } : {},
|
|
126
|
-
});
|
|
127
|
-
if (!res.ok) {
|
|
128
|
-
console.error(`\n Error: API returned ${res.status}\n`);
|
|
129
|
-
await pressEnterToContinue();
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const full = await res.json();
|
|
133
|
-
console.log(`\n Jules Session: ${full.name}`);
|
|
134
|
-
console.log(" " + "-".repeat(60));
|
|
135
|
-
console.log(` ID: ${full.id}`);
|
|
136
|
-
console.log(` Jules Session ID: ${full.julesSessionId}`);
|
|
137
|
-
console.log(` Status: ${STATUS_LABELS[full.status] || full.status}`);
|
|
138
|
-
console.log(` Source: ${full.sourceName || full.sourceId}`);
|
|
139
|
-
if (full.branch) {
|
|
140
|
-
console.log(` Branch: ${full.branch}`);
|
|
141
|
-
}
|
|
142
|
-
console.log(` Plan Approval: ${full.requirePlanApproval ? "Required" : "Auto"}`);
|
|
143
|
-
console.log(`\n Prompt:`);
|
|
144
|
-
const promptLines = (full.prompt || "").split("\n").slice(0, 3);
|
|
145
|
-
for (const line of promptLines) {
|
|
146
|
-
console.log(` ${truncate(line, 70)}`);
|
|
147
|
-
}
|
|
148
|
-
if (full.planSummary) {
|
|
149
|
-
console.log(`\n Plan Summary:`);
|
|
150
|
-
console.log(` ${truncate(full.planSummary, 150)}`);
|
|
151
|
-
}
|
|
152
|
-
if (full.prUrl) {
|
|
153
|
-
console.log(`\n Pull Request: ${full.prUrl}`);
|
|
154
|
-
if (full.prNumber)
|
|
155
|
-
console.log(` Number: #${full.prNumber}`);
|
|
156
|
-
}
|
|
157
|
-
if (full.taskId) {
|
|
158
|
-
console.log(`\n Linked Task: ${full.taskId}`);
|
|
159
|
-
}
|
|
160
|
-
console.log(`\n Created: ${formatDate(full.createdAt)}`);
|
|
161
|
-
console.log("");
|
|
162
|
-
await pressEnterToContinue();
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
console.error("\n Error viewing session:", error);
|
|
166
|
-
await pressEnterToContinue();
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
async function createJulesSession(config) {
|
|
170
|
-
try {
|
|
171
|
-
// First check if Jules is configured and get sources
|
|
172
|
-
const sourceData = await fetchJulesSources(config);
|
|
173
|
-
if (!sourceData.configured) {
|
|
174
|
-
console.log("\n Error: Jules API is not configured.");
|
|
175
|
-
console.log(" Add JULES_API_KEY to Secret Manager.\n");
|
|
176
|
-
await pressEnterToContinue();
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (!sourceData.sources || sourceData.sources.length === 0) {
|
|
180
|
-
console.log("\n Error: No Jules sources available.");
|
|
181
|
-
console.log(" Connect a GitHub repository in the Jules dashboard.\n");
|
|
182
|
-
await pressEnterToContinue();
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
// Select source
|
|
186
|
-
const sourceChoices = sourceData.sources.map((s) => ({
|
|
187
|
-
name: `${s.fullName} (${s.defaultBranch})`,
|
|
188
|
-
value: s.id,
|
|
189
|
-
description: s.connected ? "Connected" : "Not connected",
|
|
190
|
-
}));
|
|
191
|
-
sourceChoices.push({ name: "Cancel", value: "__cancel__", description: "" });
|
|
192
|
-
const sourceId = await select({ message: "Select source repository:", choices: sourceChoices });
|
|
193
|
-
if (sourceId === "__cancel__")
|
|
194
|
-
return;
|
|
195
|
-
const selectedSource = sourceData.sources.find((s) => s.id === sourceId);
|
|
196
|
-
const name = await input({
|
|
197
|
-
message: "Session name:",
|
|
198
|
-
validate: (v) => (v.length > 0 ? true : "Name required"),
|
|
199
|
-
});
|
|
200
|
-
const prompt = await input({
|
|
201
|
-
message: "Task prompt (what should Jules do?):",
|
|
202
|
-
validate: (v) => (v.length > 10 ? true : "Please provide more detail"),
|
|
203
|
-
});
|
|
204
|
-
const branch = await input({
|
|
205
|
-
message: `Branch (default: ${selectedSource?.defaultBranch || "main"}):`,
|
|
206
|
-
default: selectedSource?.defaultBranch || "main",
|
|
207
|
-
});
|
|
208
|
-
const requireApproval = await confirm({
|
|
209
|
-
message: "Require plan approval before execution?",
|
|
210
|
-
default: true,
|
|
211
|
-
});
|
|
212
|
-
console.log("\n Creating Jules session...\n");
|
|
213
|
-
const res = await fetch(`${config.apiUrl}/api/jules-sessions`, {
|
|
214
|
-
method: "POST",
|
|
215
|
-
headers: {
|
|
216
|
-
"Content-Type": "application/json",
|
|
217
|
-
...(config.apiKey ? { "x-api-key": config.apiKey } : {}),
|
|
218
|
-
},
|
|
219
|
-
body: JSON.stringify({
|
|
220
|
-
name,
|
|
221
|
-
prompt,
|
|
222
|
-
sourceId,
|
|
223
|
-
sourceName: selectedSource?.fullName,
|
|
224
|
-
branch,
|
|
225
|
-
requirePlanApproval: requireApproval,
|
|
226
|
-
}),
|
|
227
|
-
});
|
|
228
|
-
if (!res.ok) {
|
|
229
|
-
const error = await res.json().catch(() => ({}));
|
|
230
|
-
console.error(`\n Error: ${error.error || `API returned ${res.status}`}\n`);
|
|
231
|
-
await pressEnterToContinue();
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
const session = await res.json();
|
|
235
|
-
console.log(` ✓ Jules session created!`);
|
|
236
|
-
console.log(` ID: ${session.id}`);
|
|
237
|
-
console.log(` Name: ${session.name}`);
|
|
238
|
-
console.log(` Status: ${STATUS_LABELS[session.status] || session.status}\n`);
|
|
239
|
-
await pressEnterToContinue();
|
|
240
|
-
}
|
|
241
|
-
catch (error) {
|
|
242
|
-
console.error("\n Error creating session:", error);
|
|
243
|
-
await pressEnterToContinue();
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
async function sendMessage(config) {
|
|
247
|
-
try {
|
|
248
|
-
const session = await selectJulesSession(config, "Select session to message:");
|
|
249
|
-
if (!session)
|
|
250
|
-
return;
|
|
251
|
-
// Check if session can receive messages
|
|
252
|
-
if (session.status === "completed" || session.status === "failed" || session.status === "cancelled") {
|
|
253
|
-
console.log(`\n Cannot send message to session with status: ${session.status}\n`);
|
|
254
|
-
await pressEnterToContinue();
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
const message = await input({
|
|
258
|
-
message: "Enter your message:",
|
|
259
|
-
validate: (v) => (v.length > 0 ? true : "Message required"),
|
|
260
|
-
});
|
|
261
|
-
console.log("\n Sending message...\n");
|
|
262
|
-
const res = await fetch(`${config.apiUrl}/api/jules-sessions/${session.id}/message`, {
|
|
263
|
-
method: "POST",
|
|
264
|
-
headers: {
|
|
265
|
-
"Content-Type": "application/json",
|
|
266
|
-
...(config.apiKey ? { "x-api-key": config.apiKey } : {}),
|
|
267
|
-
},
|
|
268
|
-
body: JSON.stringify({ prompt: message }),
|
|
269
|
-
});
|
|
270
|
-
if (!res.ok) {
|
|
271
|
-
const error = await res.json().catch(() => ({}));
|
|
272
|
-
console.error(`\n Error: ${error.error || `API returned ${res.status}`}\n`);
|
|
273
|
-
await pressEnterToContinue();
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
const updated = await res.json();
|
|
277
|
-
console.log(` ✓ Message sent!`);
|
|
278
|
-
console.log(` Status: ${STATUS_LABELS[updated.status] || updated.status}\n`);
|
|
279
|
-
await pressEnterToContinue();
|
|
280
|
-
}
|
|
281
|
-
catch (error) {
|
|
282
|
-
console.error("\n Error sending message:", error);
|
|
283
|
-
await pressEnterToContinue();
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
async function approvePlan(config) {
|
|
287
|
-
try {
|
|
288
|
-
// Filter to sessions awaiting approval
|
|
289
|
-
const allSessions = await fetchJulesSessions(config);
|
|
290
|
-
const awaitingSessions = allSessions.filter((s) => s.status === "awaiting_approval");
|
|
291
|
-
if (awaitingSessions.length === 0) {
|
|
292
|
-
console.log("\n No sessions awaiting approval.\n");
|
|
293
|
-
await pressEnterToContinue();
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
const choices = awaitingSessions.map((s) => ({
|
|
297
|
-
name: `${truncate(s.name, 35)} (${s.sourceName || s.sourceId})`,
|
|
298
|
-
value: s.id,
|
|
299
|
-
}));
|
|
300
|
-
choices.push({ name: "Cancel", value: "__cancel__" });
|
|
301
|
-
const sessionId = await select({ message: "Select session to approve:", choices });
|
|
302
|
-
if (sessionId === "__cancel__")
|
|
303
|
-
return;
|
|
304
|
-
const session = awaitingSessions.find((s) => s.id === sessionId);
|
|
305
|
-
if (!session)
|
|
306
|
-
return;
|
|
307
|
-
// Show plan summary if available
|
|
308
|
-
const detailRes = await fetch(`${config.apiUrl}/api/jules-sessions/${session.id}`, {
|
|
309
|
-
headers: config.apiKey ? { "x-api-key": config.apiKey } : {},
|
|
310
|
-
});
|
|
311
|
-
if (detailRes.ok) {
|
|
312
|
-
const detail = await detailRes.json();
|
|
313
|
-
if (detail.planSummary) {
|
|
314
|
-
console.log(`\n Plan Summary:`);
|
|
315
|
-
console.log(` ${detail.planSummary}\n`);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
const action = await select({
|
|
319
|
-
message: "Action:",
|
|
320
|
-
choices: [
|
|
321
|
-
{ name: "Approve plan", value: "approve" },
|
|
322
|
-
{ name: "Reject plan", value: "reject" },
|
|
323
|
-
{ name: "Cancel", value: "cancel" },
|
|
324
|
-
],
|
|
325
|
-
});
|
|
326
|
-
if (action === "cancel")
|
|
327
|
-
return;
|
|
328
|
-
const feedback = await input({
|
|
329
|
-
message: "Feedback (optional):",
|
|
330
|
-
});
|
|
331
|
-
const res = await fetch(`${config.apiUrl}/api/jules-sessions/${session.id}/approve`, {
|
|
332
|
-
method: "POST",
|
|
333
|
-
headers: {
|
|
334
|
-
"Content-Type": "application/json",
|
|
335
|
-
...(config.apiKey ? { "x-api-key": config.apiKey } : {}),
|
|
336
|
-
},
|
|
337
|
-
body: JSON.stringify({
|
|
338
|
-
approved: action === "approve",
|
|
339
|
-
feedback: feedback || undefined,
|
|
340
|
-
}),
|
|
341
|
-
});
|
|
342
|
-
if (!res.ok) {
|
|
343
|
-
const error = await res.json().catch(() => ({}));
|
|
344
|
-
console.error(`\n Error: ${error.error || `API returned ${res.status}`}\n`);
|
|
345
|
-
await pressEnterToContinue();
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
const updated = await res.json();
|
|
349
|
-
console.log(`\n ✓ Plan ${action === "approve" ? "approved" : "rejected"}!`);
|
|
350
|
-
console.log(` Status: ${STATUS_LABELS[updated.status] || updated.status}\n`);
|
|
351
|
-
await pressEnterToContinue();
|
|
352
|
-
}
|
|
353
|
-
catch (error) {
|
|
354
|
-
console.error("\n Error processing approval:", error);
|
|
355
|
-
await pressEnterToContinue();
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
async function viewActivities(config) {
|
|
359
|
-
try {
|
|
360
|
-
const session = await selectJulesSession(config, "Select session to view activities:");
|
|
361
|
-
if (!session)
|
|
362
|
-
return;
|
|
363
|
-
const res = await fetch(`${config.apiUrl}/api/jules-sessions/${session.id}/activities`, {
|
|
364
|
-
headers: config.apiKey ? { "x-api-key": config.apiKey } : {},
|
|
365
|
-
});
|
|
366
|
-
if (!res.ok) {
|
|
367
|
-
console.error(`\n Error: API returned ${res.status}\n`);
|
|
368
|
-
await pressEnterToContinue();
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
const data = await res.json();
|
|
372
|
-
const activities = data.activities || [];
|
|
373
|
-
console.log(`\n Activities for: ${session.name}`);
|
|
374
|
-
console.log(" " + "-".repeat(60));
|
|
375
|
-
if (activities.length === 0) {
|
|
376
|
-
console.log(" No activities yet.");
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
const typeLabels = {
|
|
380
|
-
plan: "[PLAN]",
|
|
381
|
-
message: "[MSG]",
|
|
382
|
-
code_change: "[CODE]",
|
|
383
|
-
pr_created: "[PR]",
|
|
384
|
-
error: "[ERR]",
|
|
385
|
-
};
|
|
386
|
-
for (const act of activities.slice(-15)) {
|
|
387
|
-
const label = typeLabels[act.type] || `[${act.type.toUpperCase()}]`;
|
|
388
|
-
const time = formatDate(act.timestamp);
|
|
389
|
-
console.log(` ${time} ${label} ${truncate(act.content, 50)}`);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
console.log("");
|
|
393
|
-
await pressEnterToContinue();
|
|
394
|
-
}
|
|
395
|
-
catch (error) {
|
|
396
|
-
console.error("\n Error fetching activities:", error);
|
|
397
|
-
await pressEnterToContinue();
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
async function viewSources(config) {
|
|
401
|
-
try {
|
|
402
|
-
const data = await fetchJulesSources(config);
|
|
403
|
-
if (!data.configured) {
|
|
404
|
-
console.log("\n Jules API is not configured.");
|
|
405
|
-
console.log(" Add JULES_API_KEY to Secret Manager.\n");
|
|
406
|
-
await pressEnterToContinue();
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
console.log("\n JULES SOURCES (GitHub Repositories)");
|
|
410
|
-
console.log(" " + "-".repeat(70));
|
|
411
|
-
if (!data.sources || data.sources.length === 0) {
|
|
412
|
-
console.log(" No sources configured.");
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
for (const source of data.sources) {
|
|
416
|
-
const connected = source.connected ? "[Connected]" : "[Disconnected]";
|
|
417
|
-
console.log(` ${connected} ${source.fullName}`);
|
|
418
|
-
console.log(` ID: ${source.id}`);
|
|
419
|
-
console.log(` Default Branch: ${source.defaultBranch}`);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
console.log("");
|
|
423
|
-
await pressEnterToContinue();
|
|
424
|
-
}
|
|
425
|
-
catch (error) {
|
|
426
|
-
console.error("\n Error fetching sources:", error);
|
|
427
|
-
await pressEnterToContinue();
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
async function deleteJulesSession(config) {
|
|
431
|
-
try {
|
|
432
|
-
const session = await selectJulesSession(config, "Select session to delete:");
|
|
433
|
-
if (!session)
|
|
434
|
-
return;
|
|
435
|
-
const confirmed = await confirm({
|
|
436
|
-
message: `Delete "${session.name}"? This cannot be undone.`,
|
|
437
|
-
default: false,
|
|
438
|
-
});
|
|
439
|
-
if (!confirmed) {
|
|
440
|
-
console.log("\n Cancelled.\n");
|
|
441
|
-
await pressEnterToContinue();
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
const res = await fetch(`${config.apiUrl}/api/jules-sessions/${session.id}`, {
|
|
445
|
-
method: "DELETE",
|
|
446
|
-
headers: config.apiKey ? { "x-api-key": config.apiKey } : {},
|
|
447
|
-
});
|
|
448
|
-
if (!res.ok) {
|
|
449
|
-
console.error(`\n Error: API returned ${res.status}\n`);
|
|
450
|
-
await pressEnterToContinue();
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
453
|
-
console.log(`\n ✓ Jules session deleted.\n`);
|
|
454
|
-
await pressEnterToContinue();
|
|
455
|
-
}
|
|
456
|
-
catch (error) {
|
|
457
|
-
console.error("\n Error deleting session:", error);
|
|
458
|
-
await pressEnterToContinue();
|
|
459
|
-
}
|
|
460
|
-
}
|
package/dist/commands/jules.d.ts
DELETED