@milkenjoyer/toolchain 0.14.1 → 0.16.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 (53) hide show
  1. package/README.md +17 -17
  2. package/STARTS.md +11 -0
  3. package/dist/effect-plugin-BsrW5_nI.mjs +79 -0
  4. package/dist/effect-plugin.d.mts +2 -3966
  5. package/dist/effect-plugin.mjs +1 -1
  6. package/dist/fmt-BaECz64m.mjs +8 -0
  7. package/dist/fmt.mjs +1 -8
  8. package/dist/formal.mjs +1 -1
  9. package/dist/guard-Doqk4Fju.mjs +143 -0
  10. package/dist/guard.mjs +1 -96
  11. package/dist/{lint-IhmtnBbx.mjs → lint-CfztB4u8.mjs} +1 -1
  12. package/dist/lint.mjs +1 -1
  13. package/dist/standard.mjs +557 -4
  14. package/dist/starts.d.mts +100 -0
  15. package/dist/starts.mjs +385 -0
  16. package/package.json +11 -9
  17. package/src/arithmetic.ts +60 -0
  18. package/src/compatible.ts +512 -0
  19. package/src/conformance.ts +56 -0
  20. package/src/effect-plugin.ts +24 -0
  21. package/src/effect-tsgo.ts +44 -0
  22. package/src/exceptions.ts +17 -0
  23. package/src/fmt.ts +13 -0
  24. package/src/foldkit-plugin.ts +51 -0
  25. package/src/guard.ts +307 -0
  26. package/src/hooks.ts +205 -0
  27. package/src/index.ts +1 -0
  28. package/src/knip.ts +25 -0
  29. package/src/lint.ts +170 -0
  30. package/src/plugin.ts +21 -0
  31. package/src/rules/no-comments.ts +36 -0
  32. package/src/rules/no-process-env.ts +68 -0
  33. package/src/rules/prefer-accessible-scene-locators.ts +227 -0
  34. package/src/rules/require-command-answer-names.ts +144 -0
  35. package/src/rules/require-past-tense-messages.ts +201 -0
  36. package/src/rules/use-temp-file-scoped.ts +132 -0
  37. package/src/rules.ts +121 -0
  38. package/src/shared/foldkit-api.ts +51 -0
  39. package/src/shared/member-path.ts +106 -0
  40. package/src/shared/syntax.ts +47 -0
  41. package/src/standard/alchemy.ts +70 -0
  42. package/src/standard/checks.ts +10 -1
  43. package/src/standard/config.ts +84 -0
  44. package/src/standard/domain-rules.ts +204 -0
  45. package/src/standard/domain.ts +296 -0
  46. package/src/standard/infra.ts +486 -0
  47. package/src/starts/boat.ts +140 -0
  48. package/src/starts/budget.ts +151 -0
  49. package/src/starts/policy.ts +171 -0
  50. package/src/starts.ts +84 -0
  51. package/src/versions.ts +221 -0
  52. package/dist/effect-plugin-BXUx9PPu.mjs +0 -3561
  53. package/dist/manifest-xQwgnYI1.mjs +0 -53
package/README.md CHANGED
@@ -252,20 +252,20 @@ 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.
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.
258
-
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`.
255
+ `vp exec standard`: sorted `<file>: <rule>: <message>` stderr for tracked files (exit 1). Success exits 0; arguments exit 2.
256
+
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.
266
+
267
+ Source checks skip tests/proofs. Runtime story coverage is tracked in #325.
268
+
269
+ # Boat start budgets
270
+
271
+ See [Boat start budgets](STARTS.md) for `@milkenjoyer/toolchain/starts` in 0.16.0.
package/STARTS.md ADDED
@@ -0,0 +1,11 @@
1
+ # Boat start budgets
2
+
3
+ Pin `@milkenjoyer/toolchain` to `0.16.0` and import `boatJobFindings` from `@milkenjoyer/toolchain/starts`. Add its findings to the existing workflow policy, with every workflow as a `[path, text]` pair. It bounds each closure to `BOAT_JOBS_PER_RUN = 2`, including literal matrices, repeated local reusable calls and `workflow_run` descendants. Each descendant counts once per distinct activity type, or three times when `types` is absent. Dynamic and unresolved graphs produce findings. Keep runner, timeout and concurrency checks.
4
+
5
+ Scripts wrap each create, fork or resume in `admitStart({ repo, jobs: 1 }, start, { deadline })`. `Repo` validates an `owner/name`. `deadline` is an absolute epoch time in milliseconds. `start` is a lazy Effect that runs once after admission. Supply `BoatStarts.layer(key, { fetch? })` with a redacted key. It reads the key's default billing wallet. The optional `fetch` supplies the SDK transport.
6
+
7
+ Read failures and incomplete history retry until the deadline, then fail `StartHeld` with an `Unread` line. Other waits also poll fresh Boat readings until the deadline. An unknown repo, an invalid plan or non-positive `jobs` holds at once. `StartHeld.line` names the cause. The pure `decide(request, counts, now)` takes the current epoch time explicitly, including when counts are unread.
8
+
9
+ `startShares` assigns 80% of each live limit across the five repos. Account headroom is 20 starts per window. Repo CI history counts a Boat job without `runStartedAt` as starting now unless Boat reports it settled, including states the SDK does not list, such as `paused`. A start stamped after Boat answers counts at the answer's time. That history omits direct sandbox starts. A kept sandbox resume takes this admission path too. Product repos adopt the published pin instead of copying files.
10
+
11
+ Admission reads counts and reserves nothing, so concurrent callers can race. Workflows triggered by merges, Renovate, schedules and pushes start without admission, bounded only by `BOAT_JOBS_PER_RUN`. Boat reports no start spend, so nothing here proves zero paid starts.
@@ -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 };