@simonfestl/husky-cli 1.18.0 → 1.18.1
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/dist/commands/auth.js +20 -6
- package/dist/lib/api-client.js +7 -1
- package/package.json +1 -1
package/dist/commands/auth.js
CHANGED
|
@@ -311,13 +311,20 @@ authCommand
|
|
|
311
311
|
process.exit(1);
|
|
312
312
|
}
|
|
313
313
|
const session = await res.json();
|
|
314
|
-
|
|
314
|
+
// Extract agent id for storage (API returns object with id, name, emoji)
|
|
315
|
+
setSessionConfig({
|
|
316
|
+
token: session.token,
|
|
317
|
+
expiresAt: session.expiresAt,
|
|
318
|
+
role: session.role,
|
|
319
|
+
agent: session.agent.id,
|
|
320
|
+
});
|
|
315
321
|
// Fetch and cache permissions for the new session role
|
|
316
322
|
await fetchAndCacheRole();
|
|
317
323
|
if (options.json) {
|
|
318
324
|
console.log(JSON.stringify({
|
|
319
325
|
success: true,
|
|
320
|
-
agent: session.agent,
|
|
326
|
+
agent: session.agent.id,
|
|
327
|
+
agentName: session.agent.name,
|
|
321
328
|
role: session.role,
|
|
322
329
|
expiresAt: session.expiresAt,
|
|
323
330
|
}, null, 2));
|
|
@@ -326,7 +333,7 @@ authCommand
|
|
|
326
333
|
const expiresAt = new Date(session.expiresAt);
|
|
327
334
|
console.log("\n✅ Session created");
|
|
328
335
|
console.log("─".repeat(40));
|
|
329
|
-
console.log(`Agent: ${session.agent}`);
|
|
336
|
+
console.log(`Agent: ${session.agent.name} (${session.agent.id})`);
|
|
330
337
|
console.log(`Role: ${session.role}`);
|
|
331
338
|
console.log(`Expires: ${expiresAt.toLocaleString()}`);
|
|
332
339
|
console.log("");
|
|
@@ -438,20 +445,27 @@ authCommand
|
|
|
438
445
|
process.exit(1);
|
|
439
446
|
}
|
|
440
447
|
const session = await res.json();
|
|
441
|
-
|
|
448
|
+
// Extract agent id for storage (API returns object with id, name, emoji)
|
|
449
|
+
setSessionConfig({
|
|
450
|
+
token: session.token,
|
|
451
|
+
expiresAt: session.expiresAt,
|
|
452
|
+
role: session.role,
|
|
453
|
+
agent: session.agent.id,
|
|
454
|
+
});
|
|
442
455
|
// Refresh permissions for the session role
|
|
443
456
|
await fetchAndCacheRole();
|
|
444
457
|
if (options.json) {
|
|
445
458
|
console.log(JSON.stringify({
|
|
446
459
|
success: true,
|
|
447
|
-
agent: session.agent,
|
|
460
|
+
agent: session.agent.id,
|
|
461
|
+
agentName: session.agent.name,
|
|
448
462
|
role: session.role,
|
|
449
463
|
expiresAt: session.expiresAt,
|
|
450
464
|
}, null, 2));
|
|
451
465
|
return;
|
|
452
466
|
}
|
|
453
467
|
const expiresAt = new Date(session.expiresAt);
|
|
454
|
-
console.log(`✅ Session refreshed for '${session.agent}' (expires: ${expiresAt.toLocaleString()})`);
|
|
468
|
+
console.log(`✅ Session refreshed for '${session.agent.name}' (expires: ${expiresAt.toLocaleString()})`);
|
|
455
469
|
}
|
|
456
470
|
catch (error) {
|
|
457
471
|
console.error(`Error: ${error instanceof Error ? error.message : "Unknown error"}`);
|
package/dist/lib/api-client.js
CHANGED
|
@@ -28,7 +28,13 @@ async function doRefresh(agentName) {
|
|
|
28
28
|
if (!res.ok)
|
|
29
29
|
return null;
|
|
30
30
|
const session = await res.json();
|
|
31
|
-
|
|
31
|
+
// Extract agent id for storage (API returns object with id, name, emoji)
|
|
32
|
+
setSessionConfig({
|
|
33
|
+
token: session.token,
|
|
34
|
+
expiresAt: session.expiresAt,
|
|
35
|
+
role: session.role,
|
|
36
|
+
agent: session.agent.id,
|
|
37
|
+
});
|
|
32
38
|
return session;
|
|
33
39
|
}
|
|
34
40
|
catch {
|