@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
@@ -0,0 +1,512 @@
1
+ import * as Arr from "effect/Array";
2
+ import * as Data from "effect/Data";
3
+ import { dual } from "effect/Function";
4
+ import * as HashSet from "effect/HashSet";
5
+ import * as Match from "effect/Match";
6
+ import * as Option from "effect/Option";
7
+ import * as R from "effect/Record";
8
+ import * as Schema from "effect/Schema";
9
+ import * as Str from "effect/String";
10
+ import semver from "semver";
11
+
12
+ import {
13
+ type Catalog,
14
+ catalog,
15
+ type Family,
16
+ familyNamed,
17
+ familyOf,
18
+ type Fixed,
19
+ fixedBy,
20
+ fixedOf,
21
+ lead,
22
+ ownerOf,
23
+ versionOf,
24
+ } from "./versions.ts";
25
+
26
+ const Ranges = Schema.optionalKey(Schema.Record(Schema.String, Schema.String));
27
+
28
+ export const VersionManifest = Schema.Struct({
29
+ dependencies: Ranges,
30
+ peerDependencies: Ranges,
31
+ bundledVersions: Ranges,
32
+ });
33
+
34
+ export type VersionManifest = typeof VersionManifest.Type;
35
+
36
+ export const Packument = Schema.Struct({
37
+ "dist-tags": Schema.Record(Schema.String, Schema.String),
38
+ versions: Schema.Record(Schema.String, VersionManifest),
39
+ });
40
+
41
+ export type Packument = typeof Packument.Type;
42
+
43
+ export const Packuments = Schema.Record(Schema.String, Packument);
44
+
45
+ export type Packuments = typeof Packuments.Type;
46
+
47
+ type UnmetFields = {
48
+ readonly name: string;
49
+ readonly version: string;
50
+ readonly needs: string;
51
+ readonly range: string;
52
+ readonly actual: string;
53
+ };
54
+
55
+ export type Conflict = Data.TaggedEnum<{
56
+ Unpublished: { readonly name: string; readonly version: string };
57
+ Unmet: UnmetFields;
58
+ }>;
59
+
60
+ export const Conflict = Data.taggedEnum<Conflict>();
61
+
62
+ export type Solution = {
63
+ readonly resolved: boolean;
64
+ readonly catalog: Catalog;
65
+ readonly latest: Readonly<Record<string, string>>;
66
+ readonly blockers: Readonly<Record<string, string>>;
67
+ readonly conflicts: ReadonlyArray<Conflict>;
68
+ };
69
+
70
+ const ALIAS = /^npm:(?<target>(?:@[^/@]+\/)?[^@]+)@(?<version>.+)$/u;
71
+
72
+ type Lookup = (name: string) => Option.Option<string>;
73
+
74
+ const manifestOf = (
75
+ registry: Packuments,
76
+ name: string,
77
+ version: string
78
+ ): Option.Option<VersionManifest> =>
79
+ Option.flatMap(R.get(registry, name), (packument) =>
80
+ R.get(packument.versions, version)
81
+ );
82
+
83
+ export const latestOf: {
84
+ (family: Family): (registry: Packuments) => Option.Option<string>;
85
+ (registry: Packuments, family: Family): Option.Option<string>;
86
+ } = dual(2, (registry: Packuments, family: Family): Option.Option<string> =>
87
+ Option.flatMap(R.get(registry, lead(family)), (packument) =>
88
+ R.get(packument["dist-tags"], "latest")
89
+ )
90
+ );
91
+
92
+ export const otherTags: {
93
+ (
94
+ family: Family
95
+ ): (registry: Packuments) => ReadonlyArray<readonly [string, string]>;
96
+ (
97
+ registry: Packuments,
98
+ family: Family
99
+ ): ReadonlyArray<readonly [string, string]>;
100
+ } = dual(
101
+ 2,
102
+ (
103
+ registry: Packuments,
104
+ family: Family
105
+ ): ReadonlyArray<readonly [string, string]> =>
106
+ Arr.flatMap(family.packages, (name) =>
107
+ Option.match(R.get(registry, name), {
108
+ onNone: () => [],
109
+ onSome: (packument) =>
110
+ Arr.filter(
111
+ R.toEntries(packument["dist-tags"]),
112
+ ([tag]) => tag !== "latest"
113
+ ),
114
+ })
115
+ )
116
+ );
117
+
118
+ export const aliasTarget = (
119
+ alias: string
120
+ ): Option.Option<readonly [string, string]> =>
121
+ Option.flatMap(Option.fromNullishOr(ALIAS.exec(alias)?.groups), (groups) =>
122
+ Option.all([
123
+ Option.fromNullishOr(groups.target),
124
+ Option.fromNullishOr(groups.version),
125
+ ])
126
+ );
127
+
128
+ export const fixedRange: {
129
+ (
130
+ family: Family,
131
+ name: string
132
+ ): (registry: Packuments) => Option.Option<string>;
133
+ (registry: Packuments, family: Family, name: string): Option.Option<string>;
134
+ } = dual(
135
+ 3,
136
+ (registry: Packuments, family: Family, name: string): Option.Option<string> =>
137
+ Option.flatMap(
138
+ manifestOf(registry, lead(family), family.version),
139
+ ({ dependencies = {} }) => R.get(dependencies, name)
140
+ )
141
+ );
142
+
143
+ const anchored = (start: Catalog, name: string): boolean =>
144
+ Option.exists(ownerOf(name, start), (owner) =>
145
+ Arr.isReadonlyArrayNonEmpty(fixedBy(owner.name, start))
146
+ );
147
+
148
+ const requirements = (
149
+ start: Catalog,
150
+ name: string,
151
+ manifest: VersionManifest
152
+ ): ReadonlyArray<readonly [string, string]> => {
153
+ const { dependencies = {}, peerDependencies = {} } = manifest;
154
+
155
+ return [
156
+ ...(anchored(start, name) ? R.toEntries(dependencies) : []),
157
+ ...R.toEntries(peerDependencies),
158
+ ];
159
+ };
160
+
161
+ const holds = (
162
+ registry: Packuments,
163
+ needs: string,
164
+ actual: string,
165
+ range: string
166
+ ): boolean =>
167
+ Option.match(aliasTarget(actual), {
168
+ onNone: () =>
169
+ semver.validRange(range) !== null &&
170
+ semver.satisfies(actual, Str.replace(/^=/u, "")(range)),
171
+ onSome: ([target, version]) =>
172
+ range === actual ||
173
+ Option.exists(
174
+ Option.flatMap(
175
+ manifestOf(registry, target, version),
176
+ ({ bundledVersions = {} }) => R.get(bundledVersions, needs)
177
+ ),
178
+ (bundled) => semver.satisfies(bundled, range)
179
+ ),
180
+ });
181
+
182
+ const conflictsForManifest = (
183
+ registry: Packuments,
184
+ start: Catalog,
185
+ lookup: Lookup,
186
+ family: Family,
187
+ name: string,
188
+ manifest: VersionManifest
189
+ ): ReadonlyArray<Conflict> =>
190
+ Arr.flatMap(
191
+ requirements(start, name, manifest),
192
+ ([needs, range]): ReadonlyArray<Conflict> =>
193
+ Option.match(lookup(needs), {
194
+ onNone: () => [],
195
+ onSome: (actual) =>
196
+ holds(registry, needs, actual, range)
197
+ ? []
198
+ : [
199
+ Conflict.Unmet({
200
+ name,
201
+ version: family.version,
202
+ needs,
203
+ range,
204
+ actual,
205
+ }),
206
+ ],
207
+ })
208
+ );
209
+
210
+ const memberConflicts = (
211
+ registry: Packuments,
212
+ start: Catalog,
213
+ lookup: Lookup,
214
+ family: Family,
215
+ name: string
216
+ ): ReadonlyArray<Conflict> =>
217
+ Option.match(manifestOf(registry, name, family.version), {
218
+ onNone: (): ReadonlyArray<Conflict> =>
219
+ R.has(registry, name)
220
+ ? [Conflict.Unpublished({ name, version: family.version })]
221
+ : [],
222
+ onSome: (manifest) =>
223
+ conflictsForManifest(registry, start, lookup, family, name, manifest),
224
+ });
225
+
226
+ const conflictsAmong = (
227
+ registry: Packuments,
228
+ start: Catalog,
229
+ picked: ReadonlyArray<Family>,
230
+ lookup: Lookup
231
+ ): ReadonlyArray<Conflict> =>
232
+ Arr.flatMap(picked, (family) =>
233
+ Arr.flatMap(family.packages, (name) =>
234
+ memberConflicts(registry, start, lookup, family, name)
235
+ )
236
+ );
237
+
238
+ export const conflicts: {
239
+ (registry: Packuments): (current: Catalog) => ReadonlyArray<Conflict>;
240
+ (current: Catalog, registry: Packuments): ReadonlyArray<Conflict>;
241
+ } = dual(2, (current: Catalog, registry: Packuments): ReadonlyArray<Conflict> =>
242
+ conflictsAmong(registry, current, current.families, (name) =>
243
+ versionOf(name, current)
244
+ )
245
+ );
246
+
247
+ const fixedVersion = (
248
+ registry: Packuments,
249
+ family: Family,
250
+ entry: Fixed
251
+ ): Fixed =>
252
+ Option.match(fixedRange(registry, family, entry.name), {
253
+ onNone: () => entry,
254
+ onSome: (range) => ({ ...entry, version: Str.replace(/^=/u, "")(range) }),
255
+ });
256
+
257
+ export const onLatestLine: {
258
+ (latest: string): (version: string) => boolean;
259
+ (version: string, latest: string): boolean;
260
+ } = dual(
261
+ 2,
262
+ (version: string, latest: string): boolean =>
263
+ semver.lte(version, latest) &&
264
+ (semver.prerelease(latest) !== null || semver.prerelease(version) === null)
265
+ );
266
+
267
+ const published = (
268
+ registry: Packuments,
269
+ family: Family
270
+ ): ReadonlyArray<string> =>
271
+ Option.match(R.get(registry, lead(family)), {
272
+ onNone: () => [],
273
+ onSome: (packument) => R.keys(packument.versions),
274
+ });
275
+
276
+ const rises = (
277
+ family: Family,
278
+ latest: string,
279
+ tagged: HashSet.HashSet<string>,
280
+ version: string
281
+ ): boolean =>
282
+ semver.valid(version) !== null &&
283
+ semver.gt(version, family.version) &&
284
+ onLatestLine(version, latest) &&
285
+ (version === latest || !HashSet.has(tagged, version));
286
+
287
+ const ladder = (
288
+ registry: Packuments,
289
+ family: Family
290
+ ): ReadonlyArray<string> => {
291
+ const tagged = HashSet.fromIterable(
292
+ Arr.map(otherTags(registry, family), ([, version]) => version)
293
+ );
294
+
295
+ const above = Option.match(latestOf(registry, family), {
296
+ onNone: () => [],
297
+ onSome: (latest) =>
298
+ Arr.filter(
299
+ published(registry, family),
300
+ (version) =>
301
+ rises(family, latest, tagged, version) &&
302
+ Arr.every(
303
+ family.packages,
304
+ (name) =>
305
+ !R.has(registry, name) ||
306
+ Option.isSome(manifestOf(registry, name, version))
307
+ )
308
+ ),
309
+ });
310
+
311
+ return [...Arr.sort(above, semver.rcompare), family.version];
312
+ };
313
+
314
+ const assemble = (
315
+ registry: Packuments,
316
+ start: Catalog,
317
+ picked: ReadonlyArray<Family>
318
+ ): Catalog => ({
319
+ families: picked,
320
+ fixed: Arr.flatMap(start.fixed, (entry) =>
321
+ Arr.fromOption(
322
+ Option.map(
323
+ familyNamed(entry.by, { ...start, families: picked }),
324
+ (family) => fixedVersion(registry, family, entry)
325
+ )
326
+ )
327
+ ),
328
+ });
329
+
330
+ type Rung = readonly [Family, ReadonlyArray<string>];
331
+
332
+ const pickedVersion = (
333
+ registry: Packuments,
334
+ start: Catalog,
335
+ picked: ReadonlyArray<Family>,
336
+ name: string
337
+ ): Option.Option<string> => {
338
+ const owner = ownerOf(name, start);
339
+
340
+ if (Option.isNone(owner)) {
341
+ return Option.none();
342
+ }
343
+
344
+ const chosen = familyNamed(owner.value.name, { ...start, families: picked });
345
+
346
+ if (Option.isNone(chosen)) {
347
+ return Option.none();
348
+ }
349
+
350
+ if (Option.isSome(familyOf(name, start))) {
351
+ return Option.some(chosen.value.version);
352
+ }
353
+
354
+ return Option.map(
355
+ fixedOf(name, start),
356
+ (entry) => fixedVersion(registry, chosen.value, entry).version
357
+ );
358
+ };
359
+
360
+ const search = (
361
+ registry: Packuments,
362
+ start: Catalog,
363
+ rungs: ReadonlyArray<Rung>,
364
+ picked: ReadonlyArray<Family>
365
+ ): Option.Option<ReadonlyArray<Family>> =>
366
+ Arr.matchLeft(rungs, {
367
+ onEmpty: () => Option.some(picked),
368
+ onNonEmpty: ([family, versions], rest) =>
369
+ Arr.findFirst(versions, (version) => {
370
+ const next = [...picked, { ...family, version }];
371
+
372
+ return Arr.isReadonlyArrayEmpty(
373
+ conflictsAmong(registry, start, next, (name) =>
374
+ pickedVersion(registry, start, next, name)
375
+ )
376
+ )
377
+ ? search(registry, start, rest, next)
378
+ : Option.none();
379
+ }),
380
+ });
381
+
382
+ export const describeConflict: {
383
+ (current: Catalog): (conflict: Conflict) => string;
384
+ (conflict: Conflict, current: Catalog): string;
385
+ } = dual(2, (conflict: Conflict, current: Catalog): string =>
386
+ Match.value(conflict).pipe(
387
+ Match.tag(
388
+ "Unpublished",
389
+ ({ name, version }) => `${name} ${version} is not published`
390
+ ),
391
+ Match.tag("Unmet", ({ name, version, needs, range, actual }) => {
392
+ const by = Option.match(fixedOf(needs, current), {
393
+ onNone: () => "",
394
+ onSome: (entry) => `, which ${entry.by} fixes`,
395
+ });
396
+
397
+ return `${name} ${version} needs ${needs} ${range}, and the set has ${needs} ${actual}${by}`;
398
+ }),
399
+ Match.exhaustive
400
+ )
401
+ );
402
+
403
+ const involves = (
404
+ conflict: Conflict,
405
+ family: Family,
406
+ current: Catalog
407
+ ): boolean =>
408
+ family.packages.includes(conflict.name) ||
409
+ Match.value(conflict).pipe(
410
+ Match.tag("Unmet", ({ needs }) =>
411
+ Option.exists(
412
+ ownerOf(needs, current),
413
+ (owner) => owner.name === family.name
414
+ )
415
+ ),
416
+ Match.orElse(() => false)
417
+ );
418
+
419
+ const familyBlocker = (
420
+ registry: Packuments,
421
+ solved: Catalog,
422
+ family: Family,
423
+ latest: string
424
+ ): string => {
425
+ const families = Arr.map(solved.families, (entry) =>
426
+ entry.name === family.name ? { ...entry, version: latest } : entry
427
+ );
428
+
429
+ const trial = assemble(registry, solved, families);
430
+
431
+ const relevant = Arr.filter(conflicts(trial, registry), (conflict) =>
432
+ involves(conflict, family, trial)
433
+ );
434
+
435
+ return Arr.match(relevant, {
436
+ onEmpty: () => {
437
+ if (ladder(registry, family).includes(latest)) {
438
+ return `no compatible set includes ${family.name} ${latest}`;
439
+ }
440
+
441
+ return `${family.name} ${latest} is below the catalog or not published for every package in its family`;
442
+ },
443
+ onNonEmpty: ([first]) => describeConflict(first, trial),
444
+ });
445
+ };
446
+
447
+ const blockersOf = (
448
+ registry: Packuments,
449
+ solved: Catalog,
450
+ latest: Readonly<Record<string, string>>
451
+ ): Readonly<Record<string, string>> =>
452
+ R.fromEntries(
453
+ Arr.flatMap(solved.families, (family) =>
454
+ Option.match(R.get(latest, family.name), {
455
+ onNone: () => [],
456
+ onSome: (version) =>
457
+ version === family.version
458
+ ? []
459
+ : [
460
+ [
461
+ family.name,
462
+ familyBlocker(registry, solved, family, version),
463
+ ] as const,
464
+ ],
465
+ })
466
+ )
467
+ );
468
+
469
+ export const solve: {
470
+ (start?: Catalog): (registry: Packuments) => Solution;
471
+ (registry: Packuments, start?: Catalog): Solution;
472
+ } = dual(
473
+ (args) => Schema.is(Packuments)(args[0]),
474
+ (registry: Packuments, start: Catalog = catalog): Solution => {
475
+ const latest = R.fromEntries(
476
+ Arr.flatMap(start.families, (family) =>
477
+ Arr.fromOption(
478
+ Option.map(
479
+ latestOf(registry, family),
480
+ (version) => [family.name, version] as const
481
+ )
482
+ )
483
+ )
484
+ );
485
+
486
+ const rungs = Arr.map(start.families, (family): Rung => [
487
+ family,
488
+ ladder(registry, family),
489
+ ]);
490
+
491
+ return Option.match(search(registry, start, rungs, []), {
492
+ onNone: () => ({
493
+ resolved: false,
494
+ catalog: start,
495
+ latest,
496
+ blockers: {},
497
+ conflicts: conflicts(start, registry),
498
+ }),
499
+ onSome: (picked) => {
500
+ const solved = assemble(registry, start, picked);
501
+
502
+ return {
503
+ resolved: true,
504
+ catalog: solved,
505
+ latest,
506
+ blockers: blockersOf(registry, solved, latest),
507
+ conflicts: [],
508
+ };
509
+ },
510
+ });
511
+ }
512
+ );
@@ -0,0 +1,56 @@
1
+ import { readFileSync, writeFileSync } from "node:fs";
2
+
3
+ import * as Config from "effect/Config";
4
+ import * as Effect from "effect/Effect";
5
+ import { afterAll, expect, test } from "vite-plus/test";
6
+
7
+ import { FORMAL_TRACES, readTraces, receiptPath } from "./formal/trace-file.ts";
8
+ import type { Trace } from "./formal/trace-file.ts";
9
+ export type { Trace } from "./formal/trace-file.ts";
10
+ type Step = Trace["steps"][number];
11
+ export type Replay = {
12
+ readonly step: (step: Step) => void | Promise<void>;
13
+ readonly observe: () =>
14
+ | Readonly<Record<string, unknown>>
15
+ | Promise<Readonly<Record<string, unknown>>>;
16
+ };
17
+ export const replayTraces = (
18
+ name: string,
19
+ start: (trace: Trace) => Replay | Promise<Replay>
20
+ ): void => {
21
+ const file = Effect.runSync(
22
+ Config.String(FORMAL_TRACES).pipe(Config.withDefault(""))
23
+ );
24
+ if (file === "") {
25
+ test.skip(`${name}: run vp exec formal to replay traces`, () => {});
26
+ return;
27
+ }
28
+ const traces = readTraces(readFileSync(file, "utf8"));
29
+ let passed = 0;
30
+ for (const trace of traces)
31
+ test(`${name} #${trace.index}`, async () => {
32
+ const replay = await start(trace);
33
+ for (const [index, step] of trace.steps.entries()) {
34
+ if (index > 0) await replay.step(step);
35
+ const observed = await replay.observe();
36
+ const keys = Object.keys(observed);
37
+ expect(keys, `step ${index} observes no model variable`).not.toEqual(
38
+ []
39
+ );
40
+ expect(
41
+ keys.filter((key) => !Object.hasOwn(step.state, key)),
42
+ `step ${index} observes variables the model doesn't have`
43
+ ).toEqual([]);
44
+ expect(
45
+ observed,
46
+ `step ${index} (${step.action}) differs from the model`
47
+ ).toEqual(
48
+ Object.fromEntries(keys.map((key) => [key, step.state[key]]))
49
+ );
50
+ }
51
+ passed++;
52
+ });
53
+ afterAll(() => {
54
+ writeFileSync(receiptPath(file), String(passed));
55
+ });
56
+ };
@@ -0,0 +1,24 @@
1
+ import upstream from "@mpsuesser/oxlint-plugin-effect";
2
+ import * as R from "effect/Record";
3
+
4
+ import { useTempFileScopedRule } from "./rules/use-temp-file-scoped.ts";
5
+
6
+ const kept: ReadonlyArray<string> = [
7
+ "avoid-mutable-state",
8
+ "avoid-option-getorthrow",
9
+ "no-chained-type-assertions",
10
+ "no-module-mocking",
11
+ "prefer-redacted-config",
12
+ "require-effect-concurrency",
13
+ "throw-in-effect-gen",
14
+ ];
15
+
16
+ const plugin: Pick<typeof upstream, "meta" | "rules"> = {
17
+ meta: upstream.meta,
18
+ rules: {
19
+ ...R.filter(upstream.rules, (_rule, name) => kept.includes(name)),
20
+ "use-temp-file-scoped": useTempFileScopedRule,
21
+ },
22
+ };
23
+
24
+ export default plugin;
@@ -0,0 +1,44 @@
1
+ import { presets } from "@effect/tsgo/oxlint-presets";
2
+ import * as Arr from "effect/Array";
3
+ import * as Order from "effect/Order";
4
+ import * as R from "effect/Record";
5
+ import * as Struct from "effect/Struct";
6
+
7
+ export const patchCommand = "effect-tsgo patch --oxlint";
8
+
9
+ export const effectTsgoPlugin = "effecttsgo";
10
+
11
+ const beyondRecommended = [
12
+ "effecttsgo/crypto-random-uuid-in-effect",
13
+ "effecttsgo/effect-try-without-catch",
14
+ "effecttsgo/global-date-in-effect",
15
+ "effecttsgo/global-fetch-in-effect",
16
+ "effecttsgo/global-json-in-effect",
17
+ "effecttsgo/global-random-in-effect",
18
+ "effecttsgo/global-timers-in-effect",
19
+ "effecttsgo/missing-effect-service-dependency",
20
+ "effecttsgo/unsafe-effect-type-assertion",
21
+ ];
22
+
23
+ export const disabledRecommendedTsgoRules: ReadonlyArray<string> = [
24
+ "effecttsgo/schema-number",
25
+ "effecttsgo/return-effect-in-gen",
26
+ "effecttsgo/layer-merge-all-with-dependencies",
27
+ ];
28
+
29
+ export const enforcedTsgoRules: ReadonlyArray<string> = Arr.sort(
30
+ Arr.dedupe([
31
+ ...Arr.filter(
32
+ Struct.keys(presets.recommended.rules ?? {}),
33
+ (rule) => !disabledRecommendedTsgoRules.includes(rule)
34
+ ),
35
+ ...beyondRecommended,
36
+ ]),
37
+ Order.String
38
+ );
39
+
40
+ export const effectTsgoRules: Readonly<Record<string, "error" | "off">> =
41
+ R.fromEntries([
42
+ ...Arr.map(enforcedTsgoRules, (rule) => [rule, "error"] as const),
43
+ ...Arr.map(disabledRecommendedTsgoRules, (rule) => [rule, "off"] as const),
44
+ ]);
@@ -0,0 +1,17 @@
1
+ export type Exception = {
2
+ readonly files: ReadonlyArray<string>;
3
+ readonly rules: ReadonlyArray<string>;
4
+ readonly issue: string;
5
+ };
6
+
7
+ export const exceptions: ReadonlyArray<Exception> = [
8
+ {
9
+ files: ["packages/toolchain/src/conformance.ts"],
10
+ rules: [
11
+ "eslint/no-restricted-imports",
12
+ "vitest/no-disabled-tests",
13
+ "vitest/no-conditional-tests",
14
+ ],
15
+ issue: "https://github.com/birbprophet/agent-kit/issues/278",
16
+ },
17
+ ];
package/src/fmt.ts ADDED
@@ -0,0 +1,13 @@
1
+ import ultraciteFmt from "ultracite/oxfmt";
2
+ import type { OxfmtConfig } from "vite-plus/fmt";
3
+
4
+ export type FmtOptions = {
5
+ readonly ignores?: ReadonlyArray<string>;
6
+ };
7
+
8
+ const { ignorePatterns: coreIgnores = [] } = ultraciteFmt;
9
+
10
+ export const fmt = ({ ignores = [] }: FmtOptions = {}): OxfmtConfig => ({
11
+ ...ultraciteFmt,
12
+ ignorePatterns: [...coreIgnores, ...ignores],
13
+ });