@mahameru/cli 0.0.18 → 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.
package/README.md CHANGED
@@ -3,113 +3,252 @@
3
3
  [![npm version](https://img.shields.io/npm/v/mahameru.svg)](https://www.npmjs.com/package/mahameru)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- `@mahameru/cli` is the command-line interface for running and building Mahameru-based applications. This package provides the core workflow for local development and project builds from the terminal.
6
+ `@mahameru/cli` is the command-line interface for building, running, and managing Mahameru-based applications.
7
7
 
8
8
  ## Installation
9
9
 
10
- Install the CLI globally so the `mahameru` command is available directly from your terminal:
10
+ Install the CLI globally so the `mahameru` command is available from your terminal:
11
11
 
12
12
  ```bash
13
13
  npm install -g @mahameru/cli
14
14
  ```
15
15
 
16
- After that, you can run `mahameru` commands from any Mahameru project.
17
-
18
- If you don't have any MahameruJS projects, you can create one by running:
16
+ If you do not have a MahameruJS project yet, create one with:
19
17
 
20
18
  ```bash
21
19
  npm create mahameru
22
20
  ```
23
21
 
24
- or
22
+ or:
25
23
 
26
24
  ```bash
27
25
  npx create-mahameru
28
26
  ```
29
27
 
30
- and follow the prompts.
31
-
32
28
  ## Project Requirements
33
29
 
34
- This CLI expects a `mahameru.config.ts` file in the project root. That file is loaded when running development mode.
30
+ This CLI expects a `mahameru.config.ts` file in the project root for development mode.
35
31
 
36
32
  Some commands also rely on these project dependencies:
37
33
 
38
- - `tsx` to load the TypeScript config file for the `dev` command
39
- - `typescript` for the compile step in the `build` command
34
+ - `tsx` to load the TypeScript config file for `mahameru dev`
35
+ - `typescript` for the compile step in `mahameru build`
40
36
  - `tsc-alias` to rewrite path aliases after compilation
41
37
 
42
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.
43
39
 
44
- ## Usage
40
+ ## Command Reference
45
41
 
46
- ### Development
42
+ ### `mahameru dev`
47
43
 
48
- Run the Mahameru development server with Hot Reload:
44
+ Start the MahameruJS development server with hot reload.
49
45
 
50
46
  ```bash
51
47
  mahameru dev
52
- ```
53
-
54
- Available options:
55
-
56
- ```bash
57
48
  mahameru dev --port 3000
58
- mahameru dev -p 3000
59
49
  mahameru dev --host localhost
60
- mahameru dev -h localhost
61
50
  ```
62
51
 
63
- This command will:
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:
64
58
 
65
- - load `mahameru.config.ts`
66
- - run TypeScript typechecking before each start or restart
67
- - apply default config values when they are not provided
68
- - run the Mahameru application from the current project
69
- - watch `src/**` and `mahameru.config.ts`, then hot reload the development server automatically when files change
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
70
64
 
71
- This Hot Reload flow refreshes the server during development when project files change. It does not provide browser HMR or module replacement inside the running app.
72
- If typechecking fails, the error is shown in the console and the dev server will wait until the next valid save before starting again.
65
+ If typechecking fails, the error is shown in the console and the dev server waits for the next valid save before starting again.
73
66
 
74
- ### Build
67
+ ### `mahameru build`
75
68
 
76
- Build the project with TypeScript:
69
+ Build the production output for the current project.
77
70
 
78
71
  ```bash
79
72
  mahameru build
80
73
  ```
81
74
 
82
- This command will:
75
+ Behavior:
83
76
 
84
- - run `tsc --project tsconfig.json`
85
- - run `tsc-alias -p tsconfig.json`
86
- - fail if compiled `dist/**/*.js` files still contain unresolved `@/` or `#/` specifiers
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
87
80
 
88
- ### Start
81
+ ### `mahameru start`
89
82
 
90
- Run the production server from the compiled `dist/` output:
83
+ Request the Mahameru Process Manager daemon to start the current project in production mode.
91
84
 
92
85
  ```bash
93
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
94
109
  ```
95
110
 
96
- This command will:
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
97
235
 
98
- - load `dist/mahameru.config.js`
99
- - run the Mahameru application using `dist/`, `dist/modules`, and `dist/routes`
100
- - expect all application path aliases to have been rewritten during `mahameru build`
236
+ For local development:
101
237
 
102
- ## Quick Workflow
238
+ 1. Run `mahameru dev`.
239
+ 2. Make changes inside `src/**` and let the dev server restart automatically.
103
240
 
104
- This CLI is focused on the basic development workflow:
241
+ For production-style managed runs:
105
242
 
106
- 1. Use `mahameru dev` during local development and let Hot Reload refresh the server on file changes.
107
- 2. Use `mahameru build` to produce the TypeScript build output.
108
- 3. Use `@/*` path aliases in `tsconfig.json` when you want non-relative imports inside `src/`.
109
- 4. Run `mahameru start` after a successful build to verify the production output.
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.
110
248
 
111
249
  ## Notes
112
250
 
113
- - If `mahameru.config.ts` is missing, the CLI will stop and show an error.
251
+ - If `mahameru.config.ts` is missing, development commands will fail.
114
252
  - If `tsx`, `typescript`, or `tsc-alias` are not installed in the project, the related command will fail.
115
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.