cluaupp 1.5.0 → 1.5.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 (323) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +10 -5
  3. package/api/CHANGELOG.md +3 -0
  4. package/api/chat.js +74 -0
  5. package/api/fixtures/roblox/README.md +6 -0
  6. package/api/fixtures/roblox/aux/sample.d.luau +6 -0
  7. package/api/fixtures/roblox/mini/Mini-API-Dump.json +72 -0
  8. package/api/generated/bench-latest.json +39 -0
  9. package/api/generated/capability-profile.json +76 -0
  10. package/api/generated/lsp-index.json +1 -0
  11. package/api/generated/luau/classes.d.luau +11221 -0
  12. package/api/generated/luau/datatypes.d.luau +327 -0
  13. package/api/generated/luau/enums.d.luau +4918 -0
  14. package/api/generated/luau/globals.d.luau +12 -0
  15. package/api/manifests/roblox-target.manifest.json +22 -0
  16. package/api/normalized/roblox-target.profile.json +237461 -0
  17. package/api/overrides/classes.json +8 -0
  18. package/api/overrides/compatibility.json +9 -0
  19. package/api/overrides/datatypes.json +1579 -0
  20. package/api/overrides/enums.json +8 -0
  21. package/api/overrides/globals.json +8 -0
  22. package/api/overrides/type-mappings.json +9 -0
  23. package/api/roblox-api.lock.json +9 -0
  24. package/data/Mini-API-Dump.json +1 -0
  25. package/editors/vscode/README.md +12 -10
  26. package/editors/vscode/extension.js +82 -0
  27. package/editors/vscode/icons/axiom.svg +4 -0
  28. package/editors/vscode/icons/bloom.svg +5 -0
  29. package/editors/vscode/icons/helm.svg +4 -0
  30. package/editors/vscode/icons/hive.svg +5 -0
  31. package/editors/vscode/icons/mint.svg +4 -0
  32. package/editors/vscode/icons/shift.svg +6 -0
  33. package/editors/vscode/language-configuration-schema.json +24 -0
  34. package/editors/vscode/package.json +172 -12
  35. package/editors/vscode/snippets/axiom.json +12 -0
  36. package/editors/vscode/snippets/bloom.json +12 -0
  37. package/editors/vscode/snippets/helm.json +12 -0
  38. package/editors/vscode/snippets/hive.json +12 -0
  39. package/editors/vscode/snippets/mint.json +12 -0
  40. package/editors/vscode/snippets/shift.json +17 -0
  41. package/editors/vscode/syntaxes/axiom.tmLanguage.json +5 -0
  42. package/editors/vscode/syntaxes/bloom.tmLanguage.json +5 -0
  43. package/editors/vscode/syntaxes/helm.tmLanguage.json +5 -0
  44. package/editors/vscode/syntaxes/hive.tmLanguage.json +5 -0
  45. package/editors/vscode/syntaxes/mint.tmLanguage.json +5 -0
  46. package/editors/vscode/syntaxes/schema.tmLanguage.json +89 -0
  47. package/editors/vscode/syntaxes/shift.tmLanguage.json +5 -0
  48. package/examples/game/.cluaupp/compile-cache/ReplicatedStorage__Shared__Constants__Datas__TemplateData.clh.json +1 -0
  49. package/examples/game/.cluaupp/compile-cache/ServerScriptService__Boot__DataBoot.server.clpp.json +1 -0
  50. package/examples/game/.cluaupp/compile-cache/ServerScriptService__Configuration__ServerConfig.clp.json +1 -0
  51. package/examples/game/.cluaupp/compile-cache/ServerScriptService__Handlers__Guard.server.clpp.json +1 -0
  52. package/examples/game/.cluaupp/compile-cache/ServerScriptService__Handlers__PlayerHandler.server.clpp.json +1 -0
  53. package/examples/game/.cluaupp/compile-cache/StarterPlayer__StarterCharacterScripts__Character__CharacterReady.client.clpp.json +1 -0
  54. package/examples/game/.cluaupp/compile-cache/StarterPlayer__StarterPlayerScripts__Controllers__DataController.client.clpp.json +1 -0
  55. package/examples/game/.cluaupp/compile-cache/index.json +12 -0
  56. package/examples/game/.cluaupp/datamodel-profile.json +94 -0
  57. package/examples/game/.vscode/settings.json +12 -1
  58. package/examples/game/include/clpp/datatypes.clh +337 -373
  59. package/examples/game/include/clpp/generated/datamodel.clh +25 -0
  60. package/examples/game/include/clpp/generated/enums.clh +1 -1
  61. package/examples/game/include/clpp/generated/instances.clh +41135 -41064
  62. package/examples/game/include/clpp/libs/axiom.clh +1 -1
  63. package/examples/game/include/clpp/libs/math.clh +14 -0
  64. package/examples/game/include/clpp/libs/spring.clh +17 -0
  65. package/examples/game/include/clpp/libs/ward.clh +1 -0
  66. package/examples/game/include/clpp/roblox.clh +3 -4
  67. package/examples/game/libs/ArrayIndexer/init.luau +209 -0
  68. package/examples/game/libs/Axiom/init.luau +608 -0
  69. package/examples/game/libs/Bloom/init.luau +433 -0
  70. package/examples/game/libs/Coil/init.luau +215 -0
  71. package/examples/game/libs/Crest/init.luau +426 -0
  72. package/examples/game/libs/Echo/init.luau +417 -0
  73. package/examples/game/libs/Ember/init.luau +365 -0
  74. package/examples/game/libs/Flare/init.luau +717 -0
  75. package/examples/game/libs/Gleam/init.luau +729 -0
  76. package/examples/game/libs/Guide/init.luau +215 -0
  77. package/examples/game/libs/Helm/init.luau +377 -0
  78. package/examples/game/libs/Hive/init.luau +241 -0
  79. package/examples/game/libs/Keep/Client.luau +114 -0
  80. package/examples/game/libs/Keep/Data.luau +883 -0
  81. package/examples/game/libs/Keep/Engine.luau +211 -0
  82. package/examples/game/libs/Keep/Enum.luau +6 -0
  83. package/examples/game/libs/Keep/Enums.luau +10 -0
  84. package/examples/game/libs/Keep/Path.luau +236 -0
  85. package/examples/game/libs/Keep/Replicator.luau +298 -0
  86. package/examples/game/libs/Keep/Server.luau +251 -0
  87. package/examples/game/libs/Keep/Store.luau +652 -0
  88. package/examples/game/libs/Keep/Trade.luau +455 -0
  89. package/examples/game/libs/Keep/init.luau +205 -0
  90. package/examples/game/libs/Lens/init.luau +609 -0
  91. package/examples/game/libs/Mint/init.luau +279 -0
  92. package/examples/game/libs/Net/init.luau +156 -0
  93. package/examples/game/libs/Net/src/codec.luau +224 -0
  94. package/examples/game/libs/Occlude/init.luau +117 -0
  95. package/examples/game/libs/Pin/init.luau +309 -0
  96. package/examples/game/libs/Promise/LICENSE +21 -0
  97. package/examples/game/libs/Promise/_impl/LICENSE +21 -0
  98. package/examples/game/libs/Promise/_impl/init.lua +1991 -0
  99. package/examples/game/libs/Promise/init.lua +1990 -0
  100. package/examples/game/libs/Promise/init.luau +13 -0
  101. package/examples/game/libs/Promise/types.luau +46 -0
  102. package/examples/game/libs/Roster/init.luau +686 -0
  103. package/examples/game/libs/SOURCES.md +31 -0
  104. package/examples/game/libs/Shift/init.luau +238 -0
  105. package/examples/game/libs/Spark/init.luau +487 -0
  106. package/examples/game/libs/Stage/init.luau +178 -0
  107. package/examples/game/libs/Sweep/init.luau +259 -0
  108. package/examples/game/libs/Trace/init.luau +213 -0
  109. package/examples/game/libs/Ward/init.luau +211 -0
  110. package/examples/game/out/ReplicatedStorage/Shared/Constants/Datas/TemplateData.luau +29 -0
  111. package/examples/game/out/ReplicatedStorage/Shared/Constants/Datas/TemplateData.luau.map.json +13 -0
  112. package/examples/game/out/ReplicatedStorage/Shared/Net/Net.luau +83 -0
  113. package/examples/game/out/ReplicatedStorage/Shared/Net/Net.luau.map.json +13 -0
  114. package/examples/game/out/ServerScriptService/Boot/DataBoot.server.luau +18 -0
  115. package/examples/game/out/ServerScriptService/Boot/DataBoot.server.luau.map.json +13 -0
  116. package/examples/game/out/ServerScriptService/Configuration/ServerConfig.luau +14 -0
  117. package/examples/game/out/ServerScriptService/Configuration/ServerConfig.luau.map.json +13 -0
  118. package/examples/game/out/ServerScriptService/Handlers/Guard.server.luau +15 -0
  119. package/examples/game/out/ServerScriptService/Handlers/Guard.server.luau.map.json +13 -0
  120. package/examples/game/out/ServerScriptService/Handlers/PlayerHandler.server.luau +50 -0
  121. package/examples/game/out/ServerScriptService/Handlers/PlayerHandler.server.luau.map.json +13 -0
  122. package/examples/game/out/StarterPlayer/StarterCharacterScripts/Character/CharacterReady.client.luau +12 -0
  123. package/examples/game/out/StarterPlayer/StarterCharacterScripts/Character/CharacterReady.client.luau.map.json +13 -0
  124. package/examples/game/out/StarterPlayer/StarterPlayerScripts/Controllers/DataController.client.luau +16 -0
  125. package/examples/game/out/StarterPlayer/StarterPlayerScripts/Controllers/DataController.client.luau.map.json +13 -0
  126. package/examples/game/src/ReplicatedStorage/Shared/Net/Net.clh +26 -0
  127. package/examples/game/src/ServerScriptService/Boot/DataBoot.server.clpp +1 -1
  128. package/examples/game/src/ServerScriptService/Handlers/PlayerHandler.server.clpp +1 -1
  129. package/examples/game/stylua.toml +9 -0
  130. package/generated/api/build-profile.js +115 -0
  131. package/generated/api/cache.js +44 -0
  132. package/generated/api/coverage.js +32 -0
  133. package/generated/api/diff.js +125 -0
  134. package/generated/api/generators/clpp-headers.js +353 -0
  135. package/generated/api/generators/docs-reference.js +7 -0
  136. package/generated/api/generators/lsp-index.js +81 -0
  137. package/generated/api/generators/luau-defs.js +94 -0
  138. package/generated/api/ide.js +76 -0
  139. package/generated/api/identifier.js +47 -0
  140. package/generated/api/index.js +324 -0
  141. package/generated/api/loader.js +57 -0
  142. package/generated/api/merge.js +88 -0
  143. package/generated/api/model.js +5 -0
  144. package/generated/api/normalize.js +231 -0
  145. package/generated/api/overrides-validate.js +58 -0
  146. package/generated/api/perf.js +12 -0
  147. package/generated/api/registry.js +136 -0
  148. package/generated/api/release.js +44 -0
  149. package/generated/api/resolver.js +250 -0
  150. package/generated/api/sources/aux-types-diff.js +75 -0
  151. package/generated/api/sources/client-tracker.js +11 -0
  152. package/generated/api/sources/creator-docs.js +42 -0
  153. package/generated/api/sources/luau-types.js +34 -0
  154. package/generated/api/sources/mini-dump.js +17 -0
  155. package/generated/api/sources/studio-api.js +8 -0
  156. package/generated/api/sources/studio-apiv2.js +11 -0
  157. package/generated/api/sources/studio-full-api.js +8 -0
  158. package/generated/api/studio-smoke.js +80 -0
  159. package/generated/api/type-parse.js +49 -0
  160. package/generated/api/understander.js +51 -0
  161. package/generated/api/validate.js +135 -0
  162. package/generated/api-cli.js +421 -0
  163. package/generated/cli.js +16 -5
  164. package/generated/clpp/contract.js +3 -3
  165. package/generated/clpp/format-luau.js +236 -0
  166. package/generated/clpp/index.js +13 -1
  167. package/generated/clpp/modules.js +227 -0
  168. package/generated/clpp/postprocess.js +86 -5
  169. package/generated/clpp/rewrite-janitor.js +145 -0
  170. package/generated/clpp/runner.js +14 -2
  171. package/generated/compile.js +82 -0
  172. package/generated/flare/parse.js +12 -1
  173. package/generated/intellisense.js +57 -1
  174. package/generated/native/index.js +217 -16
  175. package/generated/target/authority-check.js +136 -0
  176. package/generated/target/authority-graph.js +74 -0
  177. package/generated/target/build-cache.js +112 -0
  178. package/generated/target/capabilities.js +89 -0
  179. package/generated/target/capability-profile.js +30 -0
  180. package/generated/target/component-contracts.js +60 -0
  181. package/generated/target/context-check.js +160 -0
  182. package/generated/target/datamodel-check.js +170 -0
  183. package/generated/target/datamodel-generate.js +74 -0
  184. package/generated/target/datamodel.js +233 -0
  185. package/generated/target/diagnostics.js +63 -0
  186. package/generated/target/doctor.js +152 -0
  187. package/generated/target/flare-version.js +58 -0
  188. package/generated/target/get-service.js +69 -0
  189. package/generated/target/lifetime-check.js +47 -0
  190. package/generated/target/luau-stamp.js +39 -0
  191. package/generated/target/optimizer-advise.js +88 -0
  192. package/generated/target/optimizer-apply.js +44 -0
  193. package/generated/target/optimizer-soa.js +254 -0
  194. package/generated/target/parallel-check.js +136 -0
  195. package/generated/target/pgo.js +148 -0
  196. package/generated/target/project-docs.js +69 -0
  197. package/generated/target/project-graph.js +71 -0
  198. package/generated/target/roblox.js +63 -0
  199. package/generated/target/security-check.js +41 -0
  200. package/generated/target/source-map.js +25 -0
  201. package/generated/target/studio-bridge.js +112 -0
  202. package/generated/utils/project.js +178 -8
  203. package/generated/utils/rojo-mapper.js +11 -3
  204. package/include/clpp/datatypes.clh +337 -373
  205. package/include/clpp/generated/enums.clh +1 -1
  206. package/include/clpp/generated/instances.clh +41135 -41064
  207. package/include/clpp/libs/axiom.clh +1 -1
  208. package/include/clpp/libs/hive.clh +1 -0
  209. package/include/clpp/libs/keep.clh +2 -0
  210. package/include/clpp/libs/math.clh +14 -0
  211. package/include/clpp/libs/spring.clh +17 -0
  212. package/include/clpp/libs/ward.clh +1 -0
  213. package/include/clpp/roblox.clh +3 -4
  214. package/package.json +10 -3
  215. package/plugins/CluauppNav/Plugin.luau +207 -0
  216. package/plugins/CluauppNav/ProfileLogger.luau +27 -0
  217. package/plugins/CluauppNav/README.md +24 -0
  218. package/runtime/Axiom/init.luau +10 -7
  219. package/runtime/Coil/init.luau +8 -2
  220. package/runtime/Crest/init.luau +1 -0
  221. package/runtime/Flare/init.luau +2 -1
  222. package/runtime/Gleam/init.luau +15 -4
  223. package/runtime/Hive/init.luau +36 -14
  224. package/runtime/Pin/init.luau +5 -2
  225. package/runtime/Roster/init.luau +2 -0
  226. package/runtime/Spark/init.luau +3 -0
  227. package/runtime/Sweep/init.luau +2 -0
  228. package/runtime/Trace/init.luau +3 -0
  229. package/runtime/Ward/init.luau +38 -5
  230. package/scripts/postinstall-editor.js +17 -0
  231. package/skills/README.md +13 -0
  232. package/skills/clpp-hive-flare/SKILL.md +79 -0
  233. package/skills/clpp-language/SKILL.md +123 -0
  234. package/skills/clpp-language/compiler.md +89 -0
  235. package/skills/clpp-style/SKILL.md +95 -0
  236. package/src/api/build-profile.ts +138 -0
  237. package/src/api/cache.ts +45 -0
  238. package/src/api/coverage.ts +46 -0
  239. package/src/api/diff.ts +143 -0
  240. package/src/api/generators/clpp-headers.ts +377 -0
  241. package/src/api/generators/docs-reference.ts +11 -0
  242. package/src/api/generators/lsp-index.ts +106 -0
  243. package/src/api/generators/luau-defs.ts +98 -0
  244. package/src/api/ide.ts +87 -0
  245. package/src/api/identifier.ts +47 -0
  246. package/src/api/index.ts +269 -0
  247. package/src/api/loader.ts +60 -0
  248. package/src/api/merge.ts +126 -0
  249. package/src/api/model.ts +283 -0
  250. package/src/api/normalize.ts +257 -0
  251. package/src/api/overrides-validate.ts +58 -0
  252. package/src/api/perf.ts +15 -0
  253. package/src/api/registry.ts +162 -0
  254. package/src/api/release.ts +47 -0
  255. package/src/api/resolver.ts +255 -0
  256. package/src/api/sources/aux-types-diff.ts +81 -0
  257. package/src/api/sources/client-tracker.ts +10 -0
  258. package/src/api/sources/creator-docs.ts +37 -0
  259. package/src/api/sources/luau-types.ts +30 -0
  260. package/src/api/sources/mini-dump.ts +50 -0
  261. package/src/api/sources/studio-api.ts +7 -0
  262. package/src/api/sources/studio-apiv2.ts +10 -0
  263. package/src/api/sources/studio-full-api.ts +7 -0
  264. package/src/api/studio-smoke.ts +82 -0
  265. package/src/api/type-parse.ts +48 -0
  266. package/src/api/understander.ts +72 -0
  267. package/src/api/validate.ts +160 -0
  268. package/src/api-cli.ts +493 -0
  269. package/src/api.generated.js +37 -22
  270. package/src/cli.ts +21 -6
  271. package/src/clpp/contract.ts +34 -3
  272. package/src/clpp/format-luau.ts +262 -0
  273. package/src/clpp/index.ts +13 -2
  274. package/src/clpp/modules.ts +252 -0
  275. package/src/clpp/postprocess.ts +100 -5
  276. package/src/clpp/rewrite-janitor.ts +156 -0
  277. package/src/clpp/runner.ts +14 -2
  278. package/src/compile.ts +87 -0
  279. package/src/flare/parse.ts +14 -1
  280. package/src/flare/types.ts +2 -0
  281. package/src/intellisense.ts +58 -1
  282. package/src/native/index.ts +225 -16
  283. package/src/target/authority-check.ts +162 -0
  284. package/src/target/authority-graph.ts +80 -0
  285. package/src/target/build-cache.ts +129 -0
  286. package/src/target/capabilities.ts +115 -0
  287. package/src/target/capability-profile.ts +25 -0
  288. package/src/target/component-contracts.ts +64 -0
  289. package/src/target/context-check.ts +177 -0
  290. package/src/target/datamodel-check.ts +188 -0
  291. package/src/target/datamodel-generate.ts +78 -0
  292. package/src/target/datamodel.ts +261 -0
  293. package/src/target/diagnostics.ts +67 -0
  294. package/src/target/doctor.ts +171 -0
  295. package/src/target/flare-version.ts +61 -0
  296. package/src/target/get-service.ts +85 -0
  297. package/src/target/lifetime-check.ts +45 -0
  298. package/src/target/luau-stamp.ts +33 -0
  299. package/src/target/optimizer-advise.ts +93 -0
  300. package/src/target/optimizer-apply.ts +63 -0
  301. package/src/target/optimizer-soa.ts +270 -0
  302. package/src/target/parallel-check.ts +135 -0
  303. package/src/target/pgo.ts +157 -0
  304. package/src/target/project-docs.ts +68 -0
  305. package/src/target/project-graph.ts +75 -0
  306. package/src/target/roblox.ts +78 -0
  307. package/src/target/security-check.ts +40 -0
  308. package/src/target/source-map.ts +36 -0
  309. package/src/target/studio-bridge.ts +140 -0
  310. package/src/types.ts +14 -0
  311. package/src/utils/project.ts +183 -9
  312. package/src/utils/rojo-mapper.ts +12 -3
  313. package/stylua.toml +9 -0
  314. package/templates/game/.vscode/settings.json +7 -1
  315. package/templates/game/include/clpp/datatypes.clh +337 -373
  316. package/templates/game/include/clpp/generated/enums.clh +1 -1
  317. package/templates/game/include/clpp/generated/instances.clh +41135 -41064
  318. package/templates/game/include/clpp/libs/axiom.clh +1 -1
  319. package/templates/game/include/clpp/libs/ward.clh +1 -0
  320. package/templates/game/include/clpp/roblox.clh +3 -4
  321. package/templates/game/src/ServerScriptService/Boot/DataBoot.server.clpp +1 -1
  322. package/templates/game/src/ServerScriptService/Handlers/PlayerHandler.server.clpp +1 -1
  323. package/templates/game/stylua.toml +9 -0
@@ -179,6 +179,9 @@ function Trace.builder()
179
179
  local builder = {}
180
180
 
181
181
  function builder:MaxDepth(depth: number)
182
+ if typeof(depth) ~= "number" then
183
+ return self
184
+ end
182
185
  maxDepth = math.max(0, depth)
183
186
  return self
184
187
  end
@@ -3,6 +3,7 @@
3
3
  --!strict
4
4
  -- Ward — server anti-cheat primitives. Rate-limit remotes, cap packet size,
5
5
  -- strike on speed/teleport. Does not write Keep; Keep stays server-only.
6
+ -- cluaupp: spawn grace / ignore falls / no Studio kick unless KickInStudio
6
7
 
7
8
  local Players = game:GetService("Players")
8
9
  local RunService = game:GetService("RunService")
@@ -15,10 +16,15 @@ local DEFAULT_BURST = 80
15
16
  local MAX_PACKET = 24 * 1024
16
17
  local MAX_SPEED = 220
17
18
  local MAX_TELEPORT = 80
19
+ local SPAWN_GRACE = 3
20
+ local MIN_DT = 1 / 30
21
+ local FLOOD_AT = 80
18
22
 
19
23
  local Ward = {}
20
24
  Ward.OnStrike = Spark.new()
21
25
  Ward.KickAt = DEFAULT_KICK
26
+ Ward.KickInStudio = false
27
+ Ward.FloodAt = FLOOD_AT
22
28
  Ward.MaxPacketBytes = MAX_PACKET
23
29
  Ward.MaxSpeed = MAX_SPEED
24
30
  Ward.MaxTeleport = MAX_TELEPORT
@@ -36,6 +42,7 @@ type Record = {
36
42
  lastPos: Vector3?,
37
43
  graceUntil: number,
38
44
  reasons: { [string]: number },
45
+ denied: { [string]: number },
39
46
  }
40
47
 
41
48
  local records: { [Player]: Record } = {}
@@ -50,6 +57,7 @@ local function rec(player: Player): Record
50
57
  lastPos = nil,
51
58
  graceUntil = 0,
52
59
  reasons = {},
60
+ denied = {},
53
61
  }
54
62
  records[player] = row
55
63
  end
@@ -84,9 +92,15 @@ function Ward.Allow(player: Player, channel: string, maxPerSec: number?, burst:
84
92
  bucket.last = now
85
93
  bucket.tokens = math.min(bucket.burst, bucket.tokens + elapsed * bucket.maxPerSec)
86
94
  if bucket.tokens < 1 then
87
- Ward.Strike(player, "rate:" .. channel)
95
+ local denied = (row.denied[channel] or 0) + 1
96
+ row.denied[channel] = denied
97
+ if denied >= Ward.FloodAt then
98
+ row.denied[channel] = 0
99
+ Ward.Strike(player, "rate:" .. channel)
100
+ end
88
101
  return false
89
102
  end
103
+ row.denied[channel] = 0
90
104
  bucket.tokens -= 1
91
105
  return true
92
106
  end
@@ -115,7 +129,8 @@ function Ward.Strike(player: Player, reason: string): number
115
129
  local label = if typeof(reason) == "string" and reason ~= "" then reason else "unknown"
116
130
  row.reasons[label] = (row.reasons[label] or 0) + 1
117
131
  Ward.OnStrike:Fire(player, label, row.strikes)
118
- if row.strikes >= Ward.KickAt then
132
+ local studio = RunService:IsStudio()
133
+ if row.strikes >= Ward.KickAt and (not studio or Ward.KickInStudio == true) then
119
134
  player:Kick("Movement or traffic rejected")
120
135
  end
121
136
  return row.strikes
@@ -138,6 +153,15 @@ function Ward.Strikes(player: Player): number
138
153
  return if row then row.strikes else 0
139
154
  end
140
155
 
156
+ local function bindSpawnGrace(player: Player)
157
+ Ward.Grace(player, SPAWN_GRACE)
158
+ player.CharacterAdded:Connect(function()
159
+ local row = rec(player)
160
+ row.lastPos = nil
161
+ Ward.Grace(player, SPAWN_GRACE)
162
+ end)
163
+ end
164
+
141
165
  function Ward.WatchMovement()
142
166
  if watching or not RunService:IsServer() then
143
167
  return
@@ -147,19 +171,24 @@ function Ward.WatchMovement()
147
171
  if dt <= 0 then
148
172
  return
149
173
  end
174
+ local step = math.max(dt, MIN_DT)
150
175
  local now = os.clock()
151
176
  for _, player in Players:GetPlayers() do
152
177
  local character = player.Character
153
178
  local root = character and character:FindFirstChild("HumanoidRootPart")
154
179
  if not (root and root:IsA("BasePart")) then
180
+ rec(player).lastPos = nil
155
181
  continue
156
182
  end
157
183
  local row = rec(player)
158
184
  local pos = root.Position
159
185
  if row.lastPos and now >= row.graceUntil then
160
- local dist = (pos - row.lastPos).Magnitude
161
- local speed = dist / dt
162
- if dist > Ward.MaxTeleport and speed > Ward.MaxSpeed then
186
+ local delta = pos - row.lastPos
187
+ local dist = delta.Magnitude
188
+ local horizontal = Vector3.new(delta.X, 0, delta.Z).Magnitude
189
+ local falling = delta.Y < 0 and horizontal < Ward.MaxTeleport
190
+ local speed = dist / step
191
+ if not falling and dist > Ward.MaxTeleport and speed > Ward.MaxSpeed then
163
192
  Ward.Strike(player, "speed")
164
193
  root.CFrame = CFrame.new(row.lastPos)
165
194
  pos = row.lastPos
@@ -168,6 +197,10 @@ function Ward.WatchMovement()
168
197
  row.lastPos = pos
169
198
  end
170
199
  end)
200
+ for _, player in Players:GetPlayers() do
201
+ bindSpawnGrace(player)
202
+ end
203
+ Players.PlayerAdded:Connect(bindSpawnGrace)
171
204
  Players.PlayerRemoving:Connect(Ward.Clear)
172
205
  end
173
206
 
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ // Runs after npm install / npm install -g. Copies schema IntelliSense into
4
+ // Cursor and VS Code (~/.cursor/extensions, ~/.vscode/extensions).
5
+
6
+ try {
7
+ const { installEditorExtension } = require("../generated/intellisense.js");
8
+ const installed = installEditorExtension();
9
+ if (installed.length > 0) {
10
+ console.log("cluaupp: installed schema IntelliSense (.flare .hive .mint .bloom .helm .shift .axiom)");
11
+ for (const dest of installed) {
12
+ console.log(" ", dest);
13
+ }
14
+ }
15
+ } catch (err) {
16
+ console.warn("cluaupp: editor IntelliSense skip:", err instanceof Error ? err.message : err);
17
+ }
@@ -0,0 +1,13 @@
1
+ # CL++ agent skills
2
+
3
+ Cursor skills that teach the agent how to write CL++ and Cluaupp schemas.
4
+
5
+ `cluaupp init` copies this folder to `.cursor/skills/` in the game.
6
+
7
+ | Skill | When |
8
+ | --- | --- |
9
+ | `clpp-language` | `.clpp` / `.clh` / schemas, compile, accessors |
10
+ | `clpp-style` | professional layout, named callbacks, no leftover diagnostics |
11
+ | `clpp-hive-flare` | Hive ECS + Flare packets, server authority |
12
+
13
+ CL++ highlighting still comes from `clpp setup`. Schema highlighting (`.hive`, `.flare`, …) comes from `cluaupp intellisense`.
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: clpp-hive-flare
3
+ description: Design server-authoritative systems with Hive ECS and Flare packets. Use when editing .hive, .flare, CombatServer, CombatClient, hitboxes, AttackIntent, or when the user mentions Hive, Flare, ECS, snapshot, or hitbox.
4
+ ---
5
+
6
+ # Hive + Flare
7
+
8
+ Server writes Hive columns and owns gameplay. Client sends intent and plays visuals.
9
+
10
+ ## Schema
11
+
12
+ `.hive`:
13
+
14
+ ```
15
+ opt name = PlayerECS
16
+
17
+ component Fighter { i32 userId }
18
+ component Health { i32 current, i32 max }
19
+ component Cooldown { f64 lastHit }
20
+ component Combo { i32 stage }
21
+ component Alive { i32 flag }
22
+ ```
23
+
24
+ `.flare`:
25
+
26
+ ```
27
+ opt name = Net
28
+
29
+ packet AttackIntent() from Client
30
+ packet CombatReady() from Client
31
+ packet CombatHello(i32 entityId, i32 health) from Server
32
+ packet HitResult(Player attacker, Player victim, i32 damage, i32 combo) from Server
33
+ ```
34
+
35
+ Do not edit generated `.clh`. Change the schema and rebuild.
36
+
37
+ ## Authority
38
+
39
+ - One `Schema.New()` on the **server** struct.
40
+ - Map `Player → entity` with `Roster` (`Roster.New()`). Do not write `new Roster()` — CL++ emits `Instance.new("Roster")` and Studio crashes.
41
+ - Allocate ids with `NextEntity` (see clpp-language compiler notes).
42
+ - Client never `Set`s Hive columns. Client stores replica fields from server packets.
43
+ - `Ward.Allow(player, channel, rate, burst)` on every attack remote.
44
+
45
+ ## Hitbox
46
+
47
+ On each accepted click:
48
+
49
+ 1. Client `AttackIntent.FireServer()` then spawn local Part with `CanTouch = false`.
50
+ 2. Server validates alive + cooldown + Ward, advances combo, spawns Part with `CanTouch = true`.
51
+ 3. `Touched` lambda only calls `@this.OnHitboxTouched(...)`.
52
+ 4. `OnHitboxTouched` resolves a player victim, dedupes with `Roster`, then `ApplyHit`.
53
+ 5. `ApplyHit` writes Hive Health, assigns `humanoid.Health`, `HitResult.FireAll`.
54
+
55
+ Destroy hitboxes with `spawn { task::wait(life); hitbox.Destroy(); }`.
56
+
57
+ ## Handshake
58
+
59
+ Client `init`: construct the struct, init fields, bind input, `CombatReady.FireServer()`.
60
+ Server `OnReady`: ensure fighter row, `CombatHello.Fire(player, entity, health)`.
61
+
62
+ ## Includes
63
+
64
+ Server header may include `"ReplicatedStorage/Shared/Net/Net.clh"` and the generated Hive header.
65
+
66
+ Client compiling script includes Net itself:
67
+
68
+ ```clpp
69
+ #include "ReplicatedStorage/Shared/Net/Net.clh"
70
+ #include "../../../ReplicatedStorage/Shared/Services/Combat/CombatClient.clh"
71
+ ```
72
+
73
+ After `cluaupp build`, client Luau must read:
74
+
75
+ ```luau
76
+ const Net = require(ReplicatedStorage.Shared.Net.Net)
77
+ ```
78
+
79
+ If it still says `script.Parent.Parent.Parent.Parent.ReplicatedStorage`, Play will error `ReplicatedStorage is not a valid member of Players`.
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: clpp-language
3
+ description: Write valid CL++ (Cluaupp) that compiles to Luau. Always rebuild and fix unused-parameter and compile errors until cluaupp build is clean. Use when editing .clpp, .clh, .clp, .hive, .flare, .mint, .bloom, .helm, .shift, or .axiom files, compiling with cluaupp/clpp, or when the user mentions CL++, Cluaupp, Hive, or Flare.
4
+ ---
5
+
6
+ # CL++ language
7
+
8
+ CL++ **0.8+** is C++-inspired source that `clpp` emits as Luau. Cluaupp orchestrates Rojo, includes, Hive, and Flare. There is no `int main()`. Scripts enter at `void init()`.
9
+
10
+ Read [compiler.md](compiler.md) before using Hive `Entity` / `Has` / `Despawn`, `Humanoid.TakeDamage`, `Vector3::new`, or `namespace`.
11
+
12
+ ## Files
13
+
14
+ | Source | Runtime |
15
+ | --- | --- |
16
+ | `*.server.clpp` | Script |
17
+ | `*.client.clpp` | LocalScript |
18
+ | untagged `.clpp` / `.clp` | ModuleScript — do not put `init()` unless require should run it |
19
+ | `.clh` in `src/` | types/modules; prefer `import { } from` |
20
+ | `#include <clpp/...>` | IntelliSense only; emits `CluauppLibs` require |
21
+ | `.flare` `.hive` `.mint` `.bloom` `.helm` `.shift` `.axiom` | schemas; do not edit the generated `.clh` |
22
+
23
+ Entry scripts: `#pragma strict` then imports/includes then functions then `void init()`.
24
+ Headers: `#pragma once`, structs, field defaults, method prototypes. Bodies live in `.clpp`.
25
+
26
+ ## Accessors (law)
27
+
28
+ CL++ has no `->`. Instances are `Player player`, never `Player*`.
29
+
30
+ | Write | Meaning |
31
+ | --- | --- |
32
+ | `player.Name` / `player.Kick()` | property / instance method (`.` still passes self) |
33
+ | `player:Kick()` | protected `pcall` form — do not use as normal method call |
34
+ | `task::wait` / `Class::Method` | static, method definition, call on the struct table |
35
+ | `signal~>Connect(fn)` | Sweep janitor Connect |
36
+ | `"hi " .: name` | concat |
37
+ | `expr?` | Result try (not optional chaining) |
38
+ | `Enum.UserInputType.MouseButton1` | enum |
39
+ | `@this` / `@World` / `@janitor` | receiver / field **inside** `Class::Method` only, never in `init()` |
40
+
41
+ Lambdas: `func (Player player) { }`. Not `[]() {}`.
42
+
43
+ ## Modules
44
+
45
+ ```clpp
46
+ import { Wallet } from "./PlayerData.clh";
47
+ import { PlayerData as Data } from "./PlayerData.clh";
48
+ ```
49
+
50
+ No `export` keyword — top-level is importable. Angle `#include <clpp/…>` is host only. Cycles → CLPP1001.
51
+
52
+ Cluaupp host: resolves imports for Rojo/`require`, AUTH001, project graph, and incremental cache deps (`src/clpp/modules.ts`). Prefer `import` for app modules; keep `#include <clpp/libs/…>` for CluauppLibs.
53
+
54
+ ## Option / Result
55
+
56
+ ```clpp
57
+ Result<int, string> r = Ok(1);
58
+ int n = r?;
59
+ match (r) {
60
+ Ok v => { return v; },
61
+ Err e => { return 0; },
62
+ }
63
+ optional<int> o = Some(1);
64
+ ```
65
+
66
+ CLPP0202 = Result→plain assign. CLPP1101 = `?` on non-Result. CLPP1102 = non-exhaustive match.
67
+
68
+ ## Constructs to use
69
+
70
+ ```clpp
71
+ guard (player) else {
72
+ return;
73
+ }
74
+
75
+ spawn {
76
+ task::wait(0.18);
77
+ hitbox.Destroy();
78
+ };
79
+
80
+ for (Player player in players.GetPlayers()) {
81
+ @this.RegisterFighter(player);
82
+ }
83
+
84
+ Part hitbox = new Part(workspace);
85
+ Vector3 size = Vector3(5, 6, 4);
86
+ CFrame offset = CFrame(0, 0, -3.2);
87
+ Color3 color = Color3(1, 0.25, 0.2);
88
+ Players players = GetService<Players>();
89
+ ```
90
+
91
+ ## Constructs that do not exist
92
+
93
+ `namespace` (use `struct`), `->`, `do/while`, C++ `try/catch` (use Result/`?` or `pcall`), `goto`, `Player*`, ISO `std::`, C++ captures `[&]`, invented `export` keyword.
94
+
95
+ `wait()` as a free function is unreliable — use `task::wait` inside `spawn { }`.
96
+ `delay(n, fn)` is unreliable — use `spawn { task::wait(n); ... }`.
97
+
98
+ Reserved Intent (do not teach as shipped): `requires`, `ensures`, `effect`, `newtype`, `unique`, `move`.
99
+
100
+ ## Types and init
101
+
102
+ Prefer `auto` only for `FindFirstChild` / `FindFirstChildWhichIsA` results and Hive worlds (`auto World = PlayerECS.New()`). Method parameters and other struct fields always have a named type (`InputObject`, `Player`). Do not type fields as `HiveWorld` — that name is an IntelliSense stub and is not imported into the generated module. Initialize every field: `int coins = 0;`, never `int coins;`.
103
+ `null` is Luau `nil`.
104
+ `post` / `warn` / `report` → print / warn / error.
105
+
106
+ ## Includes
107
+
108
+ - Prefer `import { Name } from "./X.clh"` for language deps
109
+ - Quoted path from **src root** for generated modules: `#include "ReplicatedStorage/Shared/Net/Net.clh"`
110
+ - Relative quoted `.clh` next to the script: `#include "CombatServer.clh"` (legado / same-stem splice)
111
+ - Never quoted-include Net/Hive generated headers from a Shared `.clh` that a LocalScript also includes — the require path follows the compiling file
112
+ - Library: `#include <clpp/libs/ward.clh>` in the **compiling** `.clpp` if the runtime require must appear in that script
113
+
114
+ ## Fix until clean
115
+
116
+ After writing CL++, run `cluaupp build`. Unused parameters, bad includes, and type errors are blockers — change the code until the compiler is silent. Nested `func` captures do not count as uses; see [compiler.md](compiler.md).
117
+
118
+ ## Layout
119
+
120
+ - Server systems: `src/ServerScriptService/Services/`
121
+ - Client controllers: `src/StarterPlayer/StarterPlayerScripts/Controllers/`
122
+ - Shared types/schemas: `src/ReplicatedStorage/Shared/`
123
+ - If it needs `DataStoreService`, it is server. If it needs `UserInputService`, it is client.
@@ -0,0 +1,89 @@
1
+ # CL++ compiler workarounds
2
+
3
+ These are emit bugs, not style. Prefer the workaround until `clpp` generates a colon call.
4
+
5
+ ## Hive
6
+
7
+ `World.Entity()`, `World.Has(...)`, `World.Despawn(...)` often emit `.Entity()` / `.Has()` / `.Despawn()` (no self).
8
+
9
+ | Need | Write |
10
+ | --- | --- |
11
+ | new id | `int id = @NextEntity; @NextEntity += 1;` |
12
+ | membership | `auto value = @World.Get(entity, Comp); if (!value) return;` |
13
+ | despawn | `@World.Remove(entity, Comp);` per component |
14
+
15
+ `PlayerECS.New()` is authoritative. Only the server writes columns. Client worlds do not spawn rows.
16
+
17
+ Generated `PlayerECS.clh` may contain `namespace PlayerECS`. Do not copy that into hand-written `.clh`. Use the generated names as `PlayerECS.Health`.
18
+
19
+ ## Roblox instances
20
+
21
+ `humanoid.TakeDamage(n)` may emit without colon. Write `humanoid.Health = currentHealth;`.
22
+
23
+ `Vector3::new(x, y, z)` fails semantic check. Write `Vector3(x, y, z)`. Same for `CFrame(...)` and `Color3(...)`.
24
+
25
+ Player-local hitbox offset is CFrame multiply, not LookVector math and not `ToWorldSpace` in source:
26
+
27
+ ```clpp
28
+ return rootPart.CFrame * CFrame(0, 0, @HITBOX_FORWARD);
29
+ ```
30
+
31
+ Native CL++ still emits `.ToWorldSpace(` without colon (`self` becomes the offset at world origin). Cluaupp postprocess rewrites that to `:ToWorldSpace(`. Prefer `*` in source.
32
+
33
+ Cluaupp reindents emitted Luau (tabs). Do not hand-fix `out/` indent.
34
+
35
+ `~>` Connect: Cluaupp hoists the method Sweep to `self.janitor` (one per controller). Hitbox/player binds `LinkToInstance` so they die with that instance. Do not add a second `new Sweep()` next to `~>`.
36
+
37
+ ## Flare
38
+
39
+ `FireAll` on generated packets is a function on the packet table (`api.FireAll`), so `.FireAll(...)` is correct.
40
+
41
+ `Fire` / `FireServer` take self — `.Fire(player, ...)` is the CL++ instance-method form.
42
+
43
+ Connect packets with Sweep: `Net.AttackIntent~>Connect(func (Player player) { @this.OnAttack(player); });`
44
+
45
+ `clpp` emits `require(script.Parent.Parent...ReplicatedStorage.Shared.Net.Net)`. Under `PlayerScripts` that path is `Players.ReplicatedStorage` and crashes. Cluaupp postprocess rewrites those requires to `require(ReplicatedStorage.Shared...)`. After a build, client files must show `game:GetService("ReplicatedStorage")`, never a `script.Parent` chain into `ReplicatedStorage`.
46
+
47
+ Do not put `table.pack(...)` inside a nested `function()` in Flare — `...` is only valid in the vararg function. Pack first, then `pcall`.
48
+
49
+ ## Callbacks
50
+
51
+ Keep `func (...) { }` as a one-line dispatch to a named `Class::Method`. Business logic belongs in the method so `@this` and fields work.
52
+
53
+ Call other methods with a dot on the receiver. `@Name(...)` emits `pcall` (`self:Name`) and hides errors.
54
+
55
+ ```clpp
56
+ hitbox.Touched~>Connect(func (BasePart hitPart) {
57
+ @this.OnHitboxTouched(hitPart, attacker, attackerCharacter, attackerEntity, struckPlayers);
58
+ });
59
+ ```
60
+
61
+ ## Struct export types
62
+
63
+ `auto` on a method parameter emits a nameless type (`input,` with no annotation). Use a real type: `InputObject input`, never `auto input`.
64
+
65
+ `const void Method();` emits `(self: T),` — invalid Luau, missing `-> ()`. Declare procedures as `const bool Method();`, `return false` on guard failure, `return true` at the end.
66
+
67
+ Uninitialized fields emit `nil` in the constructor. Write `int ComboStage = 0;`, never `int ComboStage;`.
68
+
69
+ `auto World` emits `World: any`. Do **not** type the field as `HiveWorld` — that name is only an IntelliSense stub in `hive.clh`. It is not imported into the generated module.
70
+
71
+ Construct with `Roster.New()`. Do not write `new Roster()` — CL++ emits `Instance.new("Roster")`, which is not a Roblox class. Cluaupp also rewrites leftover `Instance.new("Roster")` to `Roster.new()`.
72
+
73
+ ## Unused parameters
74
+
75
+ A name used only inside `func () { }` is unused. The compiler still flags it. Bind it in the outer `guard` (or assign it to a field) so the diagnostic disappears. Do not ignore unused errors.
76
+
77
+ ## Multiline return
78
+
79
+ Do not write `return (` across lines. Split into locals:
80
+
81
+ ```clpp
82
+ bool isMouse = input.UserInputType == Enum.UserInputType.MouseButton1;
83
+ bool isTouch = input.UserInputType == Enum.UserInputType.Touch;
84
+ return isMouse || isTouch;
85
+ ```
86
+
87
+ ## Verify
88
+
89
+ After every edit run `cluaupp build`. If it fails, fix the source and build again. Do not leave unused-parameter, type, or include errors visible. Open the matching `out/**/*.luau` and confirm `require` paths and `:` method calls.
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: clpp-style
3
+ description: Write professional CL++ with small named functions, semantic identifiers, header/script split, and named callbacks. Always fix compiler diagnostics (unused parameters, types) instead of leaving them on screen. Use when refactoring .clpp/.clh, organizing combat or services, extracting lambdas, or when the user asks for código profissional, boa conduta, nomenclatura, or organização.
4
+ ---
5
+
6
+ # CL++ professional style
7
+
8
+ Apply this whenever writing or refactoring CL++.
9
+
10
+ ## Conduct
11
+
12
+ 1. Initialize everything. `int comboStage = 0;`, never an uninitialized local.
13
+ 2. Small functions. One behavior, named after the behavior.
14
+ 3. No magic numbers. `const float HITBOX_LIFE = 0.18;` on the struct.
15
+ 4. Early return. `guard (cond) else { return; }` — no nested pyramids.
16
+ 5. Headers declare, scripts define. Prototypes in `.clh`, bodies in `.clpp`.
17
+ 6. Do not share mutable statics across server and client. Net or Keep, never a shared writeable singleton.
18
+ 7. Procedures are `const bool`, never `const void` — void emits a broken Luau function type. Parameters always have a named type (`InputObject`, not `auto`).
19
+
20
+ ## Callbacks
21
+
22
+ Never put combat/network logic inside `func () { }`.
23
+
24
+ The lambda only forwards to a named method. Call methods as `@this.Name(...)` (dot). `@Name(...)` emits a `pcall` and swallows errors.
25
+
26
+ ```clpp
27
+ hitbox.Touched~>Connect(func (BasePart hitPart) {
28
+ @this.OnHitboxTouched(hitPart, attacker, attackerCharacter, attackerEntity, struckPlayers);
29
+ });
30
+ ```
31
+
32
+ Name event handlers `On` + event: `OnAttack`, `OnHitboxTouched`, `OnCharacterSpawned`, `OnReady`.
33
+ Name binders `Bind` + surface: `BindHitboxTouched`, `BindCombatRemotes`, `BindPlayerSessions`.
34
+ Name factories `Create` / `Spawn` / `Resolve` / `Try`.
35
+
36
+ ## Naming
37
+
38
+ | Kind | Form | Example |
39
+ | --- | --- | --- |
40
+ | struct | PascalCase | `CombatServer` |
41
+ | method | PascalCase verb | `ResolveVictim`, `AdvanceCombo` |
42
+ | local / param | camelCase, role-first | `attackerEntity`, `hitPart`, `struckPlayers` |
43
+ | constant | SCREAMING_SNAKE | `ATTACK_INTERVAL`, `MAX_HEALTH` |
44
+ | player refs | role | `attacker`, `victim`, `player` — not `p`, `plr`, `currentPlayer` unless needed |
45
+ | Hive ids | `*Entity` | `fighterEntity`, `victimEntity` |
46
+
47
+ Do not abbreviate (`hp` → `currentHealth`, `box` → `hitbox`, `gp` → `gameProcessed`).
48
+
49
+ ## Header layout
50
+
51
+ Group prototypes on the struct in this order:
52
+
53
+ 1. Session bind / lifecycle
54
+ 2. Queries (`IsFighterAlive`, `CanAcceptAttack`)
55
+ 3. World writes (`SeedFighter`, `AdvanceCombo`)
56
+ 4. Hitbox
57
+ 5. Damage / replication
58
+
59
+ Keep constants next to the fields they configure.
60
+
61
+ ## Script layout
62
+
63
+ Define methods in the same order as the header. `void init()` only calls binders:
64
+
65
+ ```clpp
66
+ void init() {
67
+ CombatServer::BindPlayerSessions();
68
+ CombatServer::BindCombatRemotes();
69
+ }
70
+ ```
71
+
72
+ ## Includes in a compiling script
73
+
74
+ ```clpp
75
+ #pragma strict
76
+ #include <clpp/roblox.clh>
77
+ #include <clpp/libs/ward.clh>
78
+ #include "CombatServer.clh"
79
+ ```
80
+
81
+ Angled library includes that must emit a `require` belong in the `.clpp`, not only the `.clh`.
82
+
83
+ ## Comments
84
+
85
+ No narration. A name should replace a comment. If a workaround exists, one line pointing at the compiler limitation is enough.
86
+
87
+ ## Never leave errors
88
+
89
+ Diagnostics are work, not a report. Do not stop, explain, or ask while the file still shows errors. Fix, rebuild, fix again until `cluaupp build` exits 0 and the compiling `.clpp` has no unused-parameter / type diagnostics.
90
+
91
+ CL++ does **not** count uses inside a nested `func () { }` as uses of the outer parameters. Mention every parameter in the method body (`guard`) before the lambda.
92
+
93
+ Flare handlers must match the packet arity. If a field is unused, put it in the `guard` — do not drop it from the signature.
94
+
95
+ Truth is `cluaupp build`, not clangd / C++ IntelliSense on `.clpp`. If the editor squiggles but the compiler is clean, ignore the squiggle. If the compiler errors, change the code.