@skillstech/thunderlang 1.1.0 → 1.2.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/CHANGELOG.md +81 -0
- package/README.md +4 -1
- package/dist/core.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/learn.cjs +7510 -503
- package/package.json +2 -2
- package/src/cli-home.mjs +242 -0
- package/src/cli.mjs +107 -38
- package/src/core/cli.mjs +65 -14
- package/src/core/diagnostics.mjs +1 -0
- package/src/core/engine-core.mjs +572 -0
- package/src/core/engine-values.mjs +1054 -0
- package/src/core/engine-worker.mjs +15 -0
- package/src/core/engine.mjs +63 -0
- package/src/core/index.mjs +1 -0
- package/src/core/project.mjs +16 -6
- package/src/core/runtime-typescript.mjs +119 -0
- package/src/core/target-python.mjs +2 -1
- package/src/core/target-typescript.mjs +466 -0
- package/src/core/typescript-run.mjs +114 -0
- package/src/emit.mjs +1 -1
- package/src/learn-lessons.mjs +245 -1
- package/src/learn.d.mts +8 -0
- package/src/learn.mjs +40 -4
- package/src/read-level.mjs +146 -0
- package/src/term.mjs +89 -0
- package/src/try-cli.mjs +225 -0
- package/src/why-cli.mjs +17 -7
- package/src/why.d.mts +17 -7
- package/src/why.mjs +114 -33
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,84 @@
|
|
|
1
|
+
# 1.2.0
|
|
2
|
+
|
|
3
|
+
**Upgrade note.** Every existing command, flag, and exit code is unchanged, with one JSON change: in `thunder why
|
|
4
|
+
--json`, a step's `effect` is now one of six kinds (`money`, `delete`, `send`, `create`, `change`, `read`; or
|
|
5
|
+
`unknown` / `none`) instead of `change`, and `changes[]` items gain `kind`. `thunder` with no command now prints a
|
|
6
|
+
short home screen; the full list is `thunder help --all`. Color is used only when the output is a terminal.
|
|
7
|
+
|
|
8
|
+
- **`thunder init` is friendlier, and mission rules can be tried without JSON.** `thunder init` now says what it made
|
|
9
|
+
(a starter mission: a product's rules and the examples that prove them), lists what to try next, and points
|
|
10
|
+
beginners to `thunder new hello`. Its template's comments name the right file (they said `Mission.intent`) and
|
|
11
|
+
suggest `thunder try`. `thunder try Mission.thunder` works on mission decisions: it asks for each value (or takes
|
|
12
|
+
`--with "age=20"`), says the kind each value should be (worked out from the rules), and explains the answer in words
|
|
13
|
+
("age is at least 18 (age is 20)").
|
|
14
|
+
- **Trademark marks.** Thunder™ and ThunderLang™ now carry ™ where the brand is shown prominently: the CLI's home
|
|
15
|
+
screen, `thunder --version`, `thunder help --all`, `thunder doctor`, the npm and VS Code descriptions (and the
|
|
16
|
+
extension's display name), the compiler README, and the site's logo and footer.
|
|
17
|
+
- **Color in the terminal, and an easier full command list.** Screens people read (the home screen, `help`,
|
|
18
|
+
`doctor`, `new`, `why`, `try`, `read --level`, and the "did you mean" and "no project here" messages) use calm color:
|
|
19
|
+
green ✓, red ✗ only for real problems, yellow ! for warnings, commands to type in cyan, bold labels and headings.
|
|
20
|
+
Color is off for files, pipes, scripts, editors reading the output, `NO_COLOR`, and all JSON; `FORCE_COLOR=1` keeps
|
|
21
|
+
it. The words are identical with or without color (a test checks it). `thunder help --all` now starts with what most
|
|
22
|
+
people need (Start, Write and run programs, Read and understand code, Change code) and puts missions, proofs, and
|
|
23
|
+
editor tools under "Advanced"; every command is still listed. The home screen adds `thunder try`.
|
|
24
|
+
- **Thunder Core compiles to TypeScript.** `thunder build --target typescript` (or `target = "typescript"` in
|
|
25
|
+
thunder.toml) writes one readable `.ts` file per Thunder file into `generated/typescript/`, with `// thunder:N` line
|
|
26
|
+
marks, the runtime, its types, and a `tsconfig.json`; `thunder run --target typescript` and `thunder test --target
|
|
27
|
+
typescript` run it on Node (Node 22.6+ strips the types itself; on an older Node, Thunder uses the `typescript`
|
|
28
|
+
package when it can find it, and otherwise says what is needed). One meaning: the runtime is the Thunder engine's own
|
|
29
|
+
value code (engine-values.mjs, byte for byte), and every Core test program now runs three ways (Python, the Thunder
|
|
30
|
+
engine, and compiled TypeScript), with the same output, errors, and exit status required: 136 programs on Node 18,
|
|
31
|
+
22, and 24. `tsc --strict` accepts the code generated for all of them. A program that uses a Python module (`Use`) is
|
|
32
|
+
refused for TypeScript before anything is written (new code TC405). The site lists Core → TypeScript as Available;
|
|
33
|
+
Java, C#, Go, and Rust stay Planned. CI now runs the compiler tests on Node 22, and the site job checks every
|
|
34
|
+
generated file with tsc.
|
|
35
|
+
- **The tutorial teaches writing and running Thunder.** `@skillstech/thunderlang/learn` gains part 2, "write and run":
|
|
36
|
+
seven lessons (`part: 'write'`), each naming the concept it teaches: your first program in two commands
|
|
37
|
+
(`thunder new hello`, `thunder run hello`, and why a bare `thunder run` right after fails), conditions, loops and
|
|
38
|
+
lists (positions from 1), records with a Never rule, reading Python as Thunder (and what is marked not translated),
|
|
39
|
+
check vs test vs verify, and `thunder why` with its limits. Every answer is worked out by running the lesson's
|
|
40
|
+
program on the Thunder engine. New optional lesson fields: `concept`, `commands` (what to type), and `output` (what
|
|
41
|
+
the program prints). Same schema (`thunder-learn-v1`); the 12 reading lessons are unchanged. The engine's language
|
|
42
|
+
core is now `engine-core.mjs` with no Node APIs, so the tutorial still runs in a browser.
|
|
43
|
+
- **Fix (Core → Python): a whole number written with leading zeros (`007`) compiled to Python that would not run**
|
|
44
|
+
(Python refuses `007`). It now compiles to `7`, as Thunder means it.
|
|
45
|
+
- When Python is missing, `thunder run` and `thunder test` now also say how to run without it: `--engine thunder`.
|
|
46
|
+
- **The Thunder engine: run Thunder Core without Python.** `thunder run --engine thunder` and
|
|
47
|
+
`thunder test --engine thunder` run a program on the Thunder engine, a second engine that runs the same checked
|
|
48
|
+
program the Python compiler uses. Python is not needed, and is still the default. Both engines must agree: every
|
|
49
|
+
Core test program now runs on both (output, errors with code, words, line and "reached from", and exit status),
|
|
50
|
+
and any difference fails the tests. A program that uses a Python module (`Use csv as csv`) is refused on the
|
|
51
|
+
Thunder engine before it runs; Thunder never imitates a library. Also available as `runWithEngine` /
|
|
52
|
+
`testWithEngine` in `src/core/engine.mjs`.
|
|
53
|
+
- **`thunder try`: what if?** Try a rule from your code with your own values: `thunder try register.ts --with
|
|
54
|
+
"age=15, parent approved=no"` prints the answer and why, check by check (✓/✗ with the value it saw). Without
|
|
55
|
+
`--with`, it asks for each value, explains a mistyped one, and offers another case. Only rules can be tried (they
|
|
56
|
+
change nothing); an action is refused with the command to read it, and a rule too complex for the engine is refused
|
|
57
|
+
with the reason. `--focus` picks a rule; `--json` gives data. Same engine as the web rule editor.
|
|
58
|
+
- **`thunder read --level`: read at one depth, in the terminal.** The five levels OpenThunder shows: `big-picture`
|
|
59
|
+
(the Things, what they know and can do), `flow` (one action or rule as a tree of questions, branches, error
|
|
60
|
+
handlers, and "always"), `details` (every way it ends, what it changes and when, and what the code cannot tell),
|
|
61
|
+
`text` (Thunder Text), and `original` (the exact lines, numbered). `--focus "<name>"` picks an action, rule, or
|
|
62
|
+
Thing; without it, `flow` and `details` list the choices as commands. Each level suggests the next. Steps Thunder
|
|
63
|
+
could not explain stay marked. `--json` prints the model level itself, the same data OpenThunder reads. Works on a
|
|
64
|
+
file or a folder. `thunder read` without `--level` is unchanged.
|
|
65
|
+
- **`thunder why` is short now, and says what the agent did to the world.** The first screen is a few lines: what
|
|
66
|
+
happened, why it stopped, what it did, and what to do next; `--steps` gives every step. Each step that does something
|
|
67
|
+
gets one kind, most serious first: moves money, deletes, sends, creates, changes, reads. The kind comes from the
|
|
68
|
+
strongest evidence: what the tool declares (its MCP annotations with `--tools tools.json`, or `thunder.effect` on the
|
|
69
|
+
span), then the request method or database operation, and only then the tool's name, where every word counts and the
|
|
70
|
+
most serious wins (`get_and_delete` now deletes; it was read as `get`). Guesses are labeled. `--allow read,send`
|
|
71
|
+
names anything beyond those kinds and exits 1. JSON: new `effects` (and `allowed`/`notAllowed`); `changes` items now
|
|
72
|
+
carry `kind`, and a step's `effect` is one of the six kinds (it was `change`).
|
|
73
|
+
- **A friendlier first minute in the terminal.** `thunder` on its own now shows a short home screen (five things
|
|
74
|
+
to do, with examples) instead of 120 lines; `thunder help --all` is the full list, and `thunder help <command>`
|
|
75
|
+
shows one command. A mistyped command says "Did you mean thunder read?" instead of failing later (it used to crash
|
|
76
|
+
reading a file). `thunder new hello` says exactly how to run it (`thunder run hello`), and `--run` runs it too.
|
|
77
|
+
`thunder run` (or test, build, check) outside a project says where the nearby projects are and the exact command.
|
|
78
|
+
New: `thunder doctor` checks Thunder, Node.js, Python 3.10+, PATH, Node versions (nvm) missing Thunder, and
|
|
79
|
+
optional toolchains, offline, with the fix for each problem; `thunder completion zsh|bash|fish` completes commands
|
|
80
|
+
on Tab. Every existing command, flag, exit code, and JSON output is unchanged.
|
|
81
|
+
|
|
1
82
|
# 1.1.0
|
|
2
83
|
|
|
3
84
|
- **Thunder Why: what an AI agent did, in plain words.** `thunder why run.json` reads an agent run's OpenTelemetry
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @skillstech/thunderlang
|
|
2
2
|
|
|
3
|
-
Deterministic ThunderLang compiler and CLI. **No AI required.** Turns a `.intent` file into
|
|
3
|
+
Deterministic ThunderLang™ compiler and CLI for Thunder™, the human programming language. **No AI required.** Turns a `.intent` file into
|
|
4
4
|
the canonical **Intent Graph** plus diagnostics, docs, a test plan, and a proof artifact,
|
|
5
5
|
and, for decisions, lifecycles, and outcomes, **executes the intent directly** (no code
|
|
6
6
|
generated). Every output is pure and deterministic: the same source always yields the same
|
|
@@ -10,6 +10,9 @@ Part of [ThunderLang](https://thunderlang.dev), the intent language for AI-era s
|
|
|
10
10
|
|
|
11
11
|
**Learn ThunderLang:** the [10-minute tutorial](https://thunderlang.dev/learn), then the
|
|
12
12
|
[full course on Skills Tech Talk](https://app.skillstechtalk.com/learn/technology/t/thunderlang).
|
|
13
|
+
The tutorial also ships in this package as data (`@skillstech/thunderlang/learn`): 12 lessons on reading code, and
|
|
14
|
+
7 on writing and running Thunder programs, each naming the programming concept it teaches. Every quiz answer is
|
|
15
|
+
worked out by the compiler, and for the writing lessons by running the program.
|
|
13
16
|
|
|
14
17
|
## Install
|
|
15
18
|
|
package/dist/core.cjs
CHANGED
|
@@ -18733,7 +18733,7 @@ function notesSummary(ast) {
|
|
|
18733
18733
|
byLens
|
|
18734
18734
|
};
|
|
18735
18735
|
}
|
|
18736
|
-
var COMPILER_VERSION = "1.
|
|
18736
|
+
var COMPILER_VERSION = "1.2.0";
|
|
18737
18737
|
var PROOF_SCHEMA_VERSION = "0.1.0";
|
|
18738
18738
|
var SOURCE_PRODUCT = "skillstech-compiler";
|
|
18739
18739
|
function buildContractGraph(ast, generatedAt) {
|
package/dist/index.cjs
CHANGED
|
@@ -2577,7 +2577,7 @@ function notesSummary(ast) {
|
|
|
2577
2577
|
byLens
|
|
2578
2578
|
};
|
|
2579
2579
|
}
|
|
2580
|
-
var COMPILER_VERSION = "1.
|
|
2580
|
+
var COMPILER_VERSION = "1.2.0";
|
|
2581
2581
|
var PROOF_SCHEMA_VERSION = "0.1.0";
|
|
2582
2582
|
var SOURCE_PRODUCT = "skillstech-compiler";
|
|
2583
2583
|
function buildContractGraph(ast, generatedAt) {
|