packages/mcp-server (@scribase-mail/mcp-server, MIT): - 16 tools: send_email, batch_send_emails, get/list/cancel/reschedule email, list/get/create/verify/delete domain, list/create contact, list/get broadcast, list/get received emails - Stdio transport entry (scribase-mail-mcp bin, npx-ready) - Streamable HTTP transport: createWebHandler() for Next.js/edge, createNodeHandler() for Express/bare Node; standalone server on MCP_PORT - ScribaseMailClient fetch wrapper; resolveApiKey reads SCRIBASE_MAIL_API_KEY | RESEND_API_KEY - 11 vitest tests (mocked fetch); all pass packages/cli (@scribase-mail/cli, MIT): - scribase-mail bin using commander - Commands: login (stores key in ~/.config/scribase-mail/config.json mode 600), emails send/get/list/cancel/reschedule, domains add/verify/list/get/delete, api-keys list/create/delete - Respects SCRIBASE_MAIL_API_KEY | RESEND_API_KEY | SCRIBASE_MAIL_BASE_URL | RESEND_BASE_URL - 9 vitest tests (mocked fs); all pass apps/docs: - guides/resend-migration.mdx: 1-minute migration, API compat matrix, differences table, env vars reference - guides/supabase-smtp.mdx: custom SMTP setup with step-by-step Supabase guide (both dashboard and self-hosted env vars) - guides/neon.mdx: Next.js + Neon quickstart (App Router server action + Pages Router API route, scheduling, error handling) - guides/mcp-server.mdx: Claude Desktop, Cursor, remote HTTP, Caddy rewrite, tool table, env vars - guides/cli.mdx: full CLI usage reference with jq examples - guides/webhooks.mdx: added Svix ↔ X-UseSend-Signature mapping note - docs.json: navigation updated to include all 5 new guide pages Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
669 B
TypeScript
27 lines
669 B
TypeScript
/**
|
|
* Pretty-printing helpers for CLI output.
|
|
* All output is black/white — no colour codes, no emoji.
|
|
*/
|
|
|
|
import type { ApiResult } from "./api.js";
|
|
|
|
export function printJson(data: unknown): void {
|
|
process.stdout.write(JSON.stringify(data, null, 2) + "\n");
|
|
}
|
|
|
|
export function printLine(text: string): void {
|
|
process.stdout.write(text + "\n");
|
|
}
|
|
|
|
export function printError(message: string): void {
|
|
process.stderr.write(`Error: ${message}\n`);
|
|
}
|
|
|
|
export function handleResult<T>(result: ApiResult<T>): void {
|
|
if (!result.ok) {
|
|
printError(`${result.statusCode} ${result.name}: ${result.message}`);
|
|
process.exit(1);
|
|
}
|
|
printJson(result.data);
|
|
}
|