doomain 0.1.13 → 0.1.15

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
@@ -13,6 +13,7 @@ Use the interactive wizard when working by hand. Use explicit commands with `--j
13
13
  - Vercel project detection from `.vercel/project.json`.
14
14
  - DNS provider inference by longest matching configured zone.
15
15
  - Dry-run plans before writing changes.
16
+ - Safety checks before replacing DNS records that point elsewhere.
16
17
  - DNS propagation and Vercel verification wait loop.
17
18
  - DNS provider support for Spaceship, Namecheap, Cloudflare, and Hostinger.
18
19
 
@@ -40,7 +41,8 @@ The wizard will:
40
41
  4. Connect a DNS provider if none is configured.
41
42
  5. List domains from configured DNS providers.
42
43
  6. Preview the Vercel and DNS changes.
43
- 7. Apply the changes and request Vercel verification.
44
+ 7. Warn if the current DNS target points elsewhere and ask before overriding it.
45
+ 8. Apply the changes and request Vercel verification.
44
46
 
45
47
  If you already know the target project and domain, run the link command directly:
46
48
 
@@ -84,6 +86,8 @@ Apply it:
84
86
  doomain link app.example.com --project my-vercel-project --json
85
87
  ```
86
88
 
89
+ If JSON mode returns `DNS_TARGET_CONFLICT`, the current DNS target appears to point to another project or site. Re-run with `--force` only when you intend to replace that DNS target.
90
+
87
91
  ## Provider Setup
88
92
 
89
93
  Doomain stores local credentials in `~/.doomain/config.json` with `0600` file permissions. Environment variables override saved config values.
@@ -257,8 +261,10 @@ DNS conflict rules:
257
261
 
258
262
  - Existing exact records are skipped.
259
263
  - TXT records can coexist at the same name.
260
- - Same-name, same-type conflicts require `--force`.
261
- - CNAME slot conflicts require `--force` because a CNAME cannot share a name with most other record types.
264
+ - Same-name, same-type conflicts trigger an interactive override prompt or require `--force` in JSON/non-interactive mode.
265
+ - CNAME slot conflicts trigger an interactive override prompt or require `--force` in JSON/non-interactive mode because a CNAME cannot share a name with most other record types.
266
+
267
+ For real links, Doomain inspects the target `A` or `CNAME` DNS slot before adding the domain to Vercel. In interactive mode, it shows the existing and desired records and asks whether to override. In JSON mode, it fails with `DNS_TARGET_CONFLICT` instead of prompting.
262
268
 
263
269
  Use `--force` only when you intend to replace conflicting DNS records or move an existing Vercel alias:
264
270
 
@@ -268,6 +274,8 @@ doomain link app.example.com --project my-app --force
268
274
 
269
275
  `--force` can remove an existing Vercel alias from another project and add it to the target project.
270
276
 
277
+ Confirming the interactive DNS override only forces DNS writes. If Vercel says the domain is already assigned to another project, re-run with `--force` to move that Vercel alias.
278
+
271
279
  Namecheap note: Namecheap's API writes DNS through `setHosts`, which replaces the full host list. Doomain reads all existing records first, applies planned changes in memory, preserves unrelated records, then submits the complete final record set.
272
280
 
273
281
  ## JSON And Agent Usage
@@ -333,7 +341,7 @@ Common flags:
333
341
  - `-p, --project <project>`: Vercel project id or name.
334
342
  - `--provider <id>`: DNS provider id.
335
343
  - `--dry-run`: preview without writing.
336
- - `--force`: overwrite DNS conflicts and allow Vercel alias moves.
344
+ - `--force`: overwrite DNS conflicts without prompting and allow Vercel alias moves.
337
345
  - `--wait`, `--no-wait`: wait for DNS and Vercel verification. Default is `--wait`.
338
346
  - `--timeout <seconds>`: wait timeout. Default is `300`.
339
347
  - `--json`: output one JSON object.
@@ -345,6 +353,7 @@ doomain link app.example.com --project my-app
345
353
  doomain link --domain example.com --subdomain app --project my-app
346
354
  doomain link --domain example.com --apex --project my-app
347
355
  doomain link app.example.com --project my-app --dry-run --json
356
+ doomain link app.example.com --project my-app --force
348
357
  ```
349
358
 
350
359
  ### `doomain auth vercel`
@@ -567,6 +576,10 @@ DNS propagation timeout
567
576
 
568
577
  The DNS records may have been saved even if Vercel verification timed out. Check the domain in Vercel, inspect records with `doomain domains list`, or re-run verification with `doomain verify`.
569
578
 
579
+ DNS target conflict
580
+
581
+ The domain already has a conflicting `A` or `CNAME` record, which usually means it points to another project or site. In interactive mode, confirm the override only if you intend to replace that target. In JSON mode, re-run `doomain link` with `--force` to overwrite DNS.
582
+
570
583
  Domain already assigned to another Vercel project
571
584
 
572
585
  If you intend to move it, re-run `doomain link` with `--force`. This can remove the alias from the previous Vercel project.
@@ -1,6 +1,5 @@
1
1
  import { Args, Command, Flags } from '@oclif/core';
2
2
  import * as p from '@clack/prompts';
3
- import { DoomainError } from '../lib/errors.js';
4
3
  import { accountFlag, apexFlag, domainFlag, jsonFlag, projectFlag, providerFlag, subdomainFlag } from '../lib/flags.js';
5
4
  import { linkDomain } from '../lib/link-domain.js';
6
5
  import { createOutput, outputError } from '../lib/output.js';
@@ -27,6 +26,18 @@ function dnsOverrideNote(warning) {
27
26
  ...warning.desired.map((record) => `- ${recordLine(record)}`),
28
27
  ].join('\n');
29
28
  }
29
+ function providerAccount(result) {
30
+ return result.isDefaultAccount ? result.provider : `${result.provider}/${result.account}`;
31
+ }
32
+ function dryRunPreview(result) {
33
+ const account = providerAccount(result);
34
+ return [
35
+ `Vercel: add ${result.domain} to ${result.project}`,
36
+ `DNS provider: ${account} (${result.zoneDomain})`,
37
+ ...result.records.map((record) => `DNS: ${recordLine(record)} in ${account}`),
38
+ `Actions: ${result.actions.join(', ')}`,
39
+ ].join('\n');
40
+ }
30
41
  export default class Link extends Command {
31
42
  static description = 'Link a Vercel project to a domain and create DNS records.';
32
43
  static examples = [
@@ -59,14 +70,13 @@ export default class Link extends Command {
59
70
  let spinner;
60
71
  const domain = flags.domain ?? args.domain;
61
72
  try {
62
- if (!domain) {
63
- throw new DoomainError('MISSING_ARGUMENT', 'Domain is required. Use `doomain link <domain>` or pass --domain.');
64
- }
65
73
  if (flags['dry-run']) {
66
74
  const result = await linkDomain({ ...flags, domain, dryRun: true, timeoutSeconds: flags.timeout });
67
75
  out.result(result);
68
- if (!out.json)
76
+ if (!out.json) {
77
+ p.note(dryRunPreview(result), 'Dry run');
69
78
  out.success(`Dry run ready for ${result.domain}.`);
79
+ }
70
80
  return;
71
81
  }
72
82
  out.intro('Doomain');
@@ -8,6 +8,7 @@ export const commandSchemas = [
8
8
  'doomain link app.example.com --project my-app --json',
9
9
  'doomain link --domain app.example.com --project my-app --json',
10
10
  'doomain link --domain example.com --subdomain app --project my-app --json',
11
+ 'doomain link --project my-app --json',
11
12
  'doomain link --provider spaceship --domain example.com --apex --project my-app --dry-run --json',
12
13
  'doomain link app.example.com --provider spaceship --account work --project my-app --json',
13
14
  ],
@@ -27,16 +28,42 @@ export const commandSchemas = [
27
28
  { name: 'json', type: 'boolean', description: 'Output a single JSON object and never prompt.' },
28
29
  { name: 'provider', type: 'string', description: 'DNS provider id. Inferred from the target domain when omitted.' },
29
30
  { name: 'account', type: 'string', description: 'DNS provider profile/account alias. Defaults to the provider default account.' },
30
- { name: 'domain', type: 'string', description: 'Target domain or base zone, for example app.example.com or example.com.' },
31
+ {
32
+ name: 'domain',
33
+ type: 'string',
34
+ description: 'Target domain or base zone, for example app.example.com or example.com. Optional when DOOMAIN_DOMAIN or a default domain is configured.',
35
+ },
31
36
  { name: 'subdomain', type: 'string', description: 'Subdomain to add.' },
32
37
  { name: 'apex', type: 'boolean', description: 'Use the root/apex domain.' },
33
38
  { name: 'project', type: 'string', description: 'Vercel project id/name. Optional when project inference succeeds.' },
34
39
  { name: 'dry-run', type: 'boolean', description: 'Preview changes without writing. Intended for human previews; agents should not use this unless explicitly asked.' },
35
- { name: 'force', type: 'boolean', description: 'Overwrite conflicting DNS records.' },
36
- { name: 'wait', type: 'boolean', description: 'Wait for DNS and Vercel verification.', default: true },
40
+ {
41
+ name: 'force',
42
+ type: 'boolean',
43
+ description: 'Move existing Vercel project domains and overwrite conflicting DNS records. Interactive DNS override confirmation does not move Vercel aliases; pass --force for that.',
44
+ },
45
+ { name: 'wait', type: 'boolean', description: 'Wait for DNS and Vercel verification. Use --no-wait to skip waiting.', default: true },
37
46
  { name: 'timeout', type: 'integer', description: 'Wait timeout in seconds.', default: 300 },
38
47
  ],
39
48
  },
49
+ {
50
+ name: 'schema',
51
+ description: 'Print machine-readable command schemas for agents.',
52
+ examples: ['doomain schema --json', 'doomain schema link --json'],
53
+ safeForAgents: true,
54
+ flags: [
55
+ { name: 'json', type: 'boolean', description: 'Output a single JSON object and never prompt.' },
56
+ ],
57
+ },
58
+ {
59
+ name: 'providers list',
60
+ description: 'List supported DNS providers.',
61
+ examples: ['doomain providers list --json'],
62
+ safeForAgents: true,
63
+ flags: [
64
+ { name: 'json', type: 'boolean', description: 'Output a single JSON object and never prompt.' },
65
+ ],
66
+ },
40
67
  {
41
68
  name: 'providers connect',
42
69
  description: 'Save DNS provider credentials locally after verifying them. Prompts for a provider when omitted.',
@@ -123,6 +150,42 @@ export const commandSchemas = [
123
150
  { name: 'json', type: 'boolean', description: 'Output a single JSON object and never prompt.' },
124
151
  ],
125
152
  },
153
+ {
154
+ name: 'domains list',
155
+ description: 'List DNS zones and records for a provider.',
156
+ examples: ['doomain domains list --json', 'doomain domains list --provider cloudflare --domain example.com --json'],
157
+ safeForAgents: true,
158
+ flags: [
159
+ { name: 'json', type: 'boolean', description: 'Output a single JSON object and never prompt.' },
160
+ { name: 'provider', type: 'string', description: 'DNS provider id. Defaults to DOOMAIN_PROVIDER, configured default provider, then spaceship.' },
161
+ { name: 'account', type: 'string', description: 'DNS provider profile/account alias. Omit to list all configured accounts for the provider.' },
162
+ { name: 'domain', type: 'string', description: 'Limit output to one DNS zone.' },
163
+ ],
164
+ },
165
+ {
166
+ name: 'projects list',
167
+ description: 'List Vercel projects.',
168
+ examples: ['doomain projects list --json', 'doomain projects list --search my-app --json'],
169
+ safeForAgents: true,
170
+ flags: [
171
+ { name: 'json', type: 'boolean', description: 'Output a single JSON object and never prompt.' },
172
+ { name: 'search', type: 'string', description: 'Filter projects by search term.' },
173
+ ],
174
+ },
175
+ {
176
+ name: 'verify',
177
+ description: 'Ask Vercel to verify a project domain.',
178
+ examples: ['doomain verify --domain app.example.com --project my-app --json', 'doomain verify --domain example.com --apex --project my-app --json'],
179
+ mutates: true,
180
+ safeForAgents: true,
181
+ flags: [
182
+ { name: 'json', type: 'boolean', description: 'Output a single JSON object and never prompt.' },
183
+ { name: 'domain', type: 'string', description: 'Target domain or base zone, for example app.example.com or example.com.', required: true },
184
+ { name: 'subdomain', type: 'string', description: 'Subdomain to verify.' },
185
+ { name: 'apex', type: 'boolean', description: 'Use the root/apex domain.' },
186
+ { name: 'project', type: 'string', description: 'Vercel project id/name. Optional when local .vercel/project.json is available.' },
187
+ ],
188
+ },
126
189
  ];
127
190
  export function getCommandSchema(name) {
128
191
  if (!name)
@@ -495,8 +495,9 @@ async function resolveDnsForce(input, opts) {
495
495
  return true;
496
496
  }
497
497
  export async function createLinkPlan(input) {
498
+ const domain = await resolveConfiguredDomain(input.domain);
498
499
  const project = await resolveProject(input.project);
499
- const resolved = await resolveProviderTarget(input);
500
+ const resolved = await resolveProviderTarget({ ...input, domain });
500
501
  const { account, accountInferred, isDefaultAccount, provider, providerInferred, target } = resolved;
501
502
  const record = planBaseRecord({ isApex: target.isApex, provider, recordName: target.recordName });
502
503
  return {
@@ -673,5 +673,5 @@
673
673
  ]
674
674
  }
675
675
  },
676
- "version": "0.1.13"
676
+ "version": "0.1.15"
677
677
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "doomain",
3
3
  "description": "Link your vercel project and domain in seconds",
4
- "version": "0.1.13",
4
+ "version": "0.1.15",
5
5
  "author": "Crafter Station",
6
6
  "packageManager": "bun@1.3.13",
7
7
  "bin": {