@myvillage/cli 1.10.1 → 1.10.2
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/game.js +66 -0
- package/src/index.js +6 -0
package/package.json
CHANGED
package/src/commands/game.js
CHANGED
|
@@ -665,6 +665,72 @@ export async function gameSubmitCommand() {
|
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
667
|
|
|
668
|
+
// ── game draft (return to draft) ────────────────────
|
|
669
|
+
|
|
670
|
+
export async function gameDraftCommand() {
|
|
671
|
+
if (!isAuthenticated()) {
|
|
672
|
+
console.log(chalk.red(' ✗ Authentication required. Run \'myvillage login\' first.'));
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
const gameId = getGameId();
|
|
677
|
+
if (!gameId) return;
|
|
678
|
+
|
|
679
|
+
const checkSpinner = villageSpinner('Checking game status...').start();
|
|
680
|
+
let game;
|
|
681
|
+
try {
|
|
682
|
+
const result = await getGameDetail(gameId);
|
|
683
|
+
game = result.game;
|
|
684
|
+
checkSpinner.stop();
|
|
685
|
+
} catch (err) {
|
|
686
|
+
const message = err.response?.data?.error || err.message;
|
|
687
|
+
checkSpinner.fail(`Failed to fetch game: ${message}`);
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
if (game.status === 'DRAFT') {
|
|
692
|
+
console.log(brand.teal(`\n "${game.title}" is already in DRAFT status.\n`));
|
|
693
|
+
return;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
if (game.status === 'PUBLISHED') {
|
|
697
|
+
console.log(chalk.red(`\n ✗ "${game.title}" is PUBLISHED and cannot be returned to draft.\n`));
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
console.log();
|
|
702
|
+
console.log(brand.gold(` Return "${game.title}" to DRAFT?`));
|
|
703
|
+
console.log(brand.teal(` Current status: ${game.status}`));
|
|
704
|
+
console.log(brand.teal(' This will withdraw the game from review so you can make changes.'));
|
|
705
|
+
console.log();
|
|
706
|
+
|
|
707
|
+
const { confirm } = await inquirer.prompt([{
|
|
708
|
+
type: 'confirm',
|
|
709
|
+
name: 'confirm',
|
|
710
|
+
message: 'Return to draft?',
|
|
711
|
+
default: true,
|
|
712
|
+
}]);
|
|
713
|
+
|
|
714
|
+
if (!confirm) {
|
|
715
|
+
console.log(brand.teal('\n Cancelled.\n'));
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
const spinner = villageSpinner('Updating status...').start();
|
|
720
|
+
|
|
721
|
+
try {
|
|
722
|
+
await updateGameMetadata(gameId, { status: 'DRAFT' });
|
|
723
|
+
spinner.succeed('Game returned to draft!');
|
|
724
|
+
console.log();
|
|
725
|
+
console.log(brand.green(` ✓ "${game.title}" is now in DRAFT status.`));
|
|
726
|
+
console.log(brand.teal(' You can now upload assets, update metadata, and redeploy.'));
|
|
727
|
+
console.log();
|
|
728
|
+
} catch (err) {
|
|
729
|
+
const message = err.response?.data?.error || err.message;
|
|
730
|
+
spinner.fail(`Failed to update status: ${message}`);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
668
734
|
// ── Helpers ───────────────────────────────────────────
|
|
669
735
|
|
|
670
736
|
function getGameId() {
|
package/src/index.js
CHANGED
|
@@ -58,6 +58,7 @@ import {
|
|
|
58
58
|
gameUploadThumbnailCommand,
|
|
59
59
|
gameUploadBannerCommand,
|
|
60
60
|
gameSubmitCommand,
|
|
61
|
+
gameDraftCommand,
|
|
61
62
|
gameMissionsInitCommand,
|
|
62
63
|
gameMissionsSyncCommand,
|
|
63
64
|
gameMissionsListCommand,
|
|
@@ -155,6 +156,11 @@ export function run() {
|
|
|
155
156
|
.description('Submit a DRAFT game for admin review')
|
|
156
157
|
.action(gameSubmitCommand);
|
|
157
158
|
|
|
159
|
+
gameCmd
|
|
160
|
+
.command('draft')
|
|
161
|
+
.description('Return a game to DRAFT status (withdraw from review)')
|
|
162
|
+
.action(gameDraftCommand);
|
|
163
|
+
|
|
158
164
|
// Game missions subcommands
|
|
159
165
|
const gameMissionsCmd = gameCmd
|
|
160
166
|
.command('missions')
|