Skip to content

fix: make REPL auth-agnostic + Auth0 SPA login for playground#14

Merged
designcode merged 3 commits into
mainfrom
chore/playground-repl
Apr 22, 2026
Merged

fix: make REPL auth-agnostic + Auth0 SPA login for playground#14
designcode merged 3 commits into
mainfrom
chore/playground-repl

Conversation

@designcode
Copy link
Copy Markdown
Collaborator

@designcode designcode commented Apr 22, 2026

Summary

Package changes (triggers 0.3.1 release)

  • src/repl/auth.ts: slimmed to types only — LoginFn, LoginResult, Organization
  • src/cli/auth.ts: device flow moved here (CLI-specific, not exported)
  • ReplSession accepts loginFn via constructor — auth-agnostic
  • src/repl/index.ts: exports LoginFn type, removes deviceLogin

Playground changes

  • Replaced custom shell-loop with shared ReplSession
  • playground/src/auth.ts: browser login via @auth0/auth0-spa-js (Authorization Code + PKCE)
  • login command opens Auth0 popup in browser, device flow in CLI
  • Fixed prompt redraw showing $ instead of "Enter number:" during org selection
  • Removed credentials.ts — session manages state

Test plan

  • 122 tests passing
  • Playground builds cleanly
  • CLI: login → device flow → org selection → bucket mounted
  • Playground: login → Auth0 popup → org selection → bucket mounted
  • configure still works in both

🤖 Generated with Claude Code


Note

Medium Risk
Touches login/auth flows and changes how REPL sessions obtain credentials, which can break CLI/browser sign-in and org selection if miswired. Most changes are contained to wiring and dependency bumps, but affect user entrypoints.

Overview
Refactors the REPL to be auth-provider agnostic by replacing the built-in deviceLogin implementation with a LoginFn callback passed into ReplSession, and updates exports accordingly.

Moves the OAuth device-flow implementation into a new CLI-only module (src/cli/auth.ts) and wires the CLI to use it via new ReplSession({ loginFn: deviceLogin }).

Updates the playground to @tigrisdata/agent-shell@^0.3.0 and switches the xterm shell loop to delegate execution to the shared ReplSession, adding a browser Auth0 popup login (playground/src/auth.ts) and improving prompt handling during interactive org selection (plus removing the old in-memory credentials helper).

Reviewed by Cursor Bugbot for commit 435419f. Bugbot is set up for automated code reviews on this repo. Configure here.

designcode and others added 2 commits April 22, 2026 11:12
- Remove custom configure/mount/flush handlers from playground
- Use ReplSession from @tigrisdata/agent-shell/repl
- Implement ReplIO for xterm.js with prompt support
- Remove credentials.ts (session manages state)
- Update welcome message with login and configure options

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- src/repl/auth.ts: slimmed to types only (LoginFn, LoginResult, Organization)
- src/cli/auth.ts: device flow implementation moved here (CLI-specific)
- ReplSession accepts loginFn via constructor — no hardcoded auth
- CLI passes deviceLogin, playground passes browserLogin

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ddc865e. Configure here.

Comment thread playground/src/shell-loop.ts
Comment thread playground/src/shell-loop.ts
- playground/src/auth.ts: browser login via @auth0/auth0-spa-js
- ShellLoop passes browserLogin to ReplSession
- Fix prompt redraw showing $ instead of "Enter number: " during org selection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@designcode designcode force-pushed the chore/playground-repl branch from ddc865e to 435419f Compare April 22, 2026 11:03
@designcode designcode merged commit ae192ea into main Apr 22, 2026
3 checks passed
@designcode designcode deleted the chore/playground-repl branch April 22, 2026 11:16
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 0.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants