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