# auth: review follow-ups — docs, single revoke func, comment renames

`3eeb08c`→[main](/content/gh/entireio/cli/commits/main/index.html)·

Soph·1mo ago·4 files·+23 added/-58 removed

\- CLAUDE.md: correct the `auth` command surface (login/logout/status/
contexts/use; drop the removed list/revoke) and document logout's
 --everywhere / --all-contexts flags.
\- logout: have runLogout take a single caller-selected revoke func
instead of both revokeCurrent+revokeAll plus an `all` bool; the
command already knows --everywhere. Drop the now-obsolete
TestRunLogout\_AllRevokesAllSessions (selection is covered end-to-end
by TestLogoutCommand\_FlagMatrix) and update the simple callers.
\- Fix stale method names in //nolint:wrapcheck comments left over from
the Session -> AuthSession rename.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

## Sessions

7bbdd7fd89c1View transcript

## Changes

4

- MCLAUDE.md+3/-1

- cmd/entire/cli

- Mauth.go+1/-1

- Mlogout.go+13/-19

- Mlogout\_test.go+6/-37

```
32 unmodified lines

## function defaultListAuthSessions

// defaultListAuthSessions lists the user's active login sessions on coreURL.
func defaultListAuthSessions(ctx context.Context, coreURL, token string) ([]api.AuthSession, error) {
    return newAuthSessionsClient(coreURL, token).ListAuthSessions(ctx) //nolint:wrapcheck // ListSessions already wraps with action context
}

```

## runLogout function

// runLogout ends the user's login. revokeCurrent revokes just the active
// session; revokeAll (used when all is set) revokes every session on the
// active core. Either way the local keyring entry and active context are
// removed, so the CLI reports logged-out even if the server call fails.

```go
func runLogout(ctx context.Context, outW, errW io.Writer, store tokenStore, revokeCurrent, revokeAll revokeCurrentFunc, clearContext clearContextFunc, baseURL string, all bool) error {
    // ... implementation
}
```

### Tests

```go
func TestRunLogout_AllRevokesAllSessions(t *testing.T) {
    t.Parallel()

store := newMockTokenStore()
    store.tokens["https://entire.io"] = testLogoutToken

currentCalled, allCalled := false, false
    revokeCurrent := func(context.Context) error { currentCalled = true; return nil }
    revokeAll := func(context.Context) error { allCalled = true; return nil }

var out, errOut bytes.Buffer
    err := runLogout(context.Background(), &out, &errOut, store,
        revokeCurrent, revokeAll, func() error { return nil }, "https://entire.io", true)
    if err != nil {
        t.Fatalf("unexpected error: %v", err)
    }

if currentCalled {
        t.Error("--everywhere should not call the current-session revoke")
    }
    if !allCalled {
        t.Error("--everywhere should call the revoke-all path")
    }
    if !store.deleted["https://entire.io"] {
        t.Fatal("local token should still be deleted under --everywhere")
    }
    if !strings.Contains(out.String(), "Logged out.") {
        t.Fatalf("stdout = %q, want to contain %q", out.String(), "Logged out.")
    }
}

func TestLogoutCmd_IsRegistered(t *testing.T) {
    t.Parallel()
}
```
