@crossberryweb/mozhi 3.1.1 → 3.2.1

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/LICENSE CHANGED
@@ -1,116 +1,21 @@
1
- PROPRIETARY LICENSE
2
-
3
- Copyright (c) 2026 crossberry-in (https://github.com/crossberry-in)
4
- All rights reserved.
5
-
6
- 1. DEFINITIONS
7
-
8
- "Software" refers to the Mozhi programming language interpreter binary,
9
- its source code, and any accompanying documentation.
10
-
11
- "Source Code" refers to the human-readable C source files of the Mozhi
12
- interpreter, including but not limited to files under the src/ and
13
- include/ directories of the private source repository.
14
-
15
- "Binary" refers to the compiled, executable form of the Software,
16
- distributed via the public releases at
17
- https://github.com/crossberry-in/mozhi-doc/releases.
18
-
19
- "Licensee" refers to any individual or entity that downloads, installs,
20
- or uses the Software.
21
-
22
- 2. SOURCE CODE AVAILABILITY
23
-
24
- The Source Code of the Software is CLOSED-SOURCE and PROPRIETARY.
25
- The Source Code is maintained in a private repository and is NOT
26
- distributed to the public. Licensees receive only the Binary form
27
- of the Software.
28
-
29
- 3. GRANT OF LICENSE
30
-
31
- Subject to the terms and conditions of this License, the licensor
32
- hereby grants to the Licensee a non-exclusive, non-transferable,
33
- non-sublicensable, worldwide, royalty-free license to:
34
-
35
- a) Download, install, and use the Binary of the Software for any
36
- lawful purpose, including personal, educational, and commercial use.
37
-
38
- b) Write, distribute, and publicly share Mozhi scripts (source files
39
- with the .mz extension) that are executed by the Software.
40
-
41
- c) Distribute verbatim copies of the unmodified Binary to third parties,
42
- provided that this License is included with such copies.
43
-
44
- 4. RESTRICTIONS
45
-
46
- The Licensee shall NOT:
47
-
48
- a) Reverse engineer, decompile, disassemble, or otherwise attempt to
49
- derive the Source Code from the Binary, except to the extent that
50
- such activity is expressly permitted by applicable law.
51
-
52
- b) Modify, adapt, translate, or create derivative works based on the
53
- Software, in whole or in part, in source or binary form.
54
-
55
- c) Redistribute, sell, rent, lease, or sublicense the Software, in
56
- whole or in part, for a fee, without prior written permission from
57
- the licensor.
58
-
59
- d) Remove or alter any copyright, trademark, or other proprietary
60
- notices on or in the Software.
61
-
62
- e) Use the Software in any manner that violates applicable laws or
63
- regulations.
64
-
65
- 5. OWNERSHIP
66
-
67
- The Software is licensed, not sold. The licensor retains all right,
68
- title, and interest in and to the Software, including all intellectual
69
- property rights therein. This License does not grant the Licensee any
70
- rights to the Source Code.
71
-
72
- 6. DISCLAIMER OF WARRANTY
73
-
74
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
75
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
76
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
77
- IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES, OR
78
- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
79
- ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE
80
- OR OTHER DEALINGS IN THE SOFTWARE.
81
-
82
- 7. LIMITATION OF LIABILITY
83
-
84
- IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
85
- SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, INCLUDING BUT NOT LIMITED
86
- TO LOSS OF PROFITS, DATA, OR USE, ARISING OUT OF OR IN CONNECTION WITH
87
- THIS LICENSE OR THE SOFTWARE, HOWEVER CAUSED AND UNDER ANY THEORY OF
88
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
89
- NEGLIGENCE), EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY
90
- OF SUCH DAMAGES.
91
-
92
- 8. TERMINATION
93
-
94
- This License is effective until terminated. The Licensee may terminate
95
- this License at any time by ceasing all use of the Software and
96
- destroying all copies in their possession. The licensor may terminate
97
- this License immediately if the Licensee breaches any of its terms.
98
- Upon termination, the Licensee must cease all use of the Software and
99
- destroy all copies in their possession.
100
-
101
- 9. GOVERNING LAW
102
-
103
- This License shall be governed by and construed in accordance with the
104
- laws of the jurisdiction in which the licensor resides, without regard
105
- to its conflict of law provisions.
106
-
107
- 10. ENTIRE AGREEMENT
108
-
109
- This License constitutes the entire agreement between the licensor and
110
- the Licensee with respect to the Software and supersedes all prior or
111
- contemporaneous understandings regarding such subject matter.
112
-
113
- ---
114
-
115
- For inquiries regarding licensing, source code access, or commercial use,
116
- please visit: https://github.com/crossberry-in/mozhi-doc/issues
1
+ MIT License
2
+
3
+ Copyright (c) 2026 crossberry-in
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,90 +1,82 @@
1
- # Mozhi (official npm distribution)
1
+ # @crossberryweb/mozhi — official npm distribution
2
2
 
3
- **Mozhi** (மொழி — "language" in Tamil) is a fast, beginner-friendly scripting language with a **native full-stack platform**: HTTP server, template engine, JSON stack, sandboxed filesystem and SQLite — all built into the interpreter, zero external runtimes.
3
+ The [Mozhi](https://crossberry-in.github.io/mozhi-doc/) programming language,
4
+ delivered as pre-built native binaries through npm.
4
5
 
5
- This package installs the official `mozhi` command with a **prebuilt, fully static Linux binary** bundled inside — no compilation, no postinstall downloads, works offline behind any proxy.
6
-
7
- ## Install
6
+ Installing this package gives you **two equivalent commands**:
8
7
 
9
8
  ```bash
10
- npm install -g @crossberryweb/mozhi
11
-
12
- # then:
13
- mozhi --version
9
+ mozhi run app.mz # canonical command
10
+ mz run app.mz # short alias — same binary, identical behavior
14
11
  ```
15
12
 
16
- Bundled platforms (v3.1.1, static musl binaries with SQLite vendored):
13
+ Both are installed by npm from the same launcher, so `mz` and `mozhi` are
14
+ always in sync: same version, same flags, same exit codes.
17
15
 
18
- | Platform | Binary |
19
- |----------|--------|
20
- | Linux x86_64 | bundled |
21
- | Linux arm64 (aarch64, incl. Android/Termux chroots) | bundled |
22
- | macOS / Windows | use the [installer script](https://github.com/crossberry-in/mozhi-doc#installation) instead |
16
+ ## Requirements
23
17
 
24
- The binaries are fully static, so one build serves glibc distros (Ubuntu/Debian/Fedora/Arch), Alpine/musl, and Termux alike.
18
+ - **Node.js ≥ 22** — any currently supported release line: 22.x (Maintenance
19
+ LTS), 24.x (LTS) or 26.x (Current). Node.js 14, 16, 18 and 20 have reached
20
+ end of life and are no longer supported; on those lines the launcher still
21
+ works (it only uses `child_process`, `fs` and `path`) but prints a one-time
22
+ end-of-life notice. The interpreter itself is a fully static native binary —
23
+ Node.js only runs the tiny launcher shim.
25
24
 
26
- ## Quick start
25
+ ## What you get (v3.2.1)
27
26
 
28
- `hello.mz`
29
- ```mozhi
30
- let name = "Mozhi"
31
- echo("Hello from " + name + "!")
27
+ - **Precise error diagnostics**: every error carries a stable code
28
+ (`LEX001`, `PARSE002`, `NAME001`, ...), a caret span under the exact
29
+ token, a suggested fix, and a link to its documentation page.
30
+ - **Free AI Diagnosis** (opt-in for scripts, automatic in interactive
31
+ terminals): an anonymous, keyless service explains the error — no API
32
+ key, no account, no payment. Disable with `--no-ai` or `MOZHI_NO_AI=1`.
33
+ Failure of the service never affects the local diagnosis or exit code.
34
+ - **Machine-readable output**: `mozhi --json run app.mz` emits
35
+ `mozhi.diagnostics.v1` JSON to stderr (codes, spans, docs URLs).
36
+ - Native modules: `web` (HTTP server), `json`, `fs` (sandboxed),
37
+ `db` (SQLite), `math`, `template`, `http` client.
32
38
 
33
- fn fib(n) {
34
- if n < 2 {
35
- return n
36
- }
37
- return fib(n - 1) + fib(n - 2)
38
- }
39
- echo("fib(10) = " + string(fib(10)))
40
- ```
39
+ ## Usage
41
40
 
42
41
  ```bash
43
- mozhi run hello.mz # or simply: mozhi hello.mz
42
+ mozhi run app.mz # run a script (plain: mozhi app.mz)
43
+ mz run app.mz # identical
44
+ mozhi new myapp # scaffold a project (web | minimal)
45
+ mozhi dev # auto-reload dev server
46
+ mozhi test tests/ # run *.test.mz suites
47
+ mozhi lint src/ # parse checks with error codes
44
48
  ```
45
49
 
46
- **Full-stack web app** — `app.mz`:
47
- ```mozhi
48
- import web
50
+ ## Platform support
49
51
 
50
- let app = web.create({
51
- log: true
52
- })
52
+ Bundled binaries (fully static musl builds, SQLite vendored — work on
53
+ glibc distros, Alpine, Termux/Noxs):
53
54
 
54
- app.get("/", fn(req, res) {
55
- return res.html("<h1>Hello from Mozhi</h1>")
56
- })
55
+ - `linux-x86_64`
56
+ - `linux-arm64`
57
57
 
58
- app.get("/api/health", fn(req, res) {
59
- return res.json({
60
- status: "ok",
61
- language: "Mozhi",
62
- version: web.version()
63
- })
64
- })
58
+ macOS / Windows: use the installer
59
+ `curl -fsSL https://github.com/crossberry-in/mozhi-doc/raw/main/install.sh | bash`
60
+ (it installs `mozhi` and the `mz` alias too).
65
61
 
66
- app.listen("127.0.0.1", 8080)
67
- ```
62
+ ## Diagnostics & AI Diagnosis
68
63
 
69
- ```bash
70
- mozhi run app.mz
71
- # then: curl http://127.0.0.1:8080/api/health
64
+ ```text
65
+ error[LEX001]: illegal character in source
66
+ --> app.mz:1:14
67
+ 1 | echo(string(5 ^ 3))
68
+ | ^
69
+ reason: the character '^' is not part of the Mozhi language
70
+ help: exponentiation is written with '**' in Mozhi, e.g. 5 ** 3
71
+ docs: https://crossberry-in.github.io/mozhi-doc/errors/LEX001
72
72
  ```
73
73
 
74
- ## What's inside
75
-
76
- - `bin/mozhi-linux-x86_64`, `bin/mozhi-linux-arm64` — official v3.1.1 interpreter binaries, sha256-verified against the [v3.1.1 release](https://github.com/crossberry-in/mozhi-doc/releases/tag/v3.1.1)
77
- - `bin/mozhi.js` — tiny launcher that picks the right binary and forwards arguments, stdio, exit codes and signals
78
-
79
- Versioning: the npm package version always matches the bundled interpreter release (package 3.1.1 = Mozhi v3.1.1).
80
-
81
- ## Docs
82
-
83
- - [Documentation site](https://crossberry-in.github.io/mozhi-doc/)
84
- - [Web Server Guide](https://github.com/crossberry-in/mozhi-doc/blob/main/docs/WEB_GUIDE.md)
85
- - [Language Reference](https://github.com/crossberry-in/mozhi-doc/blob/main/LANGUAGE_REFERENCE.md)
86
- - [Examples](https://github.com/crossberry-in/mozhi-doc/tree/main/examples)
74
+ Every `docs:` URL is a real page in the official error reference.
75
+ See `mozhi help` for all output flags (`--json`, `--no-color`,
76
+ `--verbose`, `--no-ai`, `--ai`).
87
77
 
88
- ## License
78
+ ## Links
89
79
 
90
- Mozhi is proprietary (closed-source interpreter, publicly released binaries). This package redistributes **unmodified official release binaries** as permitted by the bundled [LICENSE](./LICENSE) (§3c "verbatim copies"). By installing you accept its terms.
80
+ - Documentation: https://crossberry-in.github.io/mozhi-doc/
81
+ - Error code reference: https://crossberry-in.github.io/mozhi-doc/errors/
82
+ - Source/issues: https://github.com/crossberry-in/mozhi
Binary file
Binary file
package/bin/mozhi.js CHANGED
@@ -8,10 +8,19 @@
8
8
  * and signals all pass through, so `mozhi` behaves exactly like a
9
9
  * native binary.
10
10
  *
11
- * Bundled (v3.1.1, fully static musl builds with SQLite vendored):
11
+ * npm installs TWO commands from this same launcher:
12
+ * mozhi — the canonical command
13
+ * mz — the short alias (identical behavior, same binary)
14
+ *
15
+ * Bundled official release binaries (v3.2.0 line, fully static musl builds
16
+ * with SQLite vendored):
12
17
  * bin/mozhi-linux-x86_64
13
18
  * bin/mozhi-linux-arm64
14
19
  *
20
+ * Node.js requirement (engines: ">=22"): the launcher only needs
21
+ * child_process, fs and path, but the supported Node.js release lines are
22
+ * 22.x, 24.x and 26.x — older lines are end-of-life and print a notice.
23
+ *
15
24
  * macOS / Windows / other platforms:
16
25
  * see https://github.com/crossberry-in/mozhi-doc#installation
17
26
  */
@@ -27,13 +36,24 @@ const bin = path.join(__dirname, 'mozhi-' + process.platform + '-' + arch);
27
36
 
28
37
  if (!fs.existsSync(bin)) {
29
38
  console.error('[mozhi] No bundled interpreter for ' + process.platform + '-' + process.arch + '.');
30
- console.error('[mozhi] This package ships official v3.1.1 binaries for:');
39
+ console.error('[mozhi] This package ships official v3.2.0 binaries for:');
31
40
  console.error('[mozhi] linux-x86_64, linux-arm64 (fully static — works on glibc, Alpine, Termux)');
32
41
  console.error('[mozhi] For macOS, Windows and other platforms use the installer:');
33
42
  console.error('[mozhi] curl -fsSL https://github.com/crossberry-in/mozhi-doc/raw/main/install.sh | bash');
34
43
  process.exit(1);
35
44
  }
36
45
 
46
+ // Node.js support policy (see engines in package.json): 22.x, 24.x and 26.x
47
+ // are the release lines that still receive security updates as of 2026-10.
48
+ // End-of-life lines still work — this launcher uses nothing newer than
49
+ // child_process/fs/path — but users get a one-time, non-blocking notice.
50
+ const nodeMajor = parseInt(String(process.version).slice(1), 10);
51
+ if (nodeMajor < 22) {
52
+ console.error('[mozhi] Notice: Node.js ' + process.version + ' has reached end of life.');
53
+ console.error('[mozhi] Supported Node.js release lines: 22.x, 24.x, 26.x (https://nodejs.org).');
54
+ console.error('[mozhi] Continuing anyway — the launcher only needs child_process, fs and path.');
55
+ }
56
+
37
57
  const child = spawn(bin, process.argv.slice(2), { stdio: 'inherit' });
38
58
 
39
59
  child.on('error', (err) => {
@@ -0,0 +1,6 @@
1
+ 0ab8ae3b6094946810d86aef30dc69e113ee1dc0398b2da51b53724e955eef47 mozhi-interpreter-alpine-arm64
2
+ c3ffe6667a0eb2bdea773419afc1b0819079a35476728e5d6af2522d41f8b1e1 mozhi-interpreter-alpine-x86_64
3
+ 3ae60653e5bf2c5503e4a9da077317b548a8ff7f383ba1b455d0035459cba25d mozhi-interpreter-linux-arm64
4
+ 93c86b5ccdc2096064a7aedfaeb7e6f7f8b8e81a0b46ebe4f61bc2e8e42e6ed1 mozhi-interpreter-linux-x86_64
5
+ 3e0db55954e74a5052e37de5d19ec6f9a4bd9256159a05a50f9f7b9ced639c40 mozhi-interpreter-macos-arm64
6
+ 0d308353ca9e1e475a014ed771e2361b396562541517e4a7c764349ce64d9478 mozhi-interpreter-macos-x86_64
package/package.json CHANGED
@@ -1,40 +1,31 @@
1
1
  {
2
2
  "name": "@crossberryweb/mozhi",
3
- "version": "3.1.1",
4
- "description": "Mozhi programming language — official npm distribution. Fast, beginner-friendly scripting language with a native HTTP server, template engine, JSON stack, sandboxed filesystem and SQLite. Bundles the official static Linux x86_64/arm64 binaries and installs the `mozhi` command.",
5
- "license": "SEE LICENSE IN LICENSE",
6
- "author": "crossberry-in <crossberryweb@gmail.com> (https://github.com/crossberry-in)",
7
- "bin": {
8
- "mozhi": "bin/mozhi.js"
3
+ "version": "3.2.1",
4
+ "description": "Mozhi programming language interpreter — native web, JSON, fs, math, SQLite, templates. Install once, get both commands: `mozhi` and the short alias `mz` (identical behavior).",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/crossberry-in/mozhi.git"
9
9
  },
10
- "files": [
11
- "bin/",
12
- "LICENSE",
13
- "README.md"
14
- ],
10
+ "homepage": "https://crossberry-in.github.io/mozhi-doc/",
15
11
  "keywords": [
16
12
  "mozhi",
17
13
  "language",
18
14
  "interpreter",
19
- "scripting",
20
15
  "web",
21
- "webserver",
22
- "http",
23
- "json",
24
- "sqlite",
25
- "templates",
26
16
  "fullstack"
27
17
  ],
28
- "homepage": "https://crossberry-in.github.io/mozhi-doc/",
29
- "repository": {
30
- "type": "git",
31
- "url": "git+https://github.com/crossberry-in/mozhi-doc.git",
32
- "directory": "npm"
33
- },
34
- "bugs": {
35
- "url": "https://github.com/crossberry-in/mozhi-doc/issues"
18
+ "bin": {
19
+ "mozhi": "bin/mozhi.js",
20
+ "mz": "bin/mozhi.js"
36
21
  },
22
+ "files": [
23
+ "bin/",
24
+ "checksums-sha256.txt",
25
+ "README.md",
26
+ "LICENSE"
27
+ ],
37
28
  "engines": {
38
- "node": ">=14"
29
+ "node": ">=22"
39
30
  }
40
31
  }
@@ -1,4 +0,0 @@
1
- e67ef15909da90c07e39d9a6e79f5575c4ae49a866962c44f33e35815c2c8703 mozhi-interpreter-linux-x86_64
2
- 266eebb0c330264018e52c7a4dac17ed1c811af5a8cc3bfeefa13299a8ca78c7 mozhi-interpreter-linux-arm64
3
- e67ef15909da90c07e39d9a6e79f5575c4ae49a866962c44f33e35815c2c8703 mozhi-interpreter-alpine-x86_64
4
- 266eebb0c330264018e52c7a4dac17ed1c811af5a8cc3bfeefa13299a8ca78c7 mozhi-interpreter-alpine-arm64