castle-web-cli 0.4.84 → 0.4.85

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.
Files changed (73) hide show
  1. package/dist/ide.js +35 -13
  2. package/dist/shell/assets/{index-BOgm5T3W.js → index-BJLaUTJE.js} +21 -21
  3. package/dist/shell/index.html +1 -1
  4. package/kits/physics-2d/.prettierrc +8 -0
  5. package/kits/physics-2d/CLAUDE.md +329 -0
  6. package/kits/physics-2d/behaviors/Camera.jsx +43 -0
  7. package/kits/physics-2d/behaviors/Collider.jsx +199 -0
  8. package/kits/physics-2d/behaviors/Goal.jsx +29 -0
  9. package/kits/physics-2d/behaviors/Layout.jsx +53 -0
  10. package/kits/physics-2d/behaviors/Sprite.jsx +352 -0
  11. package/kits/physics-2d/behaviors/tint.js +47 -0
  12. package/kits/physics-2d/blueprints/ball.scene +14 -0
  13. package/kits/physics-2d/blueprints/block.scene +12 -0
  14. package/kits/physics-2d/blueprints/cauldron.scene +18 -0
  15. package/kits/physics-2d/blueprints/crate.scene +14 -0
  16. package/kits/physics-2d/blueprints/goal.scene +12 -0
  17. package/kits/physics-2d/castle.json +13 -0
  18. package/kits/physics-2d/docs/pxart-format.md +377 -0
  19. package/kits/physics-2d/drawings/block.pxart +25 -0
  20. package/kits/physics-2d/drawings/cauldron.pxart +113 -0
  21. package/kits/physics-2d/editors/BlueprintLibrary.jsx +247 -0
  22. package/kits/physics-2d/editors/ErrorBoundary.jsx +59 -0
  23. package/kits/physics-2d/editors/PlayOnly.jsx +31 -0
  24. package/kits/physics-2d/editors/PxArtEditor.jsx +954 -0
  25. package/kits/physics-2d/editors/SceneEditor.jsx +1681 -0
  26. package/kits/physics-2d/editors/SelectionOverlay.jsx +909 -0
  27. package/kits/physics-2d/editors/SingleEditor.jsx +122 -0
  28. package/kits/physics-2d/editors/behaviorRegistry.js +30 -0
  29. package/kits/physics-2d/editors/editorHistory.js +157 -0
  30. package/kits/physics-2d/editors/inspectorSheet.js +13 -0
  31. package/kits/physics-2d/editors/pixelCanvas.js +11 -0
  32. package/kits/physics-2d/editors/pixelEditorChrome.jsx +74 -0
  33. package/kits/physics-2d/editors/pixelGeometry.js +140 -0
  34. package/kits/physics-2d/editors/pixelInspector.jsx +633 -0
  35. package/kits/physics-2d/editors/pxArtEditorModel.js +732 -0
  36. package/kits/physics-2d/editors/pxArtPlayback.js +92 -0
  37. package/kits/physics-2d/editors/pxArtTimeline.jsx +752 -0
  38. package/kits/physics-2d/editors/pxArtTimeline.module.css +506 -0
  39. package/kits/physics-2d/editors/pxArtTools.js +232 -0
  40. package/kits/physics-2d/editors/useArtboardFit.js +102 -0
  41. package/kits/physics-2d/engine/ScenePlayer.jsx +196 -0
  42. package/kits/physics-2d/engine/SceneUI.jsx +59 -0
  43. package/kits/physics-2d/engine/assets.js +15 -0
  44. package/kits/physics-2d/engine/autoInspector.jsx +70 -0
  45. package/kits/physics-2d/engine/blueprint.js +521 -0
  46. package/kits/physics-2d/engine/collider.js +196 -0
  47. package/kits/physics-2d/engine/files.js +117 -0
  48. package/kits/physics-2d/engine/liveReload.js +88 -0
  49. package/kits/physics-2d/engine/pxart.js +1032 -0
  50. package/kits/physics-2d/engine/pxartSmooth.js +222 -0
  51. package/kits/physics-2d/engine/scene.js +686 -0
  52. package/kits/physics-2d/engine/spriteGeometry.js +32 -0
  53. package/kits/physics-2d/engine/ui.jsx +688 -0
  54. package/kits/physics-2d/engine/ui.module.css +2287 -0
  55. package/kits/physics-2d/eslint.config.js +71 -0
  56. package/kits/physics-2d/index.html +24 -0
  57. package/kits/physics-2d/main.jsx +24 -0
  58. package/kits/physics-2d/package-lock.json +2706 -0
  59. package/kits/physics-2d/package.json +42 -0
  60. package/kits/physics-2d/physics/PhysicsSystem.js +290 -0
  61. package/kits/physics-2d/physics/behaviors/AnalogStick.jsx +101 -0
  62. package/kits/physics-2d/physics/behaviors/Draggable.jsx +79 -0
  63. package/kits/physics-2d/physics/behaviors/RigidBody.jsx +55 -0
  64. package/kits/physics-2d/physics/behaviors/Slingshot.jsx +118 -0
  65. package/kits/physics-2d/physics/controls.js +79 -0
  66. package/kits/physics-2d/physics/index.js +26 -0
  67. package/kits/physics-2d/physics/matterBridge.js +126 -0
  68. package/kits/physics-2d/pnpm-lock.yaml +1761 -0
  69. package/kits/physics-2d/scenes/main.scene +12 -0
  70. package/kits/physics-2d/scenes/sandbox.scene +13 -0
  71. package/kits/physics-2d/scripts/draw.mjs +121 -0
  72. package/kits/physics-2d/vite.config.js +1 -0
  73. package/package.json +1 -1
package/dist/ide.js CHANGED
@@ -72,12 +72,7 @@ export const PTY_WS_PATH = "/__castle/pty";
72
72
  export const FILES_API_PREFIX = "/__castle/files/";
73
73
  // Directories never surfaced in the file list / never read or written through
74
74
  // the builtin editor: VCS, deck-private state, and dependency trees.
75
- const FILES_IGNORE_DIRS = new Set([
76
- ".git",
77
- ".castle",
78
- "node_modules",
79
- "dist",
80
- ]);
75
+ const FILES_IGNORE_DIRS = new Set([".git", ".castle", "node_modules", "dist"]);
81
76
  // Fallback set of kit-owned rich-editor extensions: the known castle rich
82
77
  // content types across kit variants (.pxart in basic-2d, .drawing in older
83
78
  // kits). Only used when a kit is present but its getFileKind couldn't be parsed.
@@ -264,7 +259,9 @@ function handleFilesWrite(deckDir, req, res) {
264
259
  }
265
260
  catch (err) {
266
261
  const message = err instanceof Error ? err.message : String(err);
267
- sendJson(res, 500, { error: `Could not write ${resolved.rel}: ${message}` });
262
+ sendJson(res, 500, {
263
+ error: `Could not write ${resolved.rel}: ${message}`,
264
+ });
268
265
  }
269
266
  })();
270
267
  }
@@ -319,7 +316,9 @@ function handleFilesMkdir(deckDir, req, res) {
319
316
  }
320
317
  catch (err) {
321
318
  const message = err instanceof Error ? err.message : String(err);
322
- return sendJson(res, 500, { error: `Could not create folder ${resolved.rel}: ${message}` });
319
+ return sendJson(res, 500, {
320
+ error: `Could not create folder ${resolved.rel}: ${message}`,
321
+ });
323
322
  }
324
323
  const visiblePathAdded = ensureVisiblePath(deckDir, resolved.rel);
325
324
  sendJson(res, 200, { ok: true, path: resolved.rel, visiblePathAdded });
@@ -359,7 +358,9 @@ function handleFilesRename(deckDir, req, res) {
359
358
  // filesystem (default on macOS/Windows) `to` can "exist" only because it is
360
359
  // `from` under a different case -- a case-only rename like bounce.jsx ->
361
360
  // Bounce.jsx. Allow that by treating same-inode as not-a-collision.
362
- if (from.abs !== to.abs && fs.existsSync(to.abs) && !isSameFile(from.abs, to.abs)) {
361
+ if (from.abs !== to.abs &&
362
+ fs.existsSync(to.abs) &&
363
+ !isSameFile(from.abs, to.abs)) {
363
364
  return sendJson(res, 409, { error: `Already exists: ${to.rel}` });
364
365
  }
365
366
  try {
@@ -394,7 +395,9 @@ function handleFilesDelete(deckDir, req, res) {
394
395
  }
395
396
  catch (err) {
396
397
  const message = err instanceof Error ? err.message : String(err);
397
- sendJson(res, 500, { error: `Could not delete ${resolved.rel}: ${message}` });
398
+ sendJson(res, 500, {
399
+ error: `Could not delete ${resolved.rel}: ${message}`,
400
+ });
398
401
  }
399
402
  })();
400
403
  }
@@ -431,7 +434,7 @@ function handleFilesApi(deckDir, req, res, reqPath) {
431
434
  const url = new URL(req.url ?? "/", "http://localhost");
432
435
  const resolved = resolveDeckPath(deckDir, url.searchParams.get("path"));
433
436
  if (!resolved.ok)
434
- return sendJson(res, 400, { error: resolved.error }), true;
437
+ return (sendJson(res, 400, { error: resolved.error }), true);
435
438
  try {
436
439
  const contents = fs.readFileSync(resolved.abs, "utf8");
437
440
  sendJson(res, 200, { path: resolved.rel, contents });
@@ -457,13 +460,32 @@ function handleFilesApi(deckDir, req, res, reqPath) {
457
460
  handleFilesMkdir(deckDir, req, res);
458
461
  return true;
459
462
  }
460
- return sendJson(res, 404, { error: `Unknown files action: ${action}` }), true;
463
+ return (sendJson(res, 404, { error: `Unknown files action: ${action}` }),
464
+ true);
461
465
  }
462
466
  function defaultShell() {
463
467
  if (process.platform === "win32") {
464
468
  return { command: process.env.COMSPEC ?? "cmd.exe", args: [] };
465
469
  }
466
- return { command: process.env.SHELL ?? "/bin/zsh", args: ["-l"] };
470
+ // Pick the first shell that actually exists: $SHELL (dev), then zsh (macOS),
471
+ // then bash / sh. The cloud sandbox image is Debian-based (node:22) with no
472
+ // zsh and no $SHELL set, so a bare `/bin/zsh` fallback fails with execvp
473
+ // ENOENT and the terminal never gets a shell.
474
+ const candidates = [
475
+ process.env.SHELL,
476
+ "/bin/zsh",
477
+ "/bin/bash",
478
+ "/bin/sh",
479
+ ].filter((c) => Boolean(c));
480
+ const command = candidates.find((c) => {
481
+ try {
482
+ return fs.existsSync(c);
483
+ }
484
+ catch {
485
+ return false;
486
+ }
487
+ }) ?? "/bin/sh";
488
+ return { command, args: ["-l"] };
467
489
  }
468
490
  function ptyEnv() {
469
491
  const env = {