@replaystage/cli 0.4.0 → 0.4.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/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ interface ProjectConfig {
7
7
  apiUrl?: string;
8
8
  version?: string;
9
9
  title?: string;
10
+ tagline?: string;
10
11
  updatedAt?: string;
11
12
  visibility?: "draft" | "unlisted" | "public" | string;
12
13
  aspectRatio?: string;
@@ -115,7 +116,7 @@ interface UploadBundleOptions {
115
116
  apiUrl: string;
116
117
  bundleBuffer: Buffer;
117
118
  title: string;
118
- tagline: string;
119
+ tagline?: string;
119
120
  description?: string;
120
121
  aiTool?: string;
121
122
  category?: string;
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ async function uploadGameBundle(options) {
33
33
  const blob = new Blob([uint8], { type: "application/zip" });
34
34
  formData.append("bundle", blob, "bundle.zip");
35
35
  formData.append("title", options.title);
36
- formData.append("tagline", options.tagline);
36
+ formData.append("tagline", options.tagline ?? "");
37
37
  if (options.description) formData.append("description", options.description);
38
38
  if (options.category) formData.append("category", options.category);
39
39
  formData.append("submission_type", options.submissionType || "maker");
@@ -112,7 +112,7 @@ async function updateGameBundle(slug, options) {
112
112
  formData.append("bundle", blob, "bundle.zip");
113
113
  }
114
114
  if (options.title) formData.append("title", options.title);
115
- if (options.tagline) formData.append("tagline", options.tagline);
115
+ if (options.tagline !== void 0) formData.append("tagline", options.tagline);
116
116
  if (options.description) formData.append("description", options.description);
117
117
  if (options.visibility) formData.append("visibility", options.visibility);
118
118
  if (options.changelog) formData.append("changelog", options.changelog);
@@ -4795,10 +4795,10 @@ var aiModelSchema = external_exports.preprocess((val) => {
4795
4795
  }, external_exports.string().max(MAX_AI_MODEL_LENGTH, `AI model must be ${MAX_AI_MODEL_LENGTH} characters or less`).nullable().optional());
4796
4796
  var baseGameUploadObject = external_exports.object({
4797
4797
  title: external_exports.string().trim().min(2, "Title must be at least 2 characters").max(MAX_GAME_TITLE_LENGTH, `Title must be ${MAX_GAME_TITLE_LENGTH} characters or less`),
4798
- tagline: external_exports.string({ required_error: "Tagline is required" }).trim().max(
4798
+ tagline: external_exports.string().trim().max(
4799
4799
  MAX_GAME_TAGLINE_LENGTH,
4800
4800
  `Tagline must be ${MAX_GAME_TAGLINE_LENGTH} characters or less`
4801
- ),
4801
+ ).nullable().optional().transform((val) => val ?? ""),
4802
4802
  description: external_exports.string().max(
4803
4803
  MAX_GAME_DESCRIPTION_LENGTH,
4804
4804
  `Description must be ${MAX_GAME_DESCRIPTION_LENGTH} characters or less`
@@ -4819,7 +4819,6 @@ var baseGameUploadObject = external_exports.object({
4819
4819
  aspectRatio: aspectRatioSchema.default(DEFAULT_ASPECT_RATIO),
4820
4820
  supportedPlatforms: supportedPlatformsSchema.default(DEFAULT_SUPPORTED_PLATFORMS),
4821
4821
  changelog: external_exports.string().trim().max(500).optional(),
4822
- slug: slugSchema.optional(),
4823
4822
  fileHash: external_exports.string().regex(SHA256_REGEX, "Invalid SHA-256 hash format").optional(),
4824
4823
  sourceCode: external_exports.string().max(MAX_HTML_SIZE_BYTES, "Single-file HTML cannot exceed 5MB").optional().nullable(),
4825
4824
  thumbnailUrl: thumbnailUrlSchema.optional().nullable(),
@@ -4829,27 +4828,7 @@ var baseGameUploadObject = external_exports.object({
4829
4828
  mobile: external_exports.string().max(300).optional()
4830
4829
  }).optional().nullable()
4831
4830
  });
4832
- var gameUploadSchema = external_exports.preprocess((val) => {
4833
- if (val && typeof val === "object" && !Array.isArray(val)) {
4834
- const raw = { ...val };
4835
- if (raw.visibility === "draft" && (raw.tagline === void 0 || raw.tagline === null)) {
4836
- raw.tagline = "";
4837
- }
4838
- return raw;
4839
- }
4840
- return val;
4841
- }, baseGameUploadObject).superRefine((data, ctx) => {
4842
- if (data.visibility !== "draft" && (!data.tagline || data.tagline.trim().length < 3)) {
4843
- ctx.addIssue({
4844
- code: external_exports.ZodIssueCode.too_small,
4845
- minimum: 3,
4846
- type: "string",
4847
- inclusive: true,
4848
- path: ["tagline"],
4849
- message: "Tagline must be at least 3 characters"
4850
- });
4851
- }
4852
- }).transform((data) => {
4831
+ var gameUploadSchema = baseGameUploadObject.transform((data) => {
4853
4832
  if (data.submissionType === "hunter" && !data.isOss) {
4854
4833
  return {
4855
4834
  ...data,
@@ -4863,7 +4842,7 @@ var gameUpdateSchema = external_exports.object({
4863
4842
  tagline: external_exports.string().trim().max(
4864
4843
  MAX_GAME_TAGLINE_LENGTH,
4865
4844
  `Tagline must be ${MAX_GAME_TAGLINE_LENGTH} characters or less`
4866
- ).optional(),
4845
+ ).nullable().optional().transform((val) => val === null ? "" : val),
4867
4846
  description: external_exports.string().max(
4868
4847
  MAX_GAME_DESCRIPTION_LENGTH,
4869
4848
  `Description must be ${MAX_GAME_DESCRIPTION_LENGTH} characters or less`
@@ -5288,7 +5267,7 @@ function readProjectConfig(targetDir) {
5288
5267
  return null;
5289
5268
  }
5290
5269
  }
5291
- const hasValidKey = typeof parsed.slug === "string" && parsed.slug.trim().length > 0 || typeof parsed.supportedPlatforms === "string" || typeof parsed.platforms === "string" || typeof parsed.aspectRatio === "string" || typeof parsed.aiModel === "string" || typeof parsed.aiTool === "string" || Array.isArray(parsed.tags) || typeof parsed.tags === "string";
5270
+ const hasValidKey = typeof parsed.slug === "string" && parsed.slug.trim().length > 0 || typeof parsed.tagline === "string" || typeof parsed.supportedPlatforms === "string" || typeof parsed.platforms === "string" || typeof parsed.aspectRatio === "string" || typeof parsed.aiModel === "string" || typeof parsed.aiTool === "string" || Array.isArray(parsed.tags) || typeof parsed.tags === "string";
5292
5271
  if (!hasValidKey) {
5293
5272
  return null;
5294
5273
  }
@@ -6333,15 +6312,6 @@ async function handlePublish(targetPath = ".", options = {}) {
6333
6312
  }
6334
6313
  if (title.length < 2) title = "Web Game";
6335
6314
  if (title.length > 60) title = title.slice(0, 60);
6336
- let tagline = options.tagline?.trim();
6337
- if (!tagline && bundle.extractedTagline) {
6338
- tagline = bundle.extractedTagline;
6339
- }
6340
- if (!tagline) {
6341
- tagline = "Playable web game deployed to ReplayStage";
6342
- }
6343
- if (tagline.length < 3) tagline = "An arcade game on ReplayStage";
6344
- if (tagline.length > 120) tagline = tagline.slice(0, 120);
6345
6315
  let category = options.category?.toLowerCase().trim();
6346
6316
  if (category && !GAME_CATEGORY_KEYS.includes(category)) {
6347
6317
  category = void 0;
@@ -6349,6 +6319,15 @@ async function handlePublish(targetPath = ".", options = {}) {
6349
6319
  const token = options.anonymous ? null : resolveToken(options.token);
6350
6320
  const apiUrl = resolveApiUrl(options.apiUrl);
6351
6321
  const existingConfig = !options.fresh ? readProjectConfig(resolvedPath) : null;
6322
+ let tagline = "";
6323
+ if (options.tagline !== void 0) {
6324
+ tagline = options.tagline.trim();
6325
+ } else if (bundle.extractedTagline?.trim()) {
6326
+ tagline = bundle.extractedTagline.trim();
6327
+ } else if (existingConfig?.tagline?.trim()) {
6328
+ tagline = existingConfig.tagline.trim();
6329
+ }
6330
+ if (tagline.length > 120) tagline = tagline.slice(0, 120);
6352
6331
  let aiTool = "";
6353
6332
  if (options.tool !== void 0) {
6354
6333
  const parsedTool = aiToolSchema.safeParse(options.tool);
@@ -6553,7 +6532,7 @@ async function handlePublish(targetPath = ".", options = {}) {
6553
6532
  apiUrl,
6554
6533
  bundleBuffer: bundle.bundleBuffer,
6555
6534
  title,
6556
- tagline,
6535
+ tagline: options.tagline !== void 0 ? tagline : tagline || void 0,
6557
6536
  description: options.description,
6558
6537
  visibility,
6559
6538
  changelog: options.changelog,
@@ -6576,6 +6555,7 @@ async function handlePublish(targetPath = ".", options = {}) {
6576
6555
  apiUrl,
6577
6556
  version: newVersion,
6578
6557
  title: title || existingConfig.title,
6558
+ tagline: tagline || void 0,
6579
6559
  updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
6580
6560
  visibility: resolvedVis,
6581
6561
  aspectRatio: resolvedAspectRatio,
@@ -6685,6 +6665,7 @@ async function handlePublish(targetPath = ".", options = {}) {
6685
6665
  apiUrl,
6686
6666
  version: initialVersion,
6687
6667
  title,
6668
+ tagline: tagline || void 0,
6688
6669
  updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
6689
6670
  visibility: initialVisibility,
6690
6671
  aspectRatio: resolvedAspectRatio,
@@ -6806,8 +6787,8 @@ async function computeFileFingerprint(filePath) {
6806
6787
  // src/index.ts
6807
6788
  function createProgram() {
6808
6789
  const program = new Command();
6809
- program.name("replaystage").description("ReplayStage CLI: Deploy and share web games from command line and AI agents").version("0.4.0");
6810
- program.command("publish [path]").description("Package and deploy a web game to ReplayStage").option("-t, --title <title>", "Game title (2-60 characters)").option("-g, --tagline <tagline>", "Catchy one-line arcade tagline (3-120 characters)").option("-d, --description <desc>", "Gameplay instructions or description").option(
6790
+ program.name("replaystage").description("ReplayStage CLI: Deploy and share web games from command line and AI agents").version("0.4.1");
6791
+ program.command("publish [path]").description("Package and deploy a web game to ReplayStage").option("-t, --title <title>", "Game title (2-60 characters)").option("-g, --tagline <tagline>", "Optional one-line arcade tagline (max 120 characters)").option("-d, --description <desc>", "Gameplay instructions or description").option(
6811
6792
  "--tool <tool>",
6812
6793
  "AI tool used to generate the game (claude, gemini, antigravity, cursor, etc.)"
6813
6794
  ).option(