@deepdynamic/cli 0.1.2 → 0.1.4

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.
@@ -43,6 +43,12 @@ function queuedResult({ status, body }) {
43
43
  return status === 202 && sent?.ok === true && (sent.queued === true || sent.held === true);
44
44
  }
45
45
  export const holdReasonText = (reasons) => (reasons ?? []).map((reason) => HOLD_REASON_NAMES[reason] ?? reason).join(', ');
46
+ function domainRequiredFailure(body) {
47
+ const domains = body?.domains;
48
+ const names = Array.isArray(domains) ? domains.filter((name) => typeof name === 'string') : [];
49
+ const message = `More than one account domain can send email${names.length > 0 ? ` (${names.join(', ')})` : ''}. Choose one with --domain.`;
50
+ return { code: 'domain_required', message, display: message };
51
+ }
46
52
  function signupWaitFailure(body) {
47
53
  const availableAt = body?.availableAt;
48
54
  const message = `New free accounts can send email 72 hours after sign-up.${typeof availableAt === 'string' ? ` Try again after ${availableAt}.` : ''}`;
@@ -75,13 +81,15 @@ export async function runEmailSend(args, pretty, depth, deps = defaultAuthDeps(p
75
81
  ? { code: 'spam_rejected', message: 'The server rejected the email as advertising or spam. The account may be blocked if this continues.', display: 'The server rejected the email as advertising or spam. The account may be blocked if this continues.' }
76
82
  : result.status === 400 && typeof code === 'string' && DOMAIN_FAILURES[code]
77
83
  ? { code, message: DOMAIN_FAILURES[code], display: DOMAIN_FAILURES[code] }
78
- : result.status === 403 && code === 'signup_wait'
79
- ? signupWaitFailure(result.body)
80
- : result.status === 429
81
- ? { code: 'rate_limited', message: 'Too many emails. Try again later.', display: 'Too many emails. Try again later.' }
82
- : result.status === 400
83
- ? { code: 'rejected', message: 'The server rejected the email. Check the recipient, title and body.', display: 'The server rejected the email. Check the recipient, title and body.' }
84
- : httpFailure(result.status);
84
+ : result.status === 400 && code === 'domain_required'
85
+ ? domainRequiredFailure(result.body)
86
+ : result.status === 403 && code === 'signup_wait'
87
+ ? signupWaitFailure(result.body)
88
+ : result.status === 429
89
+ ? { code: 'rate_limited', message: 'Too many emails. Try again later.', display: 'Too many emails. Try again later.' }
90
+ : result.status === 400
91
+ ? { code: 'rejected', message: 'The server rejected the email. Check the recipient, title and body.', display: 'The server rejected the email. Check the recipient, title and body.' }
92
+ : httpFailure(result.status);
85
93
  }
86
94
  if (failure) {
87
95
  return pretty
@@ -10,7 +10,6 @@ import { rehearsed } from "./dns.js";
10
10
  export const KEYS_PATH = '/api/v1/keys';
11
11
  const KINDS = {
12
12
  dns: { name: 'DNS Control API key', prefix: 'dd_dns_' },
13
- s3: { name: 'S3 Control API key', prefix: 'dd_s3_' },
14
13
  pay: { name: 'Pay Control API key', prefix: 'dd_pay_' }
15
14
  };
16
15
  const EXPIRIES = {
@@ -21,9 +20,12 @@ const EXPIRIES = {
21
20
  };
22
21
  const DEFAULT_EXPIRY = '10m';
23
22
  const SCOPES = { 'dns:read': 'DNS read', 'dns:write': 'DNS write', 's3:read': 'Storage read', 's3:write': 'Storage write', 'pay:write': 'Consolidated billing' };
23
+ const CREATE_SCOPES = ['dns:read', 'dns:write'];
24
24
  const CUSTOM_PREFIX = 'dd_key_';
25
25
  const KIND_LABELS = { dns: 'DNS Control', s3: 'S3 Control', pay: 'Pay Control', custom: 'Custom' };
26
26
  const PAY_SCOPE = /^pay(:|$)/i;
27
+ const STORAGE_SCOPE = /^s3(:|$)/i;
28
+ const NO_STORAGE = 'no storage API accepts them yet';
27
29
  const KEY_VALUE = /^dd_/i;
28
30
  const KEY_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
29
31
  const CONTROL = /[\u0000-\u001f\u007f-\u009f]/;
@@ -32,6 +34,7 @@ const ONCE = 'The key value is shown only now. Store it somewhere safe. deepdyna
32
34
  const failure = (code, message) => ({ code, message, display: message });
33
35
  const KEY_NOT_FOUND = failure('key_not_found', 'No key with that ID is among your keys. Check them with deepdynamic keys.');
34
36
  const KEY_EXISTS = failure('key_exists', 'That key is already issued. Revoke it with deepdynamic keys revoke <key-id> --yes before issuing it again.');
37
+ const WEB_ONLY = failure('web_only', 'Pay Control keys are issued only on the web, signed in with a recent re-authentication, so the CLI cannot issue them. Ask the user to issue one in the API keys tab of /projects on the website.');
35
38
  const ISSUE_STEPS = [
36
39
  { stage: 'validate_kind', message: 'Checking the key kind.' },
37
40
  { stage: 'resolve_prefix', message: 'Resolving the key prefix.' },
@@ -63,9 +66,11 @@ function parseIssue(args) {
63
66
  const consented = args.includes('--yes');
64
67
  const [kind, ...rest] = args.filter((arg) => arg !== '--yes');
65
68
  if (kind === undefined || kind.startsWith('-'))
66
- return { error: 'Specify the key kind: dns, s3 or pay.' };
69
+ return { error: 'Specify the key kind: dns or pay.' };
70
+ if (kind === 's3')
71
+ return { error: `S3 Control keys are not issued for now because ${NO_STORAGE}. Use dns or pay.` };
67
72
  if (!Object.hasOwn(KINDS, kind))
68
- return { error: `Unknown key kind: ${kind}. Use dns, s3 or pay.` };
73
+ return { error: `Unknown key kind: ${kind}. Use dns or pay.` };
69
74
  const parsed = parseFlags(rest, ['--expires']);
70
75
  if ('error' in parsed)
71
76
  return parsed;
@@ -100,11 +105,14 @@ function parseCreate(args) {
100
105
  return { error: 'At least one --scope is required.' };
101
106
  const pay = given.find((scope) => PAY_SCOPE.test(scope));
102
107
  if (pay)
103
- return { error: `Payment scopes such as ${pay} are issued only with a temporary Pay Control key. Use deepdynamic keys issue pay.` };
104
- const unknown = given.find((scope) => !Object.hasOwn(SCOPES, scope));
108
+ return { error: `Payment scopes such as ${pay} come only with a temporary Pay Control key, which is issued on the web.` };
109
+ const storage = given.find((scope) => STORAGE_SCOPE.test(scope));
110
+ if (storage)
111
+ return { error: `Storage scopes such as ${storage} are not issued for now because ${NO_STORAGE}. Use dns:read or dns:write.` };
112
+ const unknown = given.find((scope) => !CREATE_SCOPES.includes(scope));
105
113
  if (unknown)
106
- return { error: `Unknown scope: ${unknown}. Use dns:read, dns:write, s3:read or s3:write.` };
107
- return { name, scopes: Object.keys(SCOPES).filter((scope) => scope !== 'pay:write' && given.includes(scope)) };
114
+ return { error: `Unknown scope: ${unknown}. Use dns:read or dns:write.` };
115
+ return { name, scopes: CREATE_SCOPES.filter((scope) => given.includes(scope)) };
108
116
  }
109
117
  function parseRevoke(args) {
110
118
  const option = args.find((arg) => arg.startsWith('-'));
@@ -203,6 +211,7 @@ export async function runKeysIssue(args, pretty, depth, deps = defaultAuthDeps(p
203
211
  failed: 'Could not issue the key.',
204
212
  notFound: httpFailure(404),
205
213
  conflict: KEY_EXISTS,
214
+ failures: { web_only: WEB_ONLY },
206
215
  done: (result, siteUrl) => issued(command, pretty, depth, `Issued the ${name}.`, result, siteUrl)
207
216
  }
208
217
  };
@@ -114,7 +114,7 @@ const KEYS_SECRET_NOTE = 'The key value is shown only once when it is actually i
114
114
  const MAIL_NOT_EMAILS = 'This is the Mail settings tab of captain mode on the My Projects page: the SPF, DKIM and DMARC records that let a domain send and receive mail. It never sends an email; use deepdynamic emails send for that.';
115
115
  const KEY_RESULT = '{ id, kind: dns|s3|pay|custom, name, prefix, scopes, createdAt, expiresAt, lastUsedAt }. prefix is the key prefix plus the first 8 characters (dd_dns_, dd_s3_, dd_pay_, dd_key_). scopes are among dns:read, dns:write, s3:read, s3:write and pay:write. Dates are ISO 8601 and lastUsedAt is null until the key is used.';
116
116
  const SESSION_RESULT = '{ id, kind: web|cli, current, name, device, userAgent, ip, lastIp, lastSeen, createdAt, expiresAt }. id is 64 hex characters for a browser session or a UUID for a deepdynamic login token. name is the token name for cli and null for web. device is { browser, os } for web and null for cli. ip is the sign-in IP (web) or the issue IP (cli); lastIp is the IP the token was last used from (cli only) and null for web. Dates are ISO 8601 and lastSeen is null until the session is used.';
117
- const KEYS_SOURCE_NOTE = 'Keys are told apart from deepdynamic login tokens by their prefix. A key authenticates the same Bearer header as a login token but only for its scopes: dns keys for deepdynamic dns and deepdynamic mail, s3 keys for storage, pay keys for consolidated billing.';
117
+ const KEYS_SOURCE_NOTE = 'Keys are told apart from deepdynamic login tokens by their prefix. A key authenticates the same Bearer header as a login token but only for its scopes: dns keys for deepdynamic dns and deepdynamic mail, pay keys for consolidated billing. s3 keys issued earlier have no API that accepts them yet.';
118
118
  const MAIL_SOURCE_NOTE = 'The settings are read from the TXT records of the domain: SPF at @ (v=spf1), DMARC at _dmarc and the first <selector>._domainkey record with a p= tag as the managed DKIM key. deepdynamic dns records <domain> shows the same records, and only those three managed records are replaced when settings change.';
119
119
  const MAIL_ZONE_RESULT = '{ domain, status: pending|ready, configured, custom, config: { policy, rua, spfInclude, selector, publicKey } }. configured is true once the SPF or DMARC record exists; before that config shows the automatic setup that deepdynamic mail reset or the first deepdynamic mail set would write. custom is true when the records differ from the automatic setup (policy quarantine, rua rua@<domain>, no SPF include, no DKIM key). spfInclude, selector and publicKey are "" when unset.';
120
120
  export const details = {
@@ -393,14 +393,14 @@ export const details = {
393
393
  { flag: '--title', description: 'Subject line, up to 200 characters, no line breaks.', required: true },
394
394
  { flag: '--body', description: 'Plain-text body, up to 10000 characters. \\n becomes a line break, \\t a tab and \\\\ a backslash, so write \\\\n for a literal \\n. Give this or --body-file.' },
395
395
  { flag: '--body-file', description: `Path of a UTF-8 file holding the plain-text body, instead of --body. Escapes such as \\n are not converted. ${BODY_FILE_NOTE}` },
396
- { flag: '--domain', description: 'Send from noreply@<domain> instead of the deepdynamic-usercontent.com address. The domain must belong to the account, use name servers on DeepDynamic, keep the automatic email setup, and have finished getting ready (deepdynamic mail show <domain> shows sending.state ready).' },
397
- { flag: '--dry-run', description: 'The server runs every check (account, rate limit, recipient, title, body, spam and --domain readiness) and returns the sender it would use without sending. The call is logged but does not count toward the hourly limit.' }
396
+ { flag: '--domain', description: 'Send from noreply@<domain> instead of the deepdynamic-usercontent.com address. The domain must belong to the account, use name servers on DeepDynamic, keep the automatic email setup, and have finished getting ready (deepdynamic mail show <domain> shows sending.state ready). Without --domain the server picks the domain itself when exactly one account domain is ready, fails with domain_required when more than one is, and uses the deepdynamic-usercontent.com address when none is.' },
397
+ { flag: '--dry-run', description: 'The server runs every check (account, rate limit, recipient, title, body, spam and sending domain readiness) and returns the sender it would use without sending. The call is logged but does not count toward the hourly limit.' }
398
398
  ],
399
399
  notes: [
400
400
  SIGN_IN_NOTE,
401
- 'The server builds the sender from the account email: me@example.com sends as "me <me-example.com@deepdynamic-usercontent.com>", and replies go to me@example.com. The sender and reply-to cannot be changed.',
402
- 'With --domain the sender is "me-example-com <noreply@<domain>>" and replies still go to the account email.',
403
- 'With --domain the email may be queued when the sending provider is busy: exit 0 with queued: true and delivered: false means it will be sent within an hour or, if it cannot, the account gets a notification. Do not resend a queued email.',
401
+ 'The server builds the sender from the account email: without a domain ready to send, me@example.com sends as "me <me-example.com@deepdynamic-usercontent.com>", and replies go to me@example.com. The sender and reply-to cannot be changed.',
402
+ 'When the email goes out from a domain (--domain, or the only account domain ready to send) the sender is "me-example-com <noreply@<domain>>" and replies still go to the account email.',
403
+ 'An email sent from a domain may be queued when the sending provider is busy: exit 0 with queued: true and delivered: false means it will be sent within an hour or, if it cannot, the account gets a notification. Do not resend a queued email.',
404
404
  'A free-plan email with a shortened URL (bit.ly and similar), an executable or archive file name or link, or a login link outside the account sites is not sent right away: exit 0 with held: true, code held_for_review and reasons means an administrator will send it or turn it down within 72 hours, and the account gets a notification either way. Do not resend a held email.',
405
405
  'A free-plan account can send email 72 hours after sign-up. Paid plans can send right away.',
406
406
  'The server keeps a record of every call with its full content.',
@@ -410,7 +410,7 @@ export const details = {
410
410
  limits: ['Calls per account are limited per hour.'],
411
411
  result: {
412
412
  dryRun: DRY_RUN_RESULT,
413
- queued: 'true when --domain was used and the email waits in a queue to be sent within an hour.',
413
+ queued: 'true when the email was sent from a domain and waits in a queue to be sent within an hour.',
414
414
  held: 'true when the email waits for an administrator review instead of being sent. With dryRun it means the email would be held.',
415
415
  code: 'held_for_review when held is true.',
416
416
  reasons: 'Why it was held: short_url, executable or login_page.',
@@ -430,6 +430,7 @@ export const details = {
430
430
  domain_not_found: 'The --domain is not one of the account domains that use DeepDynamic name servers. Check the domain name.',
431
431
  domain_mail_pending: 'The --domain is still getting ready to send. Retry later or send without --domain.',
432
432
  domain_mail_unavailable: 'The --domain email settings were edited manually or never set up automatically. Reset them with deepdynamic mail reset <domain> --yes or send without --domain.',
433
+ domain_required: 'More than one account domain is ready to send and --domain was not given. The message lists them. Ask the user which domain to send from and retry with --domain.',
433
434
  signup_wait: 'The free-plan account was created less than 72 hours ago. The message says when sending opens. Tell the user and retry after that time; --dry-run still works.',
434
435
  http_error: SUPPORT_HELP,
435
436
  ...CONNECTION_ERRORS
@@ -444,7 +445,7 @@ export const details = {
444
445
  ['--title', 'Subject, up to 200 characters, no line breaks (required)'],
445
446
  ['--body', 'Body, up to 10000 characters, \\n for a line break (or --body-file)'],
446
447
  ['--body-file', 'UTF-8 file with the body (instead of --body)'],
447
- ['--domain', 'Send from noreply@<domain> of an account domain'],
448
+ ['--domain', 'Send from noreply@<domain> of an account domain (needed when several are ready)'],
448
449
  SEND_DRY_RUN_PRETTY
449
450
  ]
450
451
  },
@@ -529,10 +530,10 @@ export const details = {
529
530
  'Project names are global: 1-63 lowercase letters, digits or hyphens, starting and ending with a letter or digit. Projects can only be created from the CLI.',
530
531
  'Naming step 1: run deepdynamic projects first. If one of the projects was made from this source, for example it has the name you would derive below, deploy to it instead of creating another project. If that project has a name that says nothing about the content (step 4), suggest deepdynamic projects rename instead of creating a new one.',
531
532
  'Naming step 2: if the user gave a name, use it. Otherwise read the source and derive one, in this order: the name in package.json without an @scope/ prefix, the site <title> or first heading, then the folder name.',
532
- 'Naming step 3: use lowercase letters, digits and hyphens, preferably 3-30 characters. Turn spaces, underscores and dots into hyphens, drop other characters, collapse repeated hyphens and remove hyphens at either end. Translate or romanize Korean and other non-Latin titles by meaning, for example 목동 국수집 becomes mokdong-noodle.',
533
+ 'Naming step 3: summarize the source into the shortest name that still says what the site is: one or two words, preferably 12 characters or fewer, and longer only when no shorter name does. Drop filler words such as official, homepage, website, page, the, my, korea and project. Build a long title around its most distinctive word, such as a brand or a place. Use only abbreviations most people know, such as snu, never ones a first-time reader cannot read. Join two words without a hyphen when they still read clearly, otherwise with one hyphen. Use only lowercase letters, digits and hyphens. Translate or romanize Korean and other non-Latin titles by meaning, for example 제주 카페 becomes jejucafe and 서울대학교 총동문회 공식 홈페이지 becomes snu-alumni.',
533
534
  'Naming step 4: avoid names that say nothing about the content, such as app, site, web, test, demo, my-app, vite-project or untitled. Never put personal data such as emails or phone numbers, or secrets, in a name.',
534
- 'Naming step 5: check each candidate with deepdynamic projects create <name> --dry-run. Show the user one recommended available name and two available alternatives, each with the reason taken from the source, and create the project only after the user confirms. If the user told you to proceed without asking, create the recommended name.',
535
- 'Naming step 6: on project_taken, or available: false with owned: false, add a word about the content instead of random digits, for example noodle-shop becomes mokdong-noodle-shop, and check again.',
535
+ 'Naming step 5: check each candidate with deepdynamic projects create <name> --dry-run. Show the user one recommended available name and two available alternatives as full addresses, https://<name>.deepdynamic.space, the recommendation first and the alternatives shortest first, each with a reason of a few words taken from the source, and create the project only after the user confirms. If the user told you to proceed without asking, create the recommended name.',
536
+ 'Naming step 6: on project_taken, or available: false with owned: false, first look for another name of about the same length, such as a synonym or another key word from the source, for example jejucafe becomes jejubrew or cafejeju. Only when none is available, add one short word about the content instead of random digits, for example jejucafe becomes jejucafe-aewol, and check again.',
536
537
  'With --dry-run nothing is created: available: true means nobody uses the name, owned: true means it is already your project so deploy to it, and both false mean another account uses it.',
537
538
  'Each project gets its own server and its own Git repository. The server is turned on and connected to the issued address when the project is created.',
538
539
  'The command waits while the server is prepared, writing progress to stderr. Running it again for your own project only waits for the existing server.',
@@ -540,7 +541,7 @@ export const details = {
540
541
  ],
541
542
  result: {
542
543
  project: 'The project name.',
543
- publicUrl: 'Address issued for the project, http://<project>.deepdynamic.internal. It is connected when the project server is ready and again on each deploy. It follows the project name, so a rename changes it.',
544
+ publicUrl: 'Address issued for the project, https://<project>.deepdynamic.space. It is connected when the project server is ready and again on each deploy. It follows the project name, so a rename changes it.',
544
545
  server: 'stage (network, provisioning, stopped, running or failed), ready, errorCode and a Korean message for the user.',
545
546
  dryRun: 'true with --dry-run. Then only project, available and owned are returned and nothing was created.',
546
547
  available: '--dry-run only: true when no account uses the name.',
@@ -601,7 +602,7 @@ export const details = {
601
602
  statusUrl: 'Authenticated GET progress endpoint. Read it with deepdynamic deployments <id> instead of calling it yourself.',
602
603
  percent: 'Overall milestone percentage: 75 while Git is verified, 90 while publishing and 100 when the site is published.',
603
604
  deployed: 'true only when the project server published this commit.',
604
- publicUrl: 'Issued address of the project, http://<project>.deepdynamic.internal, once deployed is true, otherwise null. Tell the user the site was deployed to this address.',
605
+ publicUrl: 'Issued address of the project, https://<project>.deepdynamic.space, once deployed is true, otherwise null. Tell the user the site was deployed to this address.',
605
606
  forHuman: 'User-facing Korean message and detail, using airline wording.',
606
607
  forAgent: 'Stage, status, gitUploaded (server verified), deployed, commit, errorCode, publishLog, nextAction and pollAfterMs.',
607
608
  manifest: `--dry-run only, present when ${MANIFEST_FILE} exists: its parsed content. The server validates it on deploy.`,
@@ -840,7 +841,7 @@ export const details = {
840
841
  target: '{ commit, publishedAt } of the deployment that was restored.',
841
842
  changed: 'false when the project branch already held the same files, so no new commit was pushed.',
842
843
  deployed: 'true only when the project server published the restored files.',
843
- publicUrl: 'Issued address of the project, http://<project>.deepdynamic.internal, once deployed is true, otherwise null.',
844
+ publicUrl: 'Issued address of the project, https://<project>.deepdynamic.space, once deployed is true, otherwise null.',
844
845
  forAgent: 'Same as deepdynamic projects deploy. forAgent.commit is the new rollback commit, not the target commit.',
845
846
  deployments: 'On no_previous_deployment, deployment_not_found and already_current: the published history to choose from.',
846
847
  dryRun: 'true with --dry-run; nothing was sent.',
@@ -874,8 +875,8 @@ export const details = {
874
875
  notes: [
875
876
  SIGN_IN_NOTE,
876
877
  'Use it when the user asks for a new name, or when a project has a name that says nothing about the content, such as demo-site, my-app, test or vite-project.',
877
- 'Unless the user gave the new name, pick it with naming steps 2-4 in deepdynamic projects create --help: read the source and derive it from the name in package.json without an @scope/ prefix, the site <title> or first heading, then the folder name.',
878
- 'Check each candidate with --dry-run. Show the user one recommended available name and two available alternatives, each with the reason taken from the source, and rename only after the user confirms. If the user told you to proceed without asking, use the recommended name.',
878
+ 'Unless the user gave the new name, pick it with naming steps 2-4 in deepdynamic projects create --help: read the source, derive it from the name in package.json without an @scope/ prefix, the site <title> or first heading, then the folder name, and summarize it into the shortest name that still says what the site is.',
879
+ 'Check each candidate with --dry-run. Show the user one recommended available name and two available alternatives as full addresses, https://<name>.deepdynamic.space, the recommendation first and the alternatives shortest first, each with a reason of a few words taken from the source, and rename only after the user confirms. If a name is taken, follow naming step 6. If the user told you to proceed without asking, use the recommended name.',
879
880
  'The issued site address follows the new name and is connected on the next deploy. The project server, the Git repository and the deploy history stay, and rollback still reaches every earlier deployment.',
880
881
  'Use the new name in every later command, such as deepdynamic projects deploy <new-name> <directory> --agent <code>. The old name is released and anyone can take it.',
881
882
  'Do not rename while a deploy of the project is running; that deploy may fail and then has to be started again with the new name.'
@@ -1859,7 +1860,7 @@ export const details = {
1859
1860
  },
1860
1861
  'keys issue': {
1861
1862
  options: [
1862
- { flag: '<dns|s3|pay>', description: 'Key kind. dns gets dns:read and dns:write, s3 gets s3:read and s3:write, both for 90 days. pay gets pay:write for the chosen expiry.', required: true },
1863
+ { flag: '<dns|pay>', description: 'Key kind. dns gets dns:read and dns:write for 90 days. pay gets pay:write for the chosen expiry and is issued only on the web.', required: true },
1863
1864
  { flag: '--expires', description: 'Expiry of a pay key: 10m, 1h, 6h or 1d. Only for pay.', default: '10m' },
1864
1865
  { flag: '--yes', description: 'Confirms the paid-service and consolidated-billing consent for a pay key. Only for pay; required to issue one without --dry-run.' },
1865
1866
  DNS_CHANGE_DRY_RUN
@@ -1868,7 +1869,8 @@ export const details = {
1868
1869
  SIGN_IN_NOTE,
1869
1870
  'Only one key of each kind can exist. If it is already issued the server answers 409 (key_exists); revoke it with deepdynamic keys revoke <key-id> first.',
1870
1871
  'The key value (key.token) is returned only by this command, once. Show it to the user and tell them to store it safely; deepdynamic keys shows only the prefix afterwards.',
1871
- 'A pay key can charge the account. Tell the user the expiry and the billing warning and get their consent before adding --yes. Pay keys can be issued only from the web with a recent sign-in; with the CLI login token the server answers 403, so send the user to the API 발급 tab for a pay key.',
1872
+ 'A pay key can charge the account and is issued only on the web, signed in with a recent re-authentication. With the CLI login token the server refuses it with web_only, so send the user to the API keys tab of /projects instead of retrying or logging in again.',
1873
+ 'S3 Control keys are not issued for now because no storage API accepts them yet. s3 keys issued earlier still appear in deepdynamic keys and can be revoked.',
1872
1874
  KEYS_SOURCE_NOTE,
1873
1875
  DNS_DRY_RUN_NOTE
1874
1876
  ],
@@ -1883,22 +1885,23 @@ export const details = {
1883
1885
  ...DNS_CHANGE_ERRORS,
1884
1886
  confirmation_required: 'Exit code 3. A pay key was requested without --yes, so nothing was sent. Get the user\'s consent, then run error.next.',
1885
1887
  key_exists: 'A key of that kind is already issued. Revoke it with deepdynamic keys revoke <key-id> --yes first.',
1886
- login_required: 'The login is missing or expired, or the token cannot issue that key (a pay key needs the web). Run deepdynamic login again or use the web.'
1888
+ web_only: 'A pay key was requested with the CLI login token. Pay keys are issued only on the web; send the user to the API keys tab of /projects. Logging in again does not help.',
1889
+ login_required: 'The login is missing or expired, or the token lacks the scope. Run deepdynamic login again.'
1887
1890
  },
1888
- examples: ['deepdynamic keys issue dns', 'deepdynamic keys issue s3 --dry-run', 'deepdynamic keys issue pay --expires 1h --yes'],
1889
- prettyOptions: [['<dns|s3|pay>', 'Kind of key to issue (required)'], ['--expires', 'Pay key expiry: 10m, 1h, 6h or 1d (default 10m)'], ['--yes', 'Consent to paid services and consolidated billing for a pay key'], DNS_CHANGE_DRY_RUN_PRETTY]
1891
+ examples: ['deepdynamic keys issue dns', 'deepdynamic keys issue dns --dry-run'],
1892
+ prettyOptions: [['<dns|pay>', 'Kind of key to issue (required, pay is web only)'], ['--expires', 'Pay key expiry: 10m, 1h, 6h or 1d (default 10m)'], ['--yes', 'Consent to paid services and consolidated billing for a pay key'], DNS_CHANGE_DRY_RUN_PRETTY]
1890
1893
  },
1891
1894
  'keys create': {
1892
1895
  options: [
1893
1896
  { flag: '--label', description: 'Key name, 1-60 characters without control characters. Surrounding spaces are removed.', required: true },
1894
- { flag: '--scope', description: 'A scope to grant: dns:read, dns:write, s3:read or s3:write. Repeat it for several scopes. Payment scopes are refused; use deepdynamic keys issue pay.', required: true },
1897
+ { flag: '--scope', description: 'A scope to grant: dns:read or dns:write. Repeat it for both. Storage scopes (s3:read, s3:write) are not issued for now, and payment scopes come only with a Pay Control key on the web.', required: true },
1895
1898
  DNS_CHANGE_DRY_RUN
1896
1899
  ],
1897
1900
  notes: [
1898
1901
  SIGN_IN_NOTE,
1899
1902
  'The key value (key.token) is returned only by this command, once. Show it to the user and tell them to store it safely.',
1900
1903
  'Keys and access tokens together are limited to 10 per account; beyond that the server answers 409.',
1901
- 'With the CLI login token you can create keys for scopes that token has (dns and s3 scopes are included in projects:read and projects:write).',
1904
+ 'With the CLI login token you can create keys for scopes that token has (dns scopes are included in projects:read and projects:write).',
1902
1905
  KEYS_SOURCE_NOTE,
1903
1906
  DNS_DRY_RUN_NOTE
1904
1907
  ],
@@ -1910,8 +1913,8 @@ export const details = {
1910
1913
  request: 'With --dry-run only: the POST request it would send, { method, url, body: { kind: "custom", name, scopes } }.'
1911
1914
  },
1912
1915
  errors: { ...DNS_CHANGE_ERRORS, key_exists: 'Keys and access tokens are limited to 10 per account. Revoke one first.' },
1913
- examples: ['deepdynamic keys create --label "Deploy automation" --scope dns:read --scope dns:write', 'deepdynamic keys create --label uploads --scope s3:write --dry-run'],
1914
- prettyOptions: [['--label', 'Key name, 1-60 characters (required)'], ['--scope', 'Scope dns:read, dns:write, s3:read or s3:write, repeatable (required)'], DNS_CHANGE_DRY_RUN_PRETTY]
1916
+ examples: ['deepdynamic keys create --label "Deploy automation" --scope dns:read --scope dns:write', 'deepdynamic keys create --label "DNS reader" --scope dns:read --dry-run'],
1917
+ prettyOptions: [['--label', 'Key name, 1-60 characters (required)'], ['--scope', 'Scope dns:read or dns:write, repeatable (required)'], DNS_CHANGE_DRY_RUN_PRETTY]
1915
1918
  },
1916
1919
  'keys revoke': {
1917
1920
  options: [
package/dist/guide.js CHANGED
@@ -4,8 +4,8 @@ const TITLE = '# DeepDynamic Cloud CLI Guide';
4
4
  const SECTIONS = `## CLI projects and deploys
5
5
  - Guidance level: run \`deepdynamic account get\` first and follow \`guide\` in its result. If the user has turned on captain mode (기장 모드) on My Projects (${SITE_URL}/projects), it is \`audience: "developer"\`: explain with technical terms and relay only \`percent\` and \`forHuman.detail\` for deploy progress. If it is off or cannot be checked, it is \`audience: "non_developer"\`: explain plainly for a non-developer with the airline terms of the My Projects page and relay only \`percent\` and \`forHuman.message\` for deploy progress.
6
6
  - Projects are created only from the CLI. Run \`deepdynamic projects create my-site\` once before the first deploy. Each project gets one server inside a customer-dedicated network and one Git repository; a pre-provisioned server is assigned, turned on and connected to the issued address. Check the status with \`deepdynamic projects status my-site\` and list your projects with \`deepdynamic projects\` without a subcommand (20 per page by recent activity, \`--page\`). \`status\` in the list is the result of the last deploy run, and when \`live\` is present that deploy is still published. Deploying to a name that is not your project is rejected with \`project_not_found\` before the upload.
7
- - Naming a project: if the user did not give a name, first check \`deepdynamic projects\` for a project made from this source and deploy there if one exists. Otherwise read the source and look for evidence in this order: \`name\` in \`package.json\` (without \`@scope/\`) → the site \`<title>\` and first heading → the folder name, then make a name of 3-30 lowercase English letters, digits and hyphens (render Korean by its meaning in English or romanization, e.g. 목동 국수집 → \`mokdong-noodle\`). Do not use names that say nothing about the content, such as \`app\`, \`site\`, \`test\`, \`my-app\` or \`vite-project\`, nor personal data or secrets. Names are globally unique, so check each candidate with \`deepdynamic projects create <name> --dry-run\` (checks only \`available\` and \`owned\` without creating), then show the user one available recommendation and two alternatives with your reasons and create it after they confirm. If a name is taken, add a word that describes the content instead of random digits. The full rules are in the notes of \`deepdynamic projects create --help\`.
8
- - Renaming: for a project made with a name that says nothing about the content, such as \`demo-site\`, do not create a new one; name it from the source by the same rules and rename it with \`deepdynamic projects rename demo-site <new-name>\` (\`POST /api/v1/projects/{project}/rename\`). Check first with \`--dry-run\` that the name is available and have the user confirm one recommendation and two alternatives. The issued address changes to the new name and is connected on the next deploy. The server, repository and deploy history stay, and later commands use the new name.
7
+ - Naming a project: if the user did not give a name, first check \`deepdynamic projects\` for a project made from this source and deploy there if one exists. Otherwise read the source and look for evidence in this order: \`name\` in \`package.json\` (without \`@scope/\`) → the site \`<title>\` and first heading → the folder name, then summarize it into the shortest name that still says what the site is: one or two words of lowercase English letters, digits and hyphens, preferably 12 characters or fewer and longer only when no shorter name does. Drop filler words such as \`official\`, \`homepage\`, \`website\` or \`korea\`, build a long title around its most distinctive word such as a brand or place, use only abbreviations most people know, and join two words without a hyphen when they still read clearly (render Korean by its meaning in English or romanization, e.g. 제주 카페 → \`jejucafe\`, 서울대학교 총동문회 공식 홈페이지 → \`snu-alumni\`). Do not use names that say nothing about the content, such as \`app\`, \`site\`, \`test\`, \`my-app\` or \`vite-project\`, nor personal data or secrets. Names are globally unique, so check each candidate with \`deepdynamic projects create <name> --dry-run\` (checks only \`available\` and \`owned\` without creating), then show the user one available recommendation and two alternatives as full addresses (\`https://<name>.deepdynamic.space\`), the alternatives shortest first, each with a reason of a few words, and create it after they confirm. If a name is taken, first try another name of about the same length, such as a synonym or another key word, and only then add one short word that describes the content instead of random digits. The full rules are in the notes of \`deepdynamic projects create --help\`.
8
+ - Renaming: for a project made with a name that says nothing about the content, such as \`demo-site\`, do not create a new one; name it from the source by the same rules and rename it with \`deepdynamic projects rename demo-site <new-name>\` (\`POST /api/v1/projects/{project}/rename\`). Check first with \`--dry-run\` that the name is available and have the user confirm one recommendation and two alternatives shown as full addresses. The issued address changes to the new name and is connected on the next deploy. The server, repository and deploy history stay, and later commands use the new name.
9
9
  - Installable app (PWA): \`deepdynamic projects pwa my-site\` (\`GET /api/v1/projects/{project}/pwa\`) returns in \`pwa\` whether the gateway advertises the site as an installable web app, and \`deepdynamic projects pwa my-site on|off\` (\`POST /api/v1/projects/{project}/pwa\`, \`{ enabled }\`) changes it. It is on by default; when on, the gateway always appends \`<link rel="manifest">\` before \`</head>\` while browsers use only the first manifest link on the page, so a manifest the site declares wins, and it serves \`/__dd/manifest.webmanifest\`, which Android Chrome uses for "Install app" and iOS Safari for "Add to Home Screen". No UI is injected into the page and the site files are not changed; when the gateway cannot be synchronized the command fails with \`unavailable\` and the setting stays as it was.
10
10
  - Deploy settings go in \`deepdynamic.json\` at the root of the deploy folder. The only accepted fields are \`packageManager\` (\`pnpm\` only), \`build\` (\`pnpm build\` or \`pnpm run <script>\`), \`output\` (relative path of the build output folder), \`start\` and \`port\`; without the file the uploaded files are served as they are. For an app server set \`start\` (\`pnpm start\` or \`pnpm run <script>\`) and \`port\` (1024-65535) instead of \`output\`: the project server starts it with \`PORT\` set and proxies the site to that port. Follow the notes of \`deepdynamic projects deploy --help\` for the full rules.
11
11
  - Security rules: use pnpm only and upload \`pnpm-lock.yaml\` with the source (the server installs with \`pnpm install --frozen-lockfile\`). Do not call npm, npx, yarn, curl or wget from package.json scripts, and list only the packages that really need install scripts in \`pnpm.onlyBuiltDependencies\`. Never put API keys, tokens or .env values into the source or settings. The build runs on the project server as a non-root user without deploy credentials.
package/dist/registry.js CHANGED
@@ -157,7 +157,7 @@ export const commands = [
157
157
  name: 'emails send',
158
158
  usage: 'deepdynamic emails send --to <email> --title <text> (--body <text> | --body-file <path>) [--domain <domain>] [--dry-run]',
159
159
  summary: 'Send an email as the account',
160
- description: 'Send a plain-text email on behalf of the logged-in account. With --domain, send from noreply@<domain>.',
160
+ description: 'Send a plain-text email on behalf of the logged-in account, from noreply@<domain> when a domain is ready to send.',
161
161
  effect: 'write',
162
162
  requiresLogin: true,
163
163
  dryRun: 'server'
@@ -585,9 +585,9 @@ export const commands = [
585
585
  },
586
586
  {
587
587
  name: 'keys issue',
588
- usage: 'deepdynamic keys issue <dns|s3|pay> [--expires 10m|1h|6h|1d] [--yes] [--dry-run]',
588
+ usage: 'deepdynamic keys issue <dns|pay> [--expires 10m|1h|6h|1d] [--yes] [--dry-run]',
589
589
  summary: 'Issue a service API key',
590
- description: 'Issue a DNS Control, S3 Control or temporary Pay Control API key and print its value once.',
590
+ description: 'Issue a DNS Control API key and print its value once. Temporary Pay Control keys are issued only on the web.',
591
591
  effect: 'billing',
592
592
  requiresLogin: true,
593
593
  dryRun: 'local',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepdynamic/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Command-line tool for deploying and managing sites on DeepDynamic Cloud.",
5
5
  "keywords": [
6
6
  "deepdynamic",