domani 0.4.14 → 1.0.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/README.md CHANGED
@@ -1,240 +1,57 @@
1
1
  # domani
2
2
 
3
- Domains and email - for humans and AI agents.
3
+ Official TypeScript SDK for the [domani](https://domani.run) API - domains, email, and identity for AI agents. Fully typed, generated from the OpenAPI spec, zero runtime dependencies (uses the global `fetch`).
4
4
 
5
- Register domains, manage DNS, create mailboxes, send and receive email. From your terminal, your agent, or the web.
6
-
7
- [![npm version](https://img.shields.io/npm/v/domani.svg)](https://www.npmjs.com/package/domani)
8
- [![license](https://img.shields.io/npm/l/domani.svg)](https://github.com/gwendall/domani/blob/main/LICENSE)
9
-
10
- ## How it works
11
-
12
- domani gives you one account and multiple ways in:
13
-
14
- - **[Web](https://domani.run)** - Dashboard with a full inbox (compose, reply, threads), DNS editor, domain management
15
- - **CLI** - This package. Everything the web app does, from your terminal
16
- - **[MCP Server](https://domani.run/mcp)** - 65 tools for Claude Code, Cursor, Windsurf, and any MCP-compatible agent
17
- - **[OpenClaw](https://openclaw.com)** - `clawhub install domani`
18
- - **[Agent Skill](https://domani.run/skill.md)** - Step-by-step guide your agent can follow. Install with `npx skills add domani.run`
19
- - **[REST API](https://domani.run/docs)** - Direct HTTP access to everything
20
-
21
- All interfaces share the same API key and the same data.
5
+ > Looking for the command-line tool? It moved to [`domani-cli`](https://www.npmjs.com/package/domani-cli) (the `domani` command is unchanged: `npm i -g domani-cli`).
22
6
 
23
7
  ## Install
24
8
 
25
9
  ```bash
26
- npm install -g domani
10
+ npm install domani
27
11
  ```
28
12
 
29
- Or run directly with `npx`:
13
+ Requires Node 18+ (for global `fetch`), or pass your own `fetch` implementation.
30
14
 
31
- ```bash
32
- npx domani search myapp .com .dev .ai
33
- ```
15
+ ## Quickstart
34
16
 
35
- ## Quick start
17
+ ```ts
18
+ import { Domani, DomaniError } from "domani";
36
19
 
37
- ```bash
38
- # Domain
39
- domani search myapp .com .io .dev # Check availability
40
- domani buy myapp.dev # Purchase a domain
41
- domani connect myapp.dev vercel # Auto-configure DNS for Vercel
42
-
43
- # Email
44
- domani email create hello@myapp.dev # Create hello@myapp.dev
45
- domani email send hello@myapp.dev \
46
- --to hi@friend.com --subject "Hello" --body "Sent from my terminal"
47
- domani email forward hello@myapp.dev \
48
- --forward-to me@gmail.com # Forward inbound to personal email
49
-
50
- # Health
51
- domani status myapp.dev # DNS, SSL, email, expiry check
52
- ```
20
+ const domani = new Domani({ apiKey: process.env.DOMANI_API_KEY! });
53
21
 
54
- ## Examples
22
+ // Search availability + pricing
23
+ const results = await domani.search({ q: "myagent.com" });
55
24
 
56
- ```bash
57
- # Find available domains with a budget
58
- domani search startup --expand --max-price 20
59
-
60
- # AI-powered name suggestions
61
- domani suggest "minimalist productivity app" --style brandable --tlds com,dev,ai
62
-
63
- # Buy multiple domains at once
64
- domani buy startup.dev startup.ai --yes
65
-
66
- # Set up Vercel + Google Workspace in two commands
67
- domani connect startup.dev vercel
68
- domani connect startup.dev google-workspace
25
+ // Give an agent an inbox
26
+ await domani.createMailboxByAddress({ address: "hi@myagent.com" });
69
27
 
70
- # Full email workflow: create, send, check inbox, forward
71
- domani email create hello@startup.dev
72
- domani email send hello@startup.dev \
73
- --to investor@vc.com --subject "Deck" --body "Here's our deck."
74
- domani email inbox hello@startup.dev --direction in
75
- domani email forward hello@startup.dev --forward-to me@gmail.com
28
+ // Send mail
29
+ await domani.sendEmailByAddress("hi@myagent.com", {
30
+ to: "user@example.com",
31
+ subject: "Hello",
32
+ text: "Sent from my domani mailbox.",
33
+ });
76
34
 
77
- # Webhook for inbound emails (for bots, support systems, etc.)
78
- domani email webhook hello@startup.dev --url https://myapp.dev/hooks/email
79
-
80
- # Export DNS records before making changes
81
- domani dns startup.dev snapshot
82
- domani dns startup.dev set TXT @ "v=spf1 include:_spf.google.com ~all"
83
-
84
- # Pipe to jq (auto-JSON when piped, no --json needed)
85
- domani list | jq '.domains[] | {domain, expires_at}'
86
-
87
- # Introspect command schemas for agent integration
88
- domani schema buy --json
35
+ // Errors carry the API's structured code + hint
36
+ try {
37
+ await domani.sendEmailByAddress("hi@myagent.com", { to: "bounced@example.com", text: "..." });
38
+ } catch (e) {
39
+ if (e instanceof DomaniError) {
40
+ console.error(e.status, e.code, e.hint); // e.g. 400 RECIPIENTS_SUPPRESSED
41
+ }
42
+ }
89
43
  ```
90
44
 
91
- ## Commands
92
-
93
- ### Domains
94
-
95
- ```
96
- domani search <name> [tlds...] Check availability across TLDs (--expand for 30+)
97
- domani suggest <prompt> AI-powered domain suggestions (--style, --lang, --tlds)
98
- domani buy <domains...> Purchase one or more domains
99
- domani transfer <domain> Transfer from another registrar
100
- domani renew <domain> Renew a domain (--years 1-10)
101
- domani import <domain> Import a domain you own elsewhere (DNS monitoring only)
102
- domani list List your domains
103
- domani status <domain> Health check (DNS, SSL, email, expiry)
104
- domani tlds List all TLDs with pricing (--sort, --max-price)
105
- domani whois <domain> WHOIS/RDAP lookup
106
- ```
107
-
108
- ### Email
109
-
110
- ```
111
- domani email list List all mailboxes
112
- domani email create user@domain Create a mailbox
113
- domani email delete user@domain Delete a mailbox
114
- domani email inbox user@domain List messages (--direction in|out)
115
- domani email send user@domain Send an email (--to, --subject, --body, --cc, --bcc)
116
- domani email forward user@domain Forward inbound to a personal address (--forward-to)
117
- domani email webhook user@domain Forward inbound as JSON to your endpoint (--url)
118
- domani email setup --domain <domain> Auto-configure MX, SPF, DKIM, DMARC
119
- domani email status --domain <domain> Check email DNS health
120
- domani email connect --domain <domain> <provider> Connect external provider (Gmail, Fastmail, Proton)
121
- ```
122
-
123
- ### DNS
124
-
125
- ```
126
- domani dns <domain> get List all DNS records
127
- domani dns <domain> set <type> <name> <value> Add/update a record
128
- domani dns <domain> delete <type> <name> Remove a record
129
- domani dns <domain> snapshot Export DNS to file
130
- domani dns <domain> restore Restore DNS from snapshot
131
- domani nameservers <domain> Get or set nameservers (--reset for defaults)
132
- domani connect <domain> <target> Auto-configure DNS for a provider
133
- ```
134
-
135
- **Supported providers**: Vercel, Netlify, Cloudflare Pages, GitHub Pages, Fly.io, Railway, Render, Google Workspace, Fastmail, Proton Mail.
136
-
137
- ### Settings
138
-
139
- ```
140
- domani settings <domain> View/update auto-renew, WHOIS privacy, security lock
141
- domani contact [view|set] Manage WHOIS contact info
142
- domani parking <domain> Manage parking page (enable/disable/price)
143
- domani analytics <domain> View parking analytics
144
- domani auth-code <domain> Get EPP auth code for outbound transfer
145
- domani transfer-away <domain> Check outbound transfer status
146
- ```
45
+ ## API
147
46
 
148
- ### Account
149
-
150
- ```
151
- domani login Log in to domani.run (opens browser)
152
- domani logout Clear saved credentials
153
- domani me Show account info
154
- domani billing Add or update payment method (opens browser)
155
- domani invoices List payment invoices
156
- domani token Print your API key
157
- domani tokens [list|create|revoke] Manage API tokens (scoped, expiring)
158
- domani webhooks [action] Manage webhook endpoints
159
- ```
160
-
161
- ### Introspection
162
-
163
- ```
164
- domani schema [command] Show command schemas for AI agent integration
165
- domani update Update to the latest version
166
- domani uninstall Remove domani CLI and config
167
- ```
168
-
169
- ## Agent integration
170
-
171
- Built for AI agents and scripts, not just humans.
172
-
173
- **TTY auto-detect**: When stdout is not a terminal, the CLI automatically switches to JSON output and skips confirmation prompts. No `--json` flag needed.
174
-
175
- ```bash
176
- domani list | jq '.domains[].domain'
177
- ```
178
-
179
- **Structured errors**: In JSON mode, errors include `code`, `hint`, and `fix_command` for auto-recovery:
180
-
181
- ```json
182
- { "error": "Not logged in", "code": "auth_required", "fix_command": "domani login" }
183
- ```
184
-
185
- | Code | Fix | Description |
186
- |------|-----|-------------|
187
- | `auth_required` | `domani login` | Not logged in |
188
- | `payment_required` | `domani billing` | No payment method on file |
189
- | `contact_required` | `domani contact set` | WHOIS contact info missing |
190
- | `validation_error` | Read `hint` | Invalid input |
191
- | `not_found` | - | Domain doesn't exist or not owned |
192
- | `rate_limited` | Wait `Retry-After` | Too many requests |
193
-
194
- **Flags**:
195
-
196
- | Flag | Description |
197
- |------|-------------|
198
- | `--json` | Force JSON output |
199
- | `--fields <f>` | Filter JSON fields (comma-separated) |
200
- | `--dry-run` | Preview mutations without executing |
201
- | `--yes` | Skip confirmation prompts |
202
-
203
- **Input hardening**: All inputs are validated against path traversal, control characters, query strings, and double encoding - common agent hallucinations.
204
-
205
- **Schema introspection**: Run `domani schema <command> --json` to get parameter types, constraints, and enums before constructing a command.
206
-
207
- ## Payments
208
-
209
- Domains are charged to your saved card. Add one at [domani.run/dashboard](https://domani.run/dashboard) or with `domani card add`.
210
-
211
- ```bash
212
- domani buy myapp.dev # Charged to saved card
213
- ```
214
-
215
- ## Authentication
216
-
217
- | Method | Description |
218
- |--------|-------------|
219
- | `domani login` | Interactive login (opens browser) |
220
- | `$DOMANI_API_KEY` | API key as environment variable |
221
- | `~/.domani/config.json` | Saved credentials from `domani login` |
222
-
223
- The CLI checks `$DOMANI_API_KEY` first, then falls back to `~/.domani/config.json`.
224
-
225
- ```bash
226
- domani login # Interactive (opens browser)
227
- export DOMANI_API_KEY=domani_sk_... # Or set env var
228
- ```
47
+ `new Domani({ apiKey, baseUrl?, fetch? })` exposes one typed method per API operation (named after its operationId). Path parameters are positional; request bodies and query objects are typed. Every method returns the parsed JSON response and throws `DomaniError` (`status`, `code`, `hint`, `documentation_url`) on non-2xx.
229
48
 
230
- Scoped API tokens can be created with `domani tokens create --scopes read,dns --expires-in 86400`.
49
+ Full endpoint reference: <https://domani.run/docs> · OpenAPI spec: <https://domani.run/.well-known/openapi.json>
231
50
 
232
- ## Environment variables
51
+ ## Generated
233
52
 
234
- | Variable | Description |
235
- |----------|-------------|
236
- | `DOMANI_API_KEY` | API key (takes precedence over saved config) |
53
+ `src/index.ts` is generated from the domani OpenAPI spec - do not edit it by hand. It is regenerated whenever the API surface changes.
237
54
 
238
55
  ## License
239
56
 
240
- [MIT](LICENSE)
57
+ MIT