groundmail-cli 0.17.1 → 0.18.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 +25 -1
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -1288,7 +1288,7 @@ function trimUrl(value) {
1288
1288
  }
1289
1289
 
1290
1290
  // package.json
1291
- var version = "0.17.1";
1291
+ var version = "0.18.1";
1292
1292
 
1293
1293
  // src/user-agent.ts
1294
1294
  function buildUserAgent(own) {
@@ -3229,6 +3229,28 @@ async function runMigrateCommand(provider, args, env = process.env) {
3229
3229
  }
3230
3230
  }
3231
3231
 
3232
+ // src/commands/validate.ts
3233
+ async function runValidateCommand(args, env = process.env) {
3234
+ const options = parseSuppressionsCommonArgs(args);
3235
+ const apiKey = resolveApiKey6(options, env);
3236
+ if (!apiKey) {
3237
+ return { exitCode: 1, error: "Missing API key. Set GROUNDMAIL_API_KEY, pass --api-key, or run `groundmail login`." };
3238
+ }
3239
+ const flagValues = new Set([options.apiKey, options.baseUrl].filter(Boolean));
3240
+ const email = readFlag18(args, "--email") || args.find((arg) => arg.includes("@") && !arg.startsWith("-") && !flagValues.has(arg));
3241
+ if (!email) {
3242
+ return { exitCode: 1, error: "Missing email. Usage: groundmail validate user@example.com" };
3243
+ }
3244
+ try {
3245
+ const client = await createSuppressionsClient(apiKey, options.baseUrl);
3246
+ const result = await client.validate(email);
3247
+ console.log(JSON.stringify(result));
3248
+ return { exitCode: result.verdict === "invalid" ? 2 : 0 };
3249
+ } catch (error) {
3250
+ return { exitCode: 1, error: error instanceof Error ? error.message : String(error) };
3251
+ }
3252
+ }
3253
+
3232
3254
  // src/help.ts
3233
3255
  var USAGE_LINES = [
3234
3256
  " groundmail login [--scope <scopes>] [--workspace <name>] sign in through the browser (OAuth; no key to copy)",
@@ -3270,6 +3292,7 @@ var USAGE_LINES = [
3270
3292
  " groundmail webhooks get --id wh_\u2026",
3271
3293
  " groundmail webhooks update --id wh_\u2026 [--url \u2026] [--event email.sent] [--enabled true|false]",
3272
3294
  " groundmail webhooks delete --id <webhook-id>",
3295
+ " groundmail validate user@example.com Groundmail validation: verdict, reasons, typo suggestion (exit 2 when invalid)",
3273
3296
  " groundmail suppressions list",
3274
3297
  " groundmail suppressions add --email user@example.com [--reason \u2026]",
3275
3298
  " groundmail suppressions remove --id <id> | --email user@example.com",
@@ -3381,6 +3404,7 @@ async function main() {
3381
3404
  if (session.notice) console.error(session.notice);
3382
3405
  const rest = session.argv;
3383
3406
  if (command === "migrate") await finish(await runMigrateCommand(subcommand, rest));
3407
+ if (command === "validate") await finish(await runValidateCommand([...subcommand ? [subcommand] : [], ...rest]));
3384
3408
  if (command === "domains") {
3385
3409
  if (subcommand === "add" || subcommand === "create") {
3386
3410
  const result = await runAddCommand(rest);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groundmail-cli",
3
- "version": "0.17.1",
3
+ "version": "0.18.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.14.7"
41
+ "groundmail": "0.15.1"
42
42
  },
43
43
  "devDependencies": {
44
44
  "tsup": "^8.5.0",