@deepdynamic/cli 0.1.0 → 0.1.1

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.
Files changed (58) hide show
  1. package/dist/agents/content.js +1 -1
  2. package/dist/agents/install.js +22 -12
  3. package/dist/agents/refresh.js +20 -0
  4. package/dist/agents/setup.js +7 -7
  5. package/dist/cli.js +8 -8
  6. package/dist/commands/account.js +19 -19
  7. package/dist/commands/activity.js +13 -13
  8. package/dist/commands/blocked.js +16 -16
  9. package/dist/commands/deploy/index.js +16 -16
  10. package/dist/commands/deploy/ship.js +8 -8
  11. package/dist/commands/deployments.js +8 -7
  12. package/dist/commands/dns.js +228 -242
  13. package/dist/commands/domains.js +188 -260
  14. package/dist/commands/emails.js +17 -17
  15. package/dist/commands/env.js +38 -38
  16. package/dist/commands/help.js +18 -19
  17. package/dist/commands/keys.js +83 -89
  18. package/dist/commands/login/flow.js +11 -11
  19. package/dist/commands/login/index.js +3 -3
  20. package/dist/commands/logout.js +11 -11
  21. package/dist/commands/mail.js +62 -62
  22. package/dist/commands/notifications.js +30 -29
  23. package/dist/commands/plan.js +109 -125
  24. package/dist/commands/projects.js +159 -157
  25. package/dist/commands/reference.js +109 -102
  26. package/dist/commands/search.js +29 -18
  27. package/dist/commands/server.js +99 -112
  28. package/dist/commands/sessions.js +38 -44
  29. package/dist/commands/sites.js +16 -16
  30. package/dist/commands/sms.js +14 -14
  31. package/dist/commands/status.js +9 -9
  32. package/dist/commands/support.js +19 -19
  33. package/dist/commands/update.js +18 -16
  34. package/dist/commands/usage.js +12 -12
  35. package/dist/commands/verify.js +16 -16
  36. package/dist/guide.js +9 -48
  37. package/dist/http/request.js +3 -3
  38. package/dist/pretty.js +4 -4
  39. package/dist/refresh-skills.js +5 -0
  40. package/dist/registry.js +72 -144
  41. package/dist/runtime/card-request.js +6 -6
  42. package/dist/runtime/confirm.js +1 -1
  43. package/dist/runtime/development.js +1 -1
  44. package/dist/runtime/dry-run.js +2 -2
  45. package/dist/runtime/env-file.js +6 -9
  46. package/dist/runtime/flags.js +11 -13
  47. package/dist/runtime/login-screen.js +5 -5
  48. package/dist/runtime/page.js +4 -4
  49. package/dist/runtime/server-options.js +4 -8
  50. package/dist/runtime/spinner.js +3 -1
  51. package/dist/runtime/support.js +2 -3
  52. package/dist/runtime/text-file.js +5 -5
  53. package/dist/runtime/timeout.js +2 -2
  54. package/dist/runtime/update-check.js +48 -14
  55. package/dist/runtime/update-install.js +34 -4
  56. package/dist/runtime/usage-error.js +2 -2
  57. package/dist/setup-agents.js +9 -2
  58. package/package.json +1 -1
@@ -22,85 +22,46 @@ const TOTAL = /^[1-9]\d{0,9}$/;
22
22
  const NO_AUTO_RENEW = '--no-auto-renew';
23
23
  const YES = '--yes';
24
24
  const SEOUL_OFFSET_MS = 9 * 3_600_000;
25
- const EXPIRY_WARNING = '만료일이 지나면 도메인이 만료됩니다. 만료된 도메인은 다른 사람이 먼저 가져갈 수 있고, 사이트 연결도 함께 끊깁니다.';
26
- const NO_PROJECT = '연결한 프로젝트 없음';
27
- const DNS_ONLY = '없음 (DNS만 관리, 사이트는 나중에 deepdynamic dns restore 로 연결)';
28
- const REMOVE_EFFECT = '소유 확인을 기다리는 등록이면 등록만 지웁니다. 연결한 도메인이면 DNS 존과 그 안의 레코드, HTTPS 인증서를 지우고 사이트가 이 도메인으로 열리지 않습니다.';
29
- const REMOVE_WARNING = '네임서버를 딥다이나믹으로 바꿨다면 도메인을 산 곳에서 네임서버를 되돌려야 메일 등 다른 레코드가 다시 응답합니다. CNAME 으로 연결했다면 추가한 CNAME 2개를 지우세요.';
30
- const DNS_LABELS = { ns: '네임서버 변경', cname: 'CNAME 연결' };
25
+ const EXPIRY_WARNING = 'The domain expires after its expiry date. Someone else can then register it first, and its site connection is cut as well.';
26
+ const NO_PROJECT = 'No project';
27
+ const DNS_ONLY = 'None (DNS only; connect a site later with deepdynamic dns restore)';
28
+ const REMOVE_EFFECT = 'A registration still waiting for the ownership check is only deleted. For a connected domain, its DNS zone, the records in it and its HTTPS certificate are deleted, and the site stops opening on the domain.';
29
+ const REMOVE_WARNING = 'If you changed the nameservers to DeepDynamic, change them back at your registrar so that mail and other records answer again. If you connected with CNAME, delete the 2 CNAME records you added.';
30
+ const DNS_LABELS = { ns: 'Nameservers', cname: 'CNAME records' };
31
31
  const VERIFIED = {
32
- ns: { pending: '소유를 확인했습니다. 네임서버 변경을 기다리고 있습니다.', ready: '소유를 확인했고 네임서버도 연결되었습니다.' },
33
- cname: { pending: '소유를 확인했습니다. CNAME 연결을 기다리고 있습니다.', ready: '소유를 확인했고 CNAME 도 연결되었습니다.' }
34
- };
35
- const PROJECT_NOT_FOUND = {
36
- code: 'project_not_found',
37
- message: 'You have no project with that name. Check the name with deepdynamic projects.',
38
- display: '그 이름의 내 프로젝트가 없습니다.'
39
- };
40
- const DOMAIN_NOT_FOUND = {
41
- code: 'domain_not_found',
42
- message: 'The domain is not in your domain list. Check it with deepdynamic domains.',
43
- display: '내 도메인 목록에 없는 도메인입니다.'
44
- };
45
- const DOMAIN_PURCHASED = {
46
- code: 'domain_purchased',
47
- message: 'The domain was bought through DeepDynamic and is already managed with deepdynamic domains and deepdynamic dns, so it cannot be registered as a domain bought elsewhere.',
48
- display: '딥다이나믹에서 구입한 도메인입니다. deepdynamic domains 와 deepdynamic dns 로 바로 관리할 수 있습니다.'
49
- };
50
- const DNS_LOOKUP_FAILED = supportFailure('dns_lookup_failed', { note: { en: 'Nothing was changed.', ko: '바뀐 것은 없습니다.' } });
51
- const CLAIM_NOT_FOUND = {
52
- code: 'claim_not_found',
53
- message: 'The domain is neither waiting for an ownership check nor connected to your account. Register it first with deepdynamic domains register <domain> [--project <project>]; a registration that is not verified within 7 days expires.',
54
- display: '소유 확인을 기다리는 도메인이 아닙니다. deepdynamic domains register 로 먼저 등록하세요.'
32
+ ns: { pending: 'Verified ownership. Waiting for the nameserver change.', ready: 'Verified ownership. The nameservers are connected.' },
33
+ cname: { pending: 'Verified ownership. Waiting for the CNAME records.', ready: 'Verified ownership. The CNAME records are connected.' }
55
34
  };
35
+ const failureOf = (code, message, display = message) => ({ code, message, display });
36
+ const PROJECT_NOT_FOUND = failureOf('project_not_found', 'You have no project with that name. Check the name with deepdynamic projects.');
37
+ const DOMAIN_NOT_FOUND = failureOf('domain_not_found', 'The domain is not in your domain list. Check it with deepdynamic domains.');
38
+ const DOMAIN_PURCHASED = failureOf('domain_purchased', 'The domain was bought through DeepDynamic and is already managed with deepdynamic domains and deepdynamic dns, so it cannot be registered as a domain bought elsewhere.', 'The domain was bought through DeepDynamic. Manage it directly with deepdynamic domains and deepdynamic dns.');
39
+ const DNS_LOOKUP_FAILED = supportFailure('dns_lookup_failed', { note: 'Nothing was changed.' });
40
+ const CLAIM_NOT_FOUND = failureOf('claim_not_found', 'The domain is neither waiting for an ownership check nor connected to your account. Register it first with deepdynamic domains register <domain> [--project <project>]; a registration that is not verified within 7 days expires.', 'The domain is not waiting for an ownership check. Register it first with deepdynamic domains register.');
56
41
  const REGISTER_FAILURES = {
57
42
  project_not_found: PROJECT_NOT_FOUND,
58
43
  domain_purchased: DOMAIN_PURCHASED,
59
- already_registered: {
60
- code: 'already_registered',
61
- message: 'The domain is already connected to your account. Check it with deepdynamic domains. To change its project or mode, disconnect it with deepdynamic domains remove <domain> --yes and register it again.',
62
- display: '이미 연결한 도메인입니다. 프로젝트나 연결 방식을 바꾸려면 deepdynamic domains remove 로 해제한 뒤 다시 등록하세요.'
63
- },
64
- limit_reached: {
65
- code: 'limit_reached',
66
- message: 'The account already has 10 domains bought elsewhere, counting the ones still waiting for the ownership check. Disconnect one with deepdynamic domains remove <domain> --yes first.',
67
- display: '다른 곳에서 산 도메인은 소유 확인을 기다리는 것까지 계정당 10개까지 연결할 수 있습니다.'
68
- },
69
- site_unavailable: {
70
- code: 'site_unavailable',
71
- message: 'The project name cannot be used as a site address. Rename the project with deepdynamic projects rename.',
72
- display: '이 프로젝트 이름으로는 사이트를 연결할 수 없습니다. deepdynamic projects rename 으로 이름을 바꾸세요.'
73
- },
44
+ already_registered: failureOf('already_registered', 'The domain is already connected to your account. Check it with deepdynamic domains. To change its project or mode, disconnect it with deepdynamic domains remove <domain> --yes and register it again.', 'The domain is already connected. To change its project or DNS mode, disconnect it with deepdynamic domains remove and register it again.'),
45
+ limit_reached: failureOf('limit_reached', 'The account already has 10 domains bought elsewhere, counting the ones still waiting for the ownership check. Disconnect one with deepdynamic domains remove <domain> --yes first.', 'An account can connect up to 10 domains bought elsewhere, including the ones waiting for the ownership check.'),
46
+ site_unavailable: failureOf('site_unavailable', 'The project name cannot be used as a site address. Rename the project with deepdynamic projects rename.'),
74
47
  dns_lookup_failed: DNS_LOOKUP_FAILED
75
48
  };
76
49
  const VERIFY_FAILURES = {
77
50
  claim_not_found: CLAIM_NOT_FOUND,
78
- txt_not_found: {
79
- code: 'txt_not_found',
80
- message: 'The ownership TXT record was not found. Show the user error.record and ask them to add it at the DNS provider where the domain was bought (name error.record.name, value error.record.value), then run deepdynamic domains verify <domain> again a few minutes later.',
81
- display: '소유 확인용 TXT 레코드를 찾지 못했습니다. 레코드를 추가했다면 몇 분 뒤 다시 실행하세요.'
82
- },
51
+ txt_not_found: failureOf('txt_not_found', 'The ownership TXT record was not found. Show the user error.record and ask them to add it at the DNS provider where the domain was bought (name error.record.name, value error.record.value), then run deepdynamic domains verify <domain> again a few minutes later.', 'The ownership TXT record was not found. If you added it, run the command again in a few minutes.'),
83
52
  domain_purchased: DOMAIN_PURCHASED,
84
53
  dns_lookup_failed: DNS_LOOKUP_FAILED
85
54
  };
86
55
  const REMOVE_FAILURES = {
87
56
  not_found: DOMAIN_NOT_FOUND,
88
- domain_purchased: {
89
- code: 'domain_purchased',
90
- message: 'The domain was bought through DeepDynamic, and only domains bought elsewhere can be disconnected.',
91
- display: '딥다이나믹에서 구입한 도메인은 연결을 해제할 수 없습니다.'
92
- }
57
+ domain_purchased: failureOf('domain_purchased', 'The domain was bought through DeepDynamic, and only domains bought elsewhere can be disconnected.', 'Domains bought through DeepDynamic cannot be disconnected.')
93
58
  };
94
59
  const AUTO_RENEW_FAILURES = {
95
- external_domain: {
96
- code: 'external_domain',
97
- message: 'The domain was bought elsewhere, so it renews at the registrar where it was bought. Tell the user to change auto-renew there.',
98
- display: '다른 곳에서 산 도메인입니다. 자동 갱신은 도메인을 산 곳에서 바꾸세요.'
99
- }
60
+ external_domain: failureOf('external_domain', 'The domain was bought elsewhere, so it renews at the registrar where it was bought. Tell the user to change auto-renew there.', 'The domain was bought elsewhere. Change auto-renew at the registrar where you bought it.')
100
61
  };
101
62
  const target = (name) => {
102
- const { usage, prettyUsage } = spec(name);
103
- return { command: name, usage, prettyUsage };
63
+ const { usage } = spec(name);
64
+ return { command: name, usage };
104
65
  };
105
66
  const LIST = target('domains');
106
67
  const SEARCH = target('domains search');
@@ -111,14 +72,11 @@ const VERIFY = target('domains verify');
111
72
  const REMOVE = target('domains remove');
112
73
  const AUTO_RENEW = target('domains auto-renew');
113
74
  const PAYMENT_FAILURES = {
114
- payment_declined: {
115
- code: 'payment_declined',
116
- message: 'The card company declined the payment, so nothing was charged or bought. reason holds its answer when it gave one. Ask the user to check the card or register another one, then run the same command again.',
117
- display: '카드사가 결제를 거절해 결제하지 않았습니다. 카드를 확인하거나 다른 카드를 등록한 뒤 다시 시도하세요.'
118
- },
119
- payment_unavailable: supportFailure('payment_unavailable', { note: { en: 'Nothing was charged or bought.', ko: '결제하지 않았습니다.' } })
75
+ payment_declined: failureOf('payment_declined', 'The card company declined the payment, so nothing was charged or bought. reason holds its answer when it gave one. Ask the user to check the card or register another one, then run the same command again.', 'The card company declined the payment, so nothing was charged. Check the card or register another one, then try again.'),
76
+ payment_unavailable: supportFailure('payment_unavailable', { note: 'Nothing was charged or bought.' })
120
77
  };
121
- const won = (amount) => `${amount.toLocaleString('ko-KR')}원`;
78
+ const krw = (amount) => `${amount.toLocaleString('en-US')} KRW`;
79
+ const counted = (count, noun) => `${count.toLocaleString('en-US')} ${noun}${count === 1 ? '' : 's'}`;
122
80
  const seoulToday = (now) => new Date(now.getTime() + SEOUL_OFFSET_MS).toISOString().slice(0, 10);
123
81
  const domainUrl = (siteUrl, domain, action) => new URL(`${DOMAINS_PATH}/${encodeURIComponent(domain)}/${action}`, siteUrl).href;
124
82
  const getWithToken = (url, token, deps, spinner) => request(url, { method: 'GET', headers: { authorization: `Bearer ${token}` } }, deps, spinner);
@@ -126,52 +84,45 @@ function addYears(date, years) {
126
84
  const [year, month, day] = date.split('-');
127
85
  return `${Number(year) + years}-${month}-${month === '02' && day === '29' ? '28' : day}`;
128
86
  }
129
- function dateLabel(date) {
130
- const [year, month, day] = date.slice(0, 10).split('-').map(Number);
131
- return `${year}년 ${month}월 ${day}일`;
132
- }
133
- const seoulDateLabel = (iso) => dateLabel(seoulToday(new Date(iso)));
134
- const recordRows = ({ name, value }) => [['TXT 이름', name], ['TXT 값', value]];
87
+ const dateLabel = (date) => date.slice(0, 10);
88
+ const seoulDateLabel = (iso) => seoulToday(new Date(iso));
89
+ const recordRows = ({ name, value }) => [['TXT name', name], ['TXT value', value]];
135
90
  const cnameRows = (connect) => (connect ?? []).map(({ name, value }) => ['CNAME', `${name} → ${value}`]);
136
- const connectionLabel = ({ dns, status }) => status === 'ready' ? '연결됨' : dns === 'ns' ? '네임서버 변경 대기' : 'CNAME 연결 대기';
91
+ const connectionLabel = ({ dns, status }) => status === 'ready' ? 'connected' : dns === 'ns' ? 'awaiting nameserver change' : 'awaiting CNAME records';
137
92
  function domainLabel(item) {
138
93
  const project = item.project ?? NO_PROJECT;
139
94
  if (item.expiresAt)
140
- return `${project} · ${dateLabel(item.expiresAt)}까지 · 자동 갱신 ${item.autoRenew ? '켬' : '끔'}`;
95
+ return `${project} · until ${dateLabel(item.expiresAt)} · auto-renew ${item.autoRenew ? 'on' : 'off'}`;
141
96
  if (item.verification)
142
- return `${project} · 외부 도메인 · 소유 확인 대기 · ${seoulDateLabel(item.verification.expiresAt)}까지`;
143
- return `${project} · 외부 도메인 · ${connectionLabel(item)}`;
97
+ return `${project} · external · awaiting ownership check · verify by ${seoulDateLabel(item.verification.expiresAt)}`;
98
+ return `${project} · external · ${connectionLabel(item)}`;
144
99
  }
145
100
  const txtRecordOf = (result) => ('failure' in result ? undefined : result.body?.record);
146
- function parseDomain(input, pretty) {
101
+ function parseDomain(input) {
147
102
  if (input === undefined || input.startsWith('-'))
148
- return { error: pretty ? '도메인을 지정하세요. 예: example.com' : 'Specify the domain, such as example.com.' };
103
+ return { error: 'Specify the domain, such as example.com.' };
149
104
  const domain = cleanDomain(input);
150
- return isDomain(domain) ? domain : { error: pretty ? '도메인 형식으로 적으세요. 예: example.com' : 'Write the domain in a form such as example.com.' };
105
+ return isDomain(domain) ? domain : { error: 'Write the domain in a form such as example.com.' };
151
106
  }
152
- function parseProject(value, pretty) {
107
+ function parseProject(value) {
153
108
  if (value === undefined)
154
109
  return null;
155
110
  if (PROJECT.test(value))
156
111
  return value;
157
- return {
158
- error: pretty
159
- ? '--project 의 프로젝트 이름은 영문 소문자·숫자로 시작하고 끝나는 1~63자의 소문자·숫자·하이픈입니다.'
160
- : '--project must be a project name of 1-63 lowercase letters, digits or hyphens that starts and ends with a letter or digit.'
161
- };
112
+ return { error: '--project must be a project name of 1-63 lowercase letters, digits or hyphens that starts and ends with a letter or digit.' };
162
113
  }
163
- function flagValues(args, flags, pretty) {
164
- const parsed = parseFlags(args, flags, pretty);
114
+ function flagValues(args, flags) {
115
+ const parsed = parseFlags(args, flags);
165
116
  if ('error' in parsed)
166
117
  return parsed;
167
118
  const repeated = flags.find((flag) => parsed.entries.filter(([name]) => name === flag).length > 1);
168
119
  if (repeated)
169
- return { error: pretty ? `${repeated} 는 한 번만 지정하세요.` : `Give ${repeated} once.` };
120
+ return { error: `Give ${repeated} once.` };
170
121
  return { values: Object.fromEntries(parsed.entries) };
171
122
  }
172
- function invalid({ command, usage, prettyUsage }, error, pretty, depth) {
123
+ function invalid({ command, usage }, error, pretty, depth) {
173
124
  return pretty
174
- ? prettyResult(2, depth, command, error, [['사용법', prettyUsage]])
125
+ ? prettyResult(2, depth, command, error, [['Usage', usage]])
175
126
  : agentResult(2, { command, error: { code: 'invalid_arguments', message: error }, usage });
176
127
  }
177
128
  async function planned(target, prepared, pretty, deps) {
@@ -192,23 +143,23 @@ function domainFailure(result, notFound, known = {}) {
192
143
  if (result.status === 401)
193
144
  return LOGIN_EXPIRED;
194
145
  if (result.status === 403)
195
- return { code: 'login_required', message: 'The access token is not allowed to do this. Run deepdynamic login again.', display: '이 로그인으로는 할 수 없습니다. deepdynamic login 으로 다시 로그인하세요.' };
146
+ return failureOf('login_required', 'The access token is not allowed to do this. Run deepdynamic login again.');
196
147
  if (result.status === 404)
197
148
  return notFound;
198
149
  if (result.status === 400) {
199
150
  return result.body?.unsupportedTld === true
200
- ? { code: 'unsupported_tld', message: `The TLD is not supported. List supported TLDs with ${TLDS_HELP}.`, display: '지원하지 않는 TLD 입니다.', retryable: false }
201
- : { code: 'invalid_arguments', message: 'The server rejected the request. Check the arguments against the command help.', display: '요청 내용을 확인하세요.' };
151
+ ? { ...failureOf('unsupported_tld', `The TLD is not supported. List supported TLDs with ${TLDS_HELP}.`), retryable: false }
152
+ : failureOf('invalid_arguments', 'The server rejected the request. Check the arguments against the command help.');
202
153
  }
203
154
  if (result.status === 409) {
204
155
  return result.body?.total
205
- ? { code: 'price_changed', message: 'The price changed. Check the new total and run again with it.', display: '결제 금액이 바뀌었습니다.' }
206
- : { code: 'domain_unavailable', message: 'The domain cannot be bought.', display: '살 수 없는 도메인입니다.' };
156
+ ? failureOf('price_changed', 'The price changed. Check the new total and run again with it.')
157
+ : failureOf('domain_unavailable', 'The domain cannot be bought.');
207
158
  }
208
159
  if (result.status === 422)
209
160
  return supportFailure('registration_rejected');
210
161
  if (result.status === 429)
211
- return { code: 'rate_limited', message: 'Too many requests. Try again in a minute.', display: '요청이 너무 많습니다.' };
162
+ return failureOf('rate_limited', 'Too many requests. Try again in a minute.');
212
163
  return httpFailure(result.status);
213
164
  }
214
165
  function errorBody(result, failure) {
@@ -223,85 +174,77 @@ function errorBody(result, failure) {
223
174
  }
224
175
  function failed(target, result, failure, pretty, depth, siteUrl, message, extra = {}, rows = []) {
225
176
  return pretty
226
- ? prettyResult(1, depth, target.command, message, [['서버', siteUrl], ['원인', failure.display], ...rows])
177
+ ? prettyResult(1, depth, target.command, message, [['Server', siteUrl], ['Reason', failure.display], ...rows])
227
178
  : agentResult(1, { command: target.command, siteUrl, ...extra, error: errorBody(result, failure) });
228
179
  }
229
180
  export async function runDomainsList(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
230
181
  const { args: rest, dryRun } = splitDryRun(args);
231
- const page = parsePage(rest, pretty);
182
+ const page = parsePage(rest);
232
183
  if (typeof page !== 'number')
233
184
  return invalid(LIST, page.error, pretty, depth);
234
185
  const listUrl = (siteUrl) => `${new URL(DOMAINS_PATH, siteUrl).href}?page=${page}`;
235
186
  if (dryRun) {
236
187
  return planned(LIST, {
237
- steps: [{ stage: 'prepare_request', message: '보유 도메인 목록 요청을 준비하고 있습니다.' }],
188
+ steps: [{ stage: 'prepare_request', message: 'Preparing the domain list request.' }],
238
189
  finish: (siteUrl) => plannedRequest(LIST.command, pretty, depth, siteUrl, listUrl(siteUrl))
239
190
  }, pretty, deps);
240
191
  }
241
- const sent = await authorized(deps, ({ siteUrl, token }) => getWithToken(listUrl(siteUrl), token, deps, pretty ? '도메인 목록을 불러오고 있습니다.' : null));
192
+ const sent = await authorized(deps, ({ siteUrl, token }) => getWithToken(listUrl(siteUrl), token, deps, pretty ? 'Loading domains.' : null));
242
193
  if ('login' in sent)
243
194
  return sent.login;
244
195
  const { session: { siteUrl }, result } = sent;
245
196
  const failure = domainFailure(result, httpFailure(404));
246
197
  if (failure)
247
- return failed(LIST, result, failure, pretty, depth, siteUrl, '도메인 목록을 불러오지 못했습니다.');
198
+ return failed(LIST, result, failure, pretty, depth, siteUrl, 'Could not load the domain list.');
248
199
  const { domains, ...paged } = result.body;
249
200
  const paging = pagination(paged, LIST.command);
250
201
  if (!pretty)
251
202
  return agentResult(0, { command: LIST.command, siteUrl, ...paging, domains });
252
- return prettyResult(0, depth, LIST.command, domains.length ? `도메인 ${domains.length}개를 불러왔습니다.` : '구입하거나 연결한 도메인이 없습니다.', [
253
- ['서버', siteUrl],
203
+ return prettyResult(0, depth, LIST.command, domains.length ? `Loaded ${counted(domains.length, 'domain')}.` : 'You have no bought or connected domains.', [
204
+ ['Server', siteUrl],
254
205
  ...domains.map((item) => [item.domain, domainLabel(item)]),
255
206
  ...pageRows(paging)
256
207
  ]);
257
208
  }
258
- function searchName(input, pretty) {
209
+ function searchName(input) {
259
210
  if (input === undefined || input.startsWith('-'))
260
- return { error: pretty ? '검색할 이름을 지정하세요. 예: my-brand' : 'Specify the name to search, such as my-brand.' };
211
+ return { error: 'Specify the name to search, such as my-brand.' };
261
212
  const name = cleanDomain(input);
262
213
  if (!LABEL.test(name.split('.')[0])) {
263
- return {
264
- error: pretty
265
- ? '영문 소문자·숫자·하이픈으로 63자 이내로 적으세요. 하이픈으로 시작하거나 끝날 수 없습니다.'
266
- : 'The name must be up to 63 lowercase letters, digits or hyphens and cannot start or end with a hyphen. A suffix such as .com may follow.'
267
- };
214
+ return { error: 'The name must be up to 63 lowercase letters, digits or hyphens and cannot start or end with a hyphen. A suffix such as .com may follow.' };
268
215
  }
269
216
  return name;
270
217
  }
271
- function searchTlds(name, value, pretty) {
218
+ function searchTlds(name, value) {
272
219
  if (value === undefined)
273
220
  return null;
274
221
  if (name.includes('.'))
275
- return { error: pretty ? '이름에 TLD 를 붙였으면 --tlds 는 지정하지 마세요.' : 'Do not give --tlds when the name already has a TLD.' };
222
+ return { error: 'Do not give --tlds when the name already has a TLD.' };
276
223
  const tlds = value.trim().toLowerCase();
277
224
  if (TLDS_VALUE.test(tlds) && new Set(tlds.split(',')).size <= DOMAIN_SEARCH_MAX_TLDS)
278
225
  return tlds;
279
- return {
280
- error: pretty
281
- ? `--tlds 에는 site,online 처럼 TLD 를 쉼표로 ${DOMAIN_SEARCH_MAX_TLDS}개까지 지정하세요.`
282
- : `--tlds must be up to ${DOMAIN_SEARCH_MAX_TLDS} comma-separated TLDs, such as site,online.`
283
- };
226
+ return { error: `--tlds must be up to ${DOMAIN_SEARCH_MAX_TLDS} comma-separated TLDs, such as site,online.` };
284
227
  }
285
228
  function priceLabel(price, renewalPrice, minYears) {
286
- const term = minYears > 1 ? ` / ${minYears}년 · ${minYears}년부터 등록` : ' / 1년';
287
- const renewal = renewalPrice && renewalPrice.amount !== price.amount ? ` · 갱신 ${won(renewalPrice.amount)}` : '';
288
- return `${won(price.amount)}${term}${renewal}`;
229
+ const term = minYears > 1 ? ` / ${counted(minYears, 'year')} · ${minYears}-year minimum` : ' / 1 year';
230
+ const renewal = renewalPrice && renewalPrice.amount !== price.amount ? ` · renewal ${krw(renewalPrice.amount)}` : '';
231
+ return `${krw(price.amount)}${term}${renewal}`;
289
232
  }
290
233
  function searchLabel({ available, premium, price, renewalPrice, minYears }) {
291
234
  if (!available)
292
- return '사용 중';
293
- return `${premium ? '프리미엄' : '등록 가능'}${price ? ` · ${priceLabel(price, renewalPrice, minYears)}` : ''}`;
235
+ return 'taken';
236
+ return `${premium ? 'premium' : 'available'}${price ? ` · ${priceLabel(price, renewalPrice, minYears)}` : ''}`;
294
237
  }
295
238
  export async function runDomainsSearch(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
296
239
  const { args: rest, dryRun } = splitDryRun(args);
297
240
  const [input, ...options] = rest;
298
- const name = searchName(input, pretty);
241
+ const name = searchName(input);
299
242
  if (typeof name !== 'string')
300
243
  return invalid(SEARCH, name.error, pretty, depth);
301
- const flags = flagValues(options, ['--tlds'], pretty);
244
+ const flags = flagValues(options, ['--tlds']);
302
245
  if ('error' in flags)
303
246
  return invalid(SEARCH, flags.error, pretty, depth);
304
- const tlds = searchTlds(name, flags.values['--tlds'], pretty);
247
+ const tlds = searchTlds(name, flags.values['--tlds']);
305
248
  if (tlds !== null && typeof tlds !== 'string')
306
249
  return invalid(SEARCH, tlds.error, pretty, depth);
307
250
  const searchUrl = (siteUrl) => {
@@ -314,91 +257,85 @@ export async function runDomainsSearch(args, pretty, depth, deps = defaultAuthDe
314
257
  const siteUrl = await loginSiteUrl();
315
258
  if (dryRun) {
316
259
  await rehearse(SEARCH.command, [
317
- { stage: 'validate_name', message: '도메인 이름 형식을 확인하고 있습니다.' },
318
- { stage: 'prepare_request', message: '검색 요청을 준비하고 있습니다.' }
260
+ { stage: 'validate_name', message: 'Checking the domain name format.' },
261
+ { stage: 'prepare_request', message: 'Preparing the search request.' }
319
262
  ], pretty, deps.stream, deps.pause);
320
263
  return plannedRequest(SEARCH.command, pretty, depth, siteUrl, searchUrl(siteUrl));
321
264
  }
322
- const result = await request(searchUrl(siteUrl), { method: 'GET' }, deps, pretty ? '등록 가능 여부를 조회하고 있습니다.' : null);
265
+ const result = await request(searchUrl(siteUrl), { method: 'GET' }, deps, pretty ? 'Checking availability.' : null);
323
266
  const failure = domainFailure(result, httpFailure(404));
324
267
  if (failure)
325
- return failed(SEARCH, result, failure, pretty, depth, siteUrl, '등록 가능 여부를 조회하지 못했습니다.', { name });
268
+ return failed(SEARCH, result, failure, pretty, depth, siteUrl, 'Could not check availability.', { name });
326
269
  const results = result.body.results;
327
270
  if (!pretty)
328
271
  return agentResult(0, { command: SEARCH.command, siteUrl, name, results });
329
- return prettyResult(0, depth, SEARCH.command, results.length ? '등록 가능 여부를 조회했습니다.' : '조회 결과를 받지 못했습니다. 잠시 후 다시 검색하세요.', [
330
- ['서버', siteUrl],
272
+ return prettyResult(0, depth, SEARCH.command, results.length ? 'Checked availability.' : 'No results came back. Search again in a moment.', [
273
+ ['Server', siteUrl],
331
274
  ...results.map((item) => [item.domain, searchLabel(item)]),
332
- ...(results.some(({ available }) => available) ? [['구입', `deepdynamic domains buy <도메인> [--project <프로젝트>]`]] : [])
275
+ ...(results.some(({ available }) => available) ? [['Buy', 'deepdynamic domains buy <domain> [--project <project>]']] : [])
333
276
  ]);
334
277
  }
335
278
  export async function runDomainsTlds(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
336
279
  const { args: rest, dryRun } = splitDryRun(args);
337
280
  if (rest.length)
338
- return invalid(TLDS, unknownArgument(rest[0], pretty), pretty, depth);
281
+ return invalid(TLDS, unknownArgument(rest[0]), pretty, depth);
339
282
  const siteUrl = await loginSiteUrl();
340
283
  const url = new URL(`${DOMAINS_PATH}/tlds`, siteUrl).href;
341
284
  if (dryRun) {
342
- await rehearse(TLDS.command, [{ stage: 'prepare_request', message: '지원 TLD 목록 요청을 준비하고 있습니다.' }], pretty, deps.stream, deps.pause);
285
+ await rehearse(TLDS.command, [{ stage: 'prepare_request', message: 'Preparing the supported TLD list request.' }], pretty, deps.stream, deps.pause);
343
286
  return plannedRequest(TLDS.command, pretty, depth, siteUrl, url);
344
287
  }
345
- const result = await request(url, { method: 'GET' }, deps, pretty ? '지원 TLD 목록을 불러오고 있습니다.' : null);
288
+ const result = await request(url, { method: 'GET' }, deps, pretty ? 'Loading supported TLDs.' : null);
346
289
  const failure = domainFailure(result, httpFailure(404));
347
290
  if (failure)
348
- return failed(TLDS, result, failure, pretty, depth, siteUrl, '지원 TLD 목록을 불러오지 못했습니다.');
291
+ return failed(TLDS, result, failure, pretty, depth, siteUrl, 'Could not load the supported TLDs.');
349
292
  const tlds = result.body.tlds;
350
293
  if (!pretty)
351
294
  return agentResult(0, { command: TLDS.command, siteUrl, tlds });
352
- return prettyResult(0, depth, TLDS.command, `지원 TLD ${tlds.length}개를 불러왔습니다.`, [
353
- ['서버', siteUrl],
295
+ return prettyResult(0, depth, TLDS.command, `Loaded ${counted(tlds.length, 'supported TLD')}.`, [
296
+ ['Server', siteUrl],
354
297
  ...tlds.map(({ tld, recommended, price, renewalPrice, minYears }) => [
355
298
  `.${tld}`,
356
- `${priceLabel(price, renewalPrice, minYears)}${recommended ? ' · 추천' : ''}`
299
+ `${priceLabel(price, renewalPrice, minYears)}${recommended ? ' · recommended' : ''}`
357
300
  ])
358
301
  ]);
359
302
  }
360
- function parseBuy(rest, pretty) {
303
+ function parseBuy(rest) {
361
304
  const autoRenew = !rest.includes(NO_AUTO_RENEW);
362
305
  const consented = rest.includes(YES);
363
306
  const [input, ...options] = rest.filter((arg) => arg !== NO_AUTO_RENEW && arg !== YES);
364
- const domain = parseDomain(input, pretty);
307
+ const domain = parseDomain(input);
365
308
  if (typeof domain !== 'string')
366
309
  return domain;
367
310
  const tld = domain.slice(domain.indexOf('.') + 1);
368
- const flags = flagValues(options, ['--project', '--years', '--total'], pretty);
311
+ const flags = flagValues(options, ['--project', '--years', '--total']);
369
312
  if ('error' in flags)
370
313
  return flags;
371
- const project = parseProject(flags.values['--project'], pretty);
314
+ const project = parseProject(flags.values['--project']);
372
315
  if (project !== null && typeof project !== 'string')
373
316
  return project;
374
317
  const minYears = DOMAIN_MIN_YEARS[tld] ?? 1;
375
318
  const term = flags.values['--years'] ?? String(minYears);
376
319
  if (!YEARS.test(term))
377
- return { error: pretty ? '--years 에는 1, 2, 3 중 하나를 지정하세요.' : '--years must be 1, 2 or 3.' };
378
- if (Number(term) < minYears) {
379
- return {
380
- error: pretty
381
- ? `.${tld} 도메인은 ${minYears}년부터 등록할 수 있습니다. --years 를 ${minYears} 이상으로 지정하세요.`
382
- : `.${tld} domains need a term of at least ${minYears} years. Give --years ${minYears} or more.`
383
- };
384
- }
320
+ return { error: '--years must be 1, 2 or 3.' };
321
+ if (Number(term) < minYears)
322
+ return { error: `.${tld} domains need a term of at least ${minYears} years. Give --years ${minYears} or more.` };
385
323
  const total = flags.values['--total'];
386
324
  if (total !== undefined && !TOTAL.test(total))
387
- return { error: pretty ? '--total 에는 원 단위 결제 금액을 숫자로 지정하세요. 예: 17900' : '--total must be the total in won, such as 17900.' };
388
- if (consented && total === undefined) {
389
- return { error: pretty ? '--yes 와 함께 확인한 결제 금액을 --total 로 지정하세요.' : 'Give --total with the amount you confirmed together with --yes.' };
390
- }
325
+ return { error: '--total must be the total in won, such as 17900.' };
326
+ if (consented && total === undefined)
327
+ return { error: 'Give --total with the amount you confirmed together with --yes.' };
391
328
  return { domain, project, years: Number(term), autoRenew, consented, total: total === undefined ? null : Number(total) };
392
329
  }
393
330
  function quoteRows(quote, until) {
394
331
  return [
395
- ['도메인', quote.domain],
396
- ['연결할 프로젝트', quote.project ?? DNS_ONLY],
397
- ['등록 기간', `${quote.years}년`],
398
- ['사용 기간', `${dateLabel(until)}까지`],
399
- ['자동 갱신', quote.autoRenew ? `켬 (${dateLabel(until)}에 자동 갱신)` : `끔 (${dateLabel(until)}에 만료)`],
400
- ['결제 금액', won(quote.total.amount)],
401
- ...(quote.premium ? [['가격', '레지스트리가 따로 정한 프리미엄 가격입니다.']] : [])
332
+ ['Domain', quote.domain],
333
+ ['Project', quote.project ?? DNS_ONLY],
334
+ ['Term', counted(quote.years, 'year')],
335
+ ['Valid until', dateLabel(until)],
336
+ ['Auto-renew', quote.autoRenew ? `on (renews on ${dateLabel(until)})` : `off (expires on ${dateLabel(until)})`],
337
+ ['Total', krw(quote.total.amount)],
338
+ ...(quote.premium ? [['Price', 'Premium price set by the registry.']] : [])
402
339
  ];
403
340
  }
404
341
  function echoesRequest(parsed, body) {
@@ -408,7 +345,7 @@ function echoesRequest(parsed, body) {
408
345
  }
409
346
  export async function runDomainsBuy(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
410
347
  const { args: rest, dryRun } = splitDryRun(args);
411
- const parsed = parseBuy(rest, pretty);
348
+ const parsed = parseBuy(rest);
412
349
  if ('error' in parsed)
413
350
  return invalid(BUY, parsed.error, pretty, depth);
414
351
  const purchase = !dryRun && parsed.consented;
@@ -419,28 +356,24 @@ export async function runDomainsBuy(args, pretty, depth, deps = defaultAuthDeps(
419
356
  autoRenew: parsed.autoRenew,
420
357
  ...(purchase ? { total: parsed.total } : { dryRun: true })
421
358
  };
422
- const sent = await authorized(deps, ({ siteUrl, token }) => postJson(new URL(`${DOMAINS_PATH}/purchase`, siteUrl).href, token, payload, deps, pretty ? (purchase ? '도메인을 구입하고 있습니다.' : '결제 금액을 확인하고 있습니다.') : null));
359
+ const sent = await authorized(deps, ({ siteUrl, token }) => postJson(new URL(`${DOMAINS_PATH}/purchase`, siteUrl).href, token, payload, deps, pretty ? (purchase ? 'Buying the domain.' : 'Checking the total.') : null));
423
360
  if ('login' in sent)
424
361
  return sent.login;
425
362
  const { session, result } = sent;
426
363
  const { siteUrl } = session;
427
364
  if (cardRequired(result))
428
365
  return requestCard(BUY.command, pretty, depth, session, deps, { domain: parsed.domain });
429
- const failure = domainFailure(result, {
430
- code: 'project_not_found',
431
- message: 'You have no project with that name. Create it with deepdynamic projects create <name>.',
432
- display: '그 이름의 내 프로젝트가 없습니다.'
433
- }, PAYMENT_FAILURES) ?? (purchase || echoesRequest(parsed, result.body) ? null : UNEXPECTED);
366
+ const failure = domainFailure(result, failureOf('project_not_found', 'You have no project with that name. Create it with deepdynamic projects create <name>.'), PAYMENT_FAILURES) ?? (purchase || echoesRequest(parsed, result.body) ? null : UNEXPECTED);
434
367
  if (failure) {
435
368
  const answer = 'failure' in result || failure === UNEXPECTED ? null : result.body;
436
369
  const total = answer?.total;
437
370
  const reason = failure.code === 'payment_declined' && typeof answer?.reason === 'string' ? answer.reason : null;
438
371
  return pretty
439
- ? prettyResult(1, depth, BUY.command, purchase ? '도메인을 구입하지 못했습니다.' : '결제 금액을 확인하지 못했습니다.', [
440
- ['서버', siteUrl],
441
- ['원인', failure.display],
442
- ...(reason ? [['카드사 응답', reason]] : []),
443
- ...(total ? [['새 결제 금액', won(total.amount)]] : [])
372
+ ? prettyResult(1, depth, BUY.command, purchase ? 'Could not buy the domain.' : 'Could not check the total.', [
373
+ ['Server', siteUrl],
374
+ ['Reason', failure.display],
375
+ ...(reason ? [['Card response', reason]] : []),
376
+ ...(total ? [['New total', krw(total.amount)]] : [])
444
377
  ])
445
378
  : agentResult(1, { command: BUY.command, siteUrl, domain: parsed.domain, ...(total ? { total } : {}), ...(reason ? { reason } : {}), error: errorBody(result, failure) });
446
379
  }
@@ -450,16 +383,16 @@ export async function runDomainsBuy(args, pretty, depth, deps = defaultAuthDeps(
450
383
  const retry = `deepdynamic domains buy ${quote.domain}${quote.project === null ? '' : ` --project ${quote.project}`} --years ${quote.years}${quote.autoRenew ? '' : ' --no-auto-renew'} --yes --total ${quote.total.amount}`;
451
384
  if (purchase) {
452
385
  return pretty
453
- ? prettyResult(0, depth, BUY.command, `${quote.domain} 도메인을 구입했습니다.`, [['서버', siteUrl], ...quoteRows(quote, until)])
386
+ ? prettyResult(0, depth, BUY.command, `Bought ${quote.domain}.`, [['Server', siteUrl], ...quoteRows(quote, until)])
454
387
  : agentResult(0, { command: BUY.command, siteUrl, ...quote, expiresAt: until });
455
388
  }
456
389
  if (dryRun) {
457
390
  return pretty
458
- ? prettyResult(0, depth, BUY.command, '결제 금액을 확인했습니다. 구입하지 않았습니다.', [['서버', siteUrl], ...quoteRows(quote, until), ['구입', retry]])
391
+ ? prettyResult(0, depth, BUY.command, 'Checked the total. Nothing was bought.', [['Server', siteUrl], ...quoteRows(quote, until), ['Run', retry]])
459
392
  : agentResult(0, { command: BUY.command, siteUrl, dryRun: true, applied: false, ...quote, expiresAt: until, next: retry });
460
393
  }
461
394
  return pretty
462
- ? prettyResult(3, depth, BUY.command, '결제 동의가 필요합니다. 금액을 확인했다면 아래 명령으로 다시 실행하세요.', [['서버', siteUrl], ...quoteRows(quote, until), ['구입', retry]])
395
+ ? prettyResult(3, depth, BUY.command, 'Payment consent is required. Check the total, then run the command below.', [['Server', siteUrl], ...quoteRows(quote, until), ['Run', retry]])
463
396
  : agentResult(3, {
464
397
  command: BUY.command,
465
398
  siteUrl,
@@ -468,32 +401,27 @@ export async function runDomainsBuy(args, pretty, depth, deps = defaultAuthDeps(
468
401
  error: { code: 'confirmation_required', message: `Show the user the total, and after they agree run: ${retry}`, next: retry, retryable: false }
469
402
  });
470
403
  }
471
- function parseRegister(rest, pretty) {
404
+ function parseRegister(rest) {
472
405
  const [input, ...options] = rest;
473
- const domain = parseDomain(input, pretty);
406
+ const domain = parseDomain(input);
474
407
  if (typeof domain !== 'string')
475
408
  return domain;
476
- const flags = flagValues(options, ['--project', '--dns', '--site'], pretty);
409
+ const flags = flagValues(options, ['--project', '--dns', '--site']);
477
410
  if ('error' in flags)
478
411
  return flags;
479
- const project = parseProject(flags.values['--project'], pretty);
412
+ const project = parseProject(flags.values['--project']);
480
413
  if (project !== null && typeof project !== 'string')
481
414
  return project;
482
415
  const dns = flags.values['--dns'] ?? 'ns';
483
416
  if (dns !== 'ns' && dns !== 'cname')
484
- return { error: pretty ? '--dns 에는 ns 또는 cname 을 지정하세요.' : '--dns must be ns or cname.' };
485
- if (dns === 'cname' && project === null) {
486
- return { error: pretty ? '--dns cname 은 --project 와 함께 지정하세요. 프로젝트 없이 연결하려면 --dns ns 를 씁니다.' : '--dns cname needs --project. Use --dns ns to connect without a project.' };
487
- }
417
+ return { error: '--dns must be ns or cname.' };
418
+ if (dns === 'cname' && project === null)
419
+ return { error: '--dns cname needs --project. Use --dns ns to connect without a project.' };
488
420
  const site = flags.values['--site'];
489
421
  if (site === '@' && dns !== 'cname')
490
- return { error: pretty ? '--site @ 는 --dns cname 과 함께만 쓸 수 있습니다.' : '--site @ works only with --dns cname.' };
422
+ return { error: '--site @ works only with --dns cname.' };
491
423
  if (site !== undefined && site !== '@' && !LABEL.test(site)) {
492
- return {
493
- error: pretty
494
- ? '--site 에는 www 처럼 영문 소문자·숫자·하이픈으로 된 1~63자 이름을 지정하세요. --dns cname 이면 @ 도 쓸 수 있습니다.'
495
- : '--site must be a label of 1-63 lowercase letters, digits or hyphens such as www, or @ with --dns cname.'
496
- };
424
+ return { error: '--site must be a label of 1-63 lowercase letters, digits or hyphens such as www, or @ with --dns cname.' };
497
425
  }
498
426
  return { domain, project, dns, site: site ?? null };
499
427
  }
@@ -502,11 +430,11 @@ function plannedHost({ domain, dns, site }) {
502
430
  return domain;
503
431
  if (site)
504
432
  return `${site}.${domain}`;
505
- return dns === 'ns' ? `www.${domain}` : `www.${domain} 또는 ${domain} (최상위 도메인이면 www 를 붙이고, 하위 도메인이면 그대로 씁니다)`;
433
+ return dns === 'ns' ? `www.${domain}` : `www.${domain} or ${domain} (www is added to an apex domain; a subdomain is used as is)`;
506
434
  }
507
435
  export async function runDomainsRegister(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
508
436
  const { args: rest, dryRun } = splitDryRun(args);
509
- const parsed = parseRegister(rest, pretty);
437
+ const parsed = parseRegister(rest);
510
438
  if ('error' in parsed)
511
439
  return invalid(REGISTER, parsed.error, pretty, depth);
512
440
  const { domain, project, dns, site } = parsed;
@@ -515,27 +443,27 @@ export async function runDomainsRegister(args, pretty, depth, deps = defaultAuth
515
443
  if (dryRun) {
516
444
  return planned(REGISTER, {
517
445
  steps: [
518
- { stage: 'validate_domain', message: '도메인 형식을 확인하고 있습니다.' },
519
- { stage: 'validate_project', message: '연결할 프로젝트 이름을 확인하고 있습니다.' },
520
- { stage: 'validate_dns', message: '연결 방식과 사이트 이름을 확인하고 있습니다.' },
521
- { stage: 'prepare_request', message: '등록 요청을 준비하고 있습니다.' }
446
+ { stage: 'validate_domain', message: 'Checking the domain format.' },
447
+ { stage: 'validate_project', message: 'Checking the project name.' },
448
+ { stage: 'validate_dns', message: 'Checking the DNS mode and site name.' },
449
+ { stage: 'prepare_request', message: 'Preparing the registration request.' }
522
450
  ],
523
- finish: (siteUrl) => plannedChange(REGISTER.command, pretty, depth, siteUrl, { url: new URL(DOMAINS_PATH, siteUrl).href, body: payload }, '등록 내용을 확인했습니다. 등록하지 않았습니다.', [
524
- ['도메인', domain],
525
- ['연결할 프로젝트', project ?? DNS_ONLY],
526
- ['연결 방식', DNS_LABELS[dns]],
527
- ['사이트 주소', plannedHost(parsed)],
528
- ['안내', `등록하면 서버가 소유 확인용 TXT 레코드를 만들어 돌려줍니다. 도메인을 산 곳의 DNS 설정에 그 레코드를 추가한 뒤 ${next} 로 소유를 확인합니다.`]
451
+ finish: (siteUrl) => plannedChange(REGISTER.command, pretty, depth, siteUrl, { url: new URL(DOMAINS_PATH, siteUrl).href, body: payload }, 'Checked the registration. Nothing was registered.', [
452
+ ['Domain', domain],
453
+ ['Project', project ?? DNS_ONLY],
454
+ ['DNS mode', DNS_LABELS[dns]],
455
+ ['Site URL', plannedHost(parsed)],
456
+ ['Notice', `Registering makes the server create an ownership TXT record and return it. Add that record in the DNS settings at your registrar, then verify ownership with ${next}.`]
529
457
  ], { domain, project, dns, site })
530
458
  }, pretty, deps);
531
459
  }
532
- const sent = await authorized(deps, ({ siteUrl, token }) => postJson(new URL(DOMAINS_PATH, siteUrl).href, token, payload, deps, pretty ? '도메인을 등록하고 있습니다.' : null));
460
+ const sent = await authorized(deps, ({ siteUrl, token }) => postJson(new URL(DOMAINS_PATH, siteUrl).href, token, payload, deps, pretty ? 'Registering the domain.' : null));
533
461
  if ('login' in sent)
534
462
  return sent.login;
535
463
  const { session: { siteUrl }, result } = sent;
536
464
  const failure = domainFailure(result, PROJECT_NOT_FOUND, REGISTER_FAILURES);
537
465
  if (failure)
538
- return failed(REGISTER, result, failure, pretty, depth, siteUrl, '도메인을 등록하지 못했습니다.', { domain });
466
+ return failed(REGISTER, result, failure, pretty, depth, siteUrl, 'Could not register the domain.', { domain });
539
467
  const registered = result.body;
540
468
  const view = {
541
469
  domain: registered.domain,
@@ -548,64 +476,64 @@ export async function runDomainsRegister(args, pretty, depth, deps = defaultAuth
548
476
  };
549
477
  if (!pretty)
550
478
  return agentResult(0, { command: REGISTER.command, siteUrl, ...view, next });
551
- return prettyResult(0, depth, REGISTER.command, `${view.domain} 도메인을 등록했습니다. 소유 확인용 TXT 레코드를 추가하세요.`, [
552
- ['서버', siteUrl],
553
- ['도메인', view.domain],
554
- ['연결할 프로젝트', view.project ?? DNS_ONLY],
555
- ['연결 방식', DNS_LABELS[view.dns]],
556
- ['사이트 주소', view.siteHost],
479
+ return prettyResult(0, depth, REGISTER.command, `Registered ${view.domain}. Add the ownership TXT record.`, [
480
+ ['Server', siteUrl],
481
+ ['Domain', view.domain],
482
+ ['Project', view.project ?? DNS_ONLY],
483
+ ['DNS mode', DNS_LABELS[view.dns]],
484
+ ['Site URL', view.siteHost],
557
485
  ...recordRows(view.record),
558
- ['확인 기한', `${seoulDateLabel(view.expiresAt)}까지`],
486
+ ['Verify by', seoulDateLabel(view.expiresAt)],
559
487
  view.dns === 'ns'
560
- ? ['소유 확인 뒤', '도메인을 산 곳에서 네임서버를 바꿔야 연결됩니다. 바꿀 네임서버는 소유를 확인할 때 알려 줍니다.']
561
- : ['소유 확인 뒤', '도메인을 산 곳의 DNS 설정에 아래 CNAME 2개도 추가해야 연결됩니다.'],
488
+ ? ['After verification', 'Change the nameservers at your registrar to connect the domain. The nameservers to use are shown when ownership is verified.']
489
+ : ['After verification', 'Also add the 2 CNAME records below in the DNS settings at your registrar to connect the domain.'],
562
490
  ...cnameRows(view.connect),
563
- ['다음', `도메인을 산 곳의 DNS 설정에 TXT 레코드를 추가한 뒤 ${next} 로 소유를 확인하세요.`]
491
+ ['Next', `Add the TXT record in the DNS settings at your registrar, then verify ownership with ${next}.`]
564
492
  ]);
565
493
  }
566
494
  function connectionRows({ domain, dns, status, nameservers, connect, imported }) {
567
495
  if (status === 'ready')
568
496
  return [];
569
497
  if (dns === 'cname') {
570
- return [...cnameRows(connect), ['다음', `도메인을 산 곳의 DNS 설정에 위 CNAME 2개를 추가하세요. 추가하면 5분마다 자동으로 확인하고, deepdynamic domains verify ${domain} 로 바로 다시 확인할 수도 있습니다.`]];
498
+ return [...cnameRows(connect), ['Next', `Add the 2 CNAME records above in the DNS settings at your registrar. They are checked automatically every 5 minutes, or run deepdynamic domains verify ${domain} to check now.`]];
571
499
  }
572
500
  return [
573
501
  ...(nameservers
574
- ? nameservers.map((nameserver) => ['네임서버', nameserver])
575
- : [['네임서버', `아직 만들지 못했습니다. 몇 분 뒤 deepdynamic domains verify ${domain} 로 다시 확인하세요.`]]),
576
- ...(imported > 0 ? [['가져온 레코드', `${imported}개`]] : []),
577
- ['주의', `네임서버를 바꾸기 전에 deepdynamic dns records ${domain} 로 옮겨 온 레코드를 확인하고, 빠진 레코드(메일·하위 도메인 등)는 deepdynamic dns add 로 추가하세요. 네임서버를 바꾸면 기존 DNS 의 레코드는 더 이상 응답하지 않습니다.`],
578
- ['다음', `도메인을 산 곳에서 네임서버를 위 주소로 바꾸세요. 바꾸면 5분마다 자동으로 확인하고, deepdynamic domains verify ${domain} 로 바로 다시 확인할 수도 있습니다.`]
502
+ ? nameservers.map((nameserver) => ['Nameservers', nameserver])
503
+ : [['Nameservers', `Not created yet. Run deepdynamic domains verify ${domain} again in a few minutes.`]]),
504
+ ...(imported > 0 ? [['Imported', counted(imported, 'record')]] : []),
505
+ ['Warning', `Before changing the nameservers, check the imported records with deepdynamic dns records ${domain} and add any missing ones (mail, subdomains and so on) with deepdynamic dns add. Once the nameservers change, the records at the old DNS provider stop answering.`],
506
+ ['Next', `Change the nameservers at your registrar to the ones above. They are checked automatically every 5 minutes, or run deepdynamic domains verify ${domain} to check now.`]
579
507
  ];
580
508
  }
581
509
  export async function runDomainsVerify(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
582
510
  const { args: rest, dryRun } = splitDryRun(args);
583
511
  const [input, ...extra] = rest;
584
- const domain = parseDomain(input, pretty);
512
+ const domain = parseDomain(input);
585
513
  if (typeof domain !== 'string')
586
514
  return invalid(VERIFY, domain.error, pretty, depth);
587
515
  if (extra.length)
588
- return invalid(VERIFY, unknownArgument(extra[0], pretty), pretty, depth);
516
+ return invalid(VERIFY, unknownArgument(extra[0]), pretty, depth);
589
517
  if (dryRun) {
590
518
  return planned(VERIFY, {
591
519
  steps: [
592
- { stage: 'validate_domain', message: '도메인 형식을 확인하고 있습니다.' },
593
- { stage: 'prepare_request', message: '소유 확인 요청을 준비하고 있습니다.' }
520
+ { stage: 'validate_domain', message: 'Checking the domain format.' },
521
+ { stage: 'prepare_request', message: 'Preparing the ownership check request.' }
594
522
  ],
595
- finish: (siteUrl) => plannedChange(VERIFY.command, pretty, depth, siteUrl, { url: domainUrl(siteUrl, domain, 'verify'), body: {} }, '소유 확인 요청을 확인했습니다. 요청하지 않았습니다.', [
596
- ['도메인', domain],
597
- ['확인', `_deepdynamic.${domain} TXT 레코드로 소유를 확인하고 도메인을 연결합니다. 이미 연결한 도메인이면 네임서버나 CNAME 연결만 다시 확인합니다.`]
523
+ finish: (siteUrl) => plannedChange(VERIFY.command, pretty, depth, siteUrl, { url: domainUrl(siteUrl, domain, 'verify'), body: {} }, 'Checked the ownership check request. Nothing was sent.', [
524
+ ['Domain', domain],
525
+ ['Impact', `Verifies ownership with the _deepdynamic.${domain} TXT record and connects the domain. For a domain that is already connected, only the nameservers or CNAME records are checked again.`]
598
526
  ], { domain })
599
527
  }, pretty, deps);
600
528
  }
601
- const sent = await authorized(deps, ({ siteUrl, token }) => postJson(domainUrl(siteUrl, domain, 'verify'), token, {}, deps, pretty ? '소유와 연결을 확인하고 있습니다.' : null));
529
+ const sent = await authorized(deps, ({ siteUrl, token }) => postJson(domainUrl(siteUrl, domain, 'verify'), token, {}, deps, pretty ? 'Checking ownership and connection.' : null));
602
530
  if ('login' in sent)
603
531
  return sent.login;
604
532
  const { session: { siteUrl }, result } = sent;
605
533
  const failure = domainFailure(result, CLAIM_NOT_FOUND, VERIFY_FAILURES);
606
534
  if (failure) {
607
535
  const record = failure.code === 'txt_not_found' ? txtRecordOf(result) : undefined;
608
- return failed(VERIFY, result, failure, pretty, depth, siteUrl, '소유를 확인하지 못했습니다.', { domain }, record ? recordRows(record) : []);
536
+ return failed(VERIFY, result, failure, pretty, depth, siteUrl, 'Could not verify ownership.', { domain }, record ? recordRows(record) : []);
609
537
  }
610
538
  const body = result.body;
611
539
  const view = {
@@ -621,12 +549,12 @@ export async function runDomainsVerify(args, pretty, depth, deps = defaultAuthDe
621
549
  if (!pretty)
622
550
  return agentResult(0, { command: VERIFY.command, siteUrl, ...view });
623
551
  return prettyResult(0, depth, VERIFY.command, VERIFIED[view.dns][view.status], [
624
- ['서버', siteUrl],
625
- ['도메인', view.domain],
626
- ['프로젝트', view.project ?? NO_PROJECT],
627
- ['연결 방식', DNS_LABELS[view.dns]],
628
- ['사이트 주소', view.siteHost],
629
- ['상태', connectionLabel(view)],
552
+ ['Server', siteUrl],
553
+ ['Domain', view.domain],
554
+ ['Project', view.project ?? NO_PROJECT],
555
+ ['DNS mode', DNS_LABELS[view.dns]],
556
+ ['Site URL', view.siteHost],
557
+ ['Status', connectionLabel(view)],
630
558
  ...connectionRows(view)
631
559
  ]);
632
560
  }
@@ -634,68 +562,68 @@ export async function runDomainsRemove(args, pretty, depth, deps = defaultAuthDe
634
562
  const { args: plain, dryRun } = splitDryRun(args);
635
563
  const { args: rest, yes } = splitYes(plain);
636
564
  const [input, ...extra] = rest;
637
- const domain = parseDomain(input, pretty);
565
+ const domain = parseDomain(input);
638
566
  if (typeof domain !== 'string')
639
567
  return invalid(REMOVE, domain.error, pretty, depth);
640
568
  if (extra.length)
641
- return invalid(REMOVE, unknownArgument(extra[0], pretty), pretty, depth);
569
+ return invalid(REMOVE, unknownArgument(extra[0]), pretty, depth);
642
570
  if (dryRun) {
643
571
  return planned(REMOVE, {
644
572
  steps: [
645
- { stage: 'validate_domain', message: '도메인 형식을 확인하고 있습니다.' },
646
- { stage: 'review_impact', message: '연결을 해제하면 달라지는 점을 정리하고 있습니다.' },
647
- { stage: 'prepare_request', message: '연결 해제 요청을 준비하고 있습니다.' }
573
+ { stage: 'validate_domain', message: 'Checking the domain format.' },
574
+ { stage: 'review_impact', message: 'Reviewing what disconnecting changes.' },
575
+ { stage: 'prepare_request', message: 'Preparing the disconnect request.' }
648
576
  ],
649
- finish: (siteUrl) => plannedChange(REMOVE.command, pretty, depth, siteUrl, { url: domainUrl(siteUrl, domain, 'remove'), body: {} }, '연결 해제를 확인했습니다. 해제하지 않았습니다.', [['도메인', domain], ['해제', REMOVE_EFFECT], ['주의', REMOVE_WARNING]], { domain })
577
+ finish: (siteUrl) => plannedChange(REMOVE.command, pretty, depth, siteUrl, { url: domainUrl(siteUrl, domain, 'remove'), body: {} }, 'Checked the disconnect. Nothing was disconnected.', [['Domain', domain], ['Impact', REMOVE_EFFECT], ['Warning', REMOVE_WARNING]], { domain })
650
578
  }, pretty, deps);
651
579
  }
652
580
  if (!yes) {
653
581
  return confirmationRequired(REMOVE.command, [domain], pretty, depth, {
654
582
  message: 'Removing deletes the DNS zone, its records and the HTTPS certificate of the domain, and the site stops opening on it.',
655
- display: '연결을 해제하면 이 도메인의 DNS 존과 레코드, HTTPS 인증서가 지워지고 사이트가 이 도메인으로 열리지 않습니다. 사용자에게 확인한 뒤 --yes 를 붙여 실행하세요.'
583
+ display: 'Disconnecting deletes the DNS zone, its records and the HTTPS certificate of this domain, and the site stops opening on it. Confirm with the user, then run it again with --yes.'
656
584
  }, { domain });
657
585
  }
658
- const sent = await authorized(deps, ({ siteUrl, token }) => postJson(domainUrl(siteUrl, domain, 'remove'), token, {}, deps, pretty ? '도메인 연결을 해제하고 있습니다.' : null));
586
+ const sent = await authorized(deps, ({ siteUrl, token }) => postJson(domainUrl(siteUrl, domain, 'remove'), token, {}, deps, pretty ? 'Disconnecting the domain.' : null));
659
587
  if ('login' in sent)
660
588
  return sent.login;
661
589
  const { session: { siteUrl }, result } = sent;
662
590
  const failure = domainFailure(result, DOMAIN_NOT_FOUND, REMOVE_FAILURES);
663
591
  if (failure)
664
- return failed(REMOVE, result, failure, pretty, depth, siteUrl, '도메인 연결을 해제하지 못했습니다.', { domain });
592
+ return failed(REMOVE, result, failure, pretty, depth, siteUrl, 'Could not disconnect the domain.', { domain });
665
593
  return pretty
666
- ? prettyResult(0, depth, REMOVE.command, `${domain} 연결을 해제했습니다.`, [['서버', siteUrl], ['도메인', domain], ['주의', REMOVE_WARNING]])
594
+ ? prettyResult(0, depth, REMOVE.command, `Disconnected ${domain}.`, [['Server', siteUrl], ['Domain', domain], ['Warning', REMOVE_WARNING]])
667
595
  : agentResult(0, { command: REMOVE.command, siteUrl, domain, removed: true });
668
596
  }
669
597
  export async function runDomainsAutoRenew(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
670
598
  const { args: plain, dryRun } = splitDryRun(args);
671
599
  const { args: rest, yes } = splitYes(plain);
672
600
  const [input, state, ...extra] = rest;
673
- const domain = parseDomain(input, pretty);
601
+ const domain = parseDomain(input);
674
602
  if (typeof domain !== 'string')
675
603
  return invalid(AUTO_RENEW, domain.error, pretty, depth);
676
604
  if (state !== 'on' && state !== 'off')
677
- return invalid(AUTO_RENEW, pretty ? '도메인 뒤에 on 또는 off 를 지정하세요.' : 'Give on or off after the domain.', pretty, depth);
605
+ return invalid(AUTO_RENEW, 'Give on or off after the domain.', pretty, depth);
678
606
  if (extra.length)
679
- return invalid(AUTO_RENEW, unknownArgument(extra[0], pretty), pretty, depth);
607
+ return invalid(AUTO_RENEW, unknownArgument(extra[0]), pretty, depth);
680
608
  const enabled = state === 'on';
681
- const effect = enabled ? [] : [['주의', EXPIRY_WARNING]];
609
+ const effect = enabled ? [] : [['Warning', EXPIRY_WARNING]];
682
610
  if (dryRun) {
683
611
  return planned(AUTO_RENEW, {
684
612
  steps: [
685
- { stage: 'validate_domain', message: '도메인 형식을 확인하고 있습니다.' },
686
- { stage: 'plan_renewal', message: '만료 영향을 정리하고 있습니다.' },
687
- { stage: 'prepare_request', message: '자동 갱신 변경 요청을 준비하고 있습니다.' }
613
+ { stage: 'validate_domain', message: 'Checking the domain format.' },
614
+ { stage: 'plan_renewal', message: 'Reviewing the expiry impact.' },
615
+ { stage: 'prepare_request', message: 'Preparing the auto-renew change request.' }
688
616
  ],
689
- finish: (siteUrl) => plannedChange(AUTO_RENEW.command, pretty, depth, siteUrl, { url: domainUrl(siteUrl, domain, 'auto-renew'), body: { enabled } }, '자동 갱신 변경을 확인했습니다. 바꾸지 않았습니다.', [['도메인', domain], ['바꿀 설정', enabled ? '자동 갱신 켜기' : '자동 갱신 끄기'], ...effect], { domain, autoRenew: enabled })
617
+ finish: (siteUrl) => plannedChange(AUTO_RENEW.command, pretty, depth, siteUrl, { url: domainUrl(siteUrl, domain, 'auto-renew'), body: { enabled } }, 'Checked the auto-renew change. Nothing was changed.', [['Domain', domain], ['Change', enabled ? 'Turn auto-renew on' : 'Turn auto-renew off'], ...effect], { domain, autoRenew: enabled })
690
618
  }, pretty, deps);
691
619
  }
692
620
  if (!enabled && !yes) {
693
621
  return confirmationRequired(AUTO_RENEW.command, [domain, state], pretty, depth, {
694
622
  message: 'Turning auto-renew off lets the domain expire at the end of its term.',
695
- display: '끄면 사용 기간이 끝날 때 도메인이 만료됩니다. 사용자에게 확인한 뒤 --yes 를 붙여 실행하세요.'
623
+ display: 'Turning auto-renew off lets the domain expire at the end of its term. Confirm with the user, then run it again with --yes.'
696
624
  }, { domain });
697
625
  }
698
- const sent = await authorized(deps, ({ siteUrl, token }) => postJson(domainUrl(siteUrl, domain, 'auto-renew'), token, { enabled }, deps, pretty ? '자동 갱신을 바꾸고 있습니다.' : null));
626
+ const sent = await authorized(deps, ({ siteUrl, token }) => postJson(domainUrl(siteUrl, domain, 'auto-renew'), token, { enabled }, deps, pretty ? 'Changing auto-renew.' : null));
699
627
  if ('login' in sent)
700
628
  return sent.login;
701
629
  const { session, result } = sent;
@@ -704,8 +632,8 @@ export async function runDomainsAutoRenew(args, pretty, depth, deps = defaultAut
704
632
  return requestCard(AUTO_RENEW.command, pretty, depth, session, deps, { domain });
705
633
  const failure = domainFailure(result, DOMAIN_NOT_FOUND, AUTO_RENEW_FAILURES);
706
634
  if (failure)
707
- return failed(AUTO_RENEW, result, failure, pretty, depth, siteUrl, '자동 갱신을 바꾸지 못했습니다.', { domain });
635
+ return failed(AUTO_RENEW, result, failure, pretty, depth, siteUrl, 'Could not change auto-renew.', { domain });
708
636
  return pretty
709
- ? prettyResult(0, depth, AUTO_RENEW.command, enabled ? '자동 갱신을 켰습니다.' : '자동 갱신을 껐습니다.', [['서버', siteUrl], ['도메인', domain], ...effect])
637
+ ? prettyResult(0, depth, AUTO_RENEW.command, enabled ? 'Turned auto-renew on.' : 'Turned auto-renew off.', [['Server', siteUrl], ['Domain', domain], ...effect])
710
638
  : agentResult(0, { command: AUTO_RENEW.command, siteUrl, domain, autoRenew: enabled });
711
639
  }