@myvillage/cli 1.8.5 → 1.10.0
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/package.json +1 -1
- package/src/commands/create-game.js +119 -6
- package/src/commands/deploy.js +143 -18
- package/src/commands/game.js +631 -0
- package/src/commands/media.js +943 -0
- package/src/index.js +72 -1
- package/src/utils/api.js +98 -0
- package/src/utils/templates.js +604 -0
package/src/index.js
CHANGED
|
@@ -53,6 +53,16 @@ import {
|
|
|
53
53
|
bizreqsStatusCommand,
|
|
54
54
|
bizreqsImportCommand,
|
|
55
55
|
} from './commands/bizreqs.js';
|
|
56
|
+
import {
|
|
57
|
+
gameUpdateCommand,
|
|
58
|
+
gameUploadThumbnailCommand,
|
|
59
|
+
gameSubmitCommand,
|
|
60
|
+
gameMissionsInitCommand,
|
|
61
|
+
gameMissionsSyncCommand,
|
|
62
|
+
gameMissionsListCommand,
|
|
63
|
+
gameBundlesUploadCommand,
|
|
64
|
+
gameBundlesUploadDirCommand,
|
|
65
|
+
} from './commands/game.js';
|
|
56
66
|
import { checkinCommand } from './commands/checkin.js';
|
|
57
67
|
import { discoverCommand } from './commands/discover.js';
|
|
58
68
|
import { logCommand } from './commands/log.js';
|
|
@@ -110,13 +120,74 @@ export function run() {
|
|
|
110
120
|
program
|
|
111
121
|
.command('deploy')
|
|
112
122
|
.description('Build and deploy your game to MyVillageOS')
|
|
113
|
-
.
|
|
123
|
+
.option('-p, --platform <platform>', 'Target platform (ios, android, webgl) — required for Unity games')
|
|
124
|
+
.action((options) => deployCommand(options));
|
|
114
125
|
|
|
115
126
|
program
|
|
116
127
|
.command('status')
|
|
117
128
|
.description('Check deployment status of your games')
|
|
118
129
|
.action(statusCommand);
|
|
119
130
|
|
|
131
|
+
// ── Game Management ────────────────────────────────
|
|
132
|
+
|
|
133
|
+
const gameCmd = program
|
|
134
|
+
.command('game')
|
|
135
|
+
.description('Manage your deployed games');
|
|
136
|
+
|
|
137
|
+
gameCmd
|
|
138
|
+
.command('update')
|
|
139
|
+
.description('Update game metadata (title, description, category, tags)')
|
|
140
|
+
.action(gameUpdateCommand);
|
|
141
|
+
|
|
142
|
+
gameCmd
|
|
143
|
+
.command('upload-thumbnail <file>')
|
|
144
|
+
.description('Upload or replace game thumbnail image')
|
|
145
|
+
.action(gameUploadThumbnailCommand);
|
|
146
|
+
|
|
147
|
+
gameCmd
|
|
148
|
+
.command('submit')
|
|
149
|
+
.description('Submit a DRAFT game for admin review')
|
|
150
|
+
.action(gameSubmitCommand);
|
|
151
|
+
|
|
152
|
+
// Game missions subcommands
|
|
153
|
+
const gameMissionsCmd = gameCmd
|
|
154
|
+
.command('missions')
|
|
155
|
+
.description('Manage game mission manifests');
|
|
156
|
+
|
|
157
|
+
gameMissionsCmd
|
|
158
|
+
.command('init')
|
|
159
|
+
.description('Create a manifest.json template')
|
|
160
|
+
.action(gameMissionsInitCommand);
|
|
161
|
+
|
|
162
|
+
gameMissionsCmd
|
|
163
|
+
.command('sync')
|
|
164
|
+
.description('Upload manifest.json to ed-platform')
|
|
165
|
+
.action(gameMissionsSyncCommand);
|
|
166
|
+
|
|
167
|
+
gameMissionsCmd
|
|
168
|
+
.command('list')
|
|
169
|
+
.description('List missions from the uploaded manifest')
|
|
170
|
+
.option('--json', 'Output raw JSON')
|
|
171
|
+
.action(gameMissionsListCommand);
|
|
172
|
+
|
|
173
|
+
// Game bundles subcommands
|
|
174
|
+
const gameBundlesCmd = gameCmd
|
|
175
|
+
.command('bundles')
|
|
176
|
+
.description('Manage game asset bundles');
|
|
177
|
+
|
|
178
|
+
gameBundlesCmd
|
|
179
|
+
.command('upload <file>')
|
|
180
|
+
.description('Upload a single bundle file')
|
|
181
|
+
.requiredOption('-p, --platform <platform>', 'Target platform (ios, android, webgl)')
|
|
182
|
+
.option('--bundle-name <name>', 'Bundle name (defaults to filename without extension)')
|
|
183
|
+
.action(gameBundlesUploadCommand);
|
|
184
|
+
|
|
185
|
+
gameBundlesCmd
|
|
186
|
+
.command('upload-dir <dir>')
|
|
187
|
+
.description('Upload all files in a directory as bundles')
|
|
188
|
+
.requiredOption('-p, --platform <platform>', 'Target platform (ios, android, webgl)')
|
|
189
|
+
.action(gameBundlesUploadDirCommand);
|
|
190
|
+
|
|
120
191
|
// ── Network: Feed ───────────────────────────────────
|
|
121
192
|
|
|
122
193
|
program
|
package/src/utils/api.js
CHANGED
|
@@ -466,3 +466,101 @@ export async function getBizReqsSpec(id) {
|
|
|
466
466
|
const response = await client.get(`/${encodeURIComponent(id)}/spec`);
|
|
467
467
|
return response.data;
|
|
468
468
|
}
|
|
469
|
+
|
|
470
|
+
// ── Media Drafts API (/api/media/drafts) ────────────────
|
|
471
|
+
|
|
472
|
+
export async function createMediaDraft(data) {
|
|
473
|
+
const client = getPlatformClient();
|
|
474
|
+
const response = await client.post('/media/drafts', data);
|
|
475
|
+
return response.data;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
export async function listMediaDrafts(params = {}) {
|
|
479
|
+
const client = getPlatformClient();
|
|
480
|
+
const response = await client.get('/media/drafts', { params });
|
|
481
|
+
return response.data;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
export async function getMediaDraft(id) {
|
|
485
|
+
const client = getPlatformClient();
|
|
486
|
+
const response = await client.get(`/media/drafts/${encodeURIComponent(id)}`);
|
|
487
|
+
return response.data;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export async function updateMediaDraft(id, data) {
|
|
491
|
+
const client = getPlatformClient();
|
|
492
|
+
const response = await client.patch(`/media/drafts/${encodeURIComponent(id)}`, data);
|
|
493
|
+
return response.data;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export async function getMediaDraftStatus(id) {
|
|
497
|
+
const client = getPlatformClient();
|
|
498
|
+
const response = await client.get(`/media/drafts/${encodeURIComponent(id)}/status`);
|
|
499
|
+
return response.data;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
export async function uploadMediaDraftAsset(id, formData) {
|
|
503
|
+
const client = getPlatformClient();
|
|
504
|
+
const response = await client.post(`/media/drafts/${encodeURIComponent(id)}/upload`, formData, {
|
|
505
|
+
headers: { 'Content-Type': 'multipart/form-data' },
|
|
506
|
+
maxBodyLength: Infinity,
|
|
507
|
+
maxContentLength: Infinity,
|
|
508
|
+
});
|
|
509
|
+
return response.data;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
export async function getMediaDraftUploadUrl(id, data) {
|
|
513
|
+
const client = getPlatformClient();
|
|
514
|
+
const response = await client.post(`/media/drafts/${encodeURIComponent(id)}/upload-url`, data);
|
|
515
|
+
return response.data;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export async function confirmMediaDraftUpload(id, data) {
|
|
519
|
+
const client = getPlatformClient();
|
|
520
|
+
const response = await client.post(`/media/drafts/${encodeURIComponent(id)}/confirm-upload`, data);
|
|
521
|
+
return response.data;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// ── Game Missions & Bundles API (/api/v1/games) ────────
|
|
525
|
+
|
|
526
|
+
export async function getGameMissions(gameId) {
|
|
527
|
+
const client = getApiClient();
|
|
528
|
+
const response = await client.get(`/games/${encodeURIComponent(gameId)}/missions`);
|
|
529
|
+
return response.data;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export async function updateGameMissions(gameId, manifest) {
|
|
533
|
+
const client = getApiClient();
|
|
534
|
+
const response = await client.put(`/games/${encodeURIComponent(gameId)}/missions`, manifest);
|
|
535
|
+
return response.data;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export async function getGameUploadUrl(gameId, data) {
|
|
539
|
+
const client = getApiClient();
|
|
540
|
+
const response = await client.post(`/games/${encodeURIComponent(gameId)}/upload-url`, data);
|
|
541
|
+
return response.data;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export async function confirmGameUpload(gameId, data) {
|
|
545
|
+
const client = getApiClient();
|
|
546
|
+
const response = await client.post(`/games/${encodeURIComponent(gameId)}/confirm-upload`, data);
|
|
547
|
+
return response.data;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
export async function getGameDetail(gameId) {
|
|
551
|
+
const client = getApiClient();
|
|
552
|
+
const response = await client.get(`/games/${encodeURIComponent(gameId)}`);
|
|
553
|
+
return response.data;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
export async function updateGameMetadata(gameId, data) {
|
|
557
|
+
const client = getApiClient();
|
|
558
|
+
const response = await client.put(`/games/${encodeURIComponent(gameId)}`, data);
|
|
559
|
+
return response.data;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
export async function submitGameForReview(gameId) {
|
|
563
|
+
const client = getApiClient();
|
|
564
|
+
const response = await client.put(`/games/${encodeURIComponent(gameId)}`, { status: 'SUBMITTED' });
|
|
565
|
+
return response.data;
|
|
566
|
+
}
|