@mahameru/cli 0.0.19 → 0.0.20

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 (3) hide show
  1. package/README.md +254 -0
  2. package/cli.js +2 -2
  3. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,254 @@
1
+ # MahameruJS CLI Utility
2
+
3
+ [![npm version](https://img.shields.io/npm/v/mahameru.svg)](https://www.npmjs.com/package/mahameru)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ `@mahameru/cli` is the command-line interface for building, running, and managing Mahameru-based applications.
7
+
8
+ ## Installation
9
+
10
+ Install the CLI globally so the `mahameru` command is available from your terminal:
11
+
12
+ ```bash
13
+ npm install -g @mahameru/cli
14
+ ```
15
+
16
+ If you do not have a MahameruJS project yet, create one with:
17
+
18
+ ```bash
19
+ npm create mahameru
20
+ ```
21
+
22
+ or:
23
+
24
+ ```bash
25
+ npx create-mahameru
26
+ ```
27
+
28
+ ## Project Requirements
29
+
30
+ This CLI expects a `mahameru.config.ts` file in the project root for development mode.
31
+
32
+ Some commands also rely on these project dependencies:
33
+
34
+ - `tsx` to load the TypeScript config file for `mahameru dev`
35
+ - `typescript` for the compile step in `mahameru build`
36
+ - `tsc-alias` to rewrite path aliases after compilation
37
+
38
+ For application source aliases, prefer `tsconfig.json` paths such as `@/*`. Do not rely on `package.json#imports` for `src/**` files that must run from `dist/` in production.
39
+
40
+ ## Command Reference
41
+
42
+ ### `mahameru dev`
43
+
44
+ Start the MahameruJS development server with hot reload.
45
+
46
+ ```bash
47
+ mahameru dev
48
+ mahameru dev --port 3000
49
+ mahameru dev --host localhost
50
+ ```
51
+
52
+ Options:
53
+
54
+ - `-p, --port <number>` Port to run the server on
55
+ - `-H, --host <string>` Host to run the server on
56
+
57
+ Behavior:
58
+
59
+ - loads `mahameru.config.ts`
60
+ - runs TypeScript typechecking before each start or restart
61
+ - applies default config values when they are not provided
62
+ - runs the Mahameru application from the current project
63
+ - watches `src/**` and `mahameru.config.ts`, then restarts automatically when files change
64
+
65
+ If typechecking fails, the error is shown in the console and the dev server waits for the next valid save before starting again.
66
+
67
+ ### `mahameru build`
68
+
69
+ Build the production output for the current project.
70
+
71
+ ```bash
72
+ mahameru build
73
+ ```
74
+
75
+ Behavior:
76
+
77
+ - runs `tsc --project tsconfig.json`
78
+ - runs `tsc-alias -p tsconfig.json`
79
+ - fails if compiled `dist/**/*.js` files still contain unresolved `@/` or `#/` specifiers
80
+
81
+ ### `mahameru start`
82
+
83
+ Request the Mahameru Process Manager daemon to start the current project in production mode.
84
+
85
+ ```bash
86
+ mahameru start
87
+ mahameru start --port 8000
88
+ mahameru start --host 127.0.0.1
89
+ ```
90
+
91
+ Options:
92
+
93
+ - `-p, --port <number>` Port to run the app on. Default: `8000`
94
+ - `-H, --host <string>` Host to run the app on. Default: `127.0.0.1`
95
+
96
+ Important:
97
+
98
+ - this command does not directly boot `dist/` by itself
99
+ - it connects to the Mahameru PM daemon over IPC and asks the daemon to fork the current project
100
+ - the daemon must already be running, either through `mahameru pm start` or `mahameru pm service install`
101
+ - on Windows, Mahameru may request elevation automatically when the daemon is running with Administrator privileges
102
+
103
+ ### `mahameru stop`
104
+
105
+ Request the Mahameru Process Manager daemon to stop the current managed project.
106
+
107
+ ```bash
108
+ mahameru stop
109
+ ```
110
+
111
+ Important:
112
+
113
+ - this command depends on the Mahameru PM daemon being available
114
+ - it stops the managed project registered under the current package name
115
+
116
+ ### `mahameru status`
117
+
118
+ Show the status of the current managed project.
119
+
120
+ ```bash
121
+ mahameru status
122
+ ```
123
+
124
+ Important:
125
+
126
+ - this command depends on the Mahameru PM daemon being available
127
+ - it shows the managed project status, PID, host, port, and root path
128
+ - on Windows, Mahameru may request elevation automatically when connecting to an elevated daemon
129
+
130
+ ## Process Manager
131
+
132
+ The Process Manager is responsible for hosting managed production apps and exposing a small management server.
133
+
134
+ ### `mahameru pm start`
135
+
136
+ Start the Mahameru Process Manager manually.
137
+
138
+ ```bash
139
+ mahameru pm start
140
+ mahameru pm start --port 8000 --host 127.0.0.1
141
+ mahameru pm start --cert ./cert.pem --key ./key.pem
142
+ mahameru pm start --daemon
143
+ ```
144
+
145
+ Options:
146
+
147
+ - `-p, --port <number>` Port to run the server on. Default: `8000`
148
+ - `-H, --host <string>` Host to run the server on. Default: `127.0.0.1`
149
+ - `--cert <string>` Path to the SSL certificate file
150
+ - `--key <string>` Path to the SSL key file
151
+ - `-d, --daemon` Run as a daemon
152
+
153
+ Notes:
154
+
155
+ - HTTPS is enabled only when both `--cert` and `--key` are provided
156
+ - the Process Manager serves the management UI and API
157
+ - the Process Manager also restores previously running managed projects on startup when available
158
+
159
+ ### `mahameru pm status`
160
+
161
+ ```bash
162
+ mahameru pm status
163
+ ```
164
+
165
+ This command exists in the CLI, but it is not implemented yet.
166
+
167
+ ### `mahameru pm service install`
168
+
169
+ Install the Mahameru Process Manager as a system service.
170
+
171
+ ```bash
172
+ mahameru pm service install
173
+ mahameru pm service install --port 8080 --host 127.0.0.1
174
+ mahameru pm service install --cert ./cert.pem --key ./key.pem
175
+ ```
176
+
177
+ Options:
178
+
179
+ - `-p, --port <number>` Port to run the server on. Default: `8080`
180
+ - `-H, --host <string>` Host to run the server on. Default: `127.0.0.1`
181
+ - `--cert <string>` Path to the SSL certificate file
182
+ - `--key <string>` Path to the SSL key file
183
+
184
+ Notes:
185
+
186
+ - this registers the Process Manager to start with the operating system
187
+ - Administrator or root privileges may be required, depending on the platform
188
+
189
+ ### `mahameru pm service uninstall`
190
+
191
+ Uninstall the Mahameru Process Manager service.
192
+
193
+ ```bash
194
+ mahameru pm service uninstall
195
+ ```
196
+
197
+ Administrator or root privileges may be required.
198
+
199
+ ### `mahameru pm service start`
200
+
201
+ Start the installed Mahameru Process Manager service.
202
+
203
+ ```bash
204
+ mahameru pm service start
205
+ ```
206
+
207
+ Administrator or root privileges may be required.
208
+
209
+ ### `mahameru pm service stop`
210
+
211
+ Stop the installed Mahameru Process Manager service.
212
+
213
+ ```bash
214
+ mahameru pm service stop
215
+ mahameru pm service stop --graceful
216
+ ```
217
+
218
+ Options:
219
+
220
+ - `-g, --graceful` Gracefully stop the service
221
+
222
+ Administrator or root privileges may be required.
223
+
224
+ ### `mahameru pm service status`
225
+
226
+ Show the installed service status.
227
+
228
+ ```bash
229
+ mahameru pm service status
230
+ ```
231
+
232
+ This command reports the Process Manager service status for the current platform.
233
+
234
+ ## Recommended Workflow
235
+
236
+ For local development:
237
+
238
+ 1. Run `mahameru dev`.
239
+ 2. Make changes inside `src/**` and let the dev server restart automatically.
240
+
241
+ For production-style managed runs:
242
+
243
+ 1. Run `mahameru build`.
244
+ 2. Start the Process Manager with `mahameru pm start`, or install it with `mahameru pm service install`.
245
+ 3. Run `mahameru start` from your project directory to register and start the app through the daemon.
246
+ 4. Use `mahameru status` to inspect the managed project.
247
+ 5. Use `mahameru stop` to stop it.
248
+
249
+ ## Notes
250
+
251
+ - If `mahameru.config.ts` is missing, development commands will fail.
252
+ - If `tsx`, `typescript`, or `tsc-alias` are not installed in the project, the related command will fail.
253
+ - `mahameru dev` ignores changes inside `dist/` and `node_modules/`.
254
+ - `mahameru start`, `mahameru stop`, and `mahameru status` are PM-daemon-backed commands, not standalone local process commands.
package/cli.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * ┌────────────────────────────────────────────┐
4
4
  * │ │
5
5
  * │ ▲ MahameruJS - CLI │
6
- * │ Version: 0.0.19
6
+ * │ Version: 0.0.20
7
7
  * │ Built: 2026 │
8
8
  * │ │
9
9
  * │ Copyright (c) Bintan <hello@bintvn.co> │
@@ -643,6 +643,6 @@ e.exports=require("module")},9278(e){e.exports=require("net")},1421(e){e.exports
643
643
  e.exports=require("node:cluster")},3024(e){e.exports=require("node:fs")},1455(e){e.exports=require("node:fs/promises")},
644
644
  7067(e){e.exports=require("node:http")},4708(e){e.exports=require("node:https")},8995(e){
645
645
  e.exports=require("node:module")},7030(e){e.exports=require("node:net")},8161(e){e.exports=require("node:os")},6760(e){
646
- e.exports=require("node:path")},6928(e){e.exports=require("path")},8330(e){e.exports={version:"0.0.19"}}};const t={}
646
+ e.exports=require("node:path")},6928(e){e.exports=require("path")},8330(e){e.exports={version:"0.0.20"}}};const t={}
647
647
  ;(function o(r){const s=t[r];if(void 0!==s)return s.exports;const n=t[r]={exports:{}}
648
648
  ;return e[r].call(n.exports,n,n.exports,o),n.exports})(8625)})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mahameru/cli",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "MahameruJS CLI Utility - The command-line interface for running and building Mahameru-based applications",
5
5
  "bin": {
6
6
  "mahameru": "./cli.js"