@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.
@@ -1,137 +1,137 @@
1
- # Third-party notices
2
-
3
- JoripSpace CLI is licensed under MIT. The dependencies below retain their own licenses and copyrights.
4
- They are installed separately by npm, not bundled into the CLI tarball. These notices record the versions in package-lock.json; other installed versions retain their accompanying licenses.
5
-
6
- ## fflate 0.8.3 — MIT
7
-
8
- https://www.npmjs.com/package/fflate/v/0.8.3
9
-
10
- MIT License
11
-
12
- Copyright (c) 2026 Arjun Barrett
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- The above copyright notice and this permission notice shall be included in all
22
- copies or substantial portions of the Software.
23
-
24
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
- SOFTWARE.
31
-
32
- ## jsonc-parser 3.3.1 — MIT
33
-
34
- https://www.npmjs.com/package/jsonc-parser/v/3.3.1
35
-
36
- The MIT License (MIT)
37
-
38
- Copyright (c) Microsoft
39
-
40
- Permission is hereby granted, free of charge, to any person obtaining a copy
41
- of this software and associated documentation files (the "Software"), to deal
42
- in the Software without restriction, including without limitation the rights
43
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
44
- copies of the Software, and to permit persons to whom the Software is
45
- furnished to do so, subject to the following conditions:
46
-
47
- The above copyright notice and this permission notice shall be included in all
48
- copies or substantial portions of the Software.
49
-
50
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
56
- SOFTWARE.
57
-
58
- ## smol-toml 1.9.1 — BSD-3-Clause
59
-
60
- https://www.npmjs.com/package/smol-toml/v/1.9.1
61
-
62
- Copyright (c) Squirrel Chat et al., All rights reserved.
63
-
64
- Redistribution and use in source and binary forms, with or without
65
- modification, are permitted provided that the following conditions are met:
66
-
67
- 1. Redistributions of source code must retain the above copyright notice, this
68
- list of conditions and the following disclaimer.
69
- 2. Redistributions in binary form must reproduce the above copyright notice,
70
- this list of conditions and the following disclaimer in the
71
- documentation and/or other materials provided with the distribution.
72
- 3. Neither the name of the copyright holder nor the names of its contributors
73
- may be used to endorse or promote products derived from this software without
74
- specific prior written permission.
75
-
76
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
77
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
78
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
79
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
80
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
81
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
82
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
83
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
84
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
85
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
86
-
87
- ## @napi-rs/keyring 2.1.2
88
-
89
- MIT License
90
-
91
- Copyright (c) 2020 N-API for Rust
92
-
93
- Permission is hereby granted, free of charge, to any person obtaining a copy
94
- of this software and associated documentation files (the "Software"), to deal
95
- in the Software without restriction, including without limitation the rights
96
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
97
- copies of the Software, and to permit persons to whom the Software is
98
- furnished to do so, subject to the following conditions:
99
-
100
- The above copyright notice and this permission notice shall be included in all
101
- copies or substantial portions of the Software.
102
-
103
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
104
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
105
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
106
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
107
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
108
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
109
- SOFTWARE.
110
-
111
- Platform binaries are npm dependencies; their bundled Rust dependency notices are included in each platform package's LICENSE.third-party.md. The Linux binary includes libdbus under AFL-2.1 OR GPL-2.0-or-later, with full license texts preserved in that dependency.
112
-
113
- ## ignore 7.0.12 — MIT
114
-
115
- https://www.npmjs.com/package/ignore/v/7.0.12
116
-
117
- Copyright (c) 2013 Kael Zhang <i@kael.me>, contributors
118
- http://kael.me/
119
-
120
- Permission is hereby granted, free of charge, to any person obtaining
121
- a copy of this software and associated documentation files (the
122
- "Software"), to deal in the Software without restriction, including
123
- without limitation the rights to use, copy, modify, merge, publish,
124
- distribute, sublicense, and/or sell copies of the Software, and to
125
- permit persons to whom the Software is furnished to do so, subject to
126
- the following conditions:
127
-
128
- The above copyright notice and this permission notice shall be
129
- included in all copies or substantial portions of the Software.
130
-
131
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
132
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
133
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
134
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
135
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
136
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1
+ # Third-party notices
2
+
3
+ JoripSpace CLI is licensed under MIT. The dependencies below retain their own licenses and copyrights.
4
+ They are installed separately by npm, not bundled into the CLI tarball. These notices record the versions in package-lock.json; other installed versions retain their accompanying licenses.
5
+
6
+ ## fflate 0.8.3 — MIT
7
+
8
+ https://www.npmjs.com/package/fflate/v/0.8.3
9
+
10
+ MIT License
11
+
12
+ Copyright (c) 2026 Arjun Barrett
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+
32
+ ## jsonc-parser 3.3.1 — MIT
33
+
34
+ https://www.npmjs.com/package/jsonc-parser/v/3.3.1
35
+
36
+ The MIT License (MIT)
37
+
38
+ Copyright (c) Microsoft
39
+
40
+ Permission is hereby granted, free of charge, to any person obtaining a copy
41
+ of this software and associated documentation files (the "Software"), to deal
42
+ in the Software without restriction, including without limitation the rights
43
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
44
+ copies of the Software, and to permit persons to whom the Software is
45
+ furnished to do so, subject to the following conditions:
46
+
47
+ The above copyright notice and this permission notice shall be included in all
48
+ copies or substantial portions of the Software.
49
+
50
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
51
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
52
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
53
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
54
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
55
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
56
+ SOFTWARE.
57
+
58
+ ## smol-toml 1.9.1 — BSD-3-Clause
59
+
60
+ https://www.npmjs.com/package/smol-toml/v/1.9.1
61
+
62
+ Copyright (c) Squirrel Chat et al., All rights reserved.
63
+
64
+ Redistribution and use in source and binary forms, with or without
65
+ modification, are permitted provided that the following conditions are met:
66
+
67
+ 1. Redistributions of source code must retain the above copyright notice, this
68
+ list of conditions and the following disclaimer.
69
+ 2. Redistributions in binary form must reproduce the above copyright notice,
70
+ this list of conditions and the following disclaimer in the
71
+ documentation and/or other materials provided with the distribution.
72
+ 3. Neither the name of the copyright holder nor the names of its contributors
73
+ may be used to endorse or promote products derived from this software without
74
+ specific prior written permission.
75
+
76
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
77
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
78
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
79
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
80
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
81
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
82
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
83
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
84
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
85
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
86
+
87
+ ## @napi-rs/keyring 2.1.2
88
+
89
+ MIT License
90
+
91
+ Copyright (c) 2020 N-API for Rust
92
+
93
+ Permission is hereby granted, free of charge, to any person obtaining a copy
94
+ of this software and associated documentation files (the "Software"), to deal
95
+ in the Software without restriction, including without limitation the rights
96
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
97
+ copies of the Software, and to permit persons to whom the Software is
98
+ furnished to do so, subject to the following conditions:
99
+
100
+ The above copyright notice and this permission notice shall be included in all
101
+ copies or substantial portions of the Software.
102
+
103
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
104
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
105
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
106
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
107
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
108
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
109
+ SOFTWARE.
110
+
111
+ Platform binaries are npm dependencies; their bundled Rust dependency notices are included in each platform package's LICENSE.third-party.md. The Linux binary includes libdbus under AFL-2.1 OR GPL-2.0-or-later, with full license texts preserved in that dependency.
112
+
113
+ ## ignore 7.0.12 — MIT
114
+
115
+ https://www.npmjs.com/package/ignore/v/7.0.12
116
+
117
+ Copyright (c) 2013 Kael Zhang <i@kael.me>, contributors
118
+ http://kael.me/
119
+
120
+ Permission is hereby granted, free of charge, to any person obtaining
121
+ a copy of this software and associated documentation files (the
122
+ "Software"), to deal in the Software without restriction, including
123
+ without limitation the rights to use, copy, modify, merge, publish,
124
+ distribute, sublicense, and/or sell copies of the Software, and to
125
+ permit persons to whom the Software is furnished to do so, subject to
126
+ the following conditions:
127
+
128
+ The above copyright notice and this permission notice shall be
129
+ included in all copies or substantial portions of the Software.
130
+
131
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
132
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
133
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
134
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
135
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
136
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
137
137
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/bin/joripspace.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  const { message } = require('../lib/locale');
3
+ const { redactAuthError } = require('../lib/auth-redaction');
3
4
 
4
5
  const fs = require('node:fs');
5
6
  const os = require('node:os');
@@ -9,6 +10,7 @@ const readline = require('node:readline/promises');
9
10
  const { formatDeploymentFailure } = require('../lib/deployment-error');
10
11
  const {
11
12
  printHelp,
13
+ printReportHelp,
12
14
  printDeployHelp,
13
15
  printDeployTemplateHelp,
14
16
  printInstallTemplateHelp,
@@ -36,6 +38,7 @@ const {
36
38
  const { ensureProjectEnvIgnored, readProjectEnv, updateDotEnvFile } = require('../lib/project-env');
37
39
  const { createCredentialStore, normalizeCredentialApiUrl } = require('../lib/credential-store');
38
40
  const credentialStore = createCredentialStore();
41
+ const { persistProjectConnection } = require('../lib/connection-persistence');
39
42
  const { createStartProjectCommand } = require('../lib/start-command');
40
43
  const { legacyCredentialSessionConnection, readProjectMarker } = require('../lib/start');
41
44
  const { buildTemplateDeployRequest, listTemplates } = loadTemplatesPackage();
@@ -149,6 +152,11 @@ async function main() {
149
152
  return;
150
153
  }
151
154
 
155
+ if (command === 'report' && (flags.help || flags.h)) {
156
+ printReportHelp();
157
+ return;
158
+ }
159
+
152
160
  if (
153
161
  (flags.help || flags.h) &&
154
162
  command !== 'deploy' &&
@@ -281,7 +289,9 @@ async function main() {
281
289
  await getUsageBreakdown(flags);
282
290
  return;
283
291
  case 'tokens':
284
- webOnlyCommand(message('API token administration', 'API 토큰 관리'));
292
+ if (rest[0] === 'revoke') await revokeToken(flags);
293
+ else if (rest[0] === 'current') await listTokens(flags);
294
+ else throw new Error('Use tokens current or tokens revoke --current|--token-id ID');
285
295
  return;
286
296
  case 'crons':
287
297
  await remoteCommands.listCrons(flags);
@@ -342,8 +352,14 @@ async function login(flags) {
342
352
  await saveBrowserConnectToken(flags, normalizeConnectToken(connectToken));
343
353
  return;
344
354
  }
345
- const existing = resolveConnection(flags);
346
- if (existing.apiToken) {
355
+ let existing;
356
+ try {
357
+ existing = resolveConnection(flags);
358
+ } catch (error) {
359
+ if (error.code !== 'credential_store_unavailable') throw error;
360
+ // Reauthentication can obtain a new token even when an older OS login is inaccessible.
361
+ }
362
+ if (existing?.apiToken) {
347
363
  await saveBrowserConnectToken(
348
364
  flags,
349
365
  normalizeConnectToken(existing.apiToken),
@@ -387,7 +403,14 @@ function logout(flags) {
387
403
  const legacyGlobal = readGlobalSession(flags);
388
404
  const connection = resolveConnection(flags);
389
405
  const apiUrl = normalizeCredentialApiUrl(connection.apiBaseUrl);
390
- const stored = credentialStore.load(apiUrl, connection.accountId || env.JORIPSPACE_ACCOUNT_ID || '');
406
+ let stored = null;
407
+ let osCredentialStatus = 'not_found';
408
+ try {
409
+ stored = credentialStore.load(apiUrl, connection.accountId || env.JORIPSPACE_ACCOUNT_ID || '');
410
+ } catch (error) {
411
+ if (error.code !== 'credential_store_unavailable' || connection.source === 'os-credential-store') throw error;
412
+ osCredentialStatus = 'unavailable';
413
+ }
391
414
  const token = connection.apiToken || stored?.apiToken;
392
415
  const sameConnection = (candidate) =>
393
416
  candidate?.apiToken === token && trimTrailingSlash(candidate.apiBaseUrl) === apiUrl;
@@ -404,8 +427,10 @@ function logout(flags) {
404
427
  managedProjectFilePath(workspaceDir, '.env.joripspace');
405
428
  const accountId =
406
429
  connection.accountId || env.JORIPSPACE_ACCOUNT_ID || (stored?.apiToken === token ? stored.accountId : '');
407
- if (accountId) credentialStore.remove(apiUrl, accountId);
408
- else if (!connection.apiToken) credentialStore.remove(apiUrl);
430
+ if (stored) {
431
+ credentialStore.remove(apiUrl, stored.accountId);
432
+ osCredentialStatus = 'removed';
433
+ }
409
434
  updateDotEnvFile(path.join(workspaceDir, '.env.joripspace'), {
410
435
  JORIPSPACE_API_BASE_URL: apiUrl,
411
436
  JORIPSPACE_API_TOKEN: null,
@@ -415,11 +440,14 @@ function logout(flags) {
415
440
  });
416
441
  if (legacyProjectPath) fs.unlinkSync(legacyProjectPath);
417
442
  if (clearLegacyGlobal) scrubGlobalSessionToken();
418
- output(flags, { status: 'logged_out' }, () =>
443
+ output(flags, { status: 'logged_out', project_credentials_cleared: true, os_credential_status: osCredentialStatus }, () =>
419
444
  console.log(
420
- message(
421
- 'Logged out: the current saved connection was removed from this device.',
422
- '로그아웃 완료: 이 기기에 저장된 현재 연결을 삭제했습니다.'
445
+ osCredentialStatus === 'unavailable' ? message(
446
+ 'Logged out: saved project credentials were removed. The OS credential store is unavailable and could not be checked.',
447
+ '로그아웃 완료: 프로젝트에 저장된 인증 정보를 삭제했습니다. OS 보안 저장소는 사용할 수 없어 확인하지 못했습니다.'
448
+ ) : message(
449
+ 'Logged out: the current saved connection was removed.',
450
+ '로그아웃 완료: 저장된 현재 연결을 삭제했습니다.'
423
451
  )
424
452
  )
425
453
  );
@@ -455,20 +483,16 @@ async function saveBrowserConnectTokenWithOptions(
455
483
  ? projects[0]
456
484
  : null;
457
485
  if (requestedProject && !selected) throw new Error(`project is not accessible: ${requestedProject}`);
458
- credentialStore.save({ ...connection, accountId: body.account_id });
459
- updateDotEnvFile(path.join(workspaceDir, '.env.joripspace'), {
460
- JORIPSPACE_API_BASE_URL: connection.apiBaseUrl,
461
- JORIPSPACE_API_TOKEN: null,
462
- JORIPSPACE_CONNECT_TOKEN: null,
463
- JORIPSPACE_ACCOUNT_ID: body.account_id,
464
- JORIPSPACE_CONNECTION_SOURCE: 'os-credential-store',
465
- });
486
+ const storage = persistProjectConnection(credentialStore, workspaceDir, { ...connection, accountId: body.account_id });
466
487
  scrubGlobalSessionToken();
467
488
  if (options.output !== false) {
468
- output(flags, body, (value) => {
489
+ output(flags, { ...body, credential_storage: storage }, (value) => {
469
490
  console.log(message(`Connected: ${value.account_id}`, `연결 완료: ${value.account_id}`));
470
491
  console.log(
471
- message(
492
+ storage === 'project-env-fallback' ? message(
493
+ 'Token storage: .env.joripspace (OS credential store unavailable; reused in this project)',
494
+ '토큰 저장 위치: .env.joripspace (OS 보안 저장소를 사용할 수 없어 이 프로젝트에서 재사용)'
495
+ ) : message(
472
496
  'Token storage: OS credential store (reused across project folders)',
473
497
  '토큰 저장 위치: OS 보안 저장소 (다른 프로젝트 폴더에서도 재사용)'
474
498
  )
@@ -553,8 +577,8 @@ async function getProject(flags) {
553
577
  async function reportAgentIssue(flags) {
554
578
  const project = requireProjectId(flags);
555
579
  const category = (stringFlag(flags, 'category') || 'problem').trim().toLowerCase();
556
- if (category !== 'problem' && category !== 'bug') {
557
- throw new Error('report --category must be problem or bug');
580
+ if (category !== 'problem' && category !== 'bug' && category !== 'feedback') {
581
+ throw new Error('report --category must be problem, bug, or feedback');
558
582
  }
559
583
  const summary = (stringFlag(flags, 'summary') || stringFlag(flags, 'message')).trim();
560
584
  if (!summary) throw new Error('report requires --summary');
@@ -1079,12 +1103,8 @@ function printWebhookDelivery(delivery) {
1079
1103
  }
1080
1104
 
1081
1105
  async function listTokens(flags) {
1082
- throw new Error(
1083
- message(
1084
- 'Issue or disable API tokens in your web profile. CLI tokens are for project management.',
1085
- 'API 토큰은 웹 프로필에서 발급하거나 사용 중지해주세요. CLI 토큰은 프로젝트 관리 전용입니다.'
1086
- )
1087
- );
1106
+ const result = await apiRequest(flags, '/v1/me/tokens/current', { method: 'GET', ...projectAuth(flags) });
1107
+ output(flags, result, (value) => console.log(value.token_id));
1088
1108
  }
1089
1109
 
1090
1110
  async function createToken(flags) {
@@ -1097,12 +1117,13 @@ async function createToken(flags) {
1097
1117
  }
1098
1118
 
1099
1119
  async function revokeToken(flags) {
1100
- throw new Error(
1101
- message(
1102
- 'Disable API tokens in your web profile. A CLI token cannot revoke tokens.',
1103
- 'API 토큰은 웹 프로필에서 사용 중지해주세요. CLI 토큰으로 토큰을 폐기할 수 없습니다.'
1104
- )
1105
- );
1120
+ const tokenId = stringFlag(flags, 'token-id');
1121
+ if (Boolean(flags.current) === Boolean(tokenId)) throw new Error('Specify exactly one of --current or --token-id ID');
1122
+ const target = flags.current ? 'current' : tokenId;
1123
+ const result = await apiRequest(flags, `/v1/me/tokens/${encodeURIComponent(target)}`, {
1124
+ method: 'DELETE', ...projectAuth(flags),
1125
+ });
1126
+ output(flags, result, (value) => console.log(`${value.token_id}: ${value.status}`));
1106
1127
  }
1107
1128
 
1108
1129
  async function deleteProject(flags) {
@@ -1160,6 +1181,7 @@ async function apiRequest(flags, apiPath, options) {
1160
1181
  const requestError = new Error(
1161
1182
  redactAuthError(error instanceof Error ? error.message : String(error), [
1162
1183
  options.apiToken,
1184
+ options.adminToken,
1163
1185
  options.body?.code,
1164
1186
  ])
1165
1187
  );
@@ -1172,7 +1194,7 @@ async function apiRequest(flags, apiPath, options) {
1172
1194
  const body = text ? parseJson(text) : {};
1173
1195
 
1174
1196
  if (!response.ok) {
1175
- const safe = redactAuthError(body, [options.apiToken, options.body?.code]);
1197
+ const safe = redactAuthError(body, [options.apiToken, options.adminToken, options.body?.code]);
1176
1198
  const message =
1177
1199
  safe?.error?.message || safe?.message || JSON.stringify(safe) || `HTTP ${response.status}`;
1178
1200
  const apiError = new Error(formatDeploymentFailure(message, safe?.error?.details));
@@ -1189,23 +1211,6 @@ async function apiRequest(flags, apiPath, options) {
1189
1211
  return body;
1190
1212
  }
1191
1213
 
1192
- function redactAuthError(value, secrets) {
1193
- if (typeof value === 'string') {
1194
- for (const secret of secrets.filter(Boolean)) value = value.split(secret).join('[REDACTED]');
1195
- return value;
1196
- }
1197
- if (Array.isArray(value)) return value.map((item) => redactAuthError(item, secrets));
1198
- if (value && typeof value === 'object') {
1199
- return Object.fromEntries(
1200
- Object.entries(value).map(([key, item]) => [
1201
- redactAuthError(key, secrets),
1202
- redactAuthError(item, secrets),
1203
- ])
1204
- );
1205
- }
1206
- return value;
1207
- }
1208
-
1209
1214
  function isDeploymentRequest(apiPath) {
1210
1215
  return /\/deploy(?:ments)?(?:[/?]|$)|\/checkpoints\/[^/]+\/deploy(?:[/?]|$)/.test(apiPath);
1211
1216
  }
@@ -1453,7 +1458,7 @@ function resolveConnection(flags) {
1453
1458
  };
1454
1459
  }
1455
1460
 
1456
- const managedOsConnection = ['os-credential-store', 'logged-out'].includes(
1461
+ const managedOsConnection = ['os-credential-store', 'project-env-fallback', 'logged-out'].includes(
1457
1462
  projectEnv.JORIPSPACE_CONNECTION_SOURCE
1458
1463
  );
1459
1464
  const legacyProjectConnection = managedOsConnection
@@ -1480,7 +1485,12 @@ function resolveConnection(flags) {
1480
1485
  process.env.JORIPSPACE_API_BASE_URL ||
1481
1486
  DEFAULT_API_URL
1482
1487
  );
1483
- const stored = credentialStore.load(selectedApiBaseUrl, projectEnv.JORIPSPACE_ACCOUNT_ID || '');
1488
+ let stored = null;
1489
+ try {
1490
+ stored = credentialStore.load(selectedApiBaseUrl, projectEnv.JORIPSPACE_ACCOUNT_ID || '');
1491
+ } catch (error) {
1492
+ if (error.code !== 'credential_store_unavailable' || projectEnv.JORIPSPACE_CONNECTION_SOURCE === 'os-credential-store') throw error;
1493
+ }
1484
1494
  if (stored) return { ...stored, workspaceDir };
1485
1495
 
1486
1496
  return {
@@ -1548,16 +1558,8 @@ function persistStartConnection(flags, connection, context = {}) {
1548
1558
  }
1549
1559
  const workspaceDir = path.resolve(stringFlag(flags, 'cwd') || projectWorkspaceDir(flags));
1550
1560
  ensureProjectEnvIgnored(workspaceDir);
1551
- const stored =
1552
- connection.source === 'os-credential-store'
1553
- ? connection
1554
- : credentialStore.save({ ...connection, accountId: context.accountId || connection.accountId });
1555
- updateDotEnvFile(path.join(workspaceDir, '.env.joripspace'), {
1556
- JORIPSPACE_API_BASE_URL: stored.apiBaseUrl,
1557
- JORIPSPACE_API_TOKEN: null,
1558
- JORIPSPACE_CONNECT_TOKEN: null,
1559
- JORIPSPACE_ACCOUNT_ID: stored.accountId,
1560
- JORIPSPACE_CONNECTION_SOURCE: 'os-credential-store',
1561
+ persistProjectConnection(credentialStore, workspaceDir, {
1562
+ ...connection, accountId: context.accountId || connection.accountId,
1561
1563
  });
1562
1564
  if (connection.source === 'legacy-global-session') scrubGlobalSessionToken();
1563
1565
  return true;
@@ -0,0 +1 @@
1
+ module.exports = require('../vendor/core/auth-redaction.cjs');
@@ -11,6 +11,7 @@ const {
11
11
  safeProjectRelativePath,
12
12
  } = require('./project-paths');
13
13
  const { ensureProjectEnvIgnored } = require('./project-env');
14
+ const { redactAuthError } = require('./auth-redaction');
14
15
 
15
16
  const HARD_DIRS = new Set(['.git', 'node_modules', '.wrangler', '.cache', 'coverage', 'tmp', 'temp']);
16
17
  const HARD_FILES = new Set(['.ds_store', 'thumbs.db', 'desktop.ini']);
@@ -173,6 +174,13 @@ async function restoreCheckpoint(options) {
173
174
  }
174
175
 
175
176
  function projectFiles(root) {
177
+ return projectFileEntries(root).map(({ relative, path: filePath }) => [
178
+ relative, new Uint8Array(fs.readFileSync(filePath)),
179
+ ]);
180
+ }
181
+
182
+ function projectFileEntries(root) {
183
+ root = path.resolve(root);
176
184
  const files = [];
177
185
  function walk(directory, inherited = []) {
178
186
  const names = directory === root ? ['.gitignore', '.ignore', '.joripspaceignore'] : ['.gitignore'];
@@ -196,7 +204,7 @@ function projectFiles(root) {
196
204
  if (entry.isDirectory()) {
197
205
  walk(full, rules);
198
206
  } else if (entry.isFile()) {
199
- files.push([relative, new Uint8Array(fs.readFileSync(full))]);
207
+ files.push({ relative, path: full, size: stat.size });
200
208
  }
201
209
  }
202
210
  }
@@ -383,6 +391,7 @@ async function apiFetch(options, route, request = {}) {
383
391
  },
384
392
  body: request.bytes || (request.json === undefined ? undefined : JSON.stringify(request.json)),
385
393
  signal: controller.signal,
394
+ redirect: 'error',
386
395
  });
387
396
  } catch (error) {
388
397
  if (error?.name === 'AbortError') {
@@ -390,7 +399,9 @@ async function apiFetch(options, route, request = {}) {
390
399
  timeoutError.code = 'request_timeout';
391
400
  throw timeoutError;
392
401
  }
393
- const requestError = new Error(error instanceof Error ? error.message : String(error));
402
+ const requestError = new Error(redactAuthError(
403
+ error instanceof Error ? error.message : String(error), [options.apiToken]
404
+ ));
394
405
  requestError.code = 'request_failed';
395
406
  throw requestError;
396
407
  } finally {
@@ -413,6 +424,7 @@ async function apiFetch(options, route, request = {}) {
413
424
  body = { message: text };
414
425
  }
415
426
  if (!response.ok) {
427
+ body = redactAuthError(body, [options.apiToken]);
416
428
  const apiError = new Error(
417
429
  body?.error?.message || body?.message || `checkpoint request failed (HTTP ${response.status})`
418
430
  );
@@ -431,6 +443,7 @@ function toPosix(value) {
431
443
  module.exports = {
432
444
  hardExcluded,
433
445
  projectFiles,
446
+ projectFileEntries,
434
447
  runCheckpointOperation,
435
448
  safeRestorePath,
436
449
  verifyRestoreArchive,
@@ -0,0 +1,36 @@
1
+ const path = require('node:path');
2
+ const { normalizeCredentialApiUrl } = require('./credential-store');
3
+ const { ensureProjectEnvIgnored, updateDotEnvFile } = require('./project-env');
4
+
5
+ function persistProjectConnection(store, workspaceDir, connection) {
6
+ ensureProjectEnvIgnored(workspaceDir);
7
+ const apiBaseUrl = normalizeCredentialApiUrl(connection.apiBaseUrl);
8
+ if (!connection.accountId || typeof connection.accountId !== 'string' ||
9
+ typeof connection.apiToken !== 'string' || !connection.apiToken.trim() || /[\r\n]/.test(connection.apiToken)) {
10
+ const error = new Error('Invalid connection credentials. Reconnect with login --code.');
11
+ error.code = 'credential_store_invalid';
12
+ throw error;
13
+ }
14
+ let storage = 'os-credential-store';
15
+ try {
16
+ store.load(apiBaseUrl, connection.accountId);
17
+ } catch (error) {
18
+ if (error.code === 'credential_store_unavailable') storage = 'project-env-fallback';
19
+ // A newly verified login may repair an invalid OS record, but must not
20
+ // downgrade it to plaintext. Save/readback failures below also stay fatal.
21
+ else if (error.code !== 'credential_store_invalid') throw error;
22
+ }
23
+ if (storage === 'os-credential-store' && connection.source !== 'os-credential-store') {
24
+ store.save({ ...connection, apiBaseUrl });
25
+ }
26
+ updateDotEnvFile(path.join(workspaceDir, '.env.joripspace'), {
27
+ JORIPSPACE_API_BASE_URL: apiBaseUrl,
28
+ JORIPSPACE_API_TOKEN: storage === 'project-env-fallback' ? connection.apiToken : null,
29
+ JORIPSPACE_CONNECT_TOKEN: null,
30
+ JORIPSPACE_ACCOUNT_ID: connection.accountId,
31
+ JORIPSPACE_CONNECTION_SOURCE: storage,
32
+ });
33
+ return storage;
34
+ }
35
+
36
+ module.exports = { persistProjectConnection };
@@ -11,8 +11,8 @@ function storeError(code = 'credential_store_unavailable') {
11
11
  'OS 보안 저장소의 JoripSpace 연결 정보가 올바르지 않습니다. login --code로 다시 연결하세요.'
12
12
  )
13
13
  : message(
14
- 'The OS credential store is unavailable. Check Windows Credential Manager, macOS Keychain, or Linux Secret Service. No plaintext fallback is used. For automation, provide JORIPSPACE_API_TOKEN and its API URL through environment variables.',
15
- 'OS 보안 저장소를 사용할 수 없습니다. Windows 자격 증명 관리자, macOS Keychain 또는 Linux Secret Service를 확인하세요. 평문 파일에는 저장하지 않습니다. 자동화에서는 JORIPSPACE_API_TOKEN과 해당 API URL을 환경 변수로 제공할 수 있습니다.'
14
+ 'The OS credential store could not complete this operation. Check Windows Credential Manager, macOS Keychain, or Linux Secret Service. Login uses .env.joripspace only when the store is unavailable before writing; failed writes or verification are not bypassed.',
15
+ 'OS 보안 저장소에서 작업을 완료하지 못했습니다. Windows 자격 증명 관리자, macOS Keychain 또는 Linux Secret Service를 확인하세요. 로그인은 쓰기 전 저장소 사용 불가가 확인된 경우에만 .env.joripspace를 사용하며, 쓰기나 검증 실패를 우회하지 않습니다.'
16
16
  )
17
17
  );
18
18
  error.code = code;