cluaupp 0.2.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/CHANGELOG.md +10 -79
  2. package/README.md +42 -88
  3. package/docs/README.md +13 -21
  4. package/docs/architecture.md +13 -76
  5. package/docs/cli.md +12 -64
  6. package/docs/comparison.md +6 -24
  7. package/docs/config.md +6 -7
  8. package/docs/examples/combat.md +19 -227
  9. package/docs/examples/hud.md +13 -81
  10. package/docs/examples/index.md +9 -16
  11. package/docs/getting-started.md +20 -137
  12. package/docs/intellisense.md +5 -41
  13. package/docs/intro.md +16 -15
  14. package/docs/migration.md +38 -0
  15. package/docs/oop/file-tags.md +12 -36
  16. package/docs/oop/index.md +8 -14
  17. package/docs/syntax.md +54 -236
  18. package/editors/vscode/extension.js +1 -1
  19. package/editors/vscode/package.json +4 -4
  20. package/examples/README.md +5 -7
  21. package/examples/game/.vscode/extensions.json +0 -3
  22. package/examples/game/.vscode/settings.json +6 -14
  23. package/examples/game/src/client/hud.client.clpp +54 -0
  24. package/examples/game/src/client/init.client.clpp +6 -0
  25. package/examples/game/src/server/combat.server.clpp +85 -0
  26. package/examples/game/src/server/leaderstats.server.clpp +28 -0
  27. package/examples/game/src/shared/PlayerData.clh +20 -0
  28. package/examples/game/src/shared/config.clp +6 -0
  29. package/examples/game/src/shared/features.clp +88 -0
  30. package/generated/cli.js +40 -24
  31. package/generated/clpp/contract.js +5 -0
  32. package/generated/clpp/index.js +27 -0
  33. package/generated/clpp/paths.js +121 -0
  34. package/generated/clpp/postprocess.js +78 -0
  35. package/generated/clpp/runner.js +102 -0
  36. package/generated/compile.js +26 -138
  37. package/generated/intellisense.js +38 -157
  38. package/generated/libs.js +1 -1
  39. package/generated/lsp.js +1 -8
  40. package/generated/preprocess.js +8 -179
  41. package/generated/system-understander.js +1 -1
  42. package/generated/transpile.js +3 -50
  43. package/generated/utils/project.js +13 -28
  44. package/include/{cluaupp/datatypes.hpp → clpp/datatypes.clh} +1 -1
  45. package/include/{cluaupp/generated/instances.hpp → clpp/generated/instances.clh} +1 -1
  46. package/include/{cluaupp/libs/chrono.hpp → clpp/libs/chrono.clh} +9 -9
  47. package/include/{cluaupp/libs/cmdr.hpp → clpp/libs/cmdr.clh} +4 -4
  48. package/include/{cluaupp/libs/dataservice.hpp → clpp/libs/dataservice.clh} +8 -15
  49. package/include/{cluaupp/libs/display.hpp → clpp/libs/display.clh} +1 -2
  50. package/include/{cluaupp/libs/ezvisual.hpp → clpp/libs/ezvisual.clh} +1 -3
  51. package/include/{cluaupp/libs/formatnumber.hpp → clpp/libs/formatnumber.clh} +2 -3
  52. package/include/{cluaupp/libs/fusion.hpp → clpp/libs/fusion.clh} +5 -5
  53. package/include/{cluaupp/libs/iris.hpp → clpp/libs/iris.clh} +2 -2
  54. package/include/{cluaupp/libs/janitor.hpp → clpp/libs/janitor.clh} +1 -2
  55. package/include/{cluaupp/libs/module3d.hpp → clpp/libs/module3d.clh} +2 -4
  56. package/include/{cluaupp/libs/net.hpp → clpp/libs/net.clh} +2 -4
  57. package/include/{cluaupp/libs/promise.hpp → clpp/libs/promise.clh} +1 -4
  58. package/include/{cluaupp/libs/spring.hpp → clpp/libs/spring.clh} +1 -2
  59. package/include/{cluaupp/libs/statemachine.hpp → clpp/libs/statemachine.clh} +2 -3
  60. package/include/{cluaupp/libs/stickybillboard.hpp → clpp/libs/stickybillboard.clh} +1 -2
  61. package/include/{cluaupp/libs/topbarplus.hpp → clpp/libs/topbarplus.clh} +3 -4
  62. package/include/clpp/libs.clh +24 -0
  63. package/include/clpp/roblox.clh +31 -0
  64. package/package.json +7 -14
  65. package/src/cli.ts +39 -25
  66. package/src/clpp/contract.ts +39 -0
  67. package/src/clpp/index.ts +18 -0
  68. package/src/clpp/paths.ts +117 -0
  69. package/src/clpp/postprocess.ts +93 -0
  70. package/src/clpp/runner.ts +102 -0
  71. package/src/compile.ts +26 -149
  72. package/src/intellisense.ts +36 -165
  73. package/src/libs.ts +1 -1
  74. package/src/lsp.ts +1 -5
  75. package/src/preprocess.ts +8 -180
  76. package/src/system-understander.ts +1 -1
  77. package/src/transpile.ts +9 -52
  78. package/src/utils/project.ts +12 -28
  79. package/templates/game/.vscode/extensions.json +0 -3
  80. package/templates/game/.vscode/settings.json +6 -14
  81. package/templates/game/src/client/init.client.clpp +6 -0
  82. package/templates/game/src/server/leaderstats.server.clpp +29 -0
  83. package/templates/game/src/shared/config.clp +6 -0
  84. package/examples/game/.clangd +0 -25
  85. package/examples/game/compile_flags.txt +0 -6
  86. package/examples/game/src/client/hud.client.cpp +0 -12
  87. package/examples/game/src/client/init.client.cpp +0 -6
  88. package/examples/game/src/server/combat.server.cpp +0 -23
  89. package/examples/game/src/server/leaderstats.server.cpp +0 -29
  90. package/examples/game/src/shared/config.cpp +0 -5
  91. package/examples/game/src/shared/config.h +0 -5
  92. package/include/cluaupp/libs.hpp +0 -25
  93. package/include/cluaupp/roblox.hpp +0 -47
  94. package/src/architecture.ts +0 -500
  95. package/src/ast.ts +0 -37
  96. package/src/emit.ts +0 -609
  97. package/src/emitter/luau-codegen.ts +0 -187
  98. package/src/emitter/translators.ts +0 -168
  99. package/src/headers.ts +0 -233
  100. package/src/layout.ts +0 -114
  101. package/src/lex.ts +0 -158
  102. package/src/parse.ts +0 -729
  103. package/src/parser/collector.ts +0 -148
  104. package/src/parser/index.ts +0 -27
  105. package/src/tree-sitter-cpp.d.ts +0 -4
  106. package/src/understand.ts +0 -322
  107. package/templates/game/src/client/init.client.cpp +0 -6
  108. package/templates/game/src/server/leaderstats.server.cpp +0 -29
  109. package/templates/game/src/shared/config.cpp +0 -5
  110. package/templates/game/src/shared/config.h +0 -5
  111. /package/include/{cluaupp/generated/enums.hpp → clpp/generated/enums.clh} +0 -0
  112. /package/include/{cluaupp/libs/math.hpp → clpp/libs/math.clh} +0 -0
  113. /package/include/{cluaupp/libs/twinkle.hpp → clpp/libs/twinkle.clh} +0 -0
  114. /package/include/{cluaupp/libs/vfx.hpp → clpp/libs/vfx.clh} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,6 +1,15 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 1.0.0
4
+
5
+ Breaking: Cluaupp no longer transpiles a C++ subset. Games are **CL++** (`.clpp` / `.clp` / `.clh`). The CLI orchestrates the [`clpp`](https://github.com/KartzRbx/CLPP) binary (`clpp api compile`), post-processes Luau (`ClppLibs` → `ReplicatedStorage.CluauppLibs`), and writes `out/` for Rojo.
6
+
7
+ - Requires `clpp` on PATH (`CLPP_PATH` override). Language, IntelliSense, and codegen live in CL++ (`clpp install`).
8
+ - `cluaupp language` prints `clpp api manifest`.
9
+ - Templates and `examples/game` use CL++ syntax (`guard`, `match`, `signal`, `.:`, `::`, Fusion).
10
+ - Docs site and README are CL++ × Luau (no clangd / `.cpp` toolchain).
11
+ - Tree-sitter C++ frontend removed. ForeverHD `"architecture": true` folder split is not implemented on this path.
12
+ - See [migration](docs/migration.md) and [CL++ docs](https://kartzrbx.github.io/CLPP/).
4
13
 
5
14
  ## 0.2.3
6
15
 
@@ -9,81 +18,3 @@
9
18
  - `string_concat(...)` joins to Luau `..` (alongside string `+`).
10
19
  - Cursor is not a licensed host for Microsoft `ms-vscode.cpptools`. Cluaupp no longer writes `C_Cpp.*` settings or `c_cpp_properties.json`; `watch` strips leftover keys and marks cpptools as unwanted. C++ completion stays clangd.
11
20
  - Docs site is a C++-class handbook (syntax through lambdas and Luau `--!strict`). Per-class and per-enum dump pages are gone; engine members stay on create.roblox.com.
12
-
13
- ## 0.2.2
14
-
15
- - Header modules with a sibling `.cpp` now re-export those functions (`startingCoins` from `config.cpp` lands on `config.luau` via `configImpl`). The impl no longer `require`s its own header (`ReplicatedStorage.config`).
16
-
17
- ## 0.2.1
18
-
19
- - Pin `tree-sitter` 0.21.1 and `tree-sitter-c` 0.23.2 so `npm i -g cluaupp` no longer pulls `tree-sitter-c@0.23.6` (peerOptional `tree-sitter@^0.22.1`).
20
-
21
- ## 0.2.0
22
-
23
- - CLI rewritten as a TypeScript collector-emitter pipeline: Tree-sitter collection, Rojo-mapped `require`s, ordered Luau blocks (Services → Requires → Types → Constants → Code), then optional StyLua / `luau-analyze`. Commands `init`, `build`, `watch`, `lsp`, and `intellisense` stay. `cluaupp build -i file.cpp -o out.luau --rojo default.project.json` is the single-file path.
24
- - C++ IntelliSense is **clangd** only. The old tokenizer/`completeAt` engine is gone. Tree-sitter is the compiler frontend. `cluaupp lsp` publishes subset parse errors only.
25
- - `SystemUnderstander` scans identifiers, scores Roblox intents, and stamps Controller / Manager / utility plus `GetService` injections. Filename tags still decide Script vs LocalScript vs ModuleScript.
26
- - Sample game C++ lives in `examples/game/` (`src/server`, `src/client`, `src/shared`). Compiler `src/` is TypeScript only.
27
- - CLI security: StyLua / luau-analyze via `spawn` without a shell; emitted paths cannot leave the project; `.env*` stays out of git and the npm pack.
28
- - Docs / GitHub Pages: clangd, SystemUnderstander, one-file-out emit, `examples/game`. Rojo **7.7.0**.
29
- - Tests cover `out/` tree, types, modules, path safety, and understander roles.
30
-
31
- ## 0.1.5
32
-
33
- - Default emit is one tagged `.cpp` → one `.server.luau` / `.client.luau`. `"architecture": true` keeps the old ForeverHD service folders.
34
- - `--!strict` is opt-in: `#pragma strict`, `#pragma nstrict`, or `"strict": true` in config (default `false`).
35
- - `.h` / `.hpp` emit type ModuleScripts (`export type` + typed table). A sibling `.cpp` becomes `*Impl.luau`; the header binds those functions.
36
- - Shared `#include` modules `require` game-rooted paths (`ReplicatedStorage.Cluaupp...` / `ServerScriptService.Cluaupp...`).
37
-
38
- ## 0.1.4
39
-
40
- - Quoted `#include "Header.h"` of project files becomes `const Header = require(...)`. Header-only structs emit a constructor (`TemplateData()`); const headers bind `PLAYER_DATA_VERSION` from the module. Boot scripts require services (`LeaderstatsServer:init()`).
41
- - Keep `const` for injected `require` / `GetService` and `const function` for C++ functions (not `local`).
42
- - `init.meta.json` stays pure JSON. Library `require` injection no longer prepends Luau onto Rojo meta files (which made `rojo serve` fail with a JSONC parse error).
43
- - Server services emit `init.server.luau` + `init.meta.json` with **only** `RunContext.Server`. Rojo forbids `className` when an `init.*` script exists (the folder is already a Script, not a Folder). `init.luau` is pruned so the instance is not a ModuleScript.
44
-
45
- ## 0.1.3
46
-
47
- - Architecture: generated services keep a fixed declaration order (requires, types, constants, variables, functions, cleanup, return) without section banners. Domain `Stop` runs `janitor:Cleanup()`.
48
- - IntelliSense: `cluaupp init` / `cluaupp intellisense` install Microsoft `ms-vscode.cpptools` (VSIX on Cursor, where the marketplace omits it), write `.vscode/c_cpp_properties.json` (LLVM clang++, C++20, `include/` + `src/`, `compile_commands.json`), and disable clangd so the two engines do not fight. `build`/`watch` only refresh `compile_commands.json`.
49
- - `Class::method` on game types becomes `Class:method()` (`self`). Datatype/library statics stay dotted (`CFrame.lookAt`, `Color3.fromRGB`, `FormatNumber.Abbreviate`).
50
- - `switch` / `case` / `default` / `break` compile to a one-shot `repeat` with `if` / `elseif` / `else`. The discriminant is evaluated once; stacked `case` labels share a body; `break` leaves the switch even from inside an `if`.
51
- - Janitor typed border re-exports `_impl` (`export type Janitor = Impl.Janitor; return Impl`). It no longer invents `Has` or requires Promise for a parallel type that did not match howmanysmall.
52
- - Emit: injected `require` / `GetService` are `const`. C++ functions emit as `const function` instead of `local function`.
53
- - `.server.cpp` emits `init.luau` + `init.meta.json` with `RunContext.Server`. `init.server.luau` is Legacy and is pruned.
54
- - `cout << ... << endl` emits `print(...)`. `cerr <<` emits `warn`. `cout::print` / `cout::warn` / `cout::error` / `cout::ping` map to the Roblox globals.
55
- - Docs: [print and cout](docs/print-cout.md); [Libraries](docs/libraries/index.md) how-tos (DataService Init, Janitor, Promise, Net); [OOP structure](docs/oop/index.md) (file tags, services, modules); [Examples](docs/examples/index.md) (leaderstats, combat validation, shop, HUD, sword). GitHub Pages Learn tabs: OOP, Libraries, print/cout, Examples — generated into `site/` (`guide/oop.html`, `guide/examples.html`).
56
-
57
- ## 0.1.2
58
-
59
- - Watch does not write `out/` while any file fails to compile (Studio keeps the last good scripts).
60
- - Watch/build skip rewriting Luau whose contents did not change (a space in C++ no longer floods Rojo).
61
- - Watch never copies `libs/` or headers. Changing a constant no longer makes Rojo 7 crash on `libs/ArrayIndexer`.
62
- - `libs/` on `cluaupp build` is fill-only: missing files are restored, existing files are never overwritten or deleted.
63
- - Filename tags: `.server.cpp` → Script (`init.server.luau`), `.client.cpp` → LocalScript (`init.client.luau`), `.plugin.cpp` → Plugin, `.legacy` / `.legacy.client` / `.legacy.server` → Legacy. Bare `init.luau` is not used for `.server` (Rojo would make a ModuleScript).
64
- - Dropped `$optional` from `default.project.json` (Rojo 7.7 failed to deserialize it).
65
-
66
- ## 0.1.1
67
-
68
- - DataService: `DataServiceOptions<T>.Template` is the required player-data table (`T` matches the save struct). Also documents `Exclude`.
69
- - Compiler: C++ designated initializers (`Type { .Field = value }`) emit Luau tables, so `DataService.Server:Init({ Template = ... })` type-checks and compiles.
70
- - Watch/build: delete orphaned `out/` files when a source is removed. Never wipe `out/` or `libs/` as a whole — Rojo 7 crashes if `libs/ArrayIndexer` disappears mid-serve. Vendor files are only created if missing; existing `libs/` is never overwritten on watch/build. Watch skips writing `out/` when compile fails, and skips rewriting Luau whose contents did not change.
71
-
72
- ## 0.1.0
73
-
74
- - Product name: **Cluaupp** (C++ × Luau)
75
- - First public release
76
- - CLI: `init`, `build`, `watch`, `--version`
77
- - Transpile C++ subset → Luau `--!strict`
78
- - `local` and `const x = ...`
79
- - Full Roblox API from the official dump (925 classes, 636 enums)
80
- - Datatypes: Vector3, Vector2, CFrame, UDim, UDim2, Color3, BrickColor, Rect, Ray, …
81
- - `Enum::Material::Plastic` → `Enum.Material.Plastic`
82
- - GitHub Pages site for every class, method, and event
83
- - Game template + IntelliSense header (`roblox.hpp`, `compile_flags.txt`, clangd)
84
- - IntelliSense headers are valid C++: `LuaArray` for `GetPlayers`, templated `Connect`, optional dump defaults (`FindFirstChild`), no recursive `Vector3.Unit` field
85
- - Libraries: full GitHub systems in CluauppLibs (Janitor, Promise, Fusion, Iris, Cmdr, TopbarPlus, Chrono, DataServiceV2, EzVisualz, StateMachine, Spring, Display, Module3D, FormatNumber) plus Cluaupp originals (Net, MathUtils, Twinkle, StickyBillboard, VfxUtil)
86
- - Wally is optional; `node scripts/vendor-libs.js` re-copies from `vendor/` clones
87
- - Moonwave docs (C++ types, const, safety, organization)
88
- - Service architecture: filename tags (`.server` / `.client` / `.legacy.*` / module) plus AST intent scoring (combat, cache, players, …) — not leaderstats-only
89
- - Type functions ArrayIndexer (`Table`) and Occlude (`Keys`) in CluauppLibs
package/README.md CHANGED
@@ -4,117 +4,71 @@
4
4
  <img src="site/assets/logo.png" alt="Cluaupp" width="160">
5
5
  </p>
6
6
 
7
- **The definitive merge of C++ and modern Luau.**
7
+ **CL++ games on Roblox.** You write [CL++](https://kartzrbx.github.io/CLPP/). Cluaupp runs `clpp`, wires Rojo, and copies CluauppLibs.
8
8
 
9
- [Docs](https://kartzrbx.github.io/Cluaupp/) · [Handbook](https://kartzrbx.github.io/Cluaupp/docs/)
9
+ [CL++ language](https://kartzrbx.github.io/CLPP/) · [Docs](https://kartzrbx.github.io/Cluaupp/) · [Handbook](https://kartzrbx.github.io/Cluaupp/docs/)
10
10
 
11
11
  [![npm version](https://img.shields.io/npm/v/cluaupp.svg)](https://www.npmjs.com/package/cluaupp)
12
12
  [![Node.js](https://img.shields.io/node/v/cluaupp.svg)](https://nodejs.org)
13
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
14
-
15
- Source-to-source transpiler: you write a C++ subset, Cluaupp emits modern [Luau](https://luau.org/getting-started) (`local`, `const`, optional `--!strict`). C++ structure, Luau quality, one language.
16
-
17
- No WASM. No Emscripten. No `lua_call`. Roblox APIs come out as they do in Studio: `game:GetService("Players")`, `player:FindFirstChild("leaderstats")`, `players:GetPlayers()`.
18
-
19
- ```cpp
20
- auto* players = GetService<Players>();
21
- for (auto* player : players->GetPlayers()) {
22
- CreateLeaderstats(player);
13
+ [![License: MIT](https://img.shields.io/badge/license-MIT-white.svg)](LICENSE)
14
+
15
+ Cluaupp is the **toolchain**, not the language compiler. [KartzRbx/CLPP](https://github.com/KartzRbx/CLPP) owns syntax, IntelliSense (`clpp install`), and Luau codegen. This CLI finds `.clpp` / `.clp` / `.clh`, runs `clpp api compile`, rewrites `ClppLibs` → `ReplicatedStorage.CluauppLibs`, and writes `out/` for Rojo.
16
+
17
+ ```clpp
18
+ #include <clpp/roblox.clh>
19
+ #include <clpp/libs/janitor.clh>
20
+
21
+ void init() {
22
+ Players* players = GetService<Players>();
23
+ players::PlayerAdded~>Connect(func [](Player* player) {
24
+ guard (player != null) else {
25
+ return;
26
+ }
27
+ post("hello, " .: player.Name);
28
+ });
23
29
  }
24
- players->PlayerAdded.Connect(CreateLeaderstats);
25
-
26
- auto* part = new Part(workspace);
27
- part->Size = Vector3(8, 1, 8);
28
- part->CFrame = CFrame::lookAt(Vector3(0, 10, 0), Vector3(0, 10, -10));
29
- frame->Size = UDim2::fromScale(1, 1);
30
- ```
31
-
32
- becomes
33
-
34
- ```luau
35
- --!strict
36
- local players: Players = game:GetService("Players")
37
- for _, player in players:GetPlayers() do
38
- CreateLeaderstats(player)
39
- end
40
- players.PlayerAdded:Connect(CreateLeaderstats)
41
30
  ```
42
31
 
43
32
  ## Install
44
33
 
45
- Node.js 18+ and [Rojo](https://rojo.space/) **7.7.0** for Studio sync (`rokit.toml` in the game template).
34
+ 1. [Node.js](https://nodejs.org/) 18+
35
+ 2. [Rojo](https://rojo.space/) **7.7.0**
36
+ 3. **`clpp` on PATH** from [CL++](https://github.com/KartzRbx/CLPP) (`cargo install --path .`)
46
37
 
47
38
  ```bash
48
39
  npm install -g cluaupp
49
- ```
50
-
51
- Or run without a global install:
52
-
53
- ```bash
40
+ clpp install
54
41
  npx cluaupp init my-game
55
- ```
56
-
57
- ## Quick start
58
-
59
- ```bash
60
- cluaupp init my-game
61
42
  cd my-game
62
43
  rokit install
63
44
  cluaupp build
64
45
  rojo serve
65
46
  ```
66
47
 
67
- Connect the Rojo plugin in Roblox Studio. Edit `src/**/*.{cpp,h,hpp}`, run `cluaupp watch` to rebuild on save.
48
+ | Source | Output | Rojo |
49
+ | --- | --- | --- |
50
+ | `*.server.clpp` | `*.server.luau` | Script |
51
+ | `*.client.clpp` | `*.client.luau` | LocalScript |
52
+ | `*.clp` / untagged `.clpp` | `*.luau` | ModuleScript |
53
+ | `*.clh` | `*.luau` | ModuleScript |
68
54
 
69
- C++ autocomplete is **clangd**, not a Cluaupp tokenizer and not Microsoft cpptools. Put `#include <cluaupp/roblox.hpp>` at the top of each script; `cluaupp init` writes `.clangd` / `compile_flags.txt` / `compile_commands.json` with `-Iinclude` so clangd finds that header. Tree-sitter is only used to compile. See [IntelliSense](docs/intellisense.md).
55
+ ## CLI
70
56
 
71
- ```
72
- src/server/*.server.cpp → out/server/*.server.luau Script
73
- src/client/*.client.cpp → out/client/*.client.luau LocalScript
74
- src/shared/*.cpp → out/shared/*.luau ModuleScript
57
+ ```bash
58
+ cluaupp init [folder]
59
+ cluaupp build [folder]
60
+ cluaupp watch [folder]
61
+ cluaupp language # clpp api manifest
62
+ cluaupp intellisense # files.associations + clpp install
75
63
  ```
76
64
 
77
- Filename tags: `.server.cpp`, `.client.cpp`, `.legacy.server.cpp`, `.legacy.client.cpp`, or no tag (ModuleScript). One source file becomes one instance. Set `"architecture": true` only for the old PascalCase folder split. See [Architecture](docs/architecture.md) and [OOP structure](docs/oop/index.md).
78
-
79
- Compiler TypeScript lives in `src/`. Sample game C++ is [`examples/game`](examples/game) (`src/server`, `src/client`, `src/shared`). `cluaupp init` still copies [`templates/game`](templates/game).
80
-
81
- ## Documentation
82
-
83
- | Guide | What it covers |
84
- | --- | --- |
85
- | [Getting started](docs/getting-started.md) | Install, first project, Rojo, IntelliSense |
86
- | [**Docs + API (GitHub Pages)**](https://kartzrbx.github.io/Cluaupp/) | Site, Learn tab, every class / datatype / enum |
87
- | [Learn](https://kartzrbx.github.io/Cluaupp/learn/) | C++ subset, Luau output, safety, architecture |
88
- | [CLI](docs/cli.md) | `init`, `build`, `watch`, flags |
89
- | [Syntax](docs/syntax.md) | C++ subset → Luau (`local`, `const`, types) |
90
- | [print and cout](docs/print-cout.md) | `cout <<`, `cout::warn`, `endl` |
91
- | [Roblox API](docs/roblox-api.md) | Vector3, CFrame, UDim2, GetService, Instance.new |
92
- | [Architecture](docs/architecture.md) | One file in, one file out; opt-in ForeverHD folders |
93
- | [OOP structure](docs/oop/index.md) | File tags, services, modules, structs |
94
- | [Libraries](docs/libraries/index.md) | DataService Init, Janitor, Promise, Net |
95
- | [Examples](docs/examples/index.md) | Leaderstats, combat validation, shop, HUD, sword |
96
- | [C++ types](docs/cpp-types.md) | Typing, `const`, safety, organization |
97
- | [Comparison](docs/comparison.md) | vs roblox-ts and WASM toolchains |
98
- | [Contributing](CONTRIBUTING.md) | Tests, layout, how to ship |
99
-
100
- ## Programmatic API
101
-
102
- ```js
103
- const { compileSource, compileService } = require("cluaupp");
104
-
105
- const luau = compileSource(
106
- `void init() { print("ok"); }`,
107
- "init.cpp",
108
- { strict: true },
109
- );
110
-
111
- const service = compileService(
112
- cppSource,
113
- "server/leaderstats.server.cpp",
114
- { relativeName: "server/leaderstats.server.cpp" },
115
- );
116
- // service.files → LeaderStats/Main.luau, PlayersManager, CacheController, Types
117
- ```
65
+ `clpp` missing? Set `CLPP_PATH` or install [CL++](https://github.com/KartzRbx/CLPP).
66
+
67
+ ## Language
68
+
69
+ Course and reference: **[kartzrbx.github.io/CLPP](https://kartzrbx.github.io/CLPP/)**.
70
+
71
+ Exclusive CL++ (`guard`, `match`, `signal`, `observable`, `.:`, `::`, `~>`, Fusion) is compiled by `clpp`. Samples: [`examples/game`](examples/game). Old C++ games: [docs/migration.md](docs/migration.md).
118
72
 
119
73
  ## License
120
74
 
package/docs/README.md CHANGED
@@ -1,35 +1,27 @@
1
1
  # Cluaupp documentation
2
2
 
3
- The live handbook is **[GitHub Pages](https://kartzrbx.github.io/Cluaupp/docs/)** — every construct the CLI accepts, not an Enum dump.
3
+ The live handbook is **[GitHub Pages](https://kartzrbx.github.io/Cluaupp/docs/)**. Language course: **[CL++](https://kartzrbx.github.io/CLPP/)**.
4
4
 
5
5
  ## Start
6
6
 
7
- 1. [Intro](intro.md) — what Cluaupp is
8
- 2. [Getting started](getting-started.md) — npm, `init`, Rojo, clangd
9
- 3. [CLI](cli.md) — `init`, `build`, `watch`, `lsp`, `intellisense`, flags
10
- 4. [Config](config.md) — `cluaupp.config.json`
11
- 5. [IntelliSense](intellisense.md) — clangd only
7
+ 1. [Intro](intro.md)
8
+ 2. [Getting started](getting-started.md)
9
+ 3. [CLI](cli.md)
10
+ 4. [Config](config.md)
11
+ 5. [IntelliSense](intellisense.md) — `clpp install`
12
+ 6. [Migration](migration.md) — `.cpp` → `.clpp`
12
13
 
13
14
  ## Language
14
15
 
15
- 6. [Syntax](syntax.md) — **complete subset**: files, types, functions, scopes, control, operators, strings, `string_concat`, callbacks, casts, OOP, singletons, unsupported
16
- 7. [print and cout](print-cout.md) — logging
17
- 8. [C++ types](cpp-types.md) — primitives, Instances, `LuaArray`
18
- 9. [const](cpp-const.md) — immutability
19
- 10. [Advanced](cpp-advanced.md) — `::` vs `:`, Wally, optimization notes
16
+ Syntax lives in CL++. Cluaupp [syntax](syntax.md) is a short map of operators and file tags.
20
17
 
21
18
  ## Structure
22
19
 
23
- 11. [Organization](cpp-organization.md) — server / client / shared, filename tags
24
- 12. [Architecture](architecture.md) — one file in, one file out
25
- 13. [OOP structure](oop/index.md) — structs, sibling headers, `Class::` methods, singletons
26
- 14. [Safety](cpp-safety.md) — client trust, Janitor, Net, DataService
20
+ - [Architecture](architecture.md) — one file in, one file out
21
+ - [OOP / file tags](oop/file-tags.md)
27
22
 
28
23
  ## Roblox
29
24
 
30
- 15. [Libraries](libraries/index.md) — DataService, Janitor, Fusion / Iris / UI
31
- 16. [Examples](examples/index.md) — leaderstats, combat, shop, HUD
32
- 17. [Roblox API](roblox-api.md) — how to spell engine calls (Creator Hub for members)
33
- 18. [Comparison](comparison.md) — roblox-ts and WASM
34
-
35
- Moonwave (local): `npx moonwave dev`. Site rebuild: `npm run site`.
25
+ - [Libraries](libraries/index.md)
26
+ - [Examples](examples/index.md)
27
+ - [Comparison](comparison.md)
@@ -5,88 +5,25 @@ sidebar_position: 15
5
5
 
6
6
  # One file in, one file out
7
7
 
8
- roblox-ts decides **what instance you get** from a filename **key** (the same idea as Rojo). Cluaupp does the same — and **stops there** by default. It does not invent Main / Controller / Types folders.
8
+ roblox-ts decides **what instance you get** from a filename **key**. Cluaupp does the same for **CL++**.
9
9
 
10
10
  | Key | Rojo instance | Default output |
11
11
  | --- | --- | --- |
12
- | `*.server.cpp` | Script | `*.server.luau` |
13
- | `*.client.cpp` | LocalScript | `*.client.luau` |
14
- | no suffix | ModuleScript | `Name.luau` |
15
- | `*.legacy.server.cpp` | Legacy Script | `*.server.luau` |
16
-
17
- `DataBoot.client.cpp` becomes `out/client/boot/DataBoot.client.luau` with your `init()` at the end. Shared `#include` modules use `require(ReplicatedStorage.Cluaupp...)`.
18
-
19
- `--!strict` is opt-in: put `#pragma strict` in the `.cpp`, or set `"strict": true` in `cluaupp.config.json`.
20
-
21
- The ForeverHD-style folder split (`LeaderStats/Main.luau`, …) is **opt-in**: `"architecture": true`.
22
-
23
- ## SystemUnderstander
24
-
25
- Like [roblox-ts](https://github.com/roblox-ts/roblox-ts) (filename **key** first) and [roblox-cs](https://github.com/roblox-csharp/roblox-cs) (scan the AST, then decide), Cluaupp does **not** call a generative model. `src/system-understander.ts` walks the Tree-sitter tree, scores token density against Roblox engine services, and returns a report the emitter may stamp as comments / extra `GetService` lines.
26
-
27
- | Step | What happens |
28
- | --- | --- |
29
- | `parseFileTag` | `.server.cpp` → Script / Server, `.client.cpp` → LocalScript / Client, no tag → ModuleScript |
30
- | `namesIn` | identifiers, `GetService<T>`, `new Class`, string literals |
31
- | `scoreIntents` | evidence count × side weight (server tokens count more on `.server.cpp`) |
32
- | `determineArchitecture` | score &lt; 2 → utility Module; otherwise Knit-style Controller / Manager / Service. `players` / `cache` stay supporting if combat, UI, or net already has ≥ 2 tokens |
33
-
34
- The **Rojo class never changes** because of a role. A HUD LocalScript can be classified as `ViewController` and still emit `hud.client.luau`. Sample sources: [examples/game](../examples/game).
35
-
36
- ## Compiler pipeline
37
-
38
- Cluaupp does not rewrite C++ as text. The CLI parses a Tree-sitter CST, collects symbols (`GetService<T>()`, `#include`, types, constants), then emits Luau in a fixed order:
39
-
40
- 1. `game:GetService(...)`
41
- 2. `require(...)` (Rojo `default.project.json` when present)
42
- 3. types
43
- 4. constants
44
- 5. functions / script body
45
-
46
- Formatting is delegated to StyLua; type sanity to `luau-analyze`. See [CLI](cli.md).
47
-
48
- ## File tags
49
-
50
- | Source | Meaning | Output |
51
- | --- | --- | --- |
52
- | `combat.server.cpp` | **Script** | `combat.server.luau` |
53
- | `hud.client.cpp` | **LocalScript** | `hud.client.luau` |
54
- | `tools.plugin.cpp` | **Script** RunContext Plugin | `tools.luau` (legacy plugin tag) |
55
- | `boot.legacy.server.cpp` | Legacy Script | `boot.server.luau` |
56
- | `damage.cpp` (no tag) | **ModuleScript** | `Damage.luau` |
57
-
58
- ## What a tagged file becomes
59
-
60
- ```
61
- src/server/leaderstats.server.cpp → out/server/leaderstats.server.luau
62
- src/client/boot/DataBoot.client.cpp → out/client/boot/DataBoot.client.luau
63
- src/shared/damage.cpp → out/shared/Damage.luau
64
- ```
65
-
66
- Scripts and LocalScripts keep your functions and call `init()` at the end. ModuleScripts return a table. There is no invented Main, Controller, or Types file.
67
-
68
- ## Opt-in: ForeverHD folders (`"architecture": true`)
69
-
70
- Set `"architecture": true` in `cluaupp.config.json` to restore the old planner: PascalCase service folders, `Main` / Managers / Controllers / Types, and `require(script.Main):Start()`. Server folders emit `init.server.luau` plus a **pure JSON** `init.meta.json` with only `RunContext.Server` — never `className`, and never library `require` lines (Rojo 7.7 rejects both).
12
+ | `*.server.clpp` | Script | `*.server.luau` |
13
+ | `*.client.clpp` | LocalScript | `*.client.luau` |
14
+ | `*.plugin.clpp` | Plugin Script | `*.plugin.luau` |
15
+ | `.clp` / untagged `.clpp` | ModuleScript | `Name.luau` |
16
+ | `.clh` | ModuleScript | `Name.luau` |
71
17
 
72
18
  ```
73
- filename key → server | client | module | legacy
74
- AST features → GetService, Instance.new, methods, identifiers
75
- intent scores → combat:2, character:1, …
76
- roles → Main + Managers + Controllers + Types
19
+ src/server/leaderstats.server.clpp → out/server/leaderstats.server.luau
20
+ src/client/hud.client.clpp → out/client/hud.client.luau
21
+ src/shared/config.clp → out/shared/config.luau
22
+ src/shared/PlayerData.clh → out/shared/PlayerData.luau
77
23
  ```
78
24
 
79
- | Evidence in the C++ | Role |
80
- | --- | --- |
81
- | `PlayerAdded`, `GetPlayers` | `PlayersManager` (Janitor) |
82
- | `Folder` + `IntValue` / `StringValue` | `CacheController` |
83
- | `TakeDamage`, `Humanoid`, `Raycast` | `CombatController` (your functions) |
84
- | `UserInputService`, `InputBegan` | `InputController` |
85
- | `RemoteEvent`, `Net` | `NetController` |
86
- | `DataStore`, `DataService` | `DataController` |
87
- | Domain shapes / stats | `{Service}Types` (`export type`, `return {}`) |
88
- | Wiring | `Main.Start` / `Main.Stop` |
25
+ `"architecture": true` (ForeverHD `Main` / Managers folders) is **not** generated in Cluaupp 1.0. `clpp` compiles each file; this CLI maps libraries and writes `out/`.
89
26
 
90
- Switching back to 1:1 deletes the stale `LeaderStats/` / `DataBoot/` folders on the next `cluaupp build`.
27
+ `--!strict` is opt-in: `#pragma strict` or `"strict": true` in `cluaupp.config.json`.
91
28
 
92
- How to **write** a system, tags, and module-style OOP: [OOP structure](oop/index.md). Copy-paste systems: [Examples](examples/index.md). Also [organization](cpp-organization.md) and [comparison](comparison.md).
29
+ Language: [kartzrbx.github.io/CLPP](https://kartzrbx.github.io/CLPP/). File tags: [OOP](oop/file-tags.md).
package/docs/cli.md CHANGED
@@ -4,88 +4,36 @@
4
4
  cluaupp <command> [folder]
5
5
  ```
6
6
 
7
- If `[folder]` is omitted, the current directory is used.
8
-
9
- The compiler is a **collector-emitter** pipeline: Tree-sitter walks the C++ CST, Rojo maps `#include` to `require`, Luau is emitted in a fixed block order (Services → Requires → Types → Constants → Code), then StyLua / `luau-analyze` can run as post-process.
7
+ Cluaupp orchestrates **CL++ → Luau**. It does not parse the language. `clpp` (on PATH) compiles each `.clpp` / `.clp` / `.clh`; Cluaupp post-processes and writes `out/`.
10
8
 
11
9
  ## `cluaupp init [folder]`
12
10
 
13
- Creates a game from the template:
14
-
15
- - `src/server`, `src/client`, `src/shared`
16
- - `cluaupp.config.json`
17
- - `default.project.json` (Rojo)
18
- - `rokit.toml` (Rojo 7.7.0)
19
- - `include/cluaupp/roblox.hpp` (IntelliSense)
20
- - `.vscode/` (clangd)
21
-
22
- ```bash
23
- cluaupp init .
24
- cluaupp init my-game
25
- ```
11
+ Creates `src/server`, `src/client`, `src/shared`, Rojo, `rokit.toml`, and a CL++ scaffold. Then run `clpp install` for editor IntelliSense.
26
12
 
27
13
  ## `cluaupp build [folder]`
28
14
 
29
- Transpiles `src/**/*.{cpp,h,hpp}` into `out/`. One tagged `.cpp` becomes one Luau instance (`leaderstats.server.luau`, `hud.client.luau`). Shared untagged files become ModuleScripts. Set `"architecture": true` for the old PascalCase service folders.
30
-
31
- - `--!strict` only with `#pragma strict`, `"strict": true`, or `--strict` on the single-file path
32
- - `#include "file.h"` becomes `require(...)` resolved from `default.project.json` when present
33
- - `#include <cluaupp/roblox.hpp>` is ignored
34
- - `.h` / `.hpp` emit a type ModuleScript (`export type` + typed table). A sibling `.cpp` becomes `*Impl.luau` (the construction); the header binds those functions.
35
- - A parse error exits with code 1 and `file:line:column`
36
- - After emit, **orphans in `out/` are removed** (source deleted → matching Luau deleted). `out/` itself is never wiped, so a running Rojo serve keeps the live tree.
37
- - `libs/` and `include/cluaupp` are synced by writing missing/changed files only. They are **never** deleted as a folder — Rojo 7 unwrap-crashes if `libs/ArrayIndexer` vanishes while serving.
15
+ Compiles `src/**/*.{clpp,clp,clh}` into `out/`. One tagged file becomes one Luau instance.
38
16
 
39
17
  ```bash
40
18
  cluaupp build
41
- cluaupp build ./my-game
42
19
  cluaupp build --format --analyze
20
+ cluaupp build --input ./src/server/boot.server.clpp --output ./out/boot.server.luau
43
21
  ```
44
22
 
45
- ### Single file
23
+ `--format` runs StyLua; `--analyze` runs `luau-analyze`.
46
24
 
47
- ```bash
48
- cluaupp build --input ./src/server/boot.server.cpp --output ./out/boot.server.luau --rojo ./default.project.json
49
- ```
50
-
51
- `--format` runs StyLua; `--analyze` runs `luau-analyze`. On the single-file path both run by default (warnings if the binaries are missing). On a project build they are opt-in.
25
+ If `clpp` is missing: install [CL++](https://github.com/KartzRbx/CLPP) or set `CLPP_PATH`.
52
26
 
53
27
  ## `cluaupp watch [folder]`
54
28
 
55
- Runs a compile (without copying `libs/`) and rebuilds when anything under `src/` changes, including deletes. Parse errors are printed; the watcher stays alive and **does not write `out/`** until the project compiles cleanly (Studio keeps the last good scripts). A second watcher in the same game exits. Deleted `.cpp` files prune their `out/` artifacts on the next successful compile.
56
-
57
- ## `cluaupp lsp [folder]`
29
+ Rebuilds on save. Does not write `out/` while compile fails.
58
30
 
59
- Stdio JSON-RPC for **Cluaupp subset diagnostics** only. Completion, hover, and definitions are clangd.
31
+ ## `cluaupp language`
60
32
 
61
- ## `cluaupp intellisense [folder]`
33
+ Prints `clpp api manifest` (extensions, tags, operators).
62
34
 
63
- Alias: `intelisense`. Writes `compile_commands.json`, `.clangd`, and `.vscode` for clangd, and installs LLVM clangd when needed.
35
+ ## `cluaupp intellisense` / `cluaupp lsp`
64
36
 
65
- ## `cluaupp --version` / `cluaupp -v`
37
+ Delegates to CL++ (`clpp install`). Cluaupp only writes `files.associations` for `clpp`.
66
38
 
67
- Prints the npm package version.
68
-
69
- ## `cluaupp --help`
70
-
71
- Shows usage.
72
-
73
- ## Suggested npm scripts
74
-
75
- ```json
76
- {
77
- "scripts": {
78
- "build": "cluaupp build",
79
- "watch": "cluaupp watch"
80
- }
81
- }
82
- ```
83
-
84
- In the Cluaupp development repo:
85
-
86
- ```bash
87
- npm run build:cli # compile the TypeScript CLI
88
- npm test
89
- npm run dev # local gitignored playground in game/ + Rojo
90
- npm run stop # stop Rojo
91
- ```
39
+ ## `cluaupp --version` / `--help`
@@ -2,36 +2,18 @@
2
2
 
3
3
  ## vs roblox-ts
4
4
 
5
- [roblox-ts](https://roblox-ts.com/) transpiles TypeScript → Luau. Cluaupp is the same idea for C++: one language merge, readable output, quality Roblox APIs.
5
+ [roblox-ts](https://roblox-ts.com/) transpiles TypeScript → Luau. Cluaupp does the same job for **[CL++](https://kartzrbx.github.io/CLPP/)**: one familiar syntax, readable Luau, Roblox APIs as in Studio.
6
6
 
7
- Both are source-to-source. Neither goes through WASM. Generated Luau calls the Roblox API directly.
7
+ `*.server.clpp` → Script, `*.client.clpp` → LocalScript, untagged → ModuleScript.
8
8
 
9
- By default Cluaupp matches that filename key: `*.server.cpp` → one Script, `*.client.cpp` → one LocalScript, untagged → ModuleScript. The ForeverHD folder split is opt-in (`"architecture": true`). See [Architecture](architecture.md).
9
+ ## vs C++ → WASM
10
10
 
11
- Current Luau has [`local`, `const`, and `--!strict`](https://luau.org/getting-started). Cluaupp emits `const` from C++ `const`. `--!strict` is opt-in (`#pragma strict` or `"strict": true`).
12
-
13
- ## vs C++ → WASM → Luau (RBX-CPP / Emscripten)
14
-
15
- Compiling real C++ to WASM and translating the binary to Luau works, but the cost shows up in the API:
16
-
17
- - Roblox methods become generic calls (`lua_call`, blobs)
18
- - `GetPlayers()` and `FindFirstChild()` do not come out as they do in Studio
19
- - Heavy toolchain: Emscripten, CMake, Python, tens of GB of cache
20
-
21
- Cluaupp skips that path. You write *script* C++ (the same mental subset as roblox-ts) and the compiler emits readable Luau.
22
-
23
- ```cpp
24
- players->GetPlayers()
25
- player->FindFirstChild("leaderstats")
26
- GetService<Players>()
27
- ```
28
-
29
- is exactly what Studio expects, not a parallel runtime.
11
+ Cluaupp never compiles native C++ or WASM. The language compiler is `clpp` (Rust). This package is init / Rojo / CluauppLibs.
30
12
 
31
13
  ## When to use what
32
14
 
33
15
  | Goal | Tool |
34
16
  | --- | --- |
35
17
  | Game in TypeScript | roblox-ts |
36
- | Game in C++, clear Roblox API | **Cluaupp** |
37
- | Full native C++ (templates, STL, engines) | not Cluaupp today |
18
+ | Game in CL++ | **Cluaupp** + [`clpp`](https://github.com/KartzRbx/CLPP) |
19
+ | Language reference | [kartzrbx.github.io/CLPP](https://kartzrbx.github.io/CLPP/) |
package/docs/config.md CHANGED
@@ -13,19 +13,18 @@ File: `cluaupp.config.json` at the game root (next to `src/`).
13
13
 
14
14
  | Field | Default | Effect |
15
15
  | --- | --- | --- |
16
- | `rootDir` | `"src"` | Where the `.cpp` / `.h` / `.hpp` files live |
16
+ | `rootDir` | `"src"` | Where `.clpp` / `.clp` / `.clh` live |
17
17
  | `outDir` | `"out"` | Where Luau is written |
18
- | `strict` | `false` | Prefix `--!strict` on generated files (overridden by `#pragma strict` / `#pragma nstrict`) |
19
- | `architecture` | `false` | If `true`, emit PascalCase service folders (`LeaderStats/Main.luau`, …) instead of one Luau per `.cpp` |
20
-
21
- If the file is missing, those defaults apply.
18
+ | `strict` | `false` | Prefix `--!strict` when `clpp` did not already (overridden by `#pragma`) |
19
+ | `architecture` | `false` | Ignored in 1.0 (always one file in, one file out) |
22
20
 
23
21
  ## Rojo
24
22
 
25
- The template ships `default.project.json` mapping:
23
+ The template maps:
26
24
 
27
25
  - `out/server` → `ServerScriptService.Cluaupp`
28
26
  - `out/client` → `StarterPlayer.StarterPlayerScripts.Cluaupp`
29
27
  - `out/shared` → `ReplicatedStorage.Cluaupp`
28
+ - `libs` → `ReplicatedStorage.CluauppLibs`
30
29
 
31
- `*.server.cpp` becomes `*.server.luau` (Script). `*.client.cpp` becomes `*.client.luau` (LocalScript). Untagged files become ModuleScripts.
30
+ `*.server.clpp` → `*.server.luau` (Script). `*.client.clpp` → LocalScript. `.clp` / `.clh` → ModuleScript.