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
@@ -261,15 +261,14 @@ function compileHelm(source, file, defaultName) {
261
261
  id += 1;
262
262
  }
263
263
  const { headerRel, luauRel } = emitPaths(file, name);
264
- const headerFns = commands
265
- .map((cmd) => {
266
- const params = cmd.args.map((arg) => `${arg.type === "i32" ? "int" : arg.type} ${arg.name}`).join(", ");
267
- return `\tvoid ${cmd.name}(${params});`;
268
- })
264
+ const headerCmds = commands
265
+ .map((cmd, index) => `\t// command ${cmd.name} permission ${cmd.permission}\n\tconst int ${cmd.name} = ${index + 1};`)
269
266
  .join("\n");
270
267
  const header = `${headerBanner("helm")}
268
+ #include <clpp/libs/helm.clh>
271
269
  namespace ${name} {
272
- ${headerFns}
270
+ ${headerCmds}
271
+ HelmSession Open(Player player);
273
272
  }
274
273
  `;
275
274
  const rows = commands
@@ -396,7 +395,7 @@ function compileHive(source, file, defaultName) {
396
395
  #include <clpp/libs/hive.clh>
397
396
  namespace ${name} {
398
397
  ${components.map((item, index) => `\tconst int ${item.name} = ${index + 1};`).join("\n")}
399
- HiveWorld New();
398
+ auto New();
400
399
  }
401
400
  `;
402
401
  const rows = components
@@ -418,32 +417,234 @@ return ${name}
418
417
  `;
419
418
  return { headerRel, headerPath: headerRel, header, luauRel, luau };
420
419
  }
420
+ /** Mirrors Axiom.Groups + axiom.clh prototypes for IntelliSense on selected namespaces. */
421
+ const AXIOM_GROUP_DECLS = {
422
+ Scalar: [
423
+ "double Clamp(double value, double min, double max);",
424
+ "double Map(double value, double inMin, double inMax, double outMin, double outMax);",
425
+ "double Wrap(double value, double min, double max);",
426
+ "double Sign(double value);",
427
+ "double Round(double value);",
428
+ "double Round(double value, int digits);",
429
+ "double Snap(double value, double step);",
430
+ "double PingPong(double t, double length);",
431
+ "double Saturate(double value);",
432
+ "double Fract(double value);",
433
+ "double InvLerp(double from, double to, double value);",
434
+ "double Approach(double current, double target, double maxDelta);",
435
+ "bool IsFinite(double value);",
436
+ "double Abs(double value);",
437
+ "double Min(double a, double b);",
438
+ "double Max(double a, double b);",
439
+ "double Pow(double base, double exp);",
440
+ "double Sqrt(double value);",
441
+ "double Cbrt(double value);",
442
+ "double Hypot(double a, double b);",
443
+ "double Log(double value);",
444
+ "double Exp(double value);",
445
+ "double Smoothstep(double edge0, double edge1, double x);",
446
+ "double Smootherstep(double edge0, double edge1, double x);",
447
+ "double Gcd(double a, double b);",
448
+ "double Lcm(double a, double b);",
449
+ "bool IsEven(double value);",
450
+ "bool IsOdd(double value);",
451
+ "double Factorial(double n);",
452
+ "double Scale(double value, int index);",
453
+ ],
454
+ Lerp: [
455
+ "double Lerp(double from, double to, double alpha);",
456
+ "double LerpClamped(double from, double to, double alpha);",
457
+ "Vector2 LerpVector2(Vector2 from, Vector2 to, double alpha);",
458
+ "Vector3 LerpVector3(Vector3 from, Vector3 to, double alpha);",
459
+ "Vector3 LerpVector(Vector3 from, Vector3 to, double alpha);",
460
+ "Color3 LerpColor3(Color3 from, Color3 to, double alpha);",
461
+ "CFrame LerpCFrame(CFrame from, CFrame to, double alpha);",
462
+ "UDim2 LerpUDim2(UDim2 from, UDim2 to, double alpha);",
463
+ "double LerpAngle(double from, double to, double alpha);",
464
+ "double Inverse(double from, double to, double value);",
465
+ ],
466
+ Vector: [
467
+ "Vector3 Project(Vector3 a, Vector3 b);",
468
+ "Vector3 Reject(Vector3 a, Vector3 b);",
469
+ "Vector3 Reflect(Vector3 incident, Vector3 normal);",
470
+ "double Angle(Vector3 a, Vector3 b);",
471
+ "double Distance(Vector3 a, Vector3 b);",
472
+ "double Distance2(Vector2 a, Vector2 b);",
473
+ "CFrame Orthonormal(Vector3 forward);",
474
+ "CFrame Orthonormal(Vector3 forward, Vector3 up);",
475
+ "Vector3 Slerp(Vector3 a, Vector3 b, double t);",
476
+ "CFrame LookAt(Vector3 from, Vector3 look);",
477
+ ],
478
+ CFrame: ["CFrame SlerpCFrame(CFrame a, CFrame b, double t);", "CFrame Flat(CFrame cf);"],
479
+ Easing: [
480
+ "double InSine(double t);",
481
+ "double OutSine(double t);",
482
+ "double InOutSine(double t);",
483
+ "double InQuad(double t);",
484
+ "double OutQuad(double t);",
485
+ "double InOutQuad(double t);",
486
+ "double InCubic(double t);",
487
+ "double OutCubic(double t);",
488
+ "double InOutCubic(double t);",
489
+ "double InQuart(double t);",
490
+ "double OutQuart(double t);",
491
+ "double InOutQuart(double t);",
492
+ "double InQuint(double t);",
493
+ "double OutQuint(double t);",
494
+ "double InOutQuint(double t);",
495
+ "double InExpo(double t);",
496
+ "double OutExpo(double t);",
497
+ "double InOutExpo(double t);",
498
+ "double InCirc(double t);",
499
+ "double OutCirc(double t);",
500
+ "double InOutCirc(double t);",
501
+ "double InBack(double t);",
502
+ "double OutBack(double t);",
503
+ "double InOutBack(double t);",
504
+ "double InElastic(double t);",
505
+ "double OutElastic(double t);",
506
+ "double InOutElastic(double t);",
507
+ "double InBounce(double t);",
508
+ "double OutBounce(double t);",
509
+ "double InOutBounce(double t);",
510
+ "double Linear(double t);",
511
+ ],
512
+ Bezier: [
513
+ "Vector3 CubicBezier(double t, Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3);",
514
+ "Vector3 QuadraticBezier(double t, Vector3 p0, Vector3 p1, Vector3 p2);",
515
+ "CFrame Hover(double elapsed, Vector3 anchor, Vector3 look);",
516
+ "CFrame Float(double elapsed, Vector3 anchor, Vector3 look);",
517
+ "CFrame FloatSpin(double elapsed, CFrame anchor);",
518
+ ],
519
+ Geometry: [
520
+ "bool AabbContains(Vector3 point, Vector3 min, Vector3 max);",
521
+ "bool SphereContains(Vector3 point, Vector3 center, double radius);",
522
+ "Vector3 RayPlane(Vector3 origin, Vector3 dir, Vector3 point, Vector3 normal);",
523
+ "Vector3 Barycentric(Vector3 p, Vector3 a, Vector3 b, Vector3 c);",
524
+ "Vector3 ClosestPointOnSegment(Vector3 p, Vector3 a, Vector3 b);",
525
+ ],
526
+ Trig: [
527
+ "double Deg(double rad);",
528
+ "double Rad(double deg);",
529
+ "double DeltaAngle(double from, double to);",
530
+ "double AngleDiff(double from, double to);",
531
+ "double DeltaAngleDegrees(double from, double to);",
532
+ "double NormalizeAngle(double angle);",
533
+ "double Sin(double x);",
534
+ "double Cos(double x);",
535
+ "double Tan(double x);",
536
+ "double Asin(double x);",
537
+ "double Acos(double x);",
538
+ "double Atan2(double y, double x);",
539
+ ],
540
+ Probability: [
541
+ "double RandomRange(double min, double max);",
542
+ "double Random(double min, double max);",
543
+ "int Weighted(LuaArray<double> weights);",
544
+ "double Gaussian();",
545
+ "double Gaussian(double mean, double std);",
546
+ "double Average(LuaArray<double> values);",
547
+ "double Sum(LuaArray<double> values);",
548
+ ],
549
+ Noise: [
550
+ "double HashU32(double n);",
551
+ "double Value1(double x);",
552
+ "double Value2(double x, double y);",
553
+ "double Value3(double x, double y, double z);",
554
+ ],
555
+ Color: [
556
+ "Color3 FromHSV(double h, double s, double v);",
557
+ "Color3 Contrast(Color3 color, double amount);",
558
+ "Color3 LerpHSV(Color3 a, Color3 b, double t);",
559
+ ],
560
+ };
561
+ function axiomFnDecls() {
562
+ const byFn = {};
563
+ for (const decls of Object.values(AXIOM_GROUP_DECLS)) {
564
+ for (const decl of decls) {
565
+ const match = decl.match(/\b([A-Za-z_][A-Za-z0-9_]*)\s*\(/);
566
+ if (!match) {
567
+ continue;
568
+ }
569
+ const fn = match[1];
570
+ if (!byFn[fn]) {
571
+ byFn[fn] = [];
572
+ }
573
+ byFn[fn].push(decl);
574
+ }
575
+ }
576
+ return byFn;
577
+ }
578
+ const AXIOM_FN_DECLS = axiomFnDecls();
579
+ function axiomHeaderBody(groups, fns, file, lineNo) {
580
+ const decls = [];
581
+ const seen = new Set();
582
+ const pushDecl = (decl) => {
583
+ if (seen.has(decl)) {
584
+ return;
585
+ }
586
+ seen.add(decl);
587
+ decls.push(`\t${decl}`);
588
+ };
589
+ for (const group of groups) {
590
+ const key = Object.keys(AXIOM_GROUP_DECLS).find((name) => name.toLowerCase() === group.toLowerCase());
591
+ if (!key) {
592
+ fail(file, lineNo, `unknown group "${group}" — use Scalar Lerp Vector CFrame Easing Bezier Geometry Trig Probability Noise Color`);
593
+ }
594
+ decls.push(`\t// group ${key}`);
595
+ for (const decl of AXIOM_GROUP_DECLS[key]) {
596
+ pushDecl(decl);
597
+ }
598
+ }
599
+ for (const fn of fns) {
600
+ const key = Object.keys(AXIOM_FN_DECLS).find((name) => name.toLowerCase() === fn.toLowerCase());
601
+ if (!key) {
602
+ fail(file, lineNo, `unknown fn "${fn}" — use a name from axiom.clh (e.g. fn LerpVector2)`);
603
+ }
604
+ decls.push(`\t// fn ${key}`);
605
+ for (const decl of AXIOM_FN_DECLS[key]) {
606
+ pushDecl(decl);
607
+ }
608
+ }
609
+ return decls.join("\n");
610
+ }
421
611
  function compileAxiom(source, file, defaultName) {
422
612
  const { name, lines } = parseOptName(source, file, defaultName);
423
613
  const groups = [];
614
+ const fns = [];
615
+ let lastLine = 1;
424
616
  for (const tagged of lines) {
425
617
  const [lineNoRaw, line] = tagged.split("\t");
426
618
  const lineNo = Number(lineNoRaw);
427
- const match = line.match(new RegExp(`^group\\s+(${IDENT})\\s*$`, "i"));
428
- if (!match) {
429
- fail(file, lineNo, `expected group Scalar`);
619
+ lastLine = lineNo;
620
+ const groupMatch = line.match(new RegExp(`^group\\s+(${IDENT})\\s*$`, "i"));
621
+ if (groupMatch) {
622
+ groups.push(groupMatch[1]);
623
+ continue;
624
+ }
625
+ const fnMatch = line.match(new RegExp(`^fn\\s+(${IDENT})\\s*$`, "i"));
626
+ if (fnMatch) {
627
+ fns.push(fnMatch[1]);
628
+ continue;
430
629
  }
431
- groups.push(match[1]);
630
+ fail(file, lineNo, `expected group Lerp or fn LerpVector2`);
432
631
  }
433
- if (groups.length === 0) {
434
- fail(file, 1, "schema is empty — add group Scalar");
632
+ if (groups.length === 0 && fns.length === 0) {
633
+ fail(file, 1, "schema is empty — add group Lerp or fn LerpVector2");
435
634
  }
635
+ const body = axiomHeaderBody(groups, fns, file, lastLine);
636
+ const selectArgs = [...groups, ...fns].map((item) => `"${item}"`).join(", ");
436
637
  const { headerRel, luauRel } = emitPaths(file, name);
437
638
  const header = `${headerBanner("axiom")}
438
639
  #include <clpp/libs/axiom.clh>
439
640
  namespace ${name} {
440
- ${groups.map((group) => `\t// group ${group}`).join("\n")}
641
+ ${body}
441
642
  }
442
643
  `;
443
644
  const luau = `${luauBanner()}local ReplicatedStorage = game:GetService("ReplicatedStorage")
444
645
  local Axiom = require(ReplicatedStorage.CluauppLibs.Axiom)
445
- local ${name} = Axiom.Select({ ${groups.map((group) => `"${group}"`).join(", ")} })
446
- -- out/ only binds groups: ${groups.join(", ")}
646
+ local ${name} = Axiom.Select({ ${selectArgs} })
647
+ -- out/ binds: ${[...groups.map((g) => `group ${g}`), ...fns.map((f) => `fn ${f}`)].join(", ")}
447
648
  return ${name}
448
649
  `;
449
650
  return { headerRel, headerPath: headerRel, header, luauRel, luau };
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ /**
3
+ * Authority / architecture rules — import boundaries (CLUAU-AUTH*).
4
+ */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.loadPlatformPolicy = loadPlatformPolicy;
10
+ exports.checkAuthority = checkAuthority;
11
+ exports.assertAuthoritySafe = assertAuthoritySafe;
12
+ const node_fs_1 = __importDefault(require("node:fs"));
13
+ const node_path_1 = __importDefault(require("node:path"));
14
+ const roblox_js_1 = require("./roblox.js");
15
+ const diagnostics_js_1 = require("./diagnostics.js");
16
+ function loadPlatformPolicy(projectRoot) {
17
+ const file = node_path_1.default.join(projectRoot, "cluaupp.config.json");
18
+ if (!node_fs_1.default.existsSync(file)) {
19
+ return defaultPolicy();
20
+ }
21
+ try {
22
+ const raw = JSON.parse(node_fs_1.default.readFileSync(file, "utf8"));
23
+ const rules = raw.rules || {};
24
+ const components = Array.isArray(raw.components) ? raw.components : [];
25
+ return {
26
+ rules: { ...defaultPolicy().rules, ...rules },
27
+ components: components.length ? components : defaultPolicy().components,
28
+ };
29
+ }
30
+ catch {
31
+ return defaultPolicy();
32
+ }
33
+ }
34
+ function defaultPolicy() {
35
+ return {
36
+ rules: {
37
+ clientCannotImport: ["ServerScriptService", "ServerStorage"],
38
+ sharedCannotUse: ["DataStoreService", "MessagingService", "ServerStorage"],
39
+ serverCannotImport: [],
40
+ },
41
+ components: [],
42
+ };
43
+ }
44
+ const INCLUDE_RE = /#include\s*[<"]([^>"]+)[>"]/g;
45
+ const IMPORT_RE = /\bimport\s*\{[^}]*\}\s*from\s*"([^"]+)"/g;
46
+ const REQUIRE_RE = /require\s*\(\s*([^)]+)\)/g;
47
+ const GET_SERVICE = /GetService\s*(?:<\s*([A-Za-z_]\w*)\s*>|\(\s*"([A-Za-z_]\w*)"\s*\))/g;
48
+ function checkAuthority(source, fileName, policy = defaultPolicy()) {
49
+ const ctx = (0, roblox_js_1.runContextFromFileName)(fileName);
50
+ const clean = (0, diagnostics_js_1.stripCommentsKeepStrings)(source);
51
+ const out = [];
52
+ const rules = policy.rules || {};
53
+ const bannedImports = ctx === "Client"
54
+ ? rules.clientCannotImport || []
55
+ : ctx === "Shared"
56
+ ? []
57
+ : ctx === "Server"
58
+ ? rules.serverCannotImport || []
59
+ : [];
60
+ const checkToken = (token, index, code, message) => {
61
+ const { line, column } = (0, diagnostics_js_1.lineColAt)(clean, index);
62
+ out.push({ code, message, line, column, severity: "error", file: fileName });
63
+ };
64
+ for (const banned of bannedImports) {
65
+ const re = new RegExp(`\\b${banned}\\b`);
66
+ INCLUDE_RE.lastIndex = 0;
67
+ let m;
68
+ while ((m = INCLUDE_RE.exec(clean))) {
69
+ if (re.test(m[1])) {
70
+ checkToken(m[1], m.index, "CLUAU_AUTH001", `Architecture: ${ctx} must not import/include path involving ${banned}`);
71
+ }
72
+ }
73
+ IMPORT_RE.lastIndex = 0;
74
+ while ((m = IMPORT_RE.exec(clean))) {
75
+ if (re.test(m[1])) {
76
+ checkToken(m[1], m.index, "CLUAU_AUTH001", `Architecture: ${ctx} must not import path involving ${banned}`);
77
+ }
78
+ }
79
+ REQUIRE_RE.lastIndex = 0;
80
+ while ((m = REQUIRE_RE.exec(clean))) {
81
+ if (re.test(m[1])) {
82
+ checkToken(m[1], m.index, "CLUAU_AUTH001", `Architecture: ${ctx} must not require ${banned}`);
83
+ }
84
+ }
85
+ if (re.test(clean) && (clean.includes(`"${banned}`) || clean.includes(`'${banned}`) || clean.includes(`<${banned}`))) {
86
+ /* covered above */
87
+ }
88
+ }
89
+ if (ctx === "Shared" || ctx === "Client") {
90
+ const forbiddenServices = rules.sharedCannotUse || [];
91
+ GET_SERVICE.lastIndex = 0;
92
+ let m;
93
+ while ((m = GET_SERVICE.exec(clean))) {
94
+ const svc = m[1] || m[2];
95
+ if (svc && forbiddenServices.includes(svc) && ctx === "Shared") {
96
+ const { line, column } = (0, diagnostics_js_1.lineColAt)(clean, m.index);
97
+ out.push({
98
+ code: "CLUAU_AUTH002",
99
+ message: `Architecture: Shared must not use ${svc}`,
100
+ line,
101
+ column,
102
+ severity: "error",
103
+ file: fileName,
104
+ });
105
+ }
106
+ }
107
+ }
108
+ // Client writing Keep/DataStore style authority smells
109
+ if (ctx === "Client") {
110
+ const smells = [
111
+ { re: /\bDataStoreService\b/, msg: "Client must not touch DataStoreService" },
112
+ { re: /Keep\.Server\.(Set|SetPersisted|Trade)/, msg: "Client must not mutate Keep.Server persistence APIs" },
113
+ ];
114
+ for (const smell of smells) {
115
+ const m = smell.re.exec(clean);
116
+ if (m) {
117
+ const { line, column } = (0, diagnostics_js_1.lineColAt)(clean, m.index);
118
+ out.push({
119
+ code: "CLUAU_AUTH003",
120
+ message: smell.msg,
121
+ line,
122
+ column,
123
+ severity: "error",
124
+ file: fileName,
125
+ });
126
+ }
127
+ }
128
+ }
129
+ return out;
130
+ }
131
+ function assertAuthoritySafe(source, fileName, policy) {
132
+ const errors = checkAuthority(source, fileName, policy).filter((d) => d.severity === "error");
133
+ if (!errors.length)
134
+ return;
135
+ throw new Error(`Authority:\n${errors.map((e) => ` ${e.line}:${e.column} ${e.code} ${e.message}`).join("\n")}`);
136
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ /**
3
+ * Call-graph authority — transitive Client → banned Server paths via include graph.
4
+ * CLUAU_AUTH004 when a client/shared module reaches ServerScriptService/ServerStorage.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.checkAuthorityGraph = checkAuthorityGraph;
8
+ const project_graph_js_1 = require("./project-graph.js");
9
+ const roblox_js_1 = require("./roblox.js");
10
+ const authority_check_js_1 = require("./authority-check.js");
11
+ function pathLooksBanned(rel, banned) {
12
+ const norm = rel.replace(/\\/g, "/");
13
+ return banned.some((b) => norm.includes(b));
14
+ }
15
+ function reachable(graph, from) {
16
+ const adj = new Map();
17
+ for (const n of graph.nodes)
18
+ adj.set(n, []);
19
+ for (const e of graph.edges) {
20
+ if (!adj.has(e.from))
21
+ adj.set(e.from, []);
22
+ adj.get(e.from).push(e.to);
23
+ }
24
+ const seen = new Set();
25
+ const stack = [from];
26
+ while (stack.length) {
27
+ const n = stack.pop();
28
+ if (seen.has(n))
29
+ continue;
30
+ seen.add(n);
31
+ for (const to of adj.get(n) || []) {
32
+ if (!seen.has(to))
33
+ stack.push(to);
34
+ }
35
+ }
36
+ seen.delete(from);
37
+ return seen;
38
+ }
39
+ function checkAuthorityGraph(projectRoot, rootDir = "src", policy = (0, authority_check_js_1.loadPlatformPolicy)(projectRoot)) {
40
+ const graph = (0, project_graph_js_1.buildProjectGraph)(projectRoot, rootDir);
41
+ const out = [];
42
+ const clientBanned = policy.rules?.clientCannotImport || ["ServerScriptService", "ServerStorage"];
43
+ for (const node of graph.nodes) {
44
+ const ctx = (0, roblox_js_1.runContextFromFileName)(node);
45
+ if (ctx !== "Client" && ctx !== "Shared")
46
+ continue;
47
+ const banned = ctx === "Client" ? clientBanned : ["ServerScriptService", "ServerStorage"];
48
+ if (pathLooksBanned(node, banned)) {
49
+ out.push({
50
+ code: "CLUAU_AUTH004",
51
+ message: `Architecture call-graph: ${ctx} file lives under banned path (${node})`,
52
+ line: 1,
53
+ column: 1,
54
+ severity: "error",
55
+ file: node,
56
+ });
57
+ continue;
58
+ }
59
+ for (const dep of reachable(graph, node)) {
60
+ if (pathLooksBanned(dep, banned)) {
61
+ out.push({
62
+ code: "CLUAU_AUTH004",
63
+ message: `Architecture call-graph: ${ctx} \`${node}\` transitively reaches banned \`${dep}\``,
64
+ line: 1,
65
+ column: 1,
66
+ severity: "error",
67
+ file: node,
68
+ });
69
+ break;
70
+ }
71
+ }
72
+ }
73
+ return out;
74
+ }
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /**
3
+ * Incremental compile cache + bounded parallel job runner.
4
+ * Cache lives under `.cluaupp/compile-cache/` (gitignored via `.cluaupp/`).
5
+ */
6
+ var __importDefault = (this && this.__importDefault) || function (mod) {
7
+ return (mod && mod.__esModule) ? mod : { "default": mod };
8
+ };
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.COMPILE_CACHE_SCHEMA = void 0;
11
+ exports.compileCacheDir = compileCacheDir;
12
+ exports.hashText = hashText;
13
+ exports.fingerprintSource = fingerprintSource;
14
+ exports.loadCompileCacheIndex = loadCompileCacheIndex;
15
+ exports.saveCompileCacheIndex = saveCompileCacheIndex;
16
+ exports.readCachedJob = readCachedJob;
17
+ exports.writeCachedJob = writeCachedJob;
18
+ exports.mapPool = mapPool;
19
+ exports.defaultJobCount = defaultJobCount;
20
+ const node_crypto_1 = __importDefault(require("node:crypto"));
21
+ const node_fs_1 = __importDefault(require("node:fs"));
22
+ const node_os_1 = __importDefault(require("node:os"));
23
+ const node_path_1 = __importDefault(require("node:path"));
24
+ exports.COMPILE_CACHE_SCHEMA = 1;
25
+ function compileCacheDir(projectRoot) {
26
+ return node_path_1.default.join(projectRoot, ".cluaupp", "compile-cache");
27
+ }
28
+ function hashText(text) {
29
+ return node_crypto_1.default.createHash("sha256").update(text, "utf8").digest("hex");
30
+ }
31
+ function fingerprintSource(source, configKey) {
32
+ return hashText(`${configKey}\n${source}`);
33
+ }
34
+ function indexPath(projectRoot) {
35
+ return node_path_1.default.join(compileCacheDir(projectRoot), "index.json");
36
+ }
37
+ function jobPath(projectRoot, rel) {
38
+ const safe = rel.replace(/[\\/]/g, "__");
39
+ return node_path_1.default.join(compileCacheDir(projectRoot), `${safe}.json`);
40
+ }
41
+ function loadCompileCacheIndex(projectRoot) {
42
+ const file = indexPath(projectRoot);
43
+ if (!node_fs_1.default.existsSync(file)) {
44
+ return { schemaVersion: exports.COMPILE_CACHE_SCHEMA, entries: {} };
45
+ }
46
+ try {
47
+ const raw = JSON.parse(node_fs_1.default.readFileSync(file, "utf8"));
48
+ if (!raw || typeof raw.entries !== "object") {
49
+ return { schemaVersion: exports.COMPILE_CACHE_SCHEMA, entries: {} };
50
+ }
51
+ return { schemaVersion: exports.COMPILE_CACHE_SCHEMA, entries: raw.entries };
52
+ }
53
+ catch {
54
+ return { schemaVersion: exports.COMPILE_CACHE_SCHEMA, entries: {} };
55
+ }
56
+ }
57
+ function saveCompileCacheIndex(projectRoot, index) {
58
+ const dir = compileCacheDir(projectRoot);
59
+ node_fs_1.default.mkdirSync(dir, { recursive: true });
60
+ node_fs_1.default.writeFileSync(indexPath(projectRoot), JSON.stringify(index, null, "\t") + "\n", "utf8");
61
+ }
62
+ function readCachedJob(projectRoot, rel, sourceHash) {
63
+ const index = loadCompileCacheIndex(projectRoot);
64
+ if (index.entries[rel] !== sourceHash) {
65
+ return null;
66
+ }
67
+ const file = jobPath(projectRoot, rel);
68
+ if (!node_fs_1.default.existsSync(file)) {
69
+ return null;
70
+ }
71
+ try {
72
+ const job = JSON.parse(node_fs_1.default.readFileSync(file, "utf8"));
73
+ if (!job || job.sourceHash !== sourceHash || !Array.isArray(job.files)) {
74
+ return null;
75
+ }
76
+ return job;
77
+ }
78
+ catch {
79
+ return null;
80
+ }
81
+ }
82
+ function writeCachedJob(projectRoot, job) {
83
+ const dir = compileCacheDir(projectRoot);
84
+ node_fs_1.default.mkdirSync(dir, { recursive: true });
85
+ node_fs_1.default.writeFileSync(jobPath(projectRoot, job.rel), JSON.stringify(job) + "\n", "utf8");
86
+ const index = loadCompileCacheIndex(projectRoot);
87
+ index.entries[job.rel] = job.sourceHash;
88
+ saveCompileCacheIndex(projectRoot, index);
89
+ }
90
+ /** Bounded concurrency over async work items. */
91
+ async function mapPool(items, concurrency, fn) {
92
+ const limit = Math.max(1, Math.min(concurrency, items.length || 1));
93
+ const results = new Array(items.length);
94
+ let next = 0;
95
+ async function worker() {
96
+ while (true) {
97
+ const i = next++;
98
+ if (i >= items.length)
99
+ return;
100
+ results[i] = await fn(items[i], i);
101
+ }
102
+ }
103
+ await Promise.all(Array.from({ length: limit }, () => worker()));
104
+ return results;
105
+ }
106
+ function defaultJobCount() {
107
+ const env = Number(process.env.CLUAUPP_JOBS || process.env.CLPP_JOBS || "");
108
+ if (Number.isFinite(env) && env > 0) {
109
+ return Math.floor(env);
110
+ }
111
+ return Math.max(1, Math.min(8, node_os_1.default.cpus()?.length || 4));
112
+ }
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ /**
3
+ * Context Safety — capability profile for CL++ compile (Cluaupp target).
4
+ * CLPP may consume this JSON later; Cluaupp enforces rules today.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.CAPABILITY_PROFILE_SCHEMA_VERSION = void 0;
8
+ exports.builtinCapabilityProfile = builtinCapabilityProfile;
9
+ exports.capabilitiesForContext = capabilitiesForContext;
10
+ exports.CAPABILITY_PROFILE_SCHEMA_VERSION = 1;
11
+ /** Builtin Roblox platform capability rules (v1). */
12
+ function builtinCapabilityProfile() {
13
+ return {
14
+ schemaVersion: exports.CAPABILITY_PROFILE_SCHEMA_VERSION,
15
+ target: "roblox",
16
+ rules: [
17
+ {
18
+ id: "CLUAUPP_CTX_LOCALPLAYER",
19
+ message: "`LocalPlayer` is client-only — illegal in Server scripts",
20
+ pattern: String.raw `\bLocalPlayer\b`,
21
+ forbiddenIn: ["Server"],
22
+ severity: "error",
23
+ capability: "client_player",
24
+ },
25
+ {
26
+ id: "CLUAUPP_CTX_LOCALPLAYER_SHARED",
27
+ message: "`LocalPlayer` in Shared modules is unsafe if required from the server — prefer Client scripts",
28
+ pattern: String.raw `\bLocalPlayer\b`,
29
+ forbiddenIn: ["Shared"],
30
+ severity: "warning",
31
+ capability: "client_player",
32
+ },
33
+ {
34
+ id: "CLUAUPP_CTX_DATASTORE",
35
+ message: "`DataStoreService` is server-only — illegal in Client scripts",
36
+ pattern: String.raw `\bDataStoreService\b|GetService\s*<\s*DataStoreService\s*>|GetService\s*\(\s*["']DataStoreService["']\s*\)`,
37
+ forbiddenIn: ["Client"],
38
+ severity: "error",
39
+ capability: "data_stores",
40
+ },
41
+ {
42
+ id: "CLUAUPP_CTX_MESSAGING",
43
+ message: "`MessagingService` is server-only — illegal in Client scripts",
44
+ pattern: String.raw `\bMessagingService\b|GetService\s*<\s*MessagingService\s*>`,
45
+ forbiddenIn: ["Client"],
46
+ severity: "error",
47
+ capability: "messaging",
48
+ },
49
+ {
50
+ id: "CLUAUPP_CTX_SERVERSTORAGE",
51
+ message: "`ServerStorage` is server-only — illegal in Client scripts",
52
+ pattern: String.raw `\bServerStorage\b|GetService\s*<\s*ServerStorage\s*>`,
53
+ forbiddenIn: ["Client"],
54
+ severity: "error",
55
+ capability: "server_storage",
56
+ },
57
+ {
58
+ id: "CLUAUPP_CTX_FIRE_SERVER",
59
+ message: "`FireServer` is client→server — illegal in Server scripts",
60
+ pattern: String.raw `\bFireServer\b`,
61
+ forbiddenIn: ["Server"],
62
+ severity: "error",
63
+ capability: "fire_server",
64
+ },
65
+ {
66
+ id: "CLUAUPP_CTX_FIRE_CLIENT",
67
+ message: "`FireClient` / `FireAllClients` are server→client — illegal in Client scripts",
68
+ pattern: String.raw `\bFireAllClients\b|\bFireClient\b`,
69
+ forbiddenIn: ["Client"],
70
+ severity: "error",
71
+ capability: "fire_client",
72
+ },
73
+ ],
74
+ };
75
+ }
76
+ function capabilitiesForContext(context) {
77
+ switch (context) {
78
+ case "Client":
79
+ return ["client_player", "fire_server"];
80
+ case "Server":
81
+ return ["server_storage", "data_stores", "messaging", "fire_client"];
82
+ case "Plugin":
83
+ return ["client_player", "server_storage", "data_stores", "messaging", "fire_server", "fire_client"];
84
+ case "Shared":
85
+ return [];
86
+ default:
87
+ return [];
88
+ }
89
+ }