groundmail-cli 0.29.0 → 0.29.2

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 +15 -2
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -1465,7 +1465,7 @@ function trimUrl(value) {
1465
1465
  }
1466
1466
 
1467
1467
  // package.json
1468
- var version = "0.29.0";
1468
+ var version = "0.29.2";
1469
1469
 
1470
1470
  // src/user-agent.ts
1471
1471
  function buildUserAgent(own) {
@@ -2143,9 +2143,11 @@ async function finishLogin(tokens, login, { io, env, json, now }) {
2143
2143
  const envKey = envApiKey(env);
2144
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;
2145
2145
  const where = storeLabel(saved.oauth, configPath(env), env);
2146
+ const next = await nextStep(login.apiUrl, tokens.access_token, scope, env);
2146
2147
  if (json) {
2147
2148
  printJson(io, {
2148
2149
  status: "signed_in",
2150
+ next,
2149
2151
  user: tokens.user ?? null,
2150
2152
  workspace: { id: saved.id, name: saved.name },
2151
2153
  scope,
@@ -2168,10 +2170,21 @@ async function finishLogin(tokens, login, { io, env, json, now }) {
2168
2170
  );
2169
2171
  }
2170
2172
  if (envNote) lines.push(envNote);
2171
- lines.push(`Next: ${brand.bin} domains list`);
2173
+ lines.push(`Next: ${next}`);
2172
2174
  io.out(lines.join("\n"));
2173
2175
  return { exitCode: EXIT_OK };
2174
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
+ }
2175
2188
  async function runLogoutCommand(argv, deps = {}) {
2176
2189
  const io = deps.io ?? processIo;
2177
2190
  const env = deps.env ?? process.env;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groundmail-cli",
3
- "version": "0.29.0",
3
+ "version": "0.29.2",
4
4
  "description": "Groundmail CLI — send transactional email from the terminal",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -46,6 +46,6 @@
46
46
  "vitest": "^3.2.4"
47
47
  },
48
48
  "optionalDependencies": {
49
- "@napi-rs/keyring": "2.1.1"
49
+ "@napi-rs/keyring": "2.1.2"
50
50
  }
51
51
  }