@playdrop/playdrop-cli 0.3.4-build.1 → 0.3.5-build.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/README.md +60 -23
- package/config/client-meta.json +5 -5
- package/dist/apps/upload.js +5 -3
- package/dist/assets/model-artifacts.js +1 -1
- package/dist/catalogue.d.ts +6 -0
- package/dist/catalogue.js +38 -1
- package/dist/commandContext.d.ts +1 -0
- package/dist/commandContext.js +45 -15
- package/dist/commands/browse.d.ts +16 -0
- package/dist/commands/browse.js +370 -0
- package/dist/commands/build.js +4 -9
- package/dist/commands/capture.js +24 -24
- package/dist/commands/captureRemote.d.ts +11 -0
- package/dist/commands/captureRemote.js +90 -0
- package/dist/commands/comments.d.ts +14 -0
- package/dist/commands/comments.js +189 -0
- package/dist/commands/create.js +112 -72
- package/dist/commands/creations.d.ts +49 -0
- package/dist/commands/creations.js +657 -0
- package/dist/commands/credits.d.ts +10 -0
- package/dist/commands/credits.js +91 -0
- package/dist/commands/detail.d.ts +2 -2
- package/dist/commands/detail.js +148 -290
- package/dist/commands/dev.js +24 -24
- package/dist/commands/devShared.js +2 -2
- package/dist/commands/documentation.d.ts +4 -1
- package/dist/commands/documentation.js +79 -104
- package/dist/commands/feedback.d.ts +12 -9
- package/dist/commands/feedback.js +125 -257
- package/dist/commands/format.js +6 -13
- package/dist/commands/generation.d.ts +11 -0
- package/dist/commands/generation.js +204 -42
- package/dist/commands/gettingStarted.d.ts +1 -0
- package/dist/commands/gettingStarted.js +26 -0
- package/dist/commands/init.js +26 -24
- package/dist/commands/login.js +9 -8
- package/dist/commands/logout.js +2 -1
- package/dist/commands/notifications.d.ts +14 -0
- package/dist/commands/notifications.js +179 -0
- package/dist/commands/search.d.ts +13 -0
- package/dist/commands/search.js +198 -0
- package/dist/commands/upload.js +20 -17
- package/dist/commands/validate.js +15 -1
- package/dist/commands/versionsBrowse.d.ts +7 -0
- package/dist/commands/versionsBrowse.js +209 -0
- package/dist/commands/whoami.js +9 -8
- package/dist/errors.d.ts +9 -0
- package/dist/errors.js +52 -0
- package/dist/externalAssetPackValidation.d.ts +2 -0
- package/dist/externalAssetPackValidation.js +115 -0
- package/dist/http.js +1 -1
- package/dist/index.js +570 -630
- package/dist/messages.js +11 -11
- package/dist/output.d.ts +5 -0
- package/dist/output.js +45 -0
- package/dist/playwright.js +1 -1
- package/dist/refs.d.ts +18 -0
- package/dist/refs.js +105 -0
- package/node_modules/@playdrop/ai-client/dist/index.d.ts +42 -15
- package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/ai-client/package.json +1 -0
- package/node_modules/@playdrop/api-client/dist/client.d.ts +39 -27
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +280 -1669
- package/node_modules/@playdrop/api-client/dist/core/errors.d.ts +9 -0
- package/node_modules/@playdrop/api-client/dist/core/errors.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/core/errors.js +46 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts +27 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/core/request.js +122 -0
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts +75 -0
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/admin.js +282 -0
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +22 -0
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/ai.js +15 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +60 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +301 -0
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts +59 -0
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.js +297 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +62 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.js +297 -0
- package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts +28 -0
- package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/auth.js +78 -0
- package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts +29 -0
- package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/comments.js +65 -0
- package/node_modules/@playdrop/api-client/dist/domains/me.d.ts +24 -0
- package/node_modules/@playdrop/api-client/dist/domains/me.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/me.js +35 -0
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts +37 -0
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/payments.js +148 -0
- package/node_modules/@playdrop/api-client/dist/domains/search.d.ts +27 -0
- package/node_modules/@playdrop/api-client/dist/domains/search.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/search.js +65 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts +33 -56
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +103 -44
- package/node_modules/@playdrop/api-client/package.json +3 -2
- package/node_modules/@playdrop/boxel-core/package.json +1 -1
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +1 -1
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +1 -1
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +1 -1
- package/node_modules/@playdrop/boxel-three/package.json +2 -1
- package/node_modules/@playdrop/config/client-meta.json +5 -5
- package/node_modules/@playdrop/config/dist/src/constants.d.ts +5 -0
- package/node_modules/@playdrop/config/dist/src/constants.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/constants.js +5 -1
- package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@playdrop/config/package.json +1 -1
- package/node_modules/@playdrop/types/dist/api.d.ts +178 -17
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +30 -1
- package/node_modules/@playdrop/types/dist/app.d.ts +0 -14
- package/node_modules/@playdrop/types/dist/app.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/app.js +0 -10
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts +11 -1
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.d.ts +65 -0
- package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/realtime.d.ts +26 -26
- package/node_modules/@playdrop/types/dist/realtime.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.d.ts +5 -0
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/package.json +2 -3
- package/bin/playdrop-cli +0 -2
- package/dist/commands/asset-packs.d.ts +0 -27
- package/dist/commands/asset-packs.js +0 -508
- package/dist/commands/assets.d.ts +0 -35
- package/dist/commands/assets.js +0 -668
- package/dist/commands/list.d.ts +0 -7
- package/dist/commands/list.js +0 -347
- package/dist/commands/migrateCatalogueV2.d.ts +0 -1
- package/dist/commands/migrateCatalogueV2.js +0 -142
- package/dist/commands/versions.d.ts +0 -17
- package/dist/commands/versions.js +0 -384
package/dist/commands/dev.js
CHANGED
|
@@ -17,19 +17,19 @@ const DEFAULT_ROOM_BASE = 'http://localhost:3001';
|
|
|
17
17
|
async function dev(targetArg, _port, appOption) {
|
|
18
18
|
const cfg = (0, config_1.loadConfig)();
|
|
19
19
|
if (!cfg.env) {
|
|
20
|
-
(0, messages_1.printConfigEnvironmentMissing)('dev');
|
|
20
|
+
(0, messages_1.printConfigEnvironmentMissing)('project dev');
|
|
21
21
|
process.exitCode = 1;
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
if (!cfg.token) {
|
|
25
|
-
(0, messages_1.printLoginRequired)('Starting the dev server', 'dev');
|
|
25
|
+
(0, messages_1.printLoginRequired)('Starting the dev server', 'project dev');
|
|
26
26
|
process.exitCode = 1;
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
const envConfig = (0, environment_1.resolveEnvironmentConfig)(cfg.env);
|
|
30
30
|
if (!envConfig) {
|
|
31
31
|
const choices = (0, environment_1.formatEnvironmentList)();
|
|
32
|
-
(0, messages_1.printUnknownEnvironment)(cfg.env, choices, 'dev');
|
|
32
|
+
(0, messages_1.printUnknownEnvironment)(cfg.env, choices, 'project dev');
|
|
33
33
|
process.exitCode = 1;
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
@@ -51,25 +51,25 @@ async function dev(targetArg, _port, appOption) {
|
|
|
51
51
|
suggestions = ['Use "--app <name>" to select which app to run.'];
|
|
52
52
|
break;
|
|
53
53
|
case 'app_not_found':
|
|
54
|
-
suggestions = ['Check the app name in catalogue.json or run "playdrop
|
|
54
|
+
suggestions = ['Check the app name in catalogue.json or run "playdrop project create app" to register a new app.'];
|
|
55
55
|
break;
|
|
56
56
|
case 'catalogue_missing':
|
|
57
|
-
suggestions = ['Run "playdrop
|
|
57
|
+
suggestions = ['Run "playdrop project dev" from a workspace with catalogue.json or provide the path to an HTML file.'];
|
|
58
58
|
break;
|
|
59
59
|
case 'invalid_target':
|
|
60
60
|
suggestions = ['Provide a path to an HTML file or directory containing a catalogue.json.'];
|
|
61
61
|
break;
|
|
62
62
|
case 'empty_catalogue':
|
|
63
|
-
suggestions = ['Add apps to catalogue.json before running "playdrop
|
|
63
|
+
suggestions = ['Add apps to catalogue.json before running "playdrop project dev".'];
|
|
64
64
|
break;
|
|
65
65
|
case 'invalid_catalogue':
|
|
66
|
-
suggestions = ['Fix the catalogue.json file and rerun "playdrop
|
|
66
|
+
suggestions = ['Fix the catalogue.json file and rerun "playdrop project dev".'];
|
|
67
67
|
break;
|
|
68
68
|
default:
|
|
69
69
|
suggestions = ['Provide an app name, HTML file path, or run inside a Playdrop workspace.'];
|
|
70
70
|
break;
|
|
71
71
|
}
|
|
72
|
-
(0, messages_1.printErrorWithHelp)(message, suggestions, { command: 'dev' });
|
|
72
|
+
(0, messages_1.printErrorWithHelp)(message, suggestions, { command: 'project dev' });
|
|
73
73
|
process.exitCode = 1;
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
@@ -78,7 +78,7 @@ async function dev(targetArg, _port, appOption) {
|
|
|
78
78
|
if (!(0, node_fs_1.existsSync)(filePath) || !(0, node_fs_1.statSync)(filePath).isFile()) {
|
|
79
79
|
(0, messages_1.printErrorWithHelp)(`App HTML was not found at ${filePath}.`, [
|
|
80
80
|
'Ensure the catalogue entry points to a compiled HTML file or provide the correct file path.'
|
|
81
|
-
], { command: 'dev' });
|
|
81
|
+
], { command: 'project dev' });
|
|
82
82
|
process.exitCode = 1;
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
@@ -99,8 +99,8 @@ async function dev(targetArg, _port, appOption) {
|
|
|
99
99
|
if (resolvedTarget.cataloguePath) {
|
|
100
100
|
(0, messages_1.printErrorWithHelp)(error?.message || 'Catalogue lookup failed.', [
|
|
101
101
|
'Ensure the HTML file is listed exactly once in catalogue.json with a valid type.',
|
|
102
|
-
'Run "playdrop
|
|
103
|
-
], { command: 'dev' });
|
|
102
|
+
'Run "playdrop project create app <name>" to scaffold a new entry if needed.',
|
|
103
|
+
], { command: 'project dev' });
|
|
104
104
|
process.exitCode = 1;
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
@@ -120,22 +120,22 @@ async function dev(targetArg, _port, appOption) {
|
|
|
120
120
|
}
|
|
121
121
|
if (error instanceof types_1.ApiError) {
|
|
122
122
|
(0, messages_1.printErrorWithHelp)(`Could not fetch your account (status ${error.status}).`, [
|
|
123
|
-
'Run "playdrop
|
|
124
|
-
'Use "playdrop
|
|
125
|
-
], { command: 'dev' });
|
|
123
|
+
'Run "playdrop auth login" to refresh your session and ensure the API is reachable.',
|
|
124
|
+
'Use "playdrop auth whoami" afterwards to confirm your status.'
|
|
125
|
+
], { command: 'project dev' });
|
|
126
126
|
process.exitCode = 1;
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
129
|
if ((0, devShared_1.isNetworkError)(error)) {
|
|
130
|
-
(0, messages_1.printNetworkIssue)('Could not reach the Playdrop API to resolve your account.', 'dev');
|
|
130
|
+
(0, messages_1.printNetworkIssue)('Could not reach the Playdrop API to resolve your account.', 'project dev');
|
|
131
131
|
process.exitCode = 1;
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
if (error instanceof Error && error.message === 'DEV_USERNAME_EMPTY') {
|
|
135
135
|
(0, messages_1.printErrorWithHelp)('Could not determine your Playdrop creator username.', [
|
|
136
|
-
'Retry "playdrop
|
|
136
|
+
'Retry "playdrop project dev" in a moment.',
|
|
137
137
|
'If the problem persists, contact the Playdrop team.'
|
|
138
|
-
], { command: 'dev' });
|
|
138
|
+
], { command: 'project dev' });
|
|
139
139
|
process.exitCode = 1;
|
|
140
140
|
return;
|
|
141
141
|
}
|
|
@@ -158,21 +158,21 @@ async function dev(targetArg, _port, appOption) {
|
|
|
158
158
|
if (error instanceof types_1.ApiError) {
|
|
159
159
|
if (error.status === 404) {
|
|
160
160
|
(0, messages_1.printErrorWithHelp)(`App ${currentUsername}/${appName} is not registered on ${cfg.env}.`, [
|
|
161
|
-
`Run "playdrop
|
|
161
|
+
`Run "playdrop project create app ${appName}" to register the app before starting the dev server.`,
|
|
162
162
|
'If you expected it to exist, ensure you are logged into the correct environment.'
|
|
163
|
-
], { command: 'dev' });
|
|
163
|
+
], { command: 'project dev' });
|
|
164
164
|
}
|
|
165
165
|
else {
|
|
166
166
|
(0, messages_1.printErrorWithHelp)(`Failed to verify app registration (status ${error.status}).`, [
|
|
167
167
|
'Retry in a moment.',
|
|
168
168
|
'If the issue persists, contact the Playdrop team.'
|
|
169
|
-
], { command: 'dev' });
|
|
169
|
+
], { command: 'project dev' });
|
|
170
170
|
}
|
|
171
171
|
process.exitCode = 1;
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
174
|
if ((0, devShared_1.isNetworkError)(error)) {
|
|
175
|
-
(0, messages_1.printNetworkIssue)('Could not reach the Playdrop API to verify the app registration.', 'dev');
|
|
175
|
+
(0, messages_1.printNetworkIssue)('Could not reach the Playdrop API to verify the app registration.', 'project dev');
|
|
176
176
|
process.exitCode = 1;
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
@@ -219,7 +219,7 @@ async function dev(targetArg, _port, appOption) {
|
|
|
219
219
|
(0, messages_1.printErrorWithHelp)(error?.message || 'Failed to upload dev ECS config to engine-server.', [
|
|
220
220
|
'Ensure catalogue entry includes valid "ecs" and "server" paths.',
|
|
221
221
|
'Check PLAYDROP_ROOM_BASE or the default http://localhost:3001 is reachable.',
|
|
222
|
-
], { command: 'dev' });
|
|
222
|
+
], { command: 'project dev' });
|
|
223
223
|
process.exitCode = 1;
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
@@ -237,7 +237,7 @@ async function dev(targetArg, _port, appOption) {
|
|
|
237
237
|
(0, messages_1.printErrorWithHelp)(error?.message || `Failed to start dev server on port ${portToUse}.`, [
|
|
238
238
|
'Check if another process is already using the port.',
|
|
239
239
|
'Ensure the HTML file exists and is readable.',
|
|
240
|
-
], { command: 'dev' });
|
|
240
|
+
], { command: 'project dev' });
|
|
241
241
|
process.exitCode = 1;
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
@@ -275,7 +275,7 @@ async function dev(targetArg, _port, appOption) {
|
|
|
275
275
|
console.log(`\n🎮 Test your app at:`);
|
|
276
276
|
console.log(` ${iframeUrl}`);
|
|
277
277
|
console.log('\nMake something fun then share it with');
|
|
278
|
-
console.log(`playdrop
|
|
278
|
+
console.log(`playdrop project publish ${appName}`);
|
|
279
279
|
}
|
|
280
280
|
else {
|
|
281
281
|
console.log(`\nOpen ${handle.appUrl} in your browser to test locally.`);
|
|
@@ -128,7 +128,7 @@ function resolveDevTarget(targetArg, appOption) {
|
|
|
128
128
|
if (!targetArg) {
|
|
129
129
|
const cataloguePath = findNearestCatalogue(process.cwd());
|
|
130
130
|
if (!cataloguePath) {
|
|
131
|
-
throw createDevError('catalogue_missing', 'Run "playdrop
|
|
131
|
+
throw createDevError('catalogue_missing', 'Run "playdrop project dev" inside a workspace or provide a path to an app HTML file.');
|
|
132
132
|
}
|
|
133
133
|
return resolveAppFromCatalogue(cataloguePath, appOption);
|
|
134
134
|
}
|
|
@@ -179,7 +179,7 @@ function resolveDevTarget(targetArg, appOption) {
|
|
|
179
179
|
}
|
|
180
180
|
const cataloguePath = findNearestCatalogue(process.cwd());
|
|
181
181
|
if (!cataloguePath) {
|
|
182
|
-
throw createDevError('catalogue_missing', `Could not find catalogue.json for app "${targetArg}". Run "playdrop
|
|
182
|
+
throw createDevError('catalogue_missing', `Could not find catalogue.json for app "${targetArg}". Run "playdrop project dev" from a workspace or provide a file path.`);
|
|
183
183
|
}
|
|
184
184
|
return resolveAppFromCatalogue(cataloguePath, targetArg);
|
|
185
185
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
const
|
|
3
|
+
exports.browseDocumentation = browseDocumentation;
|
|
4
|
+
exports.readDocumentation = readDocumentation;
|
|
5
|
+
const commandContext_1 = require("../commandContext");
|
|
6
6
|
const messages_1 = require("../messages");
|
|
7
|
+
const output_1 = require("../output");
|
|
7
8
|
const DOCUMENTATION_ROOT = 'documentation';
|
|
8
9
|
const DOCUMENTATION_INDEX_FILE = 'documentation.json';
|
|
9
10
|
function normalizeDocPath(value) {
|
|
@@ -22,131 +23,105 @@ function normalizeDocPath(value) {
|
|
|
22
23
|
return segments.join('/');
|
|
23
24
|
}
|
|
24
25
|
function encodePathSegments(pathValue) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
return pathValue
|
|
27
|
+
.split('/')
|
|
28
|
+
.map((segment) => encodeURIComponent(segment))
|
|
29
|
+
.join('/');
|
|
28
30
|
}
|
|
29
31
|
function buildDocumentationIndexUrl(base) {
|
|
30
|
-
|
|
31
|
-
return `${normalizedBase}/${DOCUMENTATION_ROOT}/${encodeURIComponent(DOCUMENTATION_INDEX_FILE)}`;
|
|
32
|
+
return `${base.replace(/\/$/, '')}/${DOCUMENTATION_ROOT}/${encodeURIComponent(DOCUMENTATION_INDEX_FILE)}`;
|
|
32
33
|
}
|
|
33
34
|
function buildDocumentationFileUrl(base, relativePath) {
|
|
34
|
-
|
|
35
|
-
return `${normalizedBase}/${DOCUMENTATION_ROOT}/${encodePathSegments(relativePath)}`;
|
|
35
|
+
return `${base.replace(/\/$/, '')}/${DOCUMENTATION_ROOT}/${encodePathSegments(relativePath)}`;
|
|
36
36
|
}
|
|
37
|
-
async function fetchDocumentationIndex(indexUrl) {
|
|
37
|
+
async function fetchDocumentationIndex(indexUrl, command) {
|
|
38
38
|
let response;
|
|
39
39
|
try {
|
|
40
40
|
response = await fetch(indexUrl);
|
|
41
41
|
}
|
|
42
|
-
catch {
|
|
43
|
-
(0, messages_1.
|
|
42
|
+
catch (error) {
|
|
43
|
+
(0, messages_1.printErrorWithHelp)('Fetching documentation failed.', [error instanceof Error ? error.message : String(error)], { command });
|
|
44
44
|
process.exitCode = 1;
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
47
|
if (!response.ok) {
|
|
48
|
-
(0, messages_1.printErrorWithHelp)(`Failed to fetch documentation
|
|
48
|
+
(0, messages_1.printErrorWithHelp)(`Failed to fetch documentation from ${indexUrl}.`, [`HTTP ${response.status} ${response.statusText}`], { command });
|
|
49
49
|
process.exitCode = 1;
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
throw new Error('invalid payload');
|
|
56
|
-
}
|
|
57
|
-
return payload;
|
|
58
|
-
}
|
|
59
|
-
catch {
|
|
60
|
-
(0, messages_1.printErrorWithHelp)(`Documentation index at ${indexUrl} is not valid JSON.`, ['Contact the platform team to refresh the documentation assets.'], { command: 'documentation' });
|
|
61
|
-
process.exitCode = 1;
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
async function fetchDocumentationFile(fileUrl) {
|
|
66
|
-
let response;
|
|
67
|
-
try {
|
|
68
|
-
response = await fetch(fileUrl);
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
(0, messages_1.printNetworkIssue)('Fetching documentation content failed.', 'documentation');
|
|
72
|
-
process.exitCode = 1;
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
if (!response.ok) {
|
|
76
|
-
(0, messages_1.printErrorWithHelp)(`Failed to fetch documentation content from ${fileUrl}.`, [`HTTP ${response.status} ${response.statusText}`], { command: 'documentation' });
|
|
77
|
-
process.exitCode = 1;
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
try {
|
|
81
|
-
return await response.text();
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
(0, messages_1.printErrorWithHelp)('The documentation response could not be read.', ['Retry in a moment or contact the platform team if the issue persists.'], { command: 'documentation' });
|
|
52
|
+
const payload = await response.json().catch(() => null);
|
|
53
|
+
if (!Array.isArray(payload) || payload.some((entry) => typeof entry !== 'string')) {
|
|
54
|
+
(0, messages_1.printErrorWithHelp)('Documentation index is invalid.', ['Retry in a moment or contact the platform team.'], { command });
|
|
85
55
|
process.exitCode = 1;
|
|
86
56
|
return null;
|
|
87
57
|
}
|
|
58
|
+
return payload;
|
|
88
59
|
}
|
|
89
|
-
async function
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
const envConfig = (0, environment_1.resolveEnvironmentConfig)(configuredEnv);
|
|
98
|
-
if (!envConfig) {
|
|
99
|
-
const choices = (0, environment_1.formatEnvironmentList)();
|
|
100
|
-
(0, messages_1.printUnknownEnvironment)(configuredEnv, choices, 'documentation');
|
|
101
|
-
process.exitCode = 1;
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
if (!envConfig.cdnBase) {
|
|
105
|
-
(0, messages_1.printErrorWithHelp)(`Environment "${envConfig.name}" does not include a CDN base URL.`, [
|
|
106
|
-
'Set PLAYDROP_CDN_BASE (or the environment-specific override) before retrying.',
|
|
107
|
-
'Run "playdrop-cli login --env <env>" after updating environment overrides to refresh the CLI configuration.'
|
|
108
|
-
], { command: 'documentation' });
|
|
109
|
-
process.exitCode = 1;
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
if (envConfig.allowInsecureRequests) {
|
|
113
|
-
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
114
|
-
}
|
|
115
|
-
const indexUrl = buildDocumentationIndexUrl(envConfig.cdnBase);
|
|
116
|
-
const rawEntries = await fetchDocumentationIndex(indexUrl);
|
|
117
|
-
if (!rawEntries) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const normalizedEntries = rawEntries
|
|
121
|
-
.map((entry) => normalizeDocPath(entry))
|
|
122
|
-
.filter((entry) => Boolean(entry));
|
|
123
|
-
if (normalizedEntries.length === 0) {
|
|
124
|
-
(0, messages_1.printErrorWithHelp)('Documentation index is empty.', ['Verify the staging pipeline published documentation.json with entries.'], { command: 'documentation' });
|
|
125
|
-
process.exitCode = 1;
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const sortedEntries = [...new Set(normalizedEntries)].sort((a, b) => a.localeCompare(b));
|
|
129
|
-
if (!pathArg) {
|
|
130
|
-
for (const entry of sortedEntries) {
|
|
131
|
-
console.log(entry);
|
|
60
|
+
async function browseDocumentation(options = {}) {
|
|
61
|
+
await (0, commandContext_1.withPublicEnvironment)('documentation browse', async ({ envConfig }) => {
|
|
62
|
+
if (!envConfig.cdnBase) {
|
|
63
|
+
(0, messages_1.printErrorWithHelp)(`Environment "${envConfig.name}" does not include a documentation base URL.`, ['Set PLAYDROP_CDN_BASE or use an environment that publishes documentation assets.'], { command: 'documentation browse' });
|
|
64
|
+
process.exitCode = 1;
|
|
65
|
+
return;
|
|
132
66
|
}
|
|
133
|
-
|
|
134
|
-
|
|
67
|
+
const entries = await fetchDocumentationIndex(buildDocumentationIndexUrl(envConfig.cdnBase), 'documentation browse');
|
|
68
|
+
if (!entries) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const items = [...new Set(entries.map((entry) => normalizeDocPath(entry)).filter((entry) => Boolean(entry)))].sort((a, b) => a.localeCompare(b));
|
|
72
|
+
if (options.json) {
|
|
73
|
+
(0, output_1.printJson)({ items });
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (items.length === 0) {
|
|
77
|
+
console.log('No documentation entries were returned.');
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
console.log('Documentation:\n');
|
|
81
|
+
for (const item of items) {
|
|
82
|
+
console.log(item);
|
|
83
|
+
}
|
|
84
|
+
console.log('\nNext: run "playdrop documentation read <path>" to open one entry.');
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
async function readDocumentation(pathArg) {
|
|
135
88
|
const normalizedTarget = normalizeDocPath(pathArg);
|
|
136
89
|
if (!normalizedTarget) {
|
|
137
|
-
(0, messages_1.printErrorWithHelp)(
|
|
90
|
+
(0, messages_1.printErrorWithHelp)('A documentation path is required.', ['Use a relative path such as sdk/getting-started.md.', 'Run "playdrop documentation browse" to list available entries.'], { command: 'documentation read' });
|
|
138
91
|
process.exitCode = 1;
|
|
139
92
|
return;
|
|
140
93
|
}
|
|
141
|
-
|
|
142
|
-
(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
94
|
+
await (0, commandContext_1.withPublicEnvironment)('documentation read', async ({ envConfig }) => {
|
|
95
|
+
if (!envConfig.cdnBase) {
|
|
96
|
+
(0, messages_1.printErrorWithHelp)(`Environment "${envConfig.name}" does not include a documentation base URL.`, ['Set PLAYDROP_CDN_BASE or use an environment that publishes documentation assets.'], { command: 'documentation read' });
|
|
97
|
+
process.exitCode = 1;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const entries = await fetchDocumentationIndex(buildDocumentationIndexUrl(envConfig.cdnBase), 'documentation read');
|
|
101
|
+
if (!entries) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const normalizedEntries = [...new Set(entries.map((entry) => normalizeDocPath(entry)).filter((entry) => Boolean(entry)))];
|
|
105
|
+
if (!normalizedEntries.includes(normalizedTarget)) {
|
|
106
|
+
(0, messages_1.printErrorWithHelp)(`Documentation entry "${normalizedTarget}" was not found.`, ['Run "playdrop documentation browse" to list available entries.'], { command: 'documentation read' });
|
|
107
|
+
process.exitCode = 1;
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const fileUrl = buildDocumentationFileUrl(envConfig.cdnBase, normalizedTarget);
|
|
111
|
+
let response;
|
|
112
|
+
try {
|
|
113
|
+
response = await fetch(fileUrl);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
(0, messages_1.printErrorWithHelp)(`Fetching documentation entry "${normalizedTarget}" failed.`, [error instanceof Error ? error.message : String(error)], { command: 'documentation read' });
|
|
117
|
+
process.exitCode = 1;
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (!response.ok) {
|
|
121
|
+
(0, messages_1.printErrorWithHelp)(`Failed to fetch "${normalizedTarget}".`, [`HTTP ${response.status} ${response.statusText}`], { command: 'documentation read' });
|
|
122
|
+
process.exitCode = 1;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
process.stdout.write(await response.text());
|
|
126
|
+
});
|
|
152
127
|
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
type
|
|
1
|
+
type FeedbackSendOptions = {
|
|
2
2
|
title?: string;
|
|
3
3
|
comment?: string;
|
|
4
4
|
file?: string;
|
|
5
|
+
json?: boolean;
|
|
5
6
|
};
|
|
6
|
-
type
|
|
7
|
-
limit?: string;
|
|
8
|
-
offset?: string;
|
|
7
|
+
type FeedbackBrowseOptions = {
|
|
8
|
+
limit?: string | number;
|
|
9
|
+
offset?: string | number;
|
|
9
10
|
source?: string;
|
|
10
|
-
userId?: string;
|
|
11
|
-
|
|
11
|
+
userId?: string | number;
|
|
12
|
+
json?: boolean;
|
|
12
13
|
};
|
|
13
|
-
export declare function
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function
|
|
14
|
+
export declare function sendFeedback(options?: FeedbackSendOptions): Promise<void>;
|
|
15
|
+
export declare function browseFeedback(options?: FeedbackBrowseOptions): Promise<void>;
|
|
16
|
+
export declare function deleteFeedbackEntry(rawId: string | undefined, options?: {
|
|
17
|
+
json?: boolean;
|
|
18
|
+
}): Promise<void>;
|
|
16
19
|
export {};
|