@skillstech/thunderlang 0.5.4 → 0.5.6

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 CHANGED
@@ -1,3 +1,115 @@
1
+ # 0.5.6
2
+
3
+ Entries that change what Thunder means or how it reads (the language itself) start with **Language:**. Courses and
4
+ tools built on `@skillstech/thunderlang/learn` should re-check their lessons when one appears.
5
+
6
+ **The Thunder tutorial ships with the compiler.**
7
+ - **`@skillstech/thunderlang/learn`** (`learnThunder()`, ESM and CommonJS, browser-safe):
8
+ `{ schema: 'thunder-learn-v1', languageVersion, lessons }`. Each lesson has its idea, a picture to hold in mind, its
9
+ code, the Thunder Text the compiler gives for it, quick-check questions (`{ prompt, choices, answer, explain }`),
10
+ and open questions (`reflect`). **Every answer is worked out by the compiler from the lesson's code**; if it ever
11
+ differs from what the lesson expects, building the lessons throws, so a release cannot carry a lesson that
12
+ disagrees with its language. thunderlang.dev/learn and the Skills Tech Talk course are built from this export.
13
+ - Twelve lessons: the last one became two, **Read a whole app in OpenThunder** (zoom App, File, Action, Rule on a
14
+ small two-door app; what the From code, Author's note, AI summary, and Not read yet labels mean) and **Study your
15
+ own app** (browser, terminal, OpenThunder, and checking a rewrite with `thunder same`).
16
+
17
+ # 0.5.5
18
+
19
+ **Complete behavior: every branch, at every depth, in every language.**
20
+ - **Fix (serious):** `else`, `elif`/`else if`/`elsif`, `except`/`catch`/`rescue`, and `finally`/`ensure` were
21
+ dropped from steps while the reading still claimed 100% anchored (OpenThunder found it on a real app; the language
22
+ audit found 0% of these branches shown in eleven open-source repositories). They are now read at every depth and
23
+ attached to their `if`/`try`: `otherwise`, `handlers` ("If DatabaseError goes wrong"), `always` ("Always, at the
24
+ end"). Steps are no longer folded below one level. Thunder Text, the model's flow (`blocks` tree plus graph),
25
+ and `modelText` all show them.
26
+ - **`scripts/language-audit.mjs`** reads one open-source repository per language and reports branches shown, steps
27
+ explained, and fully explained functions; results in `docs/language-audit.md` (branches shown: 0% → 52–95%).
28
+ - Wording fixes found by reading real code: Go `if err := f(); err != nil` ("If f fails"), counted loops, switch
29
+ cases, casts, typed declarations, `foreach`, one-line ifs, Ruby modifiers, predicates, bare-word calls and
30
+ method-level `rescue`, PHP attributes, `isset`/`empty`/`count`, ternaries, comparisons as words, plain names as
31
+ set / not set, declarations without a value, functions stored under a name, pairs in loops.
32
+
33
+ **Semantic Zoom: one model, read from the big picture down to one decision.**
34
+ - **`thunder-model-v1`** (`thunderModel(files)`, `/core`): the one meaning every Thunder view is drawn from.
35
+ Things (classes: what they know and how they start, what they can do), Data (records and choices, from
36
+ dataclasses, pydantic, TypeScript interfaces, enums), members (actions, rules, steps, setup) with their **flow as
37
+ a graph** (start, questions with Yes/No sides, steps, loops, stops, answers), links between members ("Can borrow?"
38
+ opens the rule it uses), source lines, and every unknown. Python and TypeScript classes today; other languages
39
+ list their classes as unknowns and still read every function.
40
+ - Questions are asked the positive way round for a kid: `if book.status != Status.ON_SHELF: raise` becomes "Is the
41
+ book's status on shelf?" with the Stop on **No**. A call to a rule is asked by the rule's own name ("Can
42
+ borrow?"). Rules are drawn as questions in order, each Yes giving its answer in words ("No fee"), otherwise the
43
+ fallback.
44
+ - **`modelText(model, id)`**: Thunder Text projected from the same model nodes as the picture, so the two views
45
+ cannot disagree.
46
+ - **Thunder symbols as data** (`THUNDER_VISUAL.symbols`, `does`, `beginner`): one shape per kind of thing (Thing,
47
+ Data, Record, Choices, Action, Rule, Steps, Starts with, Stop, Not read yet, App, Area, File) as SVG path data, and
48
+ what each step does in a kid's words (find, keep only, check, ask, work out, save, tell someone, ask another
49
+ part, for each, give back, stop). Six are beginner concepts.
50
+ - Wording: enum values read as words (`Status.ON_SHELF` is "on shelf"); `book.status = …` is "Sets the book's
51
+ status"; `self.max_books = max_books` is "Keeps the max books it is given"; `student.books.append(book)` is "Adds
52
+ book to student's books".
53
+ - Site: `/zoom`, Semantic Zoom (preview): How deep (Big picture, Flow, Details) and Show as (Thunder, Thunder Text,
54
+ Original), breadcrumbs, the symbols, Try the rule (runs the rule as read), and line links to the original.
55
+ **A whole app in Thunder Text, and proof that a conversion kept its meaning.**
56
+ - **`thunder thunderize <folder | owner/repo> [--out dir]`**: every readable file becomes `<file>.thunder-text`
57
+ beside a mirror of its path, plus `APP.thunder-text`, which reads the app top-down (areas, files, actions,
58
+ rules). Files Thunder cannot read are listed, never dropped. `/core`: `thunderizeFiles`, `thunderizeFile`.
59
+ - **`thunder same <old> <new>`**: does new code mean the same as old code, in any languages Thunder reads?
60
+ Functions pair by file stem and name in any convention (`delivery_fee` ↔ `deliveryFee`), falling back to a
61
+ unique name when a file was renamed. Rules are compared by running both on every edge case either one
62
+ mentions, so reordered conditions count as the same and a changed limit is caught with a counterexample in
63
+ plain words ("the total 20, the distance km 0: Free before, Standard after"). Steps are compared in order.
64
+ Code Thunder cannot read is never counted as the same: the verdict is then `partly-checked`. Exit 0 only when
65
+ the meaning is the same. `/core`: `sameMeaning`, `compareRules`, `renderSame`. Docs: `docs/converting-code.md`.
66
+
67
+ **Thunder V1: the Thunder Programming Language.** Thunder is a human-native programming language: people work
68
+ with the meaning of software while machines handle most of the implementation. Specified in `docs/spec.md`,
69
+ which replaces the mission specification draft v0.2 (kept as `docs/spec-v0.2.md`).
70
+
71
+ - **`thunder-visual-v1`**, the visual grammar as data, exported from `/core` and the root: `THUNDER_VISUAL`
72
+ (zoom levels shared with the Thunder Atlas, color roles with green/red reserved for checks that ran, step marks,
73
+ elements with honest status, provenance, the eleven languages with SQL marked planned, and the rules every view
74
+ follows), `visualFor(item)` (how to draw any reader item), `visualForStep(step)`, and `thunderText(item)` (the
75
+ same item as Thunder Text). The picture and the text are rendered from the same reading, so they cannot disagree.
76
+ A decision's docstring becomes its Thunder Text `Why:` line.
77
+ - Yes/no properties read as sentences: `if order.refunded` is "If order is refunded"; `!user.isAdmin` is "user is
78
+ not admin". Other property paths are left as they are.
79
+ - A test keeps `docs/spec.md` naming every element, step, and language in the grammar.
80
+ - **Learn Thunder** (thunderlang.dev/learn), the Thunder V1 tutorial: seven lessons on reading software in Thunder,
81
+ built on one pizza-delivery app and produced by this compiler at build time. `test/learn-thunder.test.mjs` proves
82
+ each lesson shows what it teaches, including identical Thunder for one rule in Python, TypeScript, Java, and Go.
83
+ - Wording: a collection used as a condition reads "order has items" / "order has no items"; `total += item.price`
84
+ reads "Adds item price to total"; a parenthesized calculation is a computed value, not "an object".
85
+
86
+ Read a whole app, not just its decisions: every Python endpoint is found, the author's docstring is kept as the
87
+ function's meaning, and steps that only restate code are no longer counted as read.
88
+
89
+ **Behavior changes**
90
+ - **Stricter `stepsReadable`.** A step that only puts the code's syntax into English ("Works out actives", "Returns
91
+ the result of any", "Calls set") is marked `restates: true` and does not count as read. Scores drop where steps
92
+ only restated code. The eleven-repository benchmark is now 78% of 12,087 functions at least 80% readable (was
93
+ 94% under the old rule); see `docs/thunder-repo-results.md`.
94
+
95
+ **Read code in Thunder**
96
+ - **Python headers that span lines.** Functions whose parameters run over several lines (FastAPI `Depends(...)`
97
+ one per line, wrapped return types) were skipped; they are read now, with their decorators. Multi-line route
98
+ decorators (`@router.get(\n "/x",\n response_model=...)`) give the route. On a 111-file FastAPI backend: 516 of
99
+ 516 functions read (was 254), 234 endpoints recognized (was 19). psf/requests: 708 functions (was 632).
100
+ - **The author's words: `doc`.** Each function or decision carries `doc`, the first paragraph of its docstring or
101
+ doc comment (Python docstrings, JSDoc `/** */`, `///`, Go `//`, Ruby `#`), without Args/Returns sections. It is
102
+ the author's statement, kept apart from the reading inferred from code. `thunder read` shows it as "The author
103
+ says".
104
+ - **Steps that explain.** Python comprehensions and `any`/`all`/`sum`/`min`/`max`/`len` read as what they produce
105
+ ("the items in rules where active", "whether any item in actives matches"); common shapes read as what they are
106
+ in every language: a new object (`&Command{`, `Server::new(`), a value by key (`headers.get("content-type")`),
107
+ text built from parts, a copy, a conversion, JSON in or out, a boolean result ("Returns whether …"), several
108
+ returned values, `seen[k] = …` ("Records k in seen"), `.set("Key", v)`, `.append(x)`.
109
+ - Types: `ReadItem.doc`, `ReadItem.steps`, `ReadStep` (with `restates`) in `read.d.mts`.
110
+
111
+ Not yet: identifiers in other languages (French names, for example) are still turned into English-looking words.
112
+
1
113
  # 0.5.4
2
114
 
3
115
  Read code in Thunder, change a rule safely, and review AI changes against stricter evidence. Pre-1.0: the stricter
package/README.md CHANGED
@@ -8,6 +8,9 @@ result, so intent can be diffed, merged, tested, and trusted.
8
8
 
9
9
  Part of [ThunderLang](https://thunderlang.dev), the intent language for AI-era software.
10
10
 
11
+ **Learn ThunderLang:** the [10-minute tutorial](https://thunderlang.dev/learn), then the
12
+ [full course on Skills Tech Talk](https://app.skillstechtalk.com/learn/technology/t/thunderlang).
13
+
11
14
  ## Install
12
15
 
13
16
  ```bash