cluaupp 0.2.2 → 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 (129) hide show
  1. package/CHANGELOG.md +14 -75
  2. package/README.md +42 -88
  3. package/docs/README.md +25 -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/cpp-advanced.md +6 -3
  9. package/docs/cpp-types.md +2 -0
  10. package/docs/examples/combat.md +19 -227
  11. package/docs/examples/hud.md +13 -81
  12. package/docs/examples/index.md +9 -16
  13. package/docs/examples/leaderstats.md +44 -115
  14. package/docs/getting-started.md +20 -135
  15. package/docs/intellisense.md +5 -42
  16. package/docs/intro.md +16 -15
  17. package/docs/libraries/dataservice.md +4 -1
  18. package/docs/libraries/index.md +2 -1
  19. package/docs/libraries/more.md +3 -1
  20. package/docs/libraries/ui.md +76 -0
  21. package/docs/migration.md +38 -0
  22. package/docs/oop/file-tags.md +12 -36
  23. package/docs/oop/index.md +18 -11
  24. package/docs/roblox-api.md +4 -56
  25. package/docs/syntax.md +54 -179
  26. package/editors/vscode/extension.js +1 -1
  27. package/editors/vscode/package.json +4 -4
  28. package/examples/README.md +5 -7
  29. package/examples/game/.vscode/extensions.json +2 -2
  30. package/examples/game/.vscode/settings.json +6 -23
  31. package/examples/game/src/client/hud.client.clpp +54 -0
  32. package/examples/game/src/client/init.client.clpp +6 -0
  33. package/examples/game/src/server/combat.server.clpp +85 -0
  34. package/examples/game/src/server/leaderstats.server.clpp +28 -0
  35. package/examples/game/src/shared/PlayerData.clh +20 -0
  36. package/examples/game/src/shared/config.clp +6 -0
  37. package/examples/game/src/shared/features.clp +88 -0
  38. package/generated/api.js +15 -1
  39. package/generated/cli.js +40 -24
  40. package/generated/clpp/contract.js +5 -0
  41. package/generated/clpp/index.js +27 -0
  42. package/generated/clpp/paths.js +121 -0
  43. package/generated/clpp/postprocess.js +78 -0
  44. package/generated/clpp/runner.js +102 -0
  45. package/generated/compile.js +26 -138
  46. package/generated/emit.js +79 -3
  47. package/generated/intellisense.js +83 -207
  48. package/generated/lex.js +3 -0
  49. package/generated/libs.js +1 -1
  50. package/generated/lsp.js +1 -8
  51. package/generated/parse.js +119 -24
  52. package/generated/preprocess.js +8 -179
  53. package/generated/system-understander.js +1 -1
  54. package/generated/transpile.js +3 -50
  55. package/generated/utils/project.js +13 -28
  56. package/include/{cluaupp/datatypes.hpp → clpp/datatypes.clh} +5 -1
  57. package/include/{cluaupp/generated/instances.hpp → clpp/generated/instances.clh} +1 -1
  58. package/include/{cluaupp/libs/chrono.hpp → clpp/libs/chrono.clh} +9 -9
  59. package/include/{cluaupp/libs/cmdr.hpp → clpp/libs/cmdr.clh} +4 -4
  60. package/include/{cluaupp/libs/dataservice.hpp → clpp/libs/dataservice.clh} +8 -15
  61. package/include/{cluaupp/libs/display.hpp → clpp/libs/display.clh} +1 -2
  62. package/include/{cluaupp/libs/ezvisual.hpp → clpp/libs/ezvisual.clh} +1 -3
  63. package/include/{cluaupp/libs/formatnumber.hpp → clpp/libs/formatnumber.clh} +2 -3
  64. package/include/{cluaupp/libs/fusion.hpp → clpp/libs/fusion.clh} +5 -5
  65. package/include/{cluaupp/libs/iris.hpp → clpp/libs/iris.clh} +2 -2
  66. package/include/{cluaupp/libs/janitor.hpp → clpp/libs/janitor.clh} +1 -2
  67. package/include/{cluaupp/libs/module3d.hpp → clpp/libs/module3d.clh} +2 -4
  68. package/include/{cluaupp/libs/net.hpp → clpp/libs/net.clh} +2 -4
  69. package/include/{cluaupp/libs/promise.hpp → clpp/libs/promise.clh} +1 -4
  70. package/include/{cluaupp/libs/spring.hpp → clpp/libs/spring.clh} +1 -2
  71. package/include/{cluaupp/libs/statemachine.hpp → clpp/libs/statemachine.clh} +2 -3
  72. package/include/{cluaupp/libs/stickybillboard.hpp → clpp/libs/stickybillboard.clh} +1 -2
  73. package/include/{cluaupp/libs/topbarplus.hpp → clpp/libs/topbarplus.clh} +3 -4
  74. package/include/clpp/libs.clh +24 -0
  75. package/include/clpp/roblox.clh +31 -0
  76. package/package.json +20 -16
  77. package/src/api.ts +15 -1
  78. package/src/cli.ts +39 -25
  79. package/src/clpp/contract.ts +39 -0
  80. package/src/clpp/index.ts +18 -0
  81. package/src/clpp/paths.ts +117 -0
  82. package/src/clpp/postprocess.ts +93 -0
  83. package/src/clpp/runner.ts +102 -0
  84. package/src/compile.ts +26 -149
  85. package/src/intellisense.ts +82 -211
  86. package/src/libs.ts +1 -1
  87. package/src/lsp.ts +1 -5
  88. package/src/preprocess.ts +8 -180
  89. package/src/system-understander.ts +1 -1
  90. package/src/transpile.ts +9 -52
  91. package/src/utils/project.ts +12 -28
  92. package/templates/game/.vscode/extensions.json +2 -2
  93. package/templates/game/.vscode/settings.json +6 -23
  94. package/templates/game/src/client/init.client.clpp +6 -0
  95. package/templates/game/src/server/leaderstats.server.clpp +29 -0
  96. package/templates/game/src/shared/config.clp +6 -0
  97. package/examples/game/.clangd +0 -25
  98. package/examples/game/.vscode/c_cpp_properties.json +0 -27
  99. package/examples/game/compile_flags.txt +0 -6
  100. package/examples/game/src/client/hud.client.cpp +0 -12
  101. package/examples/game/src/client/init.client.cpp +0 -6
  102. package/examples/game/src/server/combat.server.cpp +0 -23
  103. package/examples/game/src/server/leaderstats.server.cpp +0 -29
  104. package/examples/game/src/shared/config.cpp +0 -5
  105. package/examples/game/src/shared/config.h +0 -5
  106. package/include/cluaupp/libs.hpp +0 -25
  107. package/include/cluaupp/roblox.hpp +0 -47
  108. package/src/architecture.ts +0 -500
  109. package/src/ast.ts +0 -37
  110. package/src/emit.ts +0 -531
  111. package/src/emitter/luau-codegen.ts +0 -187
  112. package/src/emitter/translators.ts +0 -168
  113. package/src/headers.ts +0 -233
  114. package/src/layout.ts +0 -114
  115. package/src/lex.ts +0 -155
  116. package/src/parse.ts +0 -630
  117. package/src/parser/collector.ts +0 -148
  118. package/src/parser/index.ts +0 -27
  119. package/src/tree-sitter-cpp.d.ts +0 -4
  120. package/src/understand.ts +0 -322
  121. package/templates/game/.vscode/c_cpp_properties.json +0 -27
  122. package/templates/game/src/client/init.client.cpp +0 -6
  123. package/templates/game/src/server/leaderstats.server.cpp +0 -29
  124. package/templates/game/src/shared/config.cpp +0 -5
  125. package/templates/game/src/shared/config.h +0 -5
  126. /package/include/{cluaupp/generated/enums.hpp → clpp/generated/enums.clh} +0 -0
  127. /package/include/{cluaupp/libs/math.hpp → clpp/libs/math.clh} +0 -0
  128. /package/include/{cluaupp/libs/twinkle.hpp → clpp/libs/twinkle.clh} +0 -0
  129. /package/include/{cluaupp/libs/vfx.hpp → clpp/libs/vfx.clh} +0 -0
@@ -1,10 +1,10 @@
1
1
  #pragma once
2
2
 
3
3
  // evaera/Cmdr — vendored into CluauppLibs.Cmdr (server). Client: Cmdr.CmdrClient
4
- class CmdrType {};
5
- class CmdrCommand {};
6
- class CmdrRegistry {};
7
- class CmdrDispatcher {};
4
+ struct CmdrType {};
5
+ struct CmdrCommand {};
6
+ struct CmdrRegistry {};
7
+ struct CmdrDispatcher {};
8
8
 
9
9
  namespace Cmdr {
10
10
  void RegisterDefaultCommands();
@@ -3,14 +3,11 @@
3
3
  // KartzRbx/DataServiceV2 — https://github.com/KartzRbx/DataServiceV2
4
4
  // Runtime: CluauppLibs.DataService
5
5
  //
6
- // Real surface (not Get(player, path)):
7
- // DataService.Server / DataService.Client / DataService.Paths / DataService.Enum
8
- // local data = Server:WaitFor(player)
9
- // data:Get(Paths.Currencies.Coins)
10
- // data:GetChangedSignal(path):Connect(function(newValue, oldValue) end)
6
+ // Real surface:
7
+ // DataService:Server / DataService:Client / DataService:Paths / DataService:Enum
11
8
 
12
- class DataPath {};
13
- class DataProfile {};
9
+ struct DataPath {};
10
+ struct DataProfile {};
14
11
 
15
12
  struct DataBufferStats {
16
13
  double Bytes;
@@ -45,8 +42,7 @@ struct DataServiceOptions {
45
42
  bool AutoCreateMissingTables;
46
43
  };
47
44
 
48
- class Data {
49
- public:
45
+ struct Data {
50
46
  RBXScriptSignal Changed;
51
47
  bool Destroyed;
52
48
 
@@ -112,8 +108,7 @@ public:
112
108
  void Destroy();
113
109
  };
114
110
 
115
- class DataServiceServer {
116
- public:
111
+ struct DataServiceServer {
117
112
  DataPath Paths;
118
113
  template <typename T>
119
114
  DataServiceServer* Init(DataServiceOptions<T> options);
@@ -126,8 +121,7 @@ public:
126
121
  void Destroy();
127
122
  };
128
123
 
129
- class DataServiceClient {
130
- public:
124
+ struct DataServiceClient {
131
125
  DataPath Paths;
132
126
  Data* Init();
133
127
  Data* WaitForData();
@@ -136,8 +130,7 @@ public:
136
130
  void Destroy();
137
131
  };
138
132
 
139
- class DataService {
140
- public:
133
+ struct DataService {
141
134
  static DataServiceServer Server;
142
135
  static DataServiceClient Client;
143
136
  static DataPath Paths;
@@ -1,8 +1,7 @@
1
1
  #pragma once
2
2
 
3
3
  // nightcycle/display — pretty-print Luau values (Rust Display-style).
4
- // Vendored into CluauppLibs.Display with nightcycle/option bundled.
5
- class DisplayBuilder {};
4
+ struct DisplayBuilder {};
6
5
 
7
6
  namespace Display {
8
7
  DisplayBuilder* builder();
@@ -1,9 +1,7 @@
1
1
  #pragma once
2
2
 
3
3
  // arxkdev/ezVisualz — EasyVisuals, vendored into CluauppLibs.EzVisualz
4
- // Effect.new(gui, "Rainbow", speed, size)
5
- class EzVisualz {
6
- public:
4
+ struct EzVisualz {
7
5
  static EzVisualz* new_(GuiObject* target, string effectType);
8
6
  static EzVisualz* new_(GuiObject* target, string effectType, double speed, double size);
9
7
  void Play();
@@ -1,9 +1,8 @@
1
1
  #pragma once
2
2
 
3
3
  // Blockzez/RobloxFormatNumber — vendored into CluauppLibs.FormatNumber
4
- // Abbreviate / Comma / Compact are Cluaupp helpers over Simple.FormatCompact.
5
- class FormatNumberMain {};
6
- class FormatNumberSimple {};
4
+ struct FormatNumberMain {};
5
+ struct FormatNumberSimple {};
7
6
 
8
7
  namespace FormatNumber {
9
8
  string Abbreviate(double value);
@@ -1,11 +1,11 @@
1
1
  #pragma once
2
2
 
3
3
  // dphfox/Fusion 0.4 — vendored into CluauppLibs.Fusion
4
- class FusionScope {};
5
- class FusionState {};
6
- class FusionKey {};
7
- class FusionObserver {};
8
- class FusionContextual {};
4
+ struct FusionScope {};
5
+ struct FusionState {};
6
+ struct FusionKey {};
7
+ struct FusionObserver {};
8
+ struct FusionContextual {};
9
9
 
10
10
  namespace Fusion {
11
11
  FusionScope scoped();
@@ -1,8 +1,8 @@
1
1
  #pragma once
2
2
 
3
3
  // SirMallard/Iris — vendored into CluauppLibs.Iris
4
- class IrisWidget {};
5
- class IrisState {};
4
+ struct IrisWidget {};
5
+ struct IrisState {};
6
6
 
7
7
  namespace Iris {
8
8
  void Init();
@@ -1,8 +1,7 @@
1
1
  #pragma once
2
2
 
3
3
  // howmanysmall/Janitor — vendored into CluauppLibs.Janitor
4
- class Janitor {
5
- public:
4
+ struct Janitor {
6
5
  bool CurrentlyCleaning;
7
6
  bool SuppressInstanceReDestroy;
8
7
  bool UnsafeThreadCleanup;
@@ -1,8 +1,7 @@
1
1
  #pragma once
2
2
 
3
3
  // TheNexusAvenger/Module3D — ViewportFrame adorn, vendored into CluauppLibs.Module3D
4
- class Model3D {
5
- public:
4
+ struct Model3D {
6
5
  Model* Object3D;
7
6
  GuiObject* AdornFrame;
8
7
  Camera* Camera;
@@ -18,8 +17,7 @@ public:
18
17
  void End();
19
18
  };
20
19
 
21
- class Module3D {
22
- public:
20
+ struct Module3D {
23
21
  static Model3D* new_(Instance* model);
24
22
  static Model3D* Attach3D(GuiObject* frame, Instance* model);
25
23
  };
@@ -1,8 +1,7 @@
1
1
  #pragma once
2
2
 
3
3
  // Buffer-packed RemoteEvent / RemoteFunction. Names are unique per game.
4
- class NetEvent {
5
- public:
4
+ struct NetEvent {
6
5
  void Fire(Player* player);
7
6
  template <typename A>
8
7
  void Fire(Player* player, A a);
@@ -23,8 +22,7 @@ public:
23
22
  void On(void (*callback)());
24
23
  };
25
24
 
26
- class NetFunction {
27
- public:
25
+ struct NetFunction {
28
26
  void On(void (*callback)());
29
27
  template <typename R>
30
28
  R Invoke(Player* player);
@@ -1,9 +1,6 @@
1
1
  #pragma once
2
-
3
2
  // evaera/roblox-lua-promise — vendored into CluauppLibs.Promise
4
- // C++ Then/Catch/Await/Cancel map onto andThen/catch/await/cancel.
5
- class Promise {
6
- public:
3
+ struct Promise {
7
4
  Promise(void (*executor)());
8
5
  template <typename T>
9
6
  static Promise* resolve(T value);
@@ -1,8 +1,7 @@
1
1
  #pragma once
2
2
 
3
3
  // nightcycle/spring — Fraktality-style damped spring, vendored into CluauppLibs.Spring
4
- class Spring {
5
- public:
4
+ struct Spring {
6
5
  double Damping;
7
6
  double Frequency;
8
7
  double Goal;
@@ -1,10 +1,9 @@
1
1
  #pragma once
2
2
 
3
3
  // Prooheckcp/RobloxStateMachine — vendored into CluauppLibs.StateMachine
4
- class StateData {};
4
+ struct StateData {};
5
5
 
6
- class StateMachine {
7
- public:
6
+ struct StateMachine {
8
7
  static StateMachine* new_(string initial);
9
8
  static StateData* LoadDirectory(Instance* directory);
10
9
  void ChangeState(string name);
@@ -1,8 +1,7 @@
1
1
  #pragma once
2
2
 
3
3
  // Cluaupp StickyBillboard — BillboardGui that stays on an adornee.
4
- class StickyBillboard {
5
- public:
4
+ struct StickyBillboard {
6
5
  static StickyBillboard* new_(Instance* adornee, GuiObject* gui);
7
6
  void SetText(string text);
8
7
  void SetEnabled(bool enabled);
@@ -1,10 +1,9 @@
1
1
  #pragma once
2
2
 
3
- // 1ForeverHD/TopbarPlus — vendored into CluauppLibs.TopbarPlus (class Icon)
4
- class IconTheme {};
3
+ // 1ForeverHD/TopbarPlus — vendored into CluauppLibs.TopbarPlus (struct Icon)
4
+ struct IconTheme {};
5
5
 
6
- class Icon {
7
- public:
6
+ struct Icon {
8
7
  static Icon* new_();
9
8
  Icon* setName(string name);
10
9
  Icon* setLabel(string text);
@@ -0,0 +1,24 @@
1
+ #pragma once
2
+ // Cluaupp libraries — CL++ IntelliSense. clpp emits
3
+ // require(ReplicatedStorage.CluauppLibs.*). Runtime lives in runtime/.
4
+
5
+ #include <clpp/generated/instances.clh>
6
+ #include <clpp/libs/janitor.clh>
7
+ #include <clpp/libs/promise.clh>
8
+ #include <clpp/libs/net.clh>
9
+ #include <clpp/libs/math.clh>
10
+ #include <clpp/libs/formatnumber.clh>
11
+ #include <clpp/libs/module3d.clh>
12
+ #include <clpp/libs/twinkle.clh>
13
+ #include <clpp/libs/dataservice.clh>
14
+ #include <clpp/libs/ezvisual.clh>
15
+ #include <clpp/libs/spring.clh>
16
+ #include <clpp/libs/display.clh>
17
+ #include <clpp/libs/stickybillboard.clh>
18
+ #include <clpp/libs/topbarplus.clh>
19
+ #include <clpp/libs/cmdr.clh>
20
+ #include <clpp/libs/chrono.clh>
21
+ #include <clpp/libs/iris.clh>
22
+ #include <clpp/libs/fusion.clh>
23
+ #include <clpp/libs/statemachine.clh>
24
+ #include <clpp/libs/vfx.clh>
@@ -0,0 +1,31 @@
1
+ #pragma once
2
+ // Cluaupp — Roblox API stubs for CL++ IntelliSense.
3
+ // Source: official client dump + datatypes from create.roblox.com
4
+ // clpp emits Luau (Vector3.new, Instance.new, :GetPlayers, ...).
5
+
6
+ #include <clpp/generated/enums.clh>
7
+ #include <clpp/datatypes.clh>
8
+ #include <clpp/generated/instances.clh>
9
+ #include <clpp/libs.clh>
10
+
11
+ template <typename T>
12
+ T* GetService();
13
+
14
+ template <typename T>
15
+ T* GetService(Instance* game_);
16
+
17
+ extern DataModel* game;
18
+ extern Workspace* workspace;
19
+ extern LuaSourceContainer* script;
20
+
21
+ void post(string message);
22
+ void warn(string message);
23
+ void report(string message);
24
+ void print(string message);
25
+ void error(string message);
26
+
27
+ double tick();
28
+ double time();
29
+ void wait(double seconds = 0);
30
+ void spawn(void (*callback)());
31
+ void delay(double seconds, void (*callback)());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cluaupp",
3
- "version": "0.2.2",
4
- "description": "Cluaupp — the definitive merge of C++ and modern Luau. Source-to-source transpiler with first-class Roblox APIs.",
3
+ "version": "1.0.0",
4
+ "description": "Cluaupp toolchain — compile CL++ to Luau with Rojo and CluauppLibs.",
5
5
  "author": "KartzDev",
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -34,13 +34,15 @@
34
34
  "build:cli": "tsc",
35
35
  "dev:cli": "tsx src/cli.ts",
36
36
  "prepare": "tsc",
37
- "test": "node test/out.test.js && node test/types.test.js && node test/modules.test.js && node test/security.test.js && node test/understander.test.js",
37
+ "test": "node test/security.test.js && node test/understander.test.js && node test/out.test.js && node test/types.test.js && node test/modules.test.js && node test/clpp.test.js",
38
+ "test:clpp-contract": "node test/clpp.test.js",
38
39
  "generate-api": "node scripts/generate-api.js",
39
- "check-highlight": "node scripts/check-highlight.js",
40
+ "check-highlight": "tsx web/src/check-content.ts",
40
41
  "vendor-libs": "node scripts/vendor-libs.js",
41
42
  "docs": "moonwave dev",
42
43
  "docs:build": "moonwave build",
43
- "site": "node scripts/generate-api.js && node scripts/check-highlight.js",
44
+ "site": "vite build --config web/vite.config.mts && npm run check-highlight",
45
+ "site:dev": "vite --config web/vite.config.mts",
44
46
  "dev": "node scripts/dev.js",
45
47
  "stop": "node scripts/stop.js",
46
48
  "prepublishOnly": "tsc && npm test"
@@ -51,13 +53,12 @@
51
53
  "keywords": [
52
54
  "luau",
53
55
  "roblox",
54
- "cpp",
55
- "c++",
56
+ "clpp",
57
+ "cl++",
56
58
  "transpiler",
57
59
  "compiler",
58
60
  "rojo",
59
- "cluaupp",
60
- "cluau"
61
+ "cluaupp"
61
62
  ],
62
63
  "repository": {
63
64
  "type": "git",
@@ -70,18 +71,21 @@
70
71
  "dependencies": {
71
72
  "commander": "^15.0.0",
72
73
  "comment-json": "^5.0.0",
73
- "tree-sitter": "0.21.1",
74
- "tree-sitter-c": "0.23.2",
75
- "tree-sitter-cpp": "0.23.4",
76
74
  "vscode-languageserver": "^10.1.1",
77
75
  "vscode-languageserver-textdocument": "^1.0.14"
78
76
  },
79
- "overrides": {
80
- "tree-sitter-c": "0.23.2"
81
- },
82
77
  "devDependencies": {
83
78
  "@types/node": "^22.20.3",
79
+ "@types/react": "^19.3.0",
80
+ "@types/react-dom": "^19.3.0",
81
+ "@vitejs/plugin-react": "^6.0.1",
82
+ "@vitejs/plugin-vue": "^6.0.1",
83
+ "react": "^19.1.1",
84
+ "react-dom": "^19.1.1",
85
+ "react-router-dom": "^7.8.2",
84
86
  "tsx": "^4.23.13",
85
- "typescript": "^7.0.2"
87
+ "typescript": "^7.0.2",
88
+ "vite": "^8.0.0",
89
+ "vue": "^3.5.21"
86
90
  }
87
91
  }
package/src/api.ts CHANGED
@@ -45,9 +45,23 @@ export function luauType(name: string | null | undefined): string | null {
45
45
  if (!name) {
46
46
  return null;
47
47
  }
48
- const cleaned = String(name).replace(/\*+$/, "").replace(/^const\s+/, "").replace(/^Enum::/, "Enum.");
48
+ const cleaned = String(name)
49
+ .replace(/\*+$/, "")
50
+ .replace(/^const\s+/, "")
51
+ .replace(/^Enum::/, "Enum.")
52
+ .replace(/\s+/g, " ")
53
+ .trim();
49
54
  if (cleaned in LUAU_TYPES) {
50
55
  return LUAU_TYPES[cleaned];
51
56
  }
57
+ const generic = cleaned.match(/^(?:std::)?(?:vector|array|span|LuaArray)\s*<\s*([^>]+)\s*>$/);
58
+ if (generic) {
59
+ const inner = luauType(generic[1]) || generic[1];
60
+ return `{${inner}}`;
61
+ }
62
+ const optional = cleaned.match(/^(?:std::)?optional\s*<\s*([^>]+)\s*>$/);
63
+ if (optional) {
64
+ return `${luauType(optional[1]) || optional[1]}?`;
65
+ }
52
66
  return cleaned;
53
67
  }
package/src/cli.ts CHANGED
@@ -3,11 +3,13 @@ import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { pkg } from "./package-info.js";
5
5
  import { start as startLsp } from "./lsp.js";
6
- import { toLuauPath } from "./preprocess.js";
6
+ import { collectSources, toLuauPath } from "./clpp/paths.js";
7
+ import { CLPP_INSTALL_HINT } from "./clpp/contract.js";
8
+ import { clppManifest, clppVersion, hasClpp, resolveClppBinary } from "./clpp/runner.js";
7
9
  import { installEditorSupport, syncEditorSupport } from "./intellisense.js";
8
10
  import { RojoMapper } from "./utils/rojo-mapper.js";
9
11
  import { ProcessOrchestrator } from "./utils/process-orchestrator.js";
10
- import { build as buildProject, init, loadConfig, watch, collectCpp } from "./utils/project.js";
12
+ import { build as buildProject, init, loadConfig, watch } from "./utils/project.js";
11
13
  import { transpileSource } from "./transpile.js";
12
14
  import type { BuildOptions, BuildResult } from "./types.js";
13
15
 
@@ -15,7 +17,7 @@ const program = new Command();
15
17
 
16
18
  program
17
19
  .name("cluaupp")
18
- .description("Definitive transpiler from C++ subset to structured Luau")
20
+ .description("Cluaupp toolchain — compile CL++ to Luau, Rojo, and CluauppLibs")
19
21
  .version(pkg.version, "-v, --version", "print version")
20
22
  .showHelpAfterError()
21
23
  .action(() => {
@@ -37,14 +39,14 @@ program
37
39
 
38
40
  program
39
41
  .command("build")
40
- .description("Transpila um arquivo, diretório ou projeto C++ para Luau")
42
+ .description("Compile a CL++ file, directory, or project to Luau")
41
43
  .argument("[folder]", "project folder", ".")
42
- .option("-i, --input <path>", "Arquivo ou diretório C++ de entrada")
43
- .option("-o, --output <path>", "Arquivo ou diretório Luau de saída")
44
- .option("-r, --rojo <path>", "Caminho para o default.project.json do Rojo", "./default.project.json")
45
- .option("--strict", "Emitir --!strict")
46
- .option("--format", "Rodar StyLua no output")
47
- .option("--analyze", "Rodar luau-analyze no output")
44
+ .option("-i, --input <path>", "CL++ file or directory")
45
+ .option("-o, --output <path>", "Luau file or directory")
46
+ .option("-r, --rojo <path>", "Path to Rojo default.project.json", "./default.project.json")
47
+ .option("--strict", "Emit --!strict")
48
+ .option("--format", "Run StyLua on output")
49
+ .option("--analyze", "Run luau-analyze on output")
48
50
  .action(async (folder: string, options: {
49
51
  input?: string;
50
52
  output?: string;
@@ -73,8 +75,8 @@ program
73
75
  .command("watch")
74
76
  .description("rebuild on save")
75
77
  .argument("[folder]", "project folder", ".")
76
- .option("-r, --rojo <path>", "Caminho para o default.project.json do Rojo", "./default.project.json")
77
- .option("--format", "Rodar StyLua no output")
78
+ .option("-r, --rojo <path>", "Path to Rojo default.project.json", "./default.project.json")
79
+ .option("--format", "Run StyLua on output")
78
80
  .action((folder: string, options: { rojo?: string; format?: boolean }) => {
79
81
  try {
80
82
  watch(path.resolve(process.cwd(), folder), {
@@ -89,7 +91,7 @@ program
89
91
 
90
92
  program
91
93
  .command("lsp")
92
- .description("Cluaupp subset diagnostics over stdio (JSON-RPC). C++ completion is clangd.")
94
+ .description("Language server stdio (JSON-RPC). Use `clpp install` for CL++ IntelliSense.")
93
95
  .argument("[folder]", "project folder", ".")
94
96
  .action((folder: string) => {
95
97
  startLsp({ projectRoot: path.resolve(process.cwd(), folder) });
@@ -98,18 +100,32 @@ program
98
100
  program
99
101
  .command("intellisense")
100
102
  .alias("intelisense")
101
- .description("install LLVM clangd and write compile_commands.json")
103
+ .description("Point the editor at CL++ (`clpp install`)")
102
104
  .argument("[folder]", "project folder", ".")
103
105
  .action(async (folder: string) => {
104
106
  try {
105
107
  const root = path.resolve(process.cwd(), folder);
106
108
  syncEditorSupport(root, loadConfig(root));
107
- const installed = await installEditorSupport();
108
- console.log("cluaupp: compile_commands.json, .clangd, and .vscode updated in", root);
109
- console.log("cluaupp: C++ completion is clangd (include/cluaupp/roblox.hpp)");
110
- if (installed.clangd || installed.llvm) {
111
- console.log("cluaupp: reload Cursor (Ctrl+Shift+P → Developer: Reload Window)");
109
+ await installEditorSupport();
110
+ console.log("cluaupp: editor associations written in", root);
111
+ console.log("cluaupp:", CLPP_INSTALL_HINT);
112
+ } catch (err) {
113
+ console.error(err instanceof Error ? err.message : err);
114
+ process.exit(1);
115
+ }
116
+ });
117
+
118
+ program
119
+ .command("language")
120
+ .description("CL++ manifest (`clpp api manifest`)")
121
+ .action(() => {
122
+ try {
123
+ resolveClppBinary();
124
+ const version = clppVersion();
125
+ if (version) {
126
+ console.log("clpp", version);
112
127
  }
128
+ console.log(JSON.stringify(clppManifest(), null, "\t"));
113
129
  } catch (err) {
114
130
  console.error(err instanceof Error ? err.message : err);
115
131
  process.exit(1);
@@ -139,17 +155,15 @@ async function buildInput(options: {
139
155
  process.exit(1);
140
156
  }
141
157
 
142
- console.log("🏁 Inicializando Pipeline do Compilador Cluaupp V2...");
143
-
144
158
  const mapper = new RojoMapper(path.resolve(options.rojo), path.dirname(inputPath));
145
159
  await mapper.load();
146
160
 
147
161
  const inputs = (await fs.stat(inputPath)).isDirectory()
148
- ? collectCpp(inputPath)
162
+ ? collectSources(inputPath)
149
163
  : [inputPath];
150
164
 
151
165
  if (inputs.length === 0) {
152
- console.error("no .cpp/.h/.hpp files in", inputPath);
166
+ console.error("no .clpp/.clp/.clh files in", inputPath);
153
167
  process.exit(1);
154
168
  }
155
169
 
@@ -184,7 +198,7 @@ async function buildInput(options: {
184
198
  console.log("\nRelatório de Análise Estática do Luau:\n", analysisReport);
185
199
  }
186
200
  }
187
- console.log(`Transpilação concluída! ${file} → ${dest}`);
201
+ console.log(`Compiled ${file} → ${dest}`);
188
202
  }
189
203
  }
190
204
 
@@ -192,7 +206,7 @@ export function build(root: string, options: BuildOptions = {}): BuildResult {
192
206
  return buildProject(root, options);
193
207
  }
194
208
 
195
- export { watch, init, program };
209
+ export { watch, init, program, hasClpp };
196
210
 
197
211
  export function dispatch(args: string[]): Promise<Command> {
198
212
  return program.parseAsync(["node", "cluaupp", ...args]);
@@ -0,0 +1,39 @@
1
+ /** Stable CL++ ↔ Cluaupp contract. Cluaupp invokes the `clpp` binary. */
2
+
3
+ export interface CompileRequest {
4
+ source: string;
5
+ fileName: string;
6
+ strict?: boolean;
7
+ cwd?: string;
8
+ }
9
+
10
+ export interface CompileArtifact {
11
+ ok: boolean;
12
+ luau: string;
13
+ fileName: string;
14
+ outputHint: string;
15
+ scriptKind: "server" | "client" | "plugin" | null;
16
+ isScript: boolean;
17
+ isHeader: boolean;
18
+ rojoClass: "Script" | "LocalScript" | "ModuleScript";
19
+ libraries: string[];
20
+ error?: string;
21
+ }
22
+
23
+ export interface LanguageManifest {
24
+ name: "CL++";
25
+ id: "clpp";
26
+ version: string;
27
+ extensions: string[];
28
+ tags: Array<{
29
+ pattern: string;
30
+ scriptKind: string;
31
+ rojoClass: string;
32
+ }>;
33
+ builtins: string[];
34
+ operators: Array<{ clpp: string; luau: string; meaning: string }>;
35
+ io: Array<{ clpp: string; luau: string }>;
36
+ }
37
+
38
+ export const CLPP_INSTALL_HINT =
39
+ "Install CL++ and put `clpp` on PATH: https://github.com/KartzRbx/CLPP (`cargo install --path .` then `clpp install`). Override with CLPP_PATH.";
@@ -0,0 +1,18 @@
1
+ export type { CompileArtifact, CompileRequest, LanguageManifest } from "./contract.js";
2
+ export { CLPP_INSTALL_HINT } from "./contract.js";
3
+ export { compileViaClpp, clppManifest, clppVersion, hasClpp, resolveClppBinary } from "./runner.js";
4
+ export { clppLuauToGame, shouldSkipInit } from "./postprocess.js";
5
+ export {
6
+ SOURCE_EXTS,
7
+ collectSources,
8
+ emitKind,
9
+ fileStem,
10
+ isEngineStub,
11
+ isHeaderFile,
12
+ isImplFile,
13
+ isSourceFile,
14
+ isTaggedScript,
15
+ scriptKind,
16
+ siblingHeader,
17
+ toLuauPath,
18
+ } from "./paths.js";