groundmail-cli 0.16.0 → 0.16.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.
- package/dist/cli.js +128 -78
- 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.16.
|
|
1291
|
+
var version = "0.16.2";
|
|
1292
1292
|
|
|
1293
1293
|
// src/user-agent.ts
|
|
1294
1294
|
function buildUserAgent(own) {
|
|
@@ -3111,83 +3111,132 @@ async function switchWorkspace(argv, deps) {
|
|
|
3111
3111
|
return { exitCode: EXIT_OK };
|
|
3112
3112
|
}
|
|
3113
3113
|
|
|
3114
|
+
// src/help.ts
|
|
3115
|
+
var USAGE_LINES = [
|
|
3116
|
+
" groundmail login [--scope <scopes>] [--workspace <name>] sign in through the browser (OAuth; no key to copy)",
|
|
3117
|
+
" groundmail logout [--workspace <name>|--all] revokes the sign-in server-side",
|
|
3118
|
+
" groundmail whoami",
|
|
3119
|
+
" groundmail auth token [--scope <scopes>] print a short-lived access token (for agents and scripts)",
|
|
3120
|
+
" groundmail workspaces list",
|
|
3121
|
+
" groundmail workspaces use <name|id>",
|
|
3122
|
+
" groundmail domains add example.com",
|
|
3123
|
+
" groundmail domains apply example.com --provider cloudflare",
|
|
3124
|
+
" groundmail domains apply example.com --provider vercel",
|
|
3125
|
+
" groundmail domains apply example.com --provider godaddy",
|
|
3126
|
+
" groundmail domains list",
|
|
3127
|
+
" groundmail domains get example.com",
|
|
3128
|
+
" groundmail domains update example.com --inbound true",
|
|
3129
|
+
" groundmail domains verify example.com",
|
|
3130
|
+
" groundmail domains delete example.com",
|
|
3131
|
+
" groundmail received-emails list [--domain inbound.example.com]",
|
|
3132
|
+
" groundmail received-emails get inb_...",
|
|
3133
|
+
' groundmail emails send --from you@domain.com --to user@example.com --subject "Hello" --html "<p>Hi</p>" [--category transactional|product|newsletter] [--unsubscribe]',
|
|
3134
|
+
" groundmail emails batch --file ./emails.json",
|
|
3135
|
+
" groundmail emails list [--limit 25] [--cursor \u2026]",
|
|
3136
|
+
" groundmail emails insights [--window 7d|30d]",
|
|
3137
|
+
" groundmail emails get --id msg_\u2026",
|
|
3138
|
+
" groundmail emails cancel --id msg_\u2026",
|
|
3139
|
+
" groundmail emails resend --id msg_\u2026",
|
|
3140
|
+
` groundmail events send --name user.created --email user@example.com --data '{"name":"Ada"}'`,
|
|
3141
|
+
" groundmail automations list",
|
|
3142
|
+
" groundmail automations create --file ./welcome.json",
|
|
3143
|
+
` groundmail automations create --name Welcome --trigger user.created --steps '[{"type":"send_email","email":{...}}]'`,
|
|
3144
|
+
" groundmail automations create --file ./otp-sms.json",
|
|
3145
|
+
" groundmail automations get --id <automation-id>",
|
|
3146
|
+
" groundmail automations update --id <automation-id> --file ./welcome.json",
|
|
3147
|
+
" groundmail automations activate --id <automation-id>",
|
|
3148
|
+
" groundmail automations pause --id <automation-id>",
|
|
3149
|
+
" groundmail automations delete --id <automation-id>",
|
|
3150
|
+
" groundmail webhooks list",
|
|
3151
|
+
" groundmail webhooks create --url https://yourapp.com/hooks",
|
|
3152
|
+
" groundmail webhooks get --id wh_\u2026",
|
|
3153
|
+
" groundmail webhooks update --id wh_\u2026 [--url \u2026] [--event email.sent] [--enabled true|false]",
|
|
3154
|
+
" groundmail webhooks delete --id <webhook-id>",
|
|
3155
|
+
" groundmail suppressions list",
|
|
3156
|
+
" groundmail suppressions add --email user@example.com [--reason \u2026]",
|
|
3157
|
+
" groundmail suppressions remove --id <id> | --email user@example.com",
|
|
3158
|
+
" groundmail templates list [--status draft|published]",
|
|
3159
|
+
" groundmail templates starters",
|
|
3160
|
+
" groundmail templates from-starter password-reset",
|
|
3161
|
+
' groundmail templates create --name Welcome --subject "Hi" --html "<p>Hi</p>" [--category transactional|product|newsletter] [--unsubscribe-enabled]',
|
|
3162
|
+
" groundmail templates get --id tpl_\u2026",
|
|
3163
|
+
" groundmail templates update --id tpl_\u2026 [--name \u2026] [--subject \u2026] [--html \u2026] [--text \u2026] [--set-alias \u2026] [--category transactional|product|newsletter] [--unsubscribe-enabled|--no-unsubscribe-enabled]",
|
|
3164
|
+
" groundmail templates publish --id tpl_\u2026",
|
|
3165
|
+
` groundmail templates push ./emails/welcome.tsx --alias welcome [--subject "Welcome"] [--props '{"name":"Ada"}'] [--publish]`,
|
|
3166
|
+
" groundmail templates versions --id tpl_\u2026",
|
|
3167
|
+
" groundmail templates restore --id tpl_\u2026 --version 2",
|
|
3168
|
+
" groundmail templates test-send --id tpl_\u2026 --from you@domain.com --to you@domain.com",
|
|
3169
|
+
' groundmail templates duplicate --id tpl_\u2026 [--name "Copy"]',
|
|
3170
|
+
" groundmail templates delete --id tpl_\u2026",
|
|
3171
|
+
" groundmail keys list",
|
|
3172
|
+
" groundmail keys create [--name Default] [--scopes emails:send,domains:read] [--allowed-domains example.com]",
|
|
3173
|
+
" groundmail keys delete --id <api-key-id>",
|
|
3174
|
+
" groundmail integrations twilio status",
|
|
3175
|
+
" groundmail integrations twilio connect --account-sid AC\u2026 --auth-token \u2026 --from +15551234567",
|
|
3176
|
+
" groundmail integrations twilio disconnect"
|
|
3177
|
+
];
|
|
3178
|
+
var FOOTER_LINES = [
|
|
3179
|
+
"Environment:",
|
|
3180
|
+
" GROUNDMAIL_API_KEY=gm_\u2026 optional (CI): wins over the `groundmail login` sign-in",
|
|
3181
|
+
" GROUNDMAIL_NO_KEYCHAIN=1 keep the refresh token in the config file (0600) instead of the OS keychain",
|
|
3182
|
+
" TWILIO_ACCOUNT_SID=AC\u2026 TWILIO_AUTH_TOKEN=\u2026 TWILIO_DEFAULT_FROM=+1\u2026 (integrations twilio connect)",
|
|
3183
|
+
" CLOUDFLARE_API_TOKEN=\u2026 (optional local apply; else uses dashboard Integrations)",
|
|
3184
|
+
" VERCEL_API_TOKEN=\u2026 VERCEL_TEAM_ID=\u2026 (optional local apply; else uses dashboard Integrations)",
|
|
3185
|
+
" GODADDY_API_KEY=\u2026 GODADDY_API_SECRET=\u2026 (domains apply --provider godaddy)",
|
|
3186
|
+
"",
|
|
3187
|
+
"Scopes: full, emails:send, emails:read, domains:read, domains:write, webhooks:write, templates:write,",
|
|
3188
|
+
" suppressions:write, account:read",
|
|
3189
|
+
"",
|
|
3190
|
+
"Add --help to any command for just its usage. --version prints the CLI version."
|
|
3191
|
+
];
|
|
3192
|
+
var CLI_VERSION = version;
|
|
3193
|
+
var ALIASES = {
|
|
3194
|
+
workspace: { "": "workspaces" },
|
|
3195
|
+
domains: { create: "add", remove: "delete" },
|
|
3196
|
+
events: { trigger: "send" },
|
|
3197
|
+
automations: { add: "create", remove: "delete" },
|
|
3198
|
+
suppressions: { create: "add", delete: "remove" },
|
|
3199
|
+
templates: { add: "create", remove: "delete" }
|
|
3200
|
+
};
|
|
3201
|
+
function words(line) {
|
|
3202
|
+
return line.trim().split(/\s+/);
|
|
3203
|
+
}
|
|
3204
|
+
function fullUsage() {
|
|
3205
|
+
return ["Usage:", ...USAGE_LINES, "", ...FOOTER_LINES].join("\n");
|
|
3206
|
+
}
|
|
3207
|
+
function usageFor(command, subcommand) {
|
|
3208
|
+
if (!command) return fullUsage();
|
|
3209
|
+
const name = ALIASES[command]?.[""] ?? command;
|
|
3210
|
+
const forCommand = USAGE_LINES.filter((line) => words(line)[1] === name);
|
|
3211
|
+
if (!forCommand.length) return null;
|
|
3212
|
+
const sub = subcommand && !subcommand.startsWith("-") ? ALIASES[name]?.[subcommand] ?? subcommand : void 0;
|
|
3213
|
+
const forSub = sub ? forCommand.filter((line) => words(line)[2] === sub) : [];
|
|
3214
|
+
return ["Usage:", ...forSub.length ? forSub : forCommand].join("\n");
|
|
3215
|
+
}
|
|
3216
|
+
function isHelpFlag(arg) {
|
|
3217
|
+
return arg === "--help" || arg === "-h";
|
|
3218
|
+
}
|
|
3219
|
+
function isVersionFlag(arg) {
|
|
3220
|
+
return arg === "--version" || arg === "-v" || arg === "-V";
|
|
3221
|
+
}
|
|
3222
|
+
function resolveMetaRequest(argv) {
|
|
3223
|
+
const [command, subcommand] = argv;
|
|
3224
|
+
if (isVersionFlag(command) || command === "version") return { kind: "version", text: CLI_VERSION };
|
|
3225
|
+
if (!command) return null;
|
|
3226
|
+
if (isHelpFlag(command)) return { kind: "help", text: fullUsage() };
|
|
3227
|
+
if (command === "help") {
|
|
3228
|
+
return { kind: "help", text: usageFor(argv[1], argv[2]) ?? fullUsage() };
|
|
3229
|
+
}
|
|
3230
|
+
if (argv.some(isHelpFlag)) {
|
|
3231
|
+
const sub = isHelpFlag(subcommand) ? void 0 : subcommand;
|
|
3232
|
+
return { kind: "help", text: usageFor(command, sub) ?? fullUsage() };
|
|
3233
|
+
}
|
|
3234
|
+
return null;
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3114
3237
|
// src/cli.ts
|
|
3115
3238
|
function printUsage() {
|
|
3116
|
-
console.error(
|
|
3117
|
-
console.error(" groundmail login [--scope <scopes>] [--workspace <name>] sign in through the browser (OAuth; no key to copy)");
|
|
3118
|
-
console.error(" groundmail logout [--workspace <name>|--all] revokes the sign-in server-side");
|
|
3119
|
-
console.error(" groundmail whoami");
|
|
3120
|
-
console.error(" groundmail auth token [--scope <scopes>] print a short-lived access token (for agents and scripts)");
|
|
3121
|
-
console.error(" groundmail workspaces list");
|
|
3122
|
-
console.error(" groundmail workspaces use <name|id>");
|
|
3123
|
-
console.error(" groundmail domains add example.com");
|
|
3124
|
-
console.error(" groundmail domains apply example.com --provider cloudflare");
|
|
3125
|
-
console.error(" groundmail domains apply example.com --provider vercel");
|
|
3126
|
-
console.error(" groundmail domains apply example.com --provider godaddy");
|
|
3127
|
-
console.error(" groundmail domains list");
|
|
3128
|
-
console.error(" groundmail domains get example.com");
|
|
3129
|
-
console.error(" groundmail domains update example.com --inbound true");
|
|
3130
|
-
console.error(" groundmail domains verify example.com");
|
|
3131
|
-
console.error(" groundmail domains delete example.com");
|
|
3132
|
-
console.error(" groundmail received-emails list [--domain inbound.example.com]");
|
|
3133
|
-
console.error(" groundmail received-emails get inb_...");
|
|
3134
|
-
console.error(' groundmail emails send --from you@domain.com --to user@example.com --subject "Hello" --html "<p>Hi</p>" [--category transactional|product|newsletter] [--unsubscribe]');
|
|
3135
|
-
console.error(" groundmail emails batch --file ./emails.json");
|
|
3136
|
-
console.error(" groundmail emails list [--limit 25] [--cursor \u2026]");
|
|
3137
|
-
console.error(" groundmail emails insights [--window 7d|30d]");
|
|
3138
|
-
console.error(" groundmail emails get --id msg_\u2026");
|
|
3139
|
-
console.error(" groundmail emails cancel --id msg_\u2026");
|
|
3140
|
-
console.error(" groundmail emails resend --id msg_\u2026");
|
|
3141
|
-
console.error(` groundmail events send --name user.created --email user@example.com --data '{"name":"Ada"}'`);
|
|
3142
|
-
console.error(" groundmail automations list");
|
|
3143
|
-
console.error(" groundmail automations create --file ./welcome.json");
|
|
3144
|
-
console.error(` groundmail automations create --name Welcome --trigger user.created --steps '[{"type":"send_email","email":{...}}]'`);
|
|
3145
|
-
console.error(" groundmail automations create --file ./otp-sms.json");
|
|
3146
|
-
console.error(" groundmail automations get --id <automation-id>");
|
|
3147
|
-
console.error(" groundmail automations update --id <automation-id> --file ./welcome.json");
|
|
3148
|
-
console.error(" groundmail automations activate --id <automation-id>");
|
|
3149
|
-
console.error(" groundmail automations pause --id <automation-id>");
|
|
3150
|
-
console.error(" groundmail automations delete --id <automation-id>");
|
|
3151
|
-
console.error(" groundmail webhooks list");
|
|
3152
|
-
console.error(" groundmail webhooks create --url https://yourapp.com/hooks");
|
|
3153
|
-
console.error(" groundmail webhooks get --id wh_\u2026");
|
|
3154
|
-
console.error(" groundmail webhooks update --id wh_\u2026 [--url \u2026] [--event email.sent] [--enabled true|false]");
|
|
3155
|
-
console.error(" groundmail webhooks delete --id <webhook-id>");
|
|
3156
|
-
console.error(" groundmail suppressions list");
|
|
3157
|
-
console.error(" groundmail suppressions add --email user@example.com [--reason \u2026]");
|
|
3158
|
-
console.error(" groundmail suppressions remove --id <id> | --email user@example.com");
|
|
3159
|
-
console.error(" groundmail templates list [--status draft|published]");
|
|
3160
|
-
console.error(" groundmail templates starters");
|
|
3161
|
-
console.error(" groundmail templates from-starter password-reset");
|
|
3162
|
-
console.error(' groundmail templates create --name Welcome --subject "Hi" --html "<p>Hi</p>" [--category transactional|product|newsletter] [--unsubscribe-enabled]');
|
|
3163
|
-
console.error(" groundmail templates get --id tpl_\u2026");
|
|
3164
|
-
console.error(" groundmail templates update --id tpl_\u2026 [--name \u2026] [--subject \u2026] [--html \u2026] [--text \u2026] [--set-alias \u2026] [--category transactional|product|newsletter] [--unsubscribe-enabled|--no-unsubscribe-enabled]");
|
|
3165
|
-
console.error(" groundmail templates publish --id tpl_\u2026");
|
|
3166
|
-
console.error(
|
|
3167
|
-
` groundmail templates push ./emails/welcome.tsx --alias welcome [--subject "Welcome"] [--props '{"name":"Ada"}'] [--publish]`
|
|
3168
|
-
);
|
|
3169
|
-
console.error(" groundmail templates versions --id tpl_\u2026");
|
|
3170
|
-
console.error(" groundmail templates restore --id tpl_\u2026 --version 2");
|
|
3171
|
-
console.error(" groundmail templates test-send --id tpl_\u2026 --from you@domain.com --to you@domain.com");
|
|
3172
|
-
console.error(' groundmail templates duplicate --id tpl_\u2026 [--name "Copy"]');
|
|
3173
|
-
console.error(" groundmail templates delete --id tpl_\u2026");
|
|
3174
|
-
console.error(" groundmail keys list");
|
|
3175
|
-
console.error(" groundmail keys create [--name Default] [--scopes emails:send,domains:read] [--allowed-domains example.com]");
|
|
3176
|
-
console.error(" groundmail keys delete --id <api-key-id>");
|
|
3177
|
-
console.error(" groundmail integrations twilio status");
|
|
3178
|
-
console.error(" groundmail integrations twilio connect --account-sid AC\u2026 --auth-token \u2026 --from +15551234567");
|
|
3179
|
-
console.error(" groundmail integrations twilio disconnect");
|
|
3180
|
-
console.error("");
|
|
3181
|
-
console.error("Environment:");
|
|
3182
|
-
console.error(" GROUNDMAIL_API_KEY=gm_\u2026 optional (CI): wins over the `groundmail login` sign-in");
|
|
3183
|
-
console.error(" GROUNDMAIL_NO_KEYCHAIN=1 keep the refresh token in the config file (0600) instead of the OS keychain");
|
|
3184
|
-
console.error("");
|
|
3185
|
-
console.error("Scopes: full, emails:send, emails:read, domains:read, domains:write, webhooks:write, templates:write,");
|
|
3186
|
-
console.error(" suppressions:write, account:read");
|
|
3187
|
-
console.error(" TWILIO_ACCOUNT_SID=AC\u2026 TWILIO_AUTH_TOKEN=\u2026 TWILIO_DEFAULT_FROM=+1\u2026 (integrations twilio connect)");
|
|
3188
|
-
console.error(" CLOUDFLARE_API_TOKEN=\u2026 (optional local apply; else uses dashboard Integrations)");
|
|
3189
|
-
console.error(" VERCEL_API_TOKEN=\u2026 VERCEL_TEAM_ID=\u2026 (optional local apply; else uses dashboard Integrations)");
|
|
3190
|
-
console.error(" GODADDY_API_KEY=\u2026 GODADDY_API_SECRET=\u2026 (domains apply --provider godaddy)");
|
|
3239
|
+
console.error(fullUsage());
|
|
3191
3240
|
}
|
|
3192
3241
|
async function finish(result) {
|
|
3193
3242
|
if (result.error) console.error(result.error);
|
|
@@ -3196,8 +3245,9 @@ async function finish(result) {
|
|
|
3196
3245
|
async function main() {
|
|
3197
3246
|
const [, , command, subcommand] = process.argv;
|
|
3198
3247
|
const args = process.argv.slice(3);
|
|
3199
|
-
|
|
3200
|
-
|
|
3248
|
+
const meta = resolveMetaRequest(process.argv.slice(2));
|
|
3249
|
+
if (meta) {
|
|
3250
|
+
console.log(meta.text);
|
|
3201
3251
|
process.exit(0);
|
|
3202
3252
|
}
|
|
3203
3253
|
if (command === "login") await finish(await runLoginCommand(args));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "groundmail-cli",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
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.
|
|
41
|
+
"groundmail": "0.14.3"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"tsup": "^8.5.0",
|