Refactor Sessions to AuthSessions for Clarity

Claude Code·Opus 4.8[1m]·toothbrush·3mo ago·7hr 52min·3 Checkpoints·20 file changes·+198/-196·76.8K tokens

take a look at https://github.com/entireio/cli/pull/1341, that should be this branch. we are introducing a sessions.go file, with Sessions structs and so on. That's confusing. Refactor things to call them auth_sessions.go, and AuthSessions struct. whenever it's about auth, i want to see the name disambiguated. create a plan and show me what you'll do.

3mo ago·2h 42m

Done — auth "session" names are now disambiguated from the real strategy.Session domain.

What changed (5 files + 2 renames, no commit — yours to make):

  • Files: api/sessions.goapi/auth_sessions.go, api/sessions_test.goapi/auth_sessions_test.go (via git mv, history preserved).
  • api package: SessionAuthSession, SessionsResponseAuthSessionsResponse, ListSessionsListAuthSessions, RevokeSessionRevokeAuthSession, RevokeCurrentSessionRevokeCurrentAuthSession, WithSessionsPathWithAuthSessionsPath, plus unexported authSessionsPath/authSessionsBasePath/errAuthSessionsPathUnset. Test funcs renamed to match.
  • cli helpers (auth.go/logout.go): coreAuthSessionsPath, newAuthSessionsClient, authSessionLister, defaultListAuthSessions, renderAuthSessionsTable, sortAuthSessionsByRecency, revokeCurrentAuthSession, revokeAllAuthSessions.

Decisions honored: AuthSession singular (one row), full scope (api + cli helpers).

Notes / tradeoffs:

  • Used gopls semantic rename, not text substitution — so the bare SessionAuthSession didn't mangle prose comments. Fixed the few comment/string cross-references gopls leaves alone (they're prose, not symbol refs).
  • JSON wire key stays "tokens" (server contract) — only Go identifiers and the two filenames changed.
  • Left local test vars (noSessions, the listSessions param) and test-function names as-is: scoped, unambiguous, and not the names you flagged.
  • Verified: go vet clean, golangci-lint 0 issues on both packages, go test ./api/... ./cli/ pass. The one mise run lint failure is a pre-existing shellcheck nit in mise-tasks/release, which this refactor never touched.

fix mise-tasks/release with - Capture first, then test: status="$(git status --porcelain)"

3mo ago·2m

Done. Both fixes committed separately (not pushed).

  • mise-tasks/release now captures status="$(git status --porcelain)" then tests [ -n "$status" ] — full mise run lint passes clean.
  • Three new commits on auth-context-consolidation:
    • 144be12e31 — file renames (sessions.goauth_sessions.go)
    • b912bcbd95 — identifier renames to AuthSession forms
    • a8bf68d564 — the release shellcheck fix

Heads-up: the refactor landed as two commits (moves, then content) because my first git add hit a stale pathspec and only the moves were staged — and your rule is new commits, never amend. If you'd prefer them as one before pushing, say so and I'll squash explicitly.