naider 1.24.5 → 2.0.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/README.md +133 -112
- package/SPEC.naide +8 -6
- package/bin/naide.js +509 -124
- package/bin/postinstall.js +5 -15
- package/examples/model.naide +1 -1
- package/lsp/server.js +210 -101
- package/mcp/server.js +247 -22
- package/package.json +8 -5
- package/src/gen.js +853 -324
- package/src/generator-c.js +34 -14
- package/src/generator-go.js +26 -0
- package/src/generator.js +5 -1
- package/src/index.js +34 -14
- package/src/parser.js +15 -14
- package/src/project-tools.js +785 -0
- package/src/typechecker.js +147 -18
- package/vscode-naide/README.md +4 -6
- package/vscode-naide/extension.js +1 -2
- package/vscode-naide/package-lock.json +2 -2
- package/vscode-naide/package.json +3 -15
- package/SPEC-X.nx +0 -276
- package/assets/nx.ico +0 -0
- package/assets/nx_check.png +0 -0
- package/examples/ai-app.nx +0 -21
- package/examples/async.nx +0 -40
- package/examples/crud.nx +0 -64
- package/examples/fullapp.nx +0 -74
- package/examples/hello.nx +0 -29
- package/examples/server.nx +0 -27
- package/examples/sql-app.nx +0 -23
- package/examples/todo-api.nx +0 -31
- package/src/preprocess.js +0 -308
- package/vscode-naide/language-configuration-nx.json +0 -32
- package/vscode-naide/naide-lang-1.1.0.vsix +0 -0
- package/vscode-naide/syntaxes/naidex.tmLanguage.json +0 -287
package/README.md
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
1
|
# NAIDE
|
|
2
2
|
|
|
3
|
-
**Node AI Development Environment** —
|
|
3
|
+
**Node AI Development Environment** — One readable syntax for building, checking, and running applications, with compiler targets for **15 languages**.
|
|
4
4
|
|
|
5
|
-
NAIDE is
|
|
5
|
+
NAIDE is designed around one canonical syntax shared by people, AI tools, the compiler, editor support, and examples. It combines familiar control flow and types with concise inference, a built-in application toolkit, diagnostics, and a compiler that can emit multiple targets. The goal is not to hide how programs work, but to make common work direct and errors easier to find.
|
|
6
6
|
|
|
7
7
|
### Compilation Targets
|
|
8
8
|
|
|
9
|
-
| Target | Flag | Language | Server Framework |
|
|
10
|
-
|
|
11
|
-
| `node` | default | JavaScript (ES Modules) | Express |
|
|
12
|
-
| `python` / `py` | `--target python` | Python | Flask |
|
|
13
|
-
| `bun` | `--target bun` | JavaScript (Bun) | Bun.serve |
|
|
14
|
-
| `typescript` / `ts` | `--target ts` | TypeScript | Express |
|
|
15
|
-
| `go` | `--target go` | Go | net/http |
|
|
16
|
-
| `java` | `--target java` | Java | HttpServer |
|
|
17
|
-
| `rust` / `rs` | `--target rust` | Rust | actix-web |
|
|
18
|
-
| `cpp` / `c++` | `--target cpp` | C++ | cpp-httplib |
|
|
19
|
-
| `c` | `--target c` | C | libmicrohttpd |
|
|
20
|
-
| `csharp` / `cs` | `--target csharp` | C# | ASP.NET |
|
|
21
|
-
| `kotlin` / `kt` | `--target kotlin` | Kotlin | Ktor |
|
|
22
|
-
| `swift` | `--target swift` | Swift | Vapor |
|
|
23
|
-
| `dart` | `--target dart` | Dart | shelf |
|
|
24
|
-
| `php` | `--target php` | PHP | Built-in / Laravel |
|
|
25
|
-
| `ruby` / `rb` | `--target ruby` | Ruby | Sinatra |
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
9
|
+
| Target | Flag | Language | Server Framework | CI validation |
|
|
10
|
+
|--------|------|----------|-----------------|---------------|
|
|
11
|
+
| `node` | default | JavaScript (ES Modules) | Express | Code generation + basic runtime smoke |
|
|
12
|
+
| `python` / `py` | `--target python` | Python | Flask | Code generation + basic runtime smoke |
|
|
13
|
+
| `bun` | `--target bun` | JavaScript (Bun) | Bun.serve | Code generation + basic runtime smoke |
|
|
14
|
+
| `typescript` / `ts` | `--target ts` | TypeScript | Express | Code generation smoke test |
|
|
15
|
+
| `go` | `--target go` | Go | net/http | Code generation + basic runtime smoke |
|
|
16
|
+
| `java` | `--target java` | Java | HttpServer | Code generation smoke test |
|
|
17
|
+
| `rust` / `rs` | `--target rust` | Rust | actix-web | Code generation smoke test |
|
|
18
|
+
| `cpp` / `c++` | `--target cpp` | C++ | cpp-httplib | Code generation + basic runtime smoke |
|
|
19
|
+
| `c` | `--target c` | C | libmicrohttpd | Code generation + basic runtime smoke |
|
|
20
|
+
| `csharp` / `cs` | `--target csharp` | C# | ASP.NET | Code generation smoke test |
|
|
21
|
+
| `kotlin` / `kt` | `--target kotlin` | Kotlin | Ktor | Code generation smoke test |
|
|
22
|
+
| `swift` | `--target swift` | Swift | Vapor | Code generation smoke test |
|
|
23
|
+
| `dart` | `--target dart` | Dart | shelf | Code generation smoke test |
|
|
24
|
+
| `php` | `--target php` | PHP | Built-in / Laravel | Code generation smoke test |
|
|
25
|
+
| `ruby` / `rb` | `--target ruby` | Ruby | Sinatra | Code generation smoke test |
|
|
26
|
+
|
|
27
|
+
NAIDE source files use the `.naide` extension. There is one language syntax; no separate compressed or AI-only dialect.
|
|
28
|
+
|
|
29
|
+
#### What "supported target" means
|
|
30
|
+
|
|
31
|
+
The table describes exactly what CI currently verifies: all 15 targets have automated code-generation smoke tests; Node.js, Python, Bun, Go, C, and C++ also run a minimal output program (C/C++ are compiled first). This does **not** guarantee that every generated program compiles or runs, or that every built-in feature has equivalent behavior. Backend feature coverage varies; review generated code and target-specific requirements before relying on it in production.
|
|
32
|
+
|
|
33
|
+
The server-framework column identifies the backend's intended framework; it is not a promise that every NAIDE server feature is implemented for that target. Some backends emit TODO comments instead of working behavior—for example, the C backend's CRUD, authentication, and WebSocket paths, and the Rust backend's CRUD and WebSocket paths. Treat those generated sections as unsupported until the backend emits executable implementations and the corresponding integration tests pass.
|
|
31
34
|
|
|
32
35
|
## Install
|
|
33
36
|
|
|
@@ -42,6 +45,7 @@ npm install -g naider
|
|
|
42
45
|
naide init my-app
|
|
43
46
|
cd my-app
|
|
44
47
|
npm install
|
|
48
|
+
npm run check
|
|
45
49
|
npm run dev
|
|
46
50
|
```
|
|
47
51
|
|
|
@@ -58,10 +62,31 @@ server app port 3000:
|
|
|
58
62
|
naide app.naide
|
|
59
63
|
```
|
|
60
64
|
|
|
65
|
+
### Japanese Learning Path
|
|
66
|
+
|
|
67
|
+
1. **Values and variables** — `str` / `int` / `bool` declare values; add `mut` only when a value must change.
|
|
68
|
+
2. **Decisions and repetition** — use `if` / `elif` / `else` and `each`.
|
|
69
|
+
3. **Functions** — declare reusable behavior with `fn` and return with `ret`.
|
|
70
|
+
4. **Applications** — start with a route, then add validation, authentication, and storage deliberately.
|
|
71
|
+
|
|
72
|
+
```naide
|
|
73
|
+
str name = "NAIDE"
|
|
74
|
+
mut int visits = 0
|
|
75
|
+
|
|
76
|
+
fn greet(str who) -> str:
|
|
77
|
+
ret "こんにちは、{who}さん"
|
|
78
|
+
|
|
79
|
+
if visits == 0:
|
|
80
|
+
log greet(name)
|
|
81
|
+
visits += 1
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Save as `lesson.naide`, then run `naide lesson.naide`. To inspect a project's local setup, use `naide doctor`; use `naide verify` to check its manifests without executing code. Each lesson should introduce one concept at a time—read the generated behavior and test your own small variation before adding features.
|
|
85
|
+
|
|
61
86
|
## CLI
|
|
62
87
|
|
|
63
88
|
```bash
|
|
64
|
-
naide <file>
|
|
89
|
+
naide <file.naide> # Check and run a NAIDE file
|
|
65
90
|
naide # Start interactive REPL
|
|
66
91
|
naide repl # Start interactive REPL
|
|
67
92
|
naide init [dir] # Scaffold a new project
|
|
@@ -71,9 +96,13 @@ naide fmt <files...> # Format NAIDE files
|
|
|
71
96
|
naide lsp # Start Language Server (LSP)
|
|
72
97
|
naide vscode # Install VS Code extension
|
|
73
98
|
naide deploy [dir] # Generate Dockerfile for deployment
|
|
74
|
-
naide
|
|
99
|
+
naide doctor [dir] # Diagnose local tools and project setup
|
|
100
|
+
naide verify [dir] # Validate manifests and type-check NAIDE sources
|
|
101
|
+
naide test [dir] # Run detected native test suites
|
|
75
102
|
naide pkg init # Create naide.pkg.json manifest
|
|
76
103
|
naide pkg install <name> # Install a NAIDE package
|
|
104
|
+
naide pkg add <manager> <spec> # Install with a native package manager
|
|
105
|
+
naide pkg managers # List supported package ecosystems
|
|
77
106
|
naide pkg publish # Publish package to npm
|
|
78
107
|
naide -w <file> # Watch mode (auto-restart on changes)
|
|
79
108
|
naide -d <file> # Debug mode (Node.js inspector)
|
|
@@ -82,7 +111,6 @@ naide gen "instruction" # Same as ~~ (alias)
|
|
|
82
111
|
naide --expand <file> # Show ~~ directive expansion results
|
|
83
112
|
naide --emit <file> # Print generated JavaScript
|
|
84
113
|
naide -o <out.js> <file> # Write JavaScript to file
|
|
85
|
-
naide --mid <file.nx> # Show intermediate NAIDE v1 (debug X mode)
|
|
86
114
|
naide --ast <file> # Print AST
|
|
87
115
|
naide --tokens <file> # Print token stream
|
|
88
116
|
```
|
|
@@ -160,7 +188,7 @@ project.files.forEach(f => console.log(f.path));
|
|
|
160
188
|
|
|
161
189
|
```
|
|
162
190
|
$ naide
|
|
163
|
-
NAIDE REPL
|
|
191
|
+
NAIDE REPL v2.0.1 — type NAIDE code, see JavaScript output
|
|
164
192
|
Type .exit to quit, .eval to toggle eval mode
|
|
165
193
|
|
|
166
194
|
>>> str name = "hello"
|
|
@@ -178,7 +206,7 @@ Type `.eval` to switch to evaluation mode (runs the code instead of showing JS).
|
|
|
178
206
|
|
|
179
207
|
### Playground
|
|
180
208
|
|
|
181
|
-
Open `playground/index.html` in a browser (via a local server) for a live in-browser
|
|
209
|
+
Open `playground/index.html` in a browser (via a local server) for a live in-browser compiler with examples and source-size indicators.
|
|
182
210
|
|
|
183
211
|
### Benchmark
|
|
184
212
|
|
|
@@ -187,12 +215,13 @@ node benchmark/compare.js
|
|
|
187
215
|
```
|
|
188
216
|
|
|
189
217
|
```
|
|
190
|
-
|
|
191
|
-
JavaScript
|
|
192
|
-
NAIDE
|
|
193
|
-
NAIDE-X 39 435 19 -88%
|
|
218
|
+
Source Whitespace units Chars Lines
|
|
219
|
+
JavaScript 330 2590 78
|
|
220
|
+
NAIDE 66 517 19
|
|
194
221
|
```
|
|
195
222
|
|
|
223
|
+
The benchmark's "whitespace units" are a rough source-size comparison, not model-token counts or evidence of faster generation.
|
|
224
|
+
|
|
196
225
|
## Language Reference
|
|
197
226
|
|
|
198
227
|
### Variables
|
|
@@ -1273,7 +1302,7 @@ db.sql "postgres" "postgresql://localhost/mydb"
|
|
|
1273
1302
|
|
|
1274
1303
|
## Language Server (LSP)
|
|
1275
1304
|
|
|
1276
|
-
Built-in LSP for editor integration — diagnostics, completions, and
|
|
1305
|
+
Built-in LSP for editor integration — live syntax/type diagnostics, prefix-filtered completions, hover docs, document symbols, and definition/reference navigation across open `.naide` files:
|
|
1277
1306
|
|
|
1278
1307
|
```bash
|
|
1279
1308
|
naide lsp
|
|
@@ -1285,7 +1314,7 @@ naide lsp
|
|
|
1285
1314
|
naide vscode
|
|
1286
1315
|
```
|
|
1287
1316
|
|
|
1288
|
-
One command installs the extension — syntax highlighting, LSP diagnostics, autocomplete,
|
|
1317
|
+
One command installs the extension — syntax highlighting, LSP diagnostics, autocomplete, hover docs, symbols, and definition/reference navigation for `.naide` files. Restart VS Code after install.
|
|
1289
1318
|
|
|
1290
1319
|
## Deploy
|
|
1291
1320
|
|
|
@@ -1321,7 +1350,7 @@ server app port 3000:
|
|
|
1321
1350
|
ret {ok: true}
|
|
1322
1351
|
```
|
|
1323
1352
|
|
|
1324
|
-
Build all files with `naide build`, which compiles every `.naide
|
|
1353
|
+
Build all files with `naide build`, which compiles every `.naide` file to `.mjs`.
|
|
1325
1354
|
|
|
1326
1355
|
## Full Example
|
|
1327
1356
|
|
|
@@ -1412,65 +1441,23 @@ every "30m":
|
|
|
1412
1441
|
log "cleanup"
|
|
1413
1442
|
```
|
|
1414
1443
|
|
|
1415
|
-
This generates a
|
|
1416
|
-
|
|
1417
|
-
## NAIDE-X Syntax (.nx)
|
|
1418
|
-
|
|
1419
|
-
Every keyword is a single character. Line-start symbol = intent.
|
|
1420
|
-
|
|
1421
|
-
```
|
|
1422
|
-
s:name="World" -- str name = "World"
|
|
1423
|
-
i:count=42 -- int count = 42
|
|
1424
|
-
~i:counter=0 -- mut int counter = 0
|
|
1444
|
+
This generates a broad API starter demonstrating SQLite, AI/LLM integration, auth, CORS, CRUD, WebSocket, SSE, file caching, request validation, background jobs, and more from ~75 lines. Treat it as a starting point: install the generated dependencies, inspect the emitted code, and perform your own security, load, and deployment reviews before production use.
|
|
1425
1445
|
|
|
1426
|
-
|
|
1427
|
-
>"Hello, {who}!" -- ret "Hello, {who}!"
|
|
1446
|
+
## One syntax, end to end
|
|
1428
1447
|
|
|
1429
|
-
|
|
1430
|
-
>~fetch(url) -- ret await fetch(url)
|
|
1448
|
+
NAIDE has one source syntax for people and tools. Type inference and concise built-ins reduce ceremony; ordinary keywords keep control flow explicit:
|
|
1431
1449
|
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|count>2 -- elif count > 2:
|
|
1435
|
-
log"some" -- log "some"
|
|
1436
|
-
: -- else:
|
|
1437
|
-
log"few" -- log "few"
|
|
1450
|
+
```naide
|
|
1451
|
+
auto name = "World"
|
|
1438
1452
|
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
*active -- while active:
|
|
1453
|
+
fn greet(str who) -> str:
|
|
1454
|
+
ret "Hello, {who}!"
|
|
1442
1455
|
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
>users -- ret users
|
|
1446
|
-
P"/users"(req,res) -- post "/users" (req, res):
|
|
1447
|
-
>req.body -- ret req.body
|
|
1456
|
+
if name:
|
|
1457
|
+
log greet(name)
|
|
1448
1458
|
```
|
|
1449
1459
|
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
| Symbol | Meaning | Symbol | Meaning |
|
|
1453
|
-
|--------|---------|--------|---------|
|
|
1454
|
-
| `>` | return | `?` | if |
|
|
1455
|
-
| `\|` | elif | `:` | else |
|
|
1456
|
-
| `@` | loop | `*` | while |
|
|
1457
|
-
| `!` | try | `!!` | catch |
|
|
1458
|
-
| `!!!` | ensure/finally | `>.d` | ret.download |
|
|
1459
|
-
| `$` | server | `^` | model |
|
|
1460
|
-
| `<` | import | `%` | match |
|
|
1461
|
-
| `f` | function | `~f` | async function |
|
|
1462
|
-
| `+` | export | `~` | await |
|
|
1463
|
-
| `G` | GET | `P` | POST |
|
|
1464
|
-
| `U` | PUT | `D` | DELETE |
|
|
1465
|
-
| `X` | PATCH | `>.s` | ret.status |
|
|
1466
|
-
| `>.r` | ret.redirect | `>.h` | ret.html |
|
|
1467
|
-
| `>.t` | ret.text | `>.v` | ret.render |
|
|
1468
|
-
|
|
1469
|
-
Types: `s`=str `i`=int `n`=num `b`=bool `l`=list `m`=map `a`=any
|
|
1470
|
-
|
|
1471
|
-
High-level keywords work in both modes: `schema`, `crud`, `auth`, `cors`, `limit`, `env`, `every`, `watch`, `static`, `ws`, `db`, `db.sql`, `group`, `cookie`, `error`, `session`, `upload`, `view`, `sse`, `cache`, `patch`, `validate`, `test`, `assert`, `queue`, `openapi`, `typeof`, `instanceof`, `ensure`, `ai`, `prompt`, `bot`, `slash`.
|
|
1472
|
-
|
|
1473
|
-
NAIDE-X log shorthands: `log.e` = error, `log.w` = warn, `log.i` = info, `log.d` = debug.
|
|
1460
|
+
New projects, generated examples, editor tooling, and compiler input all use `.naide`. There is no separate symbolic or AI-only form to learn.
|
|
1474
1461
|
|
|
1475
1462
|
## Plugin System
|
|
1476
1463
|
|
|
@@ -1489,15 +1476,6 @@ list names = listPlugins()
|
|
|
1489
1476
|
|
|
1490
1477
|
`registerPlugin(name, setup)` — registers a plugin factory. `usePlugin(name, opts?)` — initializes on first call, returns cached exports. `listPlugins()` — returns registered plugin names.
|
|
1491
1478
|
|
|
1492
|
-
## Convert (NX ↔ NAIDE)
|
|
1493
|
-
|
|
1494
|
-
Bidirectional conversion between `.nx` and `.naide`:
|
|
1495
|
-
|
|
1496
|
-
```bash
|
|
1497
|
-
naide convert file.nx # → file.naide (expand to readable syntax)
|
|
1498
|
-
naide convert file.naide # → file.nx (compress to NX syntax)
|
|
1499
|
-
```
|
|
1500
|
-
|
|
1501
1479
|
## Source Maps & Error Remapping
|
|
1502
1480
|
|
|
1503
1481
|
Runtime errors are automatically remapped to source file line numbers:
|
|
@@ -1509,7 +1487,7 @@ Error in app.naide:12
|
|
|
1509
1487
|
>>12 | throw "not found"
|
|
1510
1488
|
```
|
|
1511
1489
|
|
|
1512
|
-
The CLI tracks source-to-output line mappings and shows context from your `.naide
|
|
1490
|
+
The CLI tracks source-to-output line mappings and shows context from your `.naide` file, not the generated JavaScript.
|
|
1513
1491
|
|
|
1514
1492
|
## Native Dependency Detection
|
|
1515
1493
|
|
|
@@ -1534,7 +1512,7 @@ Catches type mismatches at compile time:
|
|
|
1534
1512
|
app.naide:7 WARN: Type warning: reassigning int variable 'count' with str
|
|
1535
1513
|
```
|
|
1536
1514
|
|
|
1537
|
-
The type checker
|
|
1515
|
+
The type checker checks supported annotations (`str`, `int`, `num`, `bool`, `list`, `map`), known function argument counts and types, return expressions against explicit annotations, and straightforward assignments. `num` accepts `int` values. `any` and `json` accept all types. Expressions whose types cannot be determined (including many dynamic member accesses) are treated as `any`, so passing `naide check` is useful feedback, **not a proof of program correctness or runtime safety**.
|
|
1538
1516
|
|
|
1539
1517
|
Also available as a flag: `naide --check app.naide` or programmatically via `compile(source, { typeCheck: true })`.
|
|
1540
1518
|
|
|
@@ -1563,18 +1541,61 @@ naide -d app.naide # starts with --inspect-brk
|
|
|
1563
1541
|
|
|
1564
1542
|
Then open `chrome://inspect` in Chrome to connect. The program pauses at the first line so you can set breakpoints before execution.
|
|
1565
1543
|
|
|
1566
|
-
##
|
|
1544
|
+
## Project Diagnostics
|
|
1545
|
+
|
|
1546
|
+
```bash
|
|
1547
|
+
naide doctor # inspect Node.js and installed language tools
|
|
1548
|
+
naide doctor . --json # machine-readable report
|
|
1549
|
+
naide verify # validate package manifests and find setup gaps
|
|
1550
|
+
```
|
|
1567
1551
|
|
|
1568
|
-
|
|
1552
|
+
`doctor` checks the local Node.js requirement, available ecosystem tools, package manifests, and NAIDE source files. `verify` parses `package.json`, checks its dependency and script sections, and compiles and type-checks `.naide` files recursively, excluding `.git`, `dist`, `node_modules`, and the root `SPEC.naide` language reference. It is read-only and does not execute package scripts or source code; it is a setup/type-check aid, not a security audit or a guarantee that dependencies resolve or the application behaves correctly. Other ecosystem manifests are detected but are not fully validated. `test` is a separate, explicit command: it detects common native test setups (npm, Cargo, Go, .NET, Maven/Gradle, SwiftPM, Dart, Composer, Bundler, and pytest) and runs their configured test commands. Since project tests are executable code, run this only in a project you trust.
|
|
1553
|
+
|
|
1554
|
+
## Native Package Ecosystems
|
|
1555
|
+
|
|
1556
|
+
NAIDE can ask the native package manager to install dependencies from several registries:
|
|
1569
1557
|
|
|
1570
1558
|
```bash
|
|
1571
|
-
naide pkg
|
|
1572
|
-
naide pkg
|
|
1573
|
-
|
|
1574
|
-
|
|
1559
|
+
naide pkg managers
|
|
1560
|
+
naide pkg add npm zod@3.24.0
|
|
1561
|
+
python -m venv .venv
|
|
1562
|
+
# Activate .venv before installing Python packages
|
|
1563
|
+
naide pkg add pip requests==2.32.0
|
|
1564
|
+
naide pkg add cargo serde@1.0.0
|
|
1565
|
+
naide pkg add go github.com/google/uuid@v1.6.0
|
|
1566
|
+
naide pkg add dotnet Newtonsoft.Json@13.0.1
|
|
1567
|
+
naide pkg add composer symfony/console:^7.0
|
|
1568
|
+
naide pkg add gem rails@7.1.0
|
|
1569
|
+
naide pkg add dart 'http:^1.2.0'
|
|
1570
|
+
naide pkg add maven org.slf4j:slf4j-api:2.0.16
|
|
1571
|
+
naide pkg add conan fmt/11.0.2
|
|
1572
|
+
```
|
|
1573
|
+
|
|
1574
|
+
Supported adapters are npm, PyPI/pip, Cargo, Go modules, NuGet/.NET, Packagist/Composer, RubyGems via Bundler, pub.dev, Maven Central, and Conan. Arguments are passed separately; on Windows, script-based manager shims use a quoted `cmd.exe` wrapper, and arguments containing quotes, percent signs, or line breaks are rejected. npm, pip, Cargo, Go, .NET, Composer, Bundler, and Dart delegate dependency declaration and lockfile updates to their native tools (where that ecosystem supports lockfiles). pip installs into an active/project `.venv`, records its requirement in `requirements.txt`, and records the ecosystem dependency in `naide.pkg.json`; activate a virtual environment before installing. Metadata files are staged before replacement, and failed multi-file updates are rolled back where possible. Every successful `naide pkg add` creates or updates `naide.pkg.json` as NAIDE's cross-ecosystem index, while native project manifests remain authoritative.
|
|
1575
|
+
|
|
1576
|
+
This is package-manager interoperability, **not** automatic cross-language linking. A Python, Rust, Java, or other native library cannot be called directly from NAIDE just because it is installed. To use one from a Node.js NAIDE program, expose a deliberate boundary such as a subprocess protocol, HTTP service, or a maintained FFI/WASM adapter. The Ruby adapter uses `bundle add`, so a Gemfile must already exist. Maven downloads to the local cache, and Conan resolves/generates dependency metadata; both still require their respective build-file/toolchain integration before the dependency is usable by an application. SwiftPM, Gradle, and other ecosystems without a tested adapter can still be used through their normal native tools.
|
|
1577
|
+
|
|
1578
|
+
`naide.pkg.json` stores NAIDE package metadata and records non-npm additions under `languageDependencies`; the native manager's manifest and lockfile remain authoritative. `naide pkg install` remains the npm convenience command for NAIDE plugins.
|
|
1579
|
+
|
|
1580
|
+
## MCP Server
|
|
1581
|
+
|
|
1582
|
+
`naide-mcp` communicates over stdio and provides tools for compilation/generation, non-executing `naide_check` diagnostics, project verification and tests, package ecosystem guidance, and the language specification. The `verify_changes` prompt (also available in Japanese) guides agents to check changed source and the project without running code. It also exposes read-only resources (`naide://spec`, `naide://package-ecosystems`, `naide://project`).
|
|
1583
|
+
|
|
1584
|
+
For VS Code, after installing `naider` in a location on `PATH`, add this to `.vscode/mcp.json`:
|
|
1585
|
+
|
|
1586
|
+
```json
|
|
1587
|
+
{
|
|
1588
|
+
"servers": {
|
|
1589
|
+
"naide": {
|
|
1590
|
+
"type": "stdio",
|
|
1591
|
+
"command": "naide-mcp",
|
|
1592
|
+
"args": []
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1575
1596
|
```
|
|
1576
1597
|
|
|
1577
|
-
The `
|
|
1598
|
+
The MCP server's `naide_run` and `naide_test` tools execute code with the server process's operating-system permissions. Connect it only to clients and workspaces whose code you trust.
|
|
1578
1599
|
|
|
1579
1600
|
## NAIDE vs Python — Side by Side
|
|
1580
1601
|
|
|
@@ -1648,14 +1669,14 @@ server app port 3000:
|
|
|
1648
1669
|
|
|
1649
1670
|
## Why NAIDE?
|
|
1650
1671
|
|
|
1651
|
-
|
|
1672
|
+
An approachable language should reduce incidental complexity without obscuring program behavior:
|
|
1652
1673
|
|
|
1653
|
-
1. **
|
|
1654
|
-
2. **
|
|
1655
|
-
3. **
|
|
1656
|
-
4. **
|
|
1674
|
+
1. **One syntax** — no human-only and machine-only dialects to keep in sync
|
|
1675
|
+
2. **Direct feedback** — type checks, tests, and source-mapped diagnostics help find mistakes
|
|
1676
|
+
3. **Useful defaults** — common application patterns need less setup
|
|
1677
|
+
4. **Escape hatches** — generated code and ordinary packages remain inspectable and usable
|
|
1657
1678
|
|
|
1658
|
-
NAIDE
|
|
1679
|
+
NAIDE aims to make one readable source representation work well for both people and AI tools. Generated code and compiler diagnostics remain inspectable rather than treating the source as an opaque prompt format.
|
|
1659
1680
|
|
|
1660
1681
|
## License
|
|
1661
1682
|
|
package/SPEC.naide
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
# NAIDE Language Specification
|
|
3
3
|
# Node AI Development Environment
|
|
4
4
|
# ============================================
|
|
5
|
-
# AI
|
|
5
|
+
# 人間とAIが同じ構文を読み書きできる、実用的なプログラミング言語
|
|
6
6
|
#
|
|
7
7
|
# 設計原則:
|
|
8
|
-
# 1.
|
|
9
|
-
# 2.
|
|
10
|
-
# 3.
|
|
11
|
-
# 4.
|
|
12
|
-
# 5.
|
|
8
|
+
# 1. 構文はひとつ。人間・AI・ツールで異なる方言を持たない
|
|
9
|
+
# 2. 短さは記号暗記ではなく、型推論と明快な標準機能で実現する
|
|
10
|
+
# 3. 制御フロー・非同期・失敗の扱いはコードから読み取れる
|
|
11
|
+
# 4. よく使う仕事を支援しつつ、暗黙の副作用を増やさない
|
|
12
|
+
# 5. 型検査・診断・テストで、実行前に誤りを見つけやすくする
|
|
13
|
+
# 6. コンパイラの出力と実行時の挙動を追跡できるようにする
|
|
14
|
+
# 7. 新機能は構文の一貫性、保守性、ターゲット間の意味保存を満たしてから追加
|
|
13
15
|
# ============================================
|
|
14
16
|
|
|
15
17
|
|