titanpl 1.0.0 → 1.4.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 (188) hide show
  1. package/README.md +15 -18
  2. package/package.json +7 -5
  3. package/packages/cli/README.md +17 -0
  4. package/packages/cli/index.js +20 -0
  5. package/packages/cli/package.json +34 -0
  6. package/packages/cli/src/commands/build.js +6 -0
  7. package/packages/cli/src/commands/dev.js +5 -0
  8. package/packages/cli/src/commands/init.js +182 -0
  9. package/packages/cli/src/commands/migrate.js +106 -0
  10. package/packages/cli/src/commands/start.js +5 -0
  11. package/packages/cli/src/commands/update.js +90 -0
  12. package/packages/cli/src/engine.js +143 -0
  13. package/packages/engine-darwin-arm64/README.md +13 -0
  14. package/packages/engine-darwin-arm64/package.json +10 -0
  15. package/packages/engine-linux-x64/README.md +11 -0
  16. package/packages/engine-linux-x64/package.json +10 -0
  17. package/packages/engine-win32-x64/README.md +11 -0
  18. package/packages/engine-win32-x64/bin/titan-engine.exe +0 -0
  19. package/packages/engine-win32-x64/bin/titan-server.exe +0 -0
  20. package/packages/engine-win32-x64/package.json +10 -0
  21. package/packages/native/README.md +11 -0
  22. package/packages/native/index.d.ts +41 -0
  23. package/packages/native/index.js +39 -0
  24. package/packages/native/package.json +26 -0
  25. package/packages/native/t.native.d.ts +2043 -0
  26. package/packages/packet/README.md +11 -0
  27. package/packages/packet/index.js +84 -0
  28. package/packages/packet/js/titan/builder.js +50 -0
  29. package/packages/packet/js/titan/bundle.js +164 -0
  30. package/packages/packet/js/titan/dev.js +172 -0
  31. package/packages/packet/js/titan/error-box.js +277 -0
  32. package/packages/packet/node_modules/typescript/LICENSE.txt +55 -0
  33. package/packages/packet/node_modules/typescript/README.md +50 -0
  34. package/packages/packet/node_modules/typescript/SECURITY.md +41 -0
  35. package/packages/packet/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  36. package/packages/packet/node_modules/typescript/bin/tsc +2 -0
  37. package/packages/packet/node_modules/typescript/bin/tsserver +2 -0
  38. package/packages/packet/node_modules/typescript/lib/_tsc.js +133818 -0
  39. package/packages/packet/node_modules/typescript/lib/_tsserver.js +659 -0
  40. package/packages/packet/node_modules/typescript/lib/_typingsInstaller.js +222 -0
  41. package/packages/packet/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
  42. package/packages/packet/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
  43. package/packages/packet/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
  44. package/packages/packet/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
  45. package/packages/packet/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
  46. package/packages/packet/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
  47. package/packages/packet/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
  48. package/packages/packet/node_modules/typescript/lib/lib.d.ts +22 -0
  49. package/packages/packet/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
  50. package/packages/packet/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  51. package/packages/packet/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  52. package/packages/packet/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
  53. package/packages/packet/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
  54. package/packages/packet/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  55. package/packages/packet/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  56. package/packages/packet/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  57. package/packages/packet/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  58. package/packages/packet/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
  59. package/packages/packet/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  60. package/packages/packet/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  61. package/packages/packet/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  62. package/packages/packet/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  63. package/packages/packet/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  64. package/packages/packet/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  65. package/packages/packet/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  66. package/packages/packet/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  67. package/packages/packet/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  68. package/packages/packet/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
  69. package/packages/packet/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
  70. package/packages/packet/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  71. package/packages/packet/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  72. package/packages/packet/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  73. package/packages/packet/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  74. package/packages/packet/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  75. package/packages/packet/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  76. package/packages/packet/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  77. package/packages/packet/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  78. package/packages/packet/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  79. package/packages/packet/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  80. package/packages/packet/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  81. package/packages/packet/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  82. package/packages/packet/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  83. package/packages/packet/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  84. package/packages/packet/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  85. package/packages/packet/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  86. package/packages/packet/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  87. package/packages/packet/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  88. package/packages/packet/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  89. package/packages/packet/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  90. package/packages/packet/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  91. package/packages/packet/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
  92. package/packages/packet/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  93. package/packages/packet/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  94. package/packages/packet/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  95. package/packages/packet/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  96. package/packages/packet/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  97. package/packages/packet/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  98. package/packages/packet/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
  99. package/packages/packet/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
  100. package/packages/packet/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  101. package/packages/packet/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  102. package/packages/packet/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  103. package/packages/packet/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  104. package/packages/packet/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  105. package/packages/packet/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  106. package/packages/packet/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
  107. package/packages/packet/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  108. package/packages/packet/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
  109. package/packages/packet/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
  110. package/packages/packet/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  111. package/packages/packet/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
  112. package/packages/packet/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  113. package/packages/packet/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  114. package/packages/packet/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  115. package/packages/packet/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  116. package/packages/packet/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  117. package/packages/packet/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  118. package/packages/packet/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  119. package/packages/packet/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  120. package/packages/packet/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
  121. package/packages/packet/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
  122. package/packages/packet/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
  123. package/packages/packet/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
  124. package/packages/packet/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
  125. package/packages/packet/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
  126. package/packages/packet/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
  127. package/packages/packet/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
  128. package/packages/packet/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
  129. package/packages/packet/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
  130. package/packages/packet/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  131. package/packages/packet/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  132. package/packages/packet/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
  133. package/packages/packet/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
  134. package/packages/packet/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  135. package/packages/packet/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  136. package/packages/packet/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
  137. package/packages/packet/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
  138. package/packages/packet/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  139. package/packages/packet/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  140. package/packages/packet/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  141. package/packages/packet/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
  142. package/packages/packet/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
  143. package/packages/packet/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  144. package/packages/packet/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  145. package/packages/packet/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
  146. package/packages/packet/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  147. package/packages/packet/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
  148. package/packages/packet/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
  149. package/packages/packet/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
  150. package/packages/packet/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
  151. package/packages/packet/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
  152. package/packages/packet/node_modules/typescript/lib/tsc.js +8 -0
  153. package/packages/packet/node_modules/typescript/lib/tsserver.js +8 -0
  154. package/packages/packet/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  155. package/packages/packet/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  156. package/packages/packet/node_modules/typescript/lib/typesMap.json +497 -0
  157. package/packages/packet/node_modules/typescript/lib/typescript.d.ts +11437 -0
  158. package/packages/packet/node_modules/typescript/lib/typescript.js +200276 -0
  159. package/packages/packet/node_modules/typescript/lib/typingsInstaller.js +8 -0
  160. package/packages/packet/node_modules/typescript/lib/watchGuard.js +53 -0
  161. package/packages/packet/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
  162. package/packages/packet/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
  163. package/packages/packet/node_modules/typescript/package.json +120 -0
  164. package/packages/packet/package.json +23 -0
  165. package/packages/packet/ts/titan/builder.js +74 -0
  166. package/packages/packet/ts/titan/bundle.js +227 -0
  167. package/packages/packet/ts/titan/dev.js +175 -0
  168. package/packages/packet/ts/titan/error-box.js +277 -0
  169. package/packages/route/README.md +24 -0
  170. package/packages/route/index.d.ts +16 -0
  171. package/packages/route/index.js +52 -0
  172. package/packages/route/package.json +22 -0
  173. package/templates/extension/README.md +4 -0
  174. package/templates/extension/index.js +1 -12
  175. package/templates/extension/package.json +4 -4
  176. package/templates/js/app/app.js +1 -1
  177. package/templates/js/package.json +9 -8
  178. package/templates/rust-js/package.json +7 -7
  179. package/templates/rust-js/titan/dev.js +2 -2
  180. package/templates/rust-ts/package.json +7 -7
  181. package/templates/rust-ts/titan/dev.js +2 -2
  182. package/templates/ts/app/app.ts +1 -1
  183. package/templates/ts/package.json +9 -8
  184. package/titanpl-sdk/README.md +2 -0
  185. package/titanpl-sdk/package.json +4 -4
  186. package/titanpl-sdk/templates/titan/bundle.js +1 -1
  187. package/titanpl-sdk/templates/titan/dev.js +2 -2
  188. package/titanpl-sdk/templates/titan/error-box.js +2 -2
package/README.md CHANGED
@@ -9,8 +9,8 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="https://www.npmjs.com/package/@ezetgalaxy/titan">
13
- <img src="https://img.shields.io/npm/v/@ezetgalaxy/titan?style=for-the-badge&logo=npm&logoColor=white" />
12
+ <a href="https://www.npmjs.com/package/titanpl">
13
+ <img src="https://img.shields.io/npm/v/titanpl?style=for-the-badge&logo=npm&logoColor=white" />
14
14
  </a>
15
15
 
16
16
  <img src="https://img.shields.io/badge/Runtime-Gravity(V8)%20%26%20Rust%20Tokio-1f2937?style=for-the-badge" />
@@ -84,8 +84,9 @@ Titan handles the integration automatically.
84
84
  * **Node.js** (v18+): Required for CLI and JS tooling.
85
85
 
86
86
  ### 2. Install CLI
87
+ **The `titanpl` CLI is used to create and manage all your new projects and everything related to Titan.**
87
88
  ```bash
88
- npm install -g @ezetgalaxy/titan
89
+ npm install -g @titanpl/cli@latest
89
90
  ```
90
91
 
91
92
  ### 3. Initialize & Run
@@ -103,29 +104,25 @@ titan init my-app
103
104
  1. `Standard` (Pure JS/TS)
104
105
  2. `Rust + JS/TS (Hybrid)` (High-performance native actions)
105
106
 
106
- This creates one of four isolated environments:
107
- * **Standard JS:** Lightweight server, zero Rust overhead.
108
- * **Standard TS:** Strict server, zero Rust overhead.
109
- * **Hybrid JS:** Full Rust integration + JS flexibility.
110
- * **Hybrid TS:** Full Rust integration + TS strictness.
111
-
112
107
  Inside your project:
113
108
  ```bash
114
109
  cd my-app
115
- titan dev
110
+ npm run dev
116
111
  ```
117
112
 
118
113
  You'll see the Titan Dev Server spin up:
119
114
  ```
120
- Titan Planet v26.16.0 [ Dev Mode ]
115
+ Titan Planet v1.0.0 [ Dev Mode ]
121
116
 
122
- Type: Rust + TS Actions
117
+ Type: TS Actions
123
118
  Hot Reload: Enabled
124
- Strict Mode: Active 🛡️
119
+ Env: Loaded
120
+
121
+ 🚀 Starting Titan Engine...
122
+ [Titan] 1 reply route(s) pre-computed
123
+ Titan server running at: http://localhost:5100 (Threads: 32, Stack: 8MB, Dev Mode)
124
+
125
125
 
126
- • Preparing runtime... Done
127
- • A new orbit is ready for your app in 0.9s
128
- • Your app is now orbiting Titan Planet
129
126
  ```
130
127
 
131
128
 
@@ -136,7 +133,7 @@ Titan is unique because it allows you to write endpoints in **JavaScript, TypeSc
136
133
  | Feature | Status | Notes |
137
134
  | :--- | :--- | :--- |
138
135
  | **Standard JavaScript** | ✅ Stable | Production Ready |
139
- | **Standard TypeScript** | 🚧 Beta | **Ready for Dev**, Production Under Testing |
136
+ | **Standard TypeScript** | Stable | Production Ready |
140
137
  | **Rust + JS (Hybrid)** | 🧪 Experimental | **Dev Only**, Production Under Testing |
141
138
  | **Rust + TS (Hybrid)** | 🧪 Experimental | **Dev Only**, Production Under Testing |
142
139
 
@@ -144,7 +141,7 @@ Titan is unique because it allows you to write endpoints in **JavaScript, TypeSc
144
141
  Fully typed, strict, and auto-compiled.
145
142
 
146
143
  ```typescript
147
- import { defineAction } from "../../titan/titan";
144
+ import { defineAction } from "@titanpl/native";
148
145
 
149
146
  interface HelloResponse {
150
147
  message: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "titanpl",
3
- "version": "1.0.0",
3
+ "version": "1.4.0",
4
4
  "description": "Titan Planet is a JavaScript-first backend framework that embeds JS actions into a Rust + Axum server and ships as a single native binary. Routes are compiled to static metadata; only actions run in the embedded JS runtime. No Node.js. No event loop in production.",
5
5
  "license": "ISC",
6
6
  "author": "ezetgalaxy",
@@ -8,7 +8,8 @@
8
8
  "main": "index.js",
9
9
  "bin": {
10
10
  "tit": "./packages/cli/index.js",
11
- "titan": "./packages/cli/index.js"
11
+ "titan": "./packages/cli/index.js",
12
+ "titanpl": "./packages/cli/index.js"
12
13
  },
13
14
  "workspaces": [
14
15
  "packages/*",
@@ -16,6 +17,7 @@
16
17
  ],
17
18
  "files": [
18
19
  "index.js",
20
+ "packages/",
19
21
  "templates/",
20
22
  "titanpl-sdk",
21
23
  "README.md"
@@ -69,8 +71,8 @@
69
71
  "test:all": "vitest run && vitest run --config vitest.config.e2e.ts"
70
72
  },
71
73
  "dependencies": {
72
- "@titanpl/core": "26.16.0",
73
- "@titanpl/node": "26.16.0",
74
+ "@titanpl/core": "1.4.0",
75
+ "@titanpl/node": "1.4.0",
74
76
  "chokidar": "^5.0.0",
75
77
  "esbuild": "^0.27.2",
76
78
  "prompts": "^2.4.2"
@@ -80,4 +82,4 @@
80
82
  "@vitest/ui": "^4.0.17",
81
83
  "vitest": "^4.0.17"
82
84
  }
83
- }
85
+ }
@@ -0,0 +1,17 @@
1
+ # @titanpl/cli
2
+
3
+ The command-line interface (CLI) for Titan Planet. It provides the `titan` and `tit` commands for initializing, building, and running Titan Planet servers.
4
+
5
+ ## What it works (What it does)
6
+ The CLI is responsible for bridging your JavaScript codebase with the underlying Rust/Axum engine. It handles scaffolding, compiling JS actions, generating metadata, and running the server.
7
+
8
+ ## How it works
9
+ You can install this package globally or use it via your package runner (e.g., `npx`). Alternatively, you can install it as a dev dependency in your project.
10
+
11
+ ```bash
12
+ npx titan help
13
+ ```
14
+
15
+ It parses your application source code, coordinates with `@titanpl/packet` to build the required JS endpoints, and then spins up the pre-compiled native core engine for your OS.
16
+
17
+ **Important Note:** Currently, Titan Planet and its entire package ecosystem are only for Windows. The Linux version is in development (dev only) for the new architecture and will be launched later.
@@ -8,6 +8,7 @@ import { buildCommand } from "./src/commands/build.js";
8
8
  import { devCommand } from "./src/commands/dev.js";
9
9
  import { startCommand } from "./src/commands/start.js";
10
10
  import { migrateCommand } from "./src/commands/migrate.js";
11
+ import { updateCommand } from "./src/commands/update.js";
11
12
  import { initCommand } from "./src/commands/init.js";
12
13
 
13
14
  /* -------------------------------------------------------
@@ -51,9 +52,11 @@ ${bold(cyan("╰─────────────────────
51
52
 
52
53
  ${bold("Commands:")}
53
54
  ${cyan("init")} ${gray("Scaffold a new Titan project")}
55
+ ${cyan("create")} ${gray("Create a new project or extension (e.g. 'titan create ext my-ext')")}
54
56
  ${cyan("build")} ${gray("Compile actions and build production dist")}
55
57
  ${cyan("dev")} ${gray("Start the Gravity Engine in dev/watch mode")}
56
58
  ${cyan("start")} ${gray("Start the production Gravity Engine")}
59
+ ${cyan("update")} ${gray("Update an existing project to latest Titan version")}
57
60
  ${cyan("migrate")} ${gray("Migrate a legacy project to the new architecture")}
58
61
 
59
62
  ${bold("Options:")}
@@ -68,6 +71,7 @@ ${gray(" The Titan Planet Engine runs your JS/TS server natively without Node.j
68
71
  /* -------------------------------------------------------
69
72
  * CLI Router
70
73
  * ----------------------------------------------------- */
74
+ process.title = "TitanPL";
71
75
  const cmd = process.argv[2];
72
76
 
73
77
  (async () => {
@@ -105,6 +109,18 @@ const cmd = process.argv[2];
105
109
  break;
106
110
  }
107
111
 
112
+ case "create": {
113
+ const type = process.argv[3];
114
+ const name = process.argv[4];
115
+ if (type === "ext" || type === "extension") {
116
+ await initCommand(name, "extension");
117
+ } else {
118
+ // Fallback to init behavior
119
+ await initCommand(type, null);
120
+ }
121
+ break;
122
+ }
123
+
108
124
  case "build":
109
125
  console.log(cyan("→ Building Titan project..."));
110
126
  await buildCommand();
@@ -120,6 +136,10 @@ const cmd = process.argv[2];
120
136
  startCommand();
121
137
  break;
122
138
 
139
+ case "update":
140
+ await updateCommand();
141
+ break;
142
+
123
143
  case "migrate":
124
144
  await migrateCommand();
125
145
  break;
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@titanpl/cli",
3
+ "version": "1.4.0",
4
+ "description": "The unified CLI for Titan Planet. Use it to create, manage, build, and deploy high-performance backend projects.",
5
+ "keywords": [
6
+ "titanpl",
7
+ "titan",
8
+ "ezetgalaxy",
9
+ "cli"
10
+ ],
11
+ "license": "ISC",
12
+ "author": "ezetgalaxy",
13
+ "type": "module",
14
+ "main": "index.js",
15
+ "scripts": {
16
+ "test": "echo \"Error: no test specified\" && exit 1"
17
+ },
18
+ "bin": {
19
+ "titan": "./index.js",
20
+ "titanpl": "./index.js",
21
+ "tit": "./index.js"
22
+ },
23
+ "optionalDependencies": {
24
+ "@titanpl/engine-win32-x64": "1.4.0",
25
+ "@titanpl/engine-linux-x64": "1.4.0",
26
+ "@titanpl/engine-darwin-arm64": "1.4.0"
27
+ },
28
+ "dependencies": {
29
+ "@titanpl/packet": "1.4.0",
30
+ "prompts": "^2.4.2",
31
+ "commander": "^11.0.0",
32
+ "chalk": "^4.1.2"
33
+ }
34
+ }
@@ -0,0 +1,6 @@
1
+ import { build } from "@titanpl/packet";
2
+
3
+ export async function buildCommand() {
4
+ const dist = await build(process.cwd());
5
+ console.log("✔ Build complete →", dist);
6
+ }
@@ -0,0 +1,5 @@
1
+ import { dev } from "@titanpl/packet";
2
+
3
+ export async function devCommand() {
4
+ await dev(process.cwd());
5
+ }
@@ -0,0 +1,182 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { spawn } from 'child_process';
5
+ import prompts from 'prompts';
6
+ import chalk from 'chalk';
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+
11
+ export function copyDir(src, dest, excludes = []) {
12
+ fs.mkdirSync(dest, { recursive: true });
13
+
14
+ for (const file of fs.readdirSync(src)) {
15
+ if (excludes.includes(file)) continue;
16
+
17
+ const srcPath = path.join(src, file);
18
+ const destPath = path.join(dest, file);
19
+
20
+ if (fs.lstatSync(srcPath).isDirectory()) {
21
+ copyDir(srcPath, destPath, excludes);
22
+ } else {
23
+ fs.copyFileSync(srcPath, destPath);
24
+ }
25
+ }
26
+ }
27
+
28
+ export async function initCommand(projectName, templateName) {
29
+ let projName = projectName;
30
+
31
+ if (!projName) {
32
+ const res = await prompts({
33
+ type: 'text',
34
+ name: 'name',
35
+ message: 'Project name:',
36
+ initial: 'my-titan-app'
37
+ });
38
+ projName = res.name;
39
+ }
40
+
41
+ if (!projName) {
42
+ console.log(chalk.red("✖ Initialization cancelled."));
43
+ process.exit(1);
44
+ }
45
+
46
+ let selectedTemplate = templateName;
47
+
48
+ if (!selectedTemplate) {
49
+ const langRes = await prompts({
50
+ type: 'select',
51
+ name: 'value',
52
+ message: 'Select language:',
53
+ choices: [
54
+ { title: 'JavaScript', value: 'js' },
55
+ { title: 'TypeScript', value: 'ts' },
56
+ ],
57
+ initial: 0
58
+ });
59
+
60
+ if (!langRes.value) {
61
+ console.log(chalk.red("✖ Operation cancelled."));
62
+ process.exit(1);
63
+ }
64
+ const lang = langRes.value;
65
+
66
+ const archRes = await prompts({
67
+ type: 'select',
68
+ name: 'value',
69
+ message: 'Select template:',
70
+ choices: [
71
+ {
72
+ title: `Standard (${lang.toUpperCase()})`,
73
+ description: `Standard Titan app with ${lang.toUpperCase()} actions`,
74
+ value: 'standard'
75
+ },
76
+ {
77
+ title: `Rust + ${lang.toUpperCase()} (Hybrid)`,
78
+ description: `High-performance Rust actions + ${lang.toUpperCase()} flexibility`,
79
+ value: 'hybrid'
80
+ }
81
+ ],
82
+ initial: 0
83
+ });
84
+
85
+ if (!archRes.value) {
86
+ console.log(chalk.red("✖ Operation cancelled."));
87
+ process.exit(1);
88
+ }
89
+ const arch = archRes.value;
90
+
91
+ if (lang === 'js') {
92
+ selectedTemplate = arch === 'standard' ? 'js' : 'rust-js';
93
+ } else {
94
+ selectedTemplate = arch === 'standard' ? 'ts' : 'rust-ts';
95
+ }
96
+ }
97
+
98
+ const target = path.resolve(process.cwd(), projName);
99
+ const templateDir = path.resolve(__dirname, '..', '..', '..', '..', 'templates', selectedTemplate);
100
+ const commonDir = path.resolve(__dirname, '..', '..', '..', '..', 'templates', 'common');
101
+
102
+ if (!fs.existsSync(templateDir) || !fs.existsSync(commonDir)) {
103
+ console.log(chalk.red(`✖ Error finding template paths.Are you in a valid Titan monorepo ? `));
104
+ process.exit(1);
105
+ }
106
+
107
+ if (fs.existsSync(target)) {
108
+ console.log(chalk.red(`✖ Directory '${projName}' already exists.`));
109
+ process.exit(1);
110
+ }
111
+
112
+ console.log(chalk.cyan(`\n→ Creating new Titan project in '${projName}'...\n`));
113
+
114
+ // 1. Copy common
115
+ copyDir(commonDir, target);
116
+
117
+ // 2. Copy specific template
118
+ copyDir(templateDir, target);
119
+
120
+ // 3. Dotfiles and Template Remapping
121
+ const remapping = {
122
+ "_gitignore": ".gitignore",
123
+ "_dockerignore": ".dockerignore",
124
+ "_titan.json": "titan.json",
125
+ ".env": ".env"
126
+ };
127
+ for (const [srcName, destName] of Object.entries(remapping)) {
128
+ const src = path.join(target, srcName);
129
+ const dest = path.join(target, destName);
130
+ if (fs.existsSync(src)) {
131
+ fs.renameSync(src, dest);
132
+ }
133
+ }
134
+
135
+ // Recursive template substitution
136
+ const substitute = (dir) => {
137
+ for (const file of fs.readdirSync(dir)) {
138
+ const fullPath = path.join(dir, file);
139
+ if (fs.lstatSync(fullPath).isDirectory()) {
140
+ if (file !== "node_modules" && file !== ".git" && file !== "target") {
141
+ substitute(fullPath);
142
+ }
143
+ } else {
144
+ // Only process text files
145
+ const ext = path.extname(file).toLowerCase();
146
+ const textExts = ['.js', '.ts', '.json', '.md', '.txt', '.rs', '.toml', '.html', '.css', '.d.ts'];
147
+ if (textExts.includes(ext) || file === ".env" || file === "Dockerfile") {
148
+ let content = fs.readFileSync(fullPath, 'utf8');
149
+ let changed = false;
150
+ if (content.includes("{{name}}")) {
151
+ content = content.replace(/{{name}}/g, projName);
152
+ changed = true;
153
+ }
154
+ if (content.includes("{{native_name}}")) {
155
+ content = content.replace(/{{native_name}}/g, projName.replace(/-/g, '_'));
156
+ changed = true;
157
+ }
158
+ if (changed) {
159
+ fs.writeFileSync(fullPath, content);
160
+ }
161
+ }
162
+ }
163
+ }
164
+ };
165
+ substitute(target);
166
+
167
+ console.log(chalk.gray(` Installing dependencies...`));
168
+
169
+ await new Promise((resolve, reject) => {
170
+ const npm = spawn('npm', ['install'], {
171
+ cwd: target,
172
+ stdio: 'inherit',
173
+ shell: true
174
+ });
175
+ npm.on('error', reject);
176
+ npm.on('close', resolve);
177
+ });
178
+
179
+ console.log(chalk.green(`\n✔ Project '${projName}' created successfully!\n`));
180
+ console.log(chalk.yellow(` cd ${projName}`));
181
+ console.log(chalk.yellow(` npm run dev\n`));
182
+ }
@@ -0,0 +1,106 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+
4
+ export async function migrateCommand() {
5
+ const root = process.cwd();
6
+ console.log(`\n🔍 Checking project for legacy Titan architecture...`);
7
+
8
+ const serverDir = path.join(root, 'server');
9
+ const titanDir = path.join(root, 'titan');
10
+ const pkgPath = path.join(root, 'package.json');
11
+
12
+ if (!fs.existsSync(serverDir) && !fs.existsSync(titanDir)) {
13
+ console.log(`✅ This project is already using the modern Titan runtime architecture.`);
14
+ return;
15
+ }
16
+
17
+ console.log(`\n⚠️ Legacy server architecture detected. Migrating to runtime-first model...`);
18
+
19
+ // 1. Delete server/
20
+ if (fs.existsSync(serverDir)) {
21
+ console.log(` Deleting legacy server/ folder...`);
22
+ fs.rmSync(serverDir, { recursive: true, force: true });
23
+ }
24
+
25
+ // 2. Delete titan/ folder
26
+ if (fs.existsSync(titanDir)) {
27
+ console.log(` Deleting legacy titan/ runtime folder...`);
28
+ fs.rmSync(titanDir, { recursive: true, force: true });
29
+ }
30
+
31
+ // 3. Update package.json
32
+ if (fs.existsSync(pkgPath)) {
33
+ console.log(` Updating package.json...`);
34
+ try {
35
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
36
+ let modified = false;
37
+
38
+ // Update scripts
39
+ if (pkg.scripts) {
40
+ if (pkg.scripts.build && pkg.scripts.build.includes('cd server')) {
41
+ pkg.scripts.build = "titan build";
42
+ modified = true;
43
+ }
44
+ if (pkg.scripts.start && pkg.scripts.start.includes('cd server')) {
45
+ pkg.scripts.start = "titan start";
46
+ modified = true;
47
+ }
48
+ if (pkg.scripts.dev && pkg.scripts.dev.includes('titan/dev.js')) {
49
+ pkg.scripts.dev = "titan dev";
50
+ modified = true;
51
+ }
52
+ }
53
+
54
+ // Add dependencies
55
+ pkg.dependencies = pkg.dependencies || {};
56
+ if (!pkg.dependencies['@titan/native']) {
57
+ pkg.dependencies['@titan/native'] = "latest";
58
+ modified = true;
59
+ }
60
+ if (!pkg.dependencies['@titan/route']) {
61
+ pkg.dependencies['@titan/route'] = "latest";
62
+ modified = true;
63
+ }
64
+
65
+ if (modified) {
66
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
67
+ }
68
+ } catch (e) {
69
+ console.log(` ⚠️ Failed to update package.json automatically. Please do it manually.`);
70
+ }
71
+ }
72
+
73
+ // 4. Synchronize Dockerfile and other common files
74
+ try {
75
+ const commonDir = path.resolve(__dirname, '..', '..', '..', '..', 'templates', 'common');
76
+ if (fs.existsSync(commonDir)) {
77
+ const filesToSync = [
78
+ ['Dockerfile', 'Dockerfile'],
79
+ ['_dockerignore', '.dockerignore'],
80
+ ['_gitignore', '.gitignore'],
81
+ ['app/t.native.d.ts', 'app/t.native.d.ts'],
82
+ ['app/t.native.js', 'app/t.native.js']
83
+ ];
84
+
85
+ for (const [srcRel, destRel] of filesToSync) {
86
+ const src = path.join(commonDir, srcRel);
87
+ const dest = path.join(root, destRel);
88
+ if (fs.existsSync(src)) {
89
+ // Create parent dir if needed
90
+ const parent = path.dirname(dest);
91
+ if (!fs.existsSync(parent)) {
92
+ fs.mkdirSync(parent, { recursive: true });
93
+ }
94
+ fs.copyFileSync(src, dest);
95
+ }
96
+ }
97
+ console.log(` Synchronized Dockerfiles and native definitions.`);
98
+ }
99
+ } catch (e) {
100
+ console.log(` ⚠️ Failed to synchronize common template files.`);
101
+ }
102
+
103
+ console.log(`\n🎉 Migration complete!`);
104
+ console.log(` Please run 'npm install' to fetch the new dependencies.`);
105
+ console.log(` Then run 'titan dev' to start your application.\n`);
106
+ }
@@ -0,0 +1,5 @@
1
+ import { startEngine } from "../engine.js";
2
+
3
+ export function startCommand() {
4
+ startEngine(false);
5
+ }
@@ -0,0 +1,90 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import chalk from 'chalk';
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+
9
+ export async function updateCommand() {
10
+ const root = process.cwd();
11
+ console.log(chalk.cyan(`\n→ Updating Titan project to latest...`));
12
+
13
+ const pkgPath = path.join(root, 'package.json');
14
+ if (!fs.existsSync(pkgPath)) {
15
+ console.log(chalk.red(`✖ No package.json found. Are you in a project root ? `));
16
+ return;
17
+ }
18
+
19
+ // 1. Update package.json versions
20
+ try {
21
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
22
+ let modified = false;
23
+
24
+ const titanDeps = [
25
+ 'titanpl',
26
+ 'titanpl-sdk',
27
+ '@titanpl/cli',
28
+ '@titanpl/route',
29
+ '@titanpl/native',
30
+ '@titanpl/packet',
31
+ '@titanpl/core',
32
+ '@titanpl/node'
33
+ ];
34
+
35
+ if (pkg.dependencies) {
36
+ for (const dep of titanDeps) {
37
+ if (pkg.dependencies[dep]) {
38
+ pkg.dependencies[dep] = "latest";
39
+ modified = true;
40
+ }
41
+ }
42
+ }
43
+
44
+ if (pkg.devDependencies) {
45
+ for (const dep of titanDeps) {
46
+ if (pkg.devDependencies[dep]) {
47
+ pkg.devDependencies[dep] = "latest";
48
+ modified = true;
49
+ }
50
+ }
51
+ }
52
+
53
+ if (modified) {
54
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
55
+ console.log(chalk.green(` ✔ Updated Titan dependencies in package.json`));
56
+ }
57
+ } catch (e) {
58
+ console.log(chalk.yellow(` ⚠️ Failed to update package.json: ${e.message}`));
59
+ }
60
+
61
+ // 2. Refresh Dockerfile and dotfiles from templates
62
+ const commonDir = path.resolve(__dirname, '..', '..', '..', '..', 'templates', 'common');
63
+ if (fs.existsSync(commonDir)) {
64
+ const filesToSync = [
65
+ ['Dockerfile', 'Dockerfile'],
66
+ ['_dockerignore', '.dockerignore'],
67
+ ['_gitignore', '.gitignore'],
68
+ ];
69
+
70
+ for (const [srcName, destName] of filesToSync) {
71
+ const src = path.join(commonDir, srcName);
72
+ const dest = path.join(root, destName);
73
+ if (fs.existsSync(src)) {
74
+ fs.copyFileSync(src, dest);
75
+ console.log(chalk.green(` ✔ Synchronized ${destName}`));
76
+ }
77
+ }
78
+
79
+ // Also update app/t.native.d.ts if it exists
80
+ const nativeTypesSrc = path.join(commonDir, 'app', 't.native.d.ts');
81
+ const nativeTypesDest = path.join(root, 'app', 't.native.d.ts');
82
+ if (fs.existsSync(nativeTypesSrc) && fs.existsSync(path.join(root, 'app'))) {
83
+ fs.copyFileSync(nativeTypesSrc, nativeTypesDest);
84
+ console.log(chalk.green(` ✔ Updated app/t.native.d.ts`));
85
+ }
86
+ }
87
+
88
+ console.log(chalk.green(`\n✔ Update complete!\n`));
89
+ console.log(chalk.yellow(` Please run 'npm install' to apply changes.\n`));
90
+ }