@deepdynamic/cli 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/content.js +1 -1
- package/dist/agents/install.js +28 -12
- package/dist/agents/refresh.js +20 -0
- package/dist/agents/setup.js +7 -7
- package/dist/cli.js +8 -8
- package/dist/commands/account.js +19 -19
- package/dist/commands/activity.js +13 -13
- package/dist/commands/blocked.js +16 -16
- package/dist/commands/deploy/index.js +16 -16
- package/dist/commands/deploy/ship.js +8 -8
- package/dist/commands/deployments.js +8 -7
- package/dist/commands/dns.js +229 -243
- package/dist/commands/domains.js +188 -260
- package/dist/commands/emails.js +64 -26
- package/dist/commands/env.js +38 -38
- package/dist/commands/help.js +18 -19
- package/dist/commands/keys.js +84 -90
- package/dist/commands/login/flow.js +11 -11
- package/dist/commands/login/index.js +3 -3
- package/dist/commands/logout.js +11 -11
- package/dist/commands/mail.js +82 -69
- package/dist/commands/notifications.js +30 -29
- package/dist/commands/plan.js +109 -125
- package/dist/commands/projects.js +159 -157
- package/dist/commands/reference.js +139 -112
- package/dist/commands/search.js +29 -18
- package/dist/commands/server.js +100 -112
- package/dist/commands/sessions.js +38 -44
- package/dist/commands/sites.js +16 -16
- package/dist/commands/sms.js +31 -17
- package/dist/commands/status.js +9 -9
- package/dist/commands/support.js +19 -19
- package/dist/commands/update.js +18 -16
- package/dist/commands/usage.js +12 -12
- package/dist/commands/verify.js +16 -16
- package/dist/guide.js +9 -48
- package/dist/http/request.js +3 -3
- package/dist/pretty.js +4 -4
- package/dist/refresh-skills.js +5 -0
- package/dist/registry.js +74 -146
- package/dist/runtime/card-request.js +6 -6
- package/dist/runtime/confirm.js +1 -1
- package/dist/runtime/development.js +1 -1
- package/dist/runtime/dry-run.js +2 -2
- package/dist/runtime/env-file.js +6 -9
- package/dist/runtime/flags.js +11 -13
- package/dist/runtime/login-screen.js +5 -5
- package/dist/runtime/page.js +4 -4
- package/dist/runtime/server-options.js +4 -8
- package/dist/runtime/spinner.js +3 -1
- package/dist/runtime/support.js +2 -3
- package/dist/runtime/text-file.js +5 -5
- package/dist/runtime/timeout.js +2 -2
- package/dist/runtime/update-check.js +48 -14
- package/dist/runtime/update-install.js +40 -5
- package/dist/runtime/usage-error.js +2 -2
- package/dist/setup-agents.js +9 -2
- package/package.json +1 -1
package/dist/commands/usage.js
CHANGED
|
@@ -11,27 +11,27 @@ export const USAGE_PATH = '/api/v1/usage';
|
|
|
11
11
|
const { name: command } = spec('usage');
|
|
12
12
|
const UNAVAILABLE = supportFailure('unavailable');
|
|
13
13
|
const STEPS = [
|
|
14
|
-
{ stage: 'check_options', message: '
|
|
15
|
-
{ stage: 'prepare_request', message: '
|
|
14
|
+
{ stage: 'check_options', message: 'Checking the options.' },
|
|
15
|
+
{ stage: 'prepare_request', message: 'Preparing the usage request.' }
|
|
16
16
|
];
|
|
17
|
-
const count = (value) =>
|
|
18
|
-
const channelText = ({ limit, used, remaining }) => `${count(used)} / ${count(limit)} · ${count(remaining)}
|
|
17
|
+
const count = (value) => value.toLocaleString('en-US');
|
|
18
|
+
const channelText = ({ limit, used, remaining }) => `${count(used)} / ${count(limit)} sent · ${count(remaining)} left`;
|
|
19
19
|
function shown(pretty, depth, body, siteUrl) {
|
|
20
20
|
const { plan, period, resetsAt, sms, email, daily } = body;
|
|
21
21
|
if (!pretty)
|
|
22
22
|
return agentResult(0, { command, siteUrl, plan, period, resetsAt, sms, email, daily });
|
|
23
|
-
return prettyResult(0, depth, command,
|
|
24
|
-
['
|
|
25
|
-
['
|
|
23
|
+
return prettyResult(0, depth, command, `Loaded the sending usage for ${period}.`, [
|
|
24
|
+
['Server', siteUrl],
|
|
25
|
+
['Plan', plan],
|
|
26
26
|
['SMS', channelText(sms)],
|
|
27
|
-
['
|
|
28
|
-
['
|
|
27
|
+
['Email', channelText(email)],
|
|
28
|
+
['Resets', `${resetsAt.slice(0, 10)} 00:00 KST`]
|
|
29
29
|
]);
|
|
30
30
|
}
|
|
31
31
|
export async function runUsage(args, pretty, depth, deps = defaultAuthDeps(pretty, depth)) {
|
|
32
32
|
return rehearsed(command, args, pretty, depth, deps, (rest) => {
|
|
33
33
|
if (rest.length)
|
|
34
|
-
return { error: unknownArgument(rest[0]
|
|
34
|
+
return { error: unknownArgument(rest[0]) };
|
|
35
35
|
const url = (siteUrl) => new URL(USAGE_PATH, siteUrl).href;
|
|
36
36
|
return {
|
|
37
37
|
steps: STEPS,
|
|
@@ -39,8 +39,8 @@ export async function runUsage(args, pretty, depth, deps = defaultAuthDeps(prett
|
|
|
39
39
|
send: {
|
|
40
40
|
method: 'GET',
|
|
41
41
|
url,
|
|
42
|
-
spinner: '
|
|
43
|
-
failed: '
|
|
42
|
+
spinner: 'Loading the usage.',
|
|
43
|
+
failed: 'Could not load the usage.',
|
|
44
44
|
notFound: httpFailure(404),
|
|
45
45
|
failures: { unavailable: UNAVAILABLE },
|
|
46
46
|
succeeded: ({ status }) => status === 200,
|
package/dist/commands/verify.js
CHANGED
|
@@ -14,8 +14,8 @@ import { supportFailure } from "../runtime/support.js";
|
|
|
14
14
|
export const FILE_OPTION = '--file';
|
|
15
15
|
export const SAVE_OPTION = '--save';
|
|
16
16
|
export const MANIFEST_PATH = '/api/v1/sdk/manifest';
|
|
17
|
-
const { name: command, usage
|
|
18
|
-
const MISMATCH = supportFailure('integrity_mismatch', { note:
|
|
17
|
+
const { name: command, usage } = spec('verify');
|
|
18
|
+
const MISMATCH = supportFailure('integrity_mismatch', { note: 'Nothing was saved.' });
|
|
19
19
|
export const integrityOf = (bytes) => `sha384-${createHash('sha384').update(bytes).digest('base64')}`;
|
|
20
20
|
function splitPaths(args) {
|
|
21
21
|
const rest = [];
|
|
@@ -50,10 +50,10 @@ function readScript(body, siteUrl) {
|
|
|
50
50
|
export async function runVerify(args, pretty, depth, deps = { fetch, stream: process.stderr, timeoutMs: 10_000, readFile: (path) => readFile(path), writeFile: (path, bytes) => writeFile(path, bytes) }) {
|
|
51
51
|
const { args: withoutDryRun, dryRun } = splitDryRun(args);
|
|
52
52
|
const split = splitPaths(withoutDryRun);
|
|
53
|
-
const options = 'error' in split ? split : parseServerArgs(split.args
|
|
53
|
+
const options = 'error' in split ? split : parseServerArgs(split.args);
|
|
54
54
|
if ('error' in options) {
|
|
55
55
|
return pretty
|
|
56
|
-
? prettyResult(2, depth, command, options.error, [['
|
|
56
|
+
? prettyResult(2, depth, command, options.error, [['Usage', usage]])
|
|
57
57
|
: agentResult(2, { command, error: { code: 'invalid_arguments', message: options.error }, usage });
|
|
58
58
|
}
|
|
59
59
|
const file = 'file' in split ? split.file : null;
|
|
@@ -62,7 +62,7 @@ export async function runVerify(args, pretty, depth, deps = { fetch, stream: pro
|
|
|
62
62
|
const manifestUrl = new URL(MANIFEST_PATH, siteUrl).href;
|
|
63
63
|
if (dryRun)
|
|
64
64
|
return plannedRequest(command, pretty, depth, siteUrl, manifestUrl);
|
|
65
|
-
const stop = pretty ? startSpinner('
|
|
65
|
+
const stop = pretty ? startSpinner('Checking the script manifest.', deps.stream) : () => { };
|
|
66
66
|
const controller = new AbortController();
|
|
67
67
|
const timer = setTimeout(() => controller.abort(), deps.timeoutMs);
|
|
68
68
|
let script = null;
|
|
@@ -97,7 +97,7 @@ export async function runVerify(args, pretty, depth, deps = { fetch, stream: pro
|
|
|
97
97
|
saved = { path: save, bytes: bytes.byteLength };
|
|
98
98
|
}
|
|
99
99
|
catch {
|
|
100
|
-
failure = { code: 'save_failed', message: `Could not write ${save}.`, display:
|
|
100
|
+
failure = { code: 'save_failed', message: `Could not write ${save}.`, display: `Could not write ${save}.` };
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -108,7 +108,7 @@ export async function runVerify(args, pretty, depth, deps = { fetch, stream: pro
|
|
|
108
108
|
local = { path: file, integrity, matches: integrity === script.integrity };
|
|
109
109
|
}
|
|
110
110
|
catch {
|
|
111
|
-
failure = { code: 'file_unreadable', message: `Could not read ${file}.`, display:
|
|
111
|
+
failure = { code: 'file_unreadable', message: `Could not read ${file}.`, display: `Could not read ${file}.` };
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
if (!failure && (served?.matches === false || local?.matches === false))
|
|
@@ -116,8 +116,8 @@ export async function runVerify(args, pretty, depth, deps = { fetch, stream: pro
|
|
|
116
116
|
}
|
|
117
117
|
catch {
|
|
118
118
|
failure = controller.signal.aborted
|
|
119
|
-
? { code: 'connection_timeout', message: 'The connection timed out.', display: '
|
|
120
|
-
: { code: 'connection_failed', message: 'Could not connect to the deployment server.', display: '
|
|
119
|
+
? { code: 'connection_timeout', message: 'The connection timed out.', display: 'The server did not respond in time.' }
|
|
120
|
+
: { code: 'connection_failed', message: 'Could not connect to the deployment server.', display: 'Check the server URL and your network connection.' };
|
|
121
121
|
}
|
|
122
122
|
finally {
|
|
123
123
|
clearTimeout(timer);
|
|
@@ -134,16 +134,16 @@ export async function runVerify(args, pretty, depth, deps = { fetch, stream: pro
|
|
|
134
134
|
...(failure ? { error: failureError(failure) } : {})
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
-
const rows = [['
|
|
137
|
+
const rows = [['Server', siteUrl]];
|
|
138
138
|
if (script)
|
|
139
|
-
rows.push(['
|
|
139
|
+
rows.push(['Script', script.src], ['Integrity', script.integrity], ['Download', script.download]);
|
|
140
140
|
if (served)
|
|
141
|
-
rows.push(['
|
|
141
|
+
rows.push(['Served file', served.matches ? 'Match' : `Mismatch (${served.integrity})`]);
|
|
142
142
|
if (local)
|
|
143
|
-
rows.push(['
|
|
143
|
+
rows.push(['Local file', local.matches ? `Match (${local.path})` : `Mismatch (${local.integrity})`]);
|
|
144
144
|
if (saved)
|
|
145
|
-
rows.push(['
|
|
145
|
+
rows.push(['Saved', `${saved.path} (${saved.bytes.toLocaleString('en-US')} bytes)`]);
|
|
146
146
|
if (!failure)
|
|
147
|
-
return prettyResult(0, depth, command, '
|
|
148
|
-
return prettyResult(1, depth, command, failure.code === 'integrity_mismatch' ? failure.display : '
|
|
147
|
+
return prettyResult(0, depth, command, 'The script hash matches the manifest.', rows);
|
|
148
|
+
return prettyResult(1, depth, command, failure.code === 'integrity_mismatch' ? failure.display : 'Could not verify the script.', [...rows, ['Reason', failure.display]]);
|
|
149
149
|
}
|
package/dist/guide.js
CHANGED
|
@@ -1,38 +1,7 @@
|
|
|
1
1
|
import { SITE_URL } from "./site.js";
|
|
2
2
|
import { commands } from "./registry.js";
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
en: '# DeepDynamic Cloud CLI Guide'
|
|
6
|
-
};
|
|
7
|
-
const sections = {
|
|
8
|
-
ko: `## CLI 프로젝트와 배포
|
|
9
|
-
- 안내 수준: 먼저 \`deepdynamic account get\`을 실행하고 결과의 \`guide\`를 따르세요. 사용자가 나의 프로젝트(${SITE_URL}/projects)에서 기장 모드를 켰으면 \`audience: "developer"\`로 기술 용어로 안내하고 배포 진행은 \`percent\`와 \`forHuman.detail\`만 전합니다. 켜지 않았거나 확인할 수 없으면 \`audience: "non_developer"\`로 나의 프로젝트 화면의 항공사 표현을 써서 비개발자에게 쉽게 안내하고 배포 진행은 \`percent\`와 \`forHuman.message\`만 전합니다.
|
|
10
|
-
- 프로젝트는 CLI에서만 만듭니다. 첫 배포 전에 \`deepdynamic projects create my-site\`를 한 번 실행하세요. 프로젝트마다 고객 전용 네트워크 안의 서버 한 대와 Git 저장소 하나가 생기고, 미리 준비해 둔 서버를 배정해 켜고 발급 주소를 연결합니다. 상태는 \`deepdynamic projects status my-site\`로, 내 프로젝트 목록은 하위 명령 없이 \`deepdynamic projects\`(최근 활동 순 20개씩, \`--page\`)로 확인합니다. 목록의 \`status\`는 마지막 배포 실행 결과이고, \`live\`가 있으면 그 배포가 계속 게시되어 있습니다. 내 프로젝트가 아닌 이름으로 배포하면 업로드 전에 \`project_not_found\`로 거절됩니다.
|
|
11
|
-
- 프로젝트 이름 짓기: 사용자가 이름을 주지 않았으면 먼저 \`deepdynamic projects\`에서 이 소스로 만든 프로젝트가 있는지 보고, 있으면 거기에 배포하세요. 없으면 소스를 읽고 \`package.json\`의 \`name\`(\`@scope/\` 제외) → 사이트 \`<title>\`·첫 제목 → 폴더 이름 순으로 근거를 찾아 영문 소문자·숫자·하이픈 3~30자로 짓습니다(한글은 뜻을 살려 영어나 로마자로, 예: 목동 국수집 → \`mokdong-noodle\`). \`app\`·\`site\`·\`test\`·\`my-app\`·\`vite-project\`처럼 내용이 드러나지 않는 이름, 개인정보·비밀값은 쓰지 마세요. 이름은 전역에서 하나이므로 후보마다 \`deepdynamic projects create <이름> --dry-run\`(만들지 않고 \`available\`·\`owned\`만 확인)으로 확인한 뒤, 쓸 수 있는 추천 1개와 대안 2개를 근거와 함께 사용자에게 보여 주고 확인받아 만드세요. 이미 쓰이면 무작위 숫자 대신 내용을 드러내는 단어를 붙입니다. 전체 규칙은 \`deepdynamic projects create --help\`의 notes에 있습니다.
|
|
12
|
-
- 이름 바꾸기: \`demo-site\`처럼 내용이 드러나지 않는 이름으로 만든 프로젝트는 새로 만들지 말고 같은 규칙으로 소스에서 이름을 지어 \`deepdynamic projects rename demo-site <새 이름>\`(\`POST /api/v1/projects/{project}/rename\`)으로 바꾸세요. 먼저 \`--dry-run\`으로 쓸 수 있는지 확인하고 추천 1개·대안 2개를 사용자에게 확인받습니다. 발급 주소는 새 이름으로 바뀌고 다음 배포 때 연결됩니다. 서버·저장소·배포 이력은 그대로이고, 이후 명령에는 새 이름을 씁니다.
|
|
13
|
-
- 앱 설치(PWA): \`deepdynamic projects pwa my-site\`(\`GET /api/v1/projects/{project}/pwa\`)는 게이트웨이가 사이트를 설치형 웹 앱으로 알리는지 \`pwa\`로 돌려주고, \`deepdynamic projects pwa my-site on|off\`(\`POST /api/v1/projects/{project}/pwa\`, \`{ enabled }\`)는 이를 바꿉니다. 기본값은 켬이며, 켜져 있으면 HTML 의 \`</head>\` 앞에 항상 \`<link rel="manifest">\`를 끼워 넣되 브라우저는 첫 매니페스트 링크만 쓰므로 사이트의 매니페스트가 우선하고 \`/__dd/manifest.webmanifest\`를 서빙해 안드로이드 크롬의 "앱 설치"·iOS 사파리의 "홈 화면에 추가"에 쓰이게 합니다. 페이지에 UI 는 넣지 않고 사이트 파일도 바꾸지 않으며, 게이트웨이 동기화가 실패하면 \`unavailable\`로 설정은 그대로입니다.
|
|
14
|
-
- 배포 설정은 배포 폴더 루트의 \`deepdynamic.json\`에 씁니다. 받는 필드는 \`packageManager\`(\`pnpm\`만), \`build\`(\`pnpm build\` 또는 \`pnpm run <스크립트>\`), \`output\`(빌드 결과 폴더의 상대 경로), \`start\`·\`port\`뿐이며 파일이 없으면 올린 파일을 그대로 서빙합니다. 앱 서버는 \`output\` 대신 \`start\`(\`pnpm start\` 또는 \`pnpm run <스크립트>\`)와 \`port\`(1024~65535)를 두면 프로젝트 서버가 \`PORT\`를 넣어 띄우고 그 포트로 연결합니다. 전체 규칙은 \`deepdynamic projects deploy --help\`의 notes를 따르세요.
|
|
15
|
-
- 보안 지침: pnpm만 쓰고 \`pnpm-lock.yaml\`을 함께 올리세요(서버는 \`pnpm install --frozen-lockfile\`로 설치합니다). package.json 스크립트에서 npm·npx·yarn·curl·wget을 부르지 말고, 의존성 설치 스크립트는 \`pnpm.onlyBuiltDependencies\`에 꼭 필요한 패키지만 적으세요. API 키·토큰·.env 값을 소스·설정에 넣지 마세요. 빌드는 프로젝트 서버에서 배포 자격 증명 없이 비루트 사용자로 실행됩니다.
|
|
16
|
-
- 환경변수: \`deepdynamic projects env push my-site [.env]\`(\`GET\`·\`POST /api/v1/projects/{project}/env\`)는 \`.env\`를 이 기기에서 프로젝트 서버 공개키로 봉인해 보내므로 웹 서버는 값을 볼 수 없습니다. 다음 배포·되돌리기부터 빌드와 앱 서버에 들어가고 빌드·앱 로그에서는 \`***\`로 가려집니다. \`deepdynamic projects env list my-site\`는 이름만, \`deepdynamic projects env clear my-site --yes\`(\`POST /api/v1/projects/{project}/env/clear\`)는 모두 지웁니다. \`VITE_*\`·\`NEXT_PUBLIC_*\`처럼 브라우저 코드에 들어가는 값은 사이트에서 그대로 보입니다.
|
|
17
|
-
- 되돌리기: \`deepdynamic projects history my-site\`(\`GET /api/v1/projects/{project}/deployments\`)는 게시까지 끝난 배포만 커밋별로 최근 20개 보여 주며 첫 항목이 지금 게시 중인 배포입니다. \`deepdynamic projects rollback my-site --yes\`는 바로 전 배포로, \`--to <커밋>\`은 고른 배포로 되돌립니다. 대상 커밋의 파일을 그대로 담은 새 커밋을 올린 뒤 \`deepdynamic projects deploy\`와 같은 단계로 다시 빌드·게시하고 이력은 지우지 않습니다. 사용자가 대상을 말하지 않았으면 이력을 보여 주고 확인받으세요. \`deployed: true\` 전까지는 이전 사이트가 그대로 게시되어 있습니다.
|
|
18
|
-
- 방문 통계: \`deepdynamic projects metric my-site [--period 24h|7d|30d]\`(\`GET /api/v1/projects/{project}/metric\`)는 나의 프로젝트의 Metric 화면과 같은 방문 수·페이지뷰·평균 체류 시간·이탈률·유입 경로·기기·많이 찾은 페이지를 한국 시간 기준으로 돌려줍니다. 기본 기간은 7일이고, \`previous*\` 값은 바로 전 같은 길이 기간의 수치이니 0이면 증감률을 말하지 마세요.
|
|
19
|
-
- 포토카드: \`deepdynamic projects photocard my-site [--out <폴더>]\`(\`GET /api/v1/projects/{project}/photocard?side=1|2\`)는 나의 프로젝트의 포토카드 앞면·뒷면을 서버가 1000×1500 PNG 로 그려 \`<프로젝트 이름>-1.png\`·\`<프로젝트 이름>-2.png\` 로 저장합니다. 편명은 \`--agent\` 를 붙인 첫 배포에서 생기므로 배포한 적 없는 프로젝트는 \`flight_required\` 입니다.
|
|
20
|
-
- 중단과 삭제: \`deepdynamic projects stop my-site --yes\`(\`POST /api/v1/projects/{project}/stop\`)는 진행 중인 배포를 \`deploy_stopped\`로 끝내고 프로젝트 서버를 끕니다. 서버가 꺼진 동안 사이트는 열리지 않고 다음 배포가 다시 켭니다. 서버가 주기 패키지 업데이트를 설치하는 동안에는 끄지 않고 \`server_updating\`으로 거절되며, 거절되지 않을 때까지 다시 실행합니다. \`deepdynamic projects delete my-site --yes\`(\`POST /api/v1/projects/{project}/delete\`)는 프로젝트의 Git 저장소와 배포 기록을 지우고 서버를 뒤에서 끄고 삭제합니다. 지운 뒤에는 예전 배포로 되돌릴 수 없습니다. 되돌릴 수 없으므로 사용자가 직접 삭제를 요청한 프로젝트만, 이름을 확인받은 뒤 \`--yes\`를 붙여 실행하세요. 서버가 아직 만들어지는 중이면 \`server_busy\`로 거절되며, \`deepdynamic projects status my-site\`로 준비를 확인한 뒤 다시 실행합니다.
|
|
21
|
-
|
|
22
|
-
## CLI 배포 진행 추적
|
|
23
|
-
- 배포할 때마다 \`--agent\`에 배포를 실행하는 에이전트 코드를 넣으세요: \`CLD\`(Claude)·\`CCD\`(Claude Code)·\`CDX\`(Codex)·\`GPT\`(ChatGPT)·\`OPC\`(OpenCode)·\`CRS\`(Crush)·\`CUR\`(Cursor)·\`OTH\`(그 밖의 에이전트나 사람). 내 코드를 모르겠으면 배포 전에 사용자에게 물어보세요. 첫 배포 때 프로젝트에 \`KR4821\` 같은 편명이 붙고, 나의 프로젝트 화면에 편명과 에이전트가 표시됩니다. 예전에 배포한 프로젝트는 다음 배포 때 편명을 받습니다.
|
|
24
|
-
- \`deepdynamic projects deploy my-site ./my-site --agent CCD\`는 \`POST /api/v1/deployments\`로 추적을 시작하고 저장소 준비·파일 정리·Git 전송 단계를 \`POST /api/v1/deployments/{id}\`로 자동 갱신합니다. \`GET /api/v1/deployments/{id}\`로 서버의 Git 커밋 확인과 게시 진행을 조회합니다.
|
|
25
|
-
- 인증은 기존 CLI 로그인 토큰의 \`Authorization: Bearer\` 헤더를 사용합니다. 생성·갱신에는 \`projects:write\`, 조회에는 \`projects:read\`가 필요하며 본인 기록만 접근할 수 있습니다.
|
|
26
|
-
- 사용자에게는 \`percent\`와, \`deepdynamic account get\`의 \`guide\`가 정한 \`forHuman\` 필드를 전달하세요. 에이전트는 \`forAgent.stage\`·\`status\`·\`gitUploaded\`·\`deployed\`·\`nextAction\`을 판단에 사용하세요. \`pollAfterMs\`가 null이면 자동 조회를 멈추세요.
|
|
27
|
-
- 진행률은 단계 기준입니다. Git 저장을 확인하면 90% \`publishing\`으로 넘어가 프로젝트 서버가 빌드·게시하고, 끝나면 100% \`published\`·\`deployed: true\`가 됩니다. \`deployed: false\`인 동안은 배포 완료나 운영 사이트 공개로 안내하지 마세요. 빌드가 실패하면 \`publish_failed\`와 함께 \`forAgent.publishLog\`에 빌드 출력의 끝부분이 담기니 그것을 보고 고친 뒤 다시 배포하세요. \`gitUploaded: false\`는 저장 여부가 아직 확인되지 않았다는 뜻입니다. 예전 기록에 남은 \`publishing_not_configured\`는 게시 연결 전의 상태입니다.
|
|
28
|
-
- CLI의 실시간 진행은 stderr의 JSON lines(\`--pretty\`는 한국어 문구), 최종 결과는 stdout의 JSON입니다. 실패 응답의 \`progress\`는 마지막 확인 상태이며 최신 상태가 아닐 수 있습니다. Git 실행 후 상태 확인이 실패하면 \`uploaded: true\`여도 종료 코드는 1이며 \`deepdynamic deployments <id>\`부터 확인하세요. \`server_pending\`으로 끝나면 \`deepdynamic projects status <이름>\`을, \`publish_pending\`으로 끝나면 \`deepdynamic deployments <id>\`(결과의 \`id\`)를 준비·게시가 끝나거나 실패할 때까지 \`pollAfterMs\` 간격으로 계속 실행하세요. 서버는 이 조회가 올 때만 배포를 다음 단계로 넘기므로 조회를 멈추면 게시되지 않습니다. 결과의 \`statusUrl\`을 직접 호출할 필요는 없습니다.
|
|
29
|
-
- 셸 명령에 제한 시간이 있으면 \`deepdynamic projects deploy\`·\`deepdynamic projects rollback\`·\`deepdynamic projects create\`에 \`--timeout <초>\`(배포·되돌리기 0~900, 생성 0~1200)를 그보다 짧게 주세요. 시간이 다 되면 \`publish_pending\`·\`server_pending\`(종료 코드 1)으로 끝나고 작업은 서버에서 이어지니 위의 조회 명령으로 계속 확인합니다.
|
|
30
|
-
- 로그인이 필요한 명령은 브라우저 로그인 창을 띄우고 최대 10분 기다립니다. 셸 제한 시간이 그보다 짧으면 어느 명령에든 \`--login-timeout <초>\`(1~600)를 그보다 짧게 주세요. 창은 그대로 뜨고, 시간이 다 되면 \`login_timeout\`으로 끝나며 그 창의 승인은 더 이상 쓸 수 없습니다.
|
|
31
|
-
- 실패 결과(\`ok: false\`)의 \`error.retryable\`은 같은 명령을 그대로 다시 실행해도 되는지, \`error.next\`는 다음에 실행할 명령입니다. 알 수 없는 명령·하위 명령·옵션에는 가장 가까운 후보가 \`suggestions\`에 담깁니다. 묶음 도움말(\`deepdynamic projects --help\` 등)은 하위 명령을 요약만 하니 자세한 내용은 요약의 \`help\`(\`deepdynamic projects create --help\` 등)를 실행하세요.
|
|
32
|
-
- 되돌리기 어려운 명령(\`confirm\`이 있는 명령)은 \`--yes\` 없이 실행하면 아무것도 보내지 않고 종료 코드 3과 \`confirmation_required\`로 끝나며, \`error.next\`에 \`--yes\`를 붙인 명령이 담깁니다. 사용자에게 확인받은 뒤에만 그 명령을 실행하세요. \`--dry-run\`은 \`--yes\` 없이 보낼 요청만 돌려줍니다.
|
|
33
|
-
- CLI 업데이트: CLI는 하루 한 번 백그라운드에서 npm의 새 버전을 확인해 전역 설치를 스스로 업데이트하고, 다음 실행부터 새 버전을 씁니다. 그 첫 실행의 stderr에 \`{"event":"updated",...}\` 줄이 한 번 나오니 사용자에게 짧게 알리면 됩니다. \`{"event":"update_available",...}\` 줄은 자동 설치를 하지 못했다는 뜻이니(전역 설치가 아님·권한 오류 등) 하던 일을 마친 뒤 사용자에게 알리고, 확인받으면 \`deepdynamic update --yes\`로 설치하세요(\`deepdynamic update\`만 실행하면 확인만 합니다). \`DEEPDYNAMIC_NO_UPDATE_CHECK=1\`이나 \`CI\` 환경변수가 있으면 확인·자동 설치·알림을 하지 않습니다.
|
|
34
|
-
- 줄바꿈·따옴표가 들어간 긴 본문은 셸 인자 대신 파일로 넘기세요: \`deepdynamic emails send\`·\`deepdynamic sms send\`는 \`--body-file <경로>\`, \`deepdynamic support contact\`는 \`--message-file <경로>\`(UTF-8, 맨 앞 BOM과 끝 줄바꿈 하나는 지움).`,
|
|
35
|
-
en: `## CLI projects and deploys
|
|
3
|
+
const TITLE = '# DeepDynamic Cloud CLI Guide';
|
|
4
|
+
const SECTIONS = `## CLI projects and deploys
|
|
36
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.
|
|
37
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.
|
|
38
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\`.
|
|
@@ -52,25 +21,17 @@ const sections = {
|
|
|
52
21
|
- Authentication uses the \`Authorization: Bearer\` header with the existing CLI login token. Creating and updating need \`projects:write\`, reading needs \`projects:read\`, and only your own records are accessible.
|
|
53
22
|
- Relay to the user \`percent\` and the \`forHuman\` field named by \`guide\` of \`deepdynamic account get\`. As the agent, decide with \`forAgent.stage\`, \`status\`, \`gitUploaded\`, \`deployed\` and \`nextAction\`. Stop automatic polling when \`pollAfterMs\` is null.
|
|
54
23
|
- Progress is based on stages. Once the Git push is confirmed it moves to 90% \`publishing\` while the project server builds and publishes, and when that finishes it becomes 100% \`published\` with \`deployed: true\`. While \`deployed: false\`, do not tell the user the deploy is done or the live site is public. If the build fails you get \`publish_failed\` and the tail of the build output in \`forAgent.publishLog\`; fix the problem from it and deploy again. \`gitUploaded: false\` means the push has not been confirmed yet. \`publishing_not_configured\` in old records is the state from before publishing was connected.
|
|
55
|
-
- The CLI streams live progress as JSON lines on stderr (
|
|
24
|
+
- The CLI streams live progress as JSON lines on stderr (human-readable text with \`--pretty\`) and prints the final result as JSON on stdout. \`progress\` in a failure response is the last checked state and may not be current. If the status check after the Git run fails, the exit code is 1 even with \`uploaded: true\`; start by checking \`deepdynamic deployments <id>\`. If it ends with \`server_pending\`, keep running \`deepdynamic projects status <name>\`, and if it ends with \`publish_pending\`, keep running \`deepdynamic deployments <id>\` (the \`id\` of the result), every \`pollAfterMs\` until preparation or publishing finishes or fails. The server moves a deploy to the next stage only when this check arrives, so if you stop checking it is never published. You do not need to call \`statusUrl\` in the result yourself.
|
|
56
25
|
- If your shell commands have a time limit, give \`deepdynamic projects deploy\`, \`deepdynamic projects rollback\` and \`deepdynamic projects create\` a shorter \`--timeout <seconds>\` (deploy and rollback 0-900, create 0-1200). When it runs out the command ends with \`publish_pending\` or \`server_pending\` (exit code 1) while the work continues on the server, so keep checking with the commands above.
|
|
57
26
|
- Commands that need a login open a browser sign-in window and wait up to 10 minutes. If your shell time limit is shorter, give any command a shorter \`--login-timeout <seconds>\` (1-600). The window still opens; when the time runs out the command ends with \`login_timeout\` and that window can no longer approve the sign-in.
|
|
58
27
|
- In a failed result (\`ok: false\`), \`error.retryable\` tells whether the same command can be run again as is, and \`error.next\` is the command to run next. For an unknown command, subcommand or option, the closest candidates are in \`suggestions\`. Group help (such as \`deepdynamic projects --help\`) only summarizes the subcommands, so run the \`help\` of a summary entry (such as \`deepdynamic projects create --help\`) for details.
|
|
59
28
|
- Commands that are hard to undo (those with \`confirm\`) send nothing without \`--yes\` and end with exit code 3 and \`confirmation_required\`, and \`error.next\` holds the command with \`--yes\`. Run that command only after the user agrees. \`--dry-run\` returns the request it would send without \`--yes\`.
|
|
60
29
|
- CLI updates: at most once a day the CLI checks npm in the background, updates its own global install and uses the new version from the next run. That first run writes a \`{"event":"updated",...}\` line once on stderr; mention it to the user briefly. A \`{"event":"update_available",...}\` line means the automatic install was not possible (not a global install, permission error and so on): finish the current task, tell the user and, after they agree, install it with \`deepdynamic update --yes\` (\`deepdynamic update\` alone only checks). Checking, installing and notices are off when \`DEEPDYNAMIC_NO_UPDATE_CHECK=1\` or \`CI\` is set.
|
|
61
|
-
- Pass long bodies with line breaks or quotes as a file instead of a shell argument: \`--body-file <path>\` for \`deepdynamic emails send\` and \`deepdynamic sms send\`, and \`--message-file <path>\` for \`deepdynamic support contact\` (UTF-8; a leading BOM and one trailing line break are removed)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
en: '## CLI commands\n- Get the whole command tree (with effect, login, `--dry-run` and `--yes`) in one call with `deepdynamic commands` (or `deepdynamic help --all`). Each command has its options, result fields and errors in `deepdynamic <command> --help`.'
|
|
66
|
-
};
|
|
67
|
-
function commandSection(locale) {
|
|
68
|
-
const lines = commands.map(({ usage, prettyUsage, summary, description }) => (locale === 'ko' ? `- \`${prettyUsage}\` — ${summary}` : `- \`${usage}\` — ${description}`));
|
|
69
|
-
return [commandIntro[locale], ...lines].join('\n');
|
|
70
|
-
}
|
|
71
|
-
export function cliGuideSections(locale) {
|
|
72
|
-
return `${sections[locale]}\n\n${commandSection(locale)}`;
|
|
30
|
+
- Pass long bodies with line breaks or quotes as a file instead of a shell argument: \`--body-file <path>\` for \`deepdynamic emails send\` and \`deepdynamic sms send\`, and \`--message-file <path>\` for \`deepdynamic support contact\` (UTF-8; a leading BOM and one trailing line break are removed).`;
|
|
31
|
+
const COMMAND_INTRO = '## CLI commands\n- Get the whole command tree (with effect, login, `--dry-run` and `--yes`) in one call with `deepdynamic commands` (or `deepdynamic help --all`). Each command has its options, result fields and errors in `deepdynamic <command> --help`.';
|
|
32
|
+
export function cliGuideSections() {
|
|
33
|
+
return `${SECTIONS}\n\n${[COMMAND_INTRO, ...commands.map(({ usage, description }) => `- \`${usage}\` — ${description}`)].join('\n')}`;
|
|
73
34
|
}
|
|
74
|
-
export function cliGuideMarkdown(
|
|
75
|
-
return `${
|
|
35
|
+
export function cliGuideMarkdown() {
|
|
36
|
+
return `${TITLE}\n\n${cliGuideSections()}\n`;
|
|
76
37
|
}
|
package/dist/http/request.js
CHANGED
|
@@ -8,7 +8,7 @@ export class LoginExpiredError extends Error {
|
|
|
8
8
|
export const LOGIN_EXPIRED = {
|
|
9
9
|
code: 'login_required',
|
|
10
10
|
message: 'The access token is invalid or expired. Run deepdynamic login again.',
|
|
11
|
-
display: '
|
|
11
|
+
display: 'Your login has expired. Run deepdynamic login to log in again.'
|
|
12
12
|
};
|
|
13
13
|
export const UNEXPECTED = supportFailure('unexpected_response');
|
|
14
14
|
export function httpFailure(status) {
|
|
@@ -33,8 +33,8 @@ export async function request(url, init, deps, spinner, read = readJson) {
|
|
|
33
33
|
}
|
|
34
34
|
catch {
|
|
35
35
|
const failure = controller.signal.aborted
|
|
36
|
-
? { code: 'connection_timeout', message: 'The connection timed out.', display: '
|
|
37
|
-
: { code: 'connection_failed', message: 'Could not connect to the server.', display: '
|
|
36
|
+
? { code: 'connection_timeout', message: 'The connection timed out.', display: 'The server did not respond in time.' }
|
|
37
|
+
: { code: 'connection_failed', message: 'Could not connect to the server.', display: 'Check the server URL and your network connection.' };
|
|
38
38
|
return { failure };
|
|
39
39
|
}
|
|
40
40
|
finally {
|
package/dist/pretty.js
CHANGED
|
@@ -45,18 +45,18 @@ export function renderBanner(version, depth, email, update = null) {
|
|
|
45
45
|
const lines = [
|
|
46
46
|
`${depth > 1 ? `${brand(' DD ')} ` : ''}${bold('DeepDynamic Cloud CLI')} ${dim(version)}`,
|
|
47
47
|
...(email ? [`${dim('Accounts :')} ${plain(email)}`] : []),
|
|
48
|
-
...(update?.event === 'update_available' ? [`${dim('Update :')}
|
|
49
|
-
...(update?.event === 'updated' ? [`${dim('Update :')} ${plain(update.previous)} → ${accent(plain(version))}
|
|
48
|
+
...(update?.event === 'update_available' ? [`${dim('Update :')} New version ${accent(plain(update.latest))} ${dim('· deepdynamic update')}`] : []),
|
|
49
|
+
...(update?.event === 'updated' ? [`${dim('Update :')} Updated ${plain(update.previous)} → ${accent(plain(version))}`] : [])
|
|
50
50
|
];
|
|
51
51
|
return [...lines, accent('─'.repeat(Math.max(...lines.map(displayWidth)))), ''].join('\n');
|
|
52
52
|
}
|
|
53
53
|
export function prettyResult(code, depth, command, message, details = []) {
|
|
54
54
|
const { bold, dim, rail, success, error } = paint(depth);
|
|
55
55
|
const summary = commands.find(({ name }) => name === command)?.summary;
|
|
56
|
-
const usage = details.find(([label]) => label === '
|
|
56
|
+
const usage = details.find(([label]) => label === 'Usage')?.[1];
|
|
57
57
|
const suggestion = code === 2 && typeof usage === 'string' ? optionSuggestion(message, usage) : null;
|
|
58
58
|
if (suggestion)
|
|
59
|
-
details = [...details, ['
|
|
59
|
+
details = [...details, ['Did you mean', suggestion]];
|
|
60
60
|
const rows = details.map(([label, value]) => [label === null ? null : plain(label), shown(value)]);
|
|
61
61
|
const labelWidth = Math.max(0, ...rows.map(([label]) => label === null ? 0 : displayWidth(label)));
|
|
62
62
|
const section = [
|