Skip to content

feat(auth): add site login and whoami commands#1852

Open
jackwener wants to merge 2 commits into
mainfrom
feat/site-login-whoami
Open

feat(auth): add site login and whoami commands#1852
jackwener wants to merge 2 commits into
mainfrom
feat/site-login-whoami

Conversation

@jackwener
Copy link
Copy Markdown
Owner

@jackwener jackwener commented Jun 4, 2026

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:

  • twitter
  • bilibili
  • xiaohongshu
  • douyin
  • github

Design Boundaries

  • No login --check; whoami is the check verb.
  • No logout.
  • No multi-account / --as.
  • No credential autofill, CAPTCHA, 2FA, or passkey automation. Human authenticates; OpenCLI only opens and verifies.
  • No sitemap retrofit in this PR.

Implementation Notes

  • Adds shared registerSiteAuthCommands(...) helper under clis/_shared/site-auth.js.
  • Each site has a thin auth.js that registers real login and whoami adapter commands, so help/list/completion/manifest all see them normally.
  • Adds defaultWindowMode command metadata so login opens foreground by default while other browser commands remain background by default.
  • Polling uses low-impact auth cookie checks first, then runs the identity probe once auth appears.

Verification

  • npx vitest run --project adapter clis/_shared/site-auth.test.js
  • npx vitest run --project unit src/execution.test.ts -t "defaultWindowMode|browser common options"
  • npm run typecheck
  • npm run build
  • npm run docs:build
  • git diff --check
  • CLI smoke: node dist/src/main.js github --help, node dist/src/main.js twitter login --help, manifest assertion for 10 auth commands and foreground login default

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant