@vibe-engine/cli 0.0.0-stage → 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.
- package/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +22 -0
- package/README.md +10 -2
- package/dist/assets.d.ts +9 -0
- package/dist/assets.js +76 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +7 -0
- package/dist/boundary.d.ts +12 -0
- package/dist/boundary.js +63 -0
- package/dist/create.d.ts +7 -0
- package/dist/create.js +53 -0
- package/dist/game-test.d.ts +60 -0
- package/dist/game-test.js +129 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/info.d.ts +41 -0
- package/dist/info.js +57 -0
- package/dist/main.d.ts +9 -0
- package/dist/main.js +106 -0
- package/dist/map.d.ts +21 -0
- package/dist/map.js +29 -0
- package/dist/project.d.ts +74 -0
- package/dist/project.js +273 -0
- package/dist/registry.d.ts +62 -0
- package/dist/registry.js +27 -0
- package/dist/run.d.ts +18 -0
- package/dist/run.js +132 -0
- package/dist/save-store.d.ts +2 -0
- package/dist/save-store.js +19 -0
- package/dist/serve.d.ts +6 -0
- package/dist/serve.js +63 -0
- package/dist/source.d.ts +7 -0
- package/dist/source.js +20 -0
- package/dist/test-run.d.ts +17 -0
- package/dist/test-run.js +94 -0
- package/dist/vite-plugin.d.ts +17 -0
- package/dist/vite-plugin.js +211 -0
- package/dist/web.d.ts +32 -0
- package/dist/web.js +195 -0
- package/package.json +52 -3
- package/templates/arena-3d/AGENTS.md +169 -0
- package/templates/arena-3d/CLAUDE.md +3 -0
- package/templates/arena-3d/README.md +13 -0
- package/templates/arena-3d/assets/audio/coin.wav +0 -0
- package/templates/arena-3d/assets/fonts/LICENSE-kenney-fonts.txt +23 -0
- package/templates/arena-3d/assets/fonts/kenney-future.ttf +0 -0
- package/templates/arena-3d/assets/models/LICENSE-kenney-blocky-characters.txt +28 -0
- package/templates/arena-3d/assets/models/character.glb +0 -0
- package/templates/arena-3d/assets/ui/LICENSE-kenney-ui-pack.txt +23 -0
- package/templates/arena-3d/assets/ui/panel.meta.json +1 -0
- package/templates/arena-3d/assets/ui/panel.png +0 -0
- package/templates/arena-3d/package.json +22 -0
- package/templates/arena-3d/src/components/game.component.ts +11 -0
- package/templates/arena-3d/src/components/player.component.ts +16 -0
- package/templates/arena-3d/src/controls.input.ts +7 -0
- package/templates/arena-3d/src/level/build.ts +40 -0
- package/templates/arena-3d/src/maps/arena.map.ts +50 -0
- package/templates/arena-3d/src/scenes/arena.scene.ts +10 -0
- package/templates/arena-3d/src/systems/player-controller.system.ts +46 -0
- package/templates/arena-3d/src/systems/rules.system.ts +58 -0
- package/templates/arena-3d/src/ui/hud.ui.ts +11 -0
- package/templates/arena-3d/tests/arena.test.ts +111 -0
- package/templates/arena-3d/vibe.config.ts +21 -0
- package/templates/platformer-2d/AGENTS.md +172 -0
- package/templates/platformer-2d/CLAUDE.md +3 -0
- package/templates/platformer-2d/README.md +17 -0
- package/templates/platformer-2d/assets/KENNEY-LICENSE.txt +30 -0
- package/templates/platformer-2d/assets/audio/coin.wav +0 -0
- package/templates/platformer-2d/assets/audio/enemy-defeat.wav +0 -0
- package/templates/platformer-2d/assets/audio/enemy-hit.wav +0 -0
- package/templates/platformer-2d/assets/audio/game-over.wav +0 -0
- package/templates/platformer-2d/assets/audio/hurt.wav +0 -0
- package/templates/platformer-2d/assets/audio/jump.wav +0 -0
- package/templates/platformer-2d/assets/audio/level-complete.wav +0 -0
- package/templates/platformer-2d/assets/audio/music-theme.wav +0 -0
- package/templates/platformer-2d/assets/audio/shoot.wav +0 -0
- package/templates/platformer-2d/assets/audio/stomp.wav +0 -0
- package/templates/platformer-2d/assets/fonts/LICENSE-kenney-fonts.txt +23 -0
- package/templates/platformer-2d/assets/fonts/kenney-pixel.ttf +0 -0
- package/templates/platformer-2d/assets/sprites/bullet.png +0 -0
- package/templates/platformer-2d/assets/sprites/characters.meta.json +9 -0
- package/templates/platformer-2d/assets/sprites/characters.png +0 -0
- package/templates/platformer-2d/assets/sprites/heart-empty.png +0 -0
- package/templates/platformer-2d/assets/sprites/heart.png +0 -0
- package/templates/platformer-2d/assets/sprites/pistol.png +0 -0
- package/templates/platformer-2d/assets/sprites/tiles.meta.json +7 -0
- package/templates/platformer-2d/assets/sprites/tiles.png +0 -0
- package/templates/platformer-2d/assets/ui/button-focus.meta.json +1 -0
- package/templates/platformer-2d/assets/ui/button-focus.png +0 -0
- package/templates/platformer-2d/assets/ui/button-hover.meta.json +1 -0
- package/templates/platformer-2d/assets/ui/button-hover.png +0 -0
- package/templates/platformer-2d/assets/ui/button-pressed.meta.json +1 -0
- package/templates/platformer-2d/assets/ui/button-pressed.png +0 -0
- package/templates/platformer-2d/assets/ui/button.meta.json +1 -0
- package/templates/platformer-2d/assets/ui/button.png +0 -0
- package/templates/platformer-2d/assets/ui/panel.meta.json +1 -0
- package/templates/platformer-2d/assets/ui/panel.png +0 -0
- package/templates/platformer-2d/package.json +22 -0
- package/templates/platformer-2d/src/components/enemy.component.ts +12 -0
- package/templates/platformer-2d/src/components/gun.component.ts +18 -0
- package/templates/platformer-2d/src/components/level.component.ts +10 -0
- package/templates/platformer-2d/src/components/pickup.component.ts +7 -0
- package/templates/platformer-2d/src/components/player.component.ts +25 -0
- package/templates/platformer-2d/src/components/shockwave.component.ts +7 -0
- package/templates/platformer-2d/src/controls.input.ts +10 -0
- package/templates/platformer-2d/src/events/gameplay.events.ts +11 -0
- package/templates/platformer-2d/src/level/build.ts +89 -0
- package/templates/platformer-2d/src/listeners/feedback.listener.ts +22 -0
- package/templates/platformer-2d/src/listeners/particles.listener.ts +21 -0
- package/templates/platformer-2d/src/listeners/progress.listener.ts +18 -0
- package/templates/platformer-2d/src/listeners/sound-effects.listener.ts +16 -0
- package/templates/platformer-2d/src/maps/legend.ts +9 -0
- package/templates/platformer-2d/src/maps/level-1.map.ts +22 -0
- package/templates/platformer-2d/src/maps/level-2.map.ts +22 -0
- package/templates/platformer-2d/src/saves/progress.save.ts +11 -0
- package/templates/platformer-2d/src/scenes/level-1.scene.ts +17 -0
- package/templates/platformer-2d/src/scenes/level-2.scene.ts +16 -0
- package/templates/platformer-2d/src/scenes/main-menu.scene.ts +36 -0
- package/templates/platformer-2d/src/systems/contacts.system.ts +74 -0
- package/templates/platformer-2d/src/systems/enemy-patrol.system.ts +28 -0
- package/templates/platformer-2d/src/systems/gameplay.ts +17 -0
- package/templates/platformer-2d/src/systems/gun.system.ts +65 -0
- package/templates/platformer-2d/src/systems/hud.system.ts +23 -0
- package/templates/platformer-2d/src/systems/pause.system.ts +22 -0
- package/templates/platformer-2d/src/systems/player-controller.system.ts +46 -0
- package/templates/platformer-2d/src/systems/player-damage.system.ts +61 -0
- package/templates/platformer-2d/src/systems/player-juice.system.ts +40 -0
- package/templates/platformer-2d/src/systems/shockwave.system.ts +15 -0
- package/templates/platformer-2d/src/ui/hud.ui.ts +16 -0
- package/templates/platformer-2d/src/ui/main-menu.ui.ts +7 -0
- package/templates/platformer-2d/src/ui/pause-menu.ui.ts +12 -0
- package/templates/platformer-2d/tests/gameplay.test.ts +492 -0
- package/templates/platformer-2d/tests/jump.test.ts +41 -0
- package/templates/platformer-2d/vibe.config.ts +32 -0
- package/templates/shooter-2d-pvp/AGENTS.md +181 -0
- package/templates/shooter-2d-pvp/CLAUDE.md +3 -0
- package/templates/shooter-2d-pvp/README.md +14 -0
- package/templates/shooter-2d-pvp/assets/KENNEY-LICENSE.txt +30 -0
- package/templates/shooter-2d-pvp/assets/audio/enemy-defeat.wav +0 -0
- package/templates/shooter-2d-pvp/assets/audio/enemy-hit.wav +0 -0
- package/templates/shooter-2d-pvp/assets/audio/game-over.wav +0 -0
- package/templates/shooter-2d-pvp/assets/audio/hurt.wav +0 -0
- package/templates/shooter-2d-pvp/assets/audio/jump.wav +0 -0
- package/templates/shooter-2d-pvp/assets/audio/shoot.wav +0 -0
- package/templates/shooter-2d-pvp/assets/fonts/LICENSE-kenney-fonts.txt +23 -0
- package/templates/shooter-2d-pvp/assets/fonts/kenney-pixel.ttf +0 -0
- package/templates/shooter-2d-pvp/assets/sprites/bullet.png +0 -0
- package/templates/shooter-2d-pvp/assets/sprites/characters.meta.json +84 -0
- package/templates/shooter-2d-pvp/assets/sprites/characters.png +0 -0
- package/templates/shooter-2d-pvp/assets/sprites/heart.png +0 -0
- package/templates/shooter-2d-pvp/assets/sprites/pistol.png +0 -0
- package/templates/shooter-2d-pvp/assets/sprites/tiles.meta.json +7 -0
- package/templates/shooter-2d-pvp/assets/sprites/tiles.png +0 -0
- package/templates/shooter-2d-pvp/assets/ui/button-focus.meta.json +1 -0
- package/templates/shooter-2d-pvp/assets/ui/button-focus.png +0 -0
- package/templates/shooter-2d-pvp/assets/ui/button-hover.meta.json +1 -0
- package/templates/shooter-2d-pvp/assets/ui/button-hover.png +0 -0
- package/templates/shooter-2d-pvp/assets/ui/button-pressed.meta.json +1 -0
- package/templates/shooter-2d-pvp/assets/ui/button-pressed.png +0 -0
- package/templates/shooter-2d-pvp/assets/ui/button.meta.json +1 -0
- package/templates/shooter-2d-pvp/assets/ui/button.png +0 -0
- package/templates/shooter-2d-pvp/assets/ui/panel.meta.json +1 -0
- package/templates/shooter-2d-pvp/assets/ui/panel.png +0 -0
- package/templates/shooter-2d-pvp/package.json +23 -0
- package/templates/shooter-2d-pvp/src/components/fighter.component.ts +33 -0
- package/templates/shooter-2d-pvp/src/components/gun.component.ts +60 -0
- package/templates/shooter-2d-pvp/src/controls.input.ts +14 -0
- package/templates/shooter-2d-pvp/src/events/combat.events.ts +15 -0
- package/templates/shooter-2d-pvp/src/level/build.ts +46 -0
- package/templates/shooter-2d-pvp/src/listeners/effects.listener.ts +71 -0
- package/templates/shooter-2d-pvp/src/listeners/players.listener.ts +32 -0
- package/templates/shooter-2d-pvp/src/maps/arena.map.ts +26 -0
- package/templates/shooter-2d-pvp/src/rooms/arena.room.ts +22 -0
- package/templates/shooter-2d-pvp/src/rules/damage.ts +56 -0
- package/templates/shooter-2d-pvp/src/saves/player.save.ts +9 -0
- package/templates/shooter-2d-pvp/src/scenes/arena.scene.ts +15 -0
- package/templates/shooter-2d-pvp/src/scenes/lobby.scene.ts +11 -0
- package/templates/shooter-2d-pvp/src/systems/combat.system.ts +95 -0
- package/templates/shooter-2d-pvp/src/systems/fighter-controller.system.ts +54 -0
- package/templates/shooter-2d-pvp/src/systems/gun.system.ts +147 -0
- package/templates/shooter-2d-pvp/src/systems/lobby.system.ts +52 -0
- package/templates/shooter-2d-pvp/src/systems/view.system.ts +35 -0
- package/templates/shooter-2d-pvp/src/ui/hud.ui.ts +10 -0
- package/templates/shooter-2d-pvp/src/ui/lobby.ui.ts +18 -0
- package/templates/shooter-2d-pvp/tests/pvp.test.ts +258 -0
- 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
|
-
#
|
|
1
|
+
# @vibe-engine/cli
|
|
2
2
|
|
|
3
|
-
|
|
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.
|
package/dist/assets.d.ts
ADDED
|
@@ -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
package/dist/bin.js
ADDED
|
@@ -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[];
|
package/dist/boundary.js
ADDED
|
@@ -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
|
+
}
|
package/dist/create.d.ts
ADDED
package/dist/create.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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
|
+
const configPath = join(dir, 'vibe.config.ts');
|
|
49
|
+
writeFileSync(configPath, readFileSync(configPath, 'utf8').replace(/name: '[^']*'/, `name: '${name}'`));
|
|
50
|
+
return { dir: relative(io.cwd, dir) || '.', template, files, next: [`cd ${relative(io.cwd, dir)}`, 'pnpm install', 'pnpm dev'] };
|
|
51
|
+
},
|
|
52
|
+
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`,
|
|
53
|
+
});
|
|
@@ -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
|
+
};
|