@auraindustry/aurajs 0.0.7 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (334) hide show
  1. package/README.md +98 -2
  2. package/benchmarks/perf-thresholds.json +54 -0
  3. package/package.json +4 -7
  4. package/src/asset-pack.mjs +5 -1
  5. package/src/authored-project.mjs +1449 -0
  6. package/src/authored-runtime.mjs +2016 -0
  7. package/src/authoring/avatar-animation-graph.mjs +648 -0
  8. package/src/bin-integrity.mjs +272 -0
  9. package/src/build-contract/assets.mjs +130 -0
  10. package/src/build-contract/capabilities.mjs +116 -0
  11. package/src/build-contract/constants.mjs +6 -0
  12. package/src/build-contract/helpers.mjs +44 -0
  13. package/src/build-contract/web-templates.mjs +5993 -0
  14. package/src/build-contract.mjs +27 -2910
  15. package/src/bundler.mjs +188 -55
  16. package/src/cli.mjs +4825 -1512
  17. package/src/commands/project-authoring.mjs +434 -0
  18. package/src/config.mjs +27 -0
  19. package/src/conformance/cases/app-and-ui-runtime-cases.mjs +3309 -0
  20. package/src/conformance/cases/core-runtime-cases.mjs +1431 -0
  21. package/src/conformance/cases/index.mjs +11 -0
  22. package/src/conformance/cases/scene3d-and-media-cases.mjs +2094 -0
  23. package/src/conformance/cases/systems-and-gameplay-cases.mjs +1776 -0
  24. package/src/conformance/shared.mjs +27 -0
  25. package/src/conformance-runner.mjs +25 -13
  26. package/src/conformance.mjs +619 -4020
  27. package/src/cutscene.mjs +362 -5
  28. package/src/dev-cli-action.mjs +249 -0
  29. package/src/dev-cli-inspect.mjs +92 -0
  30. package/src/dev-cli-state.mjs +80 -0
  31. package/src/external-asset-cache.mjs +587 -0
  32. package/src/external-asset-policy.mjs +217 -0
  33. package/src/external-package-surface.mjs +206 -0
  34. package/src/game-action-runtime.mjs +869 -0
  35. package/src/game-state-runtime.mjs +206 -6
  36. package/src/headless-action.mjs +186 -0
  37. package/src/headless-test/runtime-animation.mjs +1173 -0
  38. package/src/headless-test/runtime-coordinator.mjs +1514 -0
  39. package/src/headless-test/runtime-primitives.mjs +320 -0
  40. package/src/headless-test/runtime-world.mjs +2253 -0
  41. package/src/headless-test.mjs +392 -4298
  42. package/src/host-binary.mjs +342 -14
  43. package/src/icon-discovery.mjs +64 -0
  44. package/src/make-catalog.mjs +109 -0
  45. package/src/make.mjs +197 -0
  46. package/src/package-integrity.mjs +586 -0
  47. package/src/perf-benchmark.mjs +353 -0
  48. package/src/postinstall.mjs +5 -5
  49. package/src/prefabs/index.mjs +34 -0
  50. package/src/prefabs/scene-serialization.mjs +184 -0
  51. package/src/project-importer.mjs +620 -0
  52. package/src/project-registry.mjs +24 -0
  53. package/src/publish-command.mjs +195 -0
  54. package/src/publish-env-example.mjs +83 -0
  55. package/src/publish-validation.mjs +708 -0
  56. package/src/retro/assets/compile.mjs +232 -0
  57. package/src/retro/backend-gba/authoring.mjs +1029 -0
  58. package/src/retro/backend-gba/rom.mjs +363 -0
  59. package/src/retro/backend-gbc/rom.mjs +85 -0
  60. package/src/retro/build.mjs +278 -0
  61. package/src/retro/cli/commands.mjs +292 -0
  62. package/src/retro/cli/templates.mjs +84 -0
  63. package/src/retro/diagnostics/catalog.mjs +110 -0
  64. package/src/retro/diagnostics/emit.mjs +72 -0
  65. package/src/retro/emulator/case-overlay.mjs +64 -0
  66. package/src/retro/emulator/discovery.mjs +158 -0
  67. package/src/retro/emulator/macos-case-overlay.swift +220 -0
  68. package/src/retro/emulator/profiles.mjs +146 -0
  69. package/src/retro/emulator/runner.mjs +289 -0
  70. package/src/retro/frontend/load-project.mjs +98 -0
  71. package/src/retro/index.mjs +30 -0
  72. package/src/retro/ir/build-ir.mjs +108 -0
  73. package/src/retro/runtime-gba/contract.mjs +151 -0
  74. package/src/retro/runtime-gbc/contract.mjs +117 -0
  75. package/src/retro/shared/span.mjs +26 -0
  76. package/src/retro/shared/targets.mjs +64 -0
  77. package/src/retro/validator/check-project.mjs +114 -0
  78. package/src/runtime-hotspot-audit.mjs +707 -0
  79. package/src/scaffold/config.mjs +1000 -0
  80. package/src/scaffold/fs.mjs +56 -0
  81. package/src/scaffold/layout.mjs +318 -0
  82. package/src/scaffold/project-docs.mjs +438 -0
  83. package/src/scaffold.mjs +93 -596
  84. package/src/scene-composition/index.mjs +326 -0
  85. package/src/scene-composition/runtime.mjs +751 -0
  86. package/src/self-hosted-assets.mjs +604 -0
  87. package/src/session-client.mjs +750 -0
  88. package/src/session-native-launcher.mjs +74 -0
  89. package/src/session-protocol.mjs +75 -0
  90. package/src/session-runtime.mjs +321 -0
  91. package/src/session-server.mjs +360 -0
  92. package/src/shader-kits/index.mjs +773 -0
  93. package/src/starter-content-registry.mjs +292 -0
  94. package/src/state-artifacts.mjs +662 -24
  95. package/src/state-dev-reload.mjs +99 -2
  96. package/src/terminal-ui.mjs +245 -0
  97. package/src/web-conformance.mjs +219 -0
  98. package/templates/create/2d/config/gameplay/shooter.config.js +26 -0
  99. package/templates/create/2d/content/gameplay/waves.json +26 -0
  100. package/templates/create/2d/content/registries/.gitkeep +1 -0
  101. package/templates/create/2d/docs/design/.gitkeep +1 -0
  102. package/templates/create/2d/docs/design/loop.md +5 -0
  103. package/templates/create/2d/prefabs/enemies.prefab.js +90 -0
  104. package/templates/create/2d/prefabs/enemy-basic.prefab.js +18 -0
  105. package/templates/create/2d/prefabs/player.prefab.js +36 -0
  106. package/templates/create/2d/prefabs/projectiles.prefab.js +35 -0
  107. package/templates/create/2d/scenes/boot.scene.js +12 -0
  108. package/templates/create/2d/scenes/gameplay.scene.js +230 -0
  109. package/templates/create/2d/scenes/menu.scene.js +9 -0
  110. package/templates/create/2d/src/main.js +6 -185
  111. package/templates/create/2d/src/runtime/app.js +49 -0
  112. package/templates/create/2d/src/runtime/capabilities.js +35 -0
  113. package/templates/create/2d/ui/hud.screen.js +40 -0
  114. package/templates/create/2d/ui/pause.screen.js +149 -0
  115. package/templates/create/2d/ui/settings.screen.js +347 -0
  116. package/templates/create/2d/ui/title.screen.js +13 -0
  117. package/templates/create/2d-adventure/aura.config.json +28 -0
  118. package/templates/create/2d-adventure/config/gameplay/adventure.config.js +14 -0
  119. package/templates/create/2d-adventure/content/gameplay/world.js +46 -0
  120. package/templates/create/2d-adventure/content/registries/.gitkeep +1 -0
  121. package/templates/create/2d-adventure/docs/design/loop.md +5 -0
  122. package/templates/create/2d-adventure/prefabs/player.prefab.js +54 -0
  123. package/templates/create/2d-adventure/prefabs/relic.prefab.js +38 -0
  124. package/templates/create/2d-adventure/prefabs/world.prefab.js +125 -0
  125. package/templates/create/2d-adventure/scenes/gameplay.scene.js +256 -0
  126. package/templates/create/2d-adventure/src/runtime/capabilities.js +34 -0
  127. package/templates/create/2d-adventure/ui/hud.screen.js +60 -0
  128. package/templates/create/2d-survivor/config/gameplay/survivor.config.js +33 -0
  129. package/templates/create/2d-survivor/content/gameplay/spawn-zones.json +29 -0
  130. package/templates/create/2d-survivor/content/registries/.gitkeep +1 -0
  131. package/templates/create/2d-survivor/docs/design/.gitkeep +1 -0
  132. package/templates/create/2d-survivor/docs/design/loop.md +5 -0
  133. package/templates/create/2d-survivor/prefabs/enemies.prefab.js +178 -0
  134. package/templates/create/2d-survivor/prefabs/enemy-swarm.prefab.js +18 -0
  135. package/templates/create/2d-survivor/prefabs/player.prefab.js +42 -0
  136. package/templates/create/2d-survivor/prefabs/projectiles.prefab.js +56 -0
  137. package/templates/create/2d-survivor/scenes/boot.scene.js +12 -0
  138. package/templates/create/2d-survivor/scenes/gameplay.scene.js +314 -0
  139. package/templates/create/2d-survivor/scenes/menu.scene.js +9 -0
  140. package/templates/create/2d-survivor/src/main.js +5 -332
  141. package/templates/create/2d-survivor/src/runtime/app.js +49 -0
  142. package/templates/create/2d-survivor/src/runtime/capabilities.js +35 -0
  143. package/templates/create/2d-survivor/ui/hud.screen.js +45 -0
  144. package/templates/create/2d-survivor/ui/title.screen.js +13 -0
  145. package/templates/create/3d/assets/models/starter-avatar.gltf +184 -0
  146. package/templates/create/3d/config/gameplay/.gitkeep +1 -0
  147. package/templates/create/3d/content/gameplay/checkpoints.json +33 -0
  148. package/templates/create/3d/content/gameplay/course.js +40 -0
  149. package/templates/create/3d/content/registries/.gitkeep +1 -0
  150. package/templates/create/3d/docs/design/.gitkeep +1 -0
  151. package/templates/create/3d/docs/design/loop.md +5 -0
  152. package/templates/create/3d/prefabs/checkpoint.prefab.js +15 -0
  153. package/templates/create/3d/prefabs/player.prefab.js +204 -0
  154. package/templates/create/3d/prefabs/world.prefab.js +112 -0
  155. package/templates/create/3d/scenes/boot.scene.js +12 -0
  156. package/templates/create/3d/scenes/checkpoint.scene.js +9 -0
  157. package/templates/create/3d/scenes/gameplay.scene.js +292 -0
  158. package/templates/create/3d/src/main.js +6 -295
  159. package/templates/create/3d/src/runtime/app.js +49 -0
  160. package/templates/create/3d/src/runtime/capabilities.js +53 -0
  161. package/templates/create/3d/src/runtime/materials.js +34 -0
  162. package/templates/create/3d/src/runtime/state.js +39 -0
  163. package/templates/create/3d/ui/hud.screen.js +75 -0
  164. package/templates/create/3d/ui/pause.screen.js +166 -0
  165. package/templates/create/3d/ui/settings.screen.js +387 -0
  166. package/templates/create/3d-adventure/assets/models/starter-avatar.gltf +184 -0
  167. package/templates/create/3d-adventure/aura.config.json +28 -0
  168. package/templates/create/3d-adventure/config/gameplay/adventure.config.js +9 -0
  169. package/templates/create/3d-adventure/content/gameplay/course.js +62 -0
  170. package/templates/create/3d-adventure/content/registries/.gitkeep +1 -0
  171. package/templates/create/3d-adventure/docs/design/loop.md +5 -0
  172. package/templates/create/3d-adventure/prefabs/player.prefab.js +168 -0
  173. package/templates/create/3d-adventure/prefabs/relic.prefab.js +35 -0
  174. package/templates/create/3d-adventure/prefabs/world.prefab.js +119 -0
  175. package/templates/create/3d-adventure/scenes/gameplay.scene.js +358 -0
  176. package/templates/create/3d-adventure/src/runtime/capabilities.js +56 -0
  177. package/templates/create/3d-adventure/src/runtime/materials.js +39 -0
  178. package/templates/create/3d-adventure/src/runtime/state.js +31 -0
  179. package/templates/create/3d-adventure/ui/hud.screen.js +70 -0
  180. package/templates/create/3d-adventure/ui/pause.screen.js +437 -0
  181. package/templates/create/3d-collectathon/assets/models/starter-avatar.gltf +184 -0
  182. package/templates/create/3d-collectathon/config/gameplay/.gitkeep +1 -0
  183. package/templates/create/3d-collectathon/content/gameplay/collectibles.json +26 -0
  184. package/templates/create/3d-collectathon/content/gameplay/course.js +46 -0
  185. package/templates/create/3d-collectathon/content/registries/.gitkeep +1 -0
  186. package/templates/create/3d-collectathon/docs/design/.gitkeep +1 -0
  187. package/templates/create/3d-collectathon/docs/design/loop.md +5 -0
  188. package/templates/create/3d-collectathon/prefabs/collectible.prefab.js +15 -0
  189. package/templates/create/3d-collectathon/prefabs/player.prefab.js +207 -0
  190. package/templates/create/3d-collectathon/prefabs/world.prefab.js +112 -0
  191. package/templates/create/3d-collectathon/scenes/boot.scene.js +12 -0
  192. package/templates/create/3d-collectathon/scenes/checkpoint.scene.js +9 -0
  193. package/templates/create/3d-collectathon/scenes/gameplay.scene.js +200 -0
  194. package/templates/create/3d-collectathon/src/main.js +5 -355
  195. package/templates/create/3d-collectathon/src/runtime/app.js +49 -0
  196. package/templates/create/3d-collectathon/src/runtime/capabilities.js +53 -0
  197. package/templates/create/3d-collectathon/src/runtime/materials.js +34 -0
  198. package/templates/create/3d-collectathon/src/runtime/state.js +27 -0
  199. package/templates/create/3d-collectathon/ui/hud.screen.js +66 -0
  200. package/templates/create/3d-collectathon/ui/pause.screen.js +13 -0
  201. package/templates/create/blank/config/gameplay/.gitkeep +1 -0
  202. package/templates/create/blank/content/gameplay/.gitkeep +1 -0
  203. package/templates/create/blank/content/registries/.gitkeep +1 -0
  204. package/templates/create/blank/docs/design/.gitkeep +1 -0
  205. package/templates/create/blank/docs/design/loop.md +5 -0
  206. package/templates/create/blank/prefabs/.gitkeep +1 -0
  207. package/templates/create/blank/scenes/.gitkeep +1 -0
  208. package/templates/create/blank/src/runtime/.gitkeep +1 -0
  209. package/templates/create/blank/ui/.gitkeep +1 -0
  210. package/templates/create/deckbuilder-2d/assets/audio/.gitkeep +1 -0
  211. package/templates/create/deckbuilder-2d/assets/fonts/.gitkeep +1 -0
  212. package/templates/create/deckbuilder-2d/assets/sprites/.gitkeep +1 -0
  213. package/templates/create/deckbuilder-2d/assets/starter/README.md +11 -0
  214. package/templates/create/deckbuilder-2d/assets/ui/.gitkeep +1 -0
  215. package/templates/create/deckbuilder-2d/aura.config.json +28 -0
  216. package/templates/create/deckbuilder-2d/config/gameplay/deckbuilder.config.js +26 -0
  217. package/templates/create/deckbuilder-2d/content/cards/guard.card.js +19 -0
  218. package/templates/create/deckbuilder-2d/content/cards/spark.card.js +20 -0
  219. package/templates/create/deckbuilder-2d/content/cards/starter.deck.js +69 -0
  220. package/templates/create/deckbuilder-2d/content/cards/strike.card.js +19 -0
  221. package/templates/create/deckbuilder-2d/content/cards/survey.card.js +20 -0
  222. package/templates/create/deckbuilder-2d/content/encounters/training-battle.encounter.js +14 -0
  223. package/templates/create/deckbuilder-2d/content/encounters/training-battle.js +65 -0
  224. package/templates/create/deckbuilder-2d/content/enemies/training-automaton.enemy.js +48 -0
  225. package/templates/create/deckbuilder-2d/content/gameplay/.gitkeep +1 -0
  226. package/templates/create/deckbuilder-2d/content/registries/cards.registry.js +26 -0
  227. package/templates/create/deckbuilder-2d/content/registries/encounters.registry.js +20 -0
  228. package/templates/create/deckbuilder-2d/content/registries/enemies.registry.js +20 -0
  229. package/templates/create/deckbuilder-2d/content/registries/relics.registry.js +20 -0
  230. package/templates/create/deckbuilder-2d/content/relics/ember-charm.relic.js +18 -0
  231. package/templates/create/deckbuilder-2d/docs/design/loop.md +12 -0
  232. package/templates/create/deckbuilder-2d/prefabs/.gitkeep +1 -0
  233. package/templates/create/deckbuilder-2d/scenes/boot.scene.js +84 -0
  234. package/templates/create/deckbuilder-2d/scenes/gameplay.scene.js +641 -0
  235. package/templates/create/deckbuilder-2d/src/components/.gitkeep +1 -0
  236. package/templates/create/deckbuilder-2d/src/main.js +17 -0
  237. package/templates/create/deckbuilder-2d/src/runtime/capabilities.js +22 -0
  238. package/templates/create/deckbuilder-2d/src/shared/.gitkeep +1 -0
  239. package/templates/create/deckbuilder-2d/src/systems/.gitkeep +1 -0
  240. package/templates/create/deckbuilder-2d/tests/smoke/.gitkeep +1 -0
  241. package/templates/create/deckbuilder-2d/ui/hud.screen.js +80 -0
  242. package/templates/create/deckbuilder-2d/ui/pause.screen.js +146 -0
  243. package/templates/create/deckbuilder-2d/ui/settings.screen.js +342 -0
  244. package/templates/create/local-multiplayer/aura.config.json +40 -0
  245. package/templates/create/local-multiplayer/config/gameplay/local-multiplayer.config.js +26 -0
  246. package/templates/create/local-multiplayer/content/gameplay/room-layout.js +13 -0
  247. package/templates/create/local-multiplayer/content/registries/.gitkeep +1 -0
  248. package/templates/create/local-multiplayer/docs/design/loop.md +14 -0
  249. package/templates/create/local-multiplayer/prefabs/player.prefab.js +99 -0
  250. package/templates/create/local-multiplayer/scenes/boot.scene.js +12 -0
  251. package/templates/create/local-multiplayer/scenes/gameplay.scene.js +443 -0
  252. package/templates/create/local-multiplayer/src/main.js +17 -0
  253. package/templates/create/local-multiplayer/src/runtime/capabilities.js +28 -0
  254. package/templates/create/local-multiplayer/ui/hud.screen.js +60 -0
  255. package/templates/create/shared/src/runtime/project-inspector.js +105 -0
  256. package/templates/create/shared/src/runtime/scene-flow.js +290 -0
  257. package/templates/create/shared/src/runtime/screen-shell.js +222 -0
  258. package/templates/create/shared/src/runtime/ui-forms.js +209 -0
  259. package/templates/create/shared/src/runtime/ui-settings.js +237 -0
  260. package/templates/create/shared/src/runtime/ui-theme.js +352 -0
  261. package/templates/create/shared/src/starter-utils/adventure-objectives.js +102 -0
  262. package/templates/create/shared/src/starter-utils/animation-2d.js +337 -0
  263. package/templates/create/shared/src/starter-utils/avatar-3d.js +404 -0
  264. package/templates/create/shared/src/starter-utils/combat-feedback-2d.js +320 -0
  265. package/templates/create/shared/src/starter-utils/core.js +39 -3
  266. package/templates/create/shared/src/starter-utils/index.js +8 -2
  267. package/templates/create/shared/src/starter-utils/platformer-3d.js +34 -3
  268. package/templates/create/shared/src/starter-utils/triggers.js +662 -0
  269. package/templates/create/shared/src/starter-utils/tween-2d.js +615 -0
  270. package/templates/create/video-cutscene/assets/video/.gitkeep +0 -0
  271. package/templates/create/video-cutscene/aura.config.json +28 -0
  272. package/templates/create/video-cutscene/config/gameplay/.gitkeep +0 -0
  273. package/templates/create/video-cutscene/content/gameplay/.gitkeep +0 -0
  274. package/templates/create/video-cutscene/content/registries/.gitkeep +0 -0
  275. package/templates/create/video-cutscene/docs/design/loop.md +22 -0
  276. package/templates/create/video-cutscene/prefabs/.gitkeep +0 -0
  277. package/templates/create/video-cutscene/scenes/boot.scene.js +11 -0
  278. package/templates/create/video-cutscene/scenes/cutscene.scene.js +113 -0
  279. package/templates/create/video-cutscene/scenes/gameplay.scene.js +50 -0
  280. package/templates/create/video-cutscene/src/main.js +17 -0
  281. package/templates/create/video-cutscene/src/runtime/app.js +52 -0
  282. package/templates/create/video-cutscene/src/runtime/capabilities.js +35 -0
  283. package/templates/create/video-cutscene/src/runtime/state.js +13 -0
  284. package/templates/create/video-cutscene/ui/.gitkeep +0 -0
  285. package/templates/create-bin/play.js +1187 -0
  286. package/templates/make/README.md +46 -0
  287. package/templates/make/catalog.json +51 -0
  288. package/templates/make/component/files/{{MAKE_NAME}}.component.js +20 -0
  289. package/templates/make/component/manifest.json +9 -0
  290. package/templates/make/data/files/{{MAKE_NAME}}.json +14 -0
  291. package/templates/make/data/manifest.json +9 -0
  292. package/templates/make/material/files/{{MAKE_NAME}}.material.json +17 -0
  293. package/templates/make/material/manifest.json +9 -0
  294. package/templates/make/prefab/files/{{MAKE_NAME}}.prefab.js +20 -0
  295. package/templates/make/prefab/manifest.json +9 -0
  296. package/templates/make/scene/files/{{MAKE_NAME}}.scene.js +31 -0
  297. package/templates/make/scene/manifest.json +9 -0
  298. package/templates/make/shader/files/{{MAKE_NAME}}.shader.js +23 -0
  299. package/templates/make/shader/manifest.json +9 -0
  300. package/templates/make/system/files/{{MAKE_NAME}}.system.js +15 -0
  301. package/templates/make/system/manifest.json +9 -0
  302. package/templates/make/ui-screen/files/{{MAKE_NAME}}.screen.js +16 -0
  303. package/templates/make/ui-screen/files/{{MAKE_NAME}}.screen.json +23 -0
  304. package/templates/make/ui-screen/manifest.json +10 -0
  305. package/templates/make-starters/deckbuilder-2d/card/files/{{MAKE_NAME}}.card.js +22 -0
  306. package/templates/make-starters/deckbuilder-2d/card/manifest.json +9 -0
  307. package/templates/make-starters/deckbuilder-2d/catalog.json +34 -0
  308. package/templates/make-starters/deckbuilder-2d/encounter/files/{{MAKE_NAME}}.encounter.js +18 -0
  309. package/templates/make-starters/deckbuilder-2d/encounter/manifest.json +9 -0
  310. package/templates/make-starters/deckbuilder-2d/enemy/files/{{MAKE_NAME}}.enemy.js +28 -0
  311. package/templates/make-starters/deckbuilder-2d/enemy/manifest.json +9 -0
  312. package/templates/make-starters/deckbuilder-2d/relic/files/{{MAKE_NAME}}.relic.js +23 -0
  313. package/templates/make-starters/deckbuilder-2d/relic/manifest.json +9 -0
  314. package/templates/retro/platformer/README.md +10 -0
  315. package/templates/retro/platformer/assets/retro/assets.json +91 -0
  316. package/templates/retro/platformer/aura.config.json +7 -0
  317. package/templates/retro/platformer/package.json +5 -0
  318. package/templates/retro/platformer/src/main.js +40 -0
  319. package/templates/retro/puzzle-grid/README.md +10 -0
  320. package/templates/retro/puzzle-grid/assets/retro/assets.json +90 -0
  321. package/templates/retro/puzzle-grid/aura.config.json +7 -0
  322. package/templates/retro/puzzle-grid/package.json +5 -0
  323. package/templates/retro/puzzle-grid/src/main.js +29 -0
  324. package/templates/retro/tactics-grid/README.md +10 -0
  325. package/templates/retro/tactics-grid/assets/retro/assets.json +90 -0
  326. package/templates/retro/tactics-grid/aura.config.json +7 -0
  327. package/templates/retro/tactics-grid/package.json +5 -0
  328. package/templates/retro/tactics-grid/src/main.js +35 -0
  329. package/templates/retro/topdown-adventure/README.md +10 -0
  330. package/templates/retro/topdown-adventure/assets/retro/assets.json +95 -0
  331. package/templates/retro/topdown-adventure/aura.config.json +7 -0
  332. package/templates/retro/topdown-adventure/package.json +5 -0
  333. package/templates/retro/topdown-adventure/src/main.js +29 -0
  334. package/templates/skills/aurajs/SKILL.md +61 -5
@@ -0,0 +1,217 @@
1
+ import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
2
+ import { join, resolve } from 'node:path';
3
+
4
+ export const ASSET_MANIFEST_SCHEMA = 'aurajs.asset-manifest.v1';
5
+ export const DEFAULT_PUBLISH_ASSET_THRESHOLD_BYTES = 50 * 1024 * 1024;
6
+ export const PUBLISH_ASSET_THRESHOLD_ENV = 'AURA_PUBLISH_ASSET_THRESHOLD_BYTES';
7
+ export const SELF_HOSTED_EXTERNAL_ASSETS_CONFIG = 'aura.external-assets.json';
8
+
9
+ function formatUnit(value, unit) {
10
+ const rounded = value >= 10 ? Math.round(value) : Math.round(value * 10) / 10;
11
+ return `${rounded} ${unit}`;
12
+ }
13
+
14
+ export function formatBytes(bytes) {
15
+ const normalized = Number.isFinite(bytes) && bytes >= 0 ? bytes : 0;
16
+ if (normalized < 1024) return `${normalized} B`;
17
+ if (normalized < (1024 * 1024)) return formatUnit(normalized / 1024, 'KiB');
18
+ if (normalized < (1024 * 1024 * 1024)) return formatUnit(normalized / (1024 * 1024), 'MiB');
19
+ return formatUnit(normalized / (1024 * 1024 * 1024), 'GiB');
20
+ }
21
+
22
+ export function resolvePublishAssetThresholdBytes(env = process.env) {
23
+ const raw = String(env?.[PUBLISH_ASSET_THRESHOLD_ENV] || '').trim();
24
+ if (!raw) {
25
+ return {
26
+ bytes: DEFAULT_PUBLISH_ASSET_THRESHOLD_BYTES,
27
+ source: 'default',
28
+ raw: null,
29
+ };
30
+ }
31
+
32
+ const parsed = Number.parseInt(raw, 10);
33
+ if (!Number.isFinite(parsed) || parsed < 0) {
34
+ return {
35
+ bytes: DEFAULT_PUBLISH_ASSET_THRESHOLD_BYTES,
36
+ source: 'default_invalid_env',
37
+ raw,
38
+ };
39
+ }
40
+
41
+ return {
42
+ bytes: parsed,
43
+ source: 'env',
44
+ raw,
45
+ };
46
+ }
47
+
48
+ function sumDirectoryBytes(root) {
49
+ if (!existsSync(root)) {
50
+ return 0;
51
+ }
52
+
53
+ const stats = statSync(root);
54
+ if (!stats.isDirectory()) {
55
+ return stats.size;
56
+ }
57
+
58
+ let total = 0;
59
+ const stack = [root];
60
+ while (stack.length > 0) {
61
+ const current = stack.pop();
62
+ for (const entry of readdirSync(current)) {
63
+ const fullPath = join(current, entry);
64
+ const entryStats = statSync(fullPath);
65
+ if (entryStats.isDirectory()) {
66
+ stack.push(fullPath);
67
+ } else {
68
+ total += entryStats.size;
69
+ }
70
+ }
71
+ }
72
+ return total;
73
+ }
74
+
75
+ function parseSelfHostedExternalAssetsConfig(projectRoot) {
76
+ const configPath = resolve(projectRoot, SELF_HOSTED_EXTERNAL_ASSETS_CONFIG);
77
+ if (!existsSync(configPath)) {
78
+ return {
79
+ present: false,
80
+ valid: false,
81
+ path: configPath,
82
+ schema: null,
83
+ mode: null,
84
+ releaseManifestUrl: null,
85
+ };
86
+ }
87
+
88
+ try {
89
+ const parsed = JSON.parse(readFileSync(configPath, 'utf8'));
90
+ const releaseManifestUrl = typeof parsed?.releaseManifestUrl === 'string'
91
+ ? parsed.releaseManifestUrl.trim()
92
+ : '';
93
+ return {
94
+ present: true,
95
+ valid: parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed),
96
+ path: configPath,
97
+ schema: typeof parsed?.schema === 'string' ? parsed.schema : null,
98
+ mode: typeof parsed?.mode === 'string' ? parsed.mode : null,
99
+ releaseManifestUrl: releaseManifestUrl || null,
100
+ };
101
+ } catch {
102
+ return {
103
+ present: true,
104
+ valid: false,
105
+ path: configPath,
106
+ schema: null,
107
+ mode: null,
108
+ releaseManifestUrl: null,
109
+ };
110
+ }
111
+ }
112
+
113
+ function resolveBuildAssetBytes(buildRoot, assetsManifestPath, assetsManifest) {
114
+ if (!assetsManifest || typeof assetsManifest !== 'object') {
115
+ return {
116
+ bytes: 0,
117
+ source: 'assets_manifest_missing',
118
+ };
119
+ }
120
+
121
+ if (assetsManifest.mode === 'embed') {
122
+ const packSize = Number.isFinite(assetsManifest?.pack?.sizeBytes)
123
+ ? assetsManifest.pack.sizeBytes
124
+ : null;
125
+ if (packSize !== null) {
126
+ return {
127
+ bytes: packSize,
128
+ source: 'assets_manifest_pack_size',
129
+ };
130
+ }
131
+
132
+ const packFile = typeof assetsManifest?.pack?.file === 'string' ? assetsManifest.pack.file : null;
133
+ if (packFile) {
134
+ const packPath = resolve(buildRoot, packFile);
135
+ if (existsSync(packPath)) {
136
+ return {
137
+ bytes: statSync(packPath).size,
138
+ source: 'pack_file_stat',
139
+ };
140
+ }
141
+ }
142
+ }
143
+
144
+ if (Array.isArray(assetsManifest.entries)) {
145
+ const bytes = assetsManifest.entries.reduce((total, entry) => {
146
+ const size = Number.isFinite(entry?.sizeBytes) ? entry.sizeBytes : 0;
147
+ return total + size;
148
+ }, 0);
149
+ return {
150
+ bytes,
151
+ source: 'assets_manifest_entries',
152
+ };
153
+ }
154
+
155
+ if (existsSync(assetsManifestPath)) {
156
+ return {
157
+ bytes: statSync(assetsManifestPath).size,
158
+ source: 'assets_manifest_file_only',
159
+ };
160
+ }
161
+
162
+ return {
163
+ bytes: 0,
164
+ source: 'assets_manifest_missing',
165
+ };
166
+ }
167
+
168
+ export function evaluateExternalAssetPolicy({
169
+ projectRoot,
170
+ buildRoot,
171
+ assetsManifestPath,
172
+ assetsManifest,
173
+ assetDir = 'assets',
174
+ env = process.env,
175
+ } = {}) {
176
+ const threshold = resolvePublishAssetThresholdBytes(env);
177
+ const assetRoot = resolve(projectRoot, assetDir || 'assets');
178
+ const sourceAssetBytes = sumDirectoryBytes(assetRoot);
179
+ const buildAssetMeasurement = resolveBuildAssetBytes(buildRoot, assetsManifestPath, assetsManifest);
180
+ const buildAssetBytes = buildAssetMeasurement.bytes;
181
+ const measuredAssetBytes = buildAssetBytes > 0 ? buildAssetBytes : sourceAssetBytes;
182
+ const externalConfig = parseSelfHostedExternalAssetsConfig(projectRoot);
183
+ const overThreshold = measuredAssetBytes > threshold.bytes;
184
+ const hasSelfHostedConfig = externalConfig.present && externalConfig.valid;
185
+ const blocked = overThreshold && !hasSelfHostedConfig;
186
+ const recommendedAction = blocked
187
+ ? 'self_host_assets_then_generate_config'
188
+ : (overThreshold
189
+ ? 'publish_with_self_hosted_external_assets'
190
+ : 'publish_with_embedded_assets');
191
+ const recommendedNextStep = blocked
192
+ ? 'Upload large assets to your own CDN or object storage such as Cloudflare R2 or S3, then generate aura.external-assets.json before publishing.'
193
+ : (overThreshold
194
+ ? 'Self-hosted external asset config detected. Keep the package slim and verify packaged runtime hydration before publishing.'
195
+ : 'Asset payload is within the npm-first threshold. npm-only publish is allowed.');
196
+
197
+ return {
198
+ reasonCode: blocked ? 'publish_asset_threshold_exceeded' : 'publish_asset_threshold_ok',
199
+ assetRoot,
200
+ thresholdBytes: threshold.bytes,
201
+ thresholdSource: threshold.source,
202
+ thresholdEnvValue: threshold.raw,
203
+ sourceAssetBytes,
204
+ buildAssetBytes,
205
+ buildAssetMeasurementSource: buildAssetMeasurement.source,
206
+ assetBytes: measuredAssetBytes,
207
+ measuredAssetBytes,
208
+ measuredAssetSource: buildAssetBytes > 0 ? 'build' : 'source',
209
+ overThreshold,
210
+ blocked,
211
+ allowed: !blocked,
212
+ recommendedAction,
213
+ recommendedNextStep,
214
+ hasSelfHostedConfig,
215
+ selfHostedConfig: externalConfig,
216
+ };
217
+ }
@@ -0,0 +1,206 @@
1
+ import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
2
+ import { tmpdir } from 'node:os';
3
+ import { dirname, join, relative, resolve } from 'node:path';
4
+
5
+ import { SELF_HOSTED_EXTERNAL_ASSETS_CONFIG } from './external-asset-policy.mjs';
6
+
7
+ export const EMBEDDED_PACKAGE_SURFACE_MODE = 'embedded_assets';
8
+ export const SELF_HOSTED_PACKAGE_SURFACE_MODE = 'self_hosted_external_assets';
9
+
10
+ function normalizeRelativePath(pathLike) {
11
+ return String(pathLike || '')
12
+ .trim()
13
+ .replace(/^[.][\\/]/, '')
14
+ .replace(/[\\/]+/g, '/')
15
+ .replace(/\/+$/, '');
16
+ }
17
+
18
+ function pathWithinDirectory(candidatePath, directoryPath) {
19
+ const normalizedCandidate = normalizeRelativePath(candidatePath);
20
+ const normalizedDirectory = normalizeRelativePath(directoryPath);
21
+ if (!normalizedCandidate || !normalizedDirectory) {
22
+ return false;
23
+ }
24
+ return normalizedCandidate === normalizedDirectory || normalizedCandidate.startsWith(`${normalizedDirectory}/`);
25
+ }
26
+
27
+ function shouldCopyPath(sourcePath, {
28
+ projectRoot,
29
+ assetDir,
30
+ excludeAssetDir = false,
31
+ excludedFilePaths = [],
32
+ } = {}) {
33
+ const relativePath = normalizeRelativePath(relative(projectRoot, sourcePath));
34
+ if (!relativePath) {
35
+ return true;
36
+ }
37
+
38
+ const topLevel = relativePath.split('/')[0];
39
+ if (topLevel === '.aura' || topLevel === '.git' || topLevel === 'node_modules') {
40
+ return false;
41
+ }
42
+
43
+ if (excludedFilePaths.some((entry) => relativePath === entry || relativePath.startsWith(`${entry}/`))) {
44
+ return false;
45
+ }
46
+
47
+ if (excludeAssetDir && pathWithinDirectory(relativePath, assetDir)) {
48
+ return false;
49
+ }
50
+
51
+ return true;
52
+ }
53
+
54
+ function buildSelfHostedFilesList(packageFiles, assetDir) {
55
+ if (!Array.isArray(packageFiles)) {
56
+ return null;
57
+ }
58
+
59
+ const filtered = [];
60
+ let hasExternalAssetsConfig = false;
61
+
62
+ for (const entry of packageFiles) {
63
+ if (typeof entry !== 'string' || entry.trim().length === 0) {
64
+ continue;
65
+ }
66
+
67
+ const normalizedEntry = normalizeRelativePath(entry);
68
+ if (normalizedEntry === normalizeRelativePath(SELF_HOSTED_EXTERNAL_ASSETS_CONFIG)) {
69
+ hasExternalAssetsConfig = true;
70
+ filtered.push(entry);
71
+ continue;
72
+ }
73
+
74
+ if (pathWithinDirectory(normalizedEntry, assetDir)) {
75
+ continue;
76
+ }
77
+
78
+ filtered.push(entry);
79
+ }
80
+
81
+ if (!hasExternalAssetsConfig) {
82
+ filtered.push(SELF_HOSTED_EXTERNAL_ASSETS_CONFIG);
83
+ }
84
+
85
+ return filtered;
86
+ }
87
+
88
+ export function inspectPublishPackFiles(
89
+ packFiles,
90
+ {
91
+ assetDir = 'assets',
92
+ externalAssetsConfigPath = SELF_HOSTED_EXTERNAL_ASSETS_CONFIG,
93
+ } = {},
94
+ ) {
95
+ const normalizedConfigPath = normalizeRelativePath(externalAssetsConfigPath);
96
+ return {
97
+ includesAssetPayload: packFiles.some((entry) => pathWithinDirectory(entry?.path, assetDir)),
98
+ includesExternalAssetsConfig: packFiles.some(
99
+ (entry) => normalizeRelativePath(entry?.path) === normalizedConfigPath,
100
+ ),
101
+ };
102
+ }
103
+
104
+ export function preparePublishPackageSurface({
105
+ projectRoot,
106
+ projectPackage,
107
+ assetDir = 'assets',
108
+ assetPolicy = null,
109
+ generatedFilePaths = [],
110
+ generatedFiles = [],
111
+ excludedFilePaths = [],
112
+ } = {}) {
113
+ const normalizedAssetDir = normalizeRelativePath(assetDir || 'assets') || 'assets';
114
+ const normalizedGeneratedFilePaths = [...new Set(
115
+ (Array.isArray(generatedFilePaths) ? generatedFilePaths : [])
116
+ .map((entry) => normalizeRelativePath(entry))
117
+ .filter(Boolean),
118
+ )];
119
+ const normalizedGeneratedFiles = (Array.isArray(generatedFiles) ? generatedFiles : [])
120
+ .map((entry) => {
121
+ const relativePath = normalizeRelativePath(entry?.path);
122
+ if (!relativePath) {
123
+ return null;
124
+ }
125
+ return {
126
+ path: relativePath,
127
+ contents: String(entry?.contents ?? ''),
128
+ };
129
+ })
130
+ .filter(Boolean);
131
+ const normalizedExcludedFilePaths = [...new Set(
132
+ (Array.isArray(excludedFilePaths) ? excludedFilePaths : [])
133
+ .map((entry) => normalizeRelativePath(entry))
134
+ .filter(Boolean),
135
+ )];
136
+ const allGeneratedFilePaths = [...new Set([
137
+ ...normalizedGeneratedFilePaths,
138
+ ...normalizedGeneratedFiles.map((entry) => entry.path),
139
+ ])];
140
+ const usingSelfHostedSurface = assetPolicy?.hasSelfHostedConfig === true;
141
+ const configPath = resolve(projectRoot, SELF_HOSTED_EXTERNAL_ASSETS_CONFIG);
142
+ const shouldStagePublishSurface = usingSelfHostedSurface
143
+ || allGeneratedFilePaths.length > 0
144
+ || normalizedExcludedFilePaths.length > 0;
145
+
146
+ if (!shouldStagePublishSurface) {
147
+ return {
148
+ mode: EMBEDDED_PACKAGE_SURFACE_MODE,
149
+ publishRoot: projectRoot,
150
+ assetDir: normalizedAssetDir,
151
+ externalAssetsConfigPath: SELF_HOSTED_EXTERNAL_ASSETS_CONFIG,
152
+ cleanup() {},
153
+ };
154
+ }
155
+
156
+ if (usingSelfHostedSurface && !existsSync(configPath)) {
157
+ throw new Error(
158
+ `Self-hosted asset package surface requires ${SELF_HOSTED_EXTERNAL_ASSETS_CONFIG} in the project root.`,
159
+ );
160
+ }
161
+
162
+ const publishRoot = mkdtempSync(join(tmpdir(), 'aurajs-publish-surface-'));
163
+ cpSync(projectRoot, publishRoot, {
164
+ recursive: true,
165
+ filter: (sourcePath) => shouldCopyPath(sourcePath, {
166
+ projectRoot,
167
+ assetDir: normalizedAssetDir,
168
+ excludeAssetDir: usingSelfHostedSurface,
169
+ excludedFilePaths: normalizedExcludedFilePaths,
170
+ }),
171
+ });
172
+
173
+ const surfacePackagePath = resolve(publishRoot, 'package.json');
174
+ const surfacePackage = JSON.parse(readFileSync(surfacePackagePath, 'utf8'));
175
+ const nextFiles = usingSelfHostedSurface
176
+ ? buildSelfHostedFilesList(
177
+ Array.isArray(projectPackage?.files) ? projectPackage.files : surfacePackage.files,
178
+ normalizedAssetDir,
179
+ )
180
+ : (Array.isArray(projectPackage?.files) ? [...projectPackage.files] : (Array.isArray(surfacePackage.files) ? [...surfacePackage.files] : null));
181
+ if (Array.isArray(nextFiles)) {
182
+ for (const generatedFilePath of allGeneratedFilePaths) {
183
+ if (!nextFiles.includes(generatedFilePath)) {
184
+ nextFiles.push(generatedFilePath);
185
+ }
186
+ }
187
+ surfacePackage.files = nextFiles;
188
+ writeFileSync(surfacePackagePath, `${JSON.stringify(surfacePackage, null, 2)}\n`, 'utf8');
189
+ }
190
+
191
+ for (const generatedFile of normalizedGeneratedFiles) {
192
+ const outputPath = resolve(publishRoot, generatedFile.path);
193
+ mkdirSync(dirname(outputPath), { recursive: true });
194
+ writeFileSync(outputPath, generatedFile.contents, 'utf8');
195
+ }
196
+
197
+ return {
198
+ mode: usingSelfHostedSurface ? SELF_HOSTED_PACKAGE_SURFACE_MODE : EMBEDDED_PACKAGE_SURFACE_MODE,
199
+ publishRoot,
200
+ assetDir: normalizedAssetDir,
201
+ externalAssetsConfigPath: SELF_HOSTED_EXTERNAL_ASSETS_CONFIG,
202
+ cleanup() {
203
+ rmSync(publishRoot, { recursive: true, force: true });
204
+ },
205
+ };
206
+ }