groundmail-cli 0.28.0 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +19 -4
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -797,7 +797,8 @@ function hasLocalCredentials(provider, env) {
797
797
  if (provider === "netlify") return Boolean(env.NETLIFY_AUTH_TOKEN);
798
798
  if (provider === "digitalocean") return Boolean(env.DIGITALOCEAN_TOKEN || env.DIGITALOCEAN_ACCESS_TOKEN);
799
799
  if (provider === "dnsimple") return Boolean(env.DNSIMPLE_TOKEN && env.DNSIMPLE_ACCOUNT_ID);
800
- return true;
800
+ if (provider === "godaddy") return Boolean(env.GODADDY_PAT || env.GODADDY_API_KEY && env.GODADDY_API_SECRET);
801
+ return false;
801
802
  }
802
803
  async function runApplyCommand(args, env = process.env) {
803
804
  const options = parseDomainsCommonArgs(args);
@@ -836,6 +837,7 @@ async function runApplyCommand(args, env = process.env) {
836
837
  provider: dnsProvider,
837
838
  cloudflareApiToken: env.CLOUDFLARE_API_TOKEN || env.CLOUDFLARE_API_KEY,
838
839
  cloudflareZoneId: env.CLOUDFLARE_ZONE_ID,
840
+ godaddyApiToken: env.GODADDY_PAT,
839
841
  godaddyApiKey: env.GODADDY_API_KEY,
840
842
  godaddyApiSecret: env.GODADDY_API_SECRET,
841
843
  vercelApiToken: env.VERCEL_API_TOKEN,
@@ -1463,7 +1465,7 @@ function trimUrl(value) {
1463
1465
  }
1464
1466
 
1465
1467
  // package.json
1466
- var version = "0.28.0";
1468
+ var version = "0.29.1";
1467
1469
 
1468
1470
  // src/user-agent.ts
1469
1471
  function buildUserAgent(own) {
@@ -2141,9 +2143,11 @@ async function finishLogin(tokens, login, { io, env, json, now }) {
2141
2143
  const envKey = envApiKey(env);
2142
2144
  const envNote = envKey ? `${sourceLabel("env", env)} is set in this environment and is used instead of this sign-in until you unset it.` : null;
2143
2145
  const where = storeLabel(saved.oauth, configPath(env), env);
2146
+ const next = await nextStep(login.apiUrl, tokens.access_token, scope, env);
2144
2147
  if (json) {
2145
2148
  printJson(io, {
2146
2149
  status: "signed_in",
2150
+ next,
2147
2151
  user: tokens.user ?? null,
2148
2152
  workspace: { id: saved.id, name: saved.name },
2149
2153
  scope,
@@ -2166,10 +2170,21 @@ async function finishLogin(tokens, login, { io, env, json, now }) {
2166
2170
  );
2167
2171
  }
2168
2172
  if (envNote) lines.push(envNote);
2169
- lines.push(`Next: ${brand.bin} domains list`);
2173
+ lines.push(`Next: ${next}`);
2170
2174
  io.out(lines.join("\n"));
2171
2175
  return { exitCode: EXIT_OK };
2172
2176
  }
2177
+ async function nextStep(apiUrl, accessToken, scope, env) {
2178
+ const brand = cliBrand(env);
2179
+ const canReadDomains = scope === "full" || /\bdomains:(read|write)\b/.test(scope);
2180
+ if (canReadDomains) {
2181
+ const response = await apiRequest(apiUrl, "/domains?limit=1", { apiKey: accessToken, env }).catch(() => null);
2182
+ if (response?.ok && Array.isArray(response.body.domains) && response.body.domains.length === 0) {
2183
+ return `${brand.bin} domains add yourdomain.com`;
2184
+ }
2185
+ }
2186
+ return `${brand.bin} domains list`;
2187
+ }
2173
2188
  async function runLogoutCommand(argv, deps = {}) {
2174
2189
  const io = deps.io ?? processIo;
2175
2190
  const env = deps.env ?? process.env;
@@ -3929,7 +3944,7 @@ var FOOTER_LINES = [
3929
3944
  " TWILIO_ACCOUNT_SID=AC\u2026 TWILIO_AUTH_TOKEN=\u2026 TWILIO_DEFAULT_FROM=+1\u2026 (integrations twilio connect)",
3930
3945
  " CLOUDFLARE_API_TOKEN=\u2026 (optional local apply; else uses dashboard Integrations)",
3931
3946
  " VERCEL_API_TOKEN=\u2026 VERCEL_TEAM_ID=\u2026 (optional local apply; else uses dashboard Integrations)",
3932
- " GODADDY_API_KEY=\u2026 GODADDY_API_SECRET=\u2026 (domains apply --provider godaddy)",
3947
+ " GODADDY_PAT=\u2026 or GODADDY_API_KEY=\u2026 GODADDY_API_SECRET=\u2026 (domains apply --provider godaddy)",
3933
3948
  " SENDGRID_API_KEY / POSTMARK_SERVER_TOKEN (+ POSTMARK_ACCOUNT_TOKEN) / MAILGUN_API_KEY (migrate; used once, never stored)",
3934
3949
  "",
3935
3950
  "Scopes: full, emails:send, emails:read, domains:read, domains:write, webhooks:write, templates:write,",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groundmail-cli",
3
- "version": "0.28.0",
3
+ "version": "0.29.1",
4
4
  "description": "Groundmail CLI — send transactional email from the terminal",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -38,7 +38,7 @@
38
38
  "prepublishOnly": "npm run build"
39
39
  },
40
40
  "dependencies": {
41
- "groundmail": "0.27.0"
41
+ "groundmail": "0.28.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "tsup": "^8.5.0",