@vibe-engine/cli 0.0.0-stage → 0.1.1

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 (186) hide show
  1. package/LICENSE-APACHE +202 -0
  2. package/LICENSE-MIT +22 -0
  3. package/README.md +10 -2
  4. package/dist/assets.d.ts +9 -0
  5. package/dist/assets.js +76 -0
  6. package/dist/bin.d.ts +2 -0
  7. package/dist/bin.js +7 -0
  8. package/dist/boundary.d.ts +12 -0
  9. package/dist/boundary.js +63 -0
  10. package/dist/create.d.ts +7 -0
  11. package/dist/create.js +56 -0
  12. package/dist/game-test.d.ts +60 -0
  13. package/dist/game-test.js +129 -0
  14. package/dist/index.d.ts +5 -0
  15. package/dist/index.js +5 -0
  16. package/dist/info.d.ts +41 -0
  17. package/dist/info.js +57 -0
  18. package/dist/main.d.ts +9 -0
  19. package/dist/main.js +106 -0
  20. package/dist/map.d.ts +21 -0
  21. package/dist/map.js +29 -0
  22. package/dist/project.d.ts +74 -0
  23. package/dist/project.js +273 -0
  24. package/dist/registry.d.ts +62 -0
  25. package/dist/registry.js +27 -0
  26. package/dist/run.d.ts +18 -0
  27. package/dist/run.js +132 -0
  28. package/dist/save-store.d.ts +2 -0
  29. package/dist/save-store.js +19 -0
  30. package/dist/serve.d.ts +6 -0
  31. package/dist/serve.js +63 -0
  32. package/dist/source.d.ts +7 -0
  33. package/dist/source.js +20 -0
  34. package/dist/test-run.d.ts +17 -0
  35. package/dist/test-run.js +94 -0
  36. package/dist/vite-plugin.d.ts +17 -0
  37. package/dist/vite-plugin.js +211 -0
  38. package/dist/web.d.ts +32 -0
  39. package/dist/web.js +195 -0
  40. package/package.json +52 -3
  41. package/templates/arena-3d/AGENTS.md +169 -0
  42. package/templates/arena-3d/CLAUDE.md +3 -0
  43. package/templates/arena-3d/README.md +13 -0
  44. package/templates/arena-3d/assets/audio/coin.wav +0 -0
  45. package/templates/arena-3d/assets/fonts/LICENSE-kenney-fonts.txt +23 -0
  46. package/templates/arena-3d/assets/fonts/kenney-future.ttf +0 -0
  47. package/templates/arena-3d/assets/models/LICENSE-kenney-blocky-characters.txt +28 -0
  48. package/templates/arena-3d/assets/models/character.glb +0 -0
  49. package/templates/arena-3d/assets/ui/LICENSE-kenney-ui-pack.txt +23 -0
  50. package/templates/arena-3d/assets/ui/panel.meta.json +1 -0
  51. package/templates/arena-3d/assets/ui/panel.png +0 -0
  52. package/templates/arena-3d/package.json +22 -0
  53. package/templates/arena-3d/src/components/game.component.ts +11 -0
  54. package/templates/arena-3d/src/components/player.component.ts +16 -0
  55. package/templates/arena-3d/src/controls.input.ts +7 -0
  56. package/templates/arena-3d/src/level/build.ts +40 -0
  57. package/templates/arena-3d/src/maps/arena.map.ts +50 -0
  58. package/templates/arena-3d/src/scenes/arena.scene.ts +10 -0
  59. package/templates/arena-3d/src/systems/player-controller.system.ts +46 -0
  60. package/templates/arena-3d/src/systems/rules.system.ts +58 -0
  61. package/templates/arena-3d/src/ui/hud.ui.ts +11 -0
  62. package/templates/arena-3d/tests/arena.test.ts +111 -0
  63. package/templates/arena-3d/vibe.config.ts +21 -0
  64. package/templates/platformer-2d/AGENTS.md +172 -0
  65. package/templates/platformer-2d/CLAUDE.md +3 -0
  66. package/templates/platformer-2d/README.md +17 -0
  67. package/templates/platformer-2d/assets/KENNEY-LICENSE.txt +30 -0
  68. package/templates/platformer-2d/assets/audio/coin.wav +0 -0
  69. package/templates/platformer-2d/assets/audio/enemy-defeat.wav +0 -0
  70. package/templates/platformer-2d/assets/audio/enemy-hit.wav +0 -0
  71. package/templates/platformer-2d/assets/audio/game-over.wav +0 -0
  72. package/templates/platformer-2d/assets/audio/hurt.wav +0 -0
  73. package/templates/platformer-2d/assets/audio/jump.wav +0 -0
  74. package/templates/platformer-2d/assets/audio/level-complete.wav +0 -0
  75. package/templates/platformer-2d/assets/audio/music-theme.wav +0 -0
  76. package/templates/platformer-2d/assets/audio/shoot.wav +0 -0
  77. package/templates/platformer-2d/assets/audio/stomp.wav +0 -0
  78. package/templates/platformer-2d/assets/fonts/LICENSE-kenney-fonts.txt +23 -0
  79. package/templates/platformer-2d/assets/fonts/kenney-pixel.ttf +0 -0
  80. package/templates/platformer-2d/assets/sprites/bullet.png +0 -0
  81. package/templates/platformer-2d/assets/sprites/characters.meta.json +9 -0
  82. package/templates/platformer-2d/assets/sprites/characters.png +0 -0
  83. package/templates/platformer-2d/assets/sprites/heart-empty.png +0 -0
  84. package/templates/platformer-2d/assets/sprites/heart.png +0 -0
  85. package/templates/platformer-2d/assets/sprites/pistol.png +0 -0
  86. package/templates/platformer-2d/assets/sprites/tiles.meta.json +7 -0
  87. package/templates/platformer-2d/assets/sprites/tiles.png +0 -0
  88. package/templates/platformer-2d/assets/ui/button-focus.meta.json +1 -0
  89. package/templates/platformer-2d/assets/ui/button-focus.png +0 -0
  90. package/templates/platformer-2d/assets/ui/button-hover.meta.json +1 -0
  91. package/templates/platformer-2d/assets/ui/button-hover.png +0 -0
  92. package/templates/platformer-2d/assets/ui/button-pressed.meta.json +1 -0
  93. package/templates/platformer-2d/assets/ui/button-pressed.png +0 -0
  94. package/templates/platformer-2d/assets/ui/button.meta.json +1 -0
  95. package/templates/platformer-2d/assets/ui/button.png +0 -0
  96. package/templates/platformer-2d/assets/ui/panel.meta.json +1 -0
  97. package/templates/platformer-2d/assets/ui/panel.png +0 -0
  98. package/templates/platformer-2d/package.json +22 -0
  99. package/templates/platformer-2d/src/components/enemy.component.ts +12 -0
  100. package/templates/platformer-2d/src/components/gun.component.ts +18 -0
  101. package/templates/platformer-2d/src/components/level.component.ts +10 -0
  102. package/templates/platformer-2d/src/components/pickup.component.ts +7 -0
  103. package/templates/platformer-2d/src/components/player.component.ts +25 -0
  104. package/templates/platformer-2d/src/components/shockwave.component.ts +7 -0
  105. package/templates/platformer-2d/src/controls.input.ts +10 -0
  106. package/templates/platformer-2d/src/events/gameplay.events.ts +11 -0
  107. package/templates/platformer-2d/src/level/build.ts +89 -0
  108. package/templates/platformer-2d/src/listeners/feedback.listener.ts +22 -0
  109. package/templates/platformer-2d/src/listeners/particles.listener.ts +21 -0
  110. package/templates/platformer-2d/src/listeners/progress.listener.ts +18 -0
  111. package/templates/platformer-2d/src/listeners/sound-effects.listener.ts +16 -0
  112. package/templates/platformer-2d/src/maps/legend.ts +9 -0
  113. package/templates/platformer-2d/src/maps/level-1.map.ts +22 -0
  114. package/templates/platformer-2d/src/maps/level-2.map.ts +22 -0
  115. package/templates/platformer-2d/src/saves/progress.save.ts +11 -0
  116. package/templates/platformer-2d/src/scenes/level-1.scene.ts +17 -0
  117. package/templates/platformer-2d/src/scenes/level-2.scene.ts +16 -0
  118. package/templates/platformer-2d/src/scenes/main-menu.scene.ts +36 -0
  119. package/templates/platformer-2d/src/systems/contacts.system.ts +74 -0
  120. package/templates/platformer-2d/src/systems/enemy-patrol.system.ts +28 -0
  121. package/templates/platformer-2d/src/systems/gameplay.ts +17 -0
  122. package/templates/platformer-2d/src/systems/gun.system.ts +65 -0
  123. package/templates/platformer-2d/src/systems/hud.system.ts +23 -0
  124. package/templates/platformer-2d/src/systems/pause.system.ts +22 -0
  125. package/templates/platformer-2d/src/systems/player-controller.system.ts +46 -0
  126. package/templates/platformer-2d/src/systems/player-damage.system.ts +61 -0
  127. package/templates/platformer-2d/src/systems/player-juice.system.ts +40 -0
  128. package/templates/platformer-2d/src/systems/shockwave.system.ts +15 -0
  129. package/templates/platformer-2d/src/ui/hud.ui.ts +16 -0
  130. package/templates/platformer-2d/src/ui/main-menu.ui.ts +7 -0
  131. package/templates/platformer-2d/src/ui/pause-menu.ui.ts +12 -0
  132. package/templates/platformer-2d/tests/gameplay.test.ts +492 -0
  133. package/templates/platformer-2d/tests/jump.test.ts +41 -0
  134. package/templates/platformer-2d/vibe.config.ts +32 -0
  135. package/templates/shooter-2d-pvp/AGENTS.md +181 -0
  136. package/templates/shooter-2d-pvp/CLAUDE.md +3 -0
  137. package/templates/shooter-2d-pvp/README.md +14 -0
  138. package/templates/shooter-2d-pvp/assets/KENNEY-LICENSE.txt +30 -0
  139. package/templates/shooter-2d-pvp/assets/audio/enemy-defeat.wav +0 -0
  140. package/templates/shooter-2d-pvp/assets/audio/enemy-hit.wav +0 -0
  141. package/templates/shooter-2d-pvp/assets/audio/game-over.wav +0 -0
  142. package/templates/shooter-2d-pvp/assets/audio/hurt.wav +0 -0
  143. package/templates/shooter-2d-pvp/assets/audio/jump.wav +0 -0
  144. package/templates/shooter-2d-pvp/assets/audio/shoot.wav +0 -0
  145. package/templates/shooter-2d-pvp/assets/fonts/LICENSE-kenney-fonts.txt +23 -0
  146. package/templates/shooter-2d-pvp/assets/fonts/kenney-pixel.ttf +0 -0
  147. package/templates/shooter-2d-pvp/assets/sprites/bullet.png +0 -0
  148. package/templates/shooter-2d-pvp/assets/sprites/characters.meta.json +84 -0
  149. package/templates/shooter-2d-pvp/assets/sprites/characters.png +0 -0
  150. package/templates/shooter-2d-pvp/assets/sprites/heart.png +0 -0
  151. package/templates/shooter-2d-pvp/assets/sprites/pistol.png +0 -0
  152. package/templates/shooter-2d-pvp/assets/sprites/tiles.meta.json +7 -0
  153. package/templates/shooter-2d-pvp/assets/sprites/tiles.png +0 -0
  154. package/templates/shooter-2d-pvp/assets/ui/button-focus.meta.json +1 -0
  155. package/templates/shooter-2d-pvp/assets/ui/button-focus.png +0 -0
  156. package/templates/shooter-2d-pvp/assets/ui/button-hover.meta.json +1 -0
  157. package/templates/shooter-2d-pvp/assets/ui/button-hover.png +0 -0
  158. package/templates/shooter-2d-pvp/assets/ui/button-pressed.meta.json +1 -0
  159. package/templates/shooter-2d-pvp/assets/ui/button-pressed.png +0 -0
  160. package/templates/shooter-2d-pvp/assets/ui/button.meta.json +1 -0
  161. package/templates/shooter-2d-pvp/assets/ui/button.png +0 -0
  162. package/templates/shooter-2d-pvp/assets/ui/panel.meta.json +1 -0
  163. package/templates/shooter-2d-pvp/assets/ui/panel.png +0 -0
  164. package/templates/shooter-2d-pvp/package.json +23 -0
  165. package/templates/shooter-2d-pvp/src/components/fighter.component.ts +33 -0
  166. package/templates/shooter-2d-pvp/src/components/gun.component.ts +49 -0
  167. package/templates/shooter-2d-pvp/src/controls.input.ts +14 -0
  168. package/templates/shooter-2d-pvp/src/events/combat.events.ts +13 -0
  169. package/templates/shooter-2d-pvp/src/level/build.ts +46 -0
  170. package/templates/shooter-2d-pvp/src/listeners/effects.listener.ts +51 -0
  171. package/templates/shooter-2d-pvp/src/listeners/players.listener.ts +32 -0
  172. package/templates/shooter-2d-pvp/src/maps/arena.map.ts +26 -0
  173. package/templates/shooter-2d-pvp/src/rooms/arena.room.ts +22 -0
  174. package/templates/shooter-2d-pvp/src/rules/damage.ts +41 -0
  175. package/templates/shooter-2d-pvp/src/saves/player.save.ts +9 -0
  176. package/templates/shooter-2d-pvp/src/scenes/arena.scene.ts +15 -0
  177. package/templates/shooter-2d-pvp/src/scenes/lobby.scene.ts +11 -0
  178. package/templates/shooter-2d-pvp/src/systems/combat.system.ts +85 -0
  179. package/templates/shooter-2d-pvp/src/systems/fighter-controller.system.ts +54 -0
  180. package/templates/shooter-2d-pvp/src/systems/gun.system.ts +123 -0
  181. package/templates/shooter-2d-pvp/src/systems/lobby.system.ts +52 -0
  182. package/templates/shooter-2d-pvp/src/systems/view.system.ts +35 -0
  183. package/templates/shooter-2d-pvp/src/ui/hud.ui.ts +10 -0
  184. package/templates/shooter-2d-pvp/src/ui/lobby.ui.ts +18 -0
  185. package/templates/shooter-2d-pvp/tests/pvp.test.ts +221 -0
  186. package/templates/shooter-2d-pvp/vibe.config.ts +39 -0
package/LICENSE-APACHE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
package/LICENSE-MIT ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The vibe-engine contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md CHANGED
@@ -1,3 +1,11 @@
1
- # Temporary Holding Version
1
+ # @vibe-engine/cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ vibe CLI: create, dev, run --headless, test, check, build and serve vibe-engine games.
4
+
5
+ Part of [vibe-engine](https://github.com/sergiobanhos/vibe-engine), a TypeScript game engine that is code-first, headless-first and made to be driven by AI agents. Start a game with:
6
+
7
+ ```sh
8
+ npx @vibe-engine/cli create my-game
9
+ ```
10
+
11
+ License: MIT OR Apache-2.0.
@@ -0,0 +1,9 @@
1
+ import { type AssetEntry } from './project.ts';
2
+ export declare const assets: import("./registry.ts").CommandSpec<{
3
+ assets: AssetEntry[];
4
+ }>;
5
+ export declare const check: import("./registry.ts").CommandSpec<{
6
+ ok: true;
7
+ scenes: number;
8
+ assets: number;
9
+ }>;
package/dist/assets.js ADDED
@@ -0,0 +1,76 @@
1
+ /** `vibe assets` e `vibe check`. */
2
+ import { CliError, defineCommand } from './registry.js';
3
+ import { existsSync } from 'node:fs';
4
+ import { join } from 'node:path';
5
+ import { SHADER_PRESETS, shaderProblems, uiThemeAssets } from '@vibe-engine/core';
6
+ import { PROJECT_ERRORS, createWorld, loadProject, walk } from './project.js';
7
+ import { checkBoundaries } from './boundary.js';
8
+ import { withSource } from './source.js';
9
+ export const assets = defineCommand({
10
+ name: 'assets',
11
+ summary: 'List the assets under assets/: id (path without extension), kind, file, size, hash, image size',
12
+ flags: { kind: { type: 'string', doc: 'only this kind: image, model, audio, font, data, tilemap' } },
13
+ output: { assets: 'id, kind, file, bytes, hash, width/height for images, frames/animations for sprite sheets (.meta.json)' },
14
+ errors: { ...PROJECT_ERRORS },
15
+ async run({ flags, io }) {
16
+ const p = await loadProject(io.cwd);
17
+ return { assets: flags.kind ? p.assets.filter((a) => a.kind === flags.kind) : p.assets };
18
+ },
19
+ human({ assets }) {
20
+ if (assets.length === 0)
21
+ return 'no assets (put files under assets/)';
22
+ return assets.map((a) => `${a.id.padEnd(28)} ${a.kind.padEnd(7)} ${String(a.bytes).padStart(7)} B${a.width ? ` ${a.width}x${a.height}` : ''} ${a.hash}${a.frames ? ` ${a.frames} frames${a.animations?.length ? ` · ${a.animations.join(', ')}` : ''}` : ''}`).join('\n');
23
+ },
24
+ });
25
+ export const check = defineCommand({
26
+ name: 'check',
27
+ summary: 'Load the project and every scene (setup + first tick) and report every problem: discovery, assets, ids, setup errors, client/server boundary',
28
+ flags: {},
29
+ output: { ok: 'true when there are no problems', scenes: 'scenes checked', assets: 'assets in the catalog' },
30
+ errors: { ...PROJECT_ERRORS, 'check-failed': 'one or more problems; detail.problems lists each with code (scene-failed, boundary-violation, asset-missing, shader-missing, shader-invalid...), scene and source' },
31
+ async run({ io }) {
32
+ const project = await loadProject(io.cwd); // problema de projeto: um erro só, com o código dele
33
+ const problems = [];
34
+ const shaders = { ...SHADER_PRESETS, ...Object.fromEntries(project.shaders.map((s) => [s.id, s.def])) };
35
+ for (const scene of project.scenes) {
36
+ try {
37
+ const world = await createWorld(project, 1);
38
+ await world.start(scene.id);
39
+ world.step(1);
40
+ // Shaders usados (SpriteShader, PostEffect, MeshShader): id existe, tipo certo, uniforms declarados.
41
+ for (const p of shaderProblems(world, shaders))
42
+ problems.push({ code: p.code, message: p.message, scene: scene.id });
43
+ }
44
+ catch (err) {
45
+ const e = err;
46
+ problems.push({ code: e instanceof CliError ? e.code : 'scene-failed', message: e.message, scene: scene.id, ...withSource(e, io.cwd) });
47
+ }
48
+ }
49
+ for (const ref of uiThemeAssets(project.config.ui ?? {})) {
50
+ const asset = project.assets.find((a) => a.id === ref.id);
51
+ if (ref.kind === 'font') {
52
+ // Sem asset com esse id, o valor é uma família CSS; com cara de caminho, é um asset que falta.
53
+ if (asset ? asset.kind !== 'font' : /^[a-z0-9_.-]+(\/[a-z0-9_.-]+)+$/.test(ref.id))
54
+ problems.push({ code: 'asset-missing', message: `${ref.path}: '${ref.id}' is not a font in assets/ (expected assets/${ref.id}.woff2 or .ttf)`, source: 'vibe.config.ts' });
55
+ }
56
+ else if (!asset || asset.kind !== 'image' || asset.slice === undefined) {
57
+ problems.push({ code: 'asset-missing', message: `${ref.path}: '${ref.id}' must be an image in assets/ with a ${ref.id}.meta.json that has "slice" (9-slice borders)`, source: 'vibe.config.ts' });
58
+ }
59
+ }
60
+ const src = join(io.cwd, 'src');
61
+ for (const b of existsSync(src) ? checkBoundaries(io.cwd, walk(src)) : []) {
62
+ problems.push({ code: 'boundary-violation', message: `${b.file}:${b.line}: ${b.rule} ('${b.target}')`, source: `${b.file}:${b.line}` });
63
+ }
64
+ if (problems.length) {
65
+ throw new CliError('check-failed', `${problems.length} problem${problems.length > 1 ? 's' : ''}`, {
66
+ detail: { problems },
67
+ source: problems[0].source ?? '',
68
+ hint: problems.map((p) => (p.scene ? `${p.scene}: ${p.message}` : p.message)).join(' | '),
69
+ });
70
+ }
71
+ return { ok: true, scenes: project.scenes.length, assets: project.assets.length };
72
+ },
73
+ human(o) {
74
+ return `ok · ${o.scenes} scenes · ${o.assets} assets`;
75
+ },
76
+ });
package/dist/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/bin.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { main } from './main.js';
3
+ process.exitCode = await main(process.argv.slice(2), {
4
+ cwd: process.cwd(),
5
+ stdout: (text) => process.stdout.write(`${text}\n`),
6
+ stderr: (text) => process.stderr.write(`${text}\n`),
7
+ });
@@ -0,0 +1,12 @@
1
+ export type Role = 'client' | 'server' | 'shared';
2
+ export interface BoundaryProblem {
3
+ file: string;
4
+ line: number;
5
+ role: Role;
6
+ /** O import (ou global) proibido. */
7
+ target: string;
8
+ rule: string;
9
+ }
10
+ export declare function roleOf(file: string): Role;
11
+ /** `files`: caminhos absolutos dos `.ts` do jogo (sem testes). */
12
+ export declare function checkBoundaries(root: string, files: string[]): BoundaryProblem[];
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Fronteira client/server/shared (ADR-0003, #16). O papel do arquivo vem do
3
+ * caminho: `client/` ou `*.client.ts` → client; `server/` ou `*.server.ts` →
4
+ * server; o resto (cenas, systems, componentes) é shared e roda nos dois lados.
5
+ * Regras, checadas em cada import direto (o que basta para pegar os transitivos):
6
+ * - shared não importa client nem server, nem pacotes de browser ou de Node;
7
+ * - client não importa server nem módulos do Node;
8
+ * - server não importa client nem pacotes de browser.
9
+ * shared também não usa globais do browser (`document`, `window`...).
10
+ */
11
+ import { readFileSync } from 'node:fs';
12
+ import { dirname, relative, resolve } from 'node:path';
13
+ const BROWSER_PACKAGES = [/^@vibe-engine\/(web|renderer-2d|renderer-3d)(\/|$)/, /^pixi\.js(\/|$)/, /^@babylonjs\//];
14
+ const NODE_MODULES = [/^node:/, /^@vibe-engine\/cli(\/|$)/, /^@vibe-engine\/net\/node$/, /^ws$/];
15
+ const BROWSER_GLOBALS = /(?<![\w.$'"`])(document|window|localStorage|sessionStorage|requestAnimationFrame|navigator|HTMLElement)\s*[.(]/;
16
+ export function roleOf(file) {
17
+ const parts = file.split(/[\\/]/);
18
+ if (parts.includes('client') || file.endsWith('.client.ts'))
19
+ return 'client';
20
+ if (parts.includes('server') || file.endsWith('.server.ts'))
21
+ return 'server';
22
+ return 'shared';
23
+ }
24
+ /** `files`: caminhos absolutos dos `.ts` do jogo (sem testes). */
25
+ export function checkBoundaries(root, files) {
26
+ const problems = [];
27
+ for (const file of files) {
28
+ const role = roleOf(relative(root, file));
29
+ const text = readFileSync(file, 'utf8');
30
+ const lines = text.split('\n');
31
+ const at = (index) => text.slice(0, index).split('\n').length;
32
+ const push = (index, target, rule) => problems.push({ file: relative(root, file), line: at(index), role, target, rule });
33
+ for (const m of text.matchAll(/(?:^|[\s;])(?:import|export)\s[^'"]*?from\s*['"]([^'"]+)['"]|import\s*\(\s*['"]([^'"]+)['"]\s*\)|^\s*import\s*['"]([^'"]+)['"]/gm)) {
34
+ const spec = (m[1] ?? m[2] ?? m[3]);
35
+ if (/^import\s+type\s/.test(m[0].trim()))
36
+ continue; // tipos somem no build
37
+ const index = m.index + m[0].indexOf(spec);
38
+ if (spec.startsWith('.')) {
39
+ const targetRole = roleOf(relative(root, resolve(dirname(file), spec)));
40
+ if (role === 'shared' && targetRole !== 'shared')
41
+ push(index, spec, `shared code cannot import ${targetRole} code (it also runs on the ${targetRole === 'client' ? 'server' : 'client'})`);
42
+ else if (role !== 'shared' && targetRole !== 'shared' && targetRole !== role)
43
+ push(index, spec, `${role} code cannot import ${targetRole} code`);
44
+ continue;
45
+ }
46
+ const browser = BROWSER_PACKAGES.some((r) => r.test(spec));
47
+ const nodeOnly = NODE_MODULES.some((r) => r.test(spec));
48
+ if (browser && role !== 'client')
49
+ push(index, spec, `${role} code cannot import a browser package (move it to client/ or a *.client.ts)`);
50
+ if (nodeOnly && role !== 'server')
51
+ push(index, spec, `${role} code cannot import a Node module (move it to server/ or a *.server.ts)`);
52
+ }
53
+ if (role === 'shared') {
54
+ lines.forEach((line, i) => {
55
+ const code = line.replace(/\/\/.*$/, '').replace(/(['"`]).*?\1/g, '""');
56
+ const g = BROWSER_GLOBALS.exec(code);
57
+ if (g && !/^\s*\*/.test(line))
58
+ problems.push({ file: relative(root, file), line: i + 1, role, target: g[1], rule: `shared code cannot use the browser global '${g[1]}' (it also runs headless and on the server)` });
59
+ });
60
+ }
61
+ }
62
+ return problems;
63
+ }
@@ -0,0 +1,7 @@
1
+ export declare function templateNames(): string[];
2
+ export declare const create: import("./registry.ts").CommandSpec<{
3
+ dir: string;
4
+ template: string;
5
+ files: number;
6
+ next: string[];
7
+ }>;
package/dist/create.js ADDED
@@ -0,0 +1,56 @@
1
+ /** `vibe create <nome>`: projeto novo a partir de um template, pronto para `pnpm install && pnpm dev` (#26). */
2
+ import { cpSync, existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
3
+ import { join, relative, resolve } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { CliError, defineCommand } from './registry.js';
6
+ // Instalada do npm, a CLI traz os templates dentro do pacote e o jogo depende da mesma versão publicada.
7
+ // No checkout da engine, usa `templates/` e liga os pacotes por `link:` (mudanças na engine valem na hora).
8
+ const PKG = fileURLToPath(new URL('../', import.meta.url));
9
+ const ENGINE = fileURLToPath(new URL('../../../', import.meta.url));
10
+ const PUBLISHED = !import.meta.url.endsWith('.ts'); // rodando o dist/ (npm) e não o src/ do checkout
11
+ const TEMPLATES = PUBLISHED ? join(PKG, 'templates') : join(ENGINE, 'templates');
12
+ const VERSION = JSON.parse(readFileSync(join(PKG, 'package.json'), 'utf8')).version;
13
+ const SKIP = new Set(['node_modules', 'dist', '.vite']);
14
+ const NAME = /^[a-z0-9]+(-[a-z0-9]+)*$/;
15
+ export function templateNames() {
16
+ return readdirSync(TEMPLATES, { withFileTypes: true }).filter((e) => e.isDirectory() && existsSync(join(TEMPLATES, e.name, 'vibe.config.ts'))).map((e) => e.name).sort();
17
+ }
18
+ export const create = defineCommand({
19
+ name: 'create',
20
+ summary: 'Create a new game from a template (2D platformer or 3D arena), ready for pnpm install && pnpm dev',
21
+ positionals: [{ name: 'name', doc: 'folder and project name, kebab-case' }],
22
+ flags: { template: { type: 'string', default: 'platformer-2d', doc: 'template: platformer-2d | arena-3d | shooter-2d-pvp' } },
23
+ output: { dir: 'created folder', template: 'template used', files: 'files copied', next: 'commands to run next' },
24
+ errors: { 'name-invalid': 'missing or not kebab-case name', 'template-not-found': 'no template with that name', 'dir-exists': 'the folder already exists and is not empty' },
25
+ async run({ flags, positionals, io }) {
26
+ const name = positionals[0];
27
+ if (!name || !NAME.test(name))
28
+ throw new CliError('name-invalid', name ? `'${name}' is not kebab-case` : 'missing project name', { expected: 'vibe create my-game', hint: 'lowercase letters, digits and dashes' });
29
+ const template = flags.template;
30
+ const names = templateNames();
31
+ if (!names.includes(template))
32
+ throw new CliError('template-not-found', `no template '${template}'`, { expected: names.join(' | ') });
33
+ const dir = resolve(io.cwd, name);
34
+ if (existsSync(dir) && readdirSync(dir).length)
35
+ throw new CliError('dir-exists', `${relative(io.cwd, dir)}/ already exists and is not empty`, { hint: 'pick another name or remove the folder' });
36
+ cpSync(join(TEMPLATES, template), dir, { recursive: true, filter: (src) => !SKIP.has(src.split(/[\\/]/).pop()) });
37
+ const files = readdirSync(dir, { recursive: true, withFileTypes: true }).filter((e) => e.isFile()).length;
38
+ const pkgPath = join(dir, 'package.json');
39
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
40
+ pkg.name = name;
41
+ for (const field of ['dependencies', 'devDependencies']) {
42
+ for (const [dep, spec] of Object.entries(pkg[field] ?? {})) {
43
+ if (spec.startsWith('workspace:') && dep.startsWith('@vibe-engine/'))
44
+ pkg[field][dep] = PUBLISHED ? `^${VERSION}` : `link:${join(ENGINE, 'packages', dep.slice('@vibe-engine/'.length))}`;
45
+ }
46
+ }
47
+ writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
48
+ // O pnpm 10+ segura pacotes recém-publicados (minimumReleaseAge): sem isto, um jogo criado logo depois de uma versão nova da engine não instala.
49
+ if (PUBLISHED)
50
+ writeFileSync(join(dir, 'pnpm-workspace.yaml'), '# Versões novas da engine (@vibe-engine/*) entram na hora; o resto segue a política do pnpm.\nminimumReleaseAgeExclude:\n - "@vibe-engine/*"\n');
51
+ const configPath = join(dir, 'vibe.config.ts');
52
+ writeFileSync(configPath, readFileSync(configPath, 'utf8').replace(/name: '[^']*'/, `name: '${name}'`));
53
+ return { dir: relative(io.cwd, dir) || '.', template, files, next: [`cd ${relative(io.cwd, dir)}`, 'pnpm install', 'pnpm dev'] };
54
+ },
55
+ human: (o) => `created ${o.dir}/ from ${o.template}\n\n${o.next.map((c) => ` ${c}`).join('\n')}\n\nthen: pnpm test · pnpm vibe run --headless · pnpm build`,
56
+ });
@@ -0,0 +1,60 @@
1
+ /**
2
+ * `gameTest`: teste de gameplay headless sobre `node:test` (#36).
3
+ *
4
+ * `game` abre o projeto do arquivo de teste (sobe até achar `vibe.config.ts`),
5
+ * nada avança sem `step`/`hold`/`until`, e uma falha sai com tick, cena, seed,
6
+ * os últimos inputs e eventos — o suficiente para saber o que mudou.
7
+ */
8
+ import { type TestContext } from 'node:test';
9
+ import type { EntityId, EntityRef, EventDef, InputValue, SaveStore, World } from '@vibe-engine/core';
10
+ export interface GameEvent<P = unknown> {
11
+ frame: number;
12
+ name: string;
13
+ payload: P;
14
+ }
15
+ export interface Game {
16
+ /** Abre a cena pausada no frame 0. Padrão: `startScene` do config, seed 1. */
17
+ start(opts?: {
18
+ scene?: string;
19
+ seed?: number;
20
+ saves?: SaveStore;
21
+ }): Promise<World>;
22
+ /** O `World` aberto (lança antes de `start`). */
23
+ readonly world: World;
24
+ readonly frame: number;
25
+ /** Avança N ticks fixos e guarda os eventos emitidos. */
26
+ step(frames?: number): void;
27
+ entity(id: EntityId): EntityRef;
28
+ /** Eventos emitidos desde `start`, em ordem; por definição ou nome. */
29
+ events<P>(event: EventDef<P> | string): GameEvent<P>[];
30
+ /** Avança tick a tick até `pred` ser verdade; falha com o tick se passar de `maxFrames`. */
31
+ until(pred: () => boolean, opts: {
32
+ maxFrames: number;
33
+ }): void;
34
+ readonly input: {
35
+ set(action: string, value: InputValue, player?: string): void;
36
+ /** Aperta por 1 tick (pressed no próximo tick). */
37
+ press(action: string, player?: string): void;
38
+ /** Segura `value` por N ticks (ou até `until`) e solta (false / 0 / [0, 0]). */
39
+ hold(action: string, value: InputValue, opts: {
40
+ frames: number;
41
+ } | {
42
+ until: () => boolean;
43
+ maxFrames: number;
44
+ }, player?: string): void;
45
+ };
46
+ }
47
+ export type GameTestFn = (ctx: {
48
+ game: Game;
49
+ t: TestContext;
50
+ }) => void | Promise<void>;
51
+ /** Como `test` do `node:test`, com `game` pronto. `root` sobrescreve a pasta do projeto. */
52
+ export declare function gameTest(name: string, fn: GameTestFn, opts?: {
53
+ root?: string;
54
+ timeout?: number;
55
+ skip?: boolean;
56
+ only?: boolean;
57
+ }): void;
58
+ export declare function createGame(root: string): Game & {
59
+ context(): string;
60
+ };