lawspec 0.25.0 → 0.26.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 +43 -1
- package/README.md +5 -4
- package/api.mjs +0 -8
- package/bin/lawspec.mjs +14 -52
- package/build.json +77 -105
- package/core.wasm +2 -2
- package/core_jsffi.js +5 -0
- package/examples/native-payments/clojure/lawspec.json +1 -1
- package/examples/native-payments/csharp/lawspec.json +1 -1
- package/examples/native-payments/elixir/lawspec.json +1 -1
- package/examples/native-payments/erlang/lawspec.json +1 -1
- package/examples/native-payments/fsharp/lawspec.json +1 -1
- package/examples/native-payments/gleam/lawspec.json +1 -1
- package/examples/native-payments/go/lawspec.json +1 -1
- package/examples/native-payments/groovy/lawspec.json +1 -1
- package/examples/native-payments/haskell/lawspec.json +1 -1
- package/examples/native-payments/java/lawspec.json +1 -1
- package/examples/native-payments/javascript/lawspec.json +1 -1
- package/examples/native-payments/kotlin/lawspec.json +1 -1
- package/examples/native-payments/python/lawspec.json +1 -1
- package/examples/native-payments/rust/lawspec.json +1 -1
- package/examples/native-payments/scala/lawspec.json +1 -1
- package/examples/native-payments/swift/lawspec.json +1 -1
- package/examples/native-payments/typescript/lawspec.json +1 -1
- package/examples/packages/orders/lawspec.json +1 -1
- package/examples/packages/orders/orders.lawspec +27 -25
- package/examples/packages/shop-domain/src/domain.lawspec +15 -14
- package/examples/packages/shop-tax-1/src/api.lawspec +1 -0
- package/examples/packages/shop-tax-1/src/rates.lawspec +1 -0
- package/examples/packages/shop-tax-2/src/api.lawspec +1 -0
- package/examples/packages/shop-tax-2/src/rates.lawspec +1 -0
- package/examples/rc1/authorization-snapshots.lawspec +24 -23
- package/examples/rc1/banner-filenames.lawspec +7 -6
- package/examples/rc1/bit-codec.lawspec +12 -11
- package/examples/rc1/bounded-witness-search.lawspec +52 -45
- package/examples/rc1/conflicting-requirements.lawspec +8 -7
- package/examples/rc1/constructive-witnesses.lawspec +40 -33
- package/examples/rc1/documentary-review.lawspec +9 -8
- package/examples/rc1/empty-domains.lawspec +16 -15
- package/examples/rc1/finite-integer-domains.lawspec +24 -23
- package/examples/rc1/law-metadata.lawspec +6 -5
- package/examples/rc1/native-payments.lawspec +17 -16
- package/examples/rc1/nesting/rrr.lawspec +4 -3
- package/examples/rc1/nesting/rru.lawspec +7 -6
- package/examples/rc1/nesting/rur.lawspec +7 -6
- package/examples/rc1/nesting/ruu.lawspec +10 -9
- package/examples/rc1/nesting/urr.lawspec +7 -6
- package/examples/rc1/nesting/uru.lawspec +10 -9
- package/examples/rc1/nesting/uur.lawspec +10 -9
- package/examples/rc1/nesting/uuu.lawspec +13 -12
- package/examples/rc1/order-workflow.lawspec +18 -17
- package/examples/rc1/parcel-measurements.lawspec +14 -13
- package/examples/rc1/picture-records.lawspec +6 -5
- package/examples/rc1/picture-tuples.lawspec +6 -5
- package/examples/rc1/record-payloads.lawspec +12 -11
- package/examples/rc1/recursive-records.lawspec +11 -10
- package/examples/rc1/refund-conformance.lawspec +7 -6
- package/examples/rc1/refund-policy.lawspec +15 -14
- package/examples/rc1/requirement-composition.lawspec +26 -25
- package/examples/rc1/structural-records.lawspec +13 -12
- package/examples/rc1-authoring.lawspec +6 -5
- package/examples/specs/abilities.lawspec +67 -65
- package/examples/specs/ability_imports.lawspec +58 -57
- package/examples/specs/actors.lawspec +23 -22
- package/examples/specs/algebra.lawspec +142 -141
- package/examples/specs/approvals.lawspec +16 -15
- package/examples/specs/async_bindings.lawspec +10 -9
- package/examples/specs/async_fetch.lawspec +12 -11
- package/examples/specs/atoi_codec.lawspec +16 -15
- package/examples/specs/boolean_flags.lawspec +10 -9
- package/examples/specs/builtins.lawspec +73 -72
- package/examples/specs/canonical_url.lawspec +14 -13
- package/examples/specs/collections.lawspec +153 -154
- package/examples/specs/composition.lawspec +70 -66
- package/examples/specs/concurrent_collections.lawspec +8 -7
- package/examples/specs/consistency.lawspec +4 -3
- package/examples/specs/contracts.lawspec +80 -79
- package/examples/specs/crypto.lawspec +26 -25
- package/examples/specs/ctc.lawspec +148 -0
- package/examples/specs/currying.lawspec +32 -31
- package/examples/specs/data_types.lawspec +50 -49
- package/examples/specs/distribution.lawspec +57 -56
- package/examples/specs/domain_modeling.lawspec +48 -47
- package/examples/specs/durations.lawspec +39 -38
- package/examples/specs/equivalent.lawspec +25 -24
- package/examples/specs/failures.lawspec +64 -63
- package/examples/specs/finite_data.lawspec +32 -31
- package/examples/specs/flow_stack.lawspec +64 -63
- package/examples/specs/gadt_expressions.lawspec +50 -49
- package/examples/specs/generation.lawspec +115 -114
- package/examples/specs/handler_bindings.lawspec +42 -40
- package/examples/specs/handles.lawspec +2 -1
- package/examples/specs/harness.lawspec +45 -43
- package/examples/specs/harness_testing.lawspec +18 -13
- package/examples/specs/indexed_arithmetic.lawspec +401 -126
- package/examples/specs/indexed_families.lawspec +182 -66
- package/examples/specs/keywords.lawspec +22 -21
- package/examples/specs/limits.lawspec +6 -5
- package/examples/specs/list_contracts.lawspec +121 -120
- package/examples/specs/list_refinements.lawspec +43 -42
- package/examples/specs/lists.lawspec +45 -44
- package/examples/specs/matchers.lawspec +79 -78
- package/examples/specs/matching.lawspec +43 -42
- package/examples/specs/mixed_inputs.lawspec +25 -24
- package/examples/specs/models.lawspec +44 -43
- package/examples/specs/parse_port.lawspec +28 -27
- package/examples/specs/payments.lawspec +55 -54
- package/examples/specs/railway.lawspec +59 -58
- package/examples/specs/records.lawspec +149 -148
- package/examples/specs/records_inner.lawspec +5 -4
- package/examples/specs/recursive_refinements.lawspec +30 -29
- package/examples/specs/refined_definitions.lawspec +24 -23
- package/examples/specs/refinements.lawspec +58 -57
- package/examples/specs/resilience.lawspec +159 -158
- package/examples/specs/resources.lawspec +61 -60
- package/examples/specs/scalar_adapters.lawspec +60 -59
- package/examples/specs/scalar_catalog.lawspec +165 -164
- package/examples/specs/scalars.lawspec +78 -77
- package/examples/specs/scheduling_order.lawspec +8 -7
- package/examples/specs/scheduling_overlap.lawspec +5 -4
- package/examples/specs/sequences.lawspec +66 -65
- package/examples/specs/sessions.lawspec +13 -12
- package/examples/specs/slug.lawspec +16 -15
- package/examples/specs/sum_refinements.lawspec +42 -41
- package/examples/specs/tables.lawspec +29 -28
- package/examples/specs/total_functions.lawspec +71 -70
- package/examples/specs/workflows.lawspec +101 -100
- package/examples-command.mjs +4 -6
- package/explain.mjs +6 -4
- package/expression-presentation.mjs +8 -8
- package/files.mjs +1 -1
- package/index.d.ts +4 -527
- package/launcher.mjs +9 -2
- package/lsp.mjs +10 -6
- package/native-examples.mjs +2 -2
- package/package.json +1 -1
- package/starter-rc1.lawspec +6 -5
- package/starter.lawspec +16 -15
- package/templates.mjs +4 -2
- package/migrate.mjs +0 -135
- package/migration-bindings.mjs +0 -86
- package/migration-cases.mjs +0 -45
- package/migration-collections.mjs +0 -54
- package/migration-correspondence.mjs +0 -275
- package/migration-generation.mjs +0 -99
- package/migration-laws.mjs +0 -102
- package/migration-records.mjs +0 -166
- package/migration-source.mjs +0 -247
- package/migration-write.mjs +0 -156
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,47 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.26.0] - 2026-10-19
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Mandatory named endings for every block, including units, ability law groups,
|
|
14
|
+
harness law groups, let expressions and generator binds. Handler clauses use
|
|
15
|
+
explicit `operation` openers and `end operation` closers.
|
|
16
|
+
- Grammar profile `1.0-rc.2`, shared by compiler and authoring consumers.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Formatter source spans survive wrapping and indentation changes, preserving
|
|
21
|
+
line-scoped generator expressions and phrase names on repeated formatting.
|
|
22
|
+
- Source formatting indents continued applications and expectations, aligns
|
|
23
|
+
record fields and closers, and keeps long phrase declarations together.
|
|
24
|
+
- Both Chapter 6 entry points use the current grammar with readable nested
|
|
25
|
+
cases, conditionals, records and expectation tables.
|
|
26
|
+
- Harness strategies expand parameterized refinements and retain dependent
|
|
27
|
+
predicates during generation and shrinking.
|
|
28
|
+
- Generated Kotlin registrations fit JVM method limits, and Haskell test
|
|
29
|
+
components avoid excessive optimization of large generated test expressions.
|
|
30
|
+
- Large JVM suites share assertion bodies and Scala registration traits retain
|
|
31
|
+
every case without exceeding class-size limits. Haskell boundary helpers
|
|
32
|
+
retain fresh symbol contexts, checked inputs and per-case handler execution.
|
|
33
|
+
- Explicit BEAM harness strategies supply observations alongside finite checks;
|
|
34
|
+
coverage uses actual strategy trials, and known failures cannot bypass their
|
|
35
|
+
strategy validation or coverage checks.
|
|
36
|
+
- Closed record handler initializers preserve distinct local bindings.
|
|
37
|
+
- Indexed generation traverses intervening structural records while preserving
|
|
38
|
+
constructor guards and dependent restrictions.
|
|
39
|
+
- WASM transfers generated JSON directly as UTF-8 and reclaims transport
|
|
40
|
+
buffers between serialized calls; the host queue releases completed responses.
|
|
41
|
+
- Large Groovy and Clojure exports release Java conversion inputs earlier.
|
|
42
|
+
Shared WASM startup uses GHC's in-place compaction within wasm32's address
|
|
43
|
+
limit, preserving the complete generated projects and test domains.
|
|
44
|
+
|
|
45
|
+
### Removed
|
|
46
|
+
|
|
47
|
+
- Pre-1.0 migration tooling, APIs and compatibility grammars. Active source and
|
|
48
|
+
consumers are updated directly until the API is stable.
|
|
49
|
+
|
|
9
50
|
## [0.25.0] - 2026-10-18
|
|
10
51
|
|
|
11
52
|
### Added
|
|
@@ -1699,7 +1740,8 @@ A maintenance release. The language, generated code and API are unchanged from
|
|
|
1699
1740
|
machine-sized bindings reject an architecture mismatch. Rust adapters take
|
|
1700
1741
|
owned values.
|
|
1701
1742
|
|
|
1702
|
-
[Unreleased]: https://github.com/brain-fuel/lawspec/compare/v0.
|
|
1743
|
+
[Unreleased]: https://github.com/brain-fuel/lawspec/compare/v0.26.0...HEAD
|
|
1744
|
+
[0.26.0]: https://github.com/brain-fuel/lawspec/compare/v0.25.0...v0.26.0
|
|
1703
1745
|
[0.25.0]: https://github.com/brain-fuel/lawspec/compare/v0.24.0...v0.25.0
|
|
1704
1746
|
[0.24.0]: https://github.com/brain-fuel/lawspec/compare/v0.23.0...v0.24.0
|
|
1705
1747
|
[0.23.0]: https://github.com/brain-fuel/lawspec/compare/v0.22.0...v0.23.0
|
package/README.md
CHANGED
|
@@ -78,16 +78,17 @@ atoi :: Text -> Int32
|
|
|
78
78
|
law "|round trip| is
|
|
79
79
|
definition :
|
|
80
80
|
apply law "|left inverse| atoi itoa
|
|
81
|
-
end
|
|
81
|
+
end definition
|
|
82
82
|
description :
|
|
83
83
|
"applying {itoa} and then {atoi} recovers the original integer"
|
|
84
|
-
end
|
|
84
|
+
end description
|
|
85
85
|
example "|negative integers use a minus sign and round-trip unchanged| :
|
|
86
86
|
x = -42
|
|
87
87
|
expect itoa x = "-42"
|
|
88
88
|
expect atoi (itoa x) = -42
|
|
89
|
-
end
|
|
90
|
-
end
|
|
89
|
+
end example
|
|
90
|
+
end law
|
|
91
|
+
end unit
|
|
91
92
|
```
|
|
92
93
|
|
|
93
94
|
`lawspec explain` shows the final property:
|
package/api.mjs
CHANGED
|
@@ -11,13 +11,5 @@ export async function createCompiler() {
|
|
|
11
11
|
call({schemaVersion: 5, ...input, method: 'proofTasks'}),
|
|
12
12
|
planGeneration: (input) =>
|
|
13
13
|
call({schemaVersion: 5, ...input, method: 'planGeneration'}),
|
|
14
|
-
migrationBaseline: (input) =>
|
|
15
|
-
call({schemaVersion: 5, ...input, method: 'migrationBaseline'}),
|
|
16
|
-
migrationComparison: (input) =>
|
|
17
|
-
call({schemaVersion: 5, ...input, method: 'migrationComparison'}),
|
|
18
|
-
migrationBindings: (input) =>
|
|
19
|
-
call({schemaVersion: 5, ...input, method: 'migrationBindings'}),
|
|
20
|
-
migrationGeneration: (input) =>
|
|
21
|
-
call({schemaVersion: 5, ...input, method: 'migrationGeneration'}),
|
|
22
14
|
};
|
|
23
15
|
}
|
package/bin/lawspec.mjs
CHANGED
|
@@ -6,8 +6,6 @@ import path from "node:path";
|
|
|
6
6
|
import { createCompiler } from "../api.mjs";
|
|
7
7
|
import { targets, templates, commands, setup } from "../templates.mjs";
|
|
8
8
|
import { generateExamples } from "../examples-command.mjs";
|
|
9
|
-
import { migrationReport } from "../migrate.mjs";
|
|
10
|
-
import { writeMigration } from "../migration-write.mjs";
|
|
11
9
|
import { proveWithZ3 } from "../proof.mjs";
|
|
12
10
|
import { serveLanguage } from "../lsp.mjs";
|
|
13
11
|
import { explainLaw, explanationViews } from "../explain.mjs";
|
|
@@ -28,14 +26,14 @@ import {
|
|
|
28
26
|
safePath,
|
|
29
27
|
collectSources,
|
|
30
28
|
} from "../files.mjs";
|
|
31
|
-
const VERSION = "0.
|
|
29
|
+
const VERSION = "0.26.0";
|
|
32
30
|
const args = process.argv.slice(2);
|
|
33
31
|
const verb = args.shift();
|
|
34
32
|
const options = {};
|
|
35
33
|
const positional = [];
|
|
36
34
|
for (let i = 0; i < args.length; i++) {
|
|
37
35
|
const arg = args[i];
|
|
38
|
-
if (["--target", "--project", "--config", "--output", "--machine-bits", "--example", "--seed", "--report", "--attestation", "--view", "--
|
|
36
|
+
if (["--target", "--project", "--config", "--output", "--machine-bits", "--example", "--seed", "--report", "--attestation", "--view", "--solver", "--proof-timeout", "--proof-memory", "--proof-rlimit", "--proof-seed"].includes(arg)) {
|
|
39
37
|
if (!args[i + 1] || args[i + 1].startsWith("--"))
|
|
40
38
|
throw new Error(`Missing value for ${arg}`);
|
|
41
39
|
options[arg.slice(2)] = args[++i];
|
|
@@ -44,7 +42,7 @@ for (let i = 0; i < args.length; i++) {
|
|
|
44
42
|
if (!args[i + 1] || args[i + 1].startsWith("--"))
|
|
45
43
|
throw new Error(`Missing value for ${arg}`);
|
|
46
44
|
options[arg.slice(2)] = [...(options[arg.slice(2)] ?? []), ...args[++i].split(",").filter(Boolean)];
|
|
47
|
-
} else if (["--dry-run", "--check", "--json", "--minify", "--no-cache", "--fresh", "--coverage", "--update-recorded", "--benchmarks", "--
|
|
45
|
+
} else if (["--dry-run", "--check", "--json", "--minify", "--no-cache", "--fresh", "--coverage", "--update-recorded", "--benchmarks", "--stdio", "--warn-matches"].includes(arg))
|
|
48
46
|
options[arg.slice(2)] = true;
|
|
49
47
|
else if (arg.startsWith("--")) throw new Error(`Unknown option: ${arg}`);
|
|
50
48
|
else positional.push(arg);
|
|
@@ -126,49 +124,16 @@ async function packageInput(owner, root) {
|
|
|
126
124
|
...(owner.dependencies !== undefined ? { dependencies: owner.dependencies } : {}),
|
|
127
125
|
};
|
|
128
126
|
}
|
|
129
|
-
async function migrateCommand() {
|
|
130
|
-
if(options.write&&options["dry-run"])throw new Error("--write and --dry-run cannot be combined");
|
|
131
|
-
if (options.from !== "0.24") throw new Error("migrate requires --from 0.24");
|
|
132
|
-
const configurationText=await readFile(configFile,"utf8");
|
|
133
|
-
const config = JSON.parse(configurationText);
|
|
134
|
-
if (config.version !== 1) throw new Error("migrate --from 0.24 requires configuration version 1");
|
|
135
|
-
const compiler = await createCompiler();
|
|
136
|
-
const input={
|
|
137
|
-
sources: await sources(config), ...(await packageInput(config, configRoot)),
|
|
138
|
-
generation: config.generation, machineBits: config.machineBits ?? 64, minify: options.minify === true,
|
|
139
|
-
};
|
|
140
|
-
const recheck=async()=>{
|
|
141
|
-
const current={sources:await sources(config),...(await packageInput(config,configRoot))};
|
|
142
|
-
const original={sources:input.sources,...Object.fromEntries(['packages','dependencies']
|
|
143
|
-
.filter(key=>input[key]!==undefined).map(key=>[key,input[key]]))};
|
|
144
|
-
if(JSON.stringify(current)!==JSON.stringify(original))throw new Error('Project sources or package dependencies changed during migration.');
|
|
145
|
-
};
|
|
146
|
-
const report=options.write?await writeMigration(compiler,configRoot,path.basename(configFile),configurationText,input,{recheck}):
|
|
147
|
-
await migrationReport(compiler,config,input);
|
|
148
|
-
diagnostics(report);
|
|
149
|
-
const bindingChanges=report.bindingPreview.targets.flatMap(target=>target.evidence?.changes??[]).length;
|
|
150
|
-
const bindingChecked=report.bindingPreview.targets.filter(target=>target.evidence?.beforeValidated===true).length;
|
|
151
|
-
const bindingMatched=report.bindingPreview.targets.filter(target=>target.status==='matched').length;
|
|
152
|
-
const bindingSummary=`Native binding preview: ${bindingChecked} of ${report.bindingPreview.configurationCount} original configurations checked; ${bindingMatched} proposals match; ${bindingChanges} field changes.\n`;
|
|
153
|
-
const generationAccepted=report.generationPreview.targets.filter(target=>target.status==='accepted').length;
|
|
154
|
-
const generationSummary=`Target generation preview: ${generationAccepted} of ${report.generationPreview.configurationCount} configurations accepted. Native implementation conformance remains unestablished.\n`;
|
|
155
|
-
const boundaryMatched=report.generationPreview.targets.filter(target=>target.nativeBoundary.status==='matched').length;
|
|
156
|
-
const boundarySummary=`Native boundary comparison: ${boundaryMatched} of ${report.generationPreview.configurationCount} configurations match under their existing native implementation assumptions.\n`;
|
|
157
|
-
output(options.json ? report : `${options.write?"Written":"Read-only"} migration report: ${report.baseline.laws.length} laws, ${report.baseline.definitions.length} definitions, ${report.constructorChanges.length} constructor payload changes.\n` + bindingSummary + generationSummary + boundarySummary +
|
|
158
|
-
report.blockers.join("\n") + (options.write?`\n${report.filesWritten.length} files written. Existing native implementation assumptions are retained; no law verification is claimed.`:
|
|
159
|
-
`\nNo files were written. ${report.validated?'The migration is validated under its existing compiler and native implementation assumptions. Use --write to apply it.':'Migration remains incomplete.'} Use --json to inspect the complete report.`));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
127
|
async function formatCommand() {
|
|
163
128
|
const config = positional.length ? null : JSON.parse(await readFile(configFile, "utf8"));
|
|
164
|
-
if(config&&(config.version!==2||config.languageProfile!=="1.0-rc.
|
|
165
|
-
throw new Error("Formatting a project requires configuration version 2 and languageProfile 1.0-rc.
|
|
129
|
+
if(config&&(config.version!==2||config.languageProfile!=="1.0-rc.2"))
|
|
130
|
+
throw new Error("Formatting a project requires configuration version 2 and languageProfile 1.0-rc.2");
|
|
166
131
|
const root = positional.length ? process.cwd() : configRoot;
|
|
167
132
|
const files = await collectSources(root, positional.length ? positional : config.sources);
|
|
168
133
|
const compiler = await createCompiler();
|
|
169
134
|
const result = diagnostics(await compiler.format({
|
|
170
135
|
sources: files, ...(config ? await packageInput(config, configRoot) : {}),
|
|
171
|
-
languageProfile: "1.0-rc.
|
|
136
|
+
languageProfile: "1.0-rc.2", verification: { layers: [] },
|
|
172
137
|
}));
|
|
173
138
|
const changed = result.formattedSources.filter((file, index) => file.content !== files[index].content);
|
|
174
139
|
if (!options.check) for (const file of changed) await atomicWrite(path.resolve(root, file.path), file.content);
|
|
@@ -183,7 +148,7 @@ async function packageCommand() {
|
|
|
183
148
|
const compiler = await createCompiler();
|
|
184
149
|
const result = diagnostics(
|
|
185
150
|
await compiler.check({
|
|
186
|
-
languageProfile: '1.0-rc.
|
|
151
|
+
languageProfile: '1.0-rc.2', verification: {layers: []},
|
|
187
152
|
sources: own.sources,
|
|
188
153
|
package: { name: own.name, version: own.version },
|
|
189
154
|
...(await packageInput(manifest, directory)),
|
|
@@ -223,10 +188,10 @@ async function init() {
|
|
|
223
188
|
const current = await readOptional(configFile);
|
|
224
189
|
const config =
|
|
225
190
|
current === null
|
|
226
|
-
? { version: 2, languageProfile: "1.0-rc.
|
|
191
|
+
? { version: 2, languageProfile: "1.0-rc.2", verification: { layers: [] }, sources: ["laws"], targets: [] }
|
|
227
192
|
: JSON.parse(current);
|
|
228
|
-
if(config.version!==2||config.languageProfile!=='1.0-rc.
|
|
229
|
-
throw new Error('Existing projects require configuration version 2 and languageProfile 1.0-rc.
|
|
193
|
+
if(config.version!==2||config.languageProfile!=='1.0-rc.2')
|
|
194
|
+
throw new Error('Existing projects require configuration version 2 and languageProfile 1.0-rc.2');
|
|
230
195
|
if (
|
|
231
196
|
config.targets.some(
|
|
232
197
|
(t) =>
|
|
@@ -745,7 +710,7 @@ async function main() {
|
|
|
745
710
|
}
|
|
746
711
|
if (!verb || ["help", "--help", "-h"].includes(verb)) {
|
|
747
712
|
output(
|
|
748
|
-
"LawSpec " + VERSION + "\nUsage: lawspec init --target <language> [--project <directory>] [--minify]\n lawspec fmt [paths...] [--check]\n lawspec
|
|
713
|
+
"LawSpec " + VERSION + "\nUsage: lawspec init --target <language> [--project <directory>] [--minify]\n lawspec fmt [paths...] [--check]\n lawspec lsp --stdio\n lawspec prove [--solver <z3-executable>] [--proof-timeout <ms>] [--json]\n lawspec check [--warn-matches] | doctor | explain [<unit>::<law>] [--view developer|business|formal|evidence] | generate\n lawspec evidence [<unit> | <unit>::<declaration>] [--attestation <file>]\n lawspec test [--target <language>] [--fresh] [--seed <n>] [--attestation <file>] [--update-recorded] [--tag <t>] [--exclude-tag <t>] [--report junit=<path>] [--coverage] [--benchmarks]\n lawspec package [--project <package directory>]\n lawspec examples [--example payments] [--target <language>] [--output <directory>]\nOptions: --config <path>, --target <language>, --machine-bits <32|64>, --json, --no-cache\nGeneration: --dry-run, --check, --minify\nTargets: " +
|
|
749
714
|
targets.join(", "),
|
|
750
715
|
);
|
|
751
716
|
return;
|
|
@@ -799,11 +764,8 @@ async function main() {
|
|
|
799
764
|
throw new Error("--attestation applies to evidence and test");
|
|
800
765
|
if (options.seed !== undefined && !/^[0-9]+$/.test(options.seed))
|
|
801
766
|
throw new Error("--seed must be a whole number");
|
|
802
|
-
if (options.from && verb !== "migrate") throw new Error("--from applies to migrate");
|
|
803
|
-
if (options.write && verb !== "migrate") throw new Error("--write applies to migrate");
|
|
804
767
|
if (options["warn-matches"] && verb !== "check") throw new Error("--warn-matches applies to check");
|
|
805
768
|
if (options.stdio && verb !== "lsp") throw new Error("--stdio applies to lsp");
|
|
806
|
-
if (verb === "migrate") return migrateCommand();
|
|
807
769
|
if (verb === "lsp") {
|
|
808
770
|
if (!options.stdio) throw new Error("lsp requires --stdio");
|
|
809
771
|
return serveLanguage();
|
|
@@ -820,9 +782,9 @@ async function main() {
|
|
|
820
782
|
!Array.isArray(config.targets)
|
|
821
783
|
)
|
|
822
784
|
throw new Error(
|
|
823
|
-
"Expected lawspec.json version 2 with languageProfile 1.0-rc.
|
|
785
|
+
"Expected lawspec.json version 2 with languageProfile 1.0-rc.2, sources and targets arrays",
|
|
824
786
|
);
|
|
825
|
-
if (config.languageProfile !== "1.0-rc.
|
|
787
|
+
if (config.languageProfile !== "1.0-rc.2") throw new Error("Configuration version 2 requires languageProfile 1.0-rc.2");
|
|
826
788
|
const selected = config.targets.filter(
|
|
827
789
|
(t) => !options.target || t.language === options.target,
|
|
828
790
|
);
|
|
@@ -864,7 +826,7 @@ async function main() {
|
|
|
864
826
|
};
|
|
865
827
|
const compiler = await createCompiler();
|
|
866
828
|
if (verb === "prove") {
|
|
867
|
-
if (config.version !== 2) throw new Error("prove requires configuration version 2 and languageProfile 1.0-rc.
|
|
829
|
+
if (config.version !== 2) throw new Error("prove requires configuration version 2 and languageProfile 1.0-rc.2");
|
|
868
830
|
const result = diagnostics(await proveWithZ3(compiler, input, {
|
|
869
831
|
...(options.solver !== undefined ? {binary: options.solver} : {}),
|
|
870
832
|
...Object.fromEntries([["proof-timeout","timeoutMs"],["proof-memory","memoryMb"],
|