feat(auth): add site login and whoami commands#1852
Open
jackwener wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds agent-discoverable site auth commands:
opencli <site> whoami: verify the current browser session and return the logged-in identity; never opens the login page.opencli <site> login: verify first; if not logged in, open the site login page in a foreground browser window and poll until the human completes login.Initial sites:
twitterbilibilixiaohongshudouyingithubDesign Boundaries
login --check;whoamiis the check verb.logout.--as.Implementation Notes
registerSiteAuthCommands(...)helper underclis/_shared/site-auth.js.auth.jsthat registers realloginandwhoamiadapter commands, so help/list/completion/manifest all see them normally.defaultWindowModecommand metadata so login opens foreground by default while other browser commands remain background by default.Verification
npx vitest run --project adapter clis/_shared/site-auth.test.jsnpx vitest run --project unit src/execution.test.ts -t "defaultWindowMode|browser common options"npm run typechecknpm run buildnpm run docs:buildgit diff --checknode dist/src/main.js github --help,node dist/src/main.js twitter login --help, manifest assertion for 10 auth commands and foreground login default