@deepdynamic/cli 0.1.0 → 0.1.2

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 +28 -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 +229 -243
  13. package/dist/commands/domains.js +188 -260
  14. package/dist/commands/emails.js +64 -26
  15. package/dist/commands/env.js +38 -38
  16. package/dist/commands/help.js +18 -19
  17. package/dist/commands/keys.js +84 -90
  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 +82 -69
  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 +139 -112
  26. package/dist/commands/search.js +29 -18
  27. package/dist/commands/server.js +100 -112
  28. package/dist/commands/sessions.js +38 -44
  29. package/dist/commands/sites.js +16 -16
  30. package/dist/commands/sms.js +31 -17
  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 +74 -146
  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 +40 -5
  56. package/dist/runtime/usage-error.js +2 -2
  57. package/dist/setup-agents.js +9 -2
  58. package/package.json +1 -1
@@ -7,7 +7,7 @@ import { spec } from "../registry.js";
7
7
  import { plannedRequest, splitDryRun } from "../runtime/dry-run.js";
8
8
  import { parseServerArgs } from "../runtime/server-options.js";
9
9
  export const SEARCH_PATH = '/api/v1/search';
10
- const { name: command, usage, prettyUsage } = spec('search');
10
+ const { name: command, usage } = spec('search');
11
11
  function isPageInfo(body) {
12
12
  const info = body;
13
13
  return info?.ok === true
@@ -19,42 +19,53 @@ function searchablePages(body) {
19
19
  const pages = body?.pages;
20
20
  return Array.isArray(pages) && pages.every((page) => typeof page === 'string') ? pages : null;
21
21
  }
22
- function parseSearchArgs(args, pretty) {
22
+ function normalizePage(raw) {
23
+ const segments = [];
24
+ for (const segment of raw.split('/')) {
25
+ if (segment === '..')
26
+ segments.pop();
27
+ else if (segment && segment !== '.')
28
+ segments.push(segment);
29
+ }
30
+ return `/${segments.join('/')}`;
31
+ }
32
+ const searchUrl = (page, siteUrl) => new URL(`${SEARCH_PATH}${page.split('/').filter(Boolean).map((segment) => `/${encodeURIComponent(segment)}`).join('')}`, siteUrl);
33
+ function parseSearchArgs(args) {
23
34
  const first = args[0];
24
35
  if (first === undefined || first.startsWith('-') || !first.trim()) {
25
- return { error: pretty ? '조회할 페이지 경로를 지정하세요. 예: deepdynamic search /pricing' : 'A page path is required, for example: deepdynamic search /pricing' };
36
+ return { error: 'A page path is required, for example: deepdynamic search /pricing' };
26
37
  }
27
- const server = parseServerArgs(args.slice(1), pretty);
28
- return 'error' in server ? server : { page: first.startsWith('/') ? first : `/${first}`, siteUrl: server.siteUrl };
38
+ const server = parseServerArgs(args.slice(1));
39
+ return 'error' in server ? server : { page: normalizePage(first), siteUrl: server.siteUrl };
29
40
  }
30
41
  export async function runSearch(args, pretty, depth, deps = defaultDeps()) {
31
42
  const { args: rest, dryRun } = splitDryRun(args);
32
- const options = parseSearchArgs(rest, pretty);
43
+ const options = parseSearchArgs(rest);
33
44
  if ('error' in options) {
34
45
  return pretty
35
- ? prettyResult(2, depth, command, options.error, [['사용법', prettyUsage]])
46
+ ? prettyResult(2, depth, command, options.error, [['Usage', usage]])
36
47
  : agentResult(2, { command, error: { code: 'invalid_arguments', message: options.error }, usage });
37
48
  }
38
49
  const siteUrl = options.siteUrl ?? await readLoginSiteUrl() ?? SITE_URL;
39
- const endpoint = new URL(`${SEARCH_PATH}/${encodeURIComponent(options.page)}`, siteUrl);
50
+ const endpoint = searchUrl(options.page, siteUrl);
40
51
  if (dryRun)
41
52
  return plannedRequest(command, pretty, depth, siteUrl, endpoint.href);
42
- const result = await request(endpoint.href, { method: 'GET' }, deps, pretty ? '페이지 정보를 불러오고 있습니다.' : null);
53
+ const result = await request(endpoint.href, { method: 'GET' }, deps, pretty ? 'Loading page info.' : null);
43
54
  if ('failure' in result || result.status !== 200 || !isPageInfo(result.body)) {
44
55
  const pages = 'failure' in result || result.status !== 404 ? null : searchablePages(result.body);
45
56
  const failure = 'failure' in result
46
57
  ? result.failure
47
58
  : result.status === 404
48
- ? { code: 'page_not_found', message: `No searchable page at ${options.page}.`, display: '검색할 수 없는 페이지입니다.' }
59
+ ? { code: 'page_not_found', message: `No searchable page at ${options.page}.`, display: `No searchable page at ${options.page}.` }
49
60
  : result.status !== 200
50
61
  ? httpFailure(result.status)
51
62
  : UNEXPECTED;
52
63
  return pretty
53
- ? prettyResult(1, depth, command, '페이지 정보를 불러오지 못했습니다.', [
54
- ['서버', siteUrl],
55
- ['페이지', options.page],
56
- ['원인', failure.display],
57
- ...(pages ? [['검색 가능', pages.join(', ')]] : [])
64
+ ? prettyResult(1, depth, command, 'Could not load page info.', [
65
+ ['Server', siteUrl],
66
+ ['Page', options.page],
67
+ ['Reason', failure.display],
68
+ ...(pages ? [['Searchable', pages.join(', ')]] : [])
58
69
  ])
59
70
  : agentResult(1, {
60
71
  command,
@@ -67,9 +78,9 @@ export async function runSearch(args, pretty, depth, deps = defaultDeps()) {
67
78
  if (!pretty) {
68
79
  return agentResult(0, { command, siteUrl, page, url, markdown });
69
80
  }
70
- return prettyResult(0, depth, command, `${page.replace(CONTROL, ' ')} 페이지 정보를 불러왔습니다.`, [
71
- ['서버', siteUrl],
72
- ['주소', url.replace(CONTROL, ' ')],
81
+ return prettyResult(0, depth, command, `Loaded page info for ${page.replace(CONTROL, ' ')}.`, [
82
+ ['Server', siteUrl],
83
+ ['URL', url.replace(CONTROL, ' ')],
73
84
  ...markdown.trimEnd().split('\n').map((line) => ['', line.replace(CONTROL, ' ')])
74
85
  ]);
75
86
  }
@@ -19,102 +19,88 @@ const STARTING_LIMIT = AUTOPILOT_LIMITS[1];
19
19
  const LIST = spec('server');
20
20
  const SET = spec('server set');
21
21
  const AUTOPILOT = spec('server autopilot');
22
- const RESTART = '적용하면 서버가 재시작되어 1분 안팎으로 사이트가 멈춥니다. 꺼져 있는 서버는 다음에 켤 때 반영됩니다.';
23
- const SERVER_STATES = { running: '실행 중', stopped: '꺼짐', preparing: '서버 준비 중', failed: '서버 준비 실패' };
24
- const PROJECT_NOT_FOUND = {
25
- code: 'project_not_found',
26
- message: 'You have no active project with that name. Check it with deepdynamic server.',
27
- display: '그 이름의 내 프로젝트를 찾을 수 없습니다.'
28
- };
29
- const SERVER_UNAVAILABLE = supportFailure('server_unavailable', { note: { en: 'Nothing was changed.', ko: '바뀐 것은 없습니다.' } });
30
- const UNREACHABLE = supportFailure('server_unreachable', { note: { en: 'Nothing was read or changed.', ko: '읽거나 바꾼 것은 없습니다.' } });
22
+ const RESTART = 'Applying restarts the server, so the site stops for about a minute. A stopped server picks up the change the next time it starts.';
23
+ const SERVER_STATES = { running: 'Running', stopped: 'Stopped', preparing: 'Preparing', failed: 'Setup failed' };
24
+ const failure = (code, message) => ({ code, message, display: message });
25
+ const PROJECT_NOT_FOUND = failure('project_not_found', 'You have no active project with that name. Check it with deepdynamic server.');
26
+ const SERVER_UNAVAILABLE = supportFailure('server_unavailable', { note: 'Nothing was changed.' });
27
+ const UNREACHABLE = supportFailure('server_unreachable', { note: 'Nothing was read or changed.' });
31
28
  const LIST_FAILURES = {
32
29
  server_unreachable: UNREACHABLE,
33
30
  list_failed: supportFailure('list_failed')
34
31
  };
32
+ const AUTOPILOT_UNPAID = failure('unpaid_charges', 'The account has unpaid charges, so autopilot was not turned on. Pay them with deepdynamic plan pay, then run the same command again.');
35
33
  const SET_FAILURES = {
36
34
  server_unreachable: UNREACHABLE,
37
- autopilot_on: {
38
- code: 'autopilot_on',
39
- message: 'Autopilot is on, so the spec cannot be changed by hand. Turn it off first with deepdynamic server autopilot off.',
40
- display: '오토파일럿이 켜져 있는 동안에는 사양을 직접 바꿀 수 없습니다. 먼저 deepdynamic server autopilot off 로 끄세요.'
41
- },
42
- server_not_ready: {
43
- code: 'server_not_ready',
44
- message: 'The project server is not ready yet. Check it with deepdynamic server and retry once it is running or stopped.',
45
- display: '서버가 준비된 뒤에 사양을 바꿀 수 있습니다. deepdynamic server 로 상태를 확인하세요.'
46
- },
47
- server_busy: {
48
- code: 'server_busy',
49
- message: 'The server is busy with a restart, update or deploy, or cannot take more CPU or RAM right now. Retry later.',
50
- display: '서버가 다른 작업을 하고 있거나 지금은 CPU·RAM 을 늘릴 수 없습니다. 잠시 후 다시 시도하세요.'
51
- },
52
- cpu_too_small: {
53
- code: 'cpu_too_small',
54
- message: 'With that few cores the current CPU use would go over 100%. Keep more cores.',
55
- display: '지금 CPU 사용량으로는 코어를 이만큼 줄일 수 없습니다.'
56
- },
57
- memory_too_small: {
58
- code: 'memory_too_small',
59
- message: 'The server uses more RAM than that. Keep more RAM.',
60
- display: '지금 쓰는 RAM보다 작게 줄일 수 없습니다.'
61
- }
35
+ autopilot_on: failure('autopilot_on', 'Autopilot is on, so the spec cannot be changed by hand. Turn it off first with deepdynamic server autopilot off.'),
36
+ server_not_ready: failure('server_not_ready', 'The project server is not ready yet. Check it with deepdynamic server and retry once it is running or stopped.'),
37
+ server_busy: failure('server_busy', 'The server is busy with a restart, update or deploy, or cannot take more CPU or RAM right now. Retry later.'),
38
+ cpu_too_small: failure('cpu_too_small', 'With that few cores the current CPU use would go over 100%. Keep more cores.'),
39
+ memory_too_small: failure('memory_too_small', 'The server uses more RAM than that. Keep more RAM.'),
40
+ unpaid_charges: failure('unpaid_charges', 'The account has unpaid charges, so the spec was not raised and nothing was charged. Pay them with deepdynamic plan pay, then run the same command again.'),
41
+ charge_pending: failure('charge_pending', 'A server options payment or another spec change is still in progress, so nothing was charged or changed. Retry a little later.'),
42
+ payment_declined: failure('payment_declined', 'The card company declined the payment for the difference, so nothing was charged or changed. Ask the user to check the card or register another one, then run the same command again.'),
43
+ payment_unavailable: supportFailure('payment_unavailable', { note: 'Nothing was charged or changed.' }),
44
+ spec_unconfirmed: failure('spec_unconfirmed', 'The change was sent, but the server did not confirm it in time. Do not retry yet: it is checked again within about 15 minutes, and if it was not applied, any difference charged is refunded automatically. Check the spec later with deepdynamic server.')
62
45
  };
63
46
  const LIST_STEPS = [
64
- { stage: 'check_options', message: '조회 옵션을 확인하고 있습니다.' },
65
- { stage: 'prepare_request', message: '서버 목록 요청을 준비하고 있습니다.' }
47
+ { stage: 'check_options', message: 'Checking the options.' },
48
+ { stage: 'prepare_request', message: 'Preparing the server list request.' }
66
49
  ];
67
50
  const SET_STEPS = [
68
- { stage: 'check_options', message: 'CPU와 RAM 옵션을 확인하고 있습니다.' },
69
- { stage: 'calculate_charge', message: '바꾼 뒤 월 추가 요금을 계산하고 있습니다.' },
70
- { stage: 'check_consent', message: '추가 요금 청구 동의를 확인하고 있습니다.' },
71
- { stage: 'prepare_request', message: '서버 사양 변경 요청을 준비하고 있습니다.' }
51
+ { stage: 'check_options', message: 'Checking the CPU and RAM options.' },
52
+ { stage: 'calculate_charge', message: 'Calculating the monthly extra charge after the change.' },
53
+ { stage: 'check_consent', message: 'Checking consent to the extra charge.' },
54
+ { stage: 'prepare_request', message: 'Preparing the server spec change request.' }
72
55
  ];
73
56
  const autopilotSteps = (enabled) => [
74
- { stage: 'check_options', message: '오토파일럿 설정을 확인하고 있습니다.' },
57
+ { stage: 'check_options', message: 'Checking the autopilot setting.' },
75
58
  enabled
76
- ? { stage: 'check_limit', message: '월 한도를 확인하고 있습니다.' }
77
- : { stage: 'check_manual_control', message: '사양 직접 변경 전환을 확인하고 있습니다.' },
78
- { stage: 'prepare_request', message: '오토파일럿 요청을 준비하고 있습니다.' }
59
+ ? { stage: 'check_limit', message: 'Checking the monthly limit.' }
60
+ : { stage: 'check_manual_control', message: 'Checking the switch to manual spec changes.' },
61
+ { stage: 'prepare_request', message: 'Preparing the autopilot request.' }
79
62
  ];
80
- const won = (amount) => `${amount.toLocaleString('ko-KR')}원`;
81
- const price = (amount) => amount ? `월 +${won(amount)}` : '기본 포함';
63
+ const won = (amount) => `${amount.toLocaleString('en-US')} KRW`;
64
+ const monthly = (amount) => `${won(amount)}/month`;
65
+ const price = (amount) => amount ? `+${monthly(amount)}` : 'No extra charge';
82
66
  const extraOf = (cores, memory) => (cores - 1) * CORE_PRICE + (memory - 1) * MEMORY_PRICE;
83
- const specText = (cores, memory) => `CPU ${cores}코어 · RAM ${memory}GB`;
84
- function pickFlags(args, flags, pretty) {
85
- const parsed = parseFlags(args, flags, pretty);
67
+ const coreCount = (cores) => `${cores} ${cores === 1 ? 'core' : 'cores'}`;
68
+ const specText = (cores, memory) => `CPU ${coreCount(cores)} · RAM ${memory}GB`;
69
+ const count = (amount, noun) => `${amount} ${noun}${amount === 1 ? '' : 's'}`;
70
+ function pickFlags(args, flags) {
71
+ const parsed = parseFlags(args, flags);
86
72
  if ('error' in parsed)
87
73
  return parsed;
88
74
  const repeated = parsed.entries.find(([flag], index) => parsed.entries.findIndex(([other]) => other === flag) !== index);
89
75
  if (repeated)
90
- return { error: pretty ? `${repeated[0]} 는 한 번만 지정하세요.` : `Give ${repeated[0]} only once.` };
76
+ return { error: `Give ${repeated[0]} only once.` };
91
77
  return { values: Object.fromEntries(parsed.entries) };
92
78
  }
93
- function oneOf(flag, value, choices, pretty) {
79
+ function oneOf(flag, value, choices) {
94
80
  if (value === undefined)
95
81
  return {};
96
82
  if (choices.includes(value))
97
83
  return { value: Number(value) };
98
- return { error: pretty ? `${flag} 에는 ${choices.join(', ')} 중 하나를 지정하세요: ${value}` : `${flag} must be one of ${choices.join(', ')}: ${value}` };
84
+ return { error: `${flag} must be one of ${choices.join(', ')}: ${value}` };
99
85
  }
100
- function parseSet(args, pretty) {
86
+ function parseSet(args) {
101
87
  const [project, ...rest] = args.filter((arg) => arg !== '--yes');
102
88
  if (project === undefined || project.startsWith('-'))
103
- return { error: pretty ? '프로젝트 이름을 먼저 지정하세요.' : 'Specify the project name first.' };
89
+ return { error: 'Specify the project name first.' };
104
90
  if (!PROJECT.test(project)) {
105
- return { error: pretty ? '프로젝트 이름은 영문 소문자·숫자로 시작하고 끝나는 1~63자의 소문자·숫자·하이픈입니다.' : 'Project names are 1-63 lowercase letters, digits or hyphens and start and end with a letter or digit.' };
91
+ return { error: 'Project names are 1-63 lowercase letters, digits or hyphens and start and end with a letter or digit.' };
106
92
  }
107
- const flags = pickFlags(rest, ['--cores', '--memory'], pretty);
93
+ const flags = pickFlags(rest, ['--cores', '--memory']);
108
94
  if ('error' in flags)
109
95
  return flags;
110
- const cores = oneOf('--cores', flags.values['--cores'], CORES, pretty);
96
+ const cores = oneOf('--cores', flags.values['--cores'], CORES);
111
97
  if ('error' in cores)
112
98
  return cores;
113
- const memory = oneOf('--memory', flags.values['--memory'], MEMORIES, pretty);
99
+ const memory = oneOf('--memory', flags.values['--memory'], MEMORIES);
114
100
  if ('error' in memory)
115
101
  return memory;
116
102
  if (cores.value === undefined && memory.value === undefined) {
117
- return { error: pretty ? '--cores 나 --memory 중 하나 이상을 지정하세요.' : 'Give --cores, --memory or both.' };
103
+ return { error: 'Give --cores, --memory or both.' };
118
104
  }
119
105
  return { project, cores: cores.value, memory: memory.value, consented: args.includes('--yes') };
120
106
  }
@@ -135,60 +121,60 @@ function setRows({ project, cpu, ram, monthlyExtra, consentRequired, consented }
135
121
  const known = (cpu?.monthlyExtra ?? 0) + (ram?.monthlyExtra ?? 0);
136
122
  const kept = cpu ? 'RAM' : 'CPU';
137
123
  const total = monthlyExtra !== null
138
- ? monthlyExtra ? `월 ${won(monthlyExtra)}` : '없음'
139
- : known ? `월 ${won(known)} + 지금 ${kept} 요금` : `지금 ${kept} 요금 그대로`;
140
- const charge = '지금 사양보다 늘어나면 그 금액이 다음 결제일부터 계정에 추가 요금으로 청구됩니다.';
124
+ ? monthlyExtra ? monthly(monthlyExtra) : 'None'
125
+ : known ? `${monthly(known)} + the current ${kept} charge` : `The current ${kept} charge only`;
126
+ const charge = 'Any increase over the current spec is billed to the account as an extra charge from the next billing date.';
141
127
  return [
142
- ['프로젝트', project],
143
- ['CPU', cpu ? `${cpu.cores}코어 · ${price(cpu.monthlyExtra)}` : '바꾸지 않음 (지금 그대로)'],
144
- ['RAM', ram ? `${ram.memoryGb}GB · ${price(ram.monthlyExtra)}` : '바꾸지 않음 (지금 그대로)'],
145
- ['바꾼 뒤 추가 요금', total],
146
- ['적용', RESTART],
147
- ['청구 동의', !consentRequired
148
- ? '필요 없습니다. 요금이 늘지 않는 변경입니다.'
149
- : consented ? `동의함 (--yes). ${charge}` : `필요합니다. ${charge} 금액에 동의하면 --yes 를 붙이세요.`],
150
- ['오토파일럿', '켜져 있으면 사양을 직접 바꿀 수 없습니다. 먼저 deepdynamic server autopilot off 로 끄세요.']
128
+ ['Project', project],
129
+ ['CPU', cpu ? `${coreCount(cpu.cores)} · ${price(cpu.monthlyExtra)}` : 'Unchanged (keeps the current setting)'],
130
+ ['RAM', ram ? `${ram.memoryGb}GB · ${price(ram.monthlyExtra)}` : 'Unchanged (keeps the current setting)'],
131
+ ['New extra charge', total],
132
+ ['Restart', RESTART],
133
+ ['Billing consent', !consentRequired
134
+ ? 'Not needed. This change does not raise the charge.'
135
+ : consented ? `Given (--yes). ${charge}` : `Required. ${charge} Add --yes once the user agrees to the amount.`],
136
+ ['Autopilot', 'While it is on, the spec cannot be changed by hand. Turn it off first with deepdynamic server autopilot off.']
151
137
  ];
152
138
  }
153
- function parseAutopilot(args, pretty) {
139
+ function parseAutopilot(args) {
154
140
  const [mode, ...rest] = args;
155
141
  if (mode !== 'on' && mode !== 'off')
156
- return { error: pretty ? 'on 또는 off 를 지정하세요.' : 'Specify on or off.' };
157
- const flags = pickFlags(rest, ['--limit'], pretty);
142
+ return { error: 'Specify on or off.' };
143
+ const flags = pickFlags(rest, ['--limit']);
158
144
  if ('error' in flags)
159
145
  return flags;
160
146
  const value = flags.values['--limit'];
161
147
  if (value === undefined)
162
148
  return mode === 'on' ? { enabled: true, limit: STARTING_LIMIT, defaulted: true } : { enabled: false, limit: null, defaulted: false };
163
149
  if (mode === 'off')
164
- return { error: pretty ? '--limit 은 on 과 함께만 지정할 수 있습니다.' : '--limit is only accepted with on.' };
150
+ return { error: '--limit is only accepted with on.' };
165
151
  const limit = AUTOPILOT_LIMITS.find((amount) => String(amount) === value);
166
152
  const choices = AUTOPILOT_LIMITS.join(', ');
167
153
  if (limit === undefined)
168
- return { error: pretty ? `--limit 에는 ${choices} 중 하나를 지정하세요: ${value}` : `--limit must be one of ${choices}: ${value}` };
154
+ return { error: `--limit must be one of ${choices}: ${value}` };
169
155
  return { enabled: true, limit, defaulted: false };
170
156
  }
171
157
  function autopilotRows(enabled, limit, defaulted) {
172
158
  if (!enabled || limit === null) {
173
159
  return [
174
- ['오토파일럿', '끄기'],
175
- ['자동 조정', '끄면 사양을 자동으로 올리거나 낮추지 않습니다.'],
176
- ['직접 변경', '끄면 deepdynamic server set 으로 CPU와 RAM을 직접 바꿀 수 있습니다.']
160
+ ['Autopilot', 'Turn off'],
161
+ ['Auto scaling', 'Turning it off stops scaling the spec up or down automatically.'],
162
+ ['Manual changes', 'Turning it off lets you change CPU and RAM with deepdynamic server set.']
177
163
  ];
178
164
  }
179
165
  return [
180
- ['오토파일럿', '켜기'],
181
- ['월 한도', defaulted ? `${won(limit)} (처음 한도, --limit 로 바꿀 수 있습니다)` : won(limit)],
182
- ['자동 조정', '사양이 부족하면 CPU와 RAM을 자동으로 올리고, 여유로워지면 다시 낮춥니다. 바꿀 때마다 서버가 잠시 재시작됩니다.'],
183
- ['한도 도달', '추가 요금은 월 한도 안에서만 청구되고, 한도에 이르면 더 올리지 않고 알림으로 먼저 알립니다.'],
184
- ['직접 변경', '켜져 있는 동안에는 deepdynamic server set 으로 사양을 직접 바꿀 수 없습니다.']
166
+ ['Autopilot', 'Turn on'],
167
+ ['Monthly limit', defaulted ? `${won(limit)} (starting limit, change it with --limit)` : won(limit)],
168
+ ['Auto scaling', 'Scales CPU and RAM up when the spec runs short and back down when there is room. The server restarts briefly on each change.'],
169
+ ['Limit reached', 'Extra charges are billed only within the monthly limit. At the limit, autopilot stops scaling up and sends a notification first.'],
170
+ ['Manual changes', 'While it is on, the spec cannot be changed with deepdynamic server set.']
185
171
  ];
186
172
  }
187
173
  function serverRow({ project, name, server, cores, memory, cpu, memoryUsed, restarting }) {
188
- const state = restarting ? '재시작 중' : SERVER_STATES[server] ?? server;
174
+ const state = restarting ? 'Restarting' : SERVER_STATES[server] ?? server;
189
175
  if (server !== 'running' && server !== 'stopped')
190
176
  return [project, `${name} · ${state}`];
191
- const usage = server === 'running' ? ` · 사용량 CPU ${cpu === null ? '측정 안 됨' : `${cpu}%`} · RAM ${memoryUsed === null ? '측정 안 됨' : `${memoryUsed}/${memory}GB`}` : '';
177
+ const usage = server === 'running' ? ` · Usage: CPU ${cpu === null ? 'not measured' : `${cpu}%`}, RAM ${memoryUsed === null ? 'not measured' : `${memoryUsed}/${memory}GB`}` : '';
192
178
  return [project, `${name} · ${state} · ${specText(cores, memory)} · ${price(extraOf(cores, memory))}${usage}`];
193
179
  }
194
180
  function listed(command, pretty, depth, body, siteUrl) {
@@ -196,25 +182,27 @@ function listed(command, pretty, depth, body, siteUrl) {
196
182
  const servers = aircraft.map(({ project, name, deploy, server, cores, memory, cpu, memoryUsed, restarting }) => ({ project, name, deploy, server, cores, memory, cpu, memoryUsed, restarting }));
197
183
  if (!pretty)
198
184
  return agentResult(0, { command, siteUrl, servers, monthlyExtra, currency: 'KRW', autopilot });
199
- return prettyResult(0, depth, command, servers.length ? `서버 ${servers.length}대를 불러왔습니다.` : '서버가 없습니다.', [
200
- ['서버', siteUrl],
185
+ return prettyResult(0, depth, command, servers.length ? `Loaded ${count(servers.length, 'server')}.` : 'No servers found.', [
186
+ ['Server', siteUrl],
201
187
  ...servers.map(serverRow),
202
- ['추가 요금 합계', `월 ${won(monthlyExtra)}`],
203
- ['오토파일럿', autopilot.enabled ? `켜짐 · 월 한도 ${won(autopilot.limit)}${autopilot.limitBlocked ? ' · 한도에 걸려 더 올리지 못함' : ''}` : '꺼짐']
188
+ ['Total extra charge', monthly(monthlyExtra)],
189
+ ['Autopilot', autopilot.enabled ? `On · Monthly limit ${won(autopilot.limit)}${autopilot.limitBlocked ? ' · Limit reached, not scaling up further' : ''}` : 'Off']
204
190
  ]);
205
191
  }
206
192
  function specApplied(command, pretty, depth, body, siteUrl) {
207
193
  const { project, cores, memory, monthlyExtra, previousMonthlyExtra, changed, restarting } = body;
194
+ const charged = typeof body.charged === 'number' ? body.charged : 0;
208
195
  if (!pretty)
209
- return agentResult(0, { command, siteUrl, applied: changed, project, cores, memory, monthlyExtra, previousMonthlyExtra, currency: 'KRW', restarting });
196
+ return agentResult(0, { command, siteUrl, applied: changed, project, cores, memory, monthlyExtra, previousMonthlyExtra, charged, currency: 'KRW', restarting });
210
197
  const message = !changed
211
- ? '지금 사양 그대로라 바꾸지 않았습니다.'
212
- : `${project} 서버를 ${specText(cores, memory)}로 바꿨습니다. ${restarting ? '서버가 재시작되고 있습니다.' : '다음에 켤 때 반영됩니다.'}`;
198
+ ? 'The server already has that spec. Nothing was changed.'
199
+ : `Changed the ${project} server to ${specText(cores, memory)}. ${restarting ? 'The server is restarting.' : 'The change applies the next time the server starts.'}`;
213
200
  return prettyResult(0, depth, command, message, [
214
- ['서버', siteUrl],
215
- ['프로젝트', project],
216
- ['사양', specText(cores, memory)],
217
- ['월 추가 요금', `${won(monthlyExtra)} (이전 ${won(previousMonthlyExtra)})`]
201
+ ['Server', siteUrl],
202
+ ['Project', project],
203
+ ['Spec', specText(cores, memory)],
204
+ ['Monthly extra charge', `${won(monthlyExtra)} (previously ${won(previousMonthlyExtra)})`],
205
+ ...(charged > 0 ? [['Charged now', won(charged)]] : [])
218
206
  ]);
219
207
  }
220
208
  function consentNeeded(command, args, pretty, depth) {
@@ -225,7 +213,7 @@ function consentNeeded(command, args, pretty, depth) {
225
213
  const { monthlyExtra, previousMonthlyExtra } = answer;
226
214
  return confirmationRequired(command, args, pretty, depth, {
227
215
  message: `The change raises the monthly extra charge from ${previousMonthlyExtra} to ${monthlyExtra} KRW and needs the user's consent.`,
228
- display: `월 추가 요금이 ${won(previousMonthlyExtra)}에서 ${won(monthlyExtra)}으로 늘어납니다. 사용자에게 확인한 뒤 --yes 를 붙여 실행하세요.`
216
+ display: `The monthly extra charge rises from ${won(previousMonthlyExtra)} to ${won(monthlyExtra)}. Confirm with the user, then run it with --yes.`
229
217
  }, { monthlyExtra, previousMonthlyExtra, currency: 'KRW' });
230
218
  };
231
219
  }
@@ -233,7 +221,7 @@ export async function runServerList(args, pretty, depth, deps = defaultAuthDeps(
233
221
  const command = LIST.name;
234
222
  return rehearsed(command, args, pretty, depth, deps, (rest) => {
235
223
  if (rest.length)
236
- return { error: unknownArgument(rest[0], pretty) };
224
+ return { error: unknownArgument(rest[0]) };
237
225
  const url = (siteUrl) => new URL(SERVER_PATH, siteUrl).href;
238
226
  return {
239
227
  steps: LIST_STEPS,
@@ -241,8 +229,8 @@ export async function runServerList(args, pretty, depth, deps = defaultAuthDeps(
241
229
  send: {
242
230
  method: 'GET',
243
231
  url,
244
- spinner: '서버 목록을 불러오고 있습니다.',
245
- failed: '서버 목록을 불러오지 못했습니다.',
232
+ spinner: 'Loading the server list.',
233
+ failed: 'Could not load the server list.',
246
234
  notFound: httpFailure(404),
247
235
  failures: LIST_FAILURES,
248
236
  done: (body, siteUrl) => listed(command, pretty, depth, body, siteUrl)
@@ -253,7 +241,7 @@ export async function runServerList(args, pretty, depth, deps = defaultAuthDeps(
253
241
  export async function runServerSet(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
254
242
  const command = SET.name;
255
243
  return rehearsed(command, args, pretty, depth, deps, (rest) => {
256
- const parsed = parseSet(rest, pretty);
244
+ const parsed = parseSet(rest);
257
245
  if ('error' in parsed)
258
246
  return parsed;
259
247
  const { project, cores, memory, consented } = parsed;
@@ -262,13 +250,13 @@ export async function runServerSet(args, pretty, depth, deps = defaultAuthDeps(p
262
250
  const url = (siteUrl) => new URL(`${SERVER_PATH}/${encodeURIComponent(project)}/spec`, siteUrl).href;
263
251
  return {
264
252
  steps: SET_STEPS,
265
- result: (siteUrl) => plannedChange(command, pretty, depth, siteUrl, { url: url(siteUrl), body }, '서버 사양 변경을 확인했습니다. 바꾸지 않았습니다.', setRows(plan), plan),
253
+ result: (siteUrl) => plannedChange(command, pretty, depth, siteUrl, { url: url(siteUrl), body }, 'Checked the server spec change. Nothing was changed.', setRows(plan), plan),
266
254
  send: {
267
255
  method: 'POST',
268
256
  url,
269
257
  body,
270
- spinner: '서버 사양을 바꾸고 있습니다.',
271
- failed: '서버 사양을 바꾸지 못했습니다.',
258
+ spinner: 'Changing the server spec.',
259
+ failed: 'Could not change the server spec.',
272
260
  notFound: PROJECT_NOT_FOUND,
273
261
  conflict: SERVER_UNAVAILABLE,
274
262
  failures: SET_FAILURES,
@@ -281,7 +269,7 @@ export async function runServerSet(args, pretty, depth, deps = defaultAuthDeps(p
281
269
  export async function runServerAutopilot(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
282
270
  const command = AUTOPILOT.name;
283
271
  return rehearsed(command, args, pretty, depth, deps, (rest) => {
284
- const parsed = parseAutopilot(rest, pretty);
272
+ const parsed = parseAutopilot(rest);
285
273
  if ('error' in parsed)
286
274
  return parsed;
287
275
  const { enabled, limit, defaulted } = parsed;
@@ -290,23 +278,23 @@ export async function runServerAutopilot(args, pretty, depth, deps = defaultAuth
290
278
  const url = (siteUrl) => new URL(`${SERVER_PATH}/autopilot`, siteUrl).href;
291
279
  return {
292
280
  steps: autopilotSteps(enabled),
293
- result: (siteUrl) => plannedChange(command, pretty, depth, siteUrl, { url: url(siteUrl), body }, `오토파일럿 설정을 확인했습니다. ${enabled ? '켜지' : '끄지'} 않았습니다.`, autopilotRows(enabled, limit, defaulted), plan),
281
+ result: (siteUrl) => plannedChange(command, pretty, depth, siteUrl, { url: url(siteUrl), body }, `Checked the autopilot change. Autopilot was not turned ${enabled ? 'on' : 'off'}.`, autopilotRows(enabled, limit, defaulted), plan),
294
282
  send: {
295
283
  method: 'POST',
296
284
  url,
297
285
  body,
298
- spinner: enabled ? '오토파일럿을 켜고 있습니다.' : '오토파일럿을 끄고 있습니다.',
299
- failed: enabled ? '오토파일럿을 켜지 못했습니다.' : '오토파일럿을 끄지 못했습니다.',
286
+ spinner: enabled ? 'Turning autopilot on.' : 'Turning autopilot off.',
287
+ failed: enabled ? 'Could not turn autopilot on.' : 'Could not turn autopilot off.',
300
288
  notFound: httpFailure(404),
301
- failures: { server_unreachable: UNREACHABLE },
289
+ failures: { server_unreachable: UNREACHABLE, unpaid_charges: AUTOPILOT_UNPAID },
302
290
  done: (result, siteUrl) => {
303
291
  const saved = result;
304
292
  const monthlyLimit = saved.enabled ? saved.limit : null;
305
293
  if (!pretty)
306
294
  return agentResult(0, { command, siteUrl, applied: true, enabled: saved.enabled, monthlyLimit, currency: 'KRW', manualChangesAllowed: !saved.enabled });
307
295
  return saved.enabled
308
- ? prettyResult(0, depth, command, `오토파일럿을 켰습니다. 월 한도는 ${won(saved.limit)}입니다.`, [['서버', siteUrl], ...autopilotRows(true, saved.limit, false).slice(1)])
309
- : prettyResult(0, depth, command, '오토파일럿을 껐습니다.', [['서버', siteUrl], ...autopilotRows(false, null, false).slice(1)]);
296
+ ? prettyResult(0, depth, command, `Turned autopilot on. The monthly limit is ${won(saved.limit)}.`, [['Server', siteUrl], ...autopilotRows(true, saved.limit, false).slice(1)])
297
+ : prettyResult(0, depth, command, 'Turned autopilot off.', [['Server', siteUrl], ...autopilotRows(false, null, false).slice(1)]);
310
298
  }
311
299
  }
312
300
  };