create-mailslot 0.1.1 → 0.2.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.
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # create-mailslot
2
2
 
3
- Deploy [Mailslot](https://github.com/mailslot/mailslot) a self-hosted email
4
- inbox for AI agents — to your own Cloudflare account, interactively.
3
+ > A real inbox for AI agents. Self-hosted.
5
4
 
6
- > Your agent's email shouldn't come with a landlord.
5
+ Deploy [Mailslot](https://github.com/mailslot/mailslot) to your own Cloudflare
6
+ account, interactively.
7
7
 
8
8
  ```sh
9
9
  npx create-mailslot
@@ -11,29 +11,29 @@ npx create-mailslot
11
11
 
12
12
  The wizard:
13
13
 
14
- 1. **Scaffolds a project you own** a thin worker depending on
15
- `@mailslot/core`, deployed from your machine with wrangler
16
- 2. **Guards your existing mail** if the domain's apex already receives
17
- mail elsewhere (Google Workspace, Lark, O365), the wizard tells you the
18
- truth: Email Routing is zone-level, so that domain can't host Mailslot
19
- not even on a subdomain without breaking its mail. It steers you to a
20
- different domain instead of letting you find out the hard way
21
- 3. **Provisions everything** R2 bucket, generated API token (secret),
22
- worker deploy with your domain baked in
23
- 4. **Sets up Email Routing** fully automatic with a Cloudflare API token
24
- (`Zone → Email Routing Rules → Edit`), or guided dashboard steps with
25
- live DNS verification if you'd rather click
26
- 5. **Proves it works** ends with a live round-trip: send an email from
27
- your phone, watch it appear in your terminal
28
-
29
- ## Flags (all optional omitted values are prompted)
14
+ 1. **Scaffolds a project you own.** A thin worker depending on `@mailslot/core`,
15
+ deployed from your machine with wrangler.
16
+ 2. **Guards your existing mail.** If the domain's apex already receives mail
17
+ elsewhere (Google Workspace, Lark, O365, and so on), the wizard tells you the
18
+ truth: Email Routing is zone-level, so that domain cannot host Mailslot, not
19
+ even on a subdomain, without breaking its mail. It steers you to a different
20
+ domain instead of letting you find out the hard way.
21
+ 3. **Provisions everything.** R2 bucket, a generated API token (secret), and a
22
+ worker deploy with your domain baked in.
23
+ 4. **Sets up Email Routing.** Fully automatic with a Cloudflare API token
24
+ (`Zone → Email Routing Rules → Edit`), or guided dashboard steps with live
25
+ DNS verification if you'd rather click.
26
+ 5. **Proves it works.** Ends with a live round-trip: send an email from your
27
+ phone, watch it appear in your terminal.
28
+
29
+ ## Flags (all optional, omitted values are prompted)
30
30
 
31
31
  ```
32
32
  --dir <path> project directory (default: mailslot)
33
33
  --domain <domain> email domain on Cloudflare (e.g. mail.example.com)
34
34
  --worker-name <name> worker name (default: mailslot)
35
35
  --cf-token <token> Cloudflare API token for Email Routing setup
36
- --core-spec <spec> @mailslot/core version/spec (default: ^0.0.2)
36
+ --core-spec <spec> @mailslot/core version/spec (default: matches this wizard's version)
37
37
  --skip-install / --skip-routing / --skip-test
38
38
  ```
39
39
 
package/lib/run.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { randomBytes } from "node:crypto";
2
+ import { readFileSync } from "node:fs";
2
3
  import { writeFile } from "node:fs/promises";
3
4
  import { join, resolve } from "node:path";
4
5
  import * as p from "@clack/prompts";
@@ -7,6 +8,10 @@ import { mxRecords, isCloudflareMx, isCloudflareNs, findZone, waitForCloudflareM
7
8
  import { templates, writeScaffold } from "./scaffold.js";
8
9
  import { zoneId, routingStatus, enableRouting, setCatchAllToWorker } from "./cf-api.js";
9
10
 
11
+ // Wizard and core ship in lockstep (same repo version), so the inbox we
12
+ // scaffold should depend on the core that matches THIS wizard's version.
13
+ const selfVersion = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
14
+
10
15
  export function parseArgs(argv) {
11
16
  const flags = {};
12
17
  for (let i = 0; i < argv.length; i++) {
@@ -133,7 +138,7 @@ export async function run(argv) {
133
138
  const routingReady = isCloudflareMx(domainMx);
134
139
 
135
140
  // ---- scaffold ----
136
- const coreSpec = flags["core-spec"] ?? "^0.0.2";
141
+ const coreSpec = flags["core-spec"] ?? `^${selfVersion}`;
137
142
  const files = templates({ workerName, coreSpec });
138
143
  await writeScaffold(dir, files);
139
144
  p.log.success(`Scaffolded ${dir}`);
package/lib/scaffold.js CHANGED
@@ -1,8 +1,11 @@
1
1
  import { mkdir, readdir, writeFile } from "node:fs/promises";
2
2
  import { join, dirname } from "node:path";
3
3
 
4
- /** Render the files of a scaffolded Mailslot project. */
5
- export function templates({ workerName, coreSpec = "^0.0.2" }) {
4
+ /** Render the files of a scaffolded Mailslot project.
5
+ * coreSpec (e.g. "^0.2.0") is required — run.js derives it from the wizard's
6
+ * own version so the scaffold can't drift from the core it shipped with. */
7
+ export function templates({ workerName, coreSpec }) {
8
+ if (!coreSpec) throw new Error("templates: coreSpec is required");
6
9
  const pkg = {
7
10
  name: workerName,
8
11
  private: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mailslot",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "Deploy Mailslot — a self-hosted email inbox for AI agents — to your own Cloudflare account.",
5
5
  "license": "MIT",
6
6
  "type": "module",