You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f00a7cd
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ Nox is a high-performance, general-purpose programming language built from scrat
36
36
22.**True Async VM Model:** The Nox VM MUST support non-blocking execution. All external I/O and time-based operations MUST use async workflows where appropriate.
37
37
23.**Systemic Refactoring:** The codebase is now entirely Rust. Ensure all newly added code strictly follows idiomatic Rust practices and maintains 100% Modern Nox syntax compliance.
38
38
24.**Professional Distribution:** AI agents MUST prioritize standard, professional installer packages for releases. For Windows releases, generate Microsoft Installer (`.msi`) packages. For Linux releases, generate Debian (`.deb`) packages. These installers must automatically add Nox to the global `PATH`. Raw executables (`.exe`, `./nox`) are strictly permitted for local development and testing only.
39
-
25.**Workspace Hygiene:**Cargo build artifacts can become extremely heavy. AI agents MUST run `cargo clean` periodically after heavy builds or cross-compilation tasks to save disk space and maintain a lean workspace environment.
39
+
26.**Blueprint Protocol (`PLAN.md`):**Use `PLAN.md` strictly as a temporary, human-readable roadmap for GitHub visibility and user coordination. AI agents MUST still rely on the internal `Plan Mode` tool for permanent AI task tracking, state management, and execution orchestration.
40
40
41
41
## Progressive Disclosure
42
42
For detailed rules, architectural deep-dives, and coding patterns, refer to:
This document outlines the high-level roadmap for the next major evolution of the Nox programming language. This file serves as a temporary, human-readable blueprint for developers and users.
4
+
5
+
> **AI Note:** AI Agents should use the internal `Plan Mode` tool for managing state and task tracking. This `PLAN.md` file is strictly for human consumption and project visibility on GitHub.
6
+
7
+
## 1. Ultra-Modern Module System (Deno-Style)
8
+
Nox will abandon the traditional `node_modules` approach in favor of a secure, URL-based module resolution system.
9
+
10
+
-**Direct Imports:** Import packages directly from HTTP/HTTPS URLs or local paths.
-**Smart Mapping (`map.nx.json`):** Instead of downloading a single file, Nox will fetch a map file that defines the entire package structure, its assets (like `.so` or `.dll` binaries), and its dependencies.
16
+
17
+
## 2. Global Smart Caching & Storage
18
+
To prevent "Dependency Hell" and save disk space, all modules will be stored globally on the OS.
19
+
20
+
-**Storage Location:**
21
+
- Linux/macOS: `$HOME/.nox_libx/`
22
+
- Windows: `%USERPROFILE%\.nox_libx\`
23
+
-**Immutable Cache:** Once a module is downloaded, it is stored in an immutable, versioned hash-folder (e.g., `.nox_libx/pkg_cache/github.com/user/math_lib/v1.0.0/`).
24
+
-**Deduplication:** If multiple projects require `math_lib@v1.0.0`, it is only downloaded once. Projects simply link to the global cache.
25
+
26
+
## 3. Multi-Version Support
27
+
Nox will support running multiple versions of the same package without conflict.
28
+
-**Specific Version Import:**`import { add } from "github:user/math_lib@v1.0.0"`
29
+
-**Semantic Versioning:**`import { sub } from "github:user/math_lib@^1.0.0"`
30
+
31
+
## 4. Smart CLI & Auto-Installer
32
+
The `nox` CLI will be heavily upgraded to act as an integrated package manager.
33
+
34
+
-**Runtime Prompt:** If a script is executed and a dependency is missing, the runtime pauses and asks the user for permission to download and install it into the global cache.
35
+
-**Explicit Commands:**
36
+
-`nox install <url>`: Install a package to the global cache.
37
+
-`nox clean`: Wipe the `.nox_libx` cache.
38
+
-`nox list`: Show installed packages.
39
+
40
+
## 5. Optional Static Typing
41
+
Nox will remain beginner-friendly (Python-like) but will introduce TS/Rust-inspired optional static typing for production safety.
-**Modern TypeScript:** Adhere to ESM and modern TypeScript best practices. Avoid outdated patterns.
5
-
-**Zero-Tolerance for `any`:**Use strict TypeScript typing. `any` is strictly prohibited.
6
-
-**Strict Mode:**TypeScript `strict` mode must be enabled and enforced.
4
+
-**Idiomatic Rust:** Adhere to modern Rust best practices (e.g., using `Result`/`Option` over panics where possible, clear lifetimes).
5
+
-**Strict Typing:**Rust's strong type system must be utilized. Avoid overly generic `Any` equivalents unless strictly necessary.
6
+
-**Zero-Tolerance for Warnings:**The codebase must compile with absolutely zero warnings (`cargo check`must be clean).
7
7
-**Modular VM Architecture:** Keep opcode implementations separate from the main VM orchestration. Files should be small (< 200 lines) and focused.
8
-
-**Async-First Execution:** Prioritize asynchronous execution for any I/O, timers, or long-running tasks. Use `async/await` in TypeScript and `!` in Nox.
8
+
-**Async-First Execution:** Prioritize asynchronous execution for any I/O, timers, or long-running tasks. Use `tokio` for async operations.
9
9
10
10
## Quality Standards
11
11
-**Modern Nox Syntax:** All new code and documentation MUST use the `is`/`mut` variables, `fn =>` arrows, and no-parens `if`/`while` syntax.
12
12
-**Test-Driven Development (TDD):** Every feature must have corresponding unit tests. Aim for high coverage in Lexer, Parser, and VM.
13
-
-**Clear Error Reporting:** Compiler/Interpreter errors must provide line/column numbers and helpful suggestions.
13
+
-**Clear Error Reporting:** Compiler/Interpreter errors must provide helpful suggestions.
14
14
-**Documentation-as-Code:** Major architectural decisions and language features must be documented in the `/docs` folder.
15
15
16
16
For project-wide rules, see root [AGENTS.md](../AGENTS.md).
Copy file name to clipboardExpand all lines: docs/cli.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,16 @@
1
1
# Nox CLI & REPL Guide
2
2
3
-
Nox provides a modern, interactive CLI built with**React** and **Ink**.
3
+
Nox provides a modern, interactive CLI built in**Rust**.
4
4
5
5
## Global Command
6
-
If you have run `npm link`, you can use the `nox` command from anywhere.
6
+
If you have installed Nox globally (e.g., using a `.msi` or `.deb` release, or via `cargo install --path packages/cli`), you can use the `nox` command from anywhere.
7
7
8
8
## Interactive REPL
9
9
To start the REPL, simply run:
10
10
```bash
11
-
nox
11
+
nox repl
12
12
```
13
+
*(Or use `cargo run --package nox -- repl` during development)*
13
14
14
15
### REPL Commands (Dot Commands)
15
16
-`.help`: Displays available commands and syntax.
@@ -23,8 +24,9 @@ Nox REPL features intelligent multi-line detection. If you enter an incomplete c
23
24
## Running Files
24
25
To execute a Nox script, pass the file path as an argument.
25
26
```bash
26
-
nox my_script.nx
27
+
nox run my_script.nx
27
28
```
29
+
*(Or use `cargo run --package nox -- run my_script.nx` during development)*
28
30
*Note: While any extension works, `.nx` is the recommended standard.*
29
31
30
32
### Permission Flags
@@ -38,5 +40,5 @@ By default, Nox scripts run in a sandbox with no access to the filesystem or she
38
40
39
41
**Example:**
40
42
```bash
41
-
nox --allow-read --allow-write log_processor.nx
43
+
nox run --allow-read --allow-write log_processor.nx
Copy file name to clipboardExpand all lines: docs/packages.md
+20-21Lines changed: 20 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,51 +1,51 @@
1
1
# Nox Package Ecosystem (High Detail Analysis)
2
2
3
-
This document provides an exhaustive breakdown of the Nox monorepo structure, dependencies, and inter-package linkages. Nox is an **AI-Native** project where all packages are designed to be decoupled yet strictly synchronized through a shared contract.
3
+
This document provides an exhaustive breakdown of the Nox Cargo workspace structure, dependencies, and inter-package linkages. Nox is an **AI-Native** project where all crates are designed to be decoupled yet strictly synchronized through a shared contract.
4
4
5
5
## 1. Root Workspace (`/`)
6
6
The root directory acts as the orchestrator for the entire ecosystem.
7
7
8
-
-**Purpose:** Manages the monorepo lifecycle, builds, and cross-package testing.
8
+
-**Purpose:** Manages the Cargo workspace lifecycle, builds, and cross-package testing.
9
9
-**Key Scripts:**
10
-
-`npm run build`: Executes `tsc -b`. This uses TypeScript Project References to compile packages in the correct dependency order (`shared` -> `frontend`/`runtime` -> `cli`).
11
-
-`npm run test`: Runs the Vitest suite. It ensures integration between the compiler and the VM.
12
-
-`npm run clean`: Uses `tsc -b --clean` to wipe build artifacts safely.
10
+
-`cargo build`: Compiles all packages in the correct dependency order (`nox-shared` -> `nox-frontend`/`nox-runtime` -> `nox`).
11
+
-`cargo test`: Runs the native Rust test suite. It ensures integration between the compiler and the VM.
12
+
-`cargo clean`: Wipes build artifacts safely to save disk space.
13
13
-**Tooling:**
14
-
-`vitest`: Chosen for its speed and native ESM support, critical for the Nox 'module' architecture.
15
-
-`typescript`: Strict mode is enforced globally via `tsconfig.base.json`.
14
+
-`cargo`: Chosen for its speed and native Rust dependency management.
15
+
-`rustc`: Strict mode and warnings are enforced globally.
16
16
17
17
---
18
18
19
-
## 2. `@nox/shared` (`packages/shared`)
20
-
The "Contract" of the language. This package contains no logic, only definitions.
19
+
## 2. `nox-shared` (`packages/shared`)
20
+
The "Contract" of the language. This crate contains no logic, only definitions.
21
21
22
22
-**Role:** Ensures that the Frontend (Compiler) and the Runtime (VM) use the exact same numeric identifiers for operations.
23
23
-**Key Exports:**
24
-
-`Opcode`: An enum of 32-bit integers. Using numeric opcodes instead of strings prevents overhead during VM execution.
24
+
-`Opcode`: An enum represented as `i64`. Using numeric opcodes instead of strings prevents overhead during VM execution.
25
25
-`TokenType`: Definitions for the Lexer and Parser.
26
-
-**Linkage:** Every other package depends on `@nox/shared`. Any change here requires a full rebuild of the ecosystem.
26
+
-**Linkage:** Every other crate depends on `nox-shared`. Any change here requires a full rebuild of the ecosystem.
27
27
28
28
---
29
29
30
-
## 3. `@nox/frontend` (`packages/frontend`)
30
+
## 3. `nox-frontend` (`packages/frontend`)
31
31
The "Architect". It transforms human-readable code into machine-executable bytecode.
32
32
33
33
-**Components:**
34
34
-**Lexer:** Handles string scanning, including complex escape sequences like `\e` (ANSI) for terminal styling.
35
35
-**Parser:** A recursive-descent parser that builds a formal AST. It supports hybrid JS/Python syntax.
36
36
-**Compiler:** A one-pass AST-to-Bytecode generator.
37
37
-**High-Detail Logic:**
38
-
-**Scope Management:** Uses a stack of Maps to handle nested block scopes and function locals.
38
+
-**Scope Management:** Uses a stack of HashMaps to handle nested block scopes and function locals.
39
39
-**Bytecode Optimization:** Implements short-circuiting for `&&` and `||` using `JMP_IF_FALSE` and `JMP_IF_TRUE`.
40
-
-**Numeric Safety:** Validates that all integer literals fit within the 32-bit signed range before emitting `PUSH` opcodes.
40
+
-**Numeric Safety:** Validates that all integer literals fit within the 64-bit signed range before emitting `PUSH` opcodes.
41
41
42
42
---
43
43
44
-
## 4. `@nox/runtime` (`packages/runtime`)
44
+
## 4. `nox-runtime` (`packages/runtime`)
45
45
The "Engine". A high-performance, stack-based Virtual Machine.
46
46
47
47
-**Architecture:**
48
-
- Uses `Int32Array` for bytecode storage to leverage TypedArray performance in V8.
48
+
- Uses `Vec<i64>` for bytecode storage to leverage native Rust performance.
49
49
-**Memory Segments:**
50
50
-`Stack`: Operand processing (1024 slots).
51
51
-`Globals`: Absolute addressing (512 slots).
@@ -54,18 +54,17 @@ The "Engine". A high-performance, stack-based Virtual Machine.
54
54
- Implements a strict path-resolution algorithm to prevent "Sandbox Escapes" (`..` traversal).
55
55
-**Permissions:** Granular `read`, `write`, and `run` permissions.
56
56
-**Dependencies:**
57
-
-`readline-sync`: Used for the `read_line()` built-in to provide blocking synchronous I/O.
57
+
-`tokio`: Used for true async non-blocking execution inside the VM.
58
58
59
59
---
60
60
61
-
## 5. `@nox/cli` (`packages/cli`)
61
+
## 5. `nox` (`packages/cli`)
62
62
The "Gateway". The primary entry point for users and agents.
63
63
64
64
-**Interface:**
65
-
- Built using **React** and **Ink** to provide a modern, interactive CLI experience.
66
-
- Features a multi-line REPL with state persistence.
65
+
- Built using **clap** and **colored** to provide a modern, interactive CLI experience.
0 commit comments