@email-love/cli 0.0.0-stage → 0.1.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,30 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026-present, Email Love LLC
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ The Email Love name and logo aren't covered by this license.
package/README.md CHANGED
@@ -1,3 +1,96 @@
1
- # Temporary Holding Version
1
+ # Email Love CLI and MCP server
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Build email-ready HTML from design-system blocks, from the command line or from an AI agent over MCP. It uses [@email-love/core](../core) to render (MJML underneath, tested across inbox clients including Outlook and Gmail) and opens emails in the open-source [Email Love editor](../editor) on your own computer.
4
+
5
+ It runs entirely on your computer. It makes no network calls of its own; the HTML it writes links to the fonts and pictures the email uses.
6
+
7
+ ## Use it from an AI agent
8
+
9
+ The MCP server runs over stdio:
10
+
11
+ ```sh
12
+ npx -y @email-love/cli mcp
13
+ ```
14
+
15
+ Claude Code, with the skill that tells Claude when and how to use it:
16
+
17
+ ```sh
18
+ /plugin marketplace add email-love/email-love-sdk
19
+ /plugin install email-love-sdk@email-love-sdk
20
+ ```
21
+
22
+ Or only the MCP server:
23
+
24
+ ```sh
25
+ claude mcp add email-love -- npx -y @email-love/cli mcp
26
+ ```
27
+
28
+ Cursor, Windsurf, Claude Desktop and other clients take the same command in their MCP settings:
29
+
30
+ ```json
31
+ { "mcpServers": { "email-love": { "command": "npx", "args": ["-y", "@email-love/cli", "mcp"] } } }
32
+ ```
33
+
34
+ ### Tools
35
+
36
+ | Tool | |
37
+ | --- | --- |
38
+ | `list_components` | The components an email can be built from: the Ultimate Email Design System's 217, or a design system file's. By `category` or `search`; with `keys`, their fields |
39
+ | `build_email` | Renders `subject`, `preheader`, `blocks` and `brand` with Core and reports Core's checks and the plain text |
40
+ | `check_email` | Core's checks only |
41
+ | `save_email` | Writes `<name>.html`, `<name>.txt` and `<name>.email.json` |
42
+ | `open_in_editor` | Opens a saved `.email.json` in the editor, served on 127.0.0.1. Saving there updates the three files |
43
+
44
+ ## Use it from the command line
45
+
46
+ ```sh
47
+ npm install -g @email-love/cli
48
+
49
+ email-love components --category hero
50
+ email-love components --keys el_library_build_03_hero_5,ueds_product_grid_2
51
+ email-love check sale.json
52
+ email-love save sale.json --dir out
53
+ email-love open out/sale.email.json
54
+ ```
55
+
56
+ `--json` gives results as JSON. `email-love --help` lists everything.
57
+
58
+ ## The email file
59
+
60
+ ```json
61
+ {
62
+ "subject": "30% off jackets and packs, through Monday",
63
+ "preheader": "Use code WINTER30 until Monday at midnight.",
64
+ "brand": {
65
+ "colors": { "primary": "#1f4d3a", "background": "#f4efe6" },
66
+ "fonts": { "heading": "Bitter", "body": "Lato" },
67
+ "logo": { "src": "https://example.com/logo.png", "alt": "Fernwood Supply", "width": 160 }
68
+ },
69
+ "blocks": [
70
+ { "component": "el_header_7" },
71
+ { "component": "el_library_build_03_hero_5", "fields": {
72
+ "image": { "placeholder": "Hero: two hikers in winter jackets, 1200x800" },
73
+ "headline": "<b>30% off. Four days.</b>",
74
+ "text": "Our winter sale is on, until Monday at midnight."
75
+ } }
76
+ ]
77
+ }
78
+ ```
79
+
80
+ - **blocks**: components from top to bottom, with values for their fields. A field left out shows the component's sample content, and the checks say so.
81
+ - **Pictures** take `{ "src": "https://…", "alt": "…" }`, `{ "src", "decorative": true }`, or `{ "placeholder": "what goes here" }` for a gray placeholder to replace later.
82
+ - **brand.colors** are hex colors by role: `primary`, `secondary`, `accent`, `text`, `text_muted`, `background`, `surface`, `inverse`, `border`, `link`, `button_bg`, `button_text`.
83
+ - **brand.fonts**: a family name (Google Fonts load from Google; other fonts fall back to Arial), or `{ family, fallback, weight, webfont_url }`.
84
+ - **design_system**: a path to your own `{ tokens, components }` JSON ([FORMAT.md](../core/FORMAT.md)) instead of the Ultimate Email Design System.
85
+
86
+ The footer's unsubscribe link should be your sending platform's own tag, for example `{{ unsubscribe_url }}`.
87
+
88
+ See [examples](../../examples) for three emails built this way, each with the brief it was built from.
89
+
90
+ ## The Email Love Builder
91
+
92
+ Every result ends with a line about the [Email Love Builder](https://emaillove.com/builder), the hosted app for teams: it keeps a brand's design system, lets a team edit emails together and exports to sending platforms.
93
+
94
+ ## License
95
+
96
+ BSD 3-Clause, Copyright Email Love LLC. `dist/vendor` includes React (MIT); its notice is in `dist/vendor/THIRD_PARTY_NOTICES.md`.
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+ // email-love: build, check, save and open emails from design-system blocks, or run as an MCP server (email-love mcp).
3
+ import { readFileSync } from 'node:fs'
4
+ import { parseArgs } from 'node:util'
5
+ import { runTool } from '../src/tools.js'
6
+ import { serve } from '../src/mcp.js'
7
+ import { UsageError } from '../src/errors.js'
8
+ import { BUILDER_LINE, withBuilderLine } from '../src/builder.js'
9
+
10
+ const { version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'))
11
+
12
+ const HELP = `email-love ${version}: email-ready HTML from design-system blocks, with Email Love Core.
13
+
14
+ Usage:
15
+ email-love components [--category <name>] [--search <words>] [--keys <a,b>] [--design-system <file>]
16
+ email-love build <email.json> [--html] Render it and show Core's checks (--html prints the HTML)
17
+ email-love check <email.json> Core's checks only; exits 1 when there are errors
18
+ email-love save <email.json> [--dir <folder>] [--name <name>]
19
+ Write <name>.html, <name>.txt and <name>.email.json
20
+ email-love open <name.email.json> [--port <n>] [--no-browser]
21
+ Edit it in the open-source Email Love editor, on this computer
22
+ email-love mcp Run as an MCP server over stdio (for Claude, Cursor and other agents)
23
+
24
+ Options: --json gives the result as JSON (the Builder line then goes to stderr). --help, --version.
25
+
26
+ An email.json is { "subject", "preheader", "brand": { "colors", "fonts", "logo" }, "blocks": [{ "component", "fields" }] }.
27
+ See https://github.com/email-love/email-love-sdk/tree/main/packages/cli`
28
+
29
+ const OPTIONS = {
30
+ category: { type: 'string' }, search: { type: 'string' }, keys: { type: 'string' }, 'design-system': { type: 'string' },
31
+ html: { type: 'boolean' }, dir: { type: 'string' }, name: { type: 'string' }, port: { type: 'string' },
32
+ 'no-browser': { type: 'boolean' }, json: { type: 'boolean' }, help: { type: 'boolean', short: 'h' }, version: { type: 'boolean', short: 'v' },
33
+ }
34
+
35
+ async function main(argv) {
36
+ const { values, positionals } = parseArgs({ args: argv, options: OPTIONS, allowPositionals: true })
37
+ const [command, target] = positionals
38
+ if (values.version) return console.log(version)
39
+ if (values.help || !command || command === 'help') return console.log(withBuilderLine(HELP))
40
+ if (command === 'mcp') return serve()
41
+
42
+ const need = what => {
43
+ if (!target) throw new UsageError(`Say which ${what}: email-love ${command} <${what}>`)
44
+ return target
45
+ }
46
+ const call = {
47
+ components: () => ['list_components', { category: values.category, search: values.search, keys: values.keys?.split(',').map(k => k.trim()).filter(Boolean), design_system: values['design-system'] }],
48
+ build: () => ['build_email', { file: need('email.json'), include_html: values.html }],
49
+ check: () => ['check_email', { file: need('email.json') }],
50
+ save: () => ['save_email', { file: need('email.json'), dir: values.dir, name: values.name }],
51
+ open: () => ['open_in_editor', { file: need('name.email.json'), open_browser: !values['no-browser'] }],
52
+ }[command]
53
+ if (!call) throw new UsageError(`No command ${command}. Run email-love --help.`)
54
+ const [tool, args] = call()
55
+
56
+ if (tool === 'open_in_editor' && values.port) {
57
+ const { openInEditor } = await import('../src/editorServer.js')
58
+ const running = await openInEditor({ file: args.file, port: Number(values.port), openBrowser: args.open_browser })
59
+ console.log(withBuilderLine(`The editor is open at ${running.url}\nIt edits ${running.file}. Press Ctrl+C to stop.`))
60
+ return
61
+ }
62
+ if (tool === 'build_email' && values.html) {
63
+ const { buildEmail } = await import('../src/email.js')
64
+ const built = await buildEmail({ file: args.file })
65
+ process.stdout.write(built.html)
66
+ process.stderr.write(`\n${BUILDER_LINE}\n`)
67
+ if (!built.ok) process.exitCode = 1
68
+ return
69
+ }
70
+ const result = await runTool(tool, args)
71
+ if (values.json) {
72
+ console.log(JSON.stringify(result.data, null, 2))
73
+ process.stderr.write(`${BUILDER_LINE}\n`)
74
+ } else {
75
+ console.log(result.text)
76
+ }
77
+ if (tool === 'check_email' && result.data?.ok === false) process.exitCode = 1
78
+ }
79
+
80
+ main(process.argv.slice(2)).catch(error => {
81
+ const message = error instanceof UsageError || error?.code?.startsWith?.('ERR_PARSE_ARGS') ? error.message : (error?.stack || String(error))
82
+ process.stderr.write(`${withBuilderLine(message)}\n`)
83
+ process.exitCode = 1
84
+ })
@@ -0,0 +1,81 @@
1
+ # Third-party notices
2
+
3
+ dist/vendor includes these packages.
4
+
5
+ ## react 18.3.1 (MIT)
6
+
7
+ ```
8
+ MIT License
9
+
10
+ Copyright (c) Facebook, Inc. and its affiliates.
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ ```
30
+
31
+ ## react-dom 18.3.1 (MIT)
32
+
33
+ ```
34
+ MIT License
35
+
36
+ Copyright (c) Facebook, Inc. and its affiliates.
37
+
38
+ Permission is hereby granted, free of charge, to any person obtaining a copy
39
+ of this software and associated documentation files (the "Software"), to deal
40
+ in the Software without restriction, including without limitation the rights
41
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
42
+ copies of the Software, and to permit persons to whom the Software is
43
+ furnished to do so, subject to the following conditions:
44
+
45
+ The above copyright notice and this permission notice shall be included in all
46
+ copies or substantial portions of the Software.
47
+
48
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
49
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
50
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
51
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
52
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
53
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
54
+ SOFTWARE.
55
+ ```
56
+
57
+ ## scheduler 0.23.2 (MIT)
58
+
59
+ ```
60
+ MIT License
61
+
62
+ Copyright (c) Facebook, Inc. and its affiliates.
63
+
64
+ Permission is hereby granted, free of charge, to any person obtaining a copy
65
+ of this software and associated documentation files (the "Software"), to deal
66
+ in the Software without restriction, including without limitation the rights
67
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
68
+ copies of the Software, and to permit persons to whom the Software is
69
+ furnished to do so, subject to the following conditions:
70
+
71
+ The above copyright notice and this permission notice shall be included in all
72
+ copies or substantial portions of the Software.
73
+
74
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
75
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
76
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
77
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
78
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
79
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
80
+ SOFTWARE.
81
+ ```