Skip to content

Commit f00a7cd

Browse files
committed
docs: add PLAN.md roadmap and Blueprint Protocol mandate
1 parent 5bea565 commit f00a7cd

7 files changed

Lines changed: 88 additions & 36 deletions

File tree

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Nox is a high-performance, general-purpose programming language built from scrat
3636
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.
3737
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.
3838
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.
4040

4141
## Progressive Disclosure
4242
For detailed rules, architectural deep-dives, and coding patterns, refer to:

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Thank you for your interest in contributing to Nox! This project follows a stric
88
- **Pull Requests (PRs):** Every change must be submitted via a PR with a clear description of the "why" and "what".
99

1010
## 2. Code Quality and Linting
11-
- **Automated Linting:** PRs will only be merged if they pass all automated linting checks (Prettier/ESLint).
12-
- **Zero Warnings Policy:** All warnings are treated as errors. The codebase must remain clean at all times.
11+
- **Automated Linting:** PRs will only be merged if they pass all automated linting checks (`cargo fmt` and `cargo clippy`).
12+
- **Zero Warnings Policy:** All warnings are treated as errors (`cargo check` must be clean). The codebase must remain clean at all times.
1313

1414
## 3. Safety and Security Rules
1515
- **Signed Commits:** All contributors are encouraged (and in some cases required) to GPG-sign their commits for verification.

‎PLAN.md‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Nox Future Roadmap & Plan (Phase 11+)
2+
3+
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.
11+
```javascript
12+
import { fastMath } from "https://nox-lib.io/math/map.nx.json"
13+
import { localHelper } from "./utils/helper.nx"
14+
```
15+
- **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.
42+
43+
```javascript
44+
// Simple Function
45+
fn greet(name) { print name }
46+
47+
// Type-Safe Function
48+
pub fn add(a: int, b: int) -> int {
49+
return a + b
50+
}
51+
```

‎docs/STANDARDS.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# Nox Engineering Standards
22

33
## Coding Standards
4-
- **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).
77
- **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.
99

1010
## Quality Standards
1111
- **Modern Nox Syntax:** All new code and documentation MUST use the `is`/`mut` variables, `fn =>` arrows, and no-parens `if`/`while` syntax.
1212
- **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.
1414
- **Documentation-as-Code:** Major architectural decisions and language features must be documented in the `/docs` folder.
1515

1616
For project-wide rules, see root [AGENTS.md](../AGENTS.md).

‎docs/WORKFLOW.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ This project is primarily developed, reviewed, and managed by AI agents.
88
- **Research & Strategy:** Read all relevant files (`.ts`, `.txt`, `.md`, `.nx`) to fully understand the context before writing code.
99
- **Systemic Refactoring:** Proactively refactor legacy syntax to Modern Nox standard (`is`/`mut`, no-parens) when modifying files.
1010
- **Verification:**
11-
- Run `npm run build` after every update.
12-
- Execute and verify all integration tests in `tests/`.
11+
- Run `cargo check` and `cargo build` after every update to ensure zero warnings.
12+
- Execute and verify all integration tests in `tests/` using `cargo test`.
1313

1414
## AI Protocols
1515
- **Agent Identification:** Explicitly state your agent name (e.g., "Developed by Gemini CLI") in commit messages and documentation.

‎docs/cli.md‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# Nox CLI & REPL Guide
22

3-
Nox provides a modern, interactive CLI built with **React** and **Ink**.
3+
Nox provides a modern, interactive CLI built in **Rust**.
44

55
## 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.
77

88
## Interactive REPL
99
To start the REPL, simply run:
1010
```bash
11-
nox
11+
nox repl
1212
```
13+
*(Or use `cargo run --package nox -- repl` during development)*
1314

1415
### REPL Commands (Dot Commands)
1516
- `.help`: Displays available commands and syntax.
@@ -23,8 +24,9 @@ Nox REPL features intelligent multi-line detection. If you enter an incomplete c
2324
## Running Files
2425
To execute a Nox script, pass the file path as an argument.
2526
```bash
26-
nox my_script.nx
27+
nox run my_script.nx
2728
```
29+
*(Or use `cargo run --package nox -- run my_script.nx` during development)*
2830
*Note: While any extension works, `.nx` is the recommended standard.*
2931

3032
### Permission Flags
@@ -38,5 +40,5 @@ By default, Nox scripts run in a sandbox with no access to the filesystem or she
3840

3941
**Example:**
4042
```bash
41-
nox --allow-read --allow-write log_processor.nx
43+
nox run --allow-read --allow-write log_processor.nx
4244
```

‎docs/packages.md‎

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
# Nox Package Ecosystem (High Detail Analysis)
22

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.
44

55
## 1. Root Workspace (`/`)
66
The root directory acts as the orchestrator for the entire ecosystem.
77

8-
- **Purpose:** Manages the monorepo lifecycle, builds, and cross-package testing.
8+
- **Purpose:** Manages the Cargo workspace lifecycle, builds, and cross-package testing.
99
- **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.
1313
- **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.
1616

1717
---
1818

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.
2121

2222
- **Role:** Ensures that the Frontend (Compiler) and the Runtime (VM) use the exact same numeric identifiers for operations.
2323
- **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.
2525
- `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.
2727

2828
---
2929

30-
## 3. `@nox/frontend` (`packages/frontend`)
30+
## 3. `nox-frontend` (`packages/frontend`)
3131
The "Architect". It transforms human-readable code into machine-executable bytecode.
3232

3333
- **Components:**
3434
- **Lexer:** Handles string scanning, including complex escape sequences like `\e` (ANSI) for terminal styling.
3535
- **Parser:** A recursive-descent parser that builds a formal AST. It supports hybrid JS/Python syntax.
3636
- **Compiler:** A one-pass AST-to-Bytecode generator.
3737
- **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.
3939
- **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.
4141

4242
---
4343

44-
## 4. `@nox/runtime` (`packages/runtime`)
44+
## 4. `nox-runtime` (`packages/runtime`)
4545
The "Engine". A high-performance, stack-based Virtual Machine.
4646

4747
- **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.
4949
- **Memory Segments:**
5050
- `Stack`: Operand processing (1024 slots).
5151
- `Globals`: Absolute addressing (512 slots).
@@ -54,18 +54,17 @@ The "Engine". A high-performance, stack-based Virtual Machine.
5454
- Implements a strict path-resolution algorithm to prevent "Sandbox Escapes" (`..` traversal).
5555
- **Permissions:** Granular `read`, `write`, and `run` permissions.
5656
- **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.
5858

5959
---
6060

61-
## 5. `@nox/cli` (`packages/cli`)
61+
## 5. `nox` (`packages/cli`)
6262
The "Gateway". The primary entry point for users and agents.
6363

6464
- **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.
6766
- **Functionality:**
68-
- Parses Deno-style flags (e.g., `--allow-read`, `--allow-all`).
67+
- Parses command-line arguments and commands.
6968
- Handles file execution logic and error reporting with source-code context.
7069
- **Binaries:**
7170
- Exports the `nox` command globally.

0 commit comments

Comments
 (0)