@babylonjsmarket/cli 1.0.4 → 1.0.6

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.js CHANGED
@@ -20,7 +20,7 @@ import { homedir } from "os";
20
20
  import { join } from "path";
21
21
  var API_BASE_URL = process.env.BJS_API_URL || "https://babylonjsmarket.com";
22
22
  var DEV_API_URL = process.env.BJS_DEV_API_URL || "https://dev.babylonjsmarket.com";
23
- var USE_DEV = process.env.BJS_ENV !== "production";
23
+ var USE_DEV = process.env.BJS_ENV === "development";
24
24
  var API_URL = USE_DEV ? DEV_API_URL : API_BASE_URL;
25
25
  var AUTH_DEVICE_CODE_URL = `${API_URL}/api/auth/device/code`;
26
26
  var AUTH_DEVICE_TOKEN_URL = `${API_URL}/api/auth/device/token`;
@@ -176,13 +176,8 @@ var AuthManager = class {
176
176
  };
177
177
 
178
178
  // src/commands/login-simple.ts
179
- import { createServer } from "https";
180
179
  import { createServer as createHttpServer } from "http";
181
180
  import { URL } from "url";
182
- import { execSync } from "child_process";
183
- import fs from "fs";
184
- import path from "path";
185
- import os from "os";
186
181
  var loginCommand = new Command("login").description("Authenticate with BabylonJS Market").option("--no-browser", "Don't open browser automatically").action(async (options) => {
187
182
  const authManager = new AuthManager();
188
183
  if (authManager.isAuthenticated()) {
@@ -195,39 +190,10 @@ var loginCommand = new Command("login").description("Authenticate with BabylonJS
195
190
  try {
196
191
  const port = 8765;
197
192
  let token = null;
198
- const certDir = path.join(os.homedir(), ".bjs", "certs");
199
- const keyPath = path.join(certDir, "localhost-key.pem");
200
- const certPath = path.join(certDir, "localhost-cert.pem");
201
- if (!fs.existsSync(certDir)) {
202
- fs.mkdirSync(certDir, { recursive: true });
203
- }
204
- if (!fs.existsSync(keyPath) || !fs.existsSync(certPath)) {
205
- console.log(chalk.gray("Generating self-signed certificate for HTTPS..."));
206
- try {
207
- execSync(
208
- `openssl req -x509 -newkey rsa:2048 -nodes -sha256 -days 365 -keyout "${keyPath}" -out "${certPath}" -subj "/C=US/ST=State/L=City/O=BJS-CLI/CN=localhost"`,
209
- { stdio: "pipe" }
210
- );
211
- } catch (error) {
212
- console.log(chalk.yellow("Could not generate HTTPS certificate, falling back to HTTP"));
213
- }
214
- }
215
- let server;
216
- let protocol = "https";
217
- if (fs.existsSync(keyPath) && fs.existsSync(certPath)) {
218
- const serverOptions = {
219
- key: fs.readFileSync(keyPath),
220
- cert: fs.readFileSync(certPath)
221
- };
222
- server = createServer(serverOptions, (req, res) => {
223
- handleRequest(req, res);
224
- });
225
- } else {
226
- protocol = "http";
227
- server = createHttpServer((req, res) => {
228
- handleRequest(req, res);
229
- });
230
- }
193
+ const protocol = "http";
194
+ const server = createHttpServer((req, res) => {
195
+ handleRequest(req, res);
196
+ });
231
197
  const handleRequest = (req, res) => {
232
198
  const url = new URL(req.url, `${protocol}://localhost:${port}`);
233
199
  token = url.searchParams.get("token");
@@ -463,7 +429,7 @@ import ora2 from "ora";
463
429
  import { createWriteStream, existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
464
430
  import { pipeline } from "stream/promises";
465
431
  import fetch3 from "node-fetch";
466
- import path2 from "path";
432
+ import path from "path";
467
433
  var downloadCommand = new Command4("download").description("Download assets from BabylonJS Market").argument("<asset-key>", "Asset key to download").option("-o, --output <path>", "Output directory (default: current directory)").action(async (assetKey, options) => {
468
434
  const authManager = new AuthManager();
469
435
  const theme = applyTheme();
@@ -511,7 +477,7 @@ var downloadCommand = new Command4("download").description("Download assets from
511
477
  if (!existsSync2(outputDir)) {
512
478
  mkdirSync2(outputDir, { recursive: true });
513
479
  }
514
- const outputPath = path2.join(outputDir, fileName);
480
+ const outputPath = path.join(outputDir, fileName);
515
481
  const contentLength = fileResponse.headers.get("content-length");
516
482
  const total = contentLength ? parseInt(contentLength, 10) : 0;
517
483
  let loaded = 0;
@@ -1721,7 +1687,7 @@ var MarkdownTerminalRenderer = class {
1721
1687
 
1722
1688
  // src/utils/course-detail-viewer.ts
1723
1689
  import { EventEmitter as EventEmitter2 } from "events";
1724
- import { execSync as execSync2 } from "child_process";
1690
+ import { execSync } from "child_process";
1725
1691
  import open2 from "open";
1726
1692
 
1727
1693
  // src/utils/course-detail/layout.ts
@@ -2364,8 +2330,7 @@ var CourseDetailViewer = class extends EventEmitter2 {
2364
2330
  const alt = imageMatch[1] || "Image";
2365
2331
  let url = imageMatch[2];
2366
2332
  if (!url.startsWith("http")) {
2367
- const API_URL2 = "https://dev.babylonjsmarket.com";
2368
- url = `${API_URL2}${url.startsWith("/") ? "" : "/"}${url}`;
2333
+ url = `${API_URL}${url.startsWith("/") ? "" : "/"}${url}`;
2369
2334
  }
2370
2335
  const imageStartLine = result.length;
2371
2336
  result.push("");
@@ -2907,13 +2872,13 @@ var CourseDetailViewer = class extends EventEmitter2 {
2907
2872
  command = "clip";
2908
2873
  } else {
2909
2874
  try {
2910
- execSync2("which xclip", { stdio: "ignore" });
2875
+ execSync("which xclip", { stdio: "ignore" });
2911
2876
  command = "xclip -selection clipboard";
2912
2877
  } catch {
2913
2878
  command = "xsel --clipboard --input";
2914
2879
  }
2915
2880
  }
2916
- execSync2(command, { input: block.code });
2881
+ execSync(command, { input: block.code });
2917
2882
  const nowMs = Date.now();
2918
2883
  this.vs = {
2919
2884
  ...this.vs,
@@ -3029,14 +2994,14 @@ var CourseDetailViewer = class extends EventEmitter2 {
3029
2994
  };
3030
2995
 
3031
2996
  // src/commands/bbs.ts
3032
- import fs5 from "fs";
3033
- import path5 from "path";
2997
+ import fs4 from "fs";
2998
+ import path4 from "path";
3034
2999
  import { homedir as homedir2 } from "os";
3035
3000
  import process2 from "process";
3036
3001
 
3037
3002
  // src/utils/asset-downloader.ts
3038
3003
  import fetch5 from "node-fetch";
3039
- import fs2 from "fs";
3004
+ import fs from "fs";
3040
3005
  import { pipeline as pipeline2 } from "stream/promises";
3041
3006
  var AssetDownloader = class {
3042
3007
  authManager;
@@ -3089,7 +3054,7 @@ var AssetDownloader = class {
3089
3054
  const contentLength = fileResponse.headers.get("content-length");
3090
3055
  const total = parseInt(contentLength || "0", 10);
3091
3056
  let loaded = 0;
3092
- const writer = fs2.createWriteStream(outputPath);
3057
+ const writer = fs.createWriteStream(outputPath);
3093
3058
  fileResponse.body.on("data", (chunk) => {
3094
3059
  loaded += chunk.length;
3095
3060
  writer.write(chunk);
@@ -3103,7 +3068,7 @@ var AssetDownloader = class {
3103
3068
  });
3104
3069
  await pipeline2(fileResponse.body, writer);
3105
3070
  } else {
3106
- const fileStream = fs2.createWriteStream(outputPath);
3071
+ const fileStream = fs.createWriteStream(outputPath);
3107
3072
  await pipeline2(fileResponse.body, fileStream);
3108
3073
  }
3109
3074
  return true;
@@ -3131,15 +3096,15 @@ var AssetDownloader = class {
3131
3096
  };
3132
3097
 
3133
3098
  // src/utils/project-scanner.ts
3134
- import fs3 from "fs";
3135
- import path3 from "path";
3099
+ import fs2 from "fs";
3100
+ import path2 from "path";
3136
3101
  async function scanForProjects(baseDir, maxDepth = 2) {
3137
3102
  const projects = [];
3138
3103
  let projectId = 1;
3139
3104
  async function scanDirectory(dir, depth) {
3140
3105
  if (depth > maxDepth) return;
3141
3106
  try {
3142
- const entries = await fs3.promises.readdir(dir, { withFileTypes: true });
3107
+ const entries = await fs2.promises.readdir(dir, { withFileTypes: true });
3143
3108
  for (const entry of entries) {
3144
3109
  if (entry.name === "node_modules" || entry.name === ".git" || entry.name === "dist" || entry.name === ".next") {
3145
3110
  continue;
@@ -3147,7 +3112,7 @@ async function scanForProjects(baseDir, maxDepth = 2) {
3147
3112
  if (entry.isSymbolicLink()) {
3148
3113
  continue;
3149
3114
  }
3150
- const fullPath = path3.join(dir, entry.name);
3115
+ const fullPath = path2.join(dir, entry.name);
3151
3116
  if (entry.isDirectory()) {
3152
3117
  const isProject = await isProjectDirectory(fullPath);
3153
3118
  if (isProject) {
@@ -3166,10 +3131,10 @@ async function scanForProjects(baseDir, maxDepth = 2) {
3166
3131
  }
3167
3132
  async function isProjectDirectory(dir) {
3168
3133
  try {
3169
- const entries = await fs3.promises.readdir(dir);
3134
+ const entries = await fs2.promises.readdir(dir);
3170
3135
  if (entries.includes("package.json")) {
3171
- const packageJsonPath = path3.join(dir, "package.json");
3172
- const packageJson = JSON.parse(await fs3.promises.readFile(packageJsonPath, "utf-8"));
3136
+ const packageJsonPath = path2.join(dir, "package.json");
3137
+ const packageJson = JSON.parse(await fs2.promises.readFile(packageJsonPath, "utf-8"));
3173
3138
  const allDeps = {
3174
3139
  ...packageJson.dependencies || {},
3175
3140
  ...packageJson.devDependencies || {}
@@ -3192,10 +3157,10 @@ async function isProjectDirectory(dir) {
3192
3157
  async function detectGenre(dir) {
3193
3158
  const configFiles = ["arcade.json", ".arcade", ".arcade.json"];
3194
3159
  for (const configFile of configFiles) {
3195
- const configPath = path3.join(dir, configFile);
3196
- if (fs3.existsSync(configPath)) {
3160
+ const configPath = path2.join(dir, configFile);
3161
+ if (fs2.existsSync(configPath)) {
3197
3162
  try {
3198
- const config = JSON.parse(await fs3.promises.readFile(configPath, "utf-8"));
3163
+ const config = JSON.parse(await fs2.promises.readFile(configPath, "utf-8"));
3199
3164
  if (config.genre || config.template) {
3200
3165
  return config.genre || config.template;
3201
3166
  }
@@ -3203,20 +3168,20 @@ async function detectGenre(dir) {
3203
3168
  }
3204
3169
  }
3205
3170
  }
3206
- const packageJsonPath = path3.join(dir, "package.json");
3207
- if (fs3.existsSync(packageJsonPath)) {
3171
+ const packageJsonPath = path2.join(dir, "package.json");
3172
+ if (fs2.existsSync(packageJsonPath)) {
3208
3173
  try {
3209
- const pkg = JSON.parse(await fs3.promises.readFile(packageJsonPath, "utf-8"));
3174
+ const pkg = JSON.parse(await fs2.promises.readFile(packageJsonPath, "utf-8"));
3210
3175
  if (pkg.arcade?.genre) return pkg.arcade.genre;
3211
3176
  if (pkg.arcade?.template) return pkg.arcade.template;
3212
3177
  if (pkg.gameType) return pkg.gameType;
3213
3178
  } catch {
3214
3179
  }
3215
3180
  }
3216
- const componentsDir = path3.join(dir, "src", "Components");
3217
- if (fs3.existsSync(componentsDir)) {
3181
+ const componentsDir = path2.join(dir, "src", "Components");
3182
+ if (fs2.existsSync(componentsDir)) {
3218
3183
  try {
3219
- const components = await fs3.promises.readdir(componentsDir);
3184
+ const components = await fs2.promises.readdir(componentsDir);
3220
3185
  const componentNames = components.map((c) => c.toLowerCase());
3221
3186
  if (componentNames.some((c) => c.includes("fps") || c.includes("firstperson"))) {
3222
3187
  return "FPS";
@@ -3236,10 +3201,10 @@ async function detectGenre(dir) {
3236
3201
  } catch {
3237
3202
  }
3238
3203
  }
3239
- const dataDir = path3.join(dir, "data");
3240
- if (fs3.existsSync(dataDir)) {
3204
+ const dataDir = path2.join(dir, "data");
3205
+ if (fs2.existsSync(dataDir)) {
3241
3206
  try {
3242
- const dataDirs = await fs3.promises.readdir(dataDir);
3207
+ const dataDirs = await fs2.promises.readdir(dataDir);
3243
3208
  for (const d of dataDirs) {
3244
3209
  const lowerName = d.toLowerCase();
3245
3210
  if (lowerName === "thirdperson") return "ThirdPerson";
@@ -3254,12 +3219,12 @@ async function detectGenre(dir) {
3254
3219
  }
3255
3220
  async function scanComponents(dir) {
3256
3221
  const components = [];
3257
- const componentsDir = path3.join(dir, "src", "Components");
3258
- if (!fs3.existsSync(componentsDir)) {
3222
+ const componentsDir = path2.join(dir, "src", "Components");
3223
+ if (!fs2.existsSync(componentsDir)) {
3259
3224
  return components;
3260
3225
  }
3261
3226
  try {
3262
- const files = await fs3.promises.readdir(componentsDir);
3227
+ const files = await fs2.promises.readdir(componentsDir);
3263
3228
  for (const file of files) {
3264
3229
  if (file.endsWith(".ts") || file.endsWith(".js")) {
3265
3230
  const componentName = file.replace(/\.(ts|js)$/, "");
@@ -3273,14 +3238,14 @@ async function scanComponents(dir) {
3273
3238
  return components.sort();
3274
3239
  }
3275
3240
  async function analyzeProject(dir, id) {
3276
- const name = path3.basename(dir);
3241
+ const name = path2.basename(dir);
3277
3242
  let hasPackageJson = false;
3278
3243
  let engine = "Unknown";
3279
3244
  try {
3280
- const packageJsonPath = path3.join(dir, "package.json");
3281
- if (fs3.existsSync(packageJsonPath)) {
3245
+ const packageJsonPath = path2.join(dir, "package.json");
3246
+ if (fs2.existsSync(packageJsonPath)) {
3282
3247
  hasPackageJson = true;
3283
- const packageJson = JSON.parse(await fs3.promises.readFile(packageJsonPath, "utf-8"));
3248
+ const packageJson = JSON.parse(await fs2.promises.readFile(packageJsonPath, "utf-8"));
3284
3249
  const allDeps = {
3285
3250
  ...packageJson.dependencies || {},
3286
3251
  ...packageJson.devDependencies || {}
@@ -3308,15 +3273,15 @@ async function analyzeProject(dir, id) {
3308
3273
  }
3309
3274
 
3310
3275
  // src/utils/component-catalog.ts
3311
- import fs4 from "fs";
3312
- import path4 from "path";
3276
+ import fs3 from "fs";
3277
+ import path3 from "path";
3313
3278
  function getLibraryPath() {
3314
3279
  const auth = new AuthManager();
3315
3280
  return auth.getLibraryPath();
3316
3281
  }
3317
3282
  function isLibraryInitialized() {
3318
3283
  const libraryPath = getLibraryPath();
3319
- return fs4.existsSync(path4.join(libraryPath, "Components"));
3284
+ return fs3.existsSync(path3.join(libraryPath, "Components"));
3320
3285
  }
3321
3286
  async function initializeLibrary(libraryPath) {
3322
3287
  const targetPath = libraryPath || getLibraryPath();
@@ -3330,13 +3295,13 @@ async function initializeLibrary(libraryPath) {
3330
3295
  ];
3331
3296
  try {
3332
3297
  for (const dir of dirs) {
3333
- const fullPath = path4.join(targetPath, dir);
3334
- if (!fs4.existsSync(fullPath)) {
3335
- fs4.mkdirSync(fullPath, { recursive: true });
3298
+ const fullPath = path3.join(targetPath, dir);
3299
+ if (!fs3.existsSync(fullPath)) {
3300
+ fs3.mkdirSync(fullPath, { recursive: true });
3336
3301
  }
3337
3302
  }
3338
- const readmePath = path4.join(targetPath, "README.md");
3339
- if (!fs4.existsSync(readmePath)) {
3303
+ const readmePath = path3.join(targetPath, "README.md");
3304
+ if (!fs3.existsSync(readmePath)) {
3340
3305
  const readme = `# BJS Library
3341
3306
 
3342
3307
  Your personal library of BabylonJS components, systems, and game mode presets.
@@ -3363,7 +3328,7 @@ Your personal library of BabylonJS components, systems, and game mode presets.
3363
3328
 
3364
3329
  Content from babylonjsmarket.com will be downloaded here automatically.
3365
3330
  `;
3366
- fs4.writeFileSync(readmePath, readme);
3331
+ fs3.writeFileSync(readmePath, readme);
3367
3332
  }
3368
3333
  return { success: true, message: `Library initialized at ${targetPath}` };
3369
3334
  } catch (error) {
@@ -3372,12 +3337,12 @@ Content from babylonjsmarket.com will be downloaded here automatically.
3372
3337
  }
3373
3338
  function getGameModeSchema(modeName) {
3374
3339
  const libraryPath = getLibraryPath();
3375
- const schemaPath = path4.join(libraryPath, "GameModes", modeName, "gamemode.json");
3376
- if (!fs4.existsSync(schemaPath)) {
3340
+ const schemaPath = path3.join(libraryPath, "GameModes", modeName, "gamemode.json");
3341
+ if (!fs3.existsSync(schemaPath)) {
3377
3342
  return null;
3378
3343
  }
3379
3344
  try {
3380
- const content = fs4.readFileSync(schemaPath, "utf-8");
3345
+ const content = fs3.readFileSync(schemaPath, "utf-8");
3381
3346
  return JSON.parse(content);
3382
3347
  } catch {
3383
3348
  return null;
@@ -3444,45 +3409,45 @@ var COMPONENT_CATALOG = [
3444
3409
  ];
3445
3410
  async function installComponent(componentName, targetProjectPath) {
3446
3411
  const libraryPath = getLibraryPath();
3447
- const componentDir = path4.join(libraryPath, "Components", componentName);
3448
- const componentFile = path4.join(componentDir, `${componentName}.ts`);
3412
+ const componentDir = path3.join(libraryPath, "Components", componentName);
3413
+ const componentFile = path3.join(componentDir, `${componentName}.ts`);
3449
3414
  const files = [];
3450
- if (!fs4.existsSync(componentFile)) {
3451
- const legacyPath = path4.join(libraryPath, "Components", `${componentName}.ts`);
3452
- if (fs4.existsSync(legacyPath)) {
3453
- const targetComponentDir2 = path4.join(targetProjectPath, "src", "Components");
3454
- if (!fs4.existsSync(targetComponentDir2)) {
3455
- fs4.mkdirSync(targetComponentDir2, { recursive: true });
3456
- }
3457
- const targetComponentPath2 = path4.join(targetComponentDir2, `${componentName}.ts`);
3458
- if (fs4.existsSync(targetComponentPath2)) {
3415
+ if (!fs3.existsSync(componentFile)) {
3416
+ const legacyPath = path3.join(libraryPath, "Components", `${componentName}.ts`);
3417
+ if (fs3.existsSync(legacyPath)) {
3418
+ const targetComponentDir2 = path3.join(targetProjectPath, "src", "Components");
3419
+ if (!fs3.existsSync(targetComponentDir2)) {
3420
+ fs3.mkdirSync(targetComponentDir2, { recursive: true });
3421
+ }
3422
+ const targetComponentPath2 = path3.join(targetComponentDir2, `${componentName}.ts`);
3423
+ if (fs3.existsSync(targetComponentPath2)) {
3459
3424
  return { success: false, message: `${componentName}.ts already exists`, files };
3460
3425
  }
3461
- fs4.copyFileSync(legacyPath, targetComponentPath2);
3426
+ fs3.copyFileSync(legacyPath, targetComponentPath2);
3462
3427
  files.push(`src/Components/${componentName}.ts`);
3463
3428
  return { success: true, message: `Installed ${componentName} (${files.length} files)`, files };
3464
3429
  }
3465
3430
  return { success: false, message: `Component ${componentName} not found in Library`, files };
3466
3431
  }
3467
- const targetComponentDir = path4.join(targetProjectPath, "src", "Components");
3468
- if (!fs4.existsSync(targetComponentDir)) {
3469
- fs4.mkdirSync(targetComponentDir, { recursive: true });
3432
+ const targetComponentDir = path3.join(targetProjectPath, "src", "Components");
3433
+ if (!fs3.existsSync(targetComponentDir)) {
3434
+ fs3.mkdirSync(targetComponentDir, { recursive: true });
3470
3435
  }
3471
- const targetComponentPath = path4.join(targetComponentDir, `${componentName}.ts`);
3472
- if (fs4.existsSync(targetComponentPath)) {
3436
+ const targetComponentPath = path3.join(targetComponentDir, `${componentName}.ts`);
3437
+ if (fs3.existsSync(targetComponentPath)) {
3473
3438
  return { success: false, message: `${componentName}.ts already exists`, files };
3474
3439
  }
3475
- fs4.copyFileSync(componentFile, targetComponentPath);
3440
+ fs3.copyFileSync(componentFile, targetComponentPath);
3476
3441
  files.push(`src/Components/${componentName}.ts`);
3477
- const testPath = path4.join(componentDir, `${componentName}.test.ts`);
3478
- if (fs4.existsSync(testPath)) {
3479
- const targetTestDir = path4.join(targetProjectPath, "tests", "Components");
3480
- if (!fs4.existsSync(targetTestDir)) {
3481
- fs4.mkdirSync(targetTestDir, { recursive: true });
3482
- }
3483
- const targetTestPath = path4.join(targetTestDir, `${componentName}.test.ts`);
3484
- if (!fs4.existsSync(targetTestPath)) {
3485
- fs4.copyFileSync(testPath, targetTestPath);
3442
+ const testPath = path3.join(componentDir, `${componentName}.test.ts`);
3443
+ if (fs3.existsSync(testPath)) {
3444
+ const targetTestDir = path3.join(targetProjectPath, "tests", "Components");
3445
+ if (!fs3.existsSync(targetTestDir)) {
3446
+ fs3.mkdirSync(targetTestDir, { recursive: true });
3447
+ }
3448
+ const targetTestPath = path3.join(targetTestDir, `${componentName}.test.ts`);
3449
+ if (!fs3.existsSync(targetTestPath)) {
3450
+ fs3.copyFileSync(testPath, targetTestPath);
3486
3451
  files.push(`tests/Components/${componentName}.test.ts`);
3487
3452
  }
3488
3453
  }
@@ -3494,26 +3459,26 @@ async function installComponent(componentName, targetProjectPath) {
3494
3459
  }
3495
3460
  function getAvailableComponents(targetProjectPath) {
3496
3461
  const libraryPath = getLibraryPath();
3497
- const libraryComponentsDir = path4.join(libraryPath, "Components");
3498
- const targetComponentDir = path4.join(targetProjectPath, "src", "Components");
3462
+ const libraryComponentsDir = path3.join(libraryPath, "Components");
3463
+ const targetComponentDir = path3.join(targetProjectPath, "src", "Components");
3499
3464
  const installedComponents = /* @__PURE__ */ new Set();
3500
3465
  const availableComponents = [];
3501
- if (fs4.existsSync(targetComponentDir)) {
3502
- const files = fs4.readdirSync(targetComponentDir);
3466
+ if (fs3.existsSync(targetComponentDir)) {
3467
+ const files = fs3.readdirSync(targetComponentDir);
3503
3468
  for (const file of files) {
3504
3469
  if (file.endsWith(".ts")) {
3505
3470
  installedComponents.add(file.replace(".ts", ""));
3506
3471
  }
3507
3472
  }
3508
3473
  }
3509
- if (fs4.existsSync(libraryComponentsDir)) {
3510
- const entries = fs4.readdirSync(libraryComponentsDir, { withFileTypes: true });
3474
+ if (fs3.existsSync(libraryComponentsDir)) {
3475
+ const entries = fs3.readdirSync(libraryComponentsDir, { withFileTypes: true });
3511
3476
  for (const entry of entries) {
3512
3477
  let name;
3513
3478
  if (entry.isDirectory()) {
3514
3479
  name = entry.name;
3515
- const mainFile = path4.join(libraryComponentsDir, name, `${name}.ts`);
3516
- if (!fs4.existsSync(mainFile)) {
3480
+ const mainFile = path3.join(libraryComponentsDir, name, `${name}.ts`);
3481
+ if (!fs3.existsSync(mainFile)) {
3517
3482
  continue;
3518
3483
  }
3519
3484
  } else if (entry.isFile() && entry.name.endsWith(".ts")) {
@@ -3536,13 +3501,13 @@ function getAvailableComponents(targetProjectPath) {
3536
3501
  }
3537
3502
  function getGameModeCatalog() {
3538
3503
  const libraryPath = getLibraryPath();
3539
- const gameModesDir = path4.join(libraryPath, "GameModes");
3504
+ const gameModesDir = path3.join(libraryPath, "GameModes");
3540
3505
  const modes = [];
3541
- if (!fs4.existsSync(gameModesDir)) {
3506
+ if (!fs3.existsSync(gameModesDir)) {
3542
3507
  return modes;
3543
3508
  }
3544
3509
  try {
3545
- const dirs = fs4.readdirSync(gameModesDir, { withFileTypes: true });
3510
+ const dirs = fs3.readdirSync(gameModesDir, { withFileTypes: true });
3546
3511
  for (const dir of dirs) {
3547
3512
  if (!dir.isDirectory()) continue;
3548
3513
  const schema = getGameModeSchema(dir.name);
@@ -3555,13 +3520,13 @@ function getGameModeCatalog() {
3555
3520
  hasShared: schema.includeShared || false
3556
3521
  });
3557
3522
  } else {
3558
- const modePath = path4.join(gameModesDir, dir.name);
3523
+ const modePath = path3.join(gameModesDir, dir.name);
3559
3524
  modes.push({
3560
3525
  name: dir.name,
3561
3526
  description: `${dir.name} game mode`,
3562
- hasScenes: fs4.existsSync(path4.join(modePath, "Scenes")),
3563
- hasScreens: fs4.existsSync(path4.join(modePath, "Screens")),
3564
- hasShared: fs4.existsSync(path4.join(modePath, "Data"))
3527
+ hasScenes: fs3.existsSync(path3.join(modePath, "Scenes")),
3528
+ hasScreens: fs3.existsSync(path3.join(modePath, "Screens")),
3529
+ hasShared: fs3.existsSync(path3.join(modePath, "Data"))
3565
3530
  });
3566
3531
  }
3567
3532
  }
@@ -3570,12 +3535,12 @@ function getGameModeCatalog() {
3570
3535
  return modes;
3571
3536
  }
3572
3537
  function getAvailableGameModes(targetProjectPath) {
3573
- const targetDataDir = path4.join(targetProjectPath, "data");
3538
+ const targetDataDir = path3.join(targetProjectPath, "data");
3574
3539
  const installedModes = /* @__PURE__ */ new Set();
3575
- if (fs4.existsSync(targetDataDir)) {
3576
- const dirs = fs4.readdirSync(targetDataDir);
3540
+ if (fs3.existsSync(targetDataDir)) {
3541
+ const dirs = fs3.readdirSync(targetDataDir);
3577
3542
  for (const dir of dirs) {
3578
- const stat = fs4.statSync(path4.join(targetDataDir, dir));
3543
+ const stat = fs3.statSync(path3.join(targetDataDir, dir));
3579
3544
  if (stat.isDirectory()) {
3580
3545
  installedModes.add(dir);
3581
3546
  }
@@ -3584,12 +3549,12 @@ function getAvailableGameModes(targetProjectPath) {
3584
3549
  return getGameModeCatalog().filter((m) => !installedModes.has(m.name));
3585
3550
  }
3586
3551
  function getInstalledGameModes(targetProjectPath) {
3587
- const targetDataDir = path4.join(targetProjectPath, "data");
3552
+ const targetDataDir = path3.join(targetProjectPath, "data");
3588
3553
  const modes = [];
3589
- if (fs4.existsSync(targetDataDir)) {
3590
- const dirs = fs4.readdirSync(targetDataDir);
3554
+ if (fs3.existsSync(targetDataDir)) {
3555
+ const dirs = fs3.readdirSync(targetDataDir);
3591
3556
  for (const dir of dirs) {
3592
- const stat = fs4.statSync(path4.join(targetDataDir, dir));
3557
+ const stat = fs3.statSync(path3.join(targetDataDir, dir));
3593
3558
  if (stat.isDirectory() && dir !== "Shared") {
3594
3559
  modes.push(dir);
3595
3560
  }
@@ -3598,29 +3563,29 @@ function getInstalledGameModes(targetProjectPath) {
3598
3563
  return modes;
3599
3564
  }
3600
3565
  function copyDir(src, dest, files, baseRelPath) {
3601
- fs4.mkdirSync(dest, { recursive: true });
3602
- const entries = fs4.readdirSync(src, { withFileTypes: true });
3566
+ fs3.mkdirSync(dest, { recursive: true });
3567
+ const entries = fs3.readdirSync(src, { withFileTypes: true });
3603
3568
  for (const entry of entries) {
3604
- const srcPath = path4.join(src, entry.name);
3605
- const destPath = path4.join(dest, entry.name);
3606
- const relPath = path4.join(baseRelPath, entry.name);
3569
+ const srcPath = path3.join(src, entry.name);
3570
+ const destPath = path3.join(dest, entry.name);
3571
+ const relPath = path3.join(baseRelPath, entry.name);
3607
3572
  if (entry.isDirectory()) {
3608
3573
  copyDir(srcPath, destPath, files, relPath);
3609
3574
  } else if (entry.name !== "gamemode.json") {
3610
- fs4.copyFileSync(srcPath, destPath);
3575
+ fs3.copyFileSync(srcPath, destPath);
3611
3576
  files.push(relPath);
3612
3577
  }
3613
3578
  }
3614
3579
  }
3615
3580
  async function installGameMode(modeName, targetProjectPath) {
3616
3581
  const libraryPath = getLibraryPath();
3617
- const gameModeDir = path4.join(libraryPath, "GameModes", modeName);
3582
+ const gameModeDir = path3.join(libraryPath, "GameModes", modeName);
3618
3583
  const files = [];
3619
- if (!fs4.existsSync(gameModeDir)) {
3584
+ if (!fs3.existsSync(gameModeDir)) {
3620
3585
  return { success: false, message: `Game mode ${modeName} not found in Library`, files };
3621
3586
  }
3622
- const targetDataDir = path4.join(targetProjectPath, "data", modeName);
3623
- if (fs4.existsSync(targetDataDir)) {
3587
+ const targetDataDir = path3.join(targetProjectPath, "data", modeName);
3588
+ if (fs3.existsSync(targetDataDir)) {
3624
3589
  return { success: false, message: `${modeName} already exists`, files };
3625
3590
  }
3626
3591
  const schema = getGameModeSchema(modeName);
@@ -3634,34 +3599,34 @@ async function installGameMode(modeName, targetProjectPath) {
3634
3599
  }
3635
3600
  if (schema.systems) {
3636
3601
  for (const sysName of schema.systems) {
3637
- const sysPath = path4.join(libraryPath, "Systems", `${sysName}.ts`);
3638
- if (fs4.existsSync(sysPath)) {
3639
- const targetSysDir = path4.join(targetProjectPath, "src", "Systems");
3640
- if (!fs4.existsSync(targetSysDir)) {
3641
- fs4.mkdirSync(targetSysDir, { recursive: true });
3602
+ const sysPath = path3.join(libraryPath, "Systems", `${sysName}.ts`);
3603
+ if (fs3.existsSync(sysPath)) {
3604
+ const targetSysDir = path3.join(targetProjectPath, "src", "Systems");
3605
+ if (!fs3.existsSync(targetSysDir)) {
3606
+ fs3.mkdirSync(targetSysDir, { recursive: true });
3642
3607
  }
3643
- const targetSysPath = path4.join(targetSysDir, `${sysName}.ts`);
3644
- if (!fs4.existsSync(targetSysPath)) {
3645
- fs4.copyFileSync(sysPath, targetSysPath);
3608
+ const targetSysPath = path3.join(targetSysDir, `${sysName}.ts`);
3609
+ if (!fs3.existsSync(targetSysPath)) {
3610
+ fs3.copyFileSync(sysPath, targetSysPath);
3646
3611
  files.push(`src/Systems/${sysName}.ts`);
3647
3612
  }
3648
3613
  }
3649
3614
  }
3650
3615
  }
3651
- fs4.mkdirSync(targetDataDir, { recursive: true });
3652
- const modeDataDir = path4.join(gameModeDir, "Data");
3653
- if (fs4.existsSync(modeDataDir)) {
3654
- const targetSharedDir = path4.join(targetDataDir, "Shared");
3616
+ fs3.mkdirSync(targetDataDir, { recursive: true });
3617
+ const modeDataDir = path3.join(gameModeDir, "Data");
3618
+ if (fs3.existsSync(modeDataDir)) {
3619
+ const targetSharedDir = path3.join(targetDataDir, "Shared");
3655
3620
  copyDir(modeDataDir, targetSharedDir, files, `data/${modeName}/Shared`);
3656
3621
  }
3657
- const modeScenesDir = path4.join(gameModeDir, "Scenes");
3658
- if (fs4.existsSync(modeScenesDir)) {
3659
- const targetScenesDir = path4.join(targetDataDir, "Scenes");
3622
+ const modeScenesDir = path3.join(gameModeDir, "Scenes");
3623
+ if (fs3.existsSync(modeScenesDir)) {
3624
+ const targetScenesDir = path3.join(targetDataDir, "Scenes");
3660
3625
  copyDir(modeScenesDir, targetScenesDir, files, `data/${modeName}/Scenes`);
3661
3626
  }
3662
- const modeScreensDir = path4.join(gameModeDir, "Screens");
3663
- if (fs4.existsSync(modeScreensDir)) {
3664
- const targetScreensDir = path4.join(targetDataDir, "Screens");
3627
+ const modeScreensDir = path3.join(gameModeDir, "Screens");
3628
+ if (fs3.existsSync(modeScreensDir)) {
3629
+ const targetScreensDir = path3.join(targetDataDir, "Screens");
3665
3630
  copyDir(modeScreensDir, targetScreensDir, files, `data/${modeName}/Screens`);
3666
3631
  }
3667
3632
  } else {
@@ -3678,18 +3643,18 @@ async function installGameMode(modeName, targetProjectPath) {
3678
3643
  }
3679
3644
  function getProjectScenes(targetProjectPath) {
3680
3645
  const scenes = [];
3681
- const dataDir = path4.join(targetProjectPath, "data");
3682
- if (!fs4.existsSync(dataDir)) return scenes;
3683
- const modes = fs4.readdirSync(dataDir);
3646
+ const dataDir = path3.join(targetProjectPath, "data");
3647
+ if (!fs3.existsSync(dataDir)) return scenes;
3648
+ const modes = fs3.readdirSync(dataDir);
3684
3649
  for (const mode of modes) {
3685
- const scenesDir = path4.join(dataDir, mode, "Scenes");
3686
- if (fs4.existsSync(scenesDir)) {
3687
- const sceneFiles = fs4.readdirSync(scenesDir);
3650
+ const scenesDir = path3.join(dataDir, mode, "Scenes");
3651
+ if (fs3.existsSync(scenesDir)) {
3652
+ const sceneFiles = fs3.readdirSync(scenesDir);
3688
3653
  for (const file of sceneFiles) {
3689
3654
  if (file.endsWith(".ts")) {
3690
3655
  scenes.push({
3691
3656
  name: file.replace(".ts", ""),
3692
- path: path4.join(scenesDir, file),
3657
+ path: path3.join(scenesDir, file),
3693
3658
  gameMode: mode
3694
3659
  });
3695
3660
  }
@@ -3699,12 +3664,12 @@ function getProjectScenes(targetProjectPath) {
3699
3664
  return scenes;
3700
3665
  }
3701
3666
  async function createScene(targetProjectPath, gameMode, sceneName) {
3702
- const scenesDir = path4.join(targetProjectPath, "data", gameMode, "Scenes");
3703
- if (!fs4.existsSync(scenesDir)) {
3704
- fs4.mkdirSync(scenesDir, { recursive: true });
3667
+ const scenesDir = path3.join(targetProjectPath, "data", gameMode, "Scenes");
3668
+ if (!fs3.existsSync(scenesDir)) {
3669
+ fs3.mkdirSync(scenesDir, { recursive: true });
3705
3670
  }
3706
- const scenePath = path4.join(scenesDir, `${sceneName}.ts`);
3707
- if (fs4.existsSync(scenePath)) {
3671
+ const scenePath = path3.join(scenesDir, `${sceneName}.ts`);
3672
+ if (fs3.existsSync(scenePath)) {
3708
3673
  return { success: false, message: `Scene ${sceneName} already exists`, path: "" };
3709
3674
  }
3710
3675
  const template = `import Basics from "../../Shared/Basics";
@@ -3734,7 +3699,7 @@ export default {
3734
3699
  };
3735
3700
  `;
3736
3701
  try {
3737
- fs4.writeFileSync(scenePath, template);
3702
+ fs3.writeFileSync(scenePath, template);
3738
3703
  return {
3739
3704
  success: true,
3740
3705
  message: `Created scene ${sceneName}`,
@@ -3755,46 +3720,46 @@ async function migrateFromArcadeRef() {
3755
3720
  }
3756
3721
  }
3757
3722
  try {
3758
- const srcComponents = path4.join(ARCADE_REF_PATH, "src", "Components");
3759
- if (fs4.existsSync(srcComponents)) {
3760
- const targetComponents = path4.join(libraryPath, "Components");
3761
- const componentFiles2 = fs4.readdirSync(srcComponents);
3723
+ const srcComponents = path3.join(ARCADE_REF_PATH, "src", "Components");
3724
+ if (fs3.existsSync(srcComponents)) {
3725
+ const targetComponents = path3.join(libraryPath, "Components");
3726
+ const componentFiles2 = fs3.readdirSync(srcComponents);
3762
3727
  for (const file of componentFiles2) {
3763
3728
  if (file.endsWith(".ts")) {
3764
- const srcPath = path4.join(srcComponents, file);
3765
- const destPath = path4.join(targetComponents, file);
3766
- if (!fs4.existsSync(destPath)) {
3767
- fs4.copyFileSync(srcPath, destPath);
3729
+ const srcPath = path3.join(srcComponents, file);
3730
+ const destPath = path3.join(targetComponents, file);
3731
+ if (!fs3.existsSync(destPath)) {
3732
+ fs3.copyFileSync(srcPath, destPath);
3768
3733
  files.push(`Components/${file}`);
3769
3734
  }
3770
3735
  }
3771
3736
  }
3772
3737
  }
3773
- const srcTests = path4.join(ARCADE_REF_PATH, "tests", "Components");
3774
- if (fs4.existsSync(srcTests)) {
3775
- const targetTests = path4.join(libraryPath, "Tests");
3776
- const testFiles = fs4.readdirSync(srcTests);
3738
+ const srcTests = path3.join(ARCADE_REF_PATH, "tests", "Components");
3739
+ if (fs3.existsSync(srcTests)) {
3740
+ const targetTests = path3.join(libraryPath, "Tests");
3741
+ const testFiles = fs3.readdirSync(srcTests);
3777
3742
  for (const file of testFiles) {
3778
3743
  if (file.endsWith(".test.ts")) {
3779
- const srcPath = path4.join(srcTests, file);
3780
- const destPath = path4.join(targetTests, file);
3781
- if (!fs4.existsSync(destPath)) {
3782
- fs4.copyFileSync(srcPath, destPath);
3744
+ const srcPath = path3.join(srcTests, file);
3745
+ const destPath = path3.join(targetTests, file);
3746
+ if (!fs3.existsSync(destPath)) {
3747
+ fs3.copyFileSync(srcPath, destPath);
3783
3748
  files.push(`Tests/${file}`);
3784
3749
  }
3785
3750
  }
3786
3751
  }
3787
3752
  }
3788
- const srcData = path4.join(ARCADE_REF_PATH, "data", "Shared");
3789
- if (fs4.existsSync(srcData)) {
3790
- const targetData = path4.join(libraryPath, "Data");
3791
- const dataFiles = fs4.readdirSync(srcData);
3753
+ const srcData = path3.join(ARCADE_REF_PATH, "data", "Shared");
3754
+ if (fs3.existsSync(srcData)) {
3755
+ const targetData = path3.join(libraryPath, "Data");
3756
+ const dataFiles = fs3.readdirSync(srcData);
3792
3757
  for (const file of dataFiles) {
3793
3758
  if (file.endsWith(".ts")) {
3794
- const srcPath = path4.join(srcData, file);
3795
- const destPath = path4.join(targetData, file);
3796
- if (!fs4.existsSync(destPath)) {
3797
- fs4.copyFileSync(srcPath, destPath);
3759
+ const srcPath = path3.join(srcData, file);
3760
+ const destPath = path3.join(targetData, file);
3761
+ if (!fs3.existsSync(destPath)) {
3762
+ fs3.copyFileSync(srcPath, destPath);
3798
3763
  files.push(`Data/${file}`);
3799
3764
  }
3800
3765
  }
@@ -3802,24 +3767,24 @@ async function migrateFromArcadeRef() {
3802
3767
  }
3803
3768
  const gameModes = ["ThirdPerson", "Arcade"];
3804
3769
  for (const mode of gameModes) {
3805
- const srcMode = path4.join(ARCADE_REF_PATH, "data", mode);
3806
- if (fs4.existsSync(srcMode)) {
3807
- const targetMode = path4.join(libraryPath, "GameModes", mode);
3808
- if (!fs4.existsSync(targetMode)) {
3809
- fs4.mkdirSync(targetMode, { recursive: true });
3770
+ const srcMode = path3.join(ARCADE_REF_PATH, "data", mode);
3771
+ if (fs3.existsSync(srcMode)) {
3772
+ const targetMode = path3.join(libraryPath, "GameModes", mode);
3773
+ if (!fs3.existsSync(targetMode)) {
3774
+ fs3.mkdirSync(targetMode, { recursive: true });
3810
3775
  const subdirs = ["Scenes", "Screens", "Shared"];
3811
3776
  for (const subdir of subdirs) {
3812
- const srcSubdir = path4.join(srcMode, subdir);
3813
- if (fs4.existsSync(srcSubdir)) {
3814
- const targetSubdir = subdir === "Shared" ? path4.join(targetMode, "Data") : path4.join(targetMode, subdir);
3815
- fs4.mkdirSync(targetSubdir, { recursive: true });
3816
- const subFiles = fs4.readdirSync(srcSubdir);
3777
+ const srcSubdir = path3.join(srcMode, subdir);
3778
+ if (fs3.existsSync(srcSubdir)) {
3779
+ const targetSubdir = subdir === "Shared" ? path3.join(targetMode, "Data") : path3.join(targetMode, subdir);
3780
+ fs3.mkdirSync(targetSubdir, { recursive: true });
3781
+ const subFiles = fs3.readdirSync(srcSubdir);
3817
3782
  for (const file of subFiles) {
3818
- const srcPath = path4.join(srcSubdir, file);
3819
- const destPath = path4.join(targetSubdir, file);
3820
- const stat = fs4.statSync(srcPath);
3783
+ const srcPath = path3.join(srcSubdir, file);
3784
+ const destPath = path3.join(targetSubdir, file);
3785
+ const stat = fs3.statSync(srcPath);
3821
3786
  if (stat.isFile()) {
3822
- fs4.copyFileSync(srcPath, destPath);
3787
+ fs3.copyFileSync(srcPath, destPath);
3823
3788
  files.push(`GameModes/${mode}/${subdir === "Shared" ? "Data" : subdir}/${file}`);
3824
3789
  }
3825
3790
  }
@@ -3831,11 +3796,11 @@ async function migrateFromArcadeRef() {
3831
3796
  components: mode === "ThirdPerson" ? ["Movement", "FollowCamera", "PlayerInput", "Animation", "Physics", "KeyboardTiming"] : ["Movement", "SimpleCamera", "PlayerInput", "SimplePhysics"],
3832
3797
  data: ["Light", "Basics"],
3833
3798
  includeShared: true,
3834
- scenes: fs4.existsSync(path4.join(srcMode, "Scenes")) ? fs4.readdirSync(path4.join(srcMode, "Scenes")).filter((f) => f.endsWith(".ts")) : [],
3835
- screens: fs4.existsSync(path4.join(srcMode, "Screens")) ? fs4.readdirSync(path4.join(srcMode, "Screens")).filter((f) => f.endsWith(".ts")) : []
3799
+ scenes: fs3.existsSync(path3.join(srcMode, "Scenes")) ? fs3.readdirSync(path3.join(srcMode, "Scenes")).filter((f) => f.endsWith(".ts")) : [],
3800
+ screens: fs3.existsSync(path3.join(srcMode, "Screens")) ? fs3.readdirSync(path3.join(srcMode, "Screens")).filter((f) => f.endsWith(".ts")) : []
3836
3801
  };
3837
- fs4.writeFileSync(
3838
- path4.join(targetMode, "gamemode.json"),
3802
+ fs3.writeFileSync(
3803
+ path3.join(targetMode, "gamemode.json"),
3839
3804
  JSON.stringify(schema, null, 2)
3840
3805
  );
3841
3806
  files.push(`GameModes/${mode}/gamemode.json`);
@@ -3985,12 +3950,12 @@ async function syncLibrary(onProgress) {
3985
3950
  componentSuccess = false;
3986
3951
  continue;
3987
3952
  }
3988
- const fullPath = path4.join(libraryPath, filePath);
3989
- const dir = path4.dirname(fullPath);
3990
- if (!fs4.existsSync(dir)) {
3991
- fs4.mkdirSync(dir, { recursive: true });
3953
+ const fullPath = path3.join(libraryPath, filePath);
3954
+ const dir = path3.dirname(fullPath);
3955
+ if (!fs3.existsSync(dir)) {
3956
+ fs3.mkdirSync(dir, { recursive: true });
3992
3957
  }
3993
- fs4.writeFileSync(fullPath, result.content);
3958
+ fs3.writeFileSync(fullPath, result.content);
3994
3959
  }
3995
3960
  if (componentSuccess) {
3996
3961
  auth.updateLibraryFile(component.path, component.version);
@@ -5263,7 +5228,7 @@ var bbsCommand = new Command5("bbs").description("BabylonJS Market BBS - Browse
5263
5228
  fatalError(reason instanceof Error ? reason : new Error(String(reason)), "Unhandled Promise Rejection");
5264
5229
  });
5265
5230
  const authManager = new AuthManager();
5266
- const downloadDirectory = options.saveTo ? path5.resolve(options.saveTo) : process2.cwd();
5231
+ const downloadDirectory = options.saveTo ? path4.resolve(options.saveTo) : process2.cwd();
5267
5232
  const savedPrefs = authManager.getPreferences();
5268
5233
  if (savedPrefs && savedPrefs.theme && THEMES.includes(savedPrefs.theme)) {
5269
5234
  options.theme = savedPrefs.theme;
@@ -5410,7 +5375,7 @@ var bbsCommand = new Command5("bbs").description("BabylonJS Market BBS - Browse
5410
5375
  }
5411
5376
  const user = authManager.getUser();
5412
5377
  try {
5413
- fs5.appendFileSync("/tmp/bbs-debug.log", `${(/* @__PURE__ */ new Date()).toISOString()} BBS starting - animations: ${options.animations}
5378
+ fs4.appendFileSync("/tmp/bbs-debug.log", `${(/* @__PURE__ */ new Date()).toISOString()} BBS starting - animations: ${options.animations}
5414
5379
  `);
5415
5380
  if (options.animations) {
5416
5381
  await bbs.showLoadingAnimation("Dialing BabylonJS Market BBS...", 1500);
@@ -5421,12 +5386,12 @@ var bbsCommand = new Command5("bbs").description("BabylonJS Market BBS - Browse
5421
5386
  backBuffer.draw({ dst: screenBuffer });
5422
5387
  screenBuffer.draw({ delta: true });
5423
5388
  }
5424
- fs5.appendFileSync("/tmp/bbs-debug.log", `${(/* @__PURE__ */ new Date()).toISOString()} Fetching courses from ${API_URL}
5389
+ fs4.appendFileSync("/tmp/bbs-debug.log", `${(/* @__PURE__ */ new Date()).toISOString()} Fetching courses from ${API_URL}
5425
5390
  `);
5426
5391
  let allCoursesResponse;
5427
5392
  try {
5428
5393
  allCoursesResponse = await authManager.makeAuthenticatedRequest(`${API_URL}/api/auth/courses/all`);
5429
- fs5.appendFileSync("/tmp/bbs-debug.log", `${(/* @__PURE__ */ new Date()).toISOString()} Courses fetched OK
5394
+ fs4.appendFileSync("/tmp/bbs-debug.log", `${(/* @__PURE__ */ new Date()).toISOString()} Courses fetched OK
5430
5395
  `);
5431
5396
  } catch (fetchError) {
5432
5397
  throw new Error(`Network error: ${fetchError.message}`);
@@ -5449,7 +5414,7 @@ var bbsCommand = new Command5("bbs").description("BabylonJS Market BBS - Browse
5449
5414
  }
5450
5415
  let scannedProjects = [];
5451
5416
  const configuredProjectsDir = authManager.getProjectsDirectory();
5452
- if (configuredProjectsDir && fs5.existsSync(configuredProjectsDir)) {
5417
+ if (configuredProjectsDir && fs4.existsSync(configuredProjectsDir)) {
5453
5418
  try {
5454
5419
  const scanPromise = scanForProjects(configuredProjectsDir, 2);
5455
5420
  const timeoutPromise = new Promise(
@@ -5491,7 +5456,7 @@ var bbsCommand = new Command5("bbs").description("BabylonJS Market BBS - Browse
5491
5456
  term[color](msg);
5492
5457
  };
5493
5458
  const debugLog = (msg) => {
5494
- fs5.appendFileSync("/tmp/bbs-debug.log", `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
5459
+ fs4.appendFileSync("/tmp/bbs-debug.log", `${(/* @__PURE__ */ new Date()).toISOString()} ${msg}
5495
5460
  `);
5496
5461
  };
5497
5462
  const buildRenderContext = () => {
@@ -5620,10 +5585,10 @@ var bbsCommand = new Command5("bbs").description("BabylonJS Market BBS - Browse
5620
5585
  assetKey = toy.assetKey || toy.name.toLowerCase().replace(/\s+/g, "-");
5621
5586
  fileName = assetKey + ".glb";
5622
5587
  }
5623
- const outputPath = path5.join(downloadDirectory, fileName);
5588
+ const outputPath = path4.join(downloadDirectory, fileName);
5624
5589
  try {
5625
- if (!fs5.existsSync(downloadDirectory)) {
5626
- fs5.mkdirSync(downloadDirectory, { recursive: true });
5590
+ if (!fs4.existsSync(downloadDirectory)) {
5591
+ fs4.mkdirSync(downloadDirectory, { recursive: true });
5627
5592
  }
5628
5593
  showStatus(`Downloading ${name}...`, "yellow");
5629
5594
  const success = await assetDownloader.downloadAsset(
@@ -5651,19 +5616,19 @@ var bbsCommand = new Command5("bbs").description("BabylonJS Market BBS - Browse
5651
5616
  if (!input || input.trim() === "") {
5652
5617
  return homedir2() + "/";
5653
5618
  }
5654
- const dir = path5.dirname(input);
5655
- const base = path5.basename(input);
5656
- if (dir && fs5.existsSync(dir)) {
5657
- const entries = fs5.readdirSync(dir);
5619
+ const dir = path4.dirname(input);
5620
+ const base = path4.basename(input);
5621
+ if (dir && fs4.existsSync(dir)) {
5622
+ const entries = fs4.readdirSync(dir);
5658
5623
  const matches = entries.filter((e) => e.toLowerCase().startsWith(base.toLowerCase())).filter((e) => {
5659
5624
  try {
5660
- return fs5.statSync(path5.join(dir, e)).isDirectory();
5625
+ return fs4.statSync(path4.join(dir, e)).isDirectory();
5661
5626
  } catch {
5662
5627
  return false;
5663
5628
  }
5664
5629
  });
5665
5630
  if (matches.length === 1) {
5666
- return path5.join(dir, matches[0]) + "/";
5631
+ return path4.join(dir, matches[0]) + "/";
5667
5632
  } else if (matches.length > 1) {
5668
5633
  const commonPrefix = matches.reduce((prefix, match) => {
5669
5634
  let i = 0;
@@ -5673,7 +5638,7 @@ var bbsCommand = new Command5("bbs").description("BabylonJS Market BBS - Browse
5673
5638
  return match.slice(0, i);
5674
5639
  });
5675
5640
  if (commonPrefix.length > base.length) {
5676
- return path5.join(dir, commonPrefix);
5641
+ return path4.join(dir, commonPrefix);
5677
5642
  }
5678
5643
  }
5679
5644
  } else if (input.startsWith("~")) {
@@ -5687,8 +5652,8 @@ var bbsCommand = new Command5("bbs").description("BabylonJS Market BBS - Browse
5687
5652
  switch (effect.type) {
5688
5653
  case "CommitProjectsDir": {
5689
5654
  if (state.projectsDirInput.trim()) {
5690
- const resolvedPath = path5.resolve(state.projectsDirInput.trim());
5691
- if (fs5.existsSync(resolvedPath)) {
5655
+ const resolvedPath = path4.resolve(state.projectsDirInput.trim());
5656
+ if (fs4.existsSync(resolvedPath)) {
5692
5657
  authManager.setProjectsDirectory(resolvedPath);
5693
5658
  dispatch({ type: "SetProjectsDirResult", success: "\u2713 Saved! Scanning..." });
5694
5659
  await render();
@@ -5715,9 +5680,9 @@ var bbsCommand = new Command5("bbs").description("BabylonJS Market BBS - Browse
5715
5680
  break;
5716
5681
  case "CommitLibraryPath": {
5717
5682
  if (state.libraryPathInput.trim()) {
5718
- const resolvedPath = path5.resolve(state.libraryPathInput.trim());
5683
+ const resolvedPath = path4.resolve(state.libraryPathInput.trim());
5719
5684
  authManager.setLibraryPath(resolvedPath);
5720
- if (!fs5.existsSync(path5.join(resolvedPath, "Components"))) {
5685
+ if (!fs4.existsSync(path4.join(resolvedPath, "Components"))) {
5721
5686
  const result = await initializeLibrary(resolvedPath);
5722
5687
  state = { ...state, libraryPathSuccess: result.success ? "\u2713 Library initialized!" : result.message };
5723
5688
  } else {
@@ -5984,7 +5949,7 @@ var bbsCommand = new Command5("bbs").description("BabylonJS Market BBS - Browse
5984
5949
  const project = state.projects[state.projectsSelectedIndex];
5985
5950
  if (project) {
5986
5951
  const editor = process2.env.EDITOR || "code";
5987
- const editorName = path5.basename(editor);
5952
+ const editorName = path4.basename(editor);
5988
5953
  showStatus(`Opening ${project.name} in ${editorName}...`, "yellow");
5989
5954
  const { spawn } = await import("child_process");
5990
5955
  const editorProcess = spawn(editor, [project.path], { detached: true, stdio: "ignore" });
@@ -6240,8 +6205,8 @@ function getVersion() {
6240
6205
  }
6241
6206
 
6242
6207
  // src/lib/inject/engine.ts
6243
- import fs7 from "fs";
6244
- import path7 from "path";
6208
+ import fs6 from "fs";
6209
+ import path6 from "path";
6245
6210
  import mri from "mri";
6246
6211
  import colors2 from "picocolors";
6247
6212
 
@@ -6298,28 +6263,28 @@ function detectLayer(filePath, source, subjectLayer) {
6298
6263
  }
6299
6264
 
6300
6265
  // src/lib/inject/monorepo-root.ts
6301
- import fs6 from "fs";
6302
- import path6 from "path";
6266
+ import fs5 from "fs";
6267
+ import path5 from "path";
6303
6268
  import { fileURLToPath as fileURLToPath2 } from "url";
6304
6269
  function findMonorepoRoot() {
6305
- const here = path6.dirname(fileURLToPath2(import.meta.url));
6270
+ const here = path5.dirname(fileURLToPath2(import.meta.url));
6306
6271
  let dir = here;
6307
6272
  while (true) {
6308
- const pkgPath = path6.join(dir, "package.json");
6309
- if (fs6.existsSync(pkgPath)) {
6273
+ const pkgPath = path5.join(dir, "package.json");
6274
+ if (fs5.existsSync(pkgPath)) {
6310
6275
  try {
6311
- const pkg = JSON.parse(fs6.readFileSync(pkgPath, "utf8"));
6276
+ const pkg = JSON.parse(fs5.readFileSync(pkgPath, "utf8"));
6312
6277
  if (pkg.name === "babylonjs-market-monorepo") {
6313
6278
  return {
6314
6279
  root: dir,
6315
- arcadeProRoot: path6.join(dir, "packages", "arcade-pro"),
6316
- vizProRoot: path6.join(dir, "packages", "viz-pro")
6280
+ arcadeProRoot: path5.join(dir, "packages", "arcade-pro"),
6281
+ vizProRoot: path5.join(dir, "packages", "viz-pro")
6317
6282
  };
6318
6283
  }
6319
6284
  } catch {
6320
6285
  }
6321
6286
  }
6322
- const parent = path6.dirname(dir);
6287
+ const parent = path5.dirname(dir);
6323
6288
  if (parent === dir) {
6324
6289
  throw new Error(
6325
6290
  `Could not locate umbrella repo (no ancestor package.json with name "babylonjs-market-monorepo" above ${here}).`
@@ -6334,46 +6299,46 @@ var { cyan: cyan2, green, yellow, dim, bold: bold2 } = colors2;
6334
6299
  function componentFiles(dir) {
6335
6300
  const out = [];
6336
6301
  const walk = (d) => {
6337
- for (const e of fs7.readdirSync(d, { withFileTypes: true })) {
6338
- const p = path7.join(d, e.name);
6302
+ for (const e of fs6.readdirSync(d, { withFileTypes: true })) {
6303
+ const p = path6.join(d, e.name);
6339
6304
  if (e.isDirectory()) walk(p);
6340
6305
  else if (/\.(ts|tsx)$/.test(e.name)) out.push(p);
6341
6306
  }
6342
6307
  };
6343
- if (fs7.existsSync(dir)) walk(dir);
6308
+ if (fs6.existsSync(dir)) walk(dir);
6344
6309
  return out;
6345
6310
  }
6346
6311
  function allComponentFiles(dir) {
6347
6312
  const out = [];
6348
6313
  const walk = (d) => {
6349
- for (const e of fs7.readdirSync(d, { withFileTypes: true })) {
6350
- const p = path7.join(d, e.name);
6314
+ for (const e of fs6.readdirSync(d, { withFileTypes: true })) {
6315
+ const p = path6.join(d, e.name);
6351
6316
  if (e.isDirectory()) walk(p);
6352
6317
  else out.push(p);
6353
6318
  }
6354
6319
  };
6355
- if (fs7.existsSync(dir)) walk(dir);
6320
+ if (fs6.existsSync(dir)) walk(dir);
6356
6321
  return out;
6357
6322
  }
6358
6323
  function projectComponentNames(projectDir) {
6359
- const dir = path7.join(projectDir, "src", "components");
6360
- if (!fs7.existsSync(dir)) return [];
6361
- return fs7.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "_shared").map((e) => e.name);
6324
+ const dir = path6.join(projectDir, "src", "components");
6325
+ if (!fs6.existsSync(dir)) return [];
6326
+ return fs6.readdirSync(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== "_shared").map((e) => e.name);
6362
6327
  }
6363
6328
  function directDeps(name, componentsDir, allNames) {
6364
6329
  const deps = /* @__PURE__ */ new Set();
6365
- const metaPath = path7.join(componentsDir, name, "meta.json");
6366
- if (fs7.existsSync(metaPath)) {
6330
+ const metaPath = path6.join(componentsDir, name, "meta.json");
6331
+ if (fs6.existsSync(metaPath)) {
6367
6332
  try {
6368
- const meta = JSON.parse(fs7.readFileSync(metaPath, "utf8"));
6333
+ const meta = JSON.parse(fs6.readFileSync(metaPath, "utf8"));
6369
6334
  for (const d of meta.dependencies ?? []) if (allNames.has(d)) deps.add(d);
6370
6335
  } catch {
6371
6336
  }
6372
6337
  }
6373
6338
  const relRe = /['"]\.\.\/([A-Z][A-Za-z0-9_]*)\//g;
6374
6339
  const aliasRe = /['"]~\/components\/([A-Z][A-Za-z0-9_]*)\//g;
6375
- for (const file of componentFiles(path7.join(componentsDir, name))) {
6376
- const src = fs7.readFileSync(file, "utf8");
6340
+ for (const file of componentFiles(path6.join(componentsDir, name))) {
6341
+ const src = fs6.readFileSync(file, "utf8");
6377
6342
  let m;
6378
6343
  while (m = relRe.exec(src)) if (allNames.has(m[1])) deps.add(m[1]);
6379
6344
  while (m = aliasRe.exec(src)) if (allNames.has(m[1])) deps.add(m[1]);
@@ -6443,15 +6408,15 @@ function planArcadeProRegistry(existingRegistry, names, registryRelPath = "src/r
6443
6408
  return { lines, added, warnings, markerFound: true };
6444
6409
  }
6445
6410
  function patchArcadeProRegistry(arcadeProRoot, names, dryRun) {
6446
- const registryPath = path7.join(arcadeProRoot, "src", "registry.ts");
6447
- const existing = fs7.existsSync(registryPath) ? fs7.readFileSync(registryPath, "utf8") : void 0;
6411
+ const registryPath = path6.join(arcadeProRoot, "src", "registry.ts");
6412
+ const existing = fs6.existsSync(registryPath) ? fs6.readFileSync(registryPath, "utf8") : void 0;
6448
6413
  const plan = planArcadeProRegistry(existing, names);
6449
6414
  if (plan.warnings.length) return plan.warnings;
6450
6415
  if (plan.added.length && !dryRun) {
6451
6416
  const marker = /ARCADE_PRO_COMPONENT_REGISTRY:\s*Record<string,\s*LazyComponentResolver>\s*=\s*\{/;
6452
6417
  const next = existing.replace(marker, (m) => `${m}
6453
6418
  ${plan.lines.join("\n")}`);
6454
- fs7.writeFileSync(registryPath, next);
6419
+ fs6.writeFileSync(registryPath, next);
6455
6420
  }
6456
6421
  return plan.added.map((n) => ` patched registry: ${n}`);
6457
6422
  }
@@ -6469,21 +6434,21 @@ function planVizProBarrel(existingBarrel, layer, fileName) {
6469
6434
  return { line: `export * from './${fileName}';`, warnings: [] };
6470
6435
  }
6471
6436
  function patchVizProBarrel(vizProRoot, layer, fileName, dryRun) {
6472
- const barrelPath = path7.join(vizProRoot, "src", layer, "index.ts");
6473
- const existing = fs7.existsSync(barrelPath) ? fs7.readFileSync(barrelPath, "utf8") : void 0;
6437
+ const barrelPath = path6.join(vizProRoot, "src", layer, "index.ts");
6438
+ const existing = fs6.existsSync(barrelPath) ? fs6.readFileSync(barrelPath, "utf8") : void 0;
6474
6439
  const plan = planVizProBarrel(existing, layer, fileName);
6475
6440
  if (plan.warnings.length) return plan.warnings;
6476
6441
  if (plan.line === null) return [];
6477
6442
  if (!dryRun) {
6478
6443
  const next = existing.endsWith("\n") ? existing + plan.line + "\n" : existing + "\n" + plan.line + "\n";
6479
- fs7.writeFileSync(barrelPath, next);
6444
+ fs6.writeFileSync(barrelPath, next);
6480
6445
  }
6481
6446
  return [` patched ${layer}/index.ts: ${fileName}`];
6482
6447
  }
6483
6448
  function stripProjectRegistry(projectDir, names, dryRun) {
6484
- const registryPath = path7.join(projectDir, "src", "registry.ts");
6485
- if (!fs7.existsSync(registryPath)) return [];
6486
- let text = fs7.readFileSync(registryPath, "utf8");
6449
+ const registryPath = path6.join(projectDir, "src", "registry.ts");
6450
+ if (!fs6.existsSync(registryPath)) return [];
6451
+ let text = fs6.readFileSync(registryPath, "utf8");
6487
6452
  const removed = [];
6488
6453
  for (const name of names) {
6489
6454
  const re = new RegExp(
@@ -6495,7 +6460,7 @@ function stripProjectRegistry(projectDir, names, dryRun) {
6495
6460
  removed.push(name);
6496
6461
  }
6497
6462
  }
6498
- if (removed.length && !dryRun) fs7.writeFileSync(registryPath, text);
6463
+ if (removed.length && !dryRun) fs6.writeFileSync(registryPath, text);
6499
6464
  return removed;
6500
6465
  }
6501
6466
  async function inject(args, opts = {}) {
@@ -6567,12 +6532,12 @@ async function inject(args, opts = {}) {
6567
6532
  return;
6568
6533
  }
6569
6534
  }
6570
- const componentsDir = path7.join(projectDir, "src", "components");
6535
+ const componentsDir = path6.join(projectDir, "src", "components");
6571
6536
  const allProjectNames = projectComponentNames(projectDir);
6572
6537
  const seeds = [];
6573
6538
  for (const name of names) {
6574
- const sourceDir = sourceOverride ? path7.resolve(cwd, sourceOverride) : path7.join(componentsDir, name);
6575
- if (!fs7.existsSync(sourceDir)) {
6539
+ const sourceDir = sourceOverride ? path6.resolve(cwd, sourceOverride) : path6.join(componentsDir, name);
6540
+ if (!fs6.existsSync(sourceDir)) {
6576
6541
  console.error(
6577
6542
  yellow(
6578
6543
  `Could not find source for "${name}". Looked at ${sourceDir}. Use --source <path> to point at the seed explicitly.`
@@ -6587,9 +6552,9 @@ async function inject(args, opts = {}) {
6587
6552
  const closure = sourceOverride ? seedNames : resolveClosure(seedNames, componentsDir, allProjectNames);
6588
6553
  const closureFiles = [];
6589
6554
  for (const name of closure) {
6590
- const dir = sourceOverride && seedNames.has(name) ? seeds.find((s) => s.name === name).sourceDir : path7.join(componentsDir, name);
6555
+ const dir = sourceOverride && seedNames.has(name) ? seeds.find((s) => s.name === name).sourceDir : path6.join(componentsDir, name);
6591
6556
  for (const f of componentFiles(dir)) {
6592
- closureFiles.push({ path: f, source: fs7.readFileSync(f, "utf8") });
6557
+ closureFiles.push({ path: f, source: fs6.readFileSync(f, "utf8") });
6593
6558
  }
6594
6559
  }
6595
6560
  const target = explicitTarget ?? detectTarget(closureFiles);
@@ -6598,7 +6563,7 @@ async function inject(args, opts = {}) {
6598
6563
  const dir = seed.sourceDir;
6599
6564
  const files = componentFiles(dir).map((f) => ({
6600
6565
  path: f,
6601
- source: fs7.readFileSync(f, "utf8")
6566
+ source: fs6.readFileSync(f, "utf8")
6602
6567
  }));
6603
6568
  const perSeed = detectTarget(files);
6604
6569
  if (perSeed !== target) {
@@ -6616,14 +6581,14 @@ async function inject(args, opts = {}) {
6616
6581
  if (mode === "apply") {
6617
6582
  try {
6618
6583
  if (target === "arcade") {
6619
- if (!fs7.existsSync(packageRoot)) {
6584
+ if (!fs6.existsSync(packageRoot)) {
6620
6585
  throw new Error(
6621
6586
  `packages/arcade is not checked out at ${packageRoot}. Run \`git submodule update --init packages/arcade\` and retry.`
6622
6587
  );
6623
6588
  }
6624
6589
  chosenRoot = packageRoot;
6625
6590
  } else {
6626
- if (!fs7.existsSync(vizProRoot)) {
6591
+ if (!fs6.existsSync(vizProRoot)) {
6627
6592
  throw new Error(
6628
6593
  `packages/viz-pro is not checked out at ${vizProRoot}. Run \`git submodule update --init packages/viz-pro\` and retry.`
6629
6594
  );
@@ -6681,9 +6646,9 @@ async function inject(args, opts = {}) {
6681
6646
  );
6682
6647
  }
6683
6648
  for (const seed of seeds) {
6684
- if (fs7.existsSync(seed.sourceDir)) {
6685
- if (!dryRun) fs7.rmSync(seed.sourceDir, { recursive: true, force: true });
6686
- console.log(dim(` - ${path7.relative(projectDir, seed.sourceDir)}/ (project copy removed)`));
6649
+ if (fs6.existsSync(seed.sourceDir)) {
6650
+ if (!dryRun) fs6.rmSync(seed.sourceDir, { recursive: true, force: true });
6651
+ console.log(dim(` - ${path6.relative(projectDir, seed.sourceDir)}/ (project copy removed)`));
6687
6652
  }
6688
6653
  }
6689
6654
  const removed = stripProjectRegistry(
@@ -6703,31 +6668,31 @@ Done. Components landed in packages/${target}/.
6703
6668
  }
6704
6669
  async function injectArcadePro(args) {
6705
6670
  const { seeds, closure, componentsDir, sourceOverride, arcadeProRoot, dryRun, force } = args;
6706
- const destComponents = path7.join(arcadeProRoot, "src", "Components");
6707
- if (!dryRun) fs7.mkdirSync(destComponents, { recursive: true });
6671
+ const destComponents = path6.join(arcadeProRoot, "src", "Components");
6672
+ if (!dryRun) fs6.mkdirSync(destComponents, { recursive: true });
6708
6673
  const sourceOf = (name) => {
6709
6674
  const seed = seeds.find((s) => s.name === name);
6710
- return seed && sourceOverride ? seed.sourceDir : path7.join(componentsDir, name);
6675
+ return seed && sourceOverride ? seed.sourceDir : path6.join(componentsDir, name);
6711
6676
  };
6712
6677
  for (const name of [...closure].sort()) {
6713
6678
  const src = sourceOf(name);
6714
- const dest = path7.join(destComponents, name);
6715
- if (fs7.existsSync(dest) && !force) {
6679
+ const dest = path6.join(destComponents, name);
6680
+ if (fs6.existsSync(dest) && !force) {
6716
6681
  console.log(
6717
6682
  yellow(` ! packages/arcade/src/Components/${name}/ already exists \u2014 pass --force to overwrite.`)
6718
6683
  );
6719
6684
  continue;
6720
6685
  }
6721
6686
  if (!dryRun) {
6722
- if (fs7.existsSync(dest)) fs7.rmSync(dest, { recursive: true, force: true });
6723
- fs7.cpSync(src, dest, { recursive: true });
6687
+ if (fs6.existsSync(dest)) fs6.rmSync(dest, { recursive: true, force: true });
6688
+ fs6.cpSync(src, dest, { recursive: true });
6724
6689
  }
6725
6690
  console.log(green(` + packages/arcade/src/Components/${name}/`));
6726
6691
  }
6727
6692
  if (!dryRun) {
6728
6693
  for (const name of closure) {
6729
- const dest = path7.join(destComponents, name);
6730
- if (!fs7.existsSync(dest)) continue;
6694
+ const dest = path6.join(destComponents, name);
6695
+ if (!fs6.existsSync(dest)) continue;
6731
6696
  rewriteTree(dest, (text) => rewriteArcadeImports(text, closure));
6732
6697
  }
6733
6698
  }
@@ -6743,21 +6708,21 @@ function collectArcadePro(args) {
6743
6708
  const { seeds, closure, componentsDir, sourceOverride } = args;
6744
6709
  const sourceOf = (name) => {
6745
6710
  const seed = seeds.find((s) => s.name === name);
6746
- return seed && sourceOverride ? seed.sourceDir : path7.join(componentsDir, name);
6711
+ return seed && sourceOverride ? seed.sourceDir : path6.join(componentsDir, name);
6747
6712
  };
6748
6713
  const files = [];
6749
6714
  const warnings = [];
6750
6715
  for (const name of [...closure].sort()) {
6751
6716
  const src = sourceOf(name);
6752
- if (!fs7.existsSync(src)) {
6717
+ if (!fs6.existsSync(src)) {
6753
6718
  warnings.push(` ! source for ${name} missing at ${src}`);
6754
6719
  continue;
6755
6720
  }
6756
6721
  for (const abs of allComponentFiles(src)) {
6757
- const rel = path7.relative(src, abs);
6758
- const baseRel = path7.posix.join("src", "Components", name, rel.split(path7.sep).join("/"));
6722
+ const rel = path6.relative(src, abs);
6723
+ const baseRel = path6.posix.join("src", "Components", name, rel.split(path6.sep).join("/"));
6759
6724
  const isText = /\.(ts|tsx)$/i.test(abs);
6760
- const raw = fs7.readFileSync(abs, "utf8");
6725
+ const raw = fs6.readFileSync(abs, "utf8");
6761
6726
  const contents = isText ? rewriteArcadeImports(raw, closure) : raw;
6762
6727
  files.push({ path: baseRel, contents });
6763
6728
  }
@@ -6776,15 +6741,15 @@ function classifyVizFiles(args) {
6776
6741
  const { seeds, closure, componentsDir, sourceOverride, layerOverride } = args;
6777
6742
  const sourceOf = (name) => {
6778
6743
  const seed = seeds.find((s) => s.name === name);
6779
- return seed && sourceOverride ? seed.sourceDir : path7.join(componentsDir, name);
6744
+ return seed && sourceOverride ? seed.sourceDir : path6.join(componentsDir, name);
6780
6745
  };
6781
6746
  const files = [];
6782
6747
  for (const name of closure) {
6783
6748
  const dir = sourceOf(name);
6784
6749
  for (const abs of componentFiles(dir)) {
6785
- const base = path7.basename(abs);
6750
+ const base = path6.basename(abs);
6786
6751
  if (/\.test\.tsx?$/.test(base)) continue;
6787
- const source = fs7.readFileSync(abs, "utf8");
6752
+ const source = fs6.readFileSync(abs, "utf8");
6788
6753
  const layer = layerOverride ?? detectLayer(abs, source);
6789
6754
  files.push({ src: abs, base, owner: name, source, layer, destBase: base });
6790
6755
  }
@@ -6792,9 +6757,9 @@ function classifyVizFiles(args) {
6792
6757
  for (const name of closure) {
6793
6758
  const dir = sourceOf(name);
6794
6759
  for (const abs of componentFiles(dir)) {
6795
- const base = path7.basename(abs);
6760
+ const base = path6.basename(abs);
6796
6761
  if (!/\.test\.tsx?$/.test(base)) continue;
6797
- const source = fs7.readFileSync(abs, "utf8");
6762
+ const source = fs6.readFileSync(abs, "utf8");
6798
6763
  const subjectBase = base.replace(/\.test(\.tsx?)$/, "$1");
6799
6764
  const subjectAlt = base.replace(/\.test\.tsx?$/, ".tsx");
6800
6765
  const subject = files.find((f) => f.owner === name && (f.base === subjectBase || f.base === subjectAlt));
@@ -6814,8 +6779,8 @@ async function injectVizPro(args) {
6814
6779
  const { files, primaryLayer } = classifyVizFiles(args);
6815
6780
  const layerOf = (name) => primaryLayer.get(name);
6816
6781
  for (const f of files) {
6817
- const dest = path7.join(vizProRoot, "src", f.layer, f.destBase);
6818
- if (fs7.existsSync(dest) && !force) {
6782
+ const dest = path6.join(vizProRoot, "src", f.layer, f.destBase);
6783
+ if (fs6.existsSync(dest) && !force) {
6819
6784
  console.log(
6820
6785
  yellow(
6821
6786
  ` ! packages/viz-pro/src/${f.layer}/${f.destBase} already exists \u2014 pass --force to overwrite.`
@@ -6824,13 +6789,13 @@ async function injectVizPro(args) {
6824
6789
  }
6825
6790
  }
6826
6791
  for (const f of files) {
6827
- const destDir = path7.join(vizProRoot, "src", f.layer);
6828
- const dest = path7.join(destDir, f.destBase);
6829
- if (fs7.existsSync(dest) && !force) continue;
6792
+ const destDir = path6.join(vizProRoot, "src", f.layer);
6793
+ const dest = path6.join(destDir, f.destBase);
6794
+ if (fs6.existsSync(dest) && !force) continue;
6830
6795
  if (!dryRun) {
6831
- fs7.mkdirSync(destDir, { recursive: true });
6796
+ fs6.mkdirSync(destDir, { recursive: true });
6832
6797
  const rewritten = rewriteVizImports(f.source, closure, layerOf, f.layer);
6833
- fs7.writeFileSync(dest, rewritten);
6798
+ fs6.writeFileSync(dest, rewritten);
6834
6799
  }
6835
6800
  console.log(green(` + packages/viz-pro/src/${f.layer}/${f.destBase}`));
6836
6801
  }
@@ -6858,7 +6823,7 @@ function collectVizPro(args) {
6858
6823
  const files = [];
6859
6824
  const warnings = [];
6860
6825
  for (const f of classified) {
6861
- const rel = path7.posix.join("src", f.layer, f.destBase);
6826
+ const rel = path6.posix.join("src", f.layer, f.destBase);
6862
6827
  const contents = rewriteVizImports(f.source, closure, layerOf, f.layer);
6863
6828
  files.push({ path: rel, contents });
6864
6829
  }
@@ -6879,13 +6844,13 @@ function collectVizPro(args) {
6879
6844
  return { files, patches, warnings };
6880
6845
  }
6881
6846
  function rewriteTree(dir, rewrite) {
6882
- for (const e of fs7.readdirSync(dir, { withFileTypes: true })) {
6883
- const p = path7.join(dir, e.name);
6847
+ for (const e of fs6.readdirSync(dir, { withFileTypes: true })) {
6848
+ const p = path6.join(dir, e.name);
6884
6849
  if (e.isDirectory()) rewriteTree(p, rewrite);
6885
6850
  else if (/\.(ts|tsx)$/.test(e.name)) {
6886
- const before = fs7.readFileSync(p, "utf8");
6851
+ const before = fs6.readFileSync(p, "utf8");
6887
6852
  const after = rewrite(before);
6888
- if (after !== before) fs7.writeFileSync(p, after);
6853
+ if (after !== before) fs6.writeFileSync(p, after);
6889
6854
  }
6890
6855
  }
6891
6856
  }
@@ -7001,8 +6966,8 @@ function readSeedMeta(projectDir, seedName) {
7001
6966
  // src/commands/submissions.ts
7002
6967
  import { Command as Command7 } from "commander";
7003
6968
  import { createInterface } from "readline";
7004
- async function apiCall(auth, method, path8) {
7005
- return auth.makeAuthenticatedRequest(`${API_URL}${path8}`, { method });
6969
+ async function apiCall(auth, method, path7) {
6970
+ return auth.makeAuthenticatedRequest(`${API_URL}${path7}`, { method });
7006
6971
  }
7007
6972
  function formatDate(s) {
7008
6973
  if (!s) return "";