@joripspace/cli 0.5.8 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +243 -142
- package/THIRD_PARTY_NOTICES.md +136 -136
- package/bin/joripspace.js +66 -64
- package/lib/auth-redaction.js +1 -0
- package/lib/checkpoint-client.js +15 -2
- package/lib/connection-persistence.js +36 -0
- package/lib/credential-store.js +2 -2
- package/lib/deploy-files.js +5 -11
- package/lib/deployment-error.js +14 -14
- package/lib/help.js +47 -6
- package/lib/remote-commands.js +3 -42
- package/lib/secret-commands.js +96 -0
- package/lib/start.js +1507 -1507
- package/lib/template-commands.js +15 -9
- package/package.json +48 -48
- package/vendor/core/auth-redaction.cjs +21 -0
- package/vendor/core/cli-onboarding.cjs +35 -5
- package/vendor/core/onboarding.cjs +82 -69
- package/vendor/core/template-publish-workflow.cjs +169 -169
- package/vendor/templates/index.js +104 -104
- package/vendor/templates/templates/basic-worker/files/worker.js +9 -9
- package/vendor/templates/templates/basic-worker/manifest.json +14 -14
- package/vendor/templates/templates/r2-file-api/files/worker.js +42 -42
- package/vendor/templates/templates/r2-file-api/manifest.json +7 -7
package/lib/deploy-files.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const fs = require('node:fs');
|
|
2
2
|
const path = require('node:path');
|
|
3
3
|
const { safeProjectRelativePath } = require('./project-paths');
|
|
4
|
+
const { projectFileEntries } = require('./checkpoint-client');
|
|
4
5
|
|
|
5
6
|
const INLINE_FILE_LIMIT = 16_000;
|
|
6
7
|
const INLINE_TOTAL_LIMIT = 64_000;
|
|
@@ -166,17 +167,10 @@ function findUnresolvedPackageImports(files) {
|
|
|
166
167
|
return [...unresolved].sort();
|
|
167
168
|
}
|
|
168
169
|
|
|
169
|
-
function walkFiles(root
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const relative = toPosix(path.relative(base, fullPath));
|
|
174
|
-
if (entry.isDirectory() && IGNORED_DIRS.has(entry.name.toLowerCase())) continue;
|
|
175
|
-
if (isProtectedProjectPath(relative)) continue;
|
|
176
|
-
if (entry.isDirectory()) files.push(...walkFiles(fullPath, base));
|
|
177
|
-
else if (entry.isFile()) files.push(resolveDeploySourceFile(fullPath, base));
|
|
178
|
-
}
|
|
179
|
-
return files;
|
|
170
|
+
function walkFiles(root) {
|
|
171
|
+
return projectFileEntries(root)
|
|
172
|
+
.filter(({ relative }) => !isProtectedProjectPath(relative))
|
|
173
|
+
.map(({ path: filePath }) => resolveDeploySourceFile(filePath, root));
|
|
180
174
|
}
|
|
181
175
|
|
|
182
176
|
function assertDeployableProjectPath(value) {
|
package/lib/deployment-error.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function formatDeploymentFailure(message, details) {
|
|
4
|
-
if (!details || typeof details !== 'object' || !details.deployment_id) return message;
|
|
5
|
-
const lines = [message, `Deployment: ${details.deployment_id}`];
|
|
6
|
-
if (details.error_stage) lines.push(`Stage: ${details.error_stage}`);
|
|
7
|
-
if (details.error_code) lines.push(`Error code: ${details.error_code}`);
|
|
8
|
-
if (details.error_details && details.error_details !== message) {
|
|
9
|
-
lines.push(`Details: ${details.error_details}`);
|
|
10
|
-
}
|
|
11
|
-
return lines.join('\n');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = { formatDeploymentFailure };
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function formatDeploymentFailure(message, details) {
|
|
4
|
+
if (!details || typeof details !== 'object' || !details.deployment_id) return message;
|
|
5
|
+
const lines = [message, `Deployment: ${details.deployment_id}`];
|
|
6
|
+
if (details.error_stage) lines.push(`Stage: ${details.error_stage}`);
|
|
7
|
+
if (details.error_code) lines.push(`Error code: ${details.error_code}`);
|
|
8
|
+
if (details.error_details && details.error_details !== message) {
|
|
9
|
+
lines.push(`Details: ${details.error_details}`);
|
|
10
|
+
}
|
|
11
|
+
return lines.join('\n');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
module.exports = { formatDeploymentFailure };
|
package/lib/help.js
CHANGED
|
@@ -22,6 +22,9 @@ Usage:
|
|
|
22
22
|
joripspace realtime-v2 activate --project PROJECT
|
|
23
23
|
joripspace realtime-v2 rotate --project PROJECT
|
|
24
24
|
joripspace realtime-v2 keys --project PROJECT --cursor CURSOR
|
|
25
|
+
joripspace tokens current
|
|
26
|
+
joripspace tokens revoke --current
|
|
27
|
+
joripspace tokens revoke --token-id TOKEN_ID
|
|
25
28
|
joripspace realtime-v2 revoke-key --project PROJECT --kid KEY_ID
|
|
26
29
|
joripspace db schema --project PROJECT --token TOKEN
|
|
27
30
|
joripspace db query --project PROJECT --token TOKEN --sql "SELECT name FROM sqlite_schema WHERE type = 'table'"
|
|
@@ -38,7 +41,7 @@ Usage:
|
|
|
38
41
|
joripspace install-template --project PROJECT --token TOKEN --template TEMPLATE --dir . --files-only
|
|
39
42
|
joripspace template pull --project PROJECT --token TOKEN --dir . [--yes]
|
|
40
43
|
joripspace get --project PROJECT --token TOKEN
|
|
41
|
-
joripspace report --project PROJECT --category bug --summary "
|
|
44
|
+
joripspace report --project PROJECT --category problem|bug|feedback --summary "REPORT_SUMMARY" [--details TEXT] [--expected TEXT] [--actual TEXT] [--error-code CODE]
|
|
42
45
|
joripspace deployments --project PROJECT --token TOKEN [--include-failure-details] [--json]
|
|
43
46
|
joripspace deployment get --project PROJECT --deployment DEPLOYMENT_ID --json
|
|
44
47
|
joripspace deployment pull --project PROJECT --deployment DEPLOYMENT_ID --cwd PATH [--force]
|
|
@@ -53,6 +56,8 @@ Usage:
|
|
|
53
56
|
joripspace secrets --project PROJECT
|
|
54
57
|
joripspace secret list --project PROJECT
|
|
55
58
|
joripspace secret generate --project PROJECT --name SESSION_SECRET
|
|
59
|
+
joripspace secret set --project PROJECT --name API_KEY --value-stdin
|
|
60
|
+
joripspace secret update --project PROJECT --name API_KEY --value-stdin
|
|
56
61
|
joripspace crons --project PROJECT
|
|
57
62
|
joripspace cron create --project PROJECT --schedule "0 * * * *" --path /jobs/hourly
|
|
58
63
|
joripspace cron run --project PROJECT --cron-id CRON_ID
|
|
@@ -84,11 +89,12 @@ Login:
|
|
|
84
89
|
Open https://joripspace.com/connect/ and ask the user to paste the displayed connection code.
|
|
85
90
|
New logins store tokens in Windows Credential Manager, macOS Keychain, or Linux Secret Service.
|
|
86
91
|
Saved connections are reused in other project folders on the same OS user account.
|
|
87
|
-
|
|
92
|
+
New logins prefer the OS credential store. If unavailable before writing, the token is saved
|
|
93
|
+
in the ignored PROJECT_FOLDER/.env.joripspace instead. logout removes the saved token.
|
|
88
94
|
Existing token-bearing .env.joripspace files and process environment tokens remain supported.
|
|
89
95
|
Run login in an existing connected folder to move its token to the OS store without a new code.
|
|
90
96
|
The CLI searches parent folders and never reads an ordinary application .env for authentication.
|
|
91
|
-
|
|
97
|
+
Failed OS writes or readback verification stop login without creating a file fallback.
|
|
92
98
|
A successful connection also logs you in; no separate login step is required.
|
|
93
99
|
logout removes the current account's OS credential and the current folder's legacy credentials.
|
|
94
100
|
It does not revoke server tokens or remove credentials in other legacy project folders.
|
|
@@ -106,9 +112,14 @@ Project creation:
|
|
|
106
112
|
Security:
|
|
107
113
|
CLI tokens are for project lookup, workspace linking, project DB/storage work, server deployment, usage, and logs.
|
|
108
114
|
Project checkpoints can be saved, restored locally, and deployed independently with the checkpoint command.
|
|
109
|
-
Deployment rollback,
|
|
115
|
+
Deployment rollback, Secret generation/listing and stdin registration/replacement, crons, domains, and mail status/test are available.
|
|
110
116
|
Manage custom domains with the domain command.
|
|
111
|
-
|
|
117
|
+
Use secret set or secret update --name NAME --value-stdin for Secret registration/replacement.
|
|
118
|
+
Secret values are never returned. Secret deletion remains in the project web Secret page.
|
|
119
|
+
Manage members, billing, token issuance, webhooks, and project deletion in the web UI.
|
|
120
|
+
tokens current returns the current token ID without its secret.
|
|
121
|
+
tokens revoke disables a token server-side within your account. --current ends this connection;
|
|
122
|
+
use a new connection code to reconnect. logout only removes local credentials.
|
|
112
123
|
|
|
113
124
|
${message('Language', '언어')}:
|
|
114
125
|
${message('Messages follow the OS default locale: Korean or English. Unsupported locales use English.', '안내는 OS 기본 로캘에 따라 한국어 또는 영어로 표시합니다. 미지원 로캘은 영어를 사용합니다.')}
|
|
@@ -122,6 +133,36 @@ Global flags:
|
|
|
122
133
|
`);
|
|
123
134
|
}
|
|
124
135
|
|
|
136
|
+
function printReportHelp() {
|
|
137
|
+
console.log(`JoripSpace report
|
|
138
|
+
|
|
139
|
+
Submit a project-related problem, bug, or improvement suggestion to JoripSpace.
|
|
140
|
+
|
|
141
|
+
Usage:
|
|
142
|
+
joripspace report --project PROJECT --category problem|bug|feedback --summary "SUMMARY"
|
|
143
|
+
|
|
144
|
+
Options:
|
|
145
|
+
--project PROJECT Existing project name; defaults to the current linked project.
|
|
146
|
+
--category TYPE problem (default), bug, or feedback (suggestions and improvements).
|
|
147
|
+
--summary TEXT Required summary, up to 160 characters. --message is an alias.
|
|
148
|
+
--details TEXT Context or reproduction steps, up to 8000 characters.
|
|
149
|
+
--expected TEXT Expected behavior or desired improvement, up to 4000 characters.
|
|
150
|
+
--actual TEXT Current behavior, up to 4000 characters.
|
|
151
|
+
--error-code CODE Optional error code, up to 120 characters.
|
|
152
|
+
--cwd PATH Resolve the project and saved login from this folder.
|
|
153
|
+
--json Return structured success or failure without prompting.
|
|
154
|
+
|
|
155
|
+
Examples:
|
|
156
|
+
joripspace report --category bug --summary "Deployment status is incorrect"
|
|
157
|
+
joripspace report --category feedback --summary "Add filtering to deployment history"
|
|
158
|
+
|
|
159
|
+
The command sends a report; it does not just save a local draft.
|
|
160
|
+
Use an existing login. Never include credentials, personal data, or private source.
|
|
161
|
+
CLI version, Node.js version and OS are attached automatically.
|
|
162
|
+
A successful response includes report_id. Do not blindly retry an uncertain submission.
|
|
163
|
+
`);
|
|
164
|
+
}
|
|
165
|
+
|
|
125
166
|
function printDeployHelp() {
|
|
126
167
|
console.log(`JoripSpace deploy
|
|
127
168
|
|
|
@@ -172,4 +213,4 @@ Template updates:
|
|
|
172
213
|
`);
|
|
173
214
|
}
|
|
174
215
|
|
|
175
|
-
module.exports = { printHelp, printDeployHelp, printDeployTemplateHelp, printInstallTemplateHelp };
|
|
216
|
+
module.exports = { printHelp, printReportHelp, printDeployHelp, printDeployTemplateHelp, printInstallTemplateHelp };
|
package/lib/remote-commands.js
CHANGED
|
@@ -9,8 +9,10 @@ const {
|
|
|
9
9
|
safeProjectRelativePath,
|
|
10
10
|
} = require('./project-paths');
|
|
11
11
|
const { ensureProjectEnvIgnored } = require('./project-env');
|
|
12
|
+
const { createSecretCommands } = require('./secret-commands');
|
|
12
13
|
|
|
13
14
|
function createRemoteCommands(deps) {
|
|
15
|
+
const secrets = createSecretCommands(deps);
|
|
14
16
|
async function knowledge(rest, flags) {
|
|
15
17
|
const subcommand = rest[0] || 'search';
|
|
16
18
|
if (subcommand !== 'search') throw new Error('knowledge command requires: search');
|
|
@@ -140,47 +142,6 @@ function createRemoteCommands(deps) {
|
|
|
140
142
|
}
|
|
141
143
|
}
|
|
142
144
|
|
|
143
|
-
async function secrets(rest, flags) {
|
|
144
|
-
const subcommand = rest[0] || 'list';
|
|
145
|
-
if (subcommand === 'list') return listSecrets(flags);
|
|
146
|
-
if (subcommand === 'generate') return generateSecret(flags);
|
|
147
|
-
if (subcommand === 'set' || subcommand === 'delete')
|
|
148
|
-
return deps.webOnlyCommand(message('External secret value management', '외부 시크릿 값 관리'));
|
|
149
|
-
throw new Error('secret command requires: list or generate');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
async function generateSecret(flags) {
|
|
153
|
-
const project = deps.requireProjectId(flags);
|
|
154
|
-
const name = deps.stringFlag(flags, 'name');
|
|
155
|
-
if (!name) throw new Error('secret generate requires --name');
|
|
156
|
-
const body = await deps.apiRequest(
|
|
157
|
-
flags,
|
|
158
|
-
`/v1/projects/${encodeURIComponent(project)}/secrets/generate`,
|
|
159
|
-
{
|
|
160
|
-
method: 'POST',
|
|
161
|
-
...deps.projectAuth(flags),
|
|
162
|
-
body: { name },
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
deps.output(flags, body, (value) => {
|
|
166
|
-
console.log(`Secret: ${value.name || name}`);
|
|
167
|
-
console.log(`Status: ${value.status || (value.generated ? 'generated' : 'preserved')}`);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
async function listSecrets(flags) {
|
|
172
|
-
const project = deps.requireProjectId(flags);
|
|
173
|
-
const body = await deps.apiRequest(flags, `/v1/projects/${encodeURIComponent(project)}/secrets`, {
|
|
174
|
-
method: 'GET',
|
|
175
|
-
...deps.projectAuth(flags),
|
|
176
|
-
});
|
|
177
|
-
deps.output(flags, body, (value) => {
|
|
178
|
-
for (const secret of value.secrets || []) {
|
|
179
|
-
console.log(`${secret.name}\tcreated=${secret.created_at}\tupdated=${secret.updated_at}`);
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
145
|
async function crons(rest, flags) {
|
|
185
146
|
const subcommand = rest[0] || 'list';
|
|
186
147
|
if (subcommand === 'list') return listCrons(flags);
|
|
@@ -402,7 +363,7 @@ function createRemoteCommands(deps) {
|
|
|
402
363
|
knowledge,
|
|
403
364
|
listCrons,
|
|
404
365
|
listDomains,
|
|
405
|
-
listSecrets,
|
|
366
|
+
listSecrets: (flags) => secrets(['list'], flags),
|
|
406
367
|
mail,
|
|
407
368
|
pullDeploymentSource,
|
|
408
369
|
secrets,
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const { message } = require('./locale');
|
|
2
|
+
|
|
3
|
+
function secretManagementUrl(project) {
|
|
4
|
+
return `https://joripspace.com/projects/${encodeURIComponent(project)}/?tab=secrets`;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function createSecretCommands(deps) {
|
|
8
|
+
return async function secrets(rest, flags) {
|
|
9
|
+
const subcommand = rest[0] || 'list';
|
|
10
|
+
if (subcommand === 'delete') {
|
|
11
|
+
return deps.webOnlyCommand(message('Secret deletion', '비밀 키 삭제'));
|
|
12
|
+
}
|
|
13
|
+
if (!['list', 'generate', 'set', 'update'].includes(subcommand)) {
|
|
14
|
+
throw new Error('secret command requires: list, generate, set, or update');
|
|
15
|
+
}
|
|
16
|
+
const project = deps.requireProjectId(flags);
|
|
17
|
+
const url = secretManagementUrl(project);
|
|
18
|
+
const auth = deps.projectAuth(flags);
|
|
19
|
+
const endpoint = `/v1/projects/${encodeURIComponent(project)}/secrets`;
|
|
20
|
+
let result;
|
|
21
|
+
if (subcommand === 'list') {
|
|
22
|
+
result = await deps.apiRequest(flags, endpoint, { method: 'GET', ...auth });
|
|
23
|
+
} else {
|
|
24
|
+
const name = deps.stringFlag(flags, 'name').toUpperCase();
|
|
25
|
+
if (!name || !/^[_A-Z][_A-Z0-9]{0,127}$/.test(name)) {
|
|
26
|
+
throw new Error('secret requires --name matching [_A-Z][_A-Z0-9]* (at most 128 characters)');
|
|
27
|
+
}
|
|
28
|
+
if (subcommand === 'generate') {
|
|
29
|
+
result = await deps.apiRequest(flags, `${endpoint}/generate`, {
|
|
30
|
+
method: 'POST', ...auth, body: { name },
|
|
31
|
+
});
|
|
32
|
+
} else {
|
|
33
|
+
if (!deps.booleanFlag(flags, 'value-stdin') || flags.value !== undefined) {
|
|
34
|
+
throw new Error(message(
|
|
35
|
+
'Use --value-stdin to supply the secret through standard input, never a command-line value.',
|
|
36
|
+
'--value-stdin으로 비밀 키 값을 표준 입력으로 전달하세요. 명령 인자에는 값을 넣지 마세요.'
|
|
37
|
+
));
|
|
38
|
+
}
|
|
39
|
+
const value = await readSecretValue(process.stdin);
|
|
40
|
+
try {
|
|
41
|
+
await deps.apiRequest(flags, endpoint, { method: 'POST', ...auth, body: { name, value } });
|
|
42
|
+
} catch (cause) {
|
|
43
|
+
// An upstream failure may echo all or part of a value. Report only safe metadata.
|
|
44
|
+
const error = new Error(message('The secret could not be saved.', '비밀 키를 저장하지 못했습니다.'));
|
|
45
|
+
error.code = 'secret_set_failed';
|
|
46
|
+
error.details = {
|
|
47
|
+
name, secret_management_url: url,
|
|
48
|
+
...(Number.isInteger(cause?.status) ? { http_status: cause.status } : {}),
|
|
49
|
+
};
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
result = { status: 'success', project_id: project, name };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
result = { ...result, secret_management_url: url };
|
|
56
|
+
deps.output(flags, result, (body) => {
|
|
57
|
+
if (subcommand === 'list') {
|
|
58
|
+
for (const secret of body.secrets || []) {
|
|
59
|
+
console.log(`${secret.name}\tcreated=${secret.created_at}\tupdated=${secret.updated_at}`);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
console.log(`Secret: ${body.name}`);
|
|
63
|
+
console.log(`Status: ${body.status || (body.created || body.generated ? 'generated' : 'preserved')}`);
|
|
64
|
+
}
|
|
65
|
+
console.log(`${message('Secret management', '비밀 키 관리')}: ${url}`);
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function readSecretValue(input) {
|
|
71
|
+
if (input.isTTY) {
|
|
72
|
+
throw new Error(message('Pipe the secret value to standard input.', '비밀 키 값을 표준 입력으로 전달하세요.'));
|
|
73
|
+
}
|
|
74
|
+
const chunks = [];
|
|
75
|
+
let size = 0;
|
|
76
|
+
try {
|
|
77
|
+
for await (const chunk of input) {
|
|
78
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
79
|
+
chunks.push(bytes);
|
|
80
|
+
size += bytes.length;
|
|
81
|
+
if (size > 5120) throw new Error('invalid size');
|
|
82
|
+
}
|
|
83
|
+
if (!size) throw new Error('empty value');
|
|
84
|
+
// Preserve whitespace and newlines, including multi-line provider keys.
|
|
85
|
+
return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(Buffer.concat(chunks));
|
|
86
|
+
} catch {
|
|
87
|
+
throw new Error(message(
|
|
88
|
+
'Secret input must contain 1-5120 UTF-8 bytes.',
|
|
89
|
+
'비밀 키 값은 UTF-8 기준 1~5120바이트여야 합니다.'
|
|
90
|
+
));
|
|
91
|
+
} finally {
|
|
92
|
+
for (const chunk of chunks) chunk.fill(0);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
module.exports = { createSecretCommands, secretManagementUrl };
|