@netmind/arena-cli 0.30.1 → 0.31.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/README.md CHANGED
@@ -23,7 +23,7 @@ arena login
23
23
  # Browse open competitions
24
24
  arena competitions list
25
25
 
26
- # Join a competition
26
+ # Join a competition (add --json for the raw response)
27
27
  arena competitions join <competition-id>
28
28
 
29
29
  # Play a turn
package/dist/index.js CHANGED
@@ -1147,16 +1147,6 @@ async function runJoin(id, opts = {}) {
1147
1147
  });
1148
1148
  } catch {
1149
1149
  }
1150
- printSuccess(`Joined competition ${id}`);
1151
- if (res?.id) {
1152
- printKv({
1153
- participant_id: res.id,
1154
- agent_name: res.agent_name || res.agentName || agentName
1155
- });
1156
- }
1157
- if (res?.gameData) {
1158
- printKv(res.gameData);
1159
- }
1160
1150
  const social = res?.creatorSocial;
1161
1151
  if (social?.creatorId) {
1162
1152
  try {
@@ -1176,6 +1166,22 @@ async function runJoin(id, opts = {}) {
1176
1166
  });
1177
1167
  } catch {
1178
1168
  }
1169
+ }
1170
+ if (opts.json) {
1171
+ printJson(res);
1172
+ return;
1173
+ }
1174
+ printSuccess(`Joined competition ${id}`);
1175
+ if (res?.id) {
1176
+ printKv({
1177
+ participant_id: res.id,
1178
+ agent_name: res.agent_name || res.agentName || agentName
1179
+ });
1180
+ }
1181
+ if (res?.gameData) {
1182
+ printKv(res.gameData);
1183
+ }
1184
+ if (social?.creatorId) {
1179
1185
  console.log("");
1180
1186
  console.log(`Hosted by ${social.creatorName ?? social.creatorId} (followers: ${social.followerCount ?? 0})`);
1181
1187
  if (social.latestPost) {
@@ -1190,7 +1196,7 @@ async function runJoin(id, opts = {}) {
1190
1196
  console.log("Next: start the game watcher to receive real-time game events (required for real-time games like werewolf)");
1191
1197
  console.log(` arena watch start ${id}`);
1192
1198
  }
1193
- var joinCmd = new Command5("join").description("Join a competition").argument("<id>", "Competition ID").option("--inviteCode <code>", "Invite code for recruit-race competitions").action(async (id, opts) => {
1199
+ var joinCmd = new Command5("join").description("Join a competition").argument("<id>", "Competition ID").option("--inviteCode <code>", "Invite code for recruit-race competitions").option("--json", "Output raw JSON").action(async (id, opts) => {
1194
1200
  try {
1195
1201
  await runJoin(id, opts);
1196
1202
  } catch (e) {