Skip to content

feat: add excalidraw login and logout - #3

Merged
dwelle merged 1 commit into
masterfrom
feat/login
Oct 8, 2026
Merged

dwelle merged 1 commit into
masterfrom
feat/login

Conversation

@dwelle

@dwelle dwelle commented Oct 8, 2026

Copy link
Copy Markdown
Member
  • excalidraw login asks how to sign in, then for the key, without echoing it:
    ◆  Pick which method to sign in with:
    │  ● API key
    │  ○ OAuth (coming soon!)
    
    OAuth is listed but disabled for now. The key is checked with GET /workspaces and saved only if the API accepts it
  • login --api-key <key> saves a key without asking; without a terminal, login says how to pass one instead of saving EXCALIDRAW_API_KEY
  • keys are saved per API origin in ~/.config/excalidraw-cli/credentials.json (%APPDATA% on Windows), readable only by the user, so a staging key never goes to production
  • the file is versioned: an older CLI refuses a file from a newer one instead of misreading or overwriting it, and login replaces a damaged file
  • --api-key and EXCALIDRAW_API_KEY still win over the saved key; whoami reports which one is in use as credentialSource (flag, env, login), and login/logout warn when the variable is set
  • logout removes the key for the origin; login and logout print a confirmation instead of JSON
  • a valid key the API won't show the workspace for (HTTP 403: missing permission, canceled workspace) is saved with a warning quoting the API
  • on Windows, writes wait up to 1 s while another program has the file open, and never leave the temporary copy behind
  • prompts use @clack/prompts, bundled into a 61 KB chunk that only login loads
  • tests run with an empty config directory, so a developer's saved key can't reach them; the e2e suite logs in with the live key and checks that a bad key gets 401
  • checked by hand: the picker in a terminal (selecting, Ctrl+C, empty input), and storage on Windows with Windows Node 22 (paths, replacing the file, two origins, logout, file locks). Not checked: the picker on Windows, and macOS

Opus 5.5 (xhigh)

- login asks for a sign-in method (API key; OAuth is listed as coming soon), reads the key without echoing it, checks it with GET /workspaces and saves it; a key the API rejects isn't saved
- login --api-key <key> saves a key without asking; without a terminal, login says how to pass one instead of saving EXCALIDRAW_API_KEY
- keys are saved per API origin in ~/.config/excalidraw-cli/credentials.json (%APPDATA% on Windows), readable only by the user; the file is versioned, so an older CLI refuses a newer file instead of misreading or overwriting it, and login replaces a damaged one
- --api-key and EXCALIDRAW_API_KEY take precedence over the saved key; whoami reports which one is in use as credentialSource
- logout removes the key for the origin; login and logout print a confirmation instead of JSON
- on Windows, writes wait briefly while another program has the file open and never leave the temporary copy behind
- the prompts come from @clack/prompts, bundled into a chunk only login loads
- tests run with an empty config directory, so a developer's saved key can't reach them

Opus 5.5 (xhigh)
@dwelle
dwelle merged commit 5fe457e into master Oct 8, 2026
1 check passed
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