feat(cli): add openship mail install for the standalone webmail dashboard#141
feat(cli): add openship mail install for the standalone webmail dashboard#141Rish-it wants to merge 2 commits into
openship mail install for the standalone webmail dashboard#141Conversation
…hboard Expose the webmail deploy flow the dashboard mail wizard already uses (GET /mail/webmail/targets + POST /mail/webmail/deploy-project) as a first-class CLI verb, streaming the build over the shared deployment SSE. Deploys the standalone Zero webmail UI for an existing self-hosted mail server; --list-targets lists valid hosts, --no-watch just queues.
--domain was a required option, so listing deploy targets — a read-only discovery step run before a host is chosen — failed with "required option '-d, --domain' not specified". Make --domain a plain option and enforce it in the action after the --list-targets early return, so an actual install still requires a domain while discovery does not.
Status + Request for a Live Deployment CheckStill WIP/draft, but the command is functionally complete for the self-hosted webmail flow. I have verified it end to end against the existing API contract. Two commits:
What’s verifiedThe goal was to reuse the same functionality as the integrated dashboard version. The validation bar was simple: the CLI must send the exact same request as the dashboard wizard. I ran the built binary against a stub API and captured the HTTP request generated for every supported flag combination. In each case, the request body matched the payload sent by {
"mailServerId": "srv_1",
"hostname": "mail.example.com",
"target": {
"kind": "self",
"serverId": "srv_1"
}
}Verified cases:
No new API routes or deployment logic were added. The command uses the existing Bug found and fixedWhile testing, I found that That caused this command to fail: openship mail install <serverId> --list-targetsWith: This was incorrect because listing targets is a discovery step that should work before a hostname has been selected. The fix:
A real installation still requires What I could not verifyI do not have access to a provisioned mail server, so I could not run a real deployment through to completion. The following path is still unverified from the CLI: This path is shared with the dashboard wizard and is already exercised in production, so the implementation risk should be low. However, the CLI flow has not yet been tested against real hardware. Request for a live deployment checkCould you run it once against a real mail server and flag anything that looks wrong? cd apps/email
bun run build
openship mail install <serverId> --list-targets
openship mail install <serverId> \
--domain webmail.<your-domain>Things worth checking specifically:
I’m happy to fix anything uncovered during the live test. The external IMAP/SMTP flow using Leaving this as a draft until the real-server deployment has been checked. |
openship mail install for the standalone webmail dashboard (WIP)openship mail install for the standalone webmail dashboard
Refs #137.
What
Adds
openship mail install— the CLI entry point for installing the standalonemail (Zero webmail) dashboard, reusing the same machinery the integrated
dashboard wizard already uses. No new API, no reimplementation of the mail stack.
How it maps to the "integrated version"
The integrated install is the dashboard wizard at
apps/dashboard/.../apps/new/mail:openship mail setup.POST /mail/webmail/deploy-project.The CLI had no verb for the second path, even though
mail.ts's own header alreadydocuments the intended
webmail targets+deploy-projectsurface. This wires it up.Fix
apps/cli/src/commands/mail.ts(+97, one file):--list-targets→GET /mail/webmail/targets?serverId=(the same picker the wizard reads).POST /mail/webmail/deploy-project { mailServerId, hostname, target, internalPort? },then streams the build over the shared deployment SSE (
streamDeploymentLogs), the same/build/[deploymentId]stream the dashboard subscribes to.--targetresolvesmail(default, the mail server itself) /cloud/ a server ID to the{ kind: "self", serverId } | { kind: "cloud" }body.--no-watchjust queues. JSON mode honored throughout.Also uses the previously-dead
streamDeploymentLogsimport in this file.Tests
apps/clihas no test runner (lintistsc --noEmit; the CLI isn't unit-tested).Adding a framework for one command would be out of scope, so verification is the
strongest available, run twice:
tsc --noEmit→ clean (twice).mail installregisters undermail,--helprenders,--list-targetspresent, missing
--domainrejected. Re-verified against committedHEAD.Scope / follow-ups (WIP)
POST /mail/webmail/deploy-external, the wizard's"connect existing" provider). Natural next step — same command, a
--externalmode.