@mailquilt/cli 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vishal Lohar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # @mailquilt/cli
2
+
3
+ Command-line interface for Mail Quilt: render email HTML and plain text, check emails in CI, launch the MCP server, and edit a local folder of email JSON files live in your browser.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -D @mailquilt/cli
9
+ ```
10
+
11
+ Or run with `npx`:
12
+
13
+ ```bash
14
+ npx @mailquilt/cli --help
15
+ ```
16
+
17
+ ## Commands
18
+
19
+ ### `mailquilt render`
20
+
21
+ Render a validated Mail Quilt JSON email to email-client HTML or plain text.
22
+
23
+ ```bash
24
+ mailquilt render emails/welcome.json --out dist/welcome.html
25
+ mailquilt render emails/welcome.json --text --out dist/welcome.txt
26
+ mailquilt render emails/welcome.json --social-icons-url https://cdn.example.com/mail-icons/
27
+ ```
28
+
29
+ Options:
30
+
31
+ - `--out <path>` — write output to a file instead of `stdout`
32
+ - `--text` — render plain text via `renderText()` instead of HTML
33
+ - `--social-icons-url <url>` — base URL for Social Block icons
34
+
35
+ Exits non-zero with a clear `stderr` message if the file cannot be read, is invalid JSON, or is refused by `loadDocument()`.
36
+
37
+ ### `mailquilt check`
38
+
39
+ Run Mail Quilt's `checkEmail()` as a zero-config CI gate for email pull requests. Exits non-zero whenever any Problem exists or the document is refused.
40
+
41
+ ```bash
42
+ mailquilt check emails/welcome.json
43
+ mailquilt check emails/welcome.json --json
44
+ mailquilt check emails/welcome.json --merge-tags '[{"name":"first_name"},{"name":"unsubscribe_url","unsubscribe":true}]'
45
+ mailquilt check emails/welcome.json --merge-tags merge-tags.json --strict
46
+ ```
47
+
48
+ Options:
49
+
50
+ - `--merge-tags <json-or-file>` — inline JSON array or path to a JSON file listing Merge Tags (`string` or `{ name, unsubscribe? }`)
51
+ - `--strict` — also fail if the file used an older migrated document format version
52
+ - `--json` — print machine-readable JSON (`{ file, passed, problemCount, problems }`)
53
+
54
+ ### `mailquilt mcp`
55
+
56
+ Launch [`@mailquilt/mcp`](../mcp/README.md) over stdio scoped to `--root` (default: current working directory).
57
+
58
+ ```bash
59
+ mailquilt mcp --root ./emails
60
+ ```
61
+
62
+ Options:
63
+
64
+ - `--root <dir>` — workspace root directory (all reads and writes are confined inside it)
65
+ - `--dev-url <url>` — active `mailquilt dev` URL (default: `MAILQUILT_DEV_URL`)
66
+
67
+ ### `mailquilt dev`
68
+
69
+ Start a localhost-only (`127.0.0.1`) live editor and preview server over a folder of `.json` email files (default: `./emails`). Creates a starter `welcome.json` if the folder is empty.
70
+
71
+ ```bash
72
+ mailquilt dev ./emails --port 4173 --open
73
+ ```
74
+
75
+ Options:
76
+
77
+ - `--port <port>` — port on `127.0.0.1` (default: `4173`)
78
+ - `--open` — open the editor URL in your default browser
79
+
80
+ Security guarantees:
81
+
82
+ - Binds strictly to `127.0.0.1`.
83
+ - Validates `Host`, `Origin`, and `Sec-Fetch-Site` headers against the local server origin.
84
+ - Blocks path traversal (`..`) and symlinks escaping the watched folder.
85
+ - Validates every save through `loadDocument()` before writing atomically to disk.
86
+
87
+ ## Local MCP + live editor workflow
88
+
89
+ Run the local editor in one terminal:
90
+
91
+ ```bash
92
+ mailquilt dev ./emails --port 4173 --open
93
+ ```
94
+
95
+ Configure your coding agent (Claude Code, Cursor, or Codex) to run `mailquilt mcp --root ./emails` with `MAILQUILT_DEV_URL=http://127.0.0.1:4173`:
96
+
97
+ ```json
98
+ {
99
+ "mcpServers": {
100
+ "mailquilt": {
101
+ "command": "npx",
102
+ "args": ["-y", "@mailquilt/cli", "mcp", "--root", "./emails"],
103
+ "env": {
104
+ "MAILQUILT_DEV_URL": "http://127.0.0.1:4173"
105
+ }
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
111
+ When the agent edits an email via `apply_commands`, `mailquilt dev` detects the disk change and broadcasts an SSE update so `<mail-quilt-shell>` reloads live in your browser. Edits made visually in the browser write back to the same JSON file.
112
+
113
+ [Docs](https://editor.mailquilt.com) · [Playground](https://editor.mailquilt.com/playground) · [Source](https://github.com/mailquilt/editor) · MIT