@replaystage/cli 0.8.1 → 2.1.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 +16 -48
- package/bin/replaystage.js +3 -21
- package/dist/commands/admin.d.ts +5 -0
- package/dist/commands/admin.js +448 -0
- package/dist/commands/auth.d.ts +4 -0
- package/dist/commands/auth.js +75 -0
- package/dist/commands/creator.d.ts +14 -0
- package/dist/commands/creator.js +886 -0
- package/dist/config.d.ts +26 -0
- package/dist/config.js +122 -0
- package/dist/http.d.ts +14 -0
- package/dist/http.js +107 -0
- package/dist/index.d.ts +10 -231
- package/dist/index.js +170 -7397
- package/dist/manifest.d.ts +81 -0
- package/dist/manifest.js +198 -0
- package/dist/output.d.ts +35 -0
- package/dist/output.js +105 -0
- package/dist/validate.d.ts +39 -0
- package/dist/validate.js +225 -0
- package/package.json +14 -27
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -15
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const DEFAULT_API_BASE = "https://api.replaystage.com";
|
|
2
|
+
export declare const DEFAULT_PORTAL_ORIGIN = "https://replaystage.com";
|
|
3
|
+
export declare const DEFAULT_STUDIO_ORIGIN = "https://studio.replaystage.com";
|
|
4
|
+
export interface StoredCliConfig {
|
|
5
|
+
token?: string;
|
|
6
|
+
apiBase?: string;
|
|
7
|
+
updatedAt?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function getConfigFilePath(): string;
|
|
10
|
+
export declare function readStoredConfig(): Promise<StoredCliConfig>;
|
|
11
|
+
export declare function writeStoredConfig(next: StoredCliConfig): Promise<string>;
|
|
12
|
+
export declare function clearStoredToken(): Promise<string>;
|
|
13
|
+
export declare function resolveApiBase(flagValue?: string): Promise<string>;
|
|
14
|
+
export declare function findPlatformWorkspaceRoot(startDir: string): Promise<string | null>;
|
|
15
|
+
export declare function resolveAuthToken(options: {
|
|
16
|
+
flagToken?: string;
|
|
17
|
+
allowAdminEnvFallback?: boolean;
|
|
18
|
+
allowPublishEnvFallback?: boolean;
|
|
19
|
+
cwd: string;
|
|
20
|
+
}): Promise<string | null>;
|
|
21
|
+
export declare function requireAuthToken(options: {
|
|
22
|
+
flagToken?: string;
|
|
23
|
+
allowAdminEnvFallback?: boolean;
|
|
24
|
+
allowPublishEnvFallback?: boolean;
|
|
25
|
+
cwd: string;
|
|
26
|
+
}): Promise<string>;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { chmod, mkdir, readFile, stat, writeFile } from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { CliError } from './output.js';
|
|
5
|
+
export const DEFAULT_API_BASE = 'https://api.replaystage.com';
|
|
6
|
+
export const DEFAULT_PORTAL_ORIGIN = 'https://replaystage.com';
|
|
7
|
+
export const DEFAULT_STUDIO_ORIGIN = 'https://studio.replaystage.com';
|
|
8
|
+
export function getConfigFilePath() {
|
|
9
|
+
const override = process.env.REPLAYSTAGE_CONFIG_PATH?.trim();
|
|
10
|
+
if (override)
|
|
11
|
+
return path.resolve(override);
|
|
12
|
+
return path.join(os.homedir(), '.config', 'replaystage', 'config.json');
|
|
13
|
+
}
|
|
14
|
+
export async function readStoredConfig() {
|
|
15
|
+
const filePath = getConfigFilePath();
|
|
16
|
+
try {
|
|
17
|
+
const raw = await readFile(filePath, 'utf8');
|
|
18
|
+
const parsed = JSON.parse(raw);
|
|
19
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export async function writeStoredConfig(next) {
|
|
26
|
+
const filePath = getConfigFilePath();
|
|
27
|
+
await mkdir(path.dirname(filePath), { recursive: true, mode: 0o700 });
|
|
28
|
+
const payload = `${JSON.stringify({ ...next, updatedAt: new Date().toISOString() }, null, 2)}\n`;
|
|
29
|
+
await writeFile(filePath, payload, { encoding: 'utf8', mode: 0o600 });
|
|
30
|
+
try {
|
|
31
|
+
await chmod(filePath, 0o600);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// ignore chmod failures on filesystems that don't support POSIX modes
|
|
35
|
+
}
|
|
36
|
+
return filePath;
|
|
37
|
+
}
|
|
38
|
+
export async function clearStoredToken() {
|
|
39
|
+
const current = await readStoredConfig();
|
|
40
|
+
delete current.token;
|
|
41
|
+
return writeStoredConfig(current);
|
|
42
|
+
}
|
|
43
|
+
export async function resolveApiBase(flagValue) {
|
|
44
|
+
const stored = await readStoredConfig();
|
|
45
|
+
const raw = flagValue?.trim() ||
|
|
46
|
+
process.env.REPLAYSTAGE_API_BASE?.trim() ||
|
|
47
|
+
stored.apiBase?.trim() ||
|
|
48
|
+
DEFAULT_API_BASE;
|
|
49
|
+
return raw.replace(/\/+$/, '');
|
|
50
|
+
}
|
|
51
|
+
async function readLocalAdminEnvToken(cwd) {
|
|
52
|
+
let cursor = path.resolve(cwd);
|
|
53
|
+
for (let depth = 0; depth < 6; depth += 1) {
|
|
54
|
+
const candidate = path.join(cursor, '.env.local');
|
|
55
|
+
try {
|
|
56
|
+
const envText = await readFile(candidate, 'utf8');
|
|
57
|
+
const match = envText.match(/^REPLAYSTAGE_ADMIN_TOKEN=(.+)$/m);
|
|
58
|
+
if (match && match[1]) {
|
|
59
|
+
const cleaned = match[1].trim().replace(/^['"]|['"]$/g, '');
|
|
60
|
+
if (cleaned)
|
|
61
|
+
return cleaned;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// continue walking up
|
|
66
|
+
}
|
|
67
|
+
const parent = path.dirname(cursor);
|
|
68
|
+
if (parent === cursor)
|
|
69
|
+
break;
|
|
70
|
+
cursor = parent;
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
export async function findPlatformWorkspaceRoot(startDir) {
|
|
75
|
+
let cursor = path.resolve(startDir);
|
|
76
|
+
for (let depth = 0; depth < 6; depth += 1) {
|
|
77
|
+
try {
|
|
78
|
+
await stat(path.join(cursor, 'packages', 'catalog', 'schema.json'));
|
|
79
|
+
await stat(path.join(cursor, 'apps', 'portal', 'wrangler.jsonc'));
|
|
80
|
+
return cursor;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
const parent = path.dirname(cursor);
|
|
84
|
+
if (parent === cursor)
|
|
85
|
+
break;
|
|
86
|
+
cursor = parent;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
export async function resolveAuthToken(options) {
|
|
92
|
+
const direct = options.flagToken?.trim();
|
|
93
|
+
if (direct)
|
|
94
|
+
return direct;
|
|
95
|
+
const envToken = process.env.REPLAYSTAGE_TOKEN?.trim();
|
|
96
|
+
if (envToken)
|
|
97
|
+
return envToken;
|
|
98
|
+
if (options.allowPublishEnvFallback) {
|
|
99
|
+
const pubEnv = process.env.REPLAYSTAGE_PUBLISH_TOKEN?.trim();
|
|
100
|
+
if (pubEnv)
|
|
101
|
+
return pubEnv;
|
|
102
|
+
}
|
|
103
|
+
const stored = await readStoredConfig();
|
|
104
|
+
if (stored.token?.trim())
|
|
105
|
+
return stored.token.trim();
|
|
106
|
+
if (options.allowAdminEnvFallback) {
|
|
107
|
+
const adminEnv = process.env.REPLAYSTAGE_ADMIN_TOKEN?.trim();
|
|
108
|
+
if (adminEnv)
|
|
109
|
+
return adminEnv;
|
|
110
|
+
const fromDotEnv = await readLocalAdminEnvToken(options.cwd);
|
|
111
|
+
if (fromDotEnv)
|
|
112
|
+
return fromDotEnv;
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
export async function requireAuthToken(options) {
|
|
117
|
+
const token = await resolveAuthToken(options);
|
|
118
|
+
if (!token) {
|
|
119
|
+
throw new CliError('AUTH_REQUIRED', 'Not signed in. Mint a personal RSKEY_ API key at https://studio.replaystage.com/account and run `npx -y replaystage login --token RSKEY_...` (or set REPLAYSTAGE_TOKEN).');
|
|
120
|
+
}
|
|
121
|
+
return token;
|
|
122
|
+
}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface ApiRequestOptions {
|
|
2
|
+
apiBase: string;
|
|
3
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
4
|
+
path: string;
|
|
5
|
+
token?: string | null;
|
|
6
|
+
body?: unknown;
|
|
7
|
+
rawBody?: Uint8Array;
|
|
8
|
+
contentType?: string;
|
|
9
|
+
/** Per-attempt timeout in milliseconds (default: 45s for binary uploads, 25s otherwise). */
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
/** Maximum retries on transient network/timeout/429/5xx errors (default: 2 for idempotent methods, 0 for POST). */
|
|
12
|
+
retries?: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function apiRequestJson<T = Record<string, unknown>>(opts: ApiRequestOptions): Promise<T>;
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { CliError } from './output.js';
|
|
2
|
+
const RETRYABLE_STATUSES = new Set([408, 429, 500, 502, 503, 504]);
|
|
3
|
+
function delay(ms) {
|
|
4
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
5
|
+
}
|
|
6
|
+
function parseRetryAfterMs(header) {
|
|
7
|
+
if (!header)
|
|
8
|
+
return null;
|
|
9
|
+
const seconds = Number(header.trim());
|
|
10
|
+
if (Number.isFinite(seconds) && seconds >= 0) {
|
|
11
|
+
return Math.min(10_000, Math.round(seconds * 1000));
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
export async function apiRequestJson(opts) {
|
|
16
|
+
const headers = {
|
|
17
|
+
Accept: 'application/json',
|
|
18
|
+
};
|
|
19
|
+
if (opts.token) {
|
|
20
|
+
headers.Authorization = `Bearer ${opts.token}`;
|
|
21
|
+
}
|
|
22
|
+
let requestBody;
|
|
23
|
+
if (opts.rawBody !== undefined) {
|
|
24
|
+
headers['Content-Type'] = opts.contentType || 'application/octet-stream';
|
|
25
|
+
requestBody = Buffer.from(opts.rawBody);
|
|
26
|
+
}
|
|
27
|
+
else if (opts.body !== undefined) {
|
|
28
|
+
headers['Content-Type'] = 'application/json';
|
|
29
|
+
requestBody = JSON.stringify(opts.body);
|
|
30
|
+
}
|
|
31
|
+
const url = `${opts.apiBase.replace(/\/+$/, '')}${opts.path}`;
|
|
32
|
+
const timeoutMs = opts.timeoutMs ?? (opts.rawBody !== undefined ? 45_000 : 25_000);
|
|
33
|
+
const maxRetries = opts.retries ?? (opts.method === 'POST' ? 0 : 2);
|
|
34
|
+
for (let attempt = 0; attempt <= maxRetries; attempt += 1) {
|
|
35
|
+
let res;
|
|
36
|
+
try {
|
|
37
|
+
const controller = new AbortController();
|
|
38
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
39
|
+
try {
|
|
40
|
+
res = await fetch(url, {
|
|
41
|
+
method: opts.method,
|
|
42
|
+
headers,
|
|
43
|
+
body: requestBody,
|
|
44
|
+
signal: controller.signal,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
clearTimeout(timer);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
const isTimeout = err instanceof Error && err.name === 'AbortError';
|
|
53
|
+
if (attempt < maxRetries) {
|
|
54
|
+
await delay(350 * 2 ** attempt);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
throw new CliError(isTimeout ? 'REQUEST_TIMEOUT' : 'NETWORK_ERROR', isTimeout
|
|
58
|
+
? `Request timed out after ${timeoutMs}ms: ${opts.method} ${url}`
|
|
59
|
+
: `Failed to reach ${url}: ${err instanceof Error ? err.message : String(err)}`);
|
|
60
|
+
}
|
|
61
|
+
if (!res.ok && RETRYABLE_STATUSES.has(res.status) && attempt < maxRetries) {
|
|
62
|
+
const retryMs = parseRetryAfterMs(res.headers.get('retry-after')) ?? 350 * 2 ** attempt;
|
|
63
|
+
await delay(retryMs);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const text = await res.text();
|
|
67
|
+
let parsed = {};
|
|
68
|
+
if (text) {
|
|
69
|
+
try {
|
|
70
|
+
parsed = JSON.parse(text);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
parsed = { raw: text };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (!res.ok) {
|
|
77
|
+
const serverCode = typeof parsed.code === 'string' ? parsed.code : undefined;
|
|
78
|
+
const serverError = typeof parsed.error === 'string' ? parsed.error : `HTTP ${res.status}`;
|
|
79
|
+
const mappedCode = serverCode ||
|
|
80
|
+
(res.status === 401
|
|
81
|
+
? 'AUTH_INVALID'
|
|
82
|
+
: res.status === 403
|
|
83
|
+
? 'FORBIDDEN'
|
|
84
|
+
: res.status === 404
|
|
85
|
+
? 'NOT_FOUND'
|
|
86
|
+
: res.status === 409
|
|
87
|
+
? 'CONFLICT'
|
|
88
|
+
: `HTTP_${res.status}`);
|
|
89
|
+
const details = {
|
|
90
|
+
method: opts.method,
|
|
91
|
+
path: opts.path,
|
|
92
|
+
};
|
|
93
|
+
if (Array.isArray(parsed.details)) {
|
|
94
|
+
details.errors = parsed.details;
|
|
95
|
+
}
|
|
96
|
+
else if (parsed.details && typeof parsed.details === 'object') {
|
|
97
|
+
Object.assign(details, parsed.details);
|
|
98
|
+
}
|
|
99
|
+
throw new CliError(mappedCode, serverError, {
|
|
100
|
+
status: res.status,
|
|
101
|
+
details,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return parsed;
|
|
105
|
+
}
|
|
106
|
+
throw new CliError('NETWORK_ERROR', `Failed to complete request to ${url}`);
|
|
107
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,231 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
category?: string;
|
|
12
|
-
updatedAt?: string;
|
|
13
|
-
visibility?: "draft" | "unlisted" | "public" | string;
|
|
14
|
-
aspectRatio?: string;
|
|
15
|
-
supportedPlatforms?: string;
|
|
16
|
-
platforms?: string;
|
|
17
|
-
aiModel?: string | null;
|
|
18
|
-
aiTool?: string;
|
|
19
|
-
tags?: string[];
|
|
20
|
-
}
|
|
21
|
-
declare function resolveProjectDirectory(targetPath: string): string | null;
|
|
22
|
-
declare function getProjectConfigPath(targetDir: string): string | null;
|
|
23
|
-
declare function readProjectConfig(targetDir: string): ProjectConfig | null;
|
|
24
|
-
declare function writeProjectConfig(targetDir: string, config: ProjectConfig): void;
|
|
25
|
-
declare function incrementVersion(currentVersion?: string): string;
|
|
26
|
-
declare function promoteDraftVersion(currentVersion?: string): string;
|
|
27
|
-
|
|
28
|
-
interface UserInfo {
|
|
29
|
-
id: string;
|
|
30
|
-
name?: string;
|
|
31
|
-
handle?: string;
|
|
32
|
-
email?: string;
|
|
33
|
-
}
|
|
34
|
-
interface CliConfig {
|
|
35
|
-
apiUrl?: string;
|
|
36
|
-
token?: string;
|
|
37
|
-
user?: UserInfo;
|
|
38
|
-
}
|
|
39
|
-
declare function getConfigDir(): string;
|
|
40
|
-
declare function getConfigPath(): string;
|
|
41
|
-
declare function readConfig(): CliConfig;
|
|
42
|
-
declare function writeConfig(config: CliConfig): void;
|
|
43
|
-
declare function clearConfig(): void;
|
|
44
|
-
declare function getToken(): string | null;
|
|
45
|
-
declare function setToken(token: string, user?: UserInfo, apiUrl?: string): void;
|
|
46
|
-
declare function clearToken(): void;
|
|
47
|
-
declare function resolveToken(cliToken?: string): string | null;
|
|
48
|
-
declare function resolveApiUrl(cliApiUrl?: string): string;
|
|
49
|
-
|
|
50
|
-
declare function computeFingerprint(input: string | Buffer | Uint8Array): Promise<string>;
|
|
51
|
-
declare function computeFileFingerprint(filePath: string): Promise<string>;
|
|
52
|
-
|
|
53
|
-
declare const COVER_PRECEDENCE_FILES: readonly ["cover.png", "cover.jpg", "cover.jpeg", "cover.webp", "cover.gif"];
|
|
54
|
-
interface DetectedCover {
|
|
55
|
-
source: "bundle" | "sibling";
|
|
56
|
-
fileName: string;
|
|
57
|
-
filePath?: string;
|
|
58
|
-
buffer: Buffer;
|
|
59
|
-
ext: "png" | "jpg" | "webp" | "gif";
|
|
60
|
-
mimeType: string;
|
|
61
|
-
}
|
|
62
|
-
declare function detectSiblingCover(targetPath: string): DetectedCover | null;
|
|
63
|
-
interface PackagedBundle {
|
|
64
|
-
format: "single-html" | "directory" | "zip";
|
|
65
|
-
entryPoint: string;
|
|
66
|
-
fileCount: number;
|
|
67
|
-
totalBytes: number;
|
|
68
|
-
totalSizeBytes: number;
|
|
69
|
-
buffer: Buffer;
|
|
70
|
-
bundleBuffer: Buffer;
|
|
71
|
-
fileHash: string;
|
|
72
|
-
files: string[];
|
|
73
|
-
extractedTitle?: string;
|
|
74
|
-
extractedTagline?: string;
|
|
75
|
-
extractedAspectRatio?: string;
|
|
76
|
-
extractedModel?: string | null;
|
|
77
|
-
extractedTags?: string[];
|
|
78
|
-
}
|
|
79
|
-
declare function extractHtmlMetadata(html: string): {
|
|
80
|
-
title?: string;
|
|
81
|
-
tagline?: string;
|
|
82
|
-
aspectRatio?: string;
|
|
83
|
-
rawAspectRatio?: string;
|
|
84
|
-
model?: string | null;
|
|
85
|
-
tags?: string[];
|
|
86
|
-
};
|
|
87
|
-
declare function computeSha256(buf: Buffer | Uint8Array): string;
|
|
88
|
-
declare function createZipFromFiles(fileMap: Record<string, Buffer>): Buffer;
|
|
89
|
-
declare function packageGame(targetPath: string): Promise<PackagedBundle>;
|
|
90
|
-
|
|
91
|
-
interface ValidationResult {
|
|
92
|
-
valid: boolean;
|
|
93
|
-
targetPath: string;
|
|
94
|
-
format?: string;
|
|
95
|
-
entryPoint?: string;
|
|
96
|
-
fileCount?: number;
|
|
97
|
-
totalSizeBytes?: number;
|
|
98
|
-
sha256?: string;
|
|
99
|
-
fileHash?: string;
|
|
100
|
-
files?: string[];
|
|
101
|
-
aspectRatio?: string;
|
|
102
|
-
aiModel?: string | null;
|
|
103
|
-
supportedPlatforms?: SupportedPlatform;
|
|
104
|
-
platforms?: SupportedPlatform;
|
|
105
|
-
hasPlatformMeta?: boolean;
|
|
106
|
-
tags?: string[];
|
|
107
|
-
errors: string[];
|
|
108
|
-
warnings: string[];
|
|
109
|
-
}
|
|
110
|
-
declare function checkHtmlDependencies(content: string): {
|
|
111
|
-
valid: boolean;
|
|
112
|
-
errors: string[];
|
|
113
|
-
};
|
|
114
|
-
declare function validateGamePackage(targetPath: string): Promise<ValidationResult>;
|
|
115
|
-
|
|
116
|
-
interface UploadBundleOptions {
|
|
117
|
-
apiUrl: string;
|
|
118
|
-
bundleBuffer: Buffer;
|
|
119
|
-
title: string;
|
|
120
|
-
tagline?: string;
|
|
121
|
-
description?: string;
|
|
122
|
-
aiTool?: string;
|
|
123
|
-
category?: string;
|
|
124
|
-
tags?: string[] | string;
|
|
125
|
-
token?: string | null;
|
|
126
|
-
fileHash?: string;
|
|
127
|
-
extraHeaders?: Record<string, string>;
|
|
128
|
-
submissionType?: "maker" | "hunter";
|
|
129
|
-
makerName?: string | null;
|
|
130
|
-
visibility?: string;
|
|
131
|
-
prompt?: string;
|
|
132
|
-
changelog?: string;
|
|
133
|
-
aspectRatio?: string;
|
|
134
|
-
supportedPlatforms?: string;
|
|
135
|
-
aiModel?: string | null;
|
|
136
|
-
coverBuffer?: Buffer;
|
|
137
|
-
coverFileName?: string;
|
|
138
|
-
errorMsgFallback?: string;
|
|
139
|
-
}
|
|
140
|
-
interface UploadResponse {
|
|
141
|
-
success: boolean;
|
|
142
|
-
slug: string;
|
|
143
|
-
url: string;
|
|
144
|
-
fullUrl?: string;
|
|
145
|
-
shortUrl?: string;
|
|
146
|
-
embedUrl?: string;
|
|
147
|
-
claim_token?: string;
|
|
148
|
-
claimToken?: string;
|
|
149
|
-
claimUrl?: string;
|
|
150
|
-
fileHash?: string;
|
|
151
|
-
isAnonymous?: boolean;
|
|
152
|
-
expiresAt?: string;
|
|
153
|
-
status?: string;
|
|
154
|
-
visibility?: string;
|
|
155
|
-
semver?: string;
|
|
156
|
-
versionNumber?: number;
|
|
157
|
-
promotedToPublic?: boolean;
|
|
158
|
-
supportedPlatforms?: string;
|
|
159
|
-
supported_platforms?: string;
|
|
160
|
-
platforms?: string;
|
|
161
|
-
tags?: string[];
|
|
162
|
-
error?: string;
|
|
163
|
-
message?: string;
|
|
164
|
-
data?: any;
|
|
165
|
-
}
|
|
166
|
-
type UploadResult = UploadResponse;
|
|
167
|
-
interface UpdateBundleOptions {
|
|
168
|
-
apiUrl?: string;
|
|
169
|
-
bundleBuffer?: Buffer;
|
|
170
|
-
title?: string;
|
|
171
|
-
tagline?: string;
|
|
172
|
-
description?: string;
|
|
173
|
-
category?: string;
|
|
174
|
-
visibility?: "draft" | "unlisted" | "public" | string;
|
|
175
|
-
changelog?: string;
|
|
176
|
-
aspectRatio?: string;
|
|
177
|
-
supportedPlatforms?: string;
|
|
178
|
-
aiTool?: string;
|
|
179
|
-
aiModel?: string | null;
|
|
180
|
-
tags?: string[] | string;
|
|
181
|
-
coverBuffer?: Buffer;
|
|
182
|
-
coverFileName?: string;
|
|
183
|
-
manageToken?: string;
|
|
184
|
-
token?: string | null;
|
|
185
|
-
errorMsgFallback?: string;
|
|
186
|
-
extraHeaders?: Record<string, string>;
|
|
187
|
-
}
|
|
188
|
-
type UpdateResponse = UploadResponse;
|
|
189
|
-
type UpdateResult = UpdateResponse;
|
|
190
|
-
declare function resolvePlayableUrl(apiUrl: string, result: {
|
|
191
|
-
fullUrl?: string;
|
|
192
|
-
url?: string;
|
|
193
|
-
slug?: string;
|
|
194
|
-
}, fallbackSlug?: string): string;
|
|
195
|
-
declare function extractFieldErrors(data: any): Record<string, string[]> | undefined;
|
|
196
|
-
declare function extractErrorMessage(data: any, fallback?: string, statusText?: string, statusCode?: number): string;
|
|
197
|
-
declare function uploadGameBundle(options: UploadBundleOptions): Promise<UploadResponse>;
|
|
198
|
-
declare const uploadGame: typeof uploadGameBundle;
|
|
199
|
-
declare function updateGameBundle(slug: string, options: UpdateBundleOptions): Promise<UpdateResponse>;
|
|
200
|
-
declare const updateGame: typeof updateGameBundle;
|
|
201
|
-
declare function fetchWhoami(apiUrl: string, token: string): Promise<any>;
|
|
202
|
-
|
|
203
|
-
declare function printJson(data: any): void;
|
|
204
|
-
declare function printErrorJson(error: string, message: string, code?: number, extra?: Record<string, any>): void;
|
|
205
|
-
declare function logInfo(message: string, isJsonMode?: boolean): void;
|
|
206
|
-
declare function logSuccess(message: string, isJsonMode?: boolean): void;
|
|
207
|
-
declare function logWarn(message: string, isJsonMode?: boolean): void;
|
|
208
|
-
declare function logError(message: string, isJsonMode?: boolean): void;
|
|
209
|
-
declare function printPublishSuccess(res: {
|
|
210
|
-
title: string;
|
|
211
|
-
slug: string;
|
|
212
|
-
url: string;
|
|
213
|
-
shortUrl?: string;
|
|
214
|
-
claim_token?: string;
|
|
215
|
-
claimUrl?: string;
|
|
216
|
-
aiModel?: string | null;
|
|
217
|
-
aiTool?: string;
|
|
218
|
-
fileHash?: string;
|
|
219
|
-
aspectRatio?: string;
|
|
220
|
-
supportedPlatforms?: string;
|
|
221
|
-
platforms?: string;
|
|
222
|
-
tags?: string[];
|
|
223
|
-
}): void;
|
|
224
|
-
|
|
225
|
-
declare function createProgram(opts?: {
|
|
226
|
-
jsonMode?: boolean;
|
|
227
|
-
}): Command;
|
|
228
|
-
declare function runCli(argv?: string[]): Promise<void>;
|
|
229
|
-
declare function isDirectCliExecution(argv1?: string | undefined, moduleUrl?: string): boolean;
|
|
230
|
-
|
|
231
|
-
export { COVER_PRECEDENCE_FILES, type CliConfig, type DetectedCover, type PackagedBundle, type ProjectConfig, type UpdateBundleOptions, type UpdateResponse, type UpdateResult, type UploadBundleOptions, type UploadResponse, type UploadResult, type UserInfo, type ValidationResult, checkHtmlDependencies, clearConfig, clearToken, computeFileFingerprint, computeFingerprint, computeSha256, createProgram, createZipFromFiles, detectSiblingCover, extractErrorMessage, extractFieldErrors, extractHtmlMetadata, fetchWhoami, getConfigDir, getConfigPath, getProjectConfigPath, getToken, incrementVersion, isDirectCliExecution, logError, logInfo, logSuccess, logWarn, packageGame, printErrorJson, printJson, printPublishSuccess, promoteDraftVersion, readConfig, readProjectConfig, resolveApiUrl, resolvePlayableUrl, resolveProjectDirectory, resolveToken, runCli, writeProjectConfig as saveProjectConfig, setToken, updateGame, updateGameBundle, uploadGame, uploadGameBundle, validateGamePackage, writeConfig, writeProjectConfig };
|
|
1
|
+
import { type OutputStreams } from './output.js';
|
|
2
|
+
export declare const CLI_VERSION: string;
|
|
3
|
+
export { CliError } from './output.js';
|
|
4
|
+
export { validateManifestObject, buildStarterManifest } from './manifest.js';
|
|
5
|
+
export { validateProjectBundle } from './validate.js';
|
|
6
|
+
export interface RunCliOptions {
|
|
7
|
+
streams?: OutputStreams;
|
|
8
|
+
cwd?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function runCli(rawArgs: readonly string[], runtime?: RunCliOptions): Promise<number>;
|