@skillstech/thunderlang 0.5.2 → 0.5.4

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,39 @@
1
+ # 0.5.4
2
+
3
+ Read code in Thunder, change a rule safely, and review AI changes against stricter evidence. Pre-1.0: the stricter
4
+ evidence rules intentionally change some earlier permissive results (see **Behavior changes**). 0.5.3 was not
5
+ published to npm; its additions (below) ship for the first time in this release.
6
+
7
+ **Behavior changes**
8
+ - **Strict named evidence.** CLI, MCP, and embedding products share `resolveObligations`. References must match a complete, case-sensitive target (`verify Target` or `verify test Target`). Previously fuzzy references such as `verify Target test` stay declared (unverified) until rewritten. All references must resolve and pass; one passing subset cannot verify a claim.
9
+ - **Fail closed on invalid tests.** Evaluation errors cannot pass through a matching fallback. Cases need assertions, empty test blocks fail, and lifecycle paths must be valid unless explicitly asserted invalid. Files with no test blocks still report zero cases; zero cases do not establish verified behavior.
10
+ - **Generated code is typed.** `thunder gen` decision parameters now carry types (see Fixes), and Java is written to `<Class>.java` instead of a lowercase file name.
11
+
12
+ **Read code in Thunder**
13
+ - **Thunder steps (`thunder-steps-v1`).** Every function that is not a decision reads as a short list of steps: checks, branches, loops, assignments, and calls (payments, HTTP, database, events, email). Statements Thunder cannot explain are kept as their original code, never guessed. On eleven public repositories (all ten languages), 94% of 12,011 functions are at least 80% readable as steps. `STEPS_SCHEMA` and `classifyStatement` are exported from `/core`.
14
+ - **More decisions read.** One-expression boolean functions read as decisions in all ten languages; the statement splitter keeps object literals, destructuring, struct literals, and JSX whole; Python lines with a trailing `#` comment are read (the comment is kept).
15
+ - **Lossless anchoring (`thunder-anchor-v1`).** Every step points at its exact place in the file (character offsets; whole lines for PHP), with per-function anchor coverage. `editStep` replaces one step's code and verifies the result by reading it again, keeping a Python or Ruby line's trailing comment. `thunder anchor <file>` shows it. Exported from `/core`: `spanRange`, `spanText`, `replaceSpan`, `editStep`, `anchorReport`.
16
+ - **Thunder Text (`thunder-plain-v1`, experimental).** A readable written form of a Thunder rule: `thunder text <file>` (alias `thunder plain`) runs its examples. Exported from `/core`: `parsePlainContract`, `renderPlainContract`, `plainToThunder`, `compilePlainContract`, `previewPlainContract`, `explainPlain`.
17
+ - **`thunder repo <owner/repo | GitHub URL | folder>`.** Reads a whole repository in Thunder (shallow clone for GitHub; read-only, nothing is executed) and prints a brief: languages, decisions, functions read as steps, and what was not read.
18
+ - **Code reader exports (from 0.5.3).** `readCode`, `readRepo`, `searchRepo`, `groupByFile`, `readableLanguage`, and `promoteDecision` from the main entry and `/core`, plus `collectReadableFiles` from the main entry.
19
+ - **Typed round trips.** Thunder source carries input types, so code read into Thunder and generated back keeps `bool` and number types.
20
+
21
+ **Change a rule (Thunder write, experimental)**
22
+ - `thunder write <file> --decision <name> --rule <n|otherwise> --when "<condition>" | --answer <Outcome> [--write]` changes a number, comparison, text value, or answer in a recovered decision and writes only those characters back, keeping the file's own spelling (`===`, `100.0`, `100m`, quote style). It reads the file again and refuses, leaving it untouched, unless the edited rule reads as intended and everything else reads as before. It lists the boundary inputs whose answer changes. Previews by default; `--write` saves. Rule shape changes and new enum names are refused.
23
+ - Exported from the package and `/core`: `writeRule`, `changedCases`, `ruleParts`, `joinRuleParts`, `COMPARISON_CHOICES`.
24
+
25
+ **Review AI changes**
26
+ - **Review Atlas.** `thunder atlas --review` executes contract cases, preserves invalid files, ranks evidence gaps, and exports `intent-review-atlas-v1`. `--agent-brief` produces bounded review context; `--strict` exits 2 for incomplete evidence and 1 for evaluated failures. `--openthunder <report.json>` compares source hashes and compiler versions without promoting imported claims. The browser-safe `buildReviewAtlas`, `renderReviewBrief`, and `reviewAtlasExitCode` and the `intent_atlas` MCP tool share this policy. Original graph navigation is unchanged.
27
+ - **Browser-safe evidence API.** `/core` exports `runTests`, `TEST_SCHEMA`, and `resolveObligations` with public types. Passing results cover the declared cases, not arbitrary inputs or repository implementation.
28
+
29
+ **Fixes**
30
+ - **`thunder gen` TypeScript, Java, and C# compile.** Decision parameters were untyped (`unknown`, `Object`, `dynamic`), so comparisons such as `amount >= 0` did not compile, and typed Thunder inputs (`amount: number`) produced broken signatures. Each input now gets one type: its declared type, else the decision's example values, else how the rules use it. Python gains type hints. The TypeScript mission stub is named `run` when a decision shares the mission's name (it was a duplicate function), a C# decision named like its class becomes `Decide` (CS0542), and C# numbers are `double`, matching the live C# target. Verified with tsc (strict), javac, and dotnet, and against the Thunder runtime.
31
+ - **Python rules with trailing comments.** `if amount <= 100: # limit` was read as "does more than choose an answer"; it now reads as a rule.
32
+
33
+ # 0.5.3
34
+
35
+ - Export the code reader from the package: `readCode`, `readRepo`, `searchRepo`, `groupByFile`, `readableLanguage`, and `promoteDecision` (turn a recovered decision into a contract with edge-case examples) from both the main entry and the browser-safe `/core` entry, plus `collectReadableFiles` (read a folder on disk) from the main entry. Tools such as OpenThunder can now import them directly instead of going through the MCP tool interface. Additive; no behavior changes.
36
+
1
37
  # 0.5.2
2
38
 
3
39
  - Add named example inputs with one `->` arrow, optional primitive input annotations, and multiline cases in human-v1. Existing tables and canonical source remain supported.