@deepdynamic/cli 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/deploy/files.js +45 -6
- package/dist/commands/deploy/index.js +10 -1
- package/dist/commands/emails.js +15 -7
- package/dist/commands/keys.js +16 -7
- package/dist/commands/login/flow.js +4 -3
- package/dist/commands/reference.js +29 -20
- package/dist/guide.js +1 -1
- package/dist/registry.js +3 -3
- package/package.json +1 -1
|
@@ -1,16 +1,52 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { lstat, mkdir, mkdtemp, open, readdir, realpath, rm, stat, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
2
4
|
import { basename, join } from 'node:path';
|
|
3
5
|
import { credentialsPath } from "../../auth/credentials.js";
|
|
4
6
|
const EXCLUDED_NAMES = [
|
|
5
7
|
'node_modules', '.git', '.cache', '.ds_store', 'thumbs.db', '.env', '.envrc', '.dev.vars', '.wrangler', '.cloudflare', '.npmrc', '.netrc', '_netrc',
|
|
6
8
|
'.yarnrc', '.yarnrc.yml', '.git-credentials', '.pypirc', '.ssh', '.aws', '.docker', '.kube', '.gnupg', '.svn', '.hg'
|
|
7
9
|
];
|
|
10
|
+
const IGNORE_PATTERNS = [...EXCLUDED_NAMES, '.env.*', '.dev.vars.*'];
|
|
8
11
|
const sameFile = (first, second) => first.dev === second.dev && first.ino === second.ino;
|
|
9
12
|
function isExcluded(name) {
|
|
10
13
|
const normalized = name.toLowerCase();
|
|
11
14
|
return EXCLUDED_NAMES.includes(normalized) || normalized.startsWith('.env.') || normalized.startsWith('.dev.vars.') || /^git~\d+$/.test(normalized) || /^\.git[. ]+$/.test(normalized);
|
|
12
15
|
}
|
|
13
|
-
|
|
16
|
+
const listGit = (args, cwd, env) => new Promise((resolve, reject) => {
|
|
17
|
+
execFile('git', args, { cwd, env, windowsHide: true, timeout: 180_000, maxBuffer: 64 * 1024 * 1024 }, (error, stdout) => {
|
|
18
|
+
if (error && 'code' in error && error.code === 'ENOENT')
|
|
19
|
+
return reject(new Error('Git is required to read .gitignore files. Install Git and retry.'));
|
|
20
|
+
resolve({ code: error ? typeof error.code === 'number' ? error.code : -1 : 0, stdout });
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
const gitPath = (path) => path.startsWith('\\\\?\\') && !path.startsWith('\\\\?\\UNC\\') ? path.slice(4) : path;
|
|
24
|
+
async function unignoredFiles(root, git) {
|
|
25
|
+
const work = await mkdtemp(join(tmpdir(), 'dd-files-'));
|
|
26
|
+
try {
|
|
27
|
+
const config = join(work, 'config');
|
|
28
|
+
const templates = join(work, 'templates');
|
|
29
|
+
await mkdir(templates);
|
|
30
|
+
await writeFile(config, '');
|
|
31
|
+
const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => !/^(GIT_|GCM_)/i.test(key)));
|
|
32
|
+
Object.assign(env, { GIT_CONFIG_NOSYSTEM: '1', GIT_CONFIG_GLOBAL: config, GIT_CONFIG_SYSTEM: config, GIT_TEMPLATE_DIR: templates, GIT_TERMINAL_PROMPT: '0' });
|
|
33
|
+
const tree = gitPath(root);
|
|
34
|
+
const base = [`--git-dir=${join(work, 'git')}`, `--work-tree=${tree}`, '-c', `core.excludesFile=${config}`, '-c', 'safe.directory=*'];
|
|
35
|
+
const init = await git([...base, 'init', '-q'], tree, env);
|
|
36
|
+
const listed = init.code === 0
|
|
37
|
+
? await git([...base, 'ls-files', '--others', '--exclude-standard', '-z', ...IGNORE_PATTERNS.flatMap((pattern) => ['-x', pattern])], tree, env)
|
|
38
|
+
: init;
|
|
39
|
+
if (listed.code !== 0)
|
|
40
|
+
throw new Error('Git could not read the .gitignore files of the directory.');
|
|
41
|
+
return new Set(listed.stdout.split('\0').filter(Boolean).map((path) => path.normalize('NFC')));
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
await rm(work, { recursive: true, force: true });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export async function collectDeployFiles(root, git = listGit) {
|
|
48
|
+
const kept = await unignoredFiles(root, git);
|
|
49
|
+
const folders = new Set([...kept].flatMap((path) => path.split('/').slice(0, -1).map((_, index, parts) => parts.slice(0, index + 1).join('/'))));
|
|
14
50
|
const files = [];
|
|
15
51
|
const paths = ['', '1'].map((development) => credentialsPath({ ...process.env, DEEPDYNAMIC_DEVELOPMENT: development }));
|
|
16
52
|
const credentials = paths.map((path) => path.toLowerCase());
|
|
@@ -31,10 +67,13 @@ export async function collectDeployFiles(root) {
|
|
|
31
67
|
const path = join(directory, entry.name);
|
|
32
68
|
if (await isCredentials(path, entry.name))
|
|
33
69
|
continue;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
70
|
+
const relative = `${prefix}${entry.name}`;
|
|
71
|
+
if (entry.isDirectory()) {
|
|
72
|
+
if (folders.has(relative.normalize('NFC')))
|
|
73
|
+
await walk(path, `${relative}/`);
|
|
74
|
+
}
|
|
75
|
+
else if (entry.isFile() && kept.has(relative.normalize('NFC')))
|
|
76
|
+
files.push(relative);
|
|
38
77
|
}
|
|
39
78
|
};
|
|
40
79
|
await walk(root, '');
|
|
@@ -55,7 +55,16 @@ export async function runDeploy(input, pretty, depth, deps = { ...defaultAuthDep
|
|
|
55
55
|
: agentResult(1, { command, project, directory, error: { code: 'directory_not_found', message: 'The directory does not exist.' } });
|
|
56
56
|
}
|
|
57
57
|
const reader = await deployFileReader(directory);
|
|
58
|
-
|
|
58
|
+
let files;
|
|
59
|
+
try {
|
|
60
|
+
files = await collectDeployFiles(directory);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
64
|
+
return pretty
|
|
65
|
+
? prettyResult(1, depth, command, 'Could not list the files to upload.', [['Directory', directory], ['Reason', message]])
|
|
66
|
+
: agentResult(1, { command, project, directory, error: { code: 'file_list_failed', message } });
|
|
67
|
+
}
|
|
59
68
|
if (files.length === 0) {
|
|
60
69
|
return pretty
|
|
61
70
|
? prettyResult(1, depth, command, 'No files to upload after exclusions.', [['Directory', directory]])
|
package/dist/commands/emails.js
CHANGED
|
@@ -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 ===
|
|
79
|
-
?
|
|
80
|
-
: result.status ===
|
|
81
|
-
?
|
|
82
|
-
: result.status ===
|
|
83
|
-
? { code: '
|
|
84
|
-
:
|
|
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
|
package/dist/commands/keys.js
CHANGED
|
@@ -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
|
|
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
|
|
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}
|
|
104
|
-
const
|
|
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
|
|
107
|
-
return { name, scopes:
|
|
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
|
};
|
|
@@ -7,6 +7,7 @@ import { SITE_URL } from "../../metadata.js";
|
|
|
7
7
|
import { agentResult } from "../../output.js";
|
|
8
8
|
import { prettyResult } from "../../pretty.js";
|
|
9
9
|
import { openBrowser } from "../../runtime/browser.js";
|
|
10
|
+
import { detectAgent } from "../../runtime/card-request.js";
|
|
10
11
|
import { startLoginScreen } from "../../runtime/login-screen.js";
|
|
11
12
|
import { supportMessage } from "../../runtime/support.js";
|
|
12
13
|
export const CLIENT_ID = 'dd-cli';
|
|
@@ -25,7 +26,7 @@ const failure = (pretty, depth, code, message) => pretty
|
|
|
25
26
|
: agentResult(1, { command: 'login', error: { code, message } });
|
|
26
27
|
const supportResult = (pretty, depth, code) => failure(pretty, depth, code, supportMessage(code));
|
|
27
28
|
export const redirectUri = (port) => `http://127.0.0.1:${port}/callback`;
|
|
28
|
-
export function authorizeUrl(siteUrl, port, challenge, state, agent =
|
|
29
|
+
export function authorizeUrl(siteUrl, port, challenge, state, agent = null) {
|
|
29
30
|
const url = new URL('/login/device', siteUrl);
|
|
30
31
|
url.search = new URLSearchParams({
|
|
31
32
|
response_type: 'code',
|
|
@@ -34,7 +35,7 @@ export function authorizeUrl(siteUrl, port, challenge, state, agent = false) {
|
|
|
34
35
|
code_challenge: challenge,
|
|
35
36
|
code_challenge_method: 'S256',
|
|
36
37
|
state,
|
|
37
|
-
...(agent ? { requested_by: 'agent' } : {})
|
|
38
|
+
...(agent ? { requested_by: 'agent', agent } : {})
|
|
38
39
|
}).toString();
|
|
39
40
|
return url.href;
|
|
40
41
|
}
|
|
@@ -114,7 +115,7 @@ export async function login(deps, pretty = false, depth = 1) {
|
|
|
114
115
|
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
|
115
116
|
const { port } = server.address();
|
|
116
117
|
const timer = setTimeout(() => settle(null), deps.timeoutMs);
|
|
117
|
-
const url = authorizeUrl(deps.siteUrl, port, challenge, state,
|
|
118
|
+
const url = authorizeUrl(deps.siteUrl, port, challenge, state, pretty ? null : detectAgent());
|
|
118
119
|
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
120
|
let stop;
|
|
120
121
|
try {
|
|
@@ -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,
|
|
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
|
|
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
|
-
'
|
|
403
|
-
'
|
|
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
|
|
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
|
},
|
|
@@ -582,11 +583,16 @@ export const details = {
|
|
|
582
583
|
`Every deploy needs --agent with the code of the AI agent running it: ${AGENTS.map(([code, name]) => `${code} (${name})`).join(', ')}. Pass your own code. If you cannot tell which code is yours, ask the user before deploying.`,
|
|
583
584
|
'The first deploy with --agent gives the project a flight number such as KR4821, shown with the agent on the projects page. Later deploys keep the flight number and record the agent of the latest deploy. A project deployed before --agent existed gets its flight number on its next deploy.',
|
|
584
585
|
`Write the deploy settings in ${MANIFEST_FILE} at the root of the deployed directory. Without it the directory is served as static files exactly as uploaded, the same as {"output": "."}.`,
|
|
585
|
-
`${MANIFEST_FILE} accepts only these fields: packageManager
|
|
586
|
+
`${MANIFEST_FILE} accepts only these fields: runtime, packageManager, build, output, start and port. A static site sets output (the build output folder relative to the directory, such as "dist"). For Node.js, packageManager is "pnpm", build is "pnpm build" or "pnpm run <script>", and packageManager and build come together or not at all. An app server sets start and port (1024-65535) instead of output and may add build; with Node.js start is "pnpm start" or "pnpm run <script>" and packageManager "pnpm" is required, for example {"packageManager": "pnpm", "build": "pnpm build", "start": "pnpm start", "port": 3000}. Any other field, combination, command, runtime or package manager is rejected.`,
|
|
587
|
+
'For Python, Rust or Java set runtime instead of packageManager: "python3.11", "python3.12", "python3.13", "python3.14", "python3.15", "rust", "java17", "java21" or "java25". No other runtime or version is installed. With runtime, build and start are commands followed by optional arguments separated by single spaces and made only of letters, digits and . _ : = / -. Python commands are "python -m <module>" or "python <file>.py"; they run in a virtual environment after pip installs requirements.txt, which must be committed (it may be empty). Rust commands start with the name of a binary target in Cargo.toml; the project server builds it with cargo build --release --locked on a pinned stable Rust, so Cargo.lock must be committed. A static site with runtime needs build and output, for example {"runtime": "python3.13", "build": "python -m mkdocs build", "output": "site"}; an app server needs start and port, for example {"runtime": "python3.13", "start": "python -m uvicorn main:app --host 127.0.0.1 --port 8000", "port": 8000} or {"runtime": "rust", "start": "server", "port": 8080}. Do not upload a folder named .dd; the deploy uses it.',
|
|
588
|
+
'Java (such as Spring Boot) runs only as an app server, on Eclipse Temurin JDK 17, 21 or 25. build is the Gradle or Maven wrapper committed with the project, "./gradlew <tasks>" or "./mvnw <goals>", for example "./gradlew bootJar" or "./mvnw -DskipTests package"; commit gradlew with the gradle/wrapper folder, or mvnw with the .mvn/wrapper folder. start is "java -jar <file>.jar" with the path of the executable jar the build makes inside the project, for example {"runtime": "java21", "build": "./gradlew bootJar", "start": "java -jar build/libs/demo-0.0.1-SNAPSHOT.jar", "port": 8080}. SERVER_PORT is set to port as well as PORT, so Spring Boot listens on it without extra settings. Put JVM options such as -Xmx512m in JAVA_TOOL_OPTIONS with deepdynamic projects env push, not in start. buildTools is not available for Java.',
|
|
589
|
+
'Add "buildTools": true (only with runtime) when a dependency compiles native code, such as Rust crates using openssl-sys or Python packages without prebuilt wheels. The project server then also installs gcc, pkg-config and libssl-dev, plus python3.X-dev for Python, before the build, so that deploy takes longer than usual: tell the user before deploying. Leave it out otherwise.',
|
|
590
|
+
'The project server can open connections to the internet only on TCP 80, TCP 443, UDP 443, UDP 123 and TCP 4460, and resolves names through the project network DNS. Builds and apps cannot reach databases, mail servers, SSH or other services on other ports, so use HTTPS APIs instead.',
|
|
586
591
|
'An app server must listen on 127.0.0.1 or 0.0.0.0 at the port given in the PORT environment variable, which is set to port. If it does not start answering HTTP, the previous release stays live and the deploy fails with publish_failed and the end of the app log in forAgent.publishLog.',
|
|
587
|
-
'Rules for
|
|
592
|
+
'Rules for a Node.js project you deploy: use pnpm only and commit pnpm-lock.yaml. Do not add npm or yarn lockfiles, and do not call npm, npx, yarn, curl or wget from package.json scripts.',
|
|
588
593
|
'List the packages whose install scripts the build needs, such as esbuild, in pnpm.onlyBuiltDependencies in package.json, and only those.',
|
|
589
594
|
'Never put secrets such as API keys, tokens or .env values into source files or deepdynamic.json. Files named .env, .env.<anything>, .envrc, .dev.vars or .dev.vars.<anything> and credential files and folders such as .npmrc, .netrc, _netrc, .yarnrc.yml, .git-credentials, .pypirc, .ssh, .aws, .docker, .kube and .gnupg are never uploaded, but other names such as .env-local or secrets.json are uploaded like any file. Store secrets with deepdynamic projects env push <name> [<file>] instead: the build and the app server get them from the next deploy. Variables a bundler inlines into browser code (such as VITE_* or NEXT_PUBLIC_*) are public on the site anyway.',
|
|
595
|
+
'Files and folders that the .gitignore files inside the deployed directory match are not uploaded. Git decides this exactly as git status would, so Git must be installed, also for --dry-run. .gitignore files above the directory, .git/info/exclude and global Git excludes are not used, and a subfolder that is itself a Git repository is skipped as Git skips it. Keep build output and environments such as target/, build/, .gradle/, .venv/ and __pycache__/ in .gitignore: one Git upload request is limited to 50 MB.',
|
|
590
596
|
'For a static site the output folder must stay inside the project, and symbolic links in it are not published.',
|
|
591
597
|
'Without a build, files are minified before upload. With a build, sources are uploaded unchanged.',
|
|
592
598
|
'Automatically creates a progress record, reports upload stages, verifies the Git commit on the server and waits for publishing. A stopped project server is turned on first.',
|
|
@@ -617,7 +623,8 @@ export const details = {
|
|
|
617
623
|
server_failed: SUPPORT_HELP,
|
|
618
624
|
deploy_stopped: 'deepdynamic projects stop cancelled this deploy and turned the project server off. Deploy again when the user wants the site back.',
|
|
619
625
|
upload_unverified: UPLOAD_UNVERIFIED,
|
|
620
|
-
progress_unavailable: PROGRESS_UNAVAILABLE
|
|
626
|
+
progress_unavailable: PROGRESS_UNAVAILABLE,
|
|
627
|
+
file_list_failed: 'Git is missing or could not read the .gitignore files of the directory. Install Git or fix the message, then deploy again. No files were uploaded.'
|
|
621
628
|
},
|
|
622
629
|
options: [
|
|
623
630
|
{ flag: '<name>', description: 'Name of one of your projects created with deepdynamic projects create.', required: true },
|
|
@@ -1859,7 +1866,7 @@ export const details = {
|
|
|
1859
1866
|
},
|
|
1860
1867
|
'keys issue': {
|
|
1861
1868
|
options: [
|
|
1862
|
-
{ flag: '<dns|
|
|
1869
|
+
{ 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
1870
|
{ flag: '--expires', description: 'Expiry of a pay key: 10m, 1h, 6h or 1d. Only for pay.', default: '10m' },
|
|
1864
1871
|
{ 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
1872
|
DNS_CHANGE_DRY_RUN
|
|
@@ -1868,7 +1875,8 @@ export const details = {
|
|
|
1868
1875
|
SIGN_IN_NOTE,
|
|
1869
1876
|
'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
1877
|
'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
|
|
1878
|
+
'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.',
|
|
1879
|
+
'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
1880
|
KEYS_SOURCE_NOTE,
|
|
1873
1881
|
DNS_DRY_RUN_NOTE
|
|
1874
1882
|
],
|
|
@@ -1883,22 +1891,23 @@ export const details = {
|
|
|
1883
1891
|
...DNS_CHANGE_ERRORS,
|
|
1884
1892
|
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
1893
|
key_exists: 'A key of that kind is already issued. Revoke it with deepdynamic keys revoke <key-id> --yes first.',
|
|
1886
|
-
|
|
1894
|
+
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.',
|
|
1895
|
+
login_required: 'The login is missing or expired, or the token lacks the scope. Run deepdynamic login again.'
|
|
1887
1896
|
},
|
|
1888
|
-
examples: ['deepdynamic keys issue dns', 'deepdynamic keys issue
|
|
1889
|
-
prettyOptions: [['<dns|
|
|
1897
|
+
examples: ['deepdynamic keys issue dns', 'deepdynamic keys issue dns --dry-run'],
|
|
1898
|
+
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
1899
|
},
|
|
1891
1900
|
'keys create': {
|
|
1892
1901
|
options: [
|
|
1893
1902
|
{ 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
|
|
1903
|
+
{ 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
1904
|
DNS_CHANGE_DRY_RUN
|
|
1896
1905
|
],
|
|
1897
1906
|
notes: [
|
|
1898
1907
|
SIGN_IN_NOTE,
|
|
1899
1908
|
'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
1909
|
'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
|
|
1910
|
+
'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
1911
|
KEYS_SOURCE_NOTE,
|
|
1903
1912
|
DNS_DRY_RUN_NOTE
|
|
1904
1913
|
],
|
|
@@ -1910,8 +1919,8 @@ export const details = {
|
|
|
1910
1919
|
request: 'With --dry-run only: the POST request it would send, { method, url, body: { kind: "custom", name, scopes } }.'
|
|
1911
1920
|
},
|
|
1912
1921
|
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
|
|
1914
|
-
prettyOptions: [['--label', 'Key name, 1-60 characters (required)'], ['--scope', 'Scope dns:read
|
|
1922
|
+
examples: ['deepdynamic keys create --label "Deploy automation" --scope dns:read --scope dns:write', 'deepdynamic keys create --label "DNS reader" --scope dns:read --dry-run'],
|
|
1923
|
+
prettyOptions: [['--label', 'Key name, 1-60 characters (required)'], ['--scope', 'Scope dns:read or dns:write, repeatable (required)'], DNS_CHANGE_DRY_RUN_PRETTY]
|
|
1915
1924
|
},
|
|
1916
1925
|
'keys revoke': {
|
|
1917
1926
|
options: [
|
package/dist/guide.js
CHANGED
|
@@ -7,7 +7,7 @@ const SECTIONS = `## CLI projects and deploys
|
|
|
7
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
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
|
-
- Deploy settings go in \`deepdynamic.json\` at the root of the deploy folder. The only accepted fields are \`packageManager\` (\`pnpm\` only), \`build
|
|
10
|
+
- Deploy settings go in \`deepdynamic.json\` at the root of the deploy folder. The only accepted fields are \`runtime\`, \`buildTools\`, \`packageManager\` (\`pnpm\` only), \`build\`, \`output\` (relative path of the build output folder), \`start\` and \`port\`; without the file the uploaded files are served as they are. For Node.js set \`packageManager\` with \`build\` (\`pnpm build\` or \`pnpm run <script>\`). For an app server set \`start\` and \`port\` (1024-65535) instead of \`output\`: the project server starts it with \`PORT\` set and proxies the site to that port; with Node.js \`start\` is \`pnpm start\` or \`pnpm run <script>\`. For Python, Rust or Java set \`runtime\` to \`python3.11\`, \`python3.12\`, \`python3.13\`, \`python3.14\`, \`python3.15\`, \`rust\`, \`java17\`, \`java21\` or \`java25\` instead of \`packageManager\`; \`build\` and \`start\` are then \`python -m <module>\` or \`python <file>.py\` (commit \`requirements.txt\`), or a Cargo binary name (commit \`Cargo.lock\`), followed by simple arguments. Java (such as Spring Boot) runs only as an app server on Eclipse Temurin: \`build\` is the committed Gradle or Maven wrapper (\`./gradlew bootJar\` or \`./mvnw -DskipTests package\`) and \`start\` is \`java -jar <file>.jar\` with the jar the build makes; \`SERVER_PORT\` is set to \`port\`, and \`buildTools\` is not available. No other runtime or version is available. Add \`"buildTools": true\` only when a dependency compiles native code (for example openssl-sys or a Python package without wheels); it installs gcc, pkg-config and libssl-dev and makes the deploy take longer than usual, so tell the user. The project server reaches the internet only on ports 80 and 443 (plus time sync), so apps must use HTTPS APIs rather than direct database or mail connections. Files matched by \`.gitignore\` files inside the deploy folder are not uploaded (Git decides, so Git must be installed); keep \`target/\`, \`build/\`, \`.gradle/\` and \`.venv/\` there, because one upload request is limited to 50 MB. 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.
|
|
12
12
|
- Environment variables: \`deepdynamic projects env push my-site [.env]\` (\`GET\` and \`POST /api/v1/projects/{project}/env\`) seals the \`.env\` file on this device with the project server's public key, so the web server never sees the values. They reach the build and the app server from the next deploy or rollback and are masked as \`***\` in build and app logs. \`deepdynamic projects env list my-site\` shows only the names and \`deepdynamic projects env clear my-site --yes\` (\`POST /api/v1/projects/{project}/env/clear\`) removes them all. Values inlined into browser code such as \`VITE_*\` or \`NEXT_PUBLIC_*\` are visible on the site anyway.
|
|
13
13
|
- Rollback: \`deepdynamic projects history my-site\` (\`GET /api/v1/projects/{project}/deployments\`) lists only deploys that finished publishing, the latest 20 by commit, and the first entry is the deploy published now. \`deepdynamic projects rollback my-site --yes\` rolls back to the previous deploy, and \`--to <commit>\` to the chosen one. It pushes a new commit holding exactly the files of the target commit, then builds and publishes again in the same stages as \`deepdynamic projects deploy\`; history is never erased. If the user did not name a target, show the history and have them confirm. Until \`deployed: true\` the previous site stays published.
|
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
|
|
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|
|
|
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
|
|
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',
|