feat: Go rewrite + OAuth authentication#71
Merged
jakeschepis merged 2 commits intomainfrom Mar 2, 2026
Merged
Conversation
Complete Go rewrite with Cobra CLI framework. All 26 commands, in-memory caching, retry with backoff, JSON envelope output, and npm binary distribution. 183 tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Browser-based OAuth flow for interactive authentication. Users can run `notion-cli auth login` to authorize via Notion in their browser instead of manually managing API tokens. - New `internal/oauth` package with localhost callback server and token exchange - New `auth login`, `auth logout`, `auth status` commands - Token precedence: NOTION_TOKEN env > OAuth token > manual config token - 6 OAuth error codes with actionable suggestions - Doctor command shows auth method with workspace info - Build-time OAuth client ID/secret injection via Makefile ldflags - 14 new tests across oauth and config packages Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
auth login,auth logout,auth statuscommands for browser-based loginOAuth Details
notion-cli auth loginopens Notion, user authorizes, token saved automaticallyNOTION_TOKENenv var > OAuth token > manual config tokendoctorcommand shows auth method (oauth/env/token/none)New Files
internal/oauth/oauth.go— OAuth flow (localhost server, browser open, token exchange)internal/oauth/oauth_test.go— 9 testsinternal/cli/commands/auth.go— auth login/logout/status commandsModified Files
internal/config/config.go— OAuth fields,HasOAuthToken(),ClearOAuth(),AuthMethod()internal/errors/errors.go— 6 OAuth error codes + factory functionsinternal/cli/commands/db.go— Token precedence: env > OAuth > manualinternal/cli/root.go— Register auth commandsinternal/cli/commands/doctor.go— Auth method diagnostic checkMakefile— OAuth client ID/secret ldflagsTest plan
make test— 196 tests passmake build— compiles with OAuth ldflagsgo vet— cleannotion-cli auth login— browser opens, authorize, token savednotion-cli auth status— shows OAuth workspace infonotion-cli whoami— works with OAuth tokennotion-cli auth logout— clears tokensnotion-cli doctor— shows auth method check🤖 Generated with Claude Code