plainscript-lang 1.0.1 → 1.0.2-latest
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 +194 -729
- package/compiler/bundler.js +2 -2
- package/compiler/cli.js +69 -73
- package/compiler/dependency-detector.js +5 -0
- package/compiler/formatter.js +1 -1
- package/compiler/generator.js +931 -89
- package/compiler/lexer.js +129 -53
- package/compiler/parser.js +995 -152
- package/compiler/version.js +1 -1
- package/docs/CAPABILITY_GAP_AUDIT.md +98 -435
- package/docs/PLAINSCRIPT-SPEC.md +335 -0
- package/docs/index.html +101 -608
- package/docs/website/script.js +59 -943
- package/docs/website/style.css +74 -656
- package/examples/ai-providers.pln +7 -0
- package/examples/arrays.pln +4 -0
- package/examples/async-errors.pln +18 -0
- package/examples/auth-api.pln +9 -0
- package/examples/auth-sessions.pln +32 -0
- package/examples/basics.pln +14 -0
- package/examples/bots.pln +13 -0
- package/examples/cache-and-jobs.pln +7 -0
- package/examples/cache-schedule.pln +22 -0
- package/examples/collections.pln +15 -0
- package/examples/concurrency.pln +18 -0
- package/examples/conditions.pln +22 -0
- package/examples/database.pln +8 -0
- package/examples/day2.pln +7 -0
- package/examples/day3.pln +5 -0
- package/examples/deployment.pln +6 -0
- package/examples/email-send.pln +3 -0
- package/examples/error-handling.pln +7 -0
- package/examples/expressions.pln +7 -0
- package/examples/file-uploads.pln +10 -0
- package/examples/files-and-config.pln +6 -0
- package/examples/files.pln +12 -0
- package/examples/football-backend/{app.ps → app.pln} +22 -21
- package/examples/functions.pln +17 -0
- package/examples/hello.pln +2 -0
- package/examples/http-client.pln +3 -0
- package/examples/http.pln +11 -0
- package/examples/id-verification/{app.ps → app.pln} +5 -4
- package/examples/id-verification/make-sample-id.js +29 -42
- package/examples/json.pln +11 -0
- package/examples/loops.pln +18 -0
- package/examples/modules/app.pln +3 -0
- package/examples/modules/main.pln +4 -0
- package/examples/modules/math.pln +9 -0
- package/examples/mongo.pln +33 -0
- package/examples/objects.pln +4 -0
- package/examples/ocr.pln +22 -0
- package/examples/packages.pln +6 -0
- package/examples/record-kinds.pln +7 -0
- package/examples/records.pln +15 -0
- package/examples/rest-api-fetch.pln +10 -0
- package/examples/rest-api.pln +8 -0
- package/examples/scheduled-tasks.pln +4 -0
- package/examples/search-and-filter.pln +4 -0
- package/examples/server.pln +6 -0
- package/examples/sessions-and-cookies.pln +8 -0
- package/examples/sqlite.pln +23 -0
- package/examples/start.pln +2 -0
- package/examples/stdlib.pln +4 -0
- package/examples/telegram-ai-bot.pln +19 -0
- package/examples/telegram-bot.pln +6 -0
- package/examples/testing.pln +13 -0
- package/examples/web-api.pln +27 -0
- package/examples/web-app.pln +8 -0
- package/examples/websocket-server.pln +6 -0
- package/examples/websocket.pln +13 -0
- package/examples/whatsapp-bot/{pairing.ps → pairing.pln} +4 -5
- package/examples/whatsapp-bot/qr.pln +12 -0
- package/package.json +3 -2
- package/docs/PLINJS_SPEC.md +0 -1151
- package/examples/arrays.ps +0 -13
- package/examples/auth-api.ps +0 -56
- package/examples/cache-and-jobs.ps +0 -29
- package/examples/concurrency.ps +0 -49
- package/examples/database.ps +0 -41
- package/examples/day2.ps +0 -7
- package/examples/day3.ps +0 -11
- package/examples/deployment.ps +0 -12
- package/examples/email-send.ps +0 -22
- package/examples/error-handling.ps +0 -54
- package/examples/expressions.ps +0 -40
- package/examples/file-uploads.ps +0 -39
- package/examples/files-and-config.ps +0 -47
- package/examples/hello.ps +0 -3
- package/examples/http-client.ps +0 -44
- package/examples/loops.ps +0 -17
- package/examples/modules/app.ps +0 -16
- package/examples/modules/math.ps +0 -20
- package/examples/objects.ps +0 -12
- package/examples/record-kinds.ps +0 -43
- package/examples/rest-api-fetch.ps +0 -94
- package/examples/rest-api.ps +0 -68
- package/examples/scheduled-tasks.ps +0 -23
- package/examples/search-and-filter.ps +0 -34
- package/examples/server.ps +0 -25
- package/examples/sessions-and-cookies.ps +0 -54
- package/examples/start.ps +0 -2
- package/examples/stdlib.ps +0 -41
- package/examples/telegram-bot.ps +0 -42
- package/examples/web-app.ps +0 -20
- package/examples/websocket-server.ps +0 -27
- package/examples/whatsapp-bot/qr.ps +0 -8
package/compiler/version.js
CHANGED
|
@@ -1,439 +1,102 @@
|
|
|
1
|
-
# PlainScript 1.0.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
|
50
|
-
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
| Worker threads / parallel jobs | **IOPL-native `run in parallel ... done [as results]`** (existing, RFC-0011 ¶9) and `run background <call>` (existing). |
|
|
94
|
-
| Cancellation / AbortController | **Runtime `withTimeout(promise, ms)`** raises on timeout (this release). |
|
|
95
|
-
|
|
96
|
-
**Audit status:** `all/any/settled of`, `withTimeout` ship on top of the existing
|
|
97
|
-
`wait for`/`run in parallel`. **Gap closed.**
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## 4. Classes / object systems
|
|
102
|
-
|
|
103
|
-
The single biggest capability TypeScript users expect from a language. PlainScript
|
|
104
|
-
delivers it IOPL-native as **record kinds** — a compile-time-checked schema plus a
|
|
105
|
-
prose constructor — rather than `class`/`new`/`extends` syntax.
|
|
106
|
-
|
|
1
|
+
# PlainScript 1.0.2-latest capability audit
|
|
2
|
+
|
|
3
|
+
This audit is intentionally grounded in the implementation, not in old
|
|
4
|
+
examples. The parser and generator are the authority. A capability is listed
|
|
5
|
+
here only when a source program can be validated by `plainscript check`.
|
|
6
|
+
|
|
7
|
+
## Core language
|
|
8
|
+
|
|
9
|
+
| Capability | Status | Current source form |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| Variables and assignment | Implemented | `remember x as 1`, `x becomes 2` |
|
|
12
|
+
| Strings and templates | Implemented | `"text"`, `` `Hello ${name}` `` |
|
|
13
|
+
| Numbers and BigInt | Implemented | `3.14`, `42n` |
|
|
14
|
+
| Arrays and objects | Implemented | `[1, 2]`, `{name: "Ada"}` |
|
|
15
|
+
| Records and record kinds | Implemented | `define a kind called "User" with ... done` |
|
|
16
|
+
| Conditions | Implemented | `if ... otherwise ... done` |
|
|
17
|
+
| Functions | Implemented | `make add(a, b) ... done` |
|
|
18
|
+
| Generators | Implemented | `yield value` |
|
|
19
|
+
| For and while loops | Implemented | `for each ... done`, `while ... done` |
|
|
20
|
+
| Match and switch | Implemented | `match value against ... done` |
|
|
21
|
+
| Loop control | Implemented | `break`, `continue` |
|
|
22
|
+
| Classes and `new` | Implemented | JavaScript-compatible class forms |
|
|
23
|
+
|
|
24
|
+
## Modules and runtime
|
|
25
|
+
|
|
26
|
+
| Capability | Status | Notes |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| Relative PlainScript imports | Implemented | Imported files are bundled |
|
|
29
|
+
| Named imports and exports | Implemented | `import { name } from "./file.pln"` |
|
|
30
|
+
| npm packages | Implemented | `use package-name` and CLI dependency detection |
|
|
31
|
+
| JSON | Implemented | `jsonEncode`, `jsonDecode`, JSON response blocks |
|
|
32
|
+
| Files and paths | Implemented | Read/write, bytes, folders, path helpers |
|
|
33
|
+
| Crypto and auth helpers | Implemented | Hashes, passwords, tokens |
|
|
34
|
+
| Async/await | Implemented | `wait for`, `await`, async propagation |
|
|
35
|
+
| Concurrency | Implemented | `allOf`, `anyOf`, `settledOf`, `withTimeout` |
|
|
36
|
+
| Errors and retries | Implemented | `try`, `recover`, `finally`, `retry` |
|
|
37
|
+
| Native tests | Implemented | `test` and `check` assertions |
|
|
38
|
+
|
|
39
|
+
## Web and services
|
|
40
|
+
|
|
41
|
+
| Capability | Status | Current source form |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| Express web app | Implemented | `web app` |
|
|
44
|
+
| HTTP routes | Implemented | `route get "/path" ... done` |
|
|
45
|
+
| JSON responses | Implemented | `reply json ... done` |
|
|
46
|
+
| CORS and fallback | Implemented | `allow cors`, `when nothing matches` |
|
|
47
|
+
| Request accessors | Implemented | `body`, `param`, `query`, `header`, uploads |
|
|
48
|
+
| Cookies and sessions | Implemented | `set cookie`, `enable sessions` |
|
|
49
|
+
| API keys and rate limits | Implemented | `require api key`, `limit requests` |
|
|
50
|
+
| File uploads | Implemented | `accept uploads` |
|
|
51
|
+
| HTTP client | Implemented | `get`, `post`, `put`, `patch`, `delete` |
|
|
52
|
+
| SQLite | Implemented | native and WebAssembly drivers |
|
|
53
|
+
| PostgreSQL generation | Implemented | `postgres connection` |
|
|
54
|
+
| SQL parameter binding | Implemented | `{variable}` placeholders |
|
|
55
|
+
| Email | Implemented | `mail transport`, `send mail` |
|
|
56
|
+
| Schedules and jobs | Implemented | `every`, `schedule`, `run background` |
|
|
57
|
+
| WebSockets | Implemented | `websocket server` |
|
|
58
|
+
| Redis/in-memory cache | Implemented | `cache`, `cacheGet`, `cacheSet` |
|
|
59
|
+
| Telegram bots | Implemented | `bot`, message/callback handlers |
|
|
60
|
+
| AI providers | Implemented | `chat`, `chatWith`, `embedText`, provider presets |
|
|
61
|
+
| WhatsApp bots | Implemented | `whatsapp bot` |
|
|
62
|
+
| OCR | Implemented | `ocr path of file as text` |
|
|
63
|
+
|
|
64
|
+
## Canonical examples
|
|
65
|
+
|
|
66
|
+
The maintained examples are the executable capability matrix:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
examples/basics.pln
|
|
70
|
+
examples/conditions.pln
|
|
71
|
+
examples/loops.pln
|
|
72
|
+
examples/functions.pln
|
|
73
|
+
examples/records.pln
|
|
74
|
+
examples/collections.pln
|
|
75
|
+
examples/json.pln
|
|
76
|
+
examples/files.pln
|
|
77
|
+
examples/packages.pln
|
|
78
|
+
examples/http.pln
|
|
79
|
+
examples/sqlite.pln
|
|
80
|
+
examples/web-api.pln
|
|
81
|
+
examples/auth-sessions.pln
|
|
82
|
+
examples/async-errors.pln
|
|
83
|
+
examples/concurrency.pln
|
|
84
|
+
examples/websocket.pln
|
|
85
|
+
examples/cache-schedule.pln
|
|
86
|
+
examples/bots.pln
|
|
87
|
+
examples/ocr.pln
|
|
88
|
+
examples/testing.pln
|
|
89
|
+
examples/modules/
|
|
90
|
+
examples/football-backend/
|
|
91
|
+
examples/id-verification/
|
|
92
|
+
examples/whatsapp-bot/
|
|
107
93
|
```
|
|
108
|
-
define a kind called "Person" with
|
|
109
|
-
name is ""
|
|
110
|
-
age is 0
|
|
111
|
-
done
|
|
112
|
-
|
|
113
|
-
remember ada as create a Person with name "Ada" and age 17
|
|
114
|
-
show name of ada // "Ada"
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
- Fields declared with defaults; constructors **prompt for missing required
|
|
118
|
-
fields** at compile time; unknown constructor fields are a compile error.
|
|
119
|
-
- Kind objects are plain JS objects, so `jsonEncode`, `sendMail`, DB rows,
|
|
120
|
-
and every existing stdlib works on them unchanged.
|
|
121
|
-
- Attach behaviour with ordinary `make` functions that take the record
|
|
122
|
-
(`make describe(person) give name of person + " is " + age of person`).
|
|
123
|
-
- **Inheritance** is deliberately *composition-first*: `kind` + stdlib
|
|
124
|
-
`merge(a, b)` (existing) covers the 80%. Deep prototype chains are a
|
|
125
|
-
TypeScript *syntax*, not a capability we need to replicate.
|
|
126
|
-
|
|
127
|
-
| TypeScript | PlainScript resolution |
|
|
128
|
-
|-------------------------|------------------------|
|
|
129
|
-
| `class`, constructor | **IOPL-native `kind` + `create a X with ...`** (this release). |
|
|
130
|
-
| Fields / properties | `kind` fields; access via `name of x` / `x.name`. |
|
|
131
|
-
| Methods | Top-level `make` functions taking the record. |
|
|
132
|
-
| `this` | **Rationale: unnecessary** — functions receive the record explicitly (no context bugs). |
|
|
133
|
-
| `static` members | Module-level`remember`/`make` are naturally static. |
|
|
134
|
-
| Extension / mixins | `merge(a, b)` (existing) + nested kinds. |
|
|
135
|
-
| Access modifiers | **Rationale: unnecessary** — single-process bundles; `_field` is convention. |
|
|
136
|
-
|
|
137
|
-
**Audit status:** Record kinds ship with tested constructors, field validation,
|
|
138
|
-
and JSON/serialization compat. **Gap closed.**
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
## 5. Iterators / generators
|
|
143
|
-
|
|
144
|
-
| TypeScript | PlainScript resolution |
|
|
145
|
-
|------------------|------------------------|
|
|
146
|
-
| `for...of` | `for each item in x ... done` (existing) — works on arrays, strings, Maps, Sets, generators. |
|
|
147
|
-
| Generator `function*` / `yield` | **IOPL-native `yield`** inside `make ... done` (this release) — a `make` containing `yield` compiles to a `function*`. |
|
|
148
|
-
| `[Symbol.iterator]` | Accessible via JS Gateway / `kind` producer (this release: `make` with `yield`). |
|
|
149
|
-
| Iterator helpers (`map`/`filter`/`reduce`) | **IOPL-native** `gather each ... giving`, `filter each ... when`, `total each ... giving` (existing, functional map/filter/reduce). |
|
|
150
|
-
| Spread `/ rest` | **IOPL-native `spread of x`** unfolds an iterable into a new array (this release). |
|
|
151
|
-
| Lazy sequences | Generators via `yield` + `for each` (this release). |
|
|
152
|
-
|
|
153
|
-
**Audit status:** Generators, spread, and functional iteration ship. **Gap closed.**
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## 6. Collections
|
|
158
|
-
|
|
159
|
-
| TypeScript | PlainScript resolution |
|
|
160
|
-
|--------------|------------------------|
|
|
161
|
-
| Array | Literals `[...]`, `first/last/N-th from`, `length(x)`, `add/remove`, `gather/filter/total` (all existing). |
|
|
162
|
-
| Map | **Runtime stdlib** `keyMap()`/`mapSet/mapGet/mapDelete/mapHas` wrapping JS `Map` (this release). |
|
|
163
|
-
| Set | **Runtime stdlib** `set()`/`unique(x)` (unique exists) — `addToSet/removeFromSet` (this release). |
|
|
164
|
-
| Object | `merge`, `keys`, `values`, `hasKey`, `of` chains (existing) + `fieldsOf` (this release). |
|
|
165
|
-
| Tuple | **`kind` with positional fields** (§4). |
|
|
166
|
-
|
|
167
|
-
**Audit status:** Map/Set/`spread of` stdlib ship. **Gap closed.**
|
|
168
|
-
|
|
169
|
-
---
|
|
170
|
-
|
|
171
|
-
## 7. Decorators / metaprogramming
|
|
172
|
-
|
|
173
|
-
| TypeScript | PlainScript resolution |
|
|
174
|
-
|-----------------|------------------------|
|
|
175
|
-
| Decorators | **Rationale: unnecessary as syntax.** What decorators achieve — wrapping functions, logging, timing, auth — is done IOPL-natively with `when ... happens` pub/sub (existing), `run background`, and the JS Gateway. A bespoke `@` grammar adds complexity without new capability. |
|
|
176
|
-
| Method/class metadata | **Rationale: mostly unnecessary.** Since methods are top-level functions (no `this`), there is nothing to decorate. |
|
|
177
|
-
| `Proxy` / `Reflect` | **JS Gateway** exposes raw `Proxy`/`Reflect` when genuinely needed (existing). |
|
|
178
|
-
|
|
179
|
-
**Audit status:** Rationale documented; no decorator syntax. **No gap for 80%.**
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
## 8. Symbols / well-known keys
|
|
184
|
-
|
|
185
|
-
- **Rationale: unnecessary as a user-facing feature.** `Symbol` keys matter for
|
|
186
|
-
iterator identity and library protocol, both of which are *inside* the compiler
|
|
187
|
-
(generator `yield` uses `Symbol.iterator` transparently). Exposing `Symbol` as
|
|
188
|
-
an IOPL statement would leak implementation detail without capability gain.
|
|
189
|
-
- When a library genuinely requires a user-provided symbol, the **JS Gateway**
|
|
190
|
-
provides it.
|
|
191
|
-
|
|
192
|
-
**Audit status:** Rationale documented. **No gap.**
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
## 9. Proxies / reflection / duck typing
|
|
197
|
-
|
|
198
|
-
| TypeScript | PlainScript resolution |
|
|
199
|
-
|--------------|------------------------|
|
|
200
|
-
| `Reflect.*` | **Runtime reflection stdlib**: `typeOf(x)`, `fieldsOf(x)`, `hasField(rec, key)`, `valueOf(rec,key)`, `sizeOf(x)` (this release). |
|
|
201
|
-
| `Object.keys`| `keys(x)` (existing) / `fieldsOf(x)` (this release). |
|
|
202
|
-
| Duck typing | Provided naturally: functions receive records and read `name of x` regardless of construction site. |
|
|
203
|
-
|
|
204
|
-
**Audit status:** Runtime reflection ships. **Gap closed.**
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## 10. Binary data
|
|
209
|
-
|
|
210
|
-
| TypeScript / Node | PlainScript resolution |
|
|
211
|
-
|-------------------|------------------------|
|
|
212
|
-
| `Buffer` | **Runtime stdlib** `textToBytes(s)`, `bytesToText(b)` (this release); `readBytes`/`writeBytes` exist. |
|
|
213
|
-
| `base64` | **Runtime stdlib** `base64Encode(x)`, `base64Decode(s)` (this release). |
|
|
214
|
-
| `ArrayBuffer`/typed arrays | Accessible through `readBytes()` returning a `Buffer` and the JS Gateway. |
|
|
215
|
-
| CRC / hash | `hashPassword` (existing) + `sha256(text)` (this release). |
|
|
216
|
-
|
|
217
|
-
**Audit status:** Binary + encoding stdlib ships. **Gap closed.**
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
|
-
## 11. Workers / processes
|
|
222
|
-
|
|
223
|
-
| TypeScript / Node | PlainScript resolution |
|
|
224
|
-
|-------------------|------------------------|
|
|
225
|
-
| Worker threads | **IOPL-native `run in parallel ... done`** (existing) and `run background <call>` (existing). |
|
|
226
|
-
| Child processes | **Runtime stdlib `runCommand(cmd, args)`** (async, captures stdout/stderr/exit) (this release). |
|
|
227
|
-
| `process.exit` | `exit(code)` (existing); `env()` (existing). |
|
|
228
|
-
| Signals / IPC | **Rationale: unnecessary for 80%** — batch/parallel covers CPU-bound; cross-process messaging is niche. JS Gateway for the rest. |
|
|
229
|
-
|
|
230
|
-
**Audit status:** Process execution ships; workers via existing parallel model.
|
|
231
|
-
**Gap closed.**
|
|
232
|
-
|
|
233
|
-
---
|
|
234
|
-
|
|
235
|
-
## 12. Filesystem
|
|
236
|
-
|
|
237
|
-
| Node fs | PlainScript resolution |
|
|
238
|
-
|--------------------|------------------------|
|
|
239
|
-
| Read/write text | `read`/`readFile`, `write`/`writeFile`, `appendFile` (all existing). |
|
|
240
|
-
| Binary | `readBytes`/`writeBytes` (existing). |
|
|
241
|
-
| Metadata | `fileExists`, `fileSize(path)`, `fileType(path)`, `lastModified(path)` (this release). |
|
|
242
|
-
| Directory ops | `makeFolder`, `deleteFolder`, `listFolder` (existing), `walkFolder(dir)` recursive (this release). |
|
|
243
|
-
| Copy/move/delete | `copyFile`, `moveFile`, `deleteFile` (existing). |
|
|
244
|
-
| Path helpers | `joinPath`, `baseName`, `folderOf(path)`, `extensionOf(path)` (this release). |
|
|
245
|
-
|
|
246
|
-
**Audit status:** Filesystem suite extended to metadata/walk/path. **Gap closed.**
|
|
247
|
-
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
## 13. Streams
|
|
251
|
-
|
|
252
|
-
| Node stream | PlainScript resolution |
|
|
253
|
-
|--------------------|------------------------|
|
|
254
|
-
| Read line-by-line | **IOPL-native `stream "file" as line ... done`** (existing). |
|
|
255
|
-
| Write append | `writeLine(file, text)` / `appendLine(file, text)` (this release). |
|
|
256
|
-
| Transform / pipe | **Rationale: necessary via JS Gateway only** — stream pipelines are an implementation detail; `write`/`read`/`stream` cover I/O. |
|
|
257
|
-
|
|
258
|
-
**Audit status:** Stream I/O rounded out. **Gap mostly closed.**
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
## 14. Networking
|
|
263
|
-
|
|
264
|
-
| Node net/http | PlainScript resolution |
|
|
265
|
-
|--------------------------|------------------------|
|
|
266
|
-
| HTTP server | `web app` + `route` + `start` (existing) and Express form (existing). |
|
|
267
|
-
| HTTP client | `get/post/put/patch/delete "<url>"` + `wait for fetch` (existing). |
|
|
268
|
-
| WebSocket server/client | `websocket server on ...` (existing, server side). |
|
|
269
|
-
| TCP server / client | **IOPL-native — omitted with rationale:** Node `net` is low-level; the 80% uses HTTP/WebSocket. Provided by JS Gateway on demand. |
|
|
270
|
-
| TLS / DNS / UDP | **Rationale: omitted** (niche; JS Gateway / `use`). |
|
|
271
|
-
|
|
272
|
-
**Audit status:** HTTP/WS cover the target; TCP documented as rationale.
|
|
273
|
-
**Gap closed for 80%.**
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## 15. Serialization / configuration
|
|
278
|
-
|
|
279
|
-
| TypeScript / Node | PlainScript resolution |
|
|
280
|
-
|-------------------|------------------------|
|
|
281
|
-
| JSON | `jsonEncode`/`jsonDecode` (existing). |
|
|
282
|
-
| YAML | **Runtime stdlib `yamlDecode(s)`/`yamlEncode(v)`** (this release). |
|
|
283
|
-
| `.env` files | **IOPL-native `load env file "....env"`** statement + `envFile("path")` fallback (this release). |
|
|
284
|
-
| Config files | `loadEnvFile`; plus `plainscript.config.json` build config (existing). |
|
|
285
|
-
| `.toml` | **Rationale: niche** — YAML+JSON+env covers configuration; JS Gateway for TOML. |
|
|
286
|
-
| Binary serialization (msgpack/buffer) | `textToBytes`/`bytesToText`/`base64` (this release). |
|
|
287
|
-
|
|
288
|
-
**Audit status:** YAML + env-file configuration ship. **Gap closed.**
|
|
289
|
-
|
|
290
|
-
---
|
|
291
|
-
|
|
292
|
-
## 16. CLI tooling
|
|
293
|
-
|
|
294
|
-
| TypeScript / Node | PlainScript resolution |
|
|
295
|
-
|-------------------|------------------------|
|
|
296
|
-
| `process.argv` | **Runtime stdlib `args()`** returns the command-line argument array (this release). |
|
|
297
|
-
| argparse prompts | `ask "..." as x` (existing). |
|
|
298
|
-
| Subprocess CLI | `runCommand` (this release, §11). |
|
|
299
|
-
|
|
300
|
-
**Audit status:** `args()` ships. **Gap closed.**
|
|
301
|
-
|
|
302
|
-
---
|
|
303
|
-
|
|
304
|
-
## 17. Testing
|
|
305
|
-
|
|
306
|
-
| TypeScript / Node | PlainScript resolution |
|
|
307
|
-
|-------------------|------------------------|
|
|
308
|
-
| Test runner | **IOPL-native `test "name" ... done` blocks** with `check a equals b`, `check a is true`, `check raises` (this release). |
|
|
309
|
-
| Assertions | `check a equals b` / `check a contains b` / `check a raises <msg>` (this release). |
|
|
310
|
-
| Suite grouping | `test` blocks run in order; `check` failures print and exit `1` (this release). |
|
|
311
|
-
|
|
312
|
-
**Audit status:** A native test DSL ships — no external runner needed. **Gap closed.**
|
|
313
|
-
|
|
314
|
-
---
|
|
315
|
-
|
|
316
|
-
## 18. JavaScript Gateway (escape hatch)
|
|
317
|
-
|
|
318
|
-
The **JavaScript Gateway** (`javascript ... done`, RFC-0011 §10) is the universal
|
|
319
|
-
fallback that closes *every* remaining micro-gap — any of TypeScript's capabilities
|
|
320
|
-
that is expressible in JS is reachable here without leaving PlainScript. This
|
|
321
|
-
single feature is why the audit can be honest about the many "rationale: omitted"
|
|
322
|
-
rows without reducing capability parity.
|
|
323
|
-
|
|
324
|
-
**Audit status:** Preexisting; retained.
|
|
325
|
-
|
|
326
|
-
---
|
|
327
|
-
|
|
328
|
-
## 19. Package / library authoring
|
|
329
|
-
|
|
330
|
-
| Capability | PlainScript resolution |
|
|
331
|
-
|-----------------------|------------------------|
|
|
332
|
-
| Publish npm library | `plainscript build` → `dist/`; `main`/`prepare` in package.json (existing). |
|
|
333
|
-
| Named exports | **IOPL-native `export <name>`** marks a top-level symbol for export; imported bindings re-exportable (this release). |
|
|
334
|
-
| Consumer API | `module.exports` of top-level `make` (existing) + explicit `export` (this release). |
|
|
335
|
-
| `exports` map / ESM | Standard `package.json` semantics (project model, existing). |
|
|
336
|
-
|
|
337
|
-
**Audit status:** export statement ships. **Gap closed.**
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
|
-
## 20. Summary scoring
|
|
342
|
-
|
|
343
|
-
| Area | Status |
|
|
344
|
-
|----------------------------|--------|
|
|
345
|
-
| Advanced typing/generics | ✅ runtime kinds + reflection; type grammar rationalised |
|
|
346
|
-
| Modules/imports/exports | ✅ named imports + loadModule + export |
|
|
347
|
-
| Async & concurrency | ✅ all/any/settled of, withTimeout |
|
|
348
|
-
| Classes/objects | ✅ record kinds |
|
|
349
|
-
| Iterators/generators | ✅ yield + spread of |
|
|
350
|
-
| Collections | ✅ Map/Set stdlib |
|
|
351
|
-
| Decorators/metadata | ⚪ documented (unnecessary) |
|
|
352
|
-
| Symbols | ⚪ documented (unnecessary) |
|
|
353
|
-
| Proxies/reflection | ✅ runtime reflection stdlib |
|
|
354
|
-
| Binary data | ✅ base64/bytes/sha256 |
|
|
355
|
-
| Workers/processes | ✅ runCommand + parallel |
|
|
356
|
-
| Filesystem | ✅ metadata/walk/path |
|
|
357
|
-
| Streams | ✅ writeLine/appendLine |
|
|
358
|
-
| Networking | ✅ HTTP/WS; TCP rationalised |
|
|
359
|
-
| Serialization/config | ✅ YAML + env-file |
|
|
360
|
-
| CLI tooling | ✅ args() + runCommand |
|
|
361
|
-
| Testing | ✅ test/check DSL |
|
|
362
|
-
| Package/library authoring | ✅ export + build model |
|
|
363
|
-
| JavaScript Gateway | ✅ universal fallback |
|
|
364
|
-
|
|
365
|
-
**Legend:** ✅ shipped + tested · ⚪ intentionally omitted with rationale.
|
|
366
|
-
|
|
367
|
-
---
|
|
368
|
-
|
|
369
|
-
## 21. 1.0.1 readiness gate
|
|
370
|
-
|
|
371
|
-
The audit is **complete** only when:
|
|
372
|
-
|
|
373
|
-
1. Every row above has a **shipped implementation with tests** or an **explicit
|
|
374
|
-
rationale** (both present in this document).
|
|
375
|
-
2. `npm test` is green with the new capability tests included.
|
|
376
|
-
3. The runtime stdlib table, knowledge base, and README document every new
|
|
377
|
-
capability.
|
|
378
|
-
|
|
379
|
-
Until then the package version remains **below 1.0.1**.
|
|
380
|
-
|
|
381
|
-
---
|
|
382
|
-
|
|
383
|
-
## 22. v2.2.0 — AI/ML, data/storage & web additions
|
|
384
|
-
|
|
385
|
-
The v2.0–v2.2 releases close further gaps beyond the 1.0.1 audit across the
|
|
386
|
-
AI/ML, data/storage and web/full-stack surface. All features below are
|
|
387
|
-
IOPL-native (intent-oriented) rather than TypeScript-syntax clones.
|
|
388
|
-
|
|
389
|
-
### AI / ML (module `ai`)
|
|
390
|
-
|
|
391
|
-
| Capability | IOPL stdlib |
|
|
392
|
-
| -------------------------------------------- | --------------------------------------------------------------------------- |
|
|
393
|
-
| LLM chat completion | `chat(model, messages, {options})` → text, async, OpenAI-compatible API |
|
|
394
|
-
| Text embeddings | `embedText(model, text, {options})` → vector, async |
|
|
395
|
-
| Vector similarity (cosine) | `similarity(a, b)` → -1..1 (identical → 1, orthogonal → 0, opposite → -1) |
|
|
396
|
-
| Auto-tagging convenience | `ai_tags(text)` → topic/category tags |
|
|
397
|
-
| Post / content generation | `ai_post(subject, ideas, options)` → generated prose |
|
|
398
|
-
| Auth | `OPENAI_API_KEY` env (override via `options.apiKey`/`options.baseURL`) |
|
|
399
|
-
|
|
400
|
-
**Audit status:** chat, embeddings, similarity ship with runtime tests; tag/post
|
|
401
|
-
compose the same runtime. **Gap closed.**
|
|
402
|
-
|
|
403
|
-
### Data / storage
|
|
404
|
-
|
|
405
|
-
| Capability | IOPL stdlib |
|
|
406
|
-
| -------------------- | --------------------------------------------------------------------------- |
|
|
407
|
-
| SQLite persistence | `http`+`db` runtime, `sql` queries, `table`/`row`/`query` DSL (existing) |
|
|
408
|
-
| In-memory cache fallback | `cacheGet/cacheSet/cacheDelete` use a Map-based store with TTL when no Redis is configured |
|
|
409
|
-
| Server-managed cache | Redis-backed cache when configured (existing) |
|
|
410
|
-
| Redis cache | existing TTL semantics, now with graceful no-config fallback |
|
|
411
|
-
| Pagination | `paginate(list, page, perPage)` → `{items, count, page, pages, perPage, hasNext, hasPrev}` |
|
|
412
|
-
|
|
413
|
-
**Audit status:** paginate + in-memory cache fallback ship and are tested.
|
|
414
|
-
**Gap closed.**
|
|
415
|
-
|
|
416
|
-
### Web / full-stack
|
|
417
|
-
|
|
418
|
-
| Capability | IOPL stdlib |
|
|
419
|
-
| ------------- | ------------------------------------------------------------------ |
|
|
420
|
-
| Request body | route-scoped `body(...)` accessor: `body()` → raw, `body("field")` → field |
|
|
421
|
-
| Redirect | `redirect to "<url>"` statement inside a route handler (`res.redirect`) |
|
|
422
|
-
| (existing) | routes, status, sessions, uploads, cookies, WebSocket, OAuth, email, schedules |
|
|
423
|
-
|
|
424
|
-
**Audit status:** `body` + `redirect to` ship, route-guarded with teaching
|
|
425
|
-
errors, compile-verified. **Gap closed.**
|
|
426
|
-
|
|
427
|
-
### Core collections & string primitives (module `coll`)
|
|
428
94
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
runtime-tested. `contains` is a reserved lexer keyword, so the membership helper
|
|
432
|
-
is named `includes`.
|
|
95
|
+
Run `find examples -name '*.pln' -exec node compiler/cli.js check {} \;`
|
|
96
|
+
before changing the language reference.
|
|
433
97
|
|
|
434
|
-
|
|
98
|
+
## Version boundary
|
|
435
99
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
> collections, AI (with a live key), and cache fallback run with real tests.
|
|
100
|
+
The repository release label is `1.0.2-latest`. This label identifies the
|
|
101
|
+
compiler, package metadata, website, and editor tooling. It does not change
|
|
102
|
+
third-party dependency versions.
|