@enactprotocol/cli 2.1.29 → 2.1.31

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.
@@ -105,8 +105,11 @@ export class ValidationError extends CliError {
105
105
  * Authentication error
106
106
  */
107
107
  export class AuthError extends CliError {
108
- constructor(message: string) {
109
- super(message, EXIT_AUTH_ERROR, "Run 'enact auth login' to authenticate.");
108
+ constructor(message: string, options?: { expired?: boolean }) {
109
+ const suggestion = options?.expired
110
+ ? "Your session may have expired. Run 'enact auth login' to log in again."
111
+ : "Run 'enact auth login' to authenticate.";
112
+ super(message, EXIT_AUTH_ERROR, suggestion);
110
113
  this.name = "AuthError";
111
114
  }
112
115
  }
@@ -319,12 +322,13 @@ export function categorizeError(err: unknown): CliError {
319
322
  return new TimeoutError("Operation", 30000);
320
323
  }
321
324
 
322
- // Authentication
323
- if (
324
- message.includes("unauthorized") ||
325
- message.includes("401") ||
326
- message.includes("authentication")
327
- ) {
325
+ // Authentication - check for 401 which usually means expired session
326
+ if (message.includes("401") || message.includes("unauthorized")) {
327
+ return new AuthError("Authentication failed", { expired: true });
328
+ }
329
+
330
+ // Other auth errors
331
+ if (message.includes("authentication") || message.includes("not authenticated")) {
328
332
  return new AuthError(err.message);
329
333
  }
330
334
 
@@ -360,6 +364,15 @@ export const ErrorMessages = {
360
364
  ],
361
365
  }),
362
366
 
367
+ sessionExpired: () => ({
368
+ message: "Authentication failed",
369
+ suggestions: [
370
+ "Your session may have expired",
371
+ `Log in again: ${colors.command("enact auth login")}`,
372
+ `Check status: ${colors.command("enact auth status")}`,
373
+ ],
374
+ }),
375
+
363
376
  manifestNotFound: (dir: string) => ({
364
377
  message: `No manifest found in ${dir}`,
365
378
  suggestions: [