@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.
Files changed (141) hide show
  1. package/README.md +60 -23
  2. package/config/client-meta.json +5 -5
  3. package/dist/apps/upload.js +5 -3
  4. package/dist/assets/model-artifacts.js +1 -1
  5. package/dist/catalogue.d.ts +6 -0
  6. package/dist/catalogue.js +38 -1
  7. package/dist/commandContext.d.ts +1 -0
  8. package/dist/commandContext.js +45 -15
  9. package/dist/commands/browse.d.ts +16 -0
  10. package/dist/commands/browse.js +370 -0
  11. package/dist/commands/build.js +4 -9
  12. package/dist/commands/capture.js +24 -24
  13. package/dist/commands/captureRemote.d.ts +11 -0
  14. package/dist/commands/captureRemote.js +90 -0
  15. package/dist/commands/comments.d.ts +14 -0
  16. package/dist/commands/comments.js +189 -0
  17. package/dist/commands/create.js +112 -72
  18. package/dist/commands/creations.d.ts +49 -0
  19. package/dist/commands/creations.js +657 -0
  20. package/dist/commands/credits.d.ts +10 -0
  21. package/dist/commands/credits.js +91 -0
  22. package/dist/commands/detail.d.ts +2 -2
  23. package/dist/commands/detail.js +148 -290
  24. package/dist/commands/dev.js +24 -24
  25. package/dist/commands/devShared.js +2 -2
  26. package/dist/commands/documentation.d.ts +4 -1
  27. package/dist/commands/documentation.js +79 -104
  28. package/dist/commands/feedback.d.ts +12 -9
  29. package/dist/commands/feedback.js +125 -257
  30. package/dist/commands/format.js +6 -13
  31. package/dist/commands/generation.d.ts +11 -0
  32. package/dist/commands/generation.js +204 -42
  33. package/dist/commands/gettingStarted.d.ts +1 -0
  34. package/dist/commands/gettingStarted.js +26 -0
  35. package/dist/commands/init.js +26 -24
  36. package/dist/commands/login.js +9 -8
  37. package/dist/commands/logout.js +2 -1
  38. package/dist/commands/notifications.d.ts +14 -0
  39. package/dist/commands/notifications.js +179 -0
  40. package/dist/commands/search.d.ts +13 -0
  41. package/dist/commands/search.js +198 -0
  42. package/dist/commands/upload.js +20 -17
  43. package/dist/commands/validate.js +15 -1
  44. package/dist/commands/versionsBrowse.d.ts +7 -0
  45. package/dist/commands/versionsBrowse.js +209 -0
  46. package/dist/commands/whoami.js +9 -8
  47. package/dist/errors.d.ts +9 -0
  48. package/dist/errors.js +52 -0
  49. package/dist/externalAssetPackValidation.d.ts +2 -0
  50. package/dist/externalAssetPackValidation.js +115 -0
  51. package/dist/http.js +1 -1
  52. package/dist/index.js +570 -630
  53. package/dist/messages.js +11 -11
  54. package/dist/output.d.ts +5 -0
  55. package/dist/output.js +45 -0
  56. package/dist/playwright.js +1 -1
  57. package/dist/refs.d.ts +18 -0
  58. package/dist/refs.js +105 -0
  59. package/node_modules/@playdrop/ai-client/dist/index.d.ts +42 -15
  60. package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +1 -1
  61. package/node_modules/@playdrop/ai-client/package.json +1 -0
  62. package/node_modules/@playdrop/api-client/dist/client.d.ts +39 -27
  63. package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
  64. package/node_modules/@playdrop/api-client/dist/client.js +280 -1669
  65. package/node_modules/@playdrop/api-client/dist/core/errors.d.ts +9 -0
  66. package/node_modules/@playdrop/api-client/dist/core/errors.d.ts.map +1 -0
  67. package/node_modules/@playdrop/api-client/dist/core/errors.js +46 -0
  68. package/node_modules/@playdrop/api-client/dist/core/request.d.ts +27 -0
  69. package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -0
  70. package/node_modules/@playdrop/api-client/dist/core/request.js +122 -0
  71. package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts +75 -0
  72. package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts.map +1 -0
  73. package/node_modules/@playdrop/api-client/dist/domains/admin.js +282 -0
  74. package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +22 -0
  75. package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -0
  76. package/node_modules/@playdrop/api-client/dist/domains/ai.js +15 -0
  77. package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +60 -0
  78. package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -0
  79. package/node_modules/@playdrop/api-client/dist/domains/apps.js +301 -0
  80. package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts +59 -0
  81. package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts.map +1 -0
  82. package/node_modules/@playdrop/api-client/dist/domains/asset-packs.js +297 -0
  83. package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +62 -0
  84. package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -0
  85. package/node_modules/@playdrop/api-client/dist/domains/assets.js +297 -0
  86. package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts +28 -0
  87. package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts.map +1 -0
  88. package/node_modules/@playdrop/api-client/dist/domains/auth.js +78 -0
  89. package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts +29 -0
  90. package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts.map +1 -0
  91. package/node_modules/@playdrop/api-client/dist/domains/comments.js +65 -0
  92. package/node_modules/@playdrop/api-client/dist/domains/me.d.ts +24 -0
  93. package/node_modules/@playdrop/api-client/dist/domains/me.d.ts.map +1 -0
  94. package/node_modules/@playdrop/api-client/dist/domains/me.js +35 -0
  95. package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts +37 -0
  96. package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts.map +1 -0
  97. package/node_modules/@playdrop/api-client/dist/domains/payments.js +148 -0
  98. package/node_modules/@playdrop/api-client/dist/domains/search.d.ts +27 -0
  99. package/node_modules/@playdrop/api-client/dist/domains/search.d.ts.map +1 -0
  100. package/node_modules/@playdrop/api-client/dist/domains/search.js +65 -0
  101. package/node_modules/@playdrop/api-client/dist/index.d.ts +33 -56
  102. package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
  103. package/node_modules/@playdrop/api-client/dist/index.js +103 -44
  104. package/node_modules/@playdrop/api-client/package.json +3 -2
  105. package/node_modules/@playdrop/boxel-core/package.json +1 -1
  106. package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +1 -1
  107. package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +1 -1
  108. package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +1 -1
  109. package/node_modules/@playdrop/boxel-three/package.json +2 -1
  110. package/node_modules/@playdrop/config/client-meta.json +5 -5
  111. package/node_modules/@playdrop/config/dist/src/constants.d.ts +5 -0
  112. package/node_modules/@playdrop/config/dist/src/constants.d.ts.map +1 -1
  113. package/node_modules/@playdrop/config/dist/src/constants.js +5 -1
  114. package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
  115. package/node_modules/@playdrop/config/package.json +1 -1
  116. package/node_modules/@playdrop/types/dist/api.d.ts +178 -17
  117. package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
  118. package/node_modules/@playdrop/types/dist/api.js +30 -1
  119. package/node_modules/@playdrop/types/dist/app.d.ts +0 -14
  120. package/node_modules/@playdrop/types/dist/app.d.ts.map +1 -1
  121. package/node_modules/@playdrop/types/dist/app.js +0 -10
  122. package/node_modules/@playdrop/types/dist/asset-pack.d.ts +11 -1
  123. package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
  124. package/node_modules/@playdrop/types/dist/asset.d.ts +65 -0
  125. package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
  126. package/node_modules/@playdrop/types/dist/realtime.d.ts +26 -26
  127. package/node_modules/@playdrop/types/dist/realtime.d.ts.map +1 -1
  128. package/node_modules/@playdrop/types/dist/version.d.ts +5 -0
  129. package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
  130. package/package.json +2 -3
  131. package/bin/playdrop-cli +0 -2
  132. package/dist/commands/asset-packs.d.ts +0 -27
  133. package/dist/commands/asset-packs.js +0 -508
  134. package/dist/commands/assets.d.ts +0 -35
  135. package/dist/commands/assets.js +0 -668
  136. package/dist/commands/list.d.ts +0 -7
  137. package/dist/commands/list.js +0 -347
  138. package/dist/commands/migrateCatalogueV2.d.ts +0 -1
  139. package/dist/commands/migrateCatalogueV2.js +0 -142
  140. package/dist/commands/versions.d.ts +0 -17
  141. package/dist/commands/versions.js +0 -384
@@ -0,0 +1,14 @@
1
+ type BrowseCommentsOptions = {
2
+ json?: boolean;
3
+ };
4
+ type AddCommentOptions = {
5
+ body?: string;
6
+ replyTo?: string | number;
7
+ json?: boolean;
8
+ };
9
+ export declare function browseComments(rawRef: string | undefined, options?: BrowseCommentsOptions): Promise<void>;
10
+ export declare function addComment(rawRef: string | undefined, options?: AddCommentOptions): Promise<void>;
11
+ export declare function deleteComment(commentId: string | undefined, options?: {
12
+ json?: boolean;
13
+ }): Promise<void>;
14
+ export {};
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.browseComments = browseComments;
4
+ exports.addComment = addComment;
5
+ exports.deleteComment = deleteComment;
6
+ const commandContext_1 = require("../commandContext");
7
+ const errors_1 = require("../errors");
8
+ const messages_1 = require("../messages");
9
+ const output_1 = require("../output");
10
+ const refs_1 = require("../refs");
11
+ function parsePositiveInteger(raw, label, command) {
12
+ if (raw === undefined) {
13
+ return null;
14
+ }
15
+ const parsed = typeof raw === 'number' ? raw : Number.parseInt(String(raw), 10);
16
+ if (!Number.isInteger(parsed) || parsed <= 0) {
17
+ (0, messages_1.printErrorWithHelp)(`${label} must be a positive integer.`, [], { command });
18
+ process.exitCode = 1;
19
+ return null;
20
+ }
21
+ return parsed;
22
+ }
23
+ function printComments(nodes, depth = 0) {
24
+ const indent = ' '.repeat(depth);
25
+ for (const node of nodes) {
26
+ const author = node.author?.displayName || node.author?.username || 'unknown';
27
+ const creatorBadge = node.authorIsCreator ? ' [creator]' : '';
28
+ const body = node.isDeleted ? '[deleted]' : node.body;
29
+ console.log(`${indent}- #${node.id} ${author}${creatorBadge} | ${(0, output_1.formatTimestamp)(node.createdAt)}`);
30
+ console.log(`${indent} ${body}`);
31
+ if (Array.isArray(node.replies) && node.replies.length > 0) {
32
+ printComments(node.replies, depth + 1);
33
+ }
34
+ }
35
+ }
36
+ async function browseComments(rawRef, options = {}) {
37
+ let ref;
38
+ try {
39
+ ref = (0, refs_1.parseContentRef)(rawRef ?? '');
40
+ }
41
+ catch {
42
+ (0, messages_1.printErrorWithHelp)('A canonical ref is required.', ['Use the format <creator>/<kind>/<name>.', 'Example: playdrop comments browse playdrop/app/hangingout'], { command: 'comments browse' });
43
+ process.exitCode = 1;
44
+ return;
45
+ }
46
+ await (0, commandContext_1.withPublicEnvironment)('comments browse', async ({ client }) => {
47
+ try {
48
+ const response = await client.fetchContentComments((0, refs_1.contentKindToSavedItemKind)(ref.kind), ref.creator, ref.name);
49
+ const items = response.comments ?? [];
50
+ if (options.json) {
51
+ (0, output_1.printJson)({ items });
52
+ return;
53
+ }
54
+ if (items.length === 0) {
55
+ console.log(`No comments found for "${ref.ref}".`);
56
+ console.log('Next: run "playdrop comments add <ref> --body <text>" to start the conversation.');
57
+ return;
58
+ }
59
+ console.log(`Comments for ${ref.ref}:\n`);
60
+ printComments(items);
61
+ console.log('\nNext: run "playdrop comments add <ref> --body <text>" to reply.');
62
+ }
63
+ catch (error) {
64
+ const handled = (0, errors_1.handleCommandFailure)(error, 'comments browse', 'Comment lookup', {
65
+ apiMessage: (apiError) => {
66
+ if (apiError.status === 404) {
67
+ return {
68
+ problem: `No item was found for "${ref.ref}".`,
69
+ suggestions: ['Check the ref and retry.', 'Run "playdrop browse" to explore available content.'],
70
+ };
71
+ }
72
+ if (apiError.status === 401 || apiError.status === 403) {
73
+ return {
74
+ problem: `You do not have access to comments for "${ref.ref}".`,
75
+ suggestions: ['Run "playdrop auth login" if this is private content you own.'],
76
+ };
77
+ }
78
+ return {
79
+ problem: `Comment lookup failed with status ${apiError.status}.`,
80
+ suggestions: ['Retry in a moment.'],
81
+ };
82
+ },
83
+ });
84
+ if (!handled) {
85
+ throw error;
86
+ }
87
+ }
88
+ });
89
+ }
90
+ async function addComment(rawRef, options = {}) {
91
+ let ref;
92
+ try {
93
+ ref = (0, refs_1.parseContentRef)(rawRef ?? '');
94
+ }
95
+ catch {
96
+ (0, messages_1.printErrorWithHelp)('A canonical ref is required.', ['Use the format <creator>/<kind>/<name>.', 'Example: playdrop comments add playdrop/app/hangingout --body "Nice work"'], { command: 'comments add' });
97
+ process.exitCode = 1;
98
+ return;
99
+ }
100
+ const body = typeof options.body === 'string' ? options.body.trim() : '';
101
+ if (!body) {
102
+ (0, messages_1.printErrorWithHelp)('Comment body is required.', ['Use --body <text>.'], { command: 'comments add' });
103
+ process.exitCode = 1;
104
+ return;
105
+ }
106
+ const replyTo = parsePositiveInteger(options.replyTo, '--reply-to', 'comments add');
107
+ if (options.replyTo !== undefined && replyTo === null) {
108
+ return;
109
+ }
110
+ await (0, commandContext_1.withEnvironment)('comments add', 'Adding a comment', async ({ client }) => {
111
+ try {
112
+ const response = await client.createContentComment((0, refs_1.contentKindToSavedItemKind)(ref.kind), ref.creator, ref.name, {
113
+ body,
114
+ parentCommentId: replyTo ?? undefined,
115
+ });
116
+ if (options.json) {
117
+ (0, output_1.printJson)({ comment: response.comment });
118
+ return;
119
+ }
120
+ (0, output_1.printSuccess)(`Comment added to ${ref.ref}.`, ['Next: run "playdrop comments browse ' + ref.ref + '" to review the thread.']);
121
+ }
122
+ catch (error) {
123
+ const handled = (0, errors_1.handleCommandFailure)(error, 'comments add', 'Add comment', {
124
+ apiMessage: (apiError) => {
125
+ if (apiError.status === 401 || apiError.status === 403) {
126
+ return {
127
+ problem: 'Adding a comment requires you to be logged in.',
128
+ suggestions: ['Run "playdrop auth login" and retry.'],
129
+ };
130
+ }
131
+ if (apiError.status === 404) {
132
+ return {
133
+ problem: `No item was found for "${ref.ref}".`,
134
+ suggestions: ['Check the ref and retry.'],
135
+ };
136
+ }
137
+ return {
138
+ problem: `Adding a comment failed with status ${apiError.status}.`,
139
+ suggestions: ['Retry in a moment.'],
140
+ };
141
+ },
142
+ });
143
+ if (!handled) {
144
+ throw error;
145
+ }
146
+ }
147
+ });
148
+ }
149
+ async function deleteComment(commentId, options = {}) {
150
+ const numericId = parsePositiveInteger(commentId, 'Comment id', 'comments delete');
151
+ if (numericId === null) {
152
+ return;
153
+ }
154
+ await (0, commandContext_1.withEnvironment)('comments delete', 'Deleting a comment', async ({ client }) => {
155
+ try {
156
+ const response = await client.deleteContentComment(numericId);
157
+ if (options.json) {
158
+ (0, output_1.printJson)({ success: Boolean(response.success), commentId: numericId });
159
+ return;
160
+ }
161
+ (0, output_1.printSuccess)(`Comment #${numericId} deleted.`, ['Next: run "playdrop comments browse <ref>" to confirm the thread state.']);
162
+ }
163
+ catch (error) {
164
+ const handled = (0, errors_1.handleCommandFailure)(error, 'comments delete', 'Delete comment', {
165
+ apiMessage: (apiError) => {
166
+ if (apiError.status === 401 || apiError.status === 403) {
167
+ return {
168
+ problem: 'Deleting a comment requires a valid login with permission to manage it.',
169
+ suggestions: ['Run "playdrop auth login" and retry.'],
170
+ };
171
+ }
172
+ if (apiError.status === 404) {
173
+ return {
174
+ problem: `Comment #${numericId} was not found.`,
175
+ suggestions: ['Check the id and retry.'],
176
+ };
177
+ }
178
+ return {
179
+ problem: `Deleting a comment failed with status ${apiError.status}.`,
180
+ suggestions: ['Retry in a moment.'],
181
+ };
182
+ },
183
+ });
184
+ if (!handled) {
185
+ throw error;
186
+ }
187
+ }
188
+ });
189
+ }