carlyemail 0.4.0 → 0.5.0

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/carlyemail.js CHANGED
@@ -18,7 +18,7 @@ import { join } from "node:path";
18
18
  import { fileURLToPath } from "node:url";
19
19
  import { randomBytes } from "node:crypto";
20
20
 
21
- export const VERSION = "0.4.0";
21
+ export const VERSION = "0.5.0";
22
22
 
23
23
  const DEFAULT_API = "https://api.carlyemail.com";
24
24
  const CONFIG_DIR = join(homedir(), ".carlyemail");
@@ -253,9 +253,14 @@ define(
253
253
  }
254
254
  if (!username) throw new UsageError("--username is required");
255
255
 
256
+ // Not prompted for. Two questions is a sign-up; three is a form, and this
257
+ // one has a default that works and a `carlyemail name` to change it later.
258
+ const display_name =
259
+ typeof ctx.flags["display-name"] === "string" ? ctx.flags["display-name"] : undefined;
260
+
256
261
  const out = await request(ctx.config, "POST", "/v0/agent/sign-up", {
257
262
  auth: false,
258
- body: { human_email, username, source: "cli" },
263
+ body: { human_email, username, source: "cli", display_name },
259
264
  });
260
265
 
261
266
  // Saved before anything else is printed: the key is returned exactly once
@@ -316,10 +321,37 @@ define("create", "Create an inbox", "carlyemail create --username support", asyn
316
321
  const username = ctx.positional[0] || required(ctx.flags, "username");
317
322
  const body = { username };
318
323
  if (typeof ctx.flags.domain === "string") body.domain = ctx.flags.domain;
324
+ if (typeof ctx.flags["display-name"] === "string") body.display_name = ctx.flags["display-name"];
319
325
  const inbox = await request(ctx.config, "POST", "/v0/inboxes", { body });
320
326
  emit(ctx, inbox, () => ctx.print(ok(bold(inbox.email))));
321
327
  });
322
328
 
329
+ define(
330
+ "name",
331
+ "Set the name recipients see beside an address",
332
+ 'carlyemail name support@carlyemail.com "Support Bot"',
333
+ async (ctx) => {
334
+ const inbox = ctx.positional[0];
335
+ if (!inbox) throw new UsageError('which inbox? carlyemail name <inbox> "Display Name"');
336
+ // Joined, not `positional[1]`: an unquoted `carlyemail name x@y.com Support
337
+ // Bot` is the obvious way to type this and would otherwise silently set
338
+ // "Support". Nothing after the address clears the name rather than being a
339
+ // usage error, so there is a way to take one off.
340
+ const display_name = ctx.positional.slice(1).join(" ");
341
+
342
+ const out = await request(ctx.config, "PATCH", `/v0/inboxes/${encodeURIComponent(inbox)}`, {
343
+ body: { display_name },
344
+ });
345
+ emit(ctx, out, () =>
346
+ ctx.print(
347
+ out.display_name
348
+ ? ok(`${bold(out.email)} now sends as ${bold(out.display_name)}`)
349
+ : ok(`${bold(out.email)} now sends with no display name`)
350
+ )
351
+ );
352
+ }
353
+ );
354
+
323
355
  define("delete", "Delete an inbox and its mail", "carlyemail delete support@carlyemail.com", async (ctx) => {
324
356
  const inbox = ctx.positional[0];
325
357
  if (!inbox) throw new UsageError("which inbox? carlyemail delete <inbox>");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carlyemail",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Real email inboxes your agent can send, receive and reply from. SDK and CLI.",
5
5
  "keywords": [
6
6
  "email",
package/sdk.d.ts CHANGED
@@ -21,6 +21,7 @@ export interface AgentSigninVerifyResponse {
21
21
  export interface AgentSignupRequest {
22
22
  human_email: string;
23
23
  username: string;
24
+ display_name?: string | null;
24
25
  source?: string | null;
25
26
  referrer?: string | null;
26
27
  }