@uzuhq/code-cli 0.6.1 → 0.6.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/dist/cli.js CHANGED
@@ -3,8 +3,8 @@
3
3
  // src/cli.ts
4
4
  import { Command, Option } from "commander";
5
5
  import { execSync } from "child_process";
6
- import { readFileSync as readFileSync7, existsSync as existsSync4, unlinkSync, createWriteStream } from "fs";
7
- import { dirname as dirname5, resolve as resolve5 } from "path";
6
+ import { readFileSync as readFileSync6, existsSync as existsSync4, unlinkSync, createWriteStream } from "fs";
7
+ import { dirname as dirname5, resolve as resolve6 } from "path";
8
8
  import { ZipArchive } from "archiver";
9
9
  import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "url";
10
10
 
@@ -418,8 +418,30 @@ var registerRevision = async (params) => {
418
418
 
419
419
  // src/build-server-logic.ts
420
420
  import { build } from "esbuild";
421
- import { readFileSync as readFileSync2 } from "fs";
422
- var SDK_PACKAGES = ["@uzuhq/code-sdk", "@uzupj/uzu-sdk"];
421
+
422
+ // src/sdk-server-stub.ts
423
+ import { existsSync } from "fs";
424
+ import { dirname, resolve } from "path";
425
+ import { fileURLToPath } from "url";
426
+ var SDK_SPECIFIER = /^(@uzuhq\/code-sdk|@uzupj\/uzu-sdk)$/;
427
+ function resolveSdkShimPath() {
428
+ const here = fileURLToPath(import.meta.url);
429
+ const ext = here.endsWith(".ts") ? "ts" : "js";
430
+ const shim = resolve(dirname(here), "dev-server", `sdk-server-shim.${ext}`);
431
+ if (!existsSync(shim)) {
432
+ throw new Error(`sdk-server-shim \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${shim}`);
433
+ }
434
+ return shim;
435
+ }
436
+ var uzuSdkServerStub = {
437
+ name: "uzu-sdk-server-stub",
438
+ setup(build3) {
439
+ const shimPath = resolveSdkShimPath();
440
+ build3.onResolve({ filter: SDK_SPECIFIER }, () => ({ path: shimPath }));
441
+ }
442
+ };
443
+
444
+ // src/build-server-logic.ts
423
445
  var buildServerLogic = async (logicPath, outPath) => {
424
446
  await build({
425
447
  entryPoints: [logicPath],
@@ -428,29 +450,23 @@ var buildServerLogic = async (logicPath, outPath) => {
428
450
  format: "esm",
429
451
  target: "es2022",
430
452
  platform: "neutral",
431
- // SDK type-only import tsc で消えるが安全のため external 指定。
432
- // @uzupj/uzu-sdk は旧パッケージ名 (未移行 scenario 向けの両対応)
433
- external: SDK_PACKAGES
453
+ // SDK engine-core への素通し shim へ差し替えて bundle する。`uzu dev` と
454
+ // 同じ plugin を通すので、harness で動いたものが publish でも同じ形になる。
455
+ //
456
+ // external は 1 つも置かない。Worker Loader が facet へ渡すのは index.js /
457
+ // game-facet.js / logic.js の 3 つだけで npm の解決先が無いため、成果物に bare
458
+ // import が残ると部屋の起動時に落ちる。external を置かなければ、解決できない
459
+ // import は esbuild がここでエラーにするので、壊れた成果物は publish されない。
460
+ plugins: [uzuSdkServerStub]
434
461
  });
435
- assertNoSdkRuntimeImport(outPath);
436
462
  console.log(`Built server logic: ${logicPath} \u2192 ${outPath}`);
437
463
  };
438
- var assertNoSdkRuntimeImport = (outPath) => {
439
- const built = readFileSync2(outPath, "utf-8");
440
- const found = SDK_PACKAGES.find((pkg) => built.includes(pkg));
441
- if (!found) return;
442
- throw new Error(
443
- `logic \u304C ${found} \u304B\u3089\u5024\u3092 import \u3057\u3066\u3044\u307E\u3059\u3002
444
- logic \u304B\u3089 SDK \u3078\u5411\u3051\u3066\u3088\u3044\u306E\u306F\u578B\u3060\u3051\u3067\u3059 (import type)\u3002
445
- \u5B9F\u884C\u6642\u306B\u5FC5\u8981\u306A\u3082\u306E (serverOnly / SERVER_TIME \u7B49) \u306F @uzuhq/code-engine-core \u304B\u3089 import \u3057\u3066\u304F\u3060\u3055\u3044\u3002`
446
- );
447
- };
448
464
 
449
465
  // src/create-2d-game.ts
450
- import { mkdirSync, readFileSync as readFileSync3, writeFileSync, readdirSync, statSync } from "fs";
451
- import { resolve, dirname, join as join3 } from "path";
452
- import { fileURLToPath } from "url";
453
- var __dirname = dirname(fileURLToPath(import.meta.url));
466
+ import { mkdirSync, readFileSync as readFileSync2, writeFileSync, readdirSync, statSync } from "fs";
467
+ import { resolve as resolve2, dirname as dirname2, join as join3 } from "path";
468
+ import { fileURLToPath as fileURLToPath2 } from "url";
469
+ var __dirname = dirname2(fileURLToPath2(import.meta.url));
454
470
  var copyDir = (src, dest, replacements) => {
455
471
  mkdirSync(dest, { recursive: true });
456
472
  for (const entry of readdirSync(src)) {
@@ -461,13 +477,13 @@ var copyDir = (src, dest, replacements) => {
461
477
  continue;
462
478
  }
463
479
  if (entry.endsWith(".tpl")) {
464
- let content = readFileSync3(srcPath, "utf-8");
480
+ let content = readFileSync2(srcPath, "utf-8");
465
481
  for (const [key, value] of Object.entries(replacements)) {
466
482
  content = content.replaceAll(`{{${key}}}`, value);
467
483
  }
468
484
  writeFileSync(join3(dest, entry.replace(/\.tpl$/, "")), content);
469
485
  } else {
470
- const content = readFileSync3(srcPath, "utf-8");
486
+ const content = readFileSync2(srcPath, "utf-8");
471
487
  let output = content;
472
488
  for (const [key, value] of Object.entries(replacements)) {
473
489
  output = output.replaceAll(`{{${key}}}`, value);
@@ -478,8 +494,8 @@ var copyDir = (src, dest, replacements) => {
478
494
  };
479
495
  var toTitle = (name) => name.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
480
496
  var create2dGame = (name) => {
481
- const dest = resolve(process.cwd(), name);
482
- const templateDir = resolve(__dirname, "..", "game-2d-template");
497
+ const dest = resolve2(process.cwd(), name);
498
+ const templateDir = resolve2(__dirname, "..", "game-2d-template");
483
499
  const title = toTitle(name);
484
500
  const replacements = { name, title };
485
501
  console.log(`Creating 2D game project: ${name}`);
@@ -494,7 +510,7 @@ Next steps:`);
494
510
  };
495
511
 
496
512
  // src/cf-images-upload.ts
497
- import { readFileSync as readFileSync4 } from "fs";
513
+ import { readFileSync as readFileSync3 } from "fs";
498
514
  import { basename as basename2 } from "path";
499
515
  var parseUploadedImageId = (v) => {
500
516
  if (typeof v === "object" && v !== null && "success" in v && v.success === true && "result" in v && typeof v.result === "object" && v.result !== null && "id" in v.result && typeof v.result.id === "string" && v.result.id !== "") {
@@ -513,7 +529,7 @@ var uploadIconsToCfImages = async (env, token, filePaths) => {
513
529
  filePaths.map(async (filePath, i) => {
514
530
  const image = session.images[i];
515
531
  const formData = new FormData();
516
- formData.append("file", new Blob([readFileSync4(filePath)]), basename2(filePath));
532
+ formData.append("file", new Blob([readFileSync3(filePath)]), basename2(filePath));
517
533
  const res = await fetch(image.uploadURL, { method: "POST", body: formData });
518
534
  if (!res.ok) {
519
535
  const detail = (await res.text()).trim();
@@ -530,8 +546,8 @@ var uploadIconsToCfImages = async (env, token, filePaths) => {
530
546
 
531
547
  // src/dev.ts
532
548
  import { spawn } from "child_process";
533
- import { readFileSync as readFileSync5, existsSync as existsSync2 } from "fs";
534
- import { dirname as dirname3, resolve as resolve3 } from "path";
549
+ import { readFileSync as readFileSync4, existsSync as existsSync2 } from "fs";
550
+ import { dirname as dirname3, resolve as resolve4 } from "path";
535
551
  import { fileURLToPath as fileURLToPath3 } from "url";
536
552
  import { createInterface } from "readline";
537
553
 
@@ -552,6 +568,7 @@ import { randomUUID } from "crypto";
552
568
  var toMs = (t) => t;
553
569
  var plus = (t, d) => toMs(t) + d;
554
570
  var asGameTime = (ms) => ms;
571
+ var GAME_START = asGameTime(0);
555
572
 
556
573
  // ../engine-core/src/game-clock.ts
557
574
  var NO_PLAYERS_GRACE_MS = 5 * 6e4;
@@ -1862,7 +1879,7 @@ function startHarnessServer(opts) {
1862
1879
  });
1863
1880
  httpServer.listen(opts.port, opts.host ?? "127.0.0.1");
1864
1881
  return {
1865
- stop: () => new Promise((resolve6) => {
1882
+ stop: () => new Promise((resolve7) => {
1866
1883
  for (const ws of wss.clients) {
1867
1884
  try {
1868
1885
  ws.close();
@@ -1870,7 +1887,7 @@ function startHarnessServer(opts) {
1870
1887
  }
1871
1888
  }
1872
1889
  wss.close(() => {
1873
- httpServer.close(() => resolve6());
1890
+ httpServer.close(() => resolve7());
1874
1891
  });
1875
1892
  })
1876
1893
  };
@@ -2086,29 +2103,12 @@ function proxyUpgradeToScenario(req, socket, head, scenarioUrl) {
2086
2103
 
2087
2104
  // src/dev-server/load-logic.ts
2088
2105
  import { build as build2 } from "esbuild";
2089
- import { existsSync, mkdtempSync, rmSync } from "fs";
2106
+ import { mkdtempSync, rmSync } from "fs";
2090
2107
  import { tmpdir } from "os";
2091
- import { dirname as dirname2, join as join4, resolve as resolve2 } from "path";
2092
- import { fileURLToPath as fileURLToPath2, pathToFileURL } from "url";
2093
- function resolveSdkShimPath() {
2094
- const here = fileURLToPath2(import.meta.url);
2095
- const shim = here.endsWith(".ts") ? resolve2(dirname2(here), "sdk-server-shim.ts") : resolve2(dirname2(here), "dev-server", "sdk-server-shim.js");
2096
- if (!existsSync(shim)) {
2097
- throw new Error(`sdk-server-shim \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${shim}`);
2098
- }
2099
- return shim;
2100
- }
2101
- var uzuSdkServerStub = {
2102
- name: "uzu-sdk-server-stub",
2103
- setup(build3) {
2104
- const shimPath = resolveSdkShimPath();
2105
- build3.onResolve({ filter: /^(@uzuhq\/code-sdk|@uzupj\/uzu-sdk)$/ }, () => ({
2106
- path: shimPath
2107
- }));
2108
- }
2109
- };
2108
+ import { join as join4, resolve as resolve3 } from "path";
2109
+ import { pathToFileURL } from "url";
2110
2110
  async function loadLogicFromPath(logicPath) {
2111
- const absPath = resolve2(logicPath);
2111
+ const absPath = resolve3(logicPath);
2112
2112
  const tempDir = mkdtempSync(join4(tmpdir(), "uzu-dev-logic-"));
2113
2113
  const outPath = join4(tempDir, "logic.mjs");
2114
2114
  await build2({
@@ -2185,12 +2185,12 @@ var DEFAULT_READY_PATTERN = "Local:\\s+(https?://[^\\s]+)";
2185
2185
  var DEFAULT_MIN_IFRAME_SHORT_EDGE = 360;
2186
2186
  async function runDevCommand() {
2187
2187
  const cwd = process.cwd();
2188
- const manifestPath = resolve3(cwd, "manifest.json");
2188
+ const manifestPath = resolve4(cwd, "manifest.json");
2189
2189
  if (!existsSync2(manifestPath)) {
2190
2190
  console.error("manifest.json \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 scenario \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3067\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
2191
2191
  process.exit(1);
2192
2192
  }
2193
- const manifest = JSON.parse(readFileSync5(manifestPath, "utf-8"));
2193
+ const manifest = JSON.parse(readFileSync4(manifestPath, "utf-8"));
2194
2194
  const playerCount = manifest.characters?.length ?? manifest.playerCount ?? 2;
2195
2195
  const orientation = manifest.orientation ?? "portrait";
2196
2196
  const devCommand = manifest.dev?.command ?? DEFAULT_DEV_COMMAND;
@@ -2198,13 +2198,13 @@ async function runDevCommand() {
2198
2198
  let loaded = null;
2199
2199
  if (manifest.serverActionLogicPath) {
2200
2200
  console.log(`[uzu dev] Building server logic from ${manifest.serverActionLogicPath}...`);
2201
- const logicPath = resolve3(cwd, manifest.serverActionLogicPath);
2201
+ const logicPath = resolve4(cwd, manifest.serverActionLogicPath);
2202
2202
  loaded = await loadLogicFromPath(logicPath);
2203
2203
  console.log("[uzu dev] Server logic ready");
2204
2204
  }
2205
2205
  const thisDir = dirname3(fileURLToPath3(import.meta.url));
2206
- const clientEntryJs = resolve3(thisDir, "harness", "client-entry.js");
2207
- const clientEntryTs = resolve3(thisDir, "harness", "client-entry.ts");
2206
+ const clientEntryJs = resolve4(thisDir, "harness", "client-entry.js");
2207
+ const clientEntryTs = resolve4(thisDir, "harness", "client-entry.ts");
2208
2208
  const clientEntry = existsSync2(clientEntryJs) ? clientEntryJs : existsSync2(clientEntryTs) ? clientEntryTs : null;
2209
2209
  if (!clientEntry) {
2210
2210
  console.error(`harness client entry \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${clientEntryJs}`);
@@ -2301,7 +2301,7 @@ function stripAnsi(s) {
2301
2301
  return s.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "");
2302
2302
  }
2303
2303
  function watchForReady(child, pattern) {
2304
- return new Promise((resolve6, reject) => {
2304
+ return new Promise((resolve7, reject) => {
2305
2305
  const timeout = setTimeout(() => {
2306
2306
  reject(new Error("Timed out waiting for scenario dev server to become ready (30s)"));
2307
2307
  }, 3e4);
@@ -2317,7 +2317,7 @@ function watchForReady(child, pattern) {
2317
2317
  const url = /^https?:\/\//i.test(captured) ? captured : `http://localhost:${captured}`;
2318
2318
  resolved = true;
2319
2319
  clearTimeout(timeout);
2320
- resolve6(url.replace(/\/$/, ""));
2320
+ resolve7(url.replace(/\/$/, ""));
2321
2321
  };
2322
2322
  if (child.stdout) {
2323
2323
  const rl = createInterface({ input: child.stdout });
@@ -2344,14 +2344,14 @@ var MAX_HARNESS_PORT_ATTEMPTS = 100;
2344
2344
  var HARNESS_HOST = "0.0.0.0";
2345
2345
  async function findFreePort() {
2346
2346
  const net = await import("net");
2347
- const tryPort = (port) => new Promise((resolve6) => {
2347
+ const tryPort = (port) => new Promise((resolve7) => {
2348
2348
  const server = net.createServer();
2349
2349
  server.unref();
2350
- server.once("error", () => resolve6(null));
2350
+ server.once("error", () => resolve7(null));
2351
2351
  server.listen(port, HARNESS_HOST, () => {
2352
2352
  const address = server.address();
2353
2353
  const assigned = typeof address === "object" && address !== null ? address.port : port;
2354
- server.close(() => resolve6(assigned));
2354
+ server.close(() => resolve7(assigned));
2355
2355
  });
2356
2356
  });
2357
2357
  for (let i = 0; i < MAX_HARNESS_PORT_ATTEMPTS; i++) {
@@ -2365,8 +2365,8 @@ async function findFreePort() {
2365
2365
  }
2366
2366
 
2367
2367
  // src/sdk-version.ts
2368
- import { existsSync as existsSync3, readFileSync as readFileSync6 } from "fs";
2369
- import { dirname as dirname4, resolve as resolve4 } from "path";
2368
+ import { existsSync as existsSync3, readFileSync as readFileSync5 } from "fs";
2369
+ import { dirname as dirname4, resolve as resolve5 } from "path";
2370
2370
  var SDK_PACKAGE_PATHS = [
2371
2371
  ["@uzuhq", "code-sdk"],
2372
2372
  ["@uzupj", "uzu-sdk"]
@@ -2378,17 +2378,17 @@ var readInstalledSdkVersion = (cwd) => {
2378
2378
  "@uzuhq/code-sdk \u304C node_modules \u306B\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u4F9D\u5B58\u3092 install \u3057\u3066\u304B\u3089 publish \u3057\u3066\u304F\u3060\u3055\u3044\u3002"
2379
2379
  );
2380
2380
  }
2381
- const version = JSON.parse(readFileSync6(pkgPath, "utf-8")).version;
2381
+ const version = JSON.parse(readFileSync5(pkgPath, "utf-8")).version;
2382
2382
  if (!version) {
2383
2383
  throw new Error(`${pkgPath} \u306B version \u304C\u3042\u308A\u307E\u305B\u3093\u3002`);
2384
2384
  }
2385
2385
  return version;
2386
2386
  };
2387
2387
  var findSdkPackageJson = (cwd) => {
2388
- let dir = resolve4(cwd);
2388
+ let dir = resolve5(cwd);
2389
2389
  for (; ; ) {
2390
2390
  const found = SDK_PACKAGE_PATHS.map(
2391
- (segments) => resolve4(dir, "node_modules", ...segments, "package.json")
2391
+ (segments) => resolve5(dir, "node_modules", ...segments, "package.json")
2392
2392
  ).find(existsSync3);
2393
2393
  if (found) {
2394
2394
  return found;
@@ -2450,7 +2450,7 @@ var failureHtml = (msg) => {
2450
2450
  </body>`;
2451
2451
  };
2452
2452
  var startLoopbackServer = async () => {
2453
- let resolve6 = null;
2453
+ let resolve7 = null;
2454
2454
  let reject = null;
2455
2455
  let delivered = false;
2456
2456
  let pending = null;
@@ -2487,7 +2487,7 @@ var startLoopbackServer = async () => {
2487
2487
  }
2488
2488
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
2489
2489
  res.end(SUCCESS_HTML);
2490
- if (resolve6) resolve6(code);
2490
+ if (resolve7) resolve7(code);
2491
2491
  else pending = { code };
2492
2492
  });
2493
2493
  await new Promise((res, rej) => {
@@ -2509,7 +2509,7 @@ var startLoopbackServer = async () => {
2509
2509
  () => rej(new Error(`login timed out after ${timeoutMs}ms`)),
2510
2510
  timeoutMs
2511
2511
  );
2512
- resolve6 = (code) => {
2512
+ resolve7 = (code) => {
2513
2513
  clearTimeout(t);
2514
2514
  res(code);
2515
2515
  };
@@ -2557,8 +2557,8 @@ var runLoginFlow = async (env, onURL) => {
2557
2557
  // src/cli.ts
2558
2558
  var envOption = () => new Option("--env <env>", "\u63A5\u7D9A\u5148\u74B0\u5883 (dev | stg | prd)").default(DEFAULT_ENV).hideHelp();
2559
2559
  var readOwnCliVersion = () => {
2560
- const pkgPath = resolve5(dirname5(fileURLToPath4(import.meta.url)), "..", "package.json");
2561
- const version = JSON.parse(readFileSync7(pkgPath, "utf-8")).version;
2560
+ const pkgPath = resolve6(dirname5(fileURLToPath4(import.meta.url)), "..", "package.json");
2561
+ const version = JSON.parse(readFileSync6(pkgPath, "utf-8")).version;
2562
2562
  if (!version) {
2563
2563
  throw new Error("uzu-cli \u306E package.json \u306B version \u304C\u3042\u308A\u307E\u305B\u3093\u3002");
2564
2564
  }
@@ -2583,12 +2583,12 @@ program.command("dev").description(
2583
2583
  program.command("publish").description("\u30B2\u30FC\u30E0\u3092\u30D3\u30EB\u30C9\u3057\u3066 R2 \u306B\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9 \u2192 \u767B\u9332").option("--change-notes <msg>", "\u30EA\u30D3\u30B8\u30E7\u30F3\u306E\u5909\u66F4\u30E1\u30E2", "").addOption(envOption()).action(async (options) => {
2584
2584
  const env = resolveEnv(options.env);
2585
2585
  const cwd = process.cwd();
2586
- const manifestPath = resolve5(cwd, "manifest.json");
2586
+ const manifestPath = resolve6(cwd, "manifest.json");
2587
2587
  if (!existsSync4(manifestPath)) {
2588
2588
  console.error("manifest.json \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u30B2\u30FC\u30E0\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3067\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
2589
2589
  process.exit(1);
2590
2590
  }
2591
- const manifest = JSON.parse(readFileSync7(manifestPath, "utf-8"));
2591
+ const manifest = JSON.parse(readFileSync6(manifestPath, "utf-8"));
2592
2592
  if (typeof manifest !== "object" || manifest === null) {
2593
2593
  console.error("manifest.json \u304C\u4E0D\u6B63\u306A\u5F62\u5F0F\u3067\u3059\u3002");
2594
2594
  process.exit(1);
@@ -2642,8 +2642,8 @@ program.command("publish").description("\u30B2\u30FC\u30E0\u3092\u30D3\u30EB\u30
2642
2642
  execSync(buildCommand, { stdio: "inherit", cwd });
2643
2643
  }
2644
2644
  console.log("Creating ZIP...");
2645
- const absoluteOutputDir = resolve5(cwd, outputDir);
2646
- const zipPath = resolve5(cwd, "__zip__.zip");
2645
+ const absoluteOutputDir = resolve6(cwd, outputDir);
2646
+ const zipPath = resolve6(cwd, "__zip__.zip");
2647
2647
  await new Promise((res, reject) => {
2648
2648
  const output = createWriteStream(zipPath);
2649
2649
  const archive = new ZipArchive({ zlib: { level: 9 } });
@@ -2658,8 +2658,8 @@ program.command("publish").description("\u30B2\u30FC\u30E0\u3092\u30D3\u30EB\u30
2658
2658
  const { resourceId, revisionId, token } = await uploadGameToR2(env, zipPath, absoluteOutputDir);
2659
2659
  console.log(`Uploaded to R2. revisionId: ${revisionId}, resourceId: ${resourceId}`);
2660
2660
  if (manifest.serverActionLogicPath) {
2661
- const logicEntryPoint = resolve5(cwd, manifest.serverActionLogicPath);
2662
- const logicOutPath = resolve5(cwd, "__logic__.js");
2661
+ const logicEntryPoint = resolve6(cwd, manifest.serverActionLogicPath);
2662
+ const logicOutPath = resolve6(cwd, "__logic__.js");
2663
2663
  try {
2664
2664
  console.log("Building server logic...");
2665
2665
  await buildServerLogic(logicEntryPoint, logicOutPath);
@@ -2674,7 +2674,7 @@ program.command("publish").description("\u30B2\u30FC\u30E0\u3092\u30D3\u30EB\u30
2674
2674
  process.exit(1);
2675
2675
  }
2676
2676
  console.log("Uploading logic.js to R2...");
2677
- const logicJsContent = readFileSync7(logicOutPath, "utf-8");
2677
+ const logicJsContent = readFileSync6(logicOutPath, "utf-8");
2678
2678
  await uploadLogicToR2(env, token, logicJsContent, { wireVersion: WIRE_VERSION });
2679
2679
  } finally {
2680
2680
  if (existsSync4(logicOutPath)) unlinkSync(logicOutPath);
@@ -2685,7 +2685,7 @@ program.command("publish").description("\u30B2\u30FC\u30E0\u3092\u30D3\u30EB\u30
2685
2685
  console.log("Resolving character icons...");
2686
2686
  const isLocalIcon = (char) => !!char.icon && !char.icon.startsWith("http://") && !char.icon.startsWith("https://");
2687
2687
  const localIconPaths = manifestCharacters.filter(isLocalIcon).map((char) => {
2688
- const iconAbsPath = resolve5(cwd, char.icon);
2688
+ const iconAbsPath = resolve6(cwd, char.icon);
2689
2689
  if (!existsSync4(iconAbsPath)) {
2690
2690
  console.error(`\u30A2\u30A4\u30B3\u30F3\u30D5\u30A1\u30A4\u30EB\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${char.icon}`);
2691
2691
  process.exit(1);
@@ -2695,7 +2695,7 @@ program.command("publish").description("\u30B2\u30FC\u30E0\u3092\u30D3\u30EB\u30
2695
2695
  const iconURLs = await uploadIconsToCfImages(env, token, localIconPaths);
2696
2696
  resolvedCharacters = manifestCharacters.map((char) => {
2697
2697
  if (!isLocalIcon(char)) return char;
2698
- const cfImagesUrl = iconURLs.get(resolve5(cwd, char.icon));
2698
+ const cfImagesUrl = iconURLs.get(resolve6(cwd, char.icon));
2699
2699
  if (!cfImagesUrl) {
2700
2700
  console.error(`\u30A2\u30A4\u30B3\u30F3\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u7D50\u679C\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093: ${char.icon}`);
2701
2701
  process.exit(1);
@@ -12,6 +12,7 @@ var plus = (t, d) => toMs(t) + d;
12
12
  var sub = (t, d) => toMs(t) - d;
13
13
  var minus = (a, b) => toMs(a) - toMs(b);
14
14
  var asGameTime = (ms) => ms;
15
+ var GAME_START = asGameTime(0);
15
16
 
16
17
  // ../engine-core/src/game-clock.ts
17
18
  var NO_PLAYERS_GRACE_MS = 5 * 6e4;
@@ -246,6 +247,7 @@ var WIRE_VERSION = 2;
246
247
  export {
247
248
  BRIDGE_VERSION,
248
249
  DEFAULT_ICON_URLS,
250
+ GAME_START,
249
251
  GameClock,
250
252
  NO_PLAYERS_GRACE_MS,
251
253
  SERVER_TIME,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uzuhq/code-cli",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "UZU ゲーム開発 CLI - ビルド・パブリッシュ・プロジェクト作成ツール",
5
5
  "type": "module",
6
6
  "bin": {