@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
@@ -6,165 +6,159 @@ import { confirmationRequired } from "../runtime/confirm.js";
6
6
  import { pageRows, pagination, parsePage } from "../runtime/page.js";
7
7
  import { plannedChange, plannedRequest, splitDryRun } from "../runtime/dry-run.js";
8
8
  import { parseFlags, unknownArgument } from "../runtime/flags.js";
9
- import { fail, rehearsed } from "./dns.js";
9
+ import { rehearsed } from "./dns.js";
10
10
  export const KEYS_PATH = '/api/v1/keys';
11
11
  const KINDS = {
12
- dns: { name: 'DNS Control API key', label: 'DNS Control API 키', prefix: 'dd_dns_' },
13
- s3: { name: 'S3 Control API key', label: 'S3 Control API 키', prefix: 'dd_s3_' },
14
- pay: { name: 'Pay Control API key', label: 'Pay Control API 키', prefix: 'dd_pay_' }
12
+ dns: { name: 'DNS Control API key', prefix: 'dd_dns_' },
13
+ s3: { name: 'S3 Control API key', prefix: 'dd_s3_' },
14
+ pay: { name: 'Pay Control API key', prefix: 'dd_pay_' }
15
15
  };
16
16
  const EXPIRIES = {
17
- '10m': { minutes: 10, label: '10분' },
18
- '1h': { minutes: 60, label: '1시간' },
19
- '6h': { minutes: 360, label: '6시간' },
20
- '1d': { minutes: 1440, label: '1일' }
17
+ '10m': { minutes: 10, label: '10 minutes' },
18
+ '1h': { minutes: 60, label: '1 hour' },
19
+ '6h': { minutes: 360, label: '6 hours' },
20
+ '1d': { minutes: 1440, label: '1 day' }
21
21
  };
22
22
  const DEFAULT_EXPIRY = '10m';
23
- const SCOPES = { 'dns:read': 'DNS 조회', 'dns:write': 'DNS 변경', 's3:read': '저장소 조회', 's3:write': '저장소 변경', 'pay:write': '결제 합산' };
23
+ const SCOPES = { 'dns:read': 'DNS read', 'dns:write': 'DNS write', 's3:read': 'Storage read', 's3:write': 'Storage write', 'pay:write': 'Consolidated billing' };
24
24
  const CUSTOM_PREFIX = 'dd_key_';
25
- const KIND_LABELS = { dns: 'DNS Control', s3: 'S3 Control', pay: 'Pay Control', custom: '권한 지정' };
25
+ const KIND_LABELS = { dns: 'DNS Control', s3: 'S3 Control', pay: 'Pay Control', custom: 'Custom' };
26
26
  const PAY_SCOPE = /^pay(:|$)/i;
27
27
  const KEY_VALUE = /^dd_/i;
28
28
  const KEY_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
29
29
  const CONTROL = /[\u0000-\u001f\u007f-\u009f]/;
30
30
  const NAME_MAX = 60;
31
- const ONCE = '키 값은 지금만 보여 드립니다. 안전한 곳에 보관하세요. deepdynamic keys 에는 앞부분만 나옵니다.';
32
- const KEY_NOT_FOUND = {
33
- code: 'key_not_found',
34
- message: 'No key with that ID is among your keys. Check them with deepdynamic keys.',
35
- display: '내 키 목록에 없는 키 ID 입니다.'
36
- };
37
- const KEY_EXISTS = {
38
- code: 'key_exists',
39
- message: 'That key is already issued. Revoke it with deepdynamic keys revoke <key-id> --yes before issuing it again.',
40
- display: '이미 발급된 키입니다. deepdynamic keys revoke <키 ID> --yes 로 취소한 뒤 다시 발급하세요.'
41
- };
31
+ const ONCE = 'The key value is shown only now. Store it somewhere safe. deepdynamic keys shows only its prefix.';
32
+ const failure = (code, message) => ({ code, message, display: message });
33
+ const KEY_NOT_FOUND = failure('key_not_found', 'No key with that ID is among your keys. Check them with deepdynamic keys.');
34
+ const KEY_EXISTS = failure('key_exists', 'That key is already issued. Revoke it with deepdynamic keys revoke <key-id> --yes before issuing it again.');
42
35
  const ISSUE_STEPS = [
43
- { stage: 'validate_kind', message: '키 종류를 확인하고 있습니다.' },
44
- { stage: 'resolve_prefix', message: '키 접두사를 정하고 있습니다.' },
45
- { stage: 'prepare_request', message: '발급 요청을 준비하고 있습니다.' }
36
+ { stage: 'validate_kind', message: 'Checking the key kind.' },
37
+ { stage: 'resolve_prefix', message: 'Resolving the key prefix.' },
38
+ { stage: 'prepare_request', message: 'Preparing the issue request.' }
46
39
  ];
47
40
  const PAY_STEPS = [
48
41
  ...ISSUE_STEPS.slice(0, 2),
49
- { stage: 'compute_expiry', message: '유효기간을 계산하고 있습니다.' },
50
- { stage: 'check_consent', message: '결제 합산 동의를 확인하고 있습니다.' },
42
+ { stage: 'compute_expiry', message: 'Calculating the expiry.' },
43
+ { stage: 'check_consent', message: 'Checking consent to consolidated billing.' },
51
44
  ...ISSUE_STEPS.slice(2)
52
45
  ];
53
46
  const CREATE_STEPS = [
54
- { stage: 'validate_name', message: '키 이름을 확인하고 있습니다.' },
55
- { stage: 'normalize_scopes', message: '권한을 정리하고 있습니다.' },
56
- { stage: 'prepare_request', message: '생성 요청을 준비하고 있습니다.' }
47
+ { stage: 'validate_name', message: 'Checking the key name.' },
48
+ { stage: 'normalize_scopes', message: 'Normalizing the scopes.' },
49
+ { stage: 'prepare_request', message: 'Preparing the create request.' }
57
50
  ];
58
51
  const REVOKE_STEPS = [
59
- { stage: 'validate_id', message: '키 ID 형식을 확인하고 있습니다.' },
60
- { stage: 'summarize_impact', message: '취소하면 막히는 접근을 정리하고 있습니다.' },
61
- { stage: 'prepare_request', message: '취소 요청을 준비하고 있습니다.' }
52
+ { stage: 'validate_id', message: 'Checking the key ID format.' },
53
+ { stage: 'summarize_impact', message: 'Summarizing the access that revoking blocks.' },
54
+ { stage: 'prepare_request', message: 'Preparing the revoke request.' }
62
55
  ];
63
56
  const valuesOf = (entries, flag) => entries.filter(([name]) => name === flag).map(([, value]) => value);
64
57
  const keyUrl = (siteUrl, suffix = '') => new URL(`${KEYS_PATH}${suffix}`, siteUrl).href;
65
58
  const keyOf = (body) => body.key;
66
59
  const scopeNames = (scopes) => scopes.map((scope) => SCOPES[scope] ?? scope).join(', ');
67
60
  const when = (iso) => iso.replace('T', ' ').replace(/\.\d{3}Z$/, ' UTC');
68
- function parseIssue(args, pretty) {
61
+ const count = (amount, noun) => `${amount} ${noun}${amount === 1 ? '' : 's'}`;
62
+ function parseIssue(args) {
69
63
  const consented = args.includes('--yes');
70
64
  const [kind, ...rest] = args.filter((arg) => arg !== '--yes');
71
65
  if (kind === undefined || kind.startsWith('-'))
72
- return fail(pretty, 'Specify the key kind: dns, s3 or pay.', '발급할 키 종류(dns, s3, pay)를 지정하세요.');
66
+ return { error: 'Specify the key kind: dns, s3 or pay.' };
73
67
  if (!Object.hasOwn(KINDS, kind))
74
- return fail(pretty, `Unknown key kind: ${kind}. Use dns, s3 or pay.`, `알 수 없는 키 종류입니다: ${kind}. dns, s3, pay 중 하나를 지정하세요.`);
75
- const parsed = parseFlags(rest, ['--expires'], pretty);
68
+ return { error: `Unknown key kind: ${kind}. Use dns, s3 or pay.` };
69
+ const parsed = parseFlags(rest, ['--expires']);
76
70
  if ('error' in parsed)
77
71
  return parsed;
78
72
  const values = valuesOf(parsed.entries, '--expires');
79
73
  if (values.length > 1)
80
- return fail(pretty, '--expires can be given only once.', '--expires 는 한 번만 지정하세요.');
74
+ return { error: '--expires can be given only once.' };
81
75
  if (kind !== 'pay' && (values.length || consented)) {
82
76
  const flag = values.length ? '--expires' : '--yes';
83
- return fail(pretty, `${flag} is only for pay keys.`, `${flag} 는 pay 키에만 씁니다.`);
77
+ return { error: `${flag} is only for pay keys.` };
84
78
  }
85
79
  const [expires = DEFAULT_EXPIRY] = values;
86
80
  if (!Object.hasOwn(EXPIRIES, expires))
87
- return fail(pretty, `--expires must be 10m, 1h, 6h or 1d: ${expires}`, `--expires 에는 10m, 1h, 6h, 1d 중 하나를 지정하세요: ${expires}`);
81
+ return { error: `--expires must be 10m, 1h, 6h or 1d: ${expires}` };
88
82
  return { kind: kind, expiry: kind === 'pay' ? EXPIRIES[expires] : null, consented };
89
83
  }
90
- function parseCreate(args, pretty) {
91
- const parsed = parseFlags(args, ['--label', '--scope'], pretty);
84
+ function parseCreate(args) {
85
+ const parsed = parseFlags(args, ['--label', '--scope']);
92
86
  if ('error' in parsed)
93
87
  return parsed;
94
88
  const names = valuesOf(parsed.entries, '--label');
95
89
  const given = valuesOf(parsed.entries, '--scope');
96
90
  if (names.length === 0)
97
- return fail(pretty, '--label is required.', '--label 을 지정하세요.');
91
+ return { error: '--label is required.' };
98
92
  if (names.length > 1)
99
- return fail(pretty, '--label can be given only once.', '--label 은 한 번만 지정하세요.');
93
+ return { error: '--label can be given only once.' };
100
94
  const name = names[0].trim();
101
95
  if (CONTROL.test(name))
102
- return fail(pretty, 'The key name cannot contain control characters such as line breaks.', '키 이름에는 줄바꿈 같은 제어 문자를 쓸 수 없습니다.');
96
+ return { error: 'The key name cannot contain control characters such as line breaks.' };
103
97
  if (!name || name.length > NAME_MAX)
104
- return fail(pretty, `--label must be 1-${NAME_MAX} characters.`, `--label 은 1~${NAME_MAX}자로 지정하세요.`);
98
+ return { error: `--label must be 1-${NAME_MAX} characters.` };
105
99
  if (given.length === 0)
106
- return fail(pretty, 'At least one --scope is required.', '--scope 를 하나 이상 지정하세요.');
100
+ return { error: 'At least one --scope is required.' };
107
101
  const pay = given.find((scope) => PAY_SCOPE.test(scope));
108
102
  if (pay)
109
- return fail(pretty, `Payment scopes such as ${pay} are issued only with a temporary Pay Control key. Use deepdynamic keys issue pay.`, '결제 권한은 Pay Control 임시 키로만 발급됩니다. deepdynamic keys issue pay 를 쓰세요.');
103
+ return { error: `Payment scopes such as ${pay} are issued only with a temporary Pay Control key. Use deepdynamic keys issue pay.` };
110
104
  const unknown = given.find((scope) => !Object.hasOwn(SCOPES, scope));
111
105
  if (unknown)
112
- return fail(pretty, `Unknown scope: ${unknown}. Use dns:read, dns:write, s3:read or s3:write.`, `알 수 없는 권한입니다: ${unknown}. dns:read, dns:write, s3:read, s3:write 중에서 고르세요.`);
106
+ return { error: `Unknown scope: ${unknown}. Use dns:read, dns:write, s3:read or s3:write.` };
113
107
  return { name, scopes: Object.keys(SCOPES).filter((scope) => scope !== 'pay:write' && given.includes(scope)) };
114
108
  }
115
- function parseRevoke(args, pretty) {
109
+ function parseRevoke(args) {
116
110
  const option = args.find((arg) => arg.startsWith('-'));
117
111
  if (option)
118
- return { error: unknownArgument(option, pretty) };
112
+ return { error: unknownArgument(option) };
119
113
  if (args.length !== 1)
120
- return fail(pretty, 'Specify exactly one key ID.', '취소할 키 ID 를 하나만 지정하세요.');
114
+ return { error: 'Specify exactly one key ID.' };
121
115
  if (KEY_VALUE.test(args[0]))
122
- return fail(pretty, 'Pass the key ID listed by deepdynamic keys, not the key value.', '키 값이 아니라 deepdynamic keys 에 나오는 키 ID 를 지정하세요.');
116
+ return { error: 'Pass the key ID listed by deepdynamic keys, not the key value.' };
123
117
  const id = args[0].toLowerCase();
124
118
  if (!KEY_ID.test(id))
125
- return fail(pretty, 'Key IDs are UUIDs as listed by deepdynamic keys.', '키 ID 는 deepdynamic keys 에 나오는 UUID 형식입니다.');
119
+ return { error: 'Key IDs are UUIDs as listed by deepdynamic keys.' };
126
120
  return id;
127
121
  }
128
122
  function keyRows(key) {
129
123
  return [
130
- ['키', `${KIND_LABELS[key.kind] ?? key.kind} · ${key.name}`],
131
- ['키 ID', key.id],
132
- ...(key.token ? [['키 값', key.token], ['주의', ONCE]] : [['앞부분', `${key.prefix}…`]]),
133
- ['권한', scopeNames(key.scopes)],
134
- ['발급', when(key.createdAt)],
135
- ['만료', when(key.expiresAt)]
124
+ ['Key', `${KIND_LABELS[key.kind] ?? key.kind} · ${key.name}`],
125
+ ['Key ID', key.id],
126
+ ...(key.token ? [['Key value', key.token], ['Warning', ONCE]] : [['Prefix', `${key.prefix}…`]]),
127
+ ['Scopes', scopeNames(key.scopes)],
128
+ ['Issued', when(key.createdAt)],
129
+ ['Expires', when(key.expiresAt)]
136
130
  ];
137
131
  }
138
132
  function issued(command, pretty, depth, message, body, siteUrl) {
139
133
  const key = keyOf(body);
140
134
  return pretty
141
- ? prettyResult(0, depth, command, message, [['서버', siteUrl], ...keyRows(key)])
135
+ ? prettyResult(0, depth, command, message, [['Server', siteUrl], ...keyRows(key)])
142
136
  : agentResult(0, { command, siteUrl, applied: true, key });
143
137
  }
144
138
  export async function runKeysList(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
145
139
  const command = 'keys';
146
140
  return rehearsed(command, args, pretty, depth, deps, (rest) => {
147
- const page = parsePage(rest, pretty);
141
+ const page = parsePage(rest);
148
142
  if (typeof page !== 'number')
149
143
  return page;
150
144
  const listUrl = (siteUrl) => `${keyUrl(siteUrl)}?page=${page}`;
151
145
  return {
152
- steps: [{ stage: 'prepare_request', message: '키 목록 요청을 준비하고 있습니다.' }],
146
+ steps: [{ stage: 'prepare_request', message: 'Preparing the key list request.' }],
153
147
  result: (siteUrl) => plannedRequest(command, pretty, depth, siteUrl, listUrl(siteUrl)),
154
148
  send: {
155
149
  method: 'GET',
156
150
  url: listUrl,
157
- spinner: '발급한 키를 불러오고 있습니다.',
158
- failed: '발급한 키를 불러오지 못했습니다.',
151
+ spinner: 'Loading your API keys.',
152
+ failed: 'Could not load your API keys.',
159
153
  notFound: httpFailure(404),
160
154
  done: (body, siteUrl) => {
161
155
  const { keys, ...paged } = body;
162
156
  const paging = pagination(paged, command);
163
157
  if (!pretty)
164
158
  return agentResult(0, { command, siteUrl, ...paging, keys });
165
- return prettyResult(0, depth, command, keys.length ? `발급한 키 ${keys.length}개를 불러왔습니다.` : '발급한 키가 없습니다. deepdynamic keys issue 나 deepdynamic keys create 로 발급할 수 있습니다.', [
166
- ['서버', siteUrl],
167
- ...keys.map((key) => [key.id, `${KIND_LABELS[key.kind] ?? key.kind} · ${key.name} · ${key.prefix}… · ${scopeNames(key.scopes)} · 만료 ${when(key.expiresAt)}`]),
159
+ return prettyResult(0, depth, command, keys.length ? `Loaded ${count(keys.length, 'key')}.` : 'You have no API keys. Issue one with deepdynamic keys issue or deepdynamic keys create.', [
160
+ ['Server', siteUrl],
161
+ ...keys.map((key) => [key.id, `${KIND_LABELS[key.kind] ?? key.kind} · ${key.name} · ${key.prefix}… · ${scopeNames(key.scopes)} · Expires ${when(key.expiresAt)}`]),
168
162
  ...pageRows(paging)
169
163
  ]);
170
164
  }
@@ -175,41 +169,41 @@ export async function runKeysList(args, pretty, depth, deps = defaultAuthDeps(pr
175
169
  export async function runKeysIssue(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
176
170
  const command = 'keys issue';
177
171
  const { args: rest, dryRun } = splitDryRun(args);
178
- const pre = parseIssue(rest, pretty);
172
+ const pre = parseIssue(rest);
179
173
  if (!('error' in pre) && pre.expiry && !pre.consented && !dryRun) {
180
174
  return confirmationRequired(command, rest, pretty, depth, {
181
175
  message: 'A pay key needs the consent to paid services and consolidated billing, and it can charge the account.',
182
- display: 'pay 키를 발급하려면 유료 서비스 이용과 결제 합산에 동의해야 합니다. 사용자에게 확인한 뒤 --yes 를 붙여 실행하세요.'
176
+ display: 'Issuing a pay key needs consent to paid services and consolidated billing. Confirm with the user, then run it with --yes.'
183
177
  });
184
178
  }
185
179
  return rehearsed(command, args, pretty, depth, deps, (plain) => {
186
- const parsed = parseIssue(plain, pretty);
180
+ const parsed = parseIssue(plain);
187
181
  if ('error' in parsed)
188
182
  return parsed;
189
183
  const { kind, expiry, consented } = parsed;
190
- const { name, label, prefix } = KINDS[kind];
184
+ const { name, prefix } = KINDS[kind];
191
185
  const term = expiry ? { expiresInMinutes: expiry.minutes } : {};
192
186
  const consent = expiry ? { consentRequired: true, consented } : {};
193
187
  const body = { kind, ...term, ...(expiry && consented ? { consented: true } : {}) };
194
188
  const payRows = expiry
195
189
  ? [
196
- ['유효기간', expiry.label],
197
- ['결제 합산', consented ? '동의함 (--yes)' : '필요합니다. 유료 서비스 이용과 결제 합산에 동의하면 --yes 를 붙이세요.'],
198
- ['주의', '이 키로 계정에 요금이 청구될 수 있습니다.']
190
+ ['Valid for', expiry.label],
191
+ ['Consolidated billing', consented ? 'Agreed (--yes)' : 'Required. Add --yes once the user agrees to paid services and consolidated billing.'],
192
+ ['Warning', 'This key can charge the account.']
199
193
  ]
200
194
  : [];
201
195
  return {
202
196
  steps: expiry ? PAY_STEPS : ISSUE_STEPS,
203
- result: (siteUrl) => plannedChange(command, pretty, depth, siteUrl, { url: keyUrl(siteUrl), body }, '키 발급 요청을 확인했습니다. 발급하지 않았습니다.', [['키', label], ['접두사', prefix], ...payRows], { kind, name, prefix, ...term, ...consent }),
197
+ result: (siteUrl) => plannedChange(command, pretty, depth, siteUrl, { url: keyUrl(siteUrl), body }, 'Checked the key issue request. No key was issued.', [['Key', name], ['Prefix', prefix], ...payRows], { kind, name, prefix, ...term, ...consent }),
204
198
  send: {
205
199
  method: 'POST',
206
200
  url: (siteUrl) => keyUrl(siteUrl),
207
201
  body,
208
- spinner: '키를 발급하고 있습니다.',
209
- failed: '키를 발급하지 못했습니다.',
202
+ spinner: 'Issuing the key.',
203
+ failed: 'Could not issue the key.',
210
204
  notFound: httpFailure(404),
211
205
  conflict: KEY_EXISTS,
212
- done: (result, siteUrl) => issued(command, pretty, depth, `${label}를 발급했습니다.`, result, siteUrl)
206
+ done: (result, siteUrl) => issued(command, pretty, depth, `Issued the ${name}.`, result, siteUrl)
213
207
  }
214
208
  };
215
209
  });
@@ -217,23 +211,23 @@ export async function runKeysIssue(args, pretty, depth, deps = defaultAuthDeps(p
217
211
  export async function runKeysCreate(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
218
212
  const command = 'keys create';
219
213
  return rehearsed(command, args, pretty, depth, deps, (rest) => {
220
- const parsed = parseCreate(rest, pretty);
214
+ const parsed = parseCreate(rest);
221
215
  if ('error' in parsed)
222
216
  return parsed;
223
217
  const { name, scopes } = parsed;
224
218
  const body = { kind: 'custom', name, scopes };
225
219
  return {
226
220
  steps: CREATE_STEPS,
227
- result: (siteUrl) => plannedChange(command, pretty, depth, siteUrl, { url: keyUrl(siteUrl), body }, '키 생성 요청을 확인했습니다. 만들지 않았습니다.', [['키 이름', name], ['접두사', CUSTOM_PREFIX], ['권한', scopeNames(scopes)]], { name, prefix: CUSTOM_PREFIX, scopes }),
221
+ result: (siteUrl) => plannedChange(command, pretty, depth, siteUrl, { url: keyUrl(siteUrl), body }, 'Checked the key create request. No key was created.', [['Name', name], ['Prefix', CUSTOM_PREFIX], ['Scopes', scopeNames(scopes)]], { name, prefix: CUSTOM_PREFIX, scopes }),
228
222
  send: {
229
223
  method: 'POST',
230
224
  url: (siteUrl) => keyUrl(siteUrl),
231
225
  body,
232
- spinner: '키를 만들고 있습니다.',
233
- failed: '키를 만들지 못했습니다.',
226
+ spinner: 'Creating the key.',
227
+ failed: 'Could not create the key.',
234
228
  notFound: httpFailure(404),
235
229
  conflict: KEY_EXISTS,
236
- done: (result, siteUrl) => issued(command, pretty, depth, `${name} 키를 만들었습니다.`, result, siteUrl)
230
+ done: (result, siteUrl) => issued(command, pretty, depth, `Created the key ${name}.`, result, siteUrl)
237
231
  }
238
232
  };
239
233
  });
@@ -241,29 +235,29 @@ export async function runKeysCreate(args, pretty, depth, deps = defaultAuthDeps(
241
235
  export async function runKeysRevoke(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
242
236
  const command = 'keys revoke';
243
237
  return rehearsed(command, args, pretty, depth, deps, (rest) => {
244
- const id = parseRevoke(rest, pretty);
238
+ const id = parseRevoke(rest);
245
239
  if (typeof id !== 'string')
246
240
  return id;
247
241
  return {
248
242
  steps: REVOKE_STEPS,
249
- result: (siteUrl) => plannedChange(command, pretty, depth, siteUrl, { url: keyUrl(siteUrl, `/${encodeURIComponent(id)}/revoke`), body: {} }, '키 취소 요청을 확인했습니다. 취소하지 않았습니다.', [['키 ID', id], ['영향', '취소하면 이 키를 쓰는 에이전트와 도구가 바로 막힙니다.']], { keyId: id }),
243
+ result: (siteUrl) => plannedChange(command, pretty, depth, siteUrl, { url: keyUrl(siteUrl, `/${encodeURIComponent(id)}/revoke`), body: {} }, 'Checked the key revoke request. The key was not revoked.', [['Key ID', id], ['Impact', 'Revoking blocks every agent and tool that uses this key at once.']], { keyId: id }),
250
244
  send: {
251
245
  method: 'POST',
252
246
  url: (siteUrl) => keyUrl(siteUrl, `/${encodeURIComponent(id)}/revoke`),
253
247
  body: {},
254
- spinner: '키를 취소하고 있습니다.',
255
- failed: '키를 취소하지 못했습니다.',
248
+ spinner: 'Revoking the key.',
249
+ failed: 'Could not revoke the key.',
256
250
  notFound: KEY_NOT_FOUND,
257
251
  done: (result, siteUrl) => {
258
252
  const key = keyOf(result);
259
253
  return pretty
260
- ? prettyResult(0, depth, command, `${key.name}를 취소했습니다.`, [['서버', siteUrl], ['키 ID', key.id], ['키', `${KIND_LABELS[key.kind] ?? key.kind} · ${key.name}`], ['영향', '이 키를 쓰던 에이전트와 도구는 바로 막힙니다.']])
254
+ ? prettyResult(0, depth, command, `Revoked the key ${key.name}.`, [['Server', siteUrl], ['Key ID', key.id], ['Key', `${KIND_LABELS[key.kind] ?? key.kind} · ${key.name}`], ['Impact', 'Agents and tools that used this key are now blocked.']])
261
255
  : agentResult(0, { command, siteUrl, applied: true, keyId: key.id, key });
262
256
  }
263
257
  }
264
258
  };
265
259
  }, {
266
260
  message: 'Revoking blocks every agent and tool that uses the key at once.',
267
- display: '취소하면 이 키를 쓰는 에이전트와 도구가 바로 막힙니다. 사용자에게 확인한 뒤 --yes 를 붙여 실행하세요.'
261
+ display: 'Revoking blocks every agent and tool that uses the key at once. Confirm with the user, then run it with --yes.'
268
262
  });
269
263
  }
@@ -8,7 +8,7 @@ import { agentResult } from "../../output.js";
8
8
  import { prettyResult } from "../../pretty.js";
9
9
  import { openBrowser } from "../../runtime/browser.js";
10
10
  import { startLoginScreen } from "../../runtime/login-screen.js";
11
- import { supportDisplay, supportMessage } from "../../runtime/support.js";
11
+ import { supportMessage } from "../../runtime/support.js";
12
12
  export const CLIENT_ID = 'dd-cli';
13
13
  export const LOGIN_TIMEOUT_MS = 10 * 60 * 1000;
14
14
  export const defaultLoginDeps = () => ({
@@ -20,10 +20,10 @@ export const defaultLoginDeps = () => ({
20
20
  stream: process.stdout.isTTY ? process.stderr : undefined,
21
21
  timeoutMs: LOGIN_TIMEOUT_MS
22
22
  });
23
- const failure = (pretty, depth, code, message, prettyMessage) => pretty
24
- ? prettyResult(1, depth, 'login', prettyMessage)
23
+ const failure = (pretty, depth, code, message) => pretty
24
+ ? prettyResult(1, depth, 'login', message)
25
25
  : agentResult(1, { command: 'login', error: { code, message } });
26
- const supportResult = (pretty, depth, code) => failure(pretty, depth, code, supportMessage(code), supportDisplay(code));
26
+ const supportResult = (pretty, depth, code) => failure(pretty, depth, code, supportMessage(code));
27
27
  export const redirectUri = (port) => `http://127.0.0.1:${port}/callback`;
28
28
  export function authorizeUrl(siteUrl, port, challenge, state, agent = false) {
29
29
  const url = new URL('/login/device', siteUrl);
@@ -86,9 +86,9 @@ async function finish(deps, code, verifier, port, pretty, depth) {
86
86
  credentialsPath: path
87
87
  });
88
88
  }
89
- return prettyResult(0, depth, 'login', '로그인했습니다.', [
90
- ['계정', me.user.email ?? me.user.name ?? '이메일 없는 계정'],
91
- ['인증 정보', path]
89
+ return prettyResult(0, depth, 'login', 'Logged in.', [
90
+ ['Account', me.user.email ?? me.user.name ?? 'Account without email'],
91
+ ['Credentials', path]
92
92
  ]);
93
93
  }
94
94
  export async function login(deps, pretty = false, depth = 1) {
@@ -105,7 +105,7 @@ export async function login(deps, pretty = false, depth = 1) {
105
105
  const code = url.searchParams.get('code');
106
106
  const error = url.searchParams.get('error');
107
107
  if (done || url.pathname !== '/callback' || url.searchParams.get('state') !== state || (!code && !error)) {
108
- response.writeHead(400, { 'content-type': 'text/plain; charset=utf-8' }).end('잘못된 요청입니다.');
108
+ response.writeHead(400, { 'content-type': 'text/plain; charset=utf-8' }).end('Invalid request.');
109
109
  return;
110
110
  }
111
111
  done = true;
@@ -115,7 +115,7 @@ export async function login(deps, pretty = false, depth = 1) {
115
115
  const { port } = server.address();
116
116
  const timer = setTimeout(() => settle(null), deps.timeoutMs);
117
117
  const url = authorizeUrl(deps.siteUrl, port, challenge, state, !pretty);
118
- const notice = `브라우저에서 DeepDynamic Cloud 로그인을 마무리하세요.\n브라우저가 열리지 않으면 아래 주소를 직접 여세요.\n ${url}\n`;
118
+ const notice = `Finish logging in to DeepDynamic Cloud in your browser.\nIf the browser does not open, open this URL yourself.\n ${url}\n`;
119
119
  let stop;
120
120
  try {
121
121
  stop = pretty ? startLoginScreen(url, deps.stream) : undefined;
@@ -133,13 +133,13 @@ export async function login(deps, pretty = false, depth = 1) {
133
133
  const callback = await received;
134
134
  clearTimeout(timer);
135
135
  if (!callback) {
136
- return failure(pretty, depth, 'login_timeout', 'Login timed out. Run deepdynamic login to try again.', '제한 시간 안에 로그인을 마치지 못했습니다. deepdynamic login 을 다시 실행하세요.');
136
+ return failure(pretty, depth, 'login_timeout', 'Login timed out. Run deepdynamic login to try again.');
137
137
  }
138
138
  if ('error' in callback) {
139
139
  const cancelled = callback.error === 'access_denied';
140
140
  await land(callback.response, deps.siteUrl, cancelled ? 'cancelled' : null);
141
141
  return cancelled
142
- ? failure(pretty, depth, 'login_cancelled', 'Login was cancelled.', '로그인을 취소했습니다.')
142
+ ? failure(pretty, depth, 'login_cancelled', 'Login was cancelled.')
143
143
  : supportResult(pretty, depth, 'login_failed');
144
144
  }
145
145
  const result = await finish(deps, callback.code, verifier, port, pretty, depth).catch(() => supportResult(pretty, depth, 'login_failed'));
@@ -4,10 +4,10 @@ import { spec } from "../../registry.js";
4
4
  import { plannedRequest, splitDryRun } from "../../runtime/dry-run.js";
5
5
  import { parseServerArgs } from "../../runtime/server-options.js";
6
6
  import { defaultLoginDeps, login } from "./flow.js";
7
- const { name: command, usage, prettyUsage } = spec('login');
7
+ const { name: command, usage } = spec('login');
8
8
  export async function runLogin(args, pretty, depth, loginDeps) {
9
9
  const { args: rest, dryRun } = splitDryRun(args);
10
- const options = parseServerArgs(rest, pretty);
10
+ const options = parseServerArgs(rest);
11
11
  if ('error' in options) {
12
12
  if (!pretty) {
13
13
  return agentResult(2, {
@@ -16,7 +16,7 @@ export async function runLogin(args, pretty, depth, loginDeps) {
16
16
  usage
17
17
  });
18
18
  }
19
- return prettyResult(2, depth, command, options.error, [['사용법', prettyUsage]]);
19
+ return prettyResult(2, depth, command, options.error, [['Usage', usage]]);
20
20
  }
21
21
  const deps = loginDeps ?? defaultLoginDeps();
22
22
  const siteUrl = options.siteUrl ?? deps.siteUrl;
@@ -7,15 +7,15 @@ import { spec } from "../registry.js";
7
7
  import { splitDryRun } from "../runtime/dry-run.js";
8
8
  import { unknownArgument } from "../runtime/flags.js";
9
9
  import { CLIENT_ID } from "./login/flow.js";
10
- const { usage, prettyUsage } = spec('logout');
10
+ const { usage } = spec('logout');
11
11
  const LOGOUT_PATH = '/login/revoke';
12
12
  const TOKEN_SETTINGS_PATH = '/projects';
13
13
  export async function runLogout(args, pretty, depth, deps) {
14
14
  const { args: rest, dryRun } = splitDryRun(args);
15
15
  if (rest.length > 0) {
16
- const message = unknownArgument(rest[0], pretty);
16
+ const message = unknownArgument(rest[0]);
17
17
  return pretty
18
- ? prettyResult(2, depth, 'logout', message, [['사용법', prettyUsage]])
18
+ ? prettyResult(2, depth, 'logout', message, [['Usage', usage]])
19
19
  : agentResult(2, { command: 'logout', error: { code: 'invalid_arguments', message }, usage });
20
20
  }
21
21
  const path = credentialsPath();
@@ -24,7 +24,7 @@ export async function runLogout(args, pretty, depth, deps) {
24
24
  if (!dryRun)
25
25
  await removeCredentials(path);
26
26
  return pretty
27
- ? prettyResult(0, depth, 'logout', '이미 로그아웃 상태입니다.')
27
+ ? prettyResult(0, depth, 'logout', 'Already logged out.')
28
28
  : agentResult(0, { command: 'logout', account: null, credentialsPath: path, ...(dryRun ? { dryRun: true } : {}) });
29
29
  }
30
30
  const email = await readAccountEmail(path);
@@ -32,14 +32,14 @@ export async function runLogout(args, pretty, depth, deps) {
32
32
  const url = new URL(LOGOUT_PATH, siteUrl).href;
33
33
  if (dryRun) {
34
34
  return pretty
35
- ? prettyResult(0, depth, 'logout', '요청을 보내지 않고 확인만 했습니다.', [['서버', siteUrl], ['요청', `POST ${url}`]])
35
+ ? prettyResult(0, depth, 'logout', 'Checked without sending the request.', [['Server', siteUrl], ['Request', `POST ${url}`]])
36
36
  : agentResult(0, { command: 'logout', account: { email }, siteUrl, credentialsPath: path, dryRun: true, request: { method: 'POST', url } });
37
37
  }
38
38
  const result = await request(url, {
39
39
  method: 'POST',
40
40
  headers: { 'content-type': 'application/json' },
41
41
  body: JSON.stringify({ client_id: CLIENT_ID, token })
42
- }, deps, pretty ? '토큰을 폐기하고 있습니다.' : null);
42
+ }, deps, pretty ? 'Revoking the access token.' : null);
43
43
  await removeCredentials(path);
44
44
  const failure = 'failure' in result
45
45
  ? result.failure
@@ -47,10 +47,10 @@ export async function runLogout(args, pretty, depth, deps) {
47
47
  const settings = new URL(TOKEN_SETTINGS_PATH, siteUrl).href;
48
48
  if (failure) {
49
49
  return pretty
50
- ? prettyResult(1, depth, 'logout', '로그인 정보는 지웠지만 서버에서 토큰을 폐기하지 못했습니다.', [
51
- ['서버', siteUrl],
52
- ['원인', failure.display],
53
- ['직접 폐기', settings]
50
+ ? prettyResult(1, depth, 'logout', 'Deleted the saved login, but could not revoke the access token on the server.', [
51
+ ['Server', siteUrl],
52
+ ['Reason', failure.display],
53
+ ['Revoke at', settings]
54
54
  ])
55
55
  : agentResult(1, {
56
56
  command: 'logout',
@@ -66,6 +66,6 @@ export async function runLogout(args, pretty, depth, deps) {
66
66
  });
67
67
  }
68
68
  return pretty
69
- ? prettyResult(0, depth, 'logout', '로그아웃했습니다.', [['계정', email ?? '이메일 없는 계정'], ['삭제한 인증 정보', path]])
69
+ ? prettyResult(0, depth, 'logout', 'Logged out.', [['Account', email ?? 'Account without email'], ['Deleted', path]])
70
70
  : agentResult(0, { command: 'logout', account: { email }, siteUrl, credentialsPath: path, revoked: true });
71
71
  }