@milkenjoyer/toolchain 0.20.0 → 0.21.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 (49) hide show
  1. package/dist/ci-budget-B2AuZ3xa.mjs +80 -0
  2. package/dist/ci-budget-cli.d.mts +2 -0
  3. package/dist/ci-budget-cli.mjs +31 -0
  4. package/dist/ci-budget.d.mts +22 -0
  5. package/dist/ci-budget.mjs +1 -0
  6. package/dist/ci-result.d.mts +1 -0
  7. package/dist/ci-result.mjs +12 -0
  8. package/dist/{compatible-DIYO9MZf.d.mts → compatible-BKEJ_p20.d.mts} +1 -1
  9. package/dist/{compatible-D54mCSlT.mjs → compatible-CRaMYpBM.mjs} +2 -2
  10. package/dist/compatible.d.mts +1 -1
  11. package/dist/compatible.mjs +1 -1
  12. package/dist/conformance.mjs +1 -1
  13. package/dist/{effect-plugin-BsrW5_nI.mjs → effect-plugin-BiskbKO9.mjs} +2 -2
  14. package/dist/effect-plugin.mjs +1 -1
  15. package/dist/foldkit-plugin.mjs +2 -2
  16. package/dist/formal.d.mts +1 -1
  17. package/dist/formal.mjs +5 -5
  18. package/dist/{guard-fFg_0NIp.mjs → guard-CAm90ZGy.mjs} +5 -5
  19. package/dist/guard.d.mts +1 -1
  20. package/dist/guard.mjs +1 -1
  21. package/dist/hooks.d.mts +1 -1
  22. package/dist/hooks.mjs +2 -2
  23. package/dist/{lint-BJ6SmGk1.mjs → lint-CiO5Etue.mjs} +3 -3
  24. package/dist/lint.mjs +1 -1
  25. package/dist/{plugin-CwxhPtui.mjs → plugin-DwQM07Ih.mjs} +2 -2
  26. package/dist/plugin.mjs +1 -1
  27. package/dist/proof.mjs +3 -3
  28. package/dist/renovate-ci-BdVmECgm.mjs +73 -0
  29. package/dist/renovate-ci.d.mts +10 -0
  30. package/dist/renovate-ci.mjs +1 -0
  31. package/dist/standard.mjs +6 -6
  32. package/dist/starts.mjs +4 -2
  33. package/dist/verdict.d.mts +1 -1
  34. package/dist/verdict.mjs +2 -2
  35. package/dist/{verification-FgQFU1YN.d.mts → verification-fnhfrxmy.d.mts} +1 -1
  36. package/dist/verification.d.mts +1 -1
  37. package/dist/verification.mjs +1 -1
  38. package/dist/versions.mjs +1 -1
  39. package/package.json +12 -1
  40. package/renovate.json +29 -3
  41. package/src/ci-budget-cli.ts +39 -0
  42. package/src/ci-budget.ts +116 -0
  43. package/src/ci-result.ts +12 -0
  44. package/src/renovate-ci.ts +96 -0
  45. package/src/starts/policy.ts +5 -1
  46. package/dist/{specs-file-NsQF4V7X.mjs → specs-file-Ck9ZOt46.mjs} +1 -1
  47. package/dist/{syntax-CGEOffZK.mjs → syntax-B3n7lDYJ.mjs} +1 -1
  48. package/dist/{verification-oAc1Q6I9.mjs → verification-D4Sn2fh5.mjs} +4 -4
  49. package/dist/{versions-DpRzgSR_.mjs → versions-KbYa8kbF.mjs} +1 -1
@@ -0,0 +1,80 @@
1
+ import * as Schema from "effect/Schema";
2
+ // src/ci-budget.ts
3
+ const Nonnegative = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));
4
+ const Cost = Schema.Struct({
5
+ since: Schema.String,
6
+ dollars: Nonnegative
7
+ });
8
+ const Page = Schema.Struct({
9
+ sandboxes: Schema.Array(Schema.Struct({
10
+ id: Schema.String,
11
+ name: Schema.String,
12
+ cost: Cost
13
+ })),
14
+ deletedCost: Cost,
15
+ pageInfo: Schema.Struct({
16
+ hasMore: Schema.Boolean,
17
+ nextCursor: Schema.NullOr(Schema.String)
18
+ })
19
+ });
20
+ const monthlyCiBudget = (spend) => {
21
+ const dollars = Schema.decodeSync(Nonnegative)(spend.dollars);
22
+ const warning = dollars >= 160 ? `Boat CI month-to-date $${dollars.toFixed(2)} has reached 80% of the $200 monthly budget` : null;
23
+ return dollars >= 200 ? {
24
+ _tag: "Refused",
25
+ reason: `Boat CI month-to-date $${dollars.toFixed(2)} >= $200 monthly CI budget; no CI requested`,
26
+ since: spend.since,
27
+ dollars
28
+ } : {
29
+ _tag: "Allowed",
30
+ dollars,
31
+ warning
32
+ };
33
+ };
34
+ const readMonthlyCiSpend = async ({ boat, now }) => {
35
+ const since = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1)).toISOString();
36
+ const monthly = boat.withPreMiddleware(({ url, init }) => {
37
+ const request = new URL(url);
38
+ request.searchParams.set("include", "cost,deletedCost");
39
+ return Promise.resolve({
40
+ url: request.href,
41
+ init
42
+ });
43
+ });
44
+ const ids = /* @__PURE__ */ new Set();
45
+ const cursors = /* @__PURE__ */ new Set();
46
+ let cursor;
47
+ let deletedDollars;
48
+ let dollars = 0;
49
+ for (;;) {
50
+ const response = await monthly.sandboxesRaw({
51
+ namePrefix: "ci-",
52
+ include: "cost",
53
+ limit: 200,
54
+ sort: "asc",
55
+ ...cursor === void 0 ? {} : { cursor }
56
+ });
57
+ const page = Schema.decodeUnknownSync(Page)(await response.raw.json());
58
+ if (page.deletedCost.since !== since || page.sandboxes.some(({ cost }) => cost.since !== since)) throw new Error("Monthly Boat CI meter changed month; read again");
59
+ if (deletedDollars !== void 0 && deletedDollars !== page.deletedCost.dollars) throw new Error("Monthly Boat CI deleted cost changed during pagination; read again");
60
+ deletedDollars = page.deletedCost.dollars;
61
+ for (const sandbox of page.sandboxes) {
62
+ if (!sandbox.name.startsWith("ci-") || ids.has(sandbox.id)) throw new Error("Monthly Boat CI page contains an unexpected or repeated sandbox");
63
+ ids.add(sandbox.id);
64
+ dollars += sandbox.cost.dollars;
65
+ }
66
+ if (!page.pageInfo.hasMore) break;
67
+ const next = page.pageInfo.nextCursor;
68
+ if (next === null || cursors.has(next)) throw new Error("Monthly Boat CI pagination is incomplete");
69
+ cursors.add(next);
70
+ cursor = next;
71
+ }
72
+ return {
73
+ since,
74
+ readAt: now.toISOString(),
75
+ dollars: Schema.decodeSync(Nonnegative)(dollars + deletedDollars),
76
+ deletedDollars,
77
+ sandboxes: ids.size
78
+ };
79
+ };
80
+ export { readMonthlyCiSpend as n, monthlyCiBudget as t };
@@ -0,0 +1,2 @@
1
+ import * as Effect from "effect/Effect";
2
+ export declare const checkCiBudget: Effect.Effect<number, never, never>;
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env bun
2
+ import { n as readMonthlyCiSpend, t as monthlyCiBudget } from "./ci-budget-B2AuZ3xa.mjs";
3
+ import { BoatApi, Configuration } from "@boatdev/sdk";
4
+ import * as Config from "effect/Config";
5
+ import * as Console from "effect/Console";
6
+ import * as DateTime from "effect/DateTime";
7
+ import * as Effect from "effect/Effect";
8
+ import * as Redacted from "effect/Redacted";
9
+ import * as Schema from "effect/Schema";
10
+ // src/ci-budget-cli.ts
11
+ var CiMeterUnread = class extends Schema.TaggedError()("CiMeterUnread", {}) {};
12
+ const checkCiBudget = Effect.gen(function* () {
13
+ const key = yield* Config.Redacted("BOAT_API_KEY");
14
+ const boat = new BoatApi(new Configuration({ accessToken: Redacted.value(key) }));
15
+ const now = yield* DateTime.nowAsDate;
16
+ const spend = yield* Effect.tryPromise({
17
+ try: () => readMonthlyCiSpend({
18
+ boat,
19
+ now
20
+ }),
21
+ catch: () => new CiMeterUnread()
22
+ });
23
+ const budget = monthlyCiBudget(spend);
24
+ yield* Console.log({
25
+ ...budget,
26
+ spend
27
+ });
28
+ return budget._tag === "Allowed" ? 0 : 1;
29
+ }).pipe(Effect.catch(() => Effect.as(Console.error("Boat CI monthly meter unread; no Boat job admitted"), 1)));
30
+ if (import.meta.main) process.exitCode = await Effect.runPromise(checkCiBudget);
31
+ export { checkCiBudget };
@@ -0,0 +1,22 @@
1
+ import { BoatApi } from "@boatdev/sdk";
2
+ export type MonthlyCiSpend = {
3
+ readonly since: string;
4
+ readonly readAt: string;
5
+ readonly dollars: number;
6
+ readonly deletedDollars: number;
7
+ readonly sandboxes: number;
8
+ };
9
+ export declare const monthlyCiBudget: (spend: MonthlyCiSpend) => {
10
+ readonly _tag: "Refused";
11
+ readonly reason: string;
12
+ readonly since: string;
13
+ readonly dollars: number;
14
+ } | {
15
+ readonly _tag: "Allowed";
16
+ readonly dollars: number;
17
+ readonly warning: string | null;
18
+ };
19
+ export declare const readMonthlyCiSpend: ({ boat, now }: {
20
+ readonly boat: BoatApi;
21
+ readonly now: Date;
22
+ }) => Promise<MonthlyCiSpend>;
@@ -0,0 +1 @@
1
+ export { t as monthlyCiBudget, n as readMonthlyCiSpend } from "./ci-budget-B2AuZ3xa.mjs";
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env bun
2
+ import * as Config from "effect/Config";
3
+ import * as Console from "effect/Console";
4
+ import * as Effect from "effect/Effect";
5
+ // src/ci-result.ts
6
+ const result = Effect.gen(function* () {
7
+ const checks = yield* Config.String("CI_RESULT");
8
+ yield* Console.log(`Ready checks: ${checks}`);
9
+ return checks === "success" ? 0 : 1;
10
+ }).pipe(Effect.orElseSucceed(() => 1));
11
+ if (import.meta.main) process.exitCode = await Effect.runPromise(result);
12
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { n as Family, t as Catalog } from "./versions-DqZd0jF9.mjs";
2
+ import * as Schema from "effect/Schema";
2
3
  import * as Data from "effect/Data";
3
4
  import * as Option from "effect/Option";
4
- import * as Schema from "effect/Schema";
5
5
  declare const VersionManifest: Schema.Struct<{
6
6
  readonly dependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
7
7
  readonly peerDependencies: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
@@ -1,4 +1,5 @@
1
- import { c as lead, f as versionOf, i as familyOf, o as fixedBy, r as familyNamed, s as fixedOf, t as catalog, u as ownerOf } from "./versions-DpRzgSR_.mjs";
1
+ import { c as lead, f as versionOf, i as familyOf, o as fixedBy, r as familyNamed, s as fixedOf, t as catalog, u as ownerOf } from "./versions-KbYa8kbF.mjs";
2
+ import * as Schema from "effect/Schema";
2
3
  import * as Arr from "effect/Array";
3
4
  import * as Data from "effect/Data";
4
5
  import { dual } from "effect/Function";
@@ -6,7 +7,6 @@ import * as HashSet from "effect/HashSet";
6
7
  import * as Match from "effect/Match";
7
8
  import * as Option from "effect/Option";
8
9
  import * as R from "effect/Record";
9
- import * as Schema from "effect/Schema";
10
10
  import * as Str from "effect/String";
11
11
  import semver from "semver";
12
12
  // src/compatible.ts
@@ -1,2 +1,2 @@
1
- import { a as VersionManifest, c as describeConflict, d as onLatestLine, f as otherTags, i as Solution, l as fixedRange, n as Packument, o as aliasTarget, p as solve, r as Packuments, s as conflicts, t as Conflict, u as latestOf } from "./compatible-DIYO9MZf.mjs";
1
+ import { a as VersionManifest, c as describeConflict, d as onLatestLine, f as otherTags, i as Solution, l as fixedRange, n as Packument, o as aliasTarget, p as solve, r as Packuments, s as conflicts, t as Conflict, u as latestOf } from "./compatible-BKEJ_p20.mjs";
2
2
  export { Conflict, Packument, Packuments, Solution, VersionManifest, aliasTarget, conflicts, describeConflict, fixedRange, latestOf, onLatestLine, otherTags, solve };
@@ -1 +1 @@
1
- export { t as Conflict, n as Packument, r as Packuments, i as VersionManifest, a as aliasTarget, o as conflicts, s as describeConflict, c as fixedRange, l as latestOf, u as onLatestLine, d as otherTags, f as solve } from "./compatible-D54mCSlT.mjs";
1
+ export { t as Conflict, n as Packument, r as Packuments, i as VersionManifest, a as aliasTarget, o as conflicts, s as describeConflict, c as fixedRange, l as latestOf, u as onLatestLine, d as otherTags, f as solve } from "./compatible-CRaMYpBM.mjs";
@@ -1,7 +1,7 @@
1
1
  import { n as readTraces, r as receiptPath, t as FORMAL_TRACES } from "./trace-file-KuPRWgwt.mjs";
2
- import { readFileSync, writeFileSync } from "node:fs";
3
2
  import * as Config from "effect/Config";
4
3
  import * as Effect from "effect/Effect";
4
+ import { readFileSync, writeFileSync } from "node:fs";
5
5
  import { afterAll, expect, test } from "vite-plus/test";
6
6
  // src/conformance.ts
7
7
  const replayTraces = (name, start) => {
@@ -1,8 +1,8 @@
1
- import { n as memberPropertyName } from "./syntax-CGEOffZK.mjs";
1
+ import { n as memberPropertyName } from "./syntax-B3n7lDYJ.mjs";
2
+ import * as Effect from "effect/Effect";
2
3
  import * as Arr from "effect/Array";
3
4
  import * as Option from "effect/Option";
4
5
  import * as R from "effect/Record";
5
- import * as Effect from "effect/Effect";
6
6
  import upstream from "@mpsuesser/oxlint-plugin-effect";
7
7
  import { Diagnostic, Rule, RuleContext } from "effect-oxlint";
8
8
  // src/rules/use-temp-file-scoped.ts
@@ -1 +1 @@
1
- export { t as default } from "./effect-plugin-BsrW5_nI.mjs";
1
+ export { t as default } from "./effect-plugin-BiskbKO9.mjs";
@@ -1,8 +1,8 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Schema from "effect/Schema";
1
3
  import * as Arr from "effect/Array";
2
4
  import * as R from "effect/Record";
3
- import * as Schema from "effect/Schema";
4
5
  import { existsSync, readFileSync } from "node:fs";
5
- import * as Effect from "effect/Effect";
6
6
  import { dirname, join } from "node:path";
7
7
  import upstream from "@foldkit/oxlint-plugin";
8
8
  // src/foldkit-plugin.ts
package/dist/formal.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import * as Schema from "effect/Schema";
2
1
  import * as Effect from "effect/Effect";
2
+ import * as Schema from "effect/Schema";
3
3
  import * as Layer from "effect/Layer";
4
4
  import { ChildProcessSpawner } from "effect/process";
5
5
  import { FileSystem } from "effect/FileSystem";
package/dist/formal.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env bun
2
- import { n as criticalFindings, t as decode } from "./specs-file-NsQF4V7X.mjs";
2
+ import { n as criticalFindings, t as decode } from "./specs-file-Ck9ZOt46.mjs";
3
3
  import { i as sorted, r as receiptPath, t as FORMAL_TRACES } from "./trace-file-KuPRWgwt.mjs";
4
- import * as Data from "effect/Data";
5
- import * as Option from "effect/Option";
6
- import * as Schema from "effect/Schema";
7
4
  import * as Config from "effect/Config";
5
+ import * as Console from "effect/Console";
8
6
  import * as Effect from "effect/Effect";
7
+ import * as Schema from "effect/Schema";
8
+ import * as Data from "effect/Data";
9
+ import * as Option from "effect/Option";
9
10
  import { basename, dirname, join, relative } from "node:path";
10
11
  import { NodeServices } from "@effect/platform-node";
11
12
  import * as Cause from "effect/Cause";
12
- import * as Console from "effect/Console";
13
13
  import * as Exit from "effect/Exit";
14
14
  import * as Layer from "effect/Layer";
15
15
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
@@ -1,16 +1,16 @@
1
- import { d as otherTags, l as latestOf, u as onLatestLine } from "./compatible-D54mCSlT.mjs";
1
+ import { d as otherTags, l as latestOf, u as onLatestLine } from "./compatible-CRaMYpBM.mjs";
2
2
  import { i as enforcedTsgoRules } from "./effect-tsgo-D0QfeKGD.mjs";
3
3
  import { t as exceptions } from "./exceptions-Dybl9xpc.mjs";
4
- import { a as toolchainScopes, n as effectRules, r as foldkitPreset, t as birbprophetRules } from "./lint-BJ6SmGk1.mjs";
5
- import { c as lead, f as versionOf } from "./versions-DpRzgSR_.mjs";
4
+ import { a as toolchainScopes, n as effectRules, r as foldkitPreset, t as birbprophetRules } from "./lint-CiO5Etue.mjs";
5
+ import { c as lead, f as versionOf } from "./versions-KbYa8kbF.mjs";
6
+ import * as Effect from "effect/Effect";
7
+ import * as Schema from "effect/Schema";
6
8
  import * as Arr from "effect/Array";
7
9
  import { dual } from "effect/Function";
8
10
  import * as HashSet from "effect/HashSet";
9
11
  import * as Option from "effect/Option";
10
12
  import * as R from "effect/Record";
11
- import * as Schema from "effect/Schema";
12
13
  import * as Str from "effect/String";
13
- import * as Effect from "effect/Effect";
14
14
  import * as Result from "effect/Result";
15
15
  // src/standard/manifest.ts
16
16
  const Versions = Schema.Record(Schema.String, Schema.String).pipe(Schema.withDecodingDefaultKey(Effect.succeed({})));
package/dist/guard.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { r as Packuments } from "./compatible-DIYO9MZf.mjs";
1
+ import { r as Packuments } from "./compatible-BKEJ_p20.mjs";
2
2
  import { t as Exception } from "./exceptions-LNZ022dl.mjs";
3
3
  import { t as Catalog } from "./versions-DqZd0jF9.mjs";
4
4
  import { OxlintConfig } from "vite-plus/lint";
package/dist/guard.mjs CHANGED
@@ -1 +1 @@
1
- export { c as exactFindings, t as exceptionFindings, n as foldkitViteFindings, r as isFoldkitViteInput, l as manifestRanges, i as pinFindings, a as ruleFindings, o as tagFindings } from "./guard-fFg_0NIp.mjs";
1
+ export { c as exactFindings, t as exceptionFindings, n as foldkitViteFindings, r as isFoldkitViteInput, l as manifestRanges, i as pinFindings, a as ruleFindings, o as tagFindings } from "./guard-CAm90ZGy.mjs";
package/dist/hooks.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import * as Schema from "effect/Schema";
2
1
  import * as Effect from "effect/Effect";
2
+ import * as Schema from "effect/Schema";
3
3
  import { FileSystem } from "effect/FileSystem";
4
4
  import { Path } from "effect/Path";
5
5
  export declare const worktreePrePush = "#!/bin/sh\nif ! root=$(git rev-parse --show-toplevel); then\n printf '%s\\n' 'pre-push: could not determine the invoking worktree root' >&2\n exit 1\nfi\nif [ ! -f \"$root/node_modules/.bin/vp\" ] || [ ! -x \"$root/node_modules/.bin/vp\" ]; then\n printf '%s\\n' \"pre-push: missing or nonexecutable $root/node_modules/.bin/vp\" >&2\n exit 1\nfi\nif [ ! -f \"$root/.vite-hooks/pre-push\" ]; then\n printf '%s\\n' \"pre-push: missing $root/.vite-hooks/pre-push\" >&2\n exit 1\nfi\nif ! git -C \"$root\" ls-files --error-unmatch .vite-hooks/pre-push >/dev/null 2>&1; then\n printf '%s\\n' \"pre-push: untracked $root/.vite-hooks/pre-push\" >&2\n exit 1\nfi\nexport PATH=\"$root/node_modules/.bin:$PATH\"\nexec /bin/sh -e \"$root/.vite-hooks/pre-push\" \"$@\"\n";
package/dist/hooks.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import * as Arr from "effect/Array";
1
+ import * as Effect from "effect/Effect";
2
2
  import * as Schema from "effect/Schema";
3
+ import * as Arr from "effect/Array";
3
4
  import * as Str from "effect/String";
4
- import * as Effect from "effect/Effect";
5
5
  import { ChildProcess } from "effect/process";
6
6
  import * as Stream from "effect/Stream";
7
7
  import { FileSystem } from "effect/FileSystem";
@@ -1,12 +1,12 @@
1
- import { t as plugin } from "./effect-plugin-BsrW5_nI.mjs";
1
+ import { t as plugin } from "./effect-plugin-BiskbKO9.mjs";
2
2
  import { n as effectTsgoPlugin, r as effectTsgoRules } from "./effect-tsgo-D0QfeKGD.mjs";
3
3
  import { t as exceptions } from "./exceptions-Dybl9xpc.mjs";
4
- import { t as plugin$1 } from "./plugin-CwxhPtui.mjs";
4
+ import { t as plugin$1 } from "./plugin-DwQM07Ih.mjs";
5
5
  import { t as staticRules } from "./rules-vHmNoAU0.mjs";
6
+ import * as Schema from "effect/Schema";
6
7
  import * as Arr from "effect/Array";
7
8
  import * as Option from "effect/Option";
8
9
  import * as R from "effect/Record";
9
- import * as Schema from "effect/Schema";
10
10
  import * as Str from "effect/String";
11
11
  import foldkitRecommended from "@foldkit/oxlint-plugin/recommended.json" with { type: "json" };
12
12
  import ultraciteCore from "ultracite/oxlint/core";
package/dist/lint.mjs CHANGED
@@ -1 +1 @@
1
- export { t as birbprophetRules, n as effectRules, r as foldkitPreset, i as lint, a as toolchainScopes } from "./lint-BJ6SmGk1.mjs";
1
+ export { t as birbprophetRules, n as effectRules, r as foldkitPreset, i as lint, a as toolchainScopes } from "./lint-CiO5Etue.mjs";
@@ -1,10 +1,10 @@
1
- import { i as unwrapExpression, n as memberPropertyName, r as propertyName, t as isStringLiteral } from "./syntax-CGEOffZK.mjs";
1
+ import { i as unwrapExpression, n as memberPropertyName, r as propertyName, t as isStringLiteral } from "./syntax-B3n7lDYJ.mjs";
2
+ import * as Effect from "effect/Effect";
2
3
  import * as Arr from "effect/Array";
3
4
  import { dual } from "effect/Function";
4
5
  import * as HashSet from "effect/HashSet";
5
6
  import * as Option from "effect/Option";
6
7
  import * as Str from "effect/String";
7
- import * as Effect from "effect/Effect";
8
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
package/dist/plugin.mjs CHANGED
@@ -1 +1 @@
1
- export { t as default } from "./plugin-CwxhPtui.mjs";
1
+ export { t as default } from "./plugin-DwQM07Ih.mjs";
package/dist/proof.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env bun
2
- import * as Data from "effect/Data";
3
- import * as Schema from "effect/Schema";
4
2
  import * as Config from "effect/Config";
5
3
  import * as Effect from "effect/Effect";
4
+ import * as Redacted from "effect/Redacted";
5
+ import * as Schema from "effect/Schema";
6
+ import * as Data from "effect/Data";
6
7
  import { NodeServices } from "@effect/platform-node";
7
8
  import * as Cause from "effect/Cause";
8
9
  import * as Exit from "effect/Exit";
@@ -12,7 +13,6 @@ import { FileSystem } from "effect/FileSystem";
12
13
  import { Path } from "effect/Path";
13
14
  import { Octokit } from "@octokit/rest";
14
15
  import { Base64 } from "effect/encoding";
15
- import * as Redacted from "effect/Redacted";
16
16
  // src/proof.ts
17
17
  var ProofError = class extends Data.TaggedError("ProofError") {};
18
18
  const kinds = /* @__PURE__ */ new Map([
@@ -0,0 +1,73 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { parse } from "yaml";
3
+ // src/renovate-ci.ts
4
+ const headRequest = "github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)";
5
+ const renovateRequest = "github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository";
6
+ const readyRequest = `github.event_name == 'push' || (github.event.pull_request.draft == false && !startsWith(github.head_ref, 'probe/') && ((${headRequest}) || (${renovateRequest})))`;
7
+ const budgetRequest = `github.event_name == 'pull_request' && github.event.pull_request.draft == false && (${renovateRequest})`;
8
+ const checksRequest = `always() && (${readyRequest}) && (needs.budget.result == 'success' || needs.budget.result == 'skipped')`;
9
+ const resultRequest = `always() && (${readyRequest})`;
10
+ const readyGroup = `\${{ github.workflow }}-\${{ github.event_name == 'pull_request' && !((${headRequest}) || (${renovateRequest})) && format('label-{0}-{1}', github.event.pull_request.number, github.event.label.name) || github.event.pull_request.number || github.ref }}`;
11
+ const readyCancellation = `\${{ github.event_name == 'pull_request' && ((${headRequest}) || (${renovateRequest})) }}`;
12
+ const readyRunName = `\${{ github.event_name == 'push' && format('ready {0} at {1}', github.ref_name, github.sha) || ((${headRequest}) || (${renovateRequest})) && format('ready #{0} at {1}', github.event.pull_request.number, github.event.pull_request.head.sha) || format('label {0} on #{1}', github.event.label.name, github.event.pull_request.number) }}`;
13
+ const BudgetStep = Schema.Struct({
14
+ if: Schema.optionalKey(Schema.Never),
15
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
16
+ run: Schema.Literal("vp exec ci-budget"),
17
+ env: Schema.Struct({ BOAT_API_KEY: Schema.Literal(`\${{ secrets.BOAT_CI_READ_KEY }}`) })
18
+ });
19
+ const ResultStep = Schema.Struct({
20
+ if: Schema.optionalKey(Schema.Never),
21
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
22
+ run: Schema.Literal("vp exec ci-result"),
23
+ env: Schema.Struct({ CI_RESULT: Schema.Literal(`\${{ needs.checks.result }}`) })
24
+ });
25
+ const Workflow = Schema.Struct({
26
+ on: Schema.Struct({
27
+ push: Schema.Struct({ branches: Schema.Array(Schema.String) }),
28
+ pull_request: Schema.Struct({ types: Schema.Array(Schema.String) })
29
+ }),
30
+ concurrency: Schema.Struct({
31
+ group: Schema.Literal(readyGroup),
32
+ "cancel-in-progress": Schema.Literal(readyCancellation)
33
+ }),
34
+ jobs: Schema.Struct({
35
+ budget: Schema.Struct({
36
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
37
+ if: Schema.Literal(budgetRequest),
38
+ "runs-on": Schema.Literal("ubuntu-24.04"),
39
+ steps: Schema.Array(Schema.Unknown)
40
+ }),
41
+ checks: Schema.Struct({
42
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
43
+ needs: Schema.Literal("budget"),
44
+ if: Schema.Literal(checksRequest)
45
+ }),
46
+ ready: Schema.Struct({
47
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
48
+ needs: Schema.Array(Schema.String),
49
+ if: Schema.Literal(resultRequest),
50
+ "runs-on": Schema.Literal("ubuntu-24.04"),
51
+ steps: Schema.Array(Schema.Unknown)
52
+ })
53
+ })
54
+ });
55
+ const Layout = Schema.Struct({
56
+ on: Schema.Record(Schema.String, Schema.Unknown),
57
+ jobs: Schema.Record(Schema.String, Schema.Unknown)
58
+ });
59
+ const MainOnlyJob = Schema.Struct({ if: Schema.Literal("github.event_name == 'push'") });
60
+ const isRenovateCi = (text) => {
61
+ const parsed = parse(text);
62
+ const decoded = Schema.decodeUnknownOption(Workflow)(parsed);
63
+ if (decoded._tag === "None") return false;
64
+ const layout = Schema.decodeUnknownSync(Layout)(parsed);
65
+ const push = Schema.decodeUnknownSync(Schema.Record(Schema.String, Schema.Unknown))(layout.on.push);
66
+ const workflow = decoded.value;
67
+ return Object.keys(layout.on).toSorted().join(",") === "pull_request,push" && Object.keys(push).join(",") === "branches" && workflow.on.push.branches.join(",") === "main" && Object.entries(layout.jobs).every(([name, job]) => [
68
+ "budget",
69
+ "checks",
70
+ "ready"
71
+ ].includes(name) || Schema.is(MainOnlyJob)(job)) && workflow.on.pull_request.types.join(",") === "labeled,opened,synchronize,reopened,ready_for_review" && workflow.jobs.ready.needs.join(",") === "budget,checks" && workflow.jobs.budget.steps.some(Schema.is(BudgetStep)) && workflow.jobs.ready.steps.some(Schema.is(ResultStep));
72
+ };
73
+ export { readyCancellation as a, readyRunName as c, isRenovateCi as i, renovateRequest as l, checksRequest as n, readyGroup as o, headRequest as r, readyRequest as s, budgetRequest as t, resultRequest as u };
@@ -0,0 +1,10 @@
1
+ export declare const headRequest = "github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)";
2
+ export declare const renovateRequest = "github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository";
3
+ export declare const readyRequest = "github.event_name == 'push' || (github.event.pull_request.draft == false && !startsWith(github.head_ref, 'probe/') && ((github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)) || (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository)))";
4
+ export declare const budgetRequest = "github.event_name == 'pull_request' && github.event.pull_request.draft == false && (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository)";
5
+ export declare const checksRequest = "always() && (github.event_name == 'push' || (github.event.pull_request.draft == false && !startsWith(github.head_ref, 'probe/') && ((github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)) || (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository)))) && (needs.budget.result == 'success' || needs.budget.result == 'skipped')";
6
+ export declare const resultRequest = "always() && (github.event_name == 'push' || (github.event.pull_request.draft == false && !startsWith(github.head_ref, 'probe/') && ((github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)) || (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository))))";
7
+ export declare const readyGroup = "${{ github.workflow }}-${{ github.event_name == 'pull_request' && !((github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)) || (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository)) && format('label-{0}-{1}', github.event.pull_request.number, github.event.label.name) || github.event.pull_request.number || github.ref }}";
8
+ export declare const readyCancellation = "${{ github.event_name == 'pull_request' && ((github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)) || (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository)) }}";
9
+ export declare const readyRunName = "${{ github.event_name == 'push' && format('ready {0} at {1}', github.ref_name, github.sha) || ((github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)) || (github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository)) && format('ready #{0} at {1}', github.event.pull_request.number, github.event.pull_request.head.sha) || format('label {0} on #{1}', github.event.label.name, github.event.pull_request.number) }}";
10
+ export declare const isRenovateCi: (text: string) => boolean;
@@ -0,0 +1 @@
1
+ export { t as budgetRequest, n as checksRequest, r as headRequest, i as isRenovateCi, a as readyCancellation, o as readyGroup, s as readyRequest, c as readyRunName, l as renovateRequest, u as resultRequest } from "./renovate-ci-BdVmECgm.mjs";
package/dist/standard.mjs CHANGED
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env bun
2
- import { f as versionOf } from "./versions-DpRzgSR_.mjs";
3
- import { a as ruleFindings, c as exactFindings, l as manifestRanges, s as PLAIN, u as resolveCatalog } from "./guard-fFg_0NIp.mjs";
2
+ import { f as versionOf } from "./versions-KbYa8kbF.mjs";
3
+ import { a as ruleFindings, c as exactFindings, l as manifestRanges, s as PLAIN, u as resolveCatalog } from "./guard-CAm90ZGy.mjs";
4
4
  import { t as fmt } from "./fmt-C6autuPP.mjs";
5
- import { n as criticalFindings, t as decode } from "./specs-file-NsQF4V7X.mjs";
5
+ import { n as criticalFindings, t as decode } from "./specs-file-Ck9ZOt46.mjs";
6
+ import * as Console from "effect/Console";
7
+ import * as Effect from "effect/Effect";
8
+ import * as Schema from "effect/Schema";
6
9
  import * as Arr from "effect/Array";
7
10
  import * as Option from "effect/Option";
8
11
  import * as R from "effect/Record";
9
- import * as Schema from "effect/Schema";
10
- import * as Effect from "effect/Effect";
11
12
  import { posix } from "node:path";
12
13
  import { NodeServices } from "@effect/platform-node";
13
14
  import * as Cause from "effect/Cause";
14
- import * as Console from "effect/Console";
15
15
  import * as Exit from "effect/Exit";
16
16
  import { ChildProcess } from "effect/process";
17
17
  import * as Stream from "effect/Stream";
package/dist/starts.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { i as isRenovateCi } from "./renovate-ci-BdVmECgm.mjs";
1
2
  import * as Schema from "effect/Schema";
2
3
  import { parse } from "yaml";
3
4
  // src/starts/policy.ts
@@ -51,7 +52,8 @@ const boatJobFindings = (files) => {
51
52
  for (const [path, text] of files) try {
52
53
  workflows.push({
53
54
  path,
54
- workflow: Schema.decodeUnknownSync(Workflow)(parse(text))
55
+ workflow: Schema.decodeUnknownSync(Workflow)(parse(text)),
56
+ renovate: isRenovateCi(text)
55
57
  });
56
58
  } catch {
57
59
  findings.push(`${path}: workflow unread`);
@@ -122,7 +124,7 @@ const boatJobFindings = (files) => {
122
124
  };
123
125
  for (const entry of workflows) {
124
126
  const total = count(entry, [], true);
125
- if (total > 0 && startsOnPr(entry.workflow.on)) findings.push(`${entry.path}: a pull_request or PR-branch push starts ${total} Boat jobs; PR ready starts on request`);
127
+ if (total > 0 && startsOnPr(entry.workflow.on) && !entry.renovate) findings.push(`${entry.path}: a pull_request or PR-branch push starts ${total} Boat jobs; PR ready starts on request`);
126
128
  if (total > 2) findings.push(`${entry.path}: closure starts ${total} Boat jobs, limit 2`);
127
129
  }
128
130
  return [...new Set(findings)];
@@ -1,3 +1,3 @@
1
- import { i as VerificationError } from "./verification-FgQFU1YN.mjs";
1
+ import { i as VerificationError } from "./verification-fnhfrxmy.mjs";
2
2
  import * as Effect from "effect/Effect";
3
3
  export declare const checkVerdict: Effect.Effect<number, import("effect/Config").ConfigError | import("effect/PlatformError").PlatformError | import("effect/Schema").SchemaError | VerificationError, import("effect/FileSystem").FileSystem>;
package/dist/verdict.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env bun
2
- import { a as readPullRequest, i as github, n as autoPass } from "./verification-oAc1Q6I9.mjs";
2
+ import { a as readPullRequest, i as github, n as autoPass } from "./verification-D4Sn2fh5.mjs";
3
+ import * as Console from "effect/Console";
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
- import * as Console from "effect/Console";
7
7
  import * as Exit from "effect/Exit";
8
8
  // src/verdict.ts
9
9
  const checkVerdict = Effect.gen(function* () {
@@ -1,6 +1,6 @@
1
- import * as Schema from "effect/Schema";
2
1
  import * as Config from "effect/Config";
3
2
  import * as Effect from "effect/Effect";
3
+ import * as Schema from "effect/Schema";
4
4
  import * as Cause from "effect/Cause";
5
5
  import { FileSystem } from "effect/FileSystem";
6
6
  import { Octokit } from "@octokit/rest";
@@ -1,2 +1,2 @@
1
- import { a as autoPass, c as readPullRequest, i as VerificationError, l as verdict, n as PullRequestContext, o as checkVerification, r as Verdict, s as github, t as PullRequest } from "./verification-FgQFU1YN.mjs";
1
+ import { a as autoPass, c as readPullRequest, i as VerificationError, l as verdict, n as PullRequestContext, o as checkVerification, r as Verdict, s as github, t as PullRequest } from "./verification-fnhfrxmy.mjs";
2
2
  export { PullRequest, PullRequestContext, Verdict, VerificationError, autoPass, checkVerification, github, readPullRequest, verdict };
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- export { t as VerificationError, n as autoPass, r as checkVerification, i as github, a as readPullRequest, o as verdict } from "./verification-oAc1Q6I9.mjs";
2
+ export { t as VerificationError, n as autoPass, r as checkVerification, i as github, a as readPullRequest, o as verdict } from "./verification-D4Sn2fh5.mjs";
package/dist/versions.mjs CHANGED
@@ -1 +1 @@
1
- export { t as catalog, n as families, r as familyNamed, i as familyOf, a as fixed, o as fixedBy, s as fixedOf, c as lead, l as nodeVersion, u as ownerOf, d as pinned, f as versionOf, p as versions } from "./versions-DpRzgSR_.mjs";
1
+ export { t as catalog, n as families, r as familyNamed, i as familyOf, a as fixed, o as fixedBy, s as fixedOf, c as lead, l as nodeVersion, u as ownerOf, d as pinned, f as versionOf, p as versions } from "./versions-KbYa8kbF.mjs";
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@milkenjoyer/toolchain",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/birbprophet/agent-kit.git",
7
7
  "directory": "packages/toolchain"
8
8
  },
9
9
  "bin": {
10
+ "ci-budget": "./src/ci-budget-cli.ts",
11
+ "ci-result": "./src/ci-result.ts",
10
12
  "formal": "./src/formal.ts",
11
13
  "proof": "./src/proof.ts",
12
14
  "standard": "./src/standard.ts",
@@ -99,6 +101,14 @@
99
101
  "./conformance": {
100
102
  "types": "./dist/conformance.d.mts",
101
103
  "default": "./dist/conformance.mjs"
104
+ },
105
+ "./ci-budget": {
106
+ "types": "./dist/ci-budget.d.mts",
107
+ "default": "./dist/ci-budget.mjs"
108
+ },
109
+ "./renovate-ci": {
110
+ "types": "./dist/renovate-ci.d.mts",
111
+ "default": "./dist/renovate-ci.mjs"
102
112
  }
103
113
  },
104
114
  "publishConfig": {
@@ -108,6 +118,7 @@
108
118
  "prepack": "vp pack"
109
119
  },
110
120
  "dependencies": {
121
+ "@boatdev/sdk": "1.13.0",
111
122
  "@effect/platform-node": "4.1.4",
112
123
  "@effect/tsgo": "0.69.0",
113
124
  "@foldkit/oxlint-plugin": "0.15.4",
package/renovate.json CHANGED
@@ -14,6 +14,21 @@
14
14
  }
15
15
  ],
16
16
  "packageRules": [
17
+ {
18
+ "matchUpdateTypes": ["minor", "patch"],
19
+ "extends": ["schedule:weekly"],
20
+ "automerge": true
21
+ },
22
+ {
23
+ "matchUpdateTypes": ["minor", "patch"],
24
+ "matchDatasources": ["npm"],
25
+ "minimumReleaseAge": "3 days"
26
+ },
27
+ {
28
+ "matchUpdateTypes": ["major"],
29
+ "matchPackageNames": ["java-jre", "ubuntu"],
30
+ "enabled": false
31
+ },
17
32
  {
18
33
  "description": "Renovate refreshes bun.lock only for updates its bun manager found, so a catalog-only update leaves bun.lock stale and a frozen install fails",
19
34
  "matchManagers": ["custom.jsonata"],
@@ -39,7 +54,8 @@
39
54
  ],
40
55
  "followTag": "latest",
41
56
  "minimumReleaseAge": "0 days",
42
- "rangeStrategy": "pin"
57
+ "rangeStrategy": "pin",
58
+ "schedule": ["at any time"]
43
59
  },
44
60
  {
45
61
  "matchDepNames": [
@@ -74,12 +90,22 @@
74
90
  "matchPackageNames": ["@milkenjoyer/toolchain"],
75
91
  "prBodyNotes": [
76
92
  "This toolchain release moves `vite-plus`, the catalog's `vite` alias, `vitest`, `@vitest/browser-*` and `@effect/tsgo` together, which Renovate leaves to this PR. Set each to what the release requires (`npm view @milkenjoyer/toolchain@<version> peerDependencies dependencies`, then `npm view vite-plus@<version> dependencies`) and run `vp install` before `ready`."
77
- ]
93
+ ],
94
+ "automerge": false
78
95
  },
79
96
  {
80
97
  "description": "engines.node is a >= floor that tests hold to the toolchain's Node version, which .node-version pins, so Renovate replaces it only when a release falls outside it and never pins it",
81
98
  "matchDepTypes": ["engines"],
82
99
  "rangeStrategy": "replace"
100
+ },
101
+ {
102
+ "description": "Catalog updates need bun.lock refreshed by hand until renovatebot/renovate#42909 lands",
103
+ "matchManagers": ["custom.jsonata"],
104
+ "matchUpdateTypes": ["minor", "patch"],
105
+ "groupName": "workspace catalog",
106
+ "groupSlug": "workspace-catalog",
107
+ "automerge": false
83
108
  }
84
- ]
109
+ ],
110
+ "extends": ["group:allNonMajor"]
85
111
  }
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env bun
2
+ import { BoatApi, Configuration } from "@boatdev/sdk";
3
+ import * as Config from "effect/Config";
4
+ import * as Console from "effect/Console";
5
+ import * as DateTime from "effect/DateTime";
6
+ import * as Effect from "effect/Effect";
7
+ import * as Redacted from "effect/Redacted";
8
+ import * as Schema from "effect/Schema";
9
+
10
+ import { monthlyCiBudget, readMonthlyCiSpend } from "./ci-budget.ts";
11
+
12
+ class CiMeterUnread extends Schema.TaggedError<
13
+ CiMeterUnread,
14
+ { readonly brand: unique symbol }
15
+ >()("CiMeterUnread", {}) {}
16
+
17
+ export const checkCiBudget = Effect.gen(function* () {
18
+ const key = yield* Config.Redacted("BOAT_API_KEY");
19
+ const boat = new BoatApi(
20
+ new Configuration({ accessToken: Redacted.value(key) })
21
+ );
22
+ const now = yield* DateTime.nowAsDate;
23
+ const spend = yield* Effect.tryPromise({
24
+ try: () => readMonthlyCiSpend({ boat, now }),
25
+ catch: () => new CiMeterUnread(),
26
+ });
27
+ const budget = monthlyCiBudget(spend);
28
+ yield* Console.log({ ...budget, spend });
29
+ return budget._tag === "Allowed" ? 0 : 1;
30
+ }).pipe(
31
+ Effect.catch(() =>
32
+ Effect.as(
33
+ Console.error("Boat CI monthly meter unread; no Boat job admitted"),
34
+ 1
35
+ )
36
+ )
37
+ );
38
+
39
+ if (import.meta.main) process.exitCode = await Effect.runPromise(checkCiBudget);
@@ -0,0 +1,116 @@
1
+ import type { BoatApi } from "@boatdev/sdk";
2
+ import * as Schema from "effect/Schema";
3
+
4
+ const Nonnegative = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));
5
+ const Cost = Schema.Struct({ since: Schema.String, dollars: Nonnegative });
6
+ const Page = Schema.Struct({
7
+ sandboxes: Schema.Array(
8
+ Schema.Struct({ id: Schema.String, name: Schema.String, cost: Cost })
9
+ ),
10
+ deletedCost: Cost,
11
+ pageInfo: Schema.Struct({
12
+ hasMore: Schema.Boolean,
13
+ nextCursor: Schema.NullOr(Schema.String),
14
+ }),
15
+ });
16
+ export type MonthlyCiSpend = {
17
+ readonly since: string;
18
+ readonly readAt: string;
19
+ readonly dollars: number;
20
+ readonly deletedDollars: number;
21
+ readonly sandboxes: number;
22
+ };
23
+ export const monthlyCiBudget = (
24
+ spend: MonthlyCiSpend
25
+ ):
26
+ | {
27
+ readonly _tag: "Refused";
28
+ readonly reason: string;
29
+ readonly since: string;
30
+ readonly dollars: number;
31
+ }
32
+ | {
33
+ readonly _tag: "Allowed";
34
+ readonly dollars: number;
35
+ readonly warning: string | null;
36
+ } => {
37
+ const dollars = Schema.decodeSync(Nonnegative)(spend.dollars);
38
+ const warning =
39
+ dollars >= 160
40
+ ? `Boat CI month-to-date $${dollars.toFixed(2)} has reached 80% of the $200 monthly budget`
41
+ : null;
42
+ return dollars >= 200
43
+ ? {
44
+ _tag: "Refused",
45
+ reason: `Boat CI month-to-date $${dollars.toFixed(2)} >= $200 monthly CI budget; no CI requested`,
46
+ since: spend.since,
47
+ dollars,
48
+ }
49
+ : { _tag: "Allowed", dollars, warning };
50
+ };
51
+
52
+ export const readMonthlyCiSpend = async ({
53
+ boat,
54
+ now,
55
+ }: {
56
+ readonly boat: BoatApi;
57
+ readonly now: Date;
58
+ }): Promise<MonthlyCiSpend> => {
59
+ const since = new Date(
60
+ Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1)
61
+ ).toISOString();
62
+ const monthly = boat.withPreMiddleware(({ url, init }) => {
63
+ const request = new URL(url);
64
+ request.searchParams.set("include", "cost,deletedCost");
65
+ return Promise.resolve({ url: request.href, init });
66
+ });
67
+ const ids = new Set<string>();
68
+ const cursors = new Set<string>();
69
+ let cursor: string | undefined;
70
+ let deletedDollars: number | undefined;
71
+ let dollars = 0;
72
+ for (;;) {
73
+ const response = await monthly.sandboxesRaw({
74
+ namePrefix: "ci-",
75
+ include: "cost",
76
+ limit: 200,
77
+ sort: "asc",
78
+ ...(cursor === undefined ? {} : { cursor }),
79
+ });
80
+ const page = Schema.decodeUnknownSync(Page)(await response.raw.json());
81
+ if (
82
+ page.deletedCost.since !== since ||
83
+ page.sandboxes.some(({ cost }) => cost.since !== since)
84
+ )
85
+ throw new Error("Monthly Boat CI meter changed month; read again");
86
+ if (
87
+ deletedDollars !== undefined &&
88
+ deletedDollars !== page.deletedCost.dollars
89
+ )
90
+ throw new Error(
91
+ "Monthly Boat CI deleted cost changed during pagination; read again"
92
+ );
93
+ deletedDollars = page.deletedCost.dollars;
94
+ for (const sandbox of page.sandboxes) {
95
+ if (!sandbox.name.startsWith("ci-") || ids.has(sandbox.id))
96
+ throw new Error(
97
+ "Monthly Boat CI page contains an unexpected or repeated sandbox"
98
+ );
99
+ ids.add(sandbox.id);
100
+ dollars += sandbox.cost.dollars;
101
+ }
102
+ if (!page.pageInfo.hasMore) break;
103
+ const next = page.pageInfo.nextCursor;
104
+ if (next === null || cursors.has(next))
105
+ throw new Error("Monthly Boat CI pagination is incomplete");
106
+ cursors.add(next);
107
+ cursor = next;
108
+ }
109
+ return {
110
+ since,
111
+ readAt: now.toISOString(),
112
+ dollars: Schema.decodeSync(Nonnegative)(dollars + deletedDollars),
113
+ deletedDollars,
114
+ sandboxes: ids.size,
115
+ };
116
+ };
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env bun
2
+ import * as Config from "effect/Config";
3
+ import * as Console from "effect/Console";
4
+ import * as Effect from "effect/Effect";
5
+
6
+ const result = Effect.gen(function* () {
7
+ const checks = yield* Config.String("CI_RESULT");
8
+ yield* Console.log(`Ready checks: ${checks}`);
9
+ return checks === "success" ? 0 : 1;
10
+ }).pipe(Effect.orElseSucceed(() => 1));
11
+
12
+ if (import.meta.main) process.exitCode = await Effect.runPromise(result);
@@ -0,0 +1,96 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { parse } from "yaml";
3
+
4
+ export const headRequest =
5
+ "github.event.action == 'labeled' && github.event.label.name == format('ready:{0}', github.event.pull_request.head.sha)";
6
+ export const renovateRequest =
7
+ "github.event.action != 'labeled' && github.event.pull_request.user.login == 'renovate[bot]' && github.event.pull_request.head.repo.full_name == github.repository";
8
+ export const readyRequest = `github.event_name == 'push' || (github.event.pull_request.draft == false && !startsWith(github.head_ref, 'probe/') && ((${headRequest}) || (${renovateRequest})))`;
9
+ export const budgetRequest = `github.event_name == 'pull_request' && github.event.pull_request.draft == false && (${renovateRequest})`;
10
+ export const checksRequest = `always() && (${readyRequest}) && (needs.budget.result == 'success' || needs.budget.result == 'skipped')`;
11
+ export const resultRequest = `always() && (${readyRequest})`;
12
+ export const readyGroup = `\${{ github.workflow }}-\${{ github.event_name == 'pull_request' && !((${headRequest}) || (${renovateRequest})) && format('label-{0}-{1}', github.event.pull_request.number, github.event.label.name) || github.event.pull_request.number || github.ref }}`;
13
+ export const readyCancellation = `\${{ github.event_name == 'pull_request' && ((${headRequest}) || (${renovateRequest})) }}`;
14
+ export const readyRunName = `\${{ github.event_name == 'push' && format('ready {0} at {1}', github.ref_name, github.sha) || ((${headRequest}) || (${renovateRequest})) && format('ready #{0} at {1}', github.event.pull_request.number, github.event.pull_request.head.sha) || format('label {0} on #{1}', github.event.label.name, github.event.pull_request.number) }}`;
15
+
16
+ const BudgetStep = Schema.Struct({
17
+ if: Schema.optionalKey(Schema.Never),
18
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
19
+ run: Schema.Literal("vp exec ci-budget"),
20
+ env: Schema.Struct({
21
+ BOAT_API_KEY: Schema.Literal(`\${{ secrets.BOAT_CI_READ_KEY }}`),
22
+ }),
23
+ });
24
+ const ResultStep = Schema.Struct({
25
+ if: Schema.optionalKey(Schema.Never),
26
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
27
+ run: Schema.Literal("vp exec ci-result"),
28
+ env: Schema.Struct({
29
+ CI_RESULT: Schema.Literal(`\${{ needs.checks.result }}`),
30
+ }),
31
+ });
32
+ const Workflow = Schema.Struct({
33
+ on: Schema.Struct({
34
+ push: Schema.Struct({ branches: Schema.Array(Schema.String) }),
35
+ pull_request: Schema.Struct({ types: Schema.Array(Schema.String) }),
36
+ }),
37
+ concurrency: Schema.Struct({
38
+ group: Schema.Literal(readyGroup),
39
+ "cancel-in-progress": Schema.Literal(readyCancellation),
40
+ }),
41
+ jobs: Schema.Struct({
42
+ budget: Schema.Struct({
43
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
44
+ if: Schema.Literal(budgetRequest),
45
+ "runs-on": Schema.Literal("ubuntu-24.04"),
46
+ steps: Schema.Array(Schema.Unknown),
47
+ }),
48
+ checks: Schema.Struct({
49
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
50
+ needs: Schema.Literal("budget"),
51
+ if: Schema.Literal(checksRequest),
52
+ }),
53
+ ready: Schema.Struct({
54
+ "continue-on-error": Schema.optionalKey(Schema.Literal(false)),
55
+ needs: Schema.Array(Schema.String),
56
+ if: Schema.Literal(resultRequest),
57
+ "runs-on": Schema.Literal("ubuntu-24.04"),
58
+ steps: Schema.Array(Schema.Unknown),
59
+ }),
60
+ }),
61
+ });
62
+
63
+ const Layout = Schema.Struct({
64
+ on: Schema.Record(Schema.String, Schema.Unknown),
65
+ jobs: Schema.Record(Schema.String, Schema.Unknown),
66
+ });
67
+
68
+ const MainOnlyJob = Schema.Struct({
69
+ if: Schema.Literal("github.event_name == 'push'"),
70
+ });
71
+
72
+ export const isRenovateCi = (text: string): boolean => {
73
+ const parsed: unknown = parse(text);
74
+ const decoded = Schema.decodeUnknownOption(Workflow)(parsed);
75
+ if (decoded._tag === "None") return false;
76
+ const layout = Schema.decodeUnknownSync(Layout)(parsed);
77
+ const push = Schema.decodeUnknownSync(
78
+ Schema.Record(Schema.String, Schema.Unknown)
79
+ )(layout.on.push);
80
+ const workflow = decoded.value;
81
+ return (
82
+ Object.keys(layout.on).toSorted().join(",") === "pull_request,push" &&
83
+ Object.keys(push).join(",") === "branches" &&
84
+ workflow.on.push.branches.join(",") === "main" &&
85
+ Object.entries(layout.jobs).every(
86
+ ([name, job]) =>
87
+ ["budget", "checks", "ready"].includes(name) ||
88
+ Schema.is(MainOnlyJob)(job)
89
+ ) &&
90
+ workflow.on.pull_request.types.join(",") ===
91
+ "labeled,opened,synchronize,reopened,ready_for_review" &&
92
+ workflow.jobs.ready.needs.join(",") === "budget,checks" &&
93
+ workflow.jobs.budget.steps.some(Schema.is(BudgetStep)) &&
94
+ workflow.jobs.ready.steps.some(Schema.is(ResultStep))
95
+ );
96
+ };
@@ -1,6 +1,8 @@
1
1
  import * as Schema from "effect/Schema";
2
2
  import { parse } from "yaml";
3
3
 
4
+ import { isRenovateCi } from "../renovate-ci.ts";
5
+
4
6
  export const BOAT_JOBS_PER_RUN = 2;
5
7
 
6
8
  const Matrix = Schema.Record(Schema.String, Schema.Array(Schema.Unknown));
@@ -43,6 +45,7 @@ type WorkflowFile = readonly [path: string, text: string];
43
45
  type Parsed = {
44
46
  readonly path: string;
45
47
  readonly workflow: typeof Workflow.Type;
48
+ readonly renovate: boolean;
46
49
  };
47
50
 
48
51
  const dynamic = (value: unknown): boolean => {
@@ -84,6 +87,7 @@ export const boatJobFindings = (
84
87
  workflows.push({
85
88
  path,
86
89
  workflow: Schema.decodeUnknownSync(Workflow)(parse(text)),
90
+ renovate: isRenovateCi(text),
87
91
  });
88
92
  } catch {
89
93
  findings.push(`${path}: workflow unread`);
@@ -186,7 +190,7 @@ export const boatJobFindings = (
186
190
  };
187
191
  for (const entry of workflows) {
188
192
  const total = count(entry, [], true);
189
- if (total > 0 && startsOnPr(entry.workflow.on))
193
+ if (total > 0 && startsOnPr(entry.workflow.on) && !entry.renovate)
190
194
  findings.push(
191
195
  `${entry.path}: a pull_request or PR-branch push starts ${total} Boat jobs; PR ready starts on request`
192
196
  );
@@ -1,5 +1,5 @@
1
- import * as Schema from "effect/Schema";
2
1
  import * as Effect from "effect/Effect";
2
+ import * as Schema from "effect/Schema";
3
3
  import * as Result from "effect/Result";
4
4
  import * as SchemaIssue from "effect/SchemaIssue";
5
5
  // src/formal/critical.ts
@@ -1,5 +1,5 @@
1
- import * as Option from "effect/Option";
2
1
  import * as Schema from "effect/Schema";
2
+ import * as Option from "effect/Option";
3
3
  // src/shared/syntax.ts
4
4
  const unwrapExpression = (node) => {
5
5
  if (node.type === "ParenthesizedExpression" || node.type === "ChainExpression" || node.type === "TSAsExpression" || node.type === "TSTypeAssertion" || node.type === "TSNonNullExpression" || node.type === "TSSatisfiesExpression") return unwrapExpression(node.expression);
@@ -1,14 +1,14 @@
1
- import * as Data from "effect/Data";
2
- import * as Schema from "effect/Schema";
3
1
  import * as Config from "effect/Config";
2
+ import * as Console from "effect/Console";
4
3
  import * as Effect from "effect/Effect";
4
+ import * as Redacted from "effect/Redacted";
5
+ import * as Schema from "effect/Schema";
6
+ import * as Data from "effect/Data";
5
7
  import { NodeServices } from "@effect/platform-node";
6
8
  import * as Cause from "effect/Cause";
7
- import * as Console from "effect/Console";
8
9
  import * as Exit from "effect/Exit";
9
10
  import { FileSystem } from "effect/FileSystem";
10
11
  import { Octokit } from "@octokit/rest";
11
- import * as Redacted from "effect/Redacted";
12
12
  // src/verification.ts
13
13
  const exemptions = [{
14
14
  reason: "Renovate PR",
@@ -1,8 +1,8 @@
1
+ import * as Schema from "effect/Schema";
1
2
  import * as Arr from "effect/Array";
2
3
  import { dual } from "effect/Function";
3
4
  import * as Option from "effect/Option";
4
5
  import * as R from "effect/Record";
5
- import * as Schema from "effect/Schema";
6
6
  import * as Str from "effect/String";
7
7
  // src/versions.ts
8
8
  const nodeVersion = "26.13.1";