MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / status

Function status

apps/cli/src/commands/auth/status.ts:18–77  ·  view source on GitHub ↗
(options: StatusOptions = {})

Source from the content-addressed store, hash-verified

16}
17
18export 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,

Callers 2

index.tsFile · 0.50

Calls 9

loadTokenFunction · 0.85
getTokenExpirationDateFunction · 0.85
isTokenValidFunction · 0.85
loadCredentialsFunction · 0.85
getTimeRemainingFunction · 0.85
getCredentialsPathFunction · 0.85
formatDateFunction · 0.70
logMethod · 0.65
isTokenExpiredFunction · 0.50

Tested by

no test coverage detected