@milkenjoyer/toolchain 0.11.0 → 0.13.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.
Files changed (45) hide show
  1. package/README.md +190 -17
  2. package/dist/arithmetic.d.mts +45 -0
  3. package/dist/arithmetic.mjs +25 -0
  4. package/dist/conformance.d.mts +18 -0
  5. package/dist/conformance.mjs +31 -0
  6. package/dist/effect-plugin.mjs +1 -1
  7. package/dist/exceptions-Dybl9xpc.mjs +11 -0
  8. package/dist/exceptions.mjs +1 -1
  9. package/dist/foldkit-plugin.mjs +1 -1
  10. package/dist/formal.d.mts +131 -3
  11. package/dist/formal.mjs +1006 -146
  12. package/dist/guard.mjs +2 -2
  13. package/dist/knip.mjs +2 -1
  14. package/dist/{lint-JSnPsGO1.mjs → lint-IhmtnBbx.mjs} +3 -3
  15. package/dist/lint.mjs +1 -1
  16. package/dist/plugin.mjs +1 -1
  17. package/dist/proof.mjs +1 -1
  18. package/dist/trace-file-KuPRWgwt.mjs +17 -0
  19. package/dist/verdict.d.mts +1 -1
  20. package/dist/verdict.mjs +1 -1
  21. package/dist/{verification-p2rSx5lc.d.mts → verification-FgQFU1YN.d.mts} +1 -1
  22. package/dist/verification.d.mts +1 -1
  23. package/dist/verification.mjs +1 -1
  24. package/package.json +12 -3
  25. package/src/formal/arithmetic.ts +190 -0
  26. package/src/formal/cfg.ts +58 -1
  27. package/src/formal/checks.ts +57 -52
  28. package/src/formal/coverage.ts +79 -0
  29. package/src/formal/gate.ts +74 -0
  30. package/src/formal/git.ts +38 -0
  31. package/src/formal/proof-run.ts +77 -0
  32. package/src/formal/proofs.ts +226 -0
  33. package/src/formal/prover.ts +291 -0
  34. package/src/formal/semantics.ts +110 -0
  35. package/src/formal/specs.ts +103 -31
  36. package/src/formal/tla.ts +60 -19
  37. package/src/formal/trace-file.ts +35 -0
  38. package/src/formal/traces.ts +293 -0
  39. package/src/formal/violations.ts +76 -0
  40. package/src/formal/z3.ts +321 -0
  41. package/src/formal.ts +10 -3
  42. package/dist/exceptions-Bq-9MxoR.mjs +0 -3
  43. package/dist/{effect-plugin-kYxB-5LJ.mjs → effect-plugin-BXUx9PPu.mjs} +1 -1
  44. package/dist/{plugin-BoBRGtGf.mjs → plugin-CwxhPtui.mjs} +1 -1
  45. package/dist/{verification-6s2chr4X.mjs → verification-oAc1Q6I9.mjs} +1 -1
package/src/formal.ts CHANGED
@@ -4,10 +4,12 @@ import * as Cause from "effect/Cause";
4
4
  import * as Console from "effect/Console";
5
5
  import * as Effect from "effect/Effect";
6
6
  import * as Exit from "effect/Exit";
7
+ import * as Layer from "effect/Layer";
7
8
  import { ChildProcess } from "effect/process";
8
9
  import * as Stream from "effect/Stream";
9
10
 
10
11
  import { checks, type Finding } from "./formal/checks.ts";
12
+ import { Gate } from "./formal/gate.ts";
11
13
  import { load } from "./formal/specs.ts";
12
14
  import { FormalError, Tla } from "./formal/tla.ts";
13
15
 
@@ -23,7 +25,10 @@ export const formal = Effect.fn("formal")(function* (root: string) {
23
25
  findings.push(...problems.map((problem) => ({ ...problem, check: name })));
24
26
  }
25
27
  findings.sort(
26
- (a, b) => a.file.localeCompare(b.file) || a.check.localeCompare(b.check)
28
+ (a, b) =>
29
+ a.file.localeCompare(b.file) ||
30
+ Object.keys(checks).indexOf(a.check) -
31
+ Object.keys(checks).indexOf(b.check)
27
32
  );
28
33
  if (findings.length) {
29
34
  for (const f of findings)
@@ -33,7 +38,7 @@ export const formal = Effect.fn("formal")(function* (root: string) {
33
38
  );
34
39
  } else
35
40
  yield* Console.log(
36
- `formal: ${repo.specs.length} specs, ${repo.specs.reduce((n, s) => n + s.configs.length, 0)} configs, no findings`
41
+ `formal: ${repo.specs.length} specs, ${repo.specs.reduce((n, s) => n + s.configs.length, 0)} configs, ${Object.keys(repo.file.proofs).length} proofs, no findings`
37
42
  );
38
43
  return findings.length ? 1 : 0;
39
44
  });
@@ -59,7 +64,9 @@ if (import.meta.main) {
59
64
  return yield* new FormalError({
60
65
  message: "run formal inside a git repository",
61
66
  });
62
- return yield* formal(root.trim()).pipe(Effect.provide(Tla.layer));
67
+ return yield* formal(root.trim()).pipe(
68
+ Effect.provide(Gate.layer.pipe(Layer.provideMerge(Tla.layer)))
69
+ );
63
70
  })
64
71
  ).pipe(Effect.provide(NodeServices.layer))
65
72
  );
@@ -1,3 +0,0 @@
1
- // src/exceptions.ts
2
- const exceptions = [];
3
- export { exceptions as t };
@@ -6,8 +6,8 @@ import * as Option from "effect/Option";
6
6
  import * as R from "effect/Record";
7
7
  import * as Schema from "effect/Schema";
8
8
  import * as Str from "effect/String";
9
- import { AST, Diagnostic, Plugin, Rule, RuleContext, Scope, SourceCode, Visitor } from "effect-oxlint";
10
9
  import * as Effect from "effect/Effect";
10
+ import { AST, Diagnostic, Plugin, Rule, RuleContext, Scope, SourceCode, Visitor } from "effect-oxlint";
11
11
  import * as Ref from "effect/Ref";
12
12
  import { pipe as pipe$1 } from "effect";
13
13
  import * as Result from "effect/Result";
@@ -4,8 +4,8 @@ import { dual } from "effect/Function";
4
4
  import * as HashSet from "effect/HashSet";
5
5
  import * as Option from "effect/Option";
6
6
  import * as Str from "effect/String";
7
- import { Comment, Diagnostic, Plugin, Rule, RuleContext } from "effect-oxlint";
8
7
  import * as Effect from "effect/Effect";
8
+ import { Comment, Diagnostic, Plugin, Rule, RuleContext } from "effect-oxlint";
9
9
  import * as HashMap from "effect/HashMap";
10
10
  // src/rules/no-comments.ts
11
11
  const noCommentsRule = Rule.define({
@@ -1,12 +1,12 @@
1
1
  import * as Data from "effect/Data";
2
2
  import * as Schema from "effect/Schema";
3
+ import * as Config from "effect/Config";
3
4
  import * as Effect from "effect/Effect";
4
5
  import { NodeServices } from "@effect/platform-node";
5
6
  import * as Cause from "effect/Cause";
6
7
  import * as Console from "effect/Console";
7
8
  import * as Exit from "effect/Exit";
8
9
  import { FileSystem } from "effect/FileSystem";
9
- import * as Config from "effect/Config";
10
10
  import { Octokit } from "@octokit/rest";
11
11
  import * as Redacted from "effect/Redacted";
12
12
  // src/verification.ts