@milkenjoyer/toolchain 0.14.0 → 0.15.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 (47) hide show
  1. package/README.md +12 -16
  2. package/dist/effect-plugin-BsrW5_nI.mjs +79 -0
  3. package/dist/effect-plugin.d.mts +2 -3966
  4. package/dist/effect-plugin.mjs +1 -1
  5. package/dist/fmt-BaECz64m.mjs +8 -0
  6. package/dist/fmt.mjs +1 -8
  7. package/dist/formal.mjs +1 -1
  8. package/dist/guard-Doqk4Fju.mjs +143 -0
  9. package/dist/guard.mjs +1 -96
  10. package/dist/{lint-IhmtnBbx.mjs → lint-CfztB4u8.mjs} +1 -1
  11. package/dist/lint.mjs +1 -1
  12. package/dist/standard.mjs +557 -4
  13. package/package.json +4 -9
  14. package/src/arithmetic.ts +60 -0
  15. package/src/compatible.ts +512 -0
  16. package/src/conformance.ts +56 -0
  17. package/src/effect-plugin.ts +24 -0
  18. package/src/effect-tsgo.ts +44 -0
  19. package/src/exceptions.ts +17 -0
  20. package/src/fmt.ts +13 -0
  21. package/src/foldkit-plugin.ts +51 -0
  22. package/src/formal/z3.ts +18 -1
  23. package/src/guard.ts +307 -0
  24. package/src/hooks.ts +205 -0
  25. package/src/index.ts +1 -0
  26. package/src/knip.ts +25 -0
  27. package/src/lint.ts +170 -0
  28. package/src/plugin.ts +21 -0
  29. package/src/rules/no-comments.ts +36 -0
  30. package/src/rules/no-process-env.ts +68 -0
  31. package/src/rules/prefer-accessible-scene-locators.ts +227 -0
  32. package/src/rules/require-command-answer-names.ts +144 -0
  33. package/src/rules/require-past-tense-messages.ts +201 -0
  34. package/src/rules/use-temp-file-scoped.ts +132 -0
  35. package/src/rules.ts +121 -0
  36. package/src/shared/foldkit-api.ts +51 -0
  37. package/src/shared/member-path.ts +106 -0
  38. package/src/shared/syntax.ts +47 -0
  39. package/src/standard/alchemy.ts +70 -0
  40. package/src/standard/checks.ts +10 -1
  41. package/src/standard/config.ts +84 -0
  42. package/src/standard/domain-rules.ts +204 -0
  43. package/src/standard/domain.ts +296 -0
  44. package/src/standard/infra.ts +486 -0
  45. package/src/versions.ts +221 -0
  46. package/dist/effect-plugin-BXUx9PPu.mjs +0 -3561
  47. package/dist/manifest-xQwgnYI1.mjs +0 -53
package/README.md CHANGED
@@ -241,7 +241,7 @@ export default z3({
241
241
 
242
242
  A `z3` proof passes only when all of these hold:
243
243
 
244
- - `code` returns a whole number equal to the model's output on `samples` seeded inputs, edge values first.
244
+ - `code` returns a whole number equal to the model's output on `samples` seeded inputs. Edge values come first, then one draw uniform over each range for every three small-magnitude draws, which put each input within a random power of two of its range's value nearest 0.
245
245
  - The claim uses only Int and BitVec arithmetic. Real and Float arithmetic fail.
246
246
  - `holds` is false for some output, so the claim constrains the model.
247
247
  - z3 answers `unsat` for the negated claim. `unknown`, a timeout or a crash fails.
@@ -252,20 +252,16 @@ Rule 16 applies once `specs.json` has an `arithmetic` key. Each `arithmetic` glo
252
252
 
253
253
  ## Standard check
254
254
 
255
- Run `vp exec standard` from a Git repository. The command accepts no arguments. It checks tracked files that still exist.
255
+ `vp exec standard`: sorted `<file>: <rule>: <message>` stderr for tracked files (exit 1). Success exits 0; arguments exit 2.
256
256
 
257
- Findings go to stderr as `<file>: <rule>: <message>`, sorted by file and rule order. Failure ends with `standard: N findings` and exit code 1. Success prints `standard: N rules, no findings` and exits 0. Extra arguments print `usage: standard` and exit 2.
257
+ - `toolchain-pin`, `exact-versions`, `alchemy-pins`: exact pins; one Alchemy.
258
+ - `lint-package`, `lint-fmt`, `lint-config`: shared lint/fmt, ignores, one-provide; no local lint package.
259
+ - `tsconfig-base`, `node-version`, `renovate-preset`: shared presets.
260
+ - `specs`, `ready-formal`: metadata, critical coverage, formal gate.
261
+ - `task-agents`, `skill-names`: pointer; unique names.
262
+ - `infra-through-alchemy`: no provider writes/Wrangler; reads/runtime allowed.
263
+ - `domain-layout`: placement, shared events/rejections, imported `.id.ts` ids.
264
+ - `domain-imports`: own files, domain, effect, `standard.domainImports`.
265
+ - `domain-no-throw`: Domain.Rejection/Schema.TaggedError.
258
266
 
259
- - `toolchain-pin` requires an exact toolchain dependency or an exact catalog entry.
260
- - `lint-package` rejects repo-owned lint packages.
261
- - `lint-fmt` requires the shared lint and fmt imports through the root Vite config.
262
- - `tsconfig-base` requires the shared base in the root extends chain.
263
- - `node-version` requires the toolchain's Node version.
264
- - `renovate-preset` requires the shared Renovate preset URL.
265
- - `exact-versions` rejects dependency ranges in tracked manifests.
266
- - `specs` requires valid specs metadata, a spec entry and coverage of critical files.
267
- - `ready-formal` requires a ready workflow step running `vp exec formal`. A step or job with `if: false` or `continue-on-error` does not count.
268
- - `task-agents` requires a Task agents section with one line pointing to `agent-kit:task-agents`.
269
- - `skill-names` rejects repo skills that share plugin skill names.
270
-
271
- New rules register in `src/standard/checks.ts`.
267
+ Source checks skip tests/proofs. Runtime story coverage is tracked in #325.
@@ -0,0 +1,79 @@
1
+ import { n as memberPropertyName } from "./syntax-CGEOffZK.mjs";
2
+ import * as Arr from "effect/Array";
3
+ import * as Option from "effect/Option";
4
+ import * as R from "effect/Record";
5
+ import * as Effect from "effect/Effect";
6
+ import upstream from "@mpsuesser/oxlint-plugin-effect";
7
+ import { Diagnostic, Rule, RuleContext } from "effect-oxlint";
8
+ // src/rules/use-temp-file-scoped.ts
9
+ const isOs = (source) => source === "os" || source === "node:os";
10
+ const isOsBinding = (source, node) => {
11
+ const lookup = (scope) => {
12
+ const variable = scope.set.get(node.name);
13
+ if (variable === void 0) return scope.upper === null ? false : lookup(scope.upper);
14
+ return Arr.some(variable.defs, (definition) => definition.type === "ImportBinding" && (definition.node.type === "ImportDefaultSpecifier" || definition.node.type === "ImportNamespaceSpecifier") && definition.parent?.type === "ImportDeclaration" && isOs(definition.parent.source.value));
15
+ };
16
+ return lookup(source.getScope(node));
17
+ };
18
+ const isManagedAcquire = (node) => {
19
+ const parent = node.parent;
20
+ if (parent === null) return false;
21
+ if (parent.type === "CallExpression" && parent.arguments[0] === node && parent.callee.type === "MemberExpression" && parent.callee.object.type === "Identifier" && parent.callee.object.name === "Effect" && Option.exists(memberPropertyName(parent.callee), (name) => name === "acquireRelease" || name === "acquireUseRelease")) return true;
22
+ return isManagedAcquire(parent);
23
+ };
24
+ const useTempFileScopedRule = Rule.define({
25
+ name: "use-temp-file-scoped",
26
+ meta: Rule.meta({
27
+ type: "suggestion",
28
+ description: "Prefer scoped temporary files and directories with automatic cleanup",
29
+ messages: {
30
+ tmpdir: "Avoid `os.tmpdir()` — use `FileSystem.makeTempFileScoped` from `@effect/platform` for scoped temp files with automatic cleanup.",
31
+ unscoped: "Avoid `{{api}}` — the unscoped variant requires manual cleanup. Use `{{api}}Scoped` so the resource is finalized when its scope closes."
32
+ }
33
+ }),
34
+ *create() {
35
+ const context = yield* RuleContext;
36
+ return {
37
+ ImportDeclaration: (node) => node.type === "ImportDeclaration" && isOs(node.source.value) ? Effect.forEach(Arr.filter(node.specifiers, (specifier) => specifier.type === "ImportSpecifier" && (specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value) === "tmpdir"), (specifier) => context.report(Diagnostic.fromId({
38
+ node: specifier,
39
+ messageId: "tmpdir"
40
+ })), {
41
+ concurrency: 1,
42
+ discard: true
43
+ }) : Effect.void,
44
+ MemberExpression: (node) => node.type === "MemberExpression" && Option.contains(memberPropertyName(node), "tmpdir") && node.object.type === "Identifier" && isOsBinding(context.sourceCode, node.object) ? context.report(Diagnostic.fromId({
45
+ node,
46
+ messageId: "tmpdir"
47
+ })) : Effect.void,
48
+ CallExpression: (node) => {
49
+ if (node.type !== "CallExpression" || node.callee.type !== "MemberExpression" || isManagedAcquire(node)) return Effect.void;
50
+ return Option.match(Option.filter(memberPropertyName(node.callee), (name) => name === "makeTempFile" || name === "makeTempDirectory"), {
51
+ onNone: () => Effect.void,
52
+ onSome: (api) => context.report(Diagnostic.fromId({
53
+ node,
54
+ messageId: "unscoped",
55
+ data: { api }
56
+ }))
57
+ });
58
+ }
59
+ };
60
+ }
61
+ });
62
+ // src/effect-plugin.ts
63
+ const kept = [
64
+ "avoid-mutable-state",
65
+ "avoid-option-getorthrow",
66
+ "no-chained-type-assertions",
67
+ "no-module-mocking",
68
+ "prefer-redacted-config",
69
+ "require-effect-concurrency",
70
+ "throw-in-effect-gen"
71
+ ];
72
+ const plugin = {
73
+ meta: upstream.meta,
74
+ rules: {
75
+ ...R.filter(upstream.rules, (_rule, name) => kept.includes(name)),
76
+ "use-temp-file-scoped": useTempFileScopedRule
77
+ }
78
+ };
79
+ export { plugin as t };