mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 11:59:29 +00:00
* feat: add DigitalOcean OAuth2 flow for automatic token provisioning Implements the OAuth2 authorization code flow for DigitalOcean as an alternative to manual API token entry. The flow mirrors the existing OpenRouter OAuth pattern using Bun.serve() for the local callback. Changes: - Add tryDoOAuth() with local Bun.serve callback, CSRF state, and code-for-token exchange via DO's /v1/oauth/token endpoint - Add tryRefreshDoToken() for refreshing expired tokens without re-authorization - Extend config persistence with refresh_token, expires_at, auth_method - Modify ensureDoToken() flow: env var -> saved config (with refresh) -> OAuth browser flow -> manual paste fallback - OAuth is gated on DO_OAUTH_CLIENT_ID and DO_OAUTH_CLIENT_SECRET env vars - Add 37 tests covering config persistence, CSRF generation, code validation, token expiry, URL construction, and feature toggle - Bump CLI version to 0.6.5 Closes #1715 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: hardcode DO OAuth credentials, remove env var gate Embed client_id and client_secret as constants (same pattern as gh CLI, doctl, gcloud). OAuth is now always available — no env vars needed. Public CLI clients cannot keep secrets confidential; security comes from the authorization code flow itself (user consent, localhost redirect, CSRF state, single-use codes). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add droplet:delete scope for spawn delete support The spawn CLI's destroyServer() calls DELETE /droplets/{id} which requires the droplet:delete scope. All its required sub-scopes (droplet:read, regions:read, sizes:read, actions:read, image:read) were already present. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude <claude@anthropic.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
24 lines
595 B
JSON
24 lines
595 B
JSON
{
|
|
"name": "@openrouter/spawn",
|
|
"version": "0.6.5",
|
|
"type": "module",
|
|
"bin": {
|
|
"spawn": "cli.js"
|
|
},
|
|
"scripts": {
|
|
"dev": "bun run src/index.ts",
|
|
"build": "bun build src/index.ts --outfile cli.js --target bun --minify --packages bundle",
|
|
"compile": "bun build src/index.ts --compile --outfile spawn",
|
|
"lint": "biome lint src/",
|
|
"test": "bun test",
|
|
"test:watch": "bun test --watch"
|
|
},
|
|
"dependencies": {
|
|
"@clack/prompts": "^1.0.0",
|
|
"picocolors": "^1.1.1"
|
|
},
|
|
"devDependencies": {
|
|
"@biomejs/biome": "^2.4.3",
|
|
"@types/bun": "^1.3.8"
|
|
}
|
|
}
|