naider 1.13.0 → 1.15.0
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 +150 -3
- package/SPEC.naide +70 -0
- package/lsp/server.js +11 -1
- package/package.json +22 -3
- package/src/generator-c.js +1014 -0
- package/src/generator-cpp.js +1211 -0
- package/src/generator-csharp.js +1633 -0
- package/src/generator-dart.js +1569 -0
- package/src/generator-go.js +1781 -0
- package/src/generator-java.js +1814 -0
- package/src/generator-kotlin.js +1819 -0
- package/src/generator-php.js +1576 -0
- package/src/generator-python.js +320 -0
- package/src/generator-ruby.js +1530 -0
- package/src/generator-rust.js +1887 -0
- package/src/generator-swift.js +1735 -0
- package/src/generator-typescript.js +126 -0
- package/src/generator.js +332 -0
- package/src/index.js +55 -0
- package/src/parser.js +290 -1
- package/src/tokens.js +18 -0
- package/vscode-naide/syntaxes/naide.tmLanguage.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
# NAIDE
|
|
2
2
|
|
|
3
|
-
**Node AI Development Environment** — A programming language designed for AI-speed code generation that transpiles to
|
|
4
|
-
|
|
5
|
-
NAIDE is built on three principles: one way to write everything (zero ambiguity), keyword-driven intent (the first token decides meaning), and minimal token count (fewer tokens = faster AI generation).
|
|
3
|
+
**Node AI Development Environment** — A programming language designed for AI-speed code generation that transpiles to **15 languages**.
|
|
4
|
+
|
|
5
|
+
NAIDE is built on three principles: one way to write everything (zero ambiguity), keyword-driven intent (the first token decides meaning), and minimal token count (fewer tokens = faster AI generation). Write once, compile to any target. 47 built-in features including servers, databases, authentication, bots, GraphQL, gRPC, WebRTC, blockchain, and more.
|
|
6
|
+
|
|
7
|
+
### Compilation Targets
|
|
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 |
|
|
6
26
|
|
|
7
27
|
Two syntax modes:
|
|
8
28
|
|
|
@@ -727,6 +747,133 @@ i18n "locales/":
|
|
|
727
747
|
|
|
728
748
|
Usage: `i18n.t("greeting.hello")`, `i18n.setLang("ja")`.
|
|
729
749
|
|
|
750
|
+
## Push Notifications
|
|
751
|
+
|
|
752
|
+
```python
|
|
753
|
+
push env.VAPID_PUBLIC env.VAPID_PRIVATE:
|
|
754
|
+
endpoint "/subscribe"
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
Usage: `push.send(subscription, "Title", "Body")`. Compiles to web-push (Node.js) or pywebpush (Python).
|
|
758
|
+
|
|
759
|
+
## Full-Text Search
|
|
760
|
+
|
|
761
|
+
```python
|
|
762
|
+
search "meilisearch" "http://localhost:7700" env.MEILI_KEY:
|
|
763
|
+
index "products"
|
|
764
|
+
```
|
|
765
|
+
|
|
766
|
+
Usage: `search.query("keyword")`, `search.add(docs)`. Supports Meilisearch and Elasticsearch.
|
|
767
|
+
|
|
768
|
+
## Image Processing
|
|
769
|
+
|
|
770
|
+
```python
|
|
771
|
+
image "photo.jpg" -> "output.jpg":
|
|
772
|
+
resize 800 600
|
|
773
|
+
grayscale
|
|
774
|
+
watermark "logo.png"
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
Operations: `resize`, `crop`, `rotate`, `blur`, `grayscale`, `flip`, `watermark`, `format`. Compiles to sharp (Node.js) or Pillow (Python).
|
|
778
|
+
|
|
779
|
+
## CSV/Excel Export
|
|
780
|
+
|
|
781
|
+
```python
|
|
782
|
+
csv "users" format "csv":
|
|
783
|
+
columns "name" "email" "age"
|
|
784
|
+
from data
|
|
785
|
+
|
|
786
|
+
csv "report" format "xlsx":
|
|
787
|
+
columns "id" "value" "date"
|
|
788
|
+
from items
|
|
789
|
+
output "monthly_report.xlsx"
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
| Target | CSV Library | Excel Library |
|
|
793
|
+
|--------|-----------|-------------|
|
|
794
|
+
| Node.js | csv-stringify | ExcelJS |
|
|
795
|
+
| Python | csv (stdlib) | openpyxl |
|
|
796
|
+
|
|
797
|
+
## Logging
|
|
798
|
+
|
|
799
|
+
```python
|
|
800
|
+
logging "app":
|
|
801
|
+
level "info"
|
|
802
|
+
file "app.log"
|
|
803
|
+
format "json"
|
|
804
|
+
rotate "14d"
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
Usage: `logger.info("message")`, `logger.error("fail")`, `logger.warn("caution")`.
|
|
808
|
+
|
|
809
|
+
| Target | Library |
|
|
810
|
+
|--------|---------|
|
|
811
|
+
| Node.js | winston + winston-daily-rotate-file |
|
|
812
|
+
| Python | logging (stdlib) |
|
|
813
|
+
|
|
814
|
+
## DB Migrations
|
|
815
|
+
|
|
816
|
+
```python
|
|
817
|
+
migrate "create_users":
|
|
818
|
+
up:
|
|
819
|
+
log "Creating users table"
|
|
820
|
+
down:
|
|
821
|
+
log "Dropping users table"
|
|
822
|
+
```
|
|
823
|
+
|
|
824
|
+
Generates migration files with `up()` and `down()` methods for reversible schema changes.
|
|
825
|
+
|
|
826
|
+
## gRPC
|
|
827
|
+
|
|
828
|
+
```python
|
|
829
|
+
grpc "users" port 50051:
|
|
830
|
+
rpc getUser(id) -> user
|
|
831
|
+
rpc createUser(data) -> user
|
|
832
|
+
rpc deleteUser(id) -> result
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
| Target | Library |
|
|
836
|
+
|--------|---------|
|
|
837
|
+
| Node.js | @grpc/grpc-js + @grpc/proto-loader |
|
|
838
|
+
| Python | grpcio |
|
|
839
|
+
|
|
840
|
+
## WebRTC
|
|
841
|
+
|
|
842
|
+
```python
|
|
843
|
+
webrtc "video-chat":
|
|
844
|
+
stun "stun:stun.l.google.com:19302"
|
|
845
|
+
on offer(data):
|
|
846
|
+
log "Received offer"
|
|
847
|
+
on answer(data):
|
|
848
|
+
log "Received answer"
|
|
849
|
+
on candidate(data):
|
|
850
|
+
log "ICE candidate"
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
Generates a WebSocket-based signaling server with ICE configuration.
|
|
854
|
+
|
|
855
|
+
| Target | Library |
|
|
856
|
+
|--------|---------|
|
|
857
|
+
| Node.js | ws (WebSocketServer) |
|
|
858
|
+
| Python | websockets + asyncio |
|
|
859
|
+
|
|
860
|
+
## Blockchain / Web3
|
|
861
|
+
|
|
862
|
+
```python
|
|
863
|
+
blockchain "eth":
|
|
864
|
+
network "ethereum"
|
|
865
|
+
provider env.ETH_RPC
|
|
866
|
+
contract "0x1234abcd..."
|
|
867
|
+
abi "contract-abi.json"
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
Usage: `eth.getBalance("0x...")`, `eth.getBlock()`, `eth.sendTx(wallet, to, "0.1")`.
|
|
871
|
+
|
|
872
|
+
| Target | Library |
|
|
873
|
+
|--------|---------|
|
|
874
|
+
| Node.js | ethers.js v6 |
|
|
875
|
+
| Python | web3.py |
|
|
876
|
+
|
|
730
877
|
## Environment Variables
|
|
731
878
|
|
|
732
879
|
```python
|
package/SPEC.naide
CHANGED
|
@@ -564,3 +564,73 @@ i18n "locales/":
|
|
|
564
564
|
lang "ja" "ja.json"
|
|
565
565
|
# usage: i18n.t("greeting.hello")
|
|
566
566
|
# usage: i18n.setLang("ja")
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
# ---- Push通知 ----
|
|
570
|
+
push env.VAPID_PUBLIC env.VAPID_PRIVATE:
|
|
571
|
+
endpoint "/subscribe"
|
|
572
|
+
# usage: push.send(subscription, "Title", "Body")
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
# ---- 全文検索 ----
|
|
576
|
+
search "meilisearch" "http://localhost:7700" env.MEILI_KEY:
|
|
577
|
+
index "products"
|
|
578
|
+
# usage: search.query("keyword")
|
|
579
|
+
# usage: search.add([{id: 1, name: "Item"}])
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
# ---- 画像処理 ----
|
|
583
|
+
image "photo.jpg" -> "output.jpg":
|
|
584
|
+
resize 800 600
|
|
585
|
+
grayscale
|
|
586
|
+
watermark "logo.png"
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
# ---- CSV/Excelエクスポート ----
|
|
590
|
+
csv "users" format "csv":
|
|
591
|
+
columns "name" "email" "age"
|
|
592
|
+
from data
|
|
593
|
+
# Excel形式
|
|
594
|
+
csv "report" format "xlsx":
|
|
595
|
+
columns "id" "value" "date"
|
|
596
|
+
from items
|
|
597
|
+
output "monthly_report.xlsx"
|
|
598
|
+
|
|
599
|
+
# ---- ロギング ----
|
|
600
|
+
logging "app":
|
|
601
|
+
level "info"
|
|
602
|
+
file "app.log"
|
|
603
|
+
format "json"
|
|
604
|
+
rotate "14d"
|
|
605
|
+
# usage: logger.info("message"), logger.error("fail")
|
|
606
|
+
|
|
607
|
+
# ---- DBマイグレーション ----
|
|
608
|
+
migrate "create_users":
|
|
609
|
+
up:
|
|
610
|
+
log "Creating users table"
|
|
611
|
+
down:
|
|
612
|
+
log "Dropping users table"
|
|
613
|
+
|
|
614
|
+
# ---- gRPC ----
|
|
615
|
+
grpc "users" port 50051:
|
|
616
|
+
rpc getUser(id) -> user
|
|
617
|
+
rpc createUser(data) -> user
|
|
618
|
+
rpc deleteUser(id) -> result
|
|
619
|
+
|
|
620
|
+
# ---- WebRTC ----
|
|
621
|
+
webrtc "video-chat":
|
|
622
|
+
stun "stun:stun.l.google.com:19302"
|
|
623
|
+
on offer(data):
|
|
624
|
+
log "Received offer"
|
|
625
|
+
on answer(data):
|
|
626
|
+
log "Received answer"
|
|
627
|
+
on candidate(data):
|
|
628
|
+
log "ICE candidate"
|
|
629
|
+
|
|
630
|
+
# ---- ブロックチェーン ----
|
|
631
|
+
blockchain "eth":
|
|
632
|
+
network "ethereum"
|
|
633
|
+
provider env.ETH_RPC
|
|
634
|
+
contract "0x1234abcd..."
|
|
635
|
+
abi "contract-abi.json"
|
|
636
|
+
# usage: eth.getBalance("0x..."), eth.getBlock(), eth.sendTx(wallet, to, "0.1")
|
package/lsp/server.js
CHANGED
|
@@ -289,7 +289,8 @@ function getCompletions() {
|
|
|
289
289
|
'cors', 'auth', 'crud', 'limit', 'cookie', 'session', 'static', 'ws', 'sse',
|
|
290
290
|
'cache', 'view', 'upload', 'group', 'validate', 'openapi', 'error', 'mid', 'prompt',
|
|
291
291
|
'page', 'cli', 'mail', 'graphql', 'desktop', 'screen',
|
|
292
|
-
'oauth', 'pay', 'storage', 'pdf', 'i18n',
|
|
292
|
+
'oauth', 'pay', 'storage', 'pdf', 'i18n', 'push', 'search', 'image',
|
|
293
|
+
'csv', 'logging', 'migrate', 'grpc', 'webrtc', 'blockchain',
|
|
293
294
|
];
|
|
294
295
|
const builtins = [
|
|
295
296
|
{ label: 'uuid()', detail: 'Generate UUID v4', insertText: 'uuid()' },
|
|
@@ -351,6 +352,15 @@ const HOVER_DOCS = {
|
|
|
351
352
|
'storage': '**storage** — Cloud storage (S3/GCS)\n```naide\nstorage "s3" env.BUCKET env.KEY env.SECRET:\n region "ap-northeast-1"\n```\nUsage: `storage.upload(key, body)`, `storage.download(key)`',
|
|
352
353
|
'pdf': '**pdf** — PDF generation\n```naide\npdf "report.pdf":\n title "Report"\n text "Hello"\n```',
|
|
353
354
|
'i18n': '**i18n** — Internationalization\n```naide\ni18n "locales/":\n default "en"\n lang "en" "en.json"\n lang "ja" "ja.json"\n```\nUsage: `i18n.t("key")`, `i18n.setLang("ja")`',
|
|
355
|
+
'push': '**push** — Push notifications\n```naide\npush env.VAPID_PUBLIC env.VAPID_PRIVATE:\n endpoint "/subscribe"\n```\nUsage: `push.send(subscription, title, body)`',
|
|
356
|
+
'search': '**search** — Full-text search\n```naide\nsearch "meilisearch" "http://localhost:7700" env.KEY:\n index "products"\n```\nUsage: `search.query("keyword")`, `search.add(docs)`',
|
|
357
|
+
'image': '**image** — Image processing\n```naide\nimage "input.jpg" -> "output.jpg":\n resize 800 600\n grayscale\n watermark "logo.png"\n```',
|
|
358
|
+
'csv': '**csv** — CSV/Excel export\n```naide\ncsv "users" format "xlsx":\n columns "name" "email"\n from data\n```\nSupports csv and xlsx formats',
|
|
359
|
+
'logging': '**logging** — Structured logging\n```naide\nlogging "app":\n level "info"\n file "app.log"\n format "json"\n rotate "14d"\n```\nUsage: `logger.info("msg")`, `logger.error("fail")`',
|
|
360
|
+
'migrate': '**migrate** — DB migrations\n```naide\nmigrate "create_users":\n up:\n log "creating"\n down:\n log "dropping"\n```',
|
|
361
|
+
'grpc': '**grpc** — gRPC service\n```naide\ngrpc "users" port 50051:\n rpc getUser(id) -> user\n rpc createUser(data) -> user\n```',
|
|
362
|
+
'webrtc': '**webrtc** — WebRTC signaling\n```naide\nwebrtc "video":\n stun "stun:stun.l.google.com:19302"\n on offer(data):\n log "offer received"\n```',
|
|
363
|
+
'blockchain': '**blockchain** — Blockchain/Web3\n```naide\nblockchain "eth":\n network "ethereum"\n provider env.ETH_RPC\n contract "0x..."\n```\nUsage: `eth.getBalance(addr)`, `eth.getBlock()`',
|
|
354
364
|
};
|
|
355
365
|
|
|
356
366
|
function getHover(params) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "naider",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "NAIDE - Node AI Development Environment. AI-specialized language
|
|
3
|
+
"version": "1.15.0",
|
|
4
|
+
"description": "NAIDE - Node AI Development Environment. AI-specialized language transpiling to 15 targets: Node.js, Python, Bun, TypeScript, C, C++, Java, Go, Rust, PHP, Ruby, Kotlin, Swift, Dart, C#. Built-in server, auth, DB, AI/LLM, bots, GraphQL, gRPC, WebRTC, blockchain, and 47 more features.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./src/index.js",
|
|
@@ -56,7 +56,26 @@
|
|
|
56
56
|
"react-native",
|
|
57
57
|
"cron",
|
|
58
58
|
"python",
|
|
59
|
-
"bun"
|
|
59
|
+
"bun",
|
|
60
|
+
"csv",
|
|
61
|
+
"excel",
|
|
62
|
+
"logging",
|
|
63
|
+
"migration",
|
|
64
|
+
"grpc",
|
|
65
|
+
"webrtc",
|
|
66
|
+
"blockchain",
|
|
67
|
+
"web3",
|
|
68
|
+
"typescript",
|
|
69
|
+
"java",
|
|
70
|
+
"go",
|
|
71
|
+
"rust",
|
|
72
|
+
"swift",
|
|
73
|
+
"kotlin",
|
|
74
|
+
"dart",
|
|
75
|
+
"csharp",
|
|
76
|
+
"cpp",
|
|
77
|
+
"ruby",
|
|
78
|
+
"php"
|
|
60
79
|
],
|
|
61
80
|
"author": "pirikari.sena@gmail.com",
|
|
62
81
|
"license": "MIT",
|