(options: StatusOptions = {})
| 16 | } |
| 17 | |
| 18 | export async function status(options: StatusOptions = {}): Promise<StatusResult> { |
| 19 | const { verbose = false } = options |
| 20 | |
| 21 | const token = await loadToken() |
| 22 | |
| 23 | if (!token) { |
| 24 | console.log("No legacy Roo auth token stored.") |
| 25 | console.log("") |
| 26 | console.log("Normal CLI usage does not require login.") |
| 27 | console.log("Roo Code Router has been removed, so no legacy Roo sign-in is required.") |
| 28 | return { authenticated: false } |
| 29 | } |
| 30 | |
| 31 | const expiresAt = getTokenExpirationDate(token) |
| 32 | const expired = !isTokenValid(token) |
| 33 | const expiringSoon = isTokenExpired(token, 24 * 60 * 60) && !expired |
| 34 | |
| 35 | const credentials = await loadCredentials() |
| 36 | const createdAt = credentials?.createdAt ? new Date(credentials.createdAt) : undefined |
| 37 | |
| 38 | if (expired) { |
| 39 | console.log("Stored legacy Roo auth token expired.") |
| 40 | console.log("") |
| 41 | console.log("Standard CLI usage still works without login.") |
| 42 | console.log("Roo Code Router has been removed, so you can safely ignore or delete this token.") |
| 43 | |
| 44 | return { |
| 45 | authenticated: false, |
| 46 | expired: true, |
| 47 | expiresAt: expiresAt ?? undefined, |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | if (expiringSoon) { |
| 52 | console.log("⚠ Legacy Roo auth token expires soon; use `roo auth logout` if you want to clean it up.") |
| 53 | } else { |
| 54 | console.log("✓ Legacy Roo auth token still stored") |
| 55 | } |
| 56 | |
| 57 | if (expiresAt) { |
| 58 | const remaining = getTimeRemaining(expiresAt) |
| 59 | console.log(` Expires: ${formatDate(expiresAt)} (${remaining})`) |
| 60 | } |
| 61 | |
| 62 | if (createdAt && verbose) { |
| 63 | console.log(` Created: ${formatDate(createdAt)}`) |
| 64 | } |
| 65 | |
| 66 | if (verbose) { |
| 67 | console.log(` Credentials: ${getCredentialsPath()}`) |
| 68 | } |
| 69 | |
| 70 | return { |
| 71 | authenticated: true, |
| 72 | expired: false, |
| 73 | expiringSoon, |
| 74 | expiresAt: expiresAt ?? undefined, |
| 75 | createdAt, |
no test coverage detected