@shivaedev/quality 0.59.0 → 0.61.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 (183) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +41 -18
  3. package/dist/adapters/biome/relocateConfig.d.ts +1 -1
  4. package/dist/adapters/biome/relocateConfig.d.ts.map +1 -1
  5. package/dist/adapters/biome/relocateConfig.js +6 -5
  6. package/dist/adapters/biome/relocateConfig.js.map +1 -1
  7. package/dist/adapters/biome/run.d.ts +1 -1
  8. package/dist/adapters/biome/run.d.ts.map +1 -1
  9. package/dist/adapters/biome/run.js +2 -2
  10. package/dist/adapters/biome/run.js.map +1 -1
  11. package/dist/adapters/biome/withExceptionConfig.d.ts +1 -1
  12. package/dist/adapters/biome/withExceptionConfig.d.ts.map +1 -1
  13. package/dist/adapters/biome/withExceptionConfig.js +3 -3
  14. package/dist/adapters/biome/withExceptionConfig.js.map +1 -1
  15. package/dist/adapters/bodyReference.d.ts +9 -0
  16. package/dist/adapters/bodyReference.d.ts.map +1 -0
  17. package/dist/adapters/bodyReference.js +10 -0
  18. package/dist/adapters/bodyReference.js.map +1 -0
  19. package/dist/adapters/bodyReferences.d.ts +1 -6
  20. package/dist/adapters/bodyReferences.d.ts.map +1 -1
  21. package/dist/adapters/bodyReferences.js +16 -12
  22. package/dist/adapters/bodyReferences.js.map +1 -1
  23. package/dist/adapters/engineEscapes.d.ts.map +1 -1
  24. package/dist/adapters/engineEscapes.js.map +1 -1
  25. package/dist/adapters/imports/projects.js +1 -1
  26. package/dist/adapters/imports/projects.js.map +1 -1
  27. package/dist/adapters/knip/configuration.d.ts.map +1 -1
  28. package/dist/adapters/knip/configuration.js +9 -1
  29. package/dist/adapters/knip/configuration.js.map +1 -1
  30. package/dist/adapters/knip/run.js +1 -1
  31. package/dist/adapters/knip/run.js.map +1 -1
  32. package/dist/adapters/queueReadoutFindings.js +1 -1
  33. package/dist/adapters/queueReadoutFindings.js.map +1 -1
  34. package/dist/adapters/serviceAccess.d.ts +1 -1
  35. package/dist/adapters/serviceAccess.d.ts.map +1 -1
  36. package/dist/{rules/stories/program.d.ts → adapters/storyProgram.d.ts} +1 -1
  37. package/dist/adapters/storyProgram.d.ts.map +1 -0
  38. package/dist/{rules/stories/program.js → adapters/storyProgram.js} +14 -5
  39. package/dist/adapters/storyProgram.js.map +1 -0
  40. package/dist/adapters/tanstackRoutes.d.ts +11 -0
  41. package/dist/adapters/tanstackRoutes.d.ts.map +1 -0
  42. package/dist/adapters/tanstackRoutes.js +65 -0
  43. package/dist/adapters/tanstackRoutes.js.map +1 -0
  44. package/dist/biome/nonEffectPlugins.d.ts +7 -0
  45. package/dist/biome/nonEffectPlugins.d.ts.map +1 -0
  46. package/dist/biome/nonEffectPlugins.js +24 -0
  47. package/dist/biome/nonEffectPlugins.js.map +1 -0
  48. package/dist/biome/report.d.ts +1 -1
  49. package/dist/biome/report.d.ts.map +1 -1
  50. package/dist/biome/report.js +5 -5
  51. package/dist/biome/report.js.map +1 -1
  52. package/dist/cli/baseline.d.ts.map +1 -1
  53. package/dist/cli/baseline.js +0 -6
  54. package/dist/cli/baseline.js.map +1 -1
  55. package/dist/cli/fix.d.ts.map +1 -1
  56. package/dist/cli/fix.js +7 -7
  57. package/dist/cli/fix.js.map +1 -1
  58. package/dist/cli/messages.d.ts +1 -1
  59. package/dist/cli/messages.d.ts.map +1 -1
  60. package/dist/cli/messages.js +1 -1
  61. package/dist/config/decode.d.ts +1 -0
  62. package/dist/config/decode.d.ts.map +1 -1
  63. package/dist/config/decode.js +2 -0
  64. package/dist/config/decode.js.map +1 -1
  65. package/dist/config/load.d.ts +1 -0
  66. package/dist/config/load.d.ts.map +1 -1
  67. package/dist/config/load.js +1 -0
  68. package/dist/config/load.js.map +1 -1
  69. package/dist/config/nonEffectFolders.d.ts +5 -0
  70. package/dist/config/nonEffectFolders.d.ts.map +1 -0
  71. package/dist/config/nonEffectFolders.js +17 -0
  72. package/dist/config/nonEffectFolders.js.map +1 -0
  73. package/dist/config/resolve.d.ts +1 -0
  74. package/dist/config/resolve.d.ts.map +1 -1
  75. package/dist/config.d.ts +1 -0
  76. package/dist/config.d.ts.map +1 -1
  77. package/dist/config.js.map +1 -1
  78. package/dist/engine/runRules.d.ts.map +1 -1
  79. package/dist/engine/runRules.js +4 -1
  80. package/dist/engine/runRules.js.map +1 -1
  81. package/dist/engine/session.d.ts.map +1 -1
  82. package/dist/engine/session.js +1 -0
  83. package/dist/engine/session.js.map +1 -1
  84. package/dist/inventory/routeFiles.d.ts +7 -0
  85. package/dist/inventory/routeFiles.d.ts.map +1 -0
  86. package/dist/inventory/routeFiles.js +62 -0
  87. package/dist/inventory/routeFiles.js.map +1 -0
  88. package/dist/inventory/shadcnAlias.js +1 -1
  89. package/dist/inventory/shadcnAlias.js.map +1 -1
  90. package/dist/rule.d.ts +1 -0
  91. package/dist/rule.d.ts.map +1 -1
  92. package/dist/rule.js.map +1 -1
  93. package/dist/rules/biome.js +2 -2
  94. package/dist/rules/biome.js.map +1 -1
  95. package/dist/rules/builtIn.d.ts +2 -2
  96. package/dist/rules/effect/boundary.js +1 -1
  97. package/dist/rules/effect/boundary.js.map +1 -1
  98. package/dist/rules/effect/serviceParameters.js +1 -1
  99. package/dist/rules/effect/serviceParameters.js.map +1 -1
  100. package/dist/rules/files/folderNames.d.ts +1 -1
  101. package/dist/rules/files/folderNames.d.ts.map +1 -1
  102. package/dist/rules/files/folderNames.js +6 -4
  103. package/dist/rules/files/folderNames.js.map +1 -1
  104. package/dist/rules/files/namedAfterExport.d.ts +1 -1
  105. package/dist/rules/files/namedAfterExport.d.ts.map +1 -1
  106. package/dist/rules/files/namedAfterExport.js +5 -3
  107. package/dist/rules/files/namedAfterExport.js.map +1 -1
  108. package/dist/rules/manifestsExportsShape.d.ts.map +1 -1
  109. package/dist/rules/manifestsExportsShape.js +2 -1
  110. package/dist/rules/manifestsExportsShape.js.map +1 -1
  111. package/dist/rules/manifestsSourceFirst.d.ts.map +1 -1
  112. package/dist/rules/manifestsSourceFirst.js +4 -4
  113. package/dist/rules/manifestsSourceFirst.js.map +1 -1
  114. package/dist/rules/stories/adapterOnlyFakes.js +1 -1
  115. package/dist/rules/stories/adapterOnlyFakes.js.map +1 -1
  116. package/dist/rules/stories/origins.d.ts.map +1 -1
  117. package/dist/rules/stories/origins.js +1 -1
  118. package/dist/rules/stories/origins.js.map +1 -1
  119. package/dist/rules/stories/sources.d.ts +1 -0
  120. package/dist/rules/stories/sources.d.ts.map +1 -1
  121. package/dist/rules/stories/sources.js +17 -0
  122. package/dist/rules/stories/sources.js.map +1 -1
  123. package/dist/rules/stories/waitOnEvents.d.ts.map +1 -1
  124. package/dist/rules/stories/waitOnEvents.js +74 -10
  125. package/dist/rules/stories/waitOnEvents.js.map +1 -1
  126. package/dist/testing/adapters/cli.js +1 -1
  127. package/dist/testing/adapters/cli.js.map +1 -1
  128. package/dist/testing/adapters/hookRepository.js +1 -1
  129. package/dist/testing/adapters/hookRepository.js.map +1 -1
  130. package/dist/testing/adapters/packageExports.d.ts +1 -1
  131. package/dist/testing/adapters/packageExports.d.ts.map +1 -1
  132. package/dist/testing/adapters/packageExports.js +6 -3
  133. package/dist/testing/adapters/packageExports.js.map +1 -1
  134. package/dist/testing/ruleStory.d.ts +1 -0
  135. package/dist/testing/ruleStory.d.ts.map +1 -1
  136. package/dist/testing/ruleStory.js +4 -0
  137. package/dist/testing/ruleStory.js.map +1 -1
  138. package/docs/debt-and-hooks.md +1 -1
  139. package/package.json +9 -9
  140. package/src/adapters/biome/relocateConfig.ts +6 -4
  141. package/src/adapters/biome/run.ts +17 -12
  142. package/src/adapters/biome/withExceptionConfig.ts +3 -2
  143. package/src/adapters/bodyReference.ts +19 -0
  144. package/src/adapters/bodyReferences.ts +16 -23
  145. package/src/adapters/engineEscapes.ts +2 -1
  146. package/src/adapters/imports/projects.ts +1 -1
  147. package/src/adapters/knip/configuration.ts +8 -1
  148. package/src/adapters/knip/run.ts +1 -1
  149. package/src/adapters/queueReadoutFindings.ts +1 -1
  150. package/src/adapters/serviceAccess.ts +1 -1
  151. package/src/{rules/stories/program.ts → adapters/storyProgram.ts} +13 -4
  152. package/src/adapters/tanstackRoutes.ts +73 -0
  153. package/src/biome/nonEffectPlugins.ts +27 -0
  154. package/src/biome/report.ts +5 -3
  155. package/src/cli/baseline.ts +0 -6
  156. package/src/cli/fix.ts +13 -5
  157. package/src/cli/messages.ts +1 -1
  158. package/src/config/decode.ts +2 -0
  159. package/src/config/load.ts +2 -0
  160. package/src/config/nonEffectFolders.ts +26 -0
  161. package/src/config.ts +1 -0
  162. package/src/engine/runRules.ts +9 -1
  163. package/src/engine/session.ts +1 -0
  164. package/src/inventory/routeFiles.ts +78 -0
  165. package/src/inventory/shadcnAlias.ts +1 -1
  166. package/src/rule.ts +1 -0
  167. package/src/rules/biome.ts +2 -2
  168. package/src/rules/effect/boundary.ts +1 -1
  169. package/src/rules/effect/serviceParameters.ts +1 -1
  170. package/src/rules/files/folderNames.ts +7 -5
  171. package/src/rules/files/namedAfterExport.ts +5 -3
  172. package/src/rules/manifestsExportsShape.ts +2 -1
  173. package/src/rules/manifestsSourceFirst.ts +4 -5
  174. package/src/rules/stories/adapterOnlyFakes.ts +1 -1
  175. package/src/rules/stories/origins.ts +1 -1
  176. package/src/rules/stories/sources.ts +18 -0
  177. package/src/rules/stories/waitOnEvents.ts +89 -10
  178. package/src/testing/adapters/cli.ts +1 -1
  179. package/src/testing/adapters/hookRepository.ts +1 -1
  180. package/src/testing/adapters/packageExports.ts +6 -3
  181. package/src/testing/ruleStory.ts +7 -0
  182. package/dist/rules/stories/program.d.ts.map +0 -1
  183. package/dist/rules/stories/program.js.map +0 -1
@@ -16,6 +16,7 @@ export interface ResolvedConfig extends ResolvedRules, InventoryScope {
16
16
  readonly biomeDeclarations: readonly Declaration[];
17
17
  readonly exceptions: readonly ExceptionDeclaration[];
18
18
  readonly file: string;
19
+ readonly nonEffectFolders: readonly string[];
19
20
  readonly registry: string;
20
21
  readonly root: string;
21
22
  }
@@ -36,6 +37,7 @@ function resolved(root: string, file: string, config: ConfigInput, rules: Resolv
36
37
  exclude: [],
37
38
  extensions: config.extensions ?? DEFAULT_EXTENSIONS,
38
39
  file,
40
+ nonEffectFolders: config.nonEffectFolders ?? [],
39
41
  registry: config.registry ?? "quality/registry.json",
40
42
  root,
41
43
  sources: config.sources ?? ["."],
@@ -0,0 +1,26 @@
1
+ import { Schema } from "effect";
2
+
3
+ export function nonEffectFolderPath(folder: string): string {
4
+ return folder
5
+ .split("/")
6
+ .filter((part) => part !== "" && part !== ".")
7
+ .join("/");
8
+ }
9
+
10
+ const Folder = Schema.NonEmptyString.check(
11
+ Schema.makeFilter(
12
+ (folder) =>
13
+ folder.trim().length > 0
14
+ && !folder.startsWith("/")
15
+ && !/[:*?![\]{}\\]/u.test(folder)
16
+ && !folder.split("/").includes("..")
17
+ && nonEffectFolderPath(folder) !== "",
18
+ { message: "Name an explicit repository-relative folder, without parent traversal or glob patterns." },
19
+ ),
20
+ );
21
+
22
+ export const NonEffectFolders = Schema.Array(Folder);
23
+
24
+ export function inNonEffectFolder(file: string, folders: readonly string[]): boolean {
25
+ return folders.some((folder) => file.startsWith(`${nonEffectFolderPath(folder)}/`));
26
+ }
package/src/config.ts CHANGED
@@ -19,6 +19,7 @@ export interface QualityConfig<TLocal extends readonly RegisteredRule<unknown>[]
19
19
  readonly exceptions?: readonly ExceptionDeclaration[];
20
20
  readonly extensions?: readonly string[];
21
21
  readonly local?: TLocal;
22
+ readonly nonEffectFolders?: readonly string[];
22
23
  readonly registry?: string;
23
24
  readonly rules?: RuleSettings<readonly [...BuiltInRules, ...TLocal]>;
24
25
  readonly sources?: readonly string[];
@@ -1,6 +1,7 @@
1
1
  import { basename, isAbsolute, relative } from "node:path";
2
2
  import { Effect } from "effect";
3
3
  import { ManifestFailure } from "#adapters/manifestInventory.ts";
4
+ import { inNonEffectFolder } from "#config/nonEffectFolders.ts";
4
5
  import { SetupFailure } from "#failure.ts";
5
6
  import { FilesystemFailure } from "#inventory/filesystem.ts";
6
7
  import { posix } from "#inventory/ignoreScope.ts";
@@ -67,7 +68,14 @@ function expectedFailure(rule: ActiveRule, root: string, cause: unknown): readon
67
68
 
68
69
  function runRule(rule: ActiveRule, inputs: RuleInputs, exceptionFile: string): Effect.Effect<readonly Violation[], SetupFailure, RuleServices> {
69
70
  return Effect.suspend(() => rule.check(inputs)).pipe(
70
- Effect.map((findings) => findings.map((finding) => violationOf(rule, inputs.root, finding, exceptionFile))),
71
+ Effect.map((findings) =>
72
+ findings
73
+ .filter(
74
+ (finding) =>
75
+ !(rule.id.startsWith("effect/") && inNonEffectFolder(repositoryPath(inputs.root, finding.file), inputs.nonEffectFolders ?? [])),
76
+ )
77
+ .map((finding) => violationOf(rule, inputs.root, finding, exceptionFile)),
78
+ ),
71
79
  Effect.catch((cause) => {
72
80
  const findings = expectedFailure(rule, inputs.root, cause);
73
81
  if (findings !== undefined) {
@@ -40,6 +40,7 @@ export const scan = Effect.fn("Engine.scan")(function* (
40
40
  configFile: relative(config.root, config.file),
41
41
  exceptions: config.exceptions,
42
42
  files: inventory.files,
43
+ nonEffectFolders: config.nonEffectFolders,
43
44
  readText,
44
45
  root: config.root,
45
46
  sources: inventory.sources,
@@ -0,0 +1,78 @@
1
+ import * as NodePath from "@effect/platform-node/NodePath";
2
+ import { Effect, Path } from "effect";
3
+ import { type RouterOptions, tanstackRoutes } from "#adapters/tanstackRoutes.ts";
4
+ import { SetupFailure } from "#failure.ts";
5
+ import { readRequiredText } from "./filesystem.ts";
6
+ import { posix as portable } from "./ignoreScope.ts";
7
+ import { walk } from "./walk.ts";
8
+
9
+ const CONFIG = /^(?:tsr\.config\.json|vite\.config\.[cm]?[jt]s)$/u;
10
+ const CODE = /\.[jt]sx?$/u;
11
+
12
+ interface RouteFolder {
13
+ readonly directory: string;
14
+ readonly ignorePattern: RegExp | undefined;
15
+ readonly ignorePrefix: string;
16
+ readonly prefix: string | undefined;
17
+ }
18
+
19
+ function owns(file: string, folder: RouteFolder): boolean {
20
+ if (!(CODE.test(file) && file.startsWith(`${folder.directory}/`))) {
21
+ return false;
22
+ }
23
+ const parts = file.slice(folder.directory.length + 1).split("/");
24
+ return parts.every(
25
+ (part) =>
26
+ !(part.startsWith(".") || (folder.ignorePrefix !== "" && part.startsWith(folder.ignorePrefix)) || folder.ignorePattern?.test(part))
27
+ && (folder.prefix === undefined || part.startsWith(folder.prefix)),
28
+ );
29
+ }
30
+
31
+ export const routeFiles = Effect.fn("Inventory.routeFiles")(function* (root: string) {
32
+ const { basename, dirname, relative, resolve } = yield* Path.Path.pipe(Effect.provide(NodePath.layer));
33
+ const paths = yield* walk(root);
34
+ const configs = paths
35
+ .filter((path) => CONFIG.test(basename(path)))
36
+ .sort((left, right) => Number(basename(right) === "tsr.config.json") - Number(basename(left) === "tsr.config.json"));
37
+ const byApp = new Map<string, RouterOptions>();
38
+ for (const path of configs) {
39
+ const text = yield* readRequiredText(path);
40
+ const options = yield* Effect.try({
41
+ catch: (cause) => new SetupFailure({ cause, message: `cannot read routes from ${path}: ${String(cause)}` }),
42
+ try: () => tanstackRoutes(path, text),
43
+ });
44
+ for (const option of options) {
45
+ const base = dirname(path);
46
+ byApp.set(base, { ...byApp.get(base), ...option });
47
+ }
48
+ }
49
+ const folders = yield* Effect.try({
50
+ catch: (cause) => new SetupFailure({ cause, message: `cannot resolve TanStack Router folders: ${String(cause)}` }),
51
+ try: () =>
52
+ [...byApp].map(
53
+ ([base, options]): RouteFolder => ({
54
+ directory: portable(relative(root, resolve(base, options.routesDirectory ?? "src/routes"))),
55
+ ignorePattern:
56
+ options.routeFileIgnorePattern === undefined || options.routeFileIgnorePattern === ""
57
+ ? undefined
58
+ : new RegExp(options.routeFileIgnorePattern, "u"),
59
+ ignorePrefix: options.routeFileIgnorePrefix ?? "-",
60
+ prefix: options.routeFilePrefix,
61
+ }),
62
+ ),
63
+ });
64
+ const files = new Set<string>();
65
+ const ownedFolders = new Set<string>();
66
+ for (const absolute of paths) {
67
+ const file = portable(relative(root, absolute));
68
+ const folder = folders.find((candidate) => owns(file, candidate));
69
+ if (folder === undefined) {
70
+ continue;
71
+ }
72
+ files.add(file);
73
+ for (let current = dirname(file); current.startsWith(`${folder.directory}/`) || current === folder.directory; current = dirname(current)) {
74
+ ownedFolders.add(current);
75
+ }
76
+ }
77
+ return { files, folders: ownedFolders };
78
+ });
@@ -72,7 +72,7 @@ export function shadcnAlias(directory: string, alias: string): string {
72
72
  join(directory, "components.tsx"),
73
73
  {
74
74
  ...options,
75
- customConditions: ["source", ...(options.customConditions ?? [])],
75
+ customConditions: ["@shivaedev/source", ...(options.customConditions ?? [])],
76
76
  moduleResolution: ts.ModuleResolutionKind.Bundler,
77
77
  },
78
78
  {
package/src/rule.ts CHANGED
@@ -25,6 +25,7 @@ export interface RuleInputs {
25
25
  readonly configFile?: string;
26
26
  readonly exceptions?: readonly ExceptionDeclaration[];
27
27
  readonly files: readonly string[];
28
+ readonly nonEffectFolders?: readonly string[];
28
29
  readonly readText: (path: string) => Promise<string | undefined>;
29
30
  readonly root: string;
30
31
  readonly signal?: AbortSignal;
@@ -26,9 +26,9 @@ const presetFinding = Effect.fn("Biome.presetFinding")(function* (inputs: Pick<R
26
26
  });
27
27
 
28
28
  const bridge = defineRule({
29
- check: ({ exceptions, readText, root }) =>
29
+ check: ({ exceptions, nonEffectFolders, readText, root }) =>
30
30
  Effect.gen(function* () {
31
- const [preset, report] = yield* Effect.all([presetFinding({ readText }), biomeReport(root, ["check"], exceptions)], {
31
+ const [preset, report] = yield* Effect.all([presetFinding({ readText }), biomeReport(root, ["check"], exceptions, ["."], nonEffectFolders)], {
32
32
  concurrency: "unbounded",
33
33
  });
34
34
  const failing = report.diagnostics.filter((diagnostic) => FAILING.has(diagnostic.severity));
@@ -93,7 +93,7 @@ export const effectBoundary = defineRule({
93
93
  return [...groups.values()].flatMap((sources) => checkBoundary({ ...inputs, sources }));
94
94
  },
95
95
  description:
96
- "Use Effect instead of Promise syntax and parameters, synchronous Node IO, throwing helper calls or Effect.sync with throwing APIs. Runners belong at entry points (including main.tsx and entry.tsx), tool configs and tests. Only adapters/ and test-support/ folders are exempt; calls to throwing helpers defined in adapters/ are accepted. Use Effect services and tagged errors; bridge outside libraries in adapters/. No config exceptions or inline suppressions; baseline existing debt.",
96
+ "Use Effect instead of Promise syntax and parameters, synchronous Node IO, throwing helper calls or Effect.sync with throwing APIs. Runners belong at entry points (including main.tsx and entry.tsx), tool configs and tests. Within Effect code, adapters/ and test-support/ folders are exempt; calls to throwing helpers defined in adapters/ are accepted. Use Effect services and tagged errors; bridge outside libraries in adapters/. No config exceptions or inline suppressions; baseline existing debt.",
97
97
  id: "effect/boundary",
98
98
  registrable: false,
99
99
  });
@@ -25,7 +25,7 @@ export const serviceParameters = defineRule({
25
25
  return [...groups.values()].flatMap((sources) => checkServices({ ...inputs, sources }, names));
26
26
  }),
27
27
  description:
28
- "Exported functions and public methods take services from Effect's environment, including aliases, constraints, inferred/destructured parameters and factory returns. Service keys/classes, non-empty Contexts and implementation shapes are services; Effect/Stream requirements are computations. Service implementation methods and Layer constructors are accepted. Only test-support/ folders are exempt. The fixed adapters/ convention bridges outside libraries to Effect values; adapters still follow this rule and ambient runtime bans. No config exceptions or inline suppressions; baseline existing debt.",
28
+ "Exported functions and public methods take services from Effect's environment, including aliases, constraints, inferred/destructured parameters and factory returns. Service keys/classes, non-empty Contexts and implementation shapes are services; Effect/Stream requirements are computations. Service implementation methods and Layer constructors are accepted. Within Effect code, test-support/ folders are exempt. The fixed adapters/ convention bridges outside libraries to Effect values; adapters still follow this rule and ambient runtime bans. No config exceptions or inline suppressions; baseline existing debt.",
29
29
  id: "effect/service-parameters",
30
30
  registrable: false,
31
31
  });
@@ -2,6 +2,7 @@ import { posix } from "node:path";
2
2
  import { Effect, Order, Schema } from "effect";
3
3
  import { type IgnoreMatcher, ignorePatterns } from "#adapters/ignore.ts";
4
4
  import { GlobDeclarations, globPatterns, validateGlobs } from "#config/globs.ts";
5
+ import { routeFiles } from "#inventory/routeFiles.ts";
5
6
  import { nativeNames } from "#naming/nativeNames.ts";
6
7
  import { packageLayout } from "#naming/packageLayout.ts";
7
8
  import { KEBAB, PASCAL } from "#naming/words.ts";
@@ -52,14 +53,14 @@ function groupMessage(name: string): string | undefined {
52
53
  interface Context {
53
54
  readonly content: IgnoreMatcher;
54
55
  readonly names: ReadonlyMap<string, string>;
55
- readonly native: ReadonlySet<string>;
56
+ readonly owned: ReadonlySet<string>;
56
57
  readonly stems: ReadonlySet<string>;
57
58
  readonly toolOwned: IgnoreMatcher;
58
59
  }
59
60
 
60
61
  function messageFor(folder: string, context: Context): string | undefined {
61
62
  const name = posix.basename(folder);
62
- if (context.native.has(folder) || context.toolOwned.ignores(`${folder}/`) || isModule(folder, context.stems)) {
63
+ if (context.owned.has(folder) || context.toolOwned.ignores(`${folder}/`) || isModule(folder, context.stems)) {
63
64
  return undefined;
64
65
  }
65
66
  const packageName = context.names.get(folder);
@@ -73,13 +74,14 @@ function messageFor(folder: string, context: Context): string | undefined {
73
74
  }
74
75
 
75
76
  export const folderNames = defineRule({
76
- check: ({ files, options, readText }) =>
77
+ check: ({ files, options, readText, root }) =>
77
78
  Effect.gen(function* () {
78
79
  const layout = yield* packageLayout({ files, readText });
80
+ const routes = yield* routeFiles(root);
79
81
  const context: Context = {
80
82
  content: ignorePatterns([...globPatterns(options.content)]),
81
83
  names: layout.names,
82
- native: nativeNames(files).folders,
84
+ owned: new Set([...nativeNames(files).folders, ...routes.folders]),
83
85
  stems: stemsIn(files),
84
86
  toolOwned: ignorePatterns([...globPatterns(options.toolOwned)]),
85
87
  };
@@ -89,7 +91,7 @@ export const folderNames = defineRule({
89
91
  });
90
92
  }),
91
93
  description:
92
- "A package folder is named after its package, a module folder after its main file, a content folder in snake_case and every other folder in kebab-case.",
94
+ "A package folder is named after its package, a module folder after its main file, a content folder in snake_case and every other folder in kebab-case. TanStack Router configuration owns route folder names.",
93
95
  id: "files/folder-names",
94
96
  options: Schema.toStandardSchemaV1(FolderNamesOptions, { parseOptions: { errors: "all", onExcessProperty: "error" } }),
95
97
  validate: validateGlobs,
@@ -2,6 +2,7 @@ import { posix } from "node:path";
2
2
  import { Effect, Schema } from "effect";
3
3
  import { ignorePatterns } from "#adapters/ignore.ts";
4
4
  import { GlobDeclarations, globPatterns, validateGlobs } from "#config/globs.ts";
5
+ import { routeFiles } from "#inventory/routeFiles.ts";
5
6
  import { exportFits } from "#naming/exportFits.ts";
6
7
  import { mainExport } from "#naming/mainExport.ts";
7
8
  import { isMigrationFile } from "#naming/migrationFile.ts";
@@ -89,16 +90,17 @@ function findingsOf(file: SourceFile, layout: PackageLayout): readonly Finding[]
89
90
  }
90
91
 
91
92
  export const namedAfterExport = defineRule({
92
- check: ({ files, options, readText, sources }) =>
93
+ check: ({ files, options, readText, root, sources }) =>
93
94
  Effect.gen(function* () {
94
95
  const layout = yield* packageLayout({ files, readText });
96
+ const routes = yield* routeFiles(root);
95
97
  const toolOwned = ignorePatterns([...DEFAULT_TOOL_OWNED, ...globPatterns(options.toolOwned)]);
96
98
  return sources
97
- .filter((file) => !(TEST.test(file.path) || isMigrationFile(file.path) || toolOwned.ignores(file.path)))
99
+ .filter((file) => !(TEST.test(file.path) || isMigrationFile(file.path) || routes.files.has(file.path) || toolOwned.ignores(file.path)))
98
100
  .flatMap((file) => findingsOf(file, layout));
99
101
  }),
100
102
  description:
101
- "A file is named after its main export or a module-level constant, including a private constant, with its folders as the prefix; module client/admin and server/admin files may repeat names from above the admin folder. A file of several exports is a camelCase topic file, and a script is kebab-case. Rename the file or the export; nothing renames them for you.",
103
+ "A file is named after its main export or a module-level constant, including a private constant, with its folders as the prefix; module client/admin and server/admin files may repeat names from above the admin folder. TanStack Router configuration owns route filenames. A file of several exports is a camelCase topic file, and a script is kebab-case. Rename the file or the export; nothing renames them for you.",
102
104
  id: "files/named-after-export",
103
105
  options: Schema.toStandardSchemaV1(NamedAfterExportOptions, { parseOptions: { errors: "all", onExcessProperty: "error" } }),
104
106
  validate: validateGlobs,
@@ -18,7 +18,8 @@ function standardPattern(key: string, value: unknown): boolean {
18
18
  }
19
19
  const subpath = key.slice("./".length);
20
20
  const stem = subpath.slice(0, -".ts".length);
21
- const conditions = { default: `./dist/${stem}.js`, source: `./src/${subpath}`, types: `./dist/${stem}.d.ts` };
21
+ const source = "@shivaedev/source" in value ? "@shivaedev/source" : "source";
22
+ const conditions = { default: `./dist/${stem}.js`, [source]: `./src/${subpath}`, types: `./dist/${stem}.d.ts` };
22
23
  return (
23
24
  Object.keys(value).length === Object.keys(conditions).length
24
25
  && Object.entries(conditions).every(([condition, target]) => value[condition] === target)
@@ -3,19 +3,18 @@ import { manifestEntry, manifestFiles } from "#adapters/manifestInventory.ts";
3
3
  import { defineRule, type Finding } from "#rule.ts";
4
4
  import { itemsOf, type Json, member, parseJsonc } from "#rules/suppressions/biome/json.ts";
5
5
 
6
- const CONDITION = "source";
7
-
8
6
  function misplaced(path: string, field: string, value: unknown, node: Json | undefined): readonly Finding[] {
9
7
  const conditions = typeof value === "object" && value !== null && !Array.isArray(value) ? Object.entries(value) : [];
10
8
  const first = conditions[0]?.[0];
9
+ const condition = ["@shivaedev/source", "source"].find((name) => conditions.some(([key]) => key === name));
11
10
  const own: readonly Finding[] =
12
- first === CONDITION || !conditions.some(([key]) => key === CONDITION)
11
+ condition === undefined || first === condition
13
12
  ? []
14
13
  : [
15
14
  {
16
15
  file: path,
17
16
  line: node?.line,
18
- message: `Lists the "${CONDITION}" condition after "${first}" in ${field}. TypeScript takes the first condition that matches, so once built output exists it reads that instead of the sources the "${CONDITION}" condition names. Move "${CONDITION}" to the top of this condition block.`,
17
+ message: `Lists the "${condition}" condition after "${first}" in ${field}. TypeScript takes the first condition that matches, so once built output exists it reads that instead of the sources the "${condition}" condition names. Move "${condition}" to the top of this condition block.`,
19
18
  subject: field,
20
19
  },
21
20
  ];
@@ -47,7 +46,7 @@ export const manifestsSourceFirst = defineRule({
47
46
  return findings.flat();
48
47
  }),
49
48
  description:
50
- 'Every package.json condition block that names the "source" condition lists it first in exports and imports, so TypeScript reads the sources whether or not built output exists.',
49
+ 'Every package.json condition block that names a "@shivaedev/source" or "source" condition lists it first in exports and imports, so TypeScript reads the sources whether or not built output exists.',
51
50
  id: "manifests/source-first",
52
51
  registrable: false,
53
52
  });
@@ -2,11 +2,11 @@ import { Effect } from "effect";
2
2
  import ts from "typescript";
3
3
  import { fakeApi, fakeReferences } from "#adapters/imports/fakeReferences.ts";
4
4
  import { type FakeModule, fakeTargets } from "#adapters/imports/fakeTargets.ts";
5
+ import { storyProgram } from "#adapters/storyProgram.ts";
5
6
  import { importGraph } from "#imports/graph.ts";
6
7
  import { isTestCode } from "#naming/testName.ts";
7
8
  import { defineRule, type Finding } from "#rule.ts";
8
9
  import { fakeReplacements } from "./fakeReplacements.ts";
9
- import { storyProgram } from "./program.ts";
10
10
 
11
11
  function internal(path: string): boolean {
12
12
  return !path.split("/").includes("adapters");
@@ -1,10 +1,10 @@
1
1
  import { join } from "node:path";
2
2
  import ts from "typescript";
3
+ import { storyProgram } from "#adapters/storyProgram.ts";
3
4
  import type { ImportGraph } from "#imports/graph.ts";
4
5
  import type { RuleInputs } from "#rule.ts";
5
6
  import { iterationOrigin, type Origin } from "./collectionOrigins.ts";
6
7
  import { importFrom, importOrigin } from "./importOrigin.ts";
7
- import { storyProgram } from "./program.ts";
8
8
  import { returnValues } from "./returnValues.ts";
9
9
  import { memberName } from "./syntax.ts";
10
10
 
@@ -1,5 +1,6 @@
1
1
  import { Effect } from "effect";
2
2
  import ts from "typescript";
3
+ import { outgoing } from "#imports/fences/reach.ts";
3
4
  import { importGraph } from "#imports/graph.ts";
4
5
  import { packageOf } from "#imports/workspace.ts";
5
6
  import { isTestSupport, testName } from "#naming/testName.ts";
@@ -30,3 +31,20 @@ export const storySources = Effect.fn("Stories.storySources")(function* (inputs:
30
31
  return source !== undefined && hasStory(source);
31
32
  });
32
33
  });
34
+
35
+ export const storyWaitSources = Effect.fn("Stories.storyWaitSources")(function* (inputs: RuleInputs) {
36
+ const stories = yield* storySources(inputs);
37
+ const graph = yield* importGraph(inputs);
38
+ const edges = outgoing(graph.edges.filter((edge) => edge.kind === "import" && !edge.type));
39
+ const reached = new Set(stories.map((file) => file.path));
40
+ const queue = [...reached];
41
+ for (const file of queue) {
42
+ for (const edge of edges.get(file) ?? []) {
43
+ if (edge.to.kind === "file" && !reached.has(edge.to.path)) {
44
+ reached.add(edge.to.path);
45
+ queue.push(edge.to.path);
46
+ }
47
+ }
48
+ }
49
+ return inputs.sources.filter((file) => stories.includes(file) || (isTestSupport(file.path) && reached.has(file.path)));
50
+ });
@@ -1,17 +1,93 @@
1
1
  import { Effect } from "effect";
2
2
  import ts from "typescript";
3
+ import { isTestSupport } from "#naming/testName.ts";
3
4
  import { defineRule } from "#rule.ts";
4
5
  import { bindsModule, type ImportBinding, importBindings } from "./importBindings.ts";
5
- import { storySources } from "./sources.ts";
6
+ import { storyWaitSources } from "./sources.ts";
6
7
  import { memberName, syntaxFindings, unwrapped } from "./syntax.ts";
7
8
 
8
9
  const MESSAGE =
9
- "Waits on time in a story: a sleep, a timer, polling with eventually or waitFor, fake timers or a TestClock adjustment. Settle on the engine's own signal through a kit verb, such as a Deferred the engine completes, story.runUntil or screenDriver's settle(); when time passing is the behaviour, name it in a kit verb that advances the clock.";
10
+ "Waits on time in a story or reachable test-support: a sleep, a timer, polling with eventually or waitFor, fake timers or a clock adjustment in the spec. Settle on the engine's own signal through a kit verb, such as a Deferred the engine completes, story.runUntil or screenDriver's settle(). A deadline bounds a failure but does not prove completion; reaching it must fail the story. When time passing is the behaviour, name it in a kit verb that advances TestClock.";
10
11
 
11
12
  const TIMERS = new Set(["setInterval", "setTimeout"]);
12
13
  const VI_TIMING = /^(?:useFakeTimers|advanceTimers\w*|runAllTimers\w*|runOnlyPendingTimers\w*|runAllTicks|setSystemTime|waitFor|waitUntil)$/u;
13
14
  const CLOCK_CHANGES = new Set(["adjust", "setTime"]);
14
15
 
16
+ function terminal(body: ts.ConciseBody): ts.Expression | undefined {
17
+ if (!ts.isBlock(body)) {
18
+ return unwrapped(body);
19
+ }
20
+ const last = body.statements.at(-1);
21
+ return last !== undefined && (ts.isReturnStatement(last) || ts.isExpressionStatement(last)) ? last.expression : undefined;
22
+ }
23
+
24
+ function fails(expression: ts.Expression, bindings: ReadonlyMap<string, ImportBinding>): boolean {
25
+ const value = unwrapped(expression);
26
+ if (ts.isArrowFunction(value) || ts.isFunctionExpression(value)) {
27
+ const result = terminal(value.body);
28
+ return result !== undefined && fails(result, bindings);
29
+ }
30
+ if (!(ts.isCallExpression(value) && ts.isPropertyAccessExpression(value.expression))) {
31
+ return false;
32
+ }
33
+ const receiver = value.expression.expression;
34
+ return (
35
+ ts.isIdentifier(receiver)
36
+ && bindsModule(bindings.get(receiver.text), "Effect", ["effect"])
37
+ && ["die", "fail"].includes(value.expression.name.text)
38
+ );
39
+ }
40
+
41
+ function failingSleep(call: ts.CallExpression, bindings: ReadonlyMap<string, ImportBinding>): boolean {
42
+ const access = call.parent;
43
+ const pipe = access.parent;
44
+ if (!(ts.isPropertyAccessExpression(access) && access.name.text === "pipe" && ts.isCallExpression(pipe) && pipe.arguments.length === 1)) {
45
+ return false;
46
+ }
47
+ const step = pipe.arguments[0];
48
+ if (step === undefined || !ts.isCallExpression(step) || memberName(step.expression) !== "andThen") {
49
+ return false;
50
+ }
51
+ const receiver = ts.isPropertyAccessExpression(step.expression) ? step.expression.expression : undefined;
52
+ return (
53
+ receiver !== undefined
54
+ && ts.isIdentifier(receiver)
55
+ && bindsModule(bindings.get(receiver.text), "Effect", ["effect"])
56
+ && step.arguments.length === 1
57
+ && step.arguments[0] !== undefined
58
+ && fails(step.arguments[0], bindings)
59
+ );
60
+ }
61
+
62
+ function rejectionName(call: ts.CallExpression): string | undefined {
63
+ for (let node: ts.Node | undefined = call.parent; node !== undefined; node = node.parent) {
64
+ if (
65
+ (ts.isArrowFunction(node) || ts.isFunctionExpression(node))
66
+ && ts.isNewExpression(node.parent)
67
+ && ts.isIdentifier(node.parent.expression)
68
+ && node.parent.expression.text === "Promise"
69
+ ) {
70
+ const name = node.parameters[1]?.name;
71
+ return name !== undefined && ts.isIdentifier(name) ? name.text : undefined;
72
+ }
73
+ }
74
+ return undefined;
75
+ }
76
+
77
+ function rejectingTimer(call: ts.CallExpression): boolean {
78
+ const reject = rejectionName(call);
79
+ const callback = call.arguments[0];
80
+ if (reject === undefined || callback === undefined) {
81
+ return false;
82
+ }
83
+ const body = ts.isArrowFunction(callback) || ts.isFunctionExpression(callback) ? terminal(callback.body) : callback;
84
+ return (
85
+ body !== undefined
86
+ && ((ts.isIdentifier(body) && body.text === reject)
87
+ || (ts.isCallExpression(body) && ts.isIdentifier(body.expression) && body.expression.text === reject))
88
+ );
89
+ }
90
+
15
91
  function receiverOf(callee: ts.Expression): ts.Identifier | undefined {
16
92
  const receiver = ts.isPropertyAccessExpression(callee) ? unwrapped(callee.expression) : undefined;
17
93
  return receiver !== undefined && ts.isIdentifier(receiver) ? receiver : undefined;
@@ -22,10 +98,12 @@ function vitestTiming(receiver: ts.Identifier, bindings: ReadonlyMap<string, Imp
22
98
  return binding === undefined ? receiver.text === "vi" : bindsModule(binding, "vi", ["vitest", "@effect/vitest"]);
23
99
  }
24
100
 
25
- function timedWait(call: ts.CallExpression, bindings: ReadonlyMap<string, ImportBinding>): boolean {
101
+ function timedWait(call: ts.CallExpression, bindings: ReadonlyMap<string, ImportBinding>, support: boolean): boolean {
26
102
  const callee = unwrapped(call.expression);
27
103
  if (ts.isIdentifier(callee)) {
28
- return TIMERS.has(callee.text) || bindings.get(callee.text)?.imported === "eventually";
104
+ return (
105
+ (TIMERS.has(callee.text) && !(callee.text === "setTimeout" && rejectingTimer(call))) || bindings.get(callee.text)?.imported === "eventually"
106
+ );
29
107
  }
30
108
  const member = memberName(callee) ?? "";
31
109
  const receiver = receiverOf(callee);
@@ -34,18 +112,19 @@ function timedWait(call: ts.CallExpression, bindings: ReadonlyMap<string, Import
34
112
  }
35
113
  const binding = bindings.get(receiver.text);
36
114
  return (
37
- (member === "sleep" && bindsModule(binding, "Effect", ["effect"]))
115
+ (member === "sleep" && bindsModule(binding, "Effect", ["effect"]) && !failingSleep(call, bindings))
38
116
  || (VI_TIMING.test(member) && vitestTiming(receiver, bindings))
39
- || (CLOCK_CHANGES.has(member) && bindsModule(binding, "TestClock", ["effect/testing"]))
40
- || (TIMERS.has(member) && receiver.text === "globalThis")
117
+ || (!support && CLOCK_CHANGES.has(member) && bindsModule(binding, "TestClock", ["effect/testing"]))
118
+ || (TIMERS.has(member) && receiver.text === "globalThis" && !(member === "setTimeout" && rejectingTimer(call)))
41
119
  );
42
120
  }
43
121
 
44
122
  function timedWaits(source: ts.SourceFile): readonly ts.Node[] {
45
123
  const bindings = importBindings(source);
124
+ const support = isTestSupport(source.fileName);
46
125
  const found: ts.Node[] = [];
47
126
  function visit(node: ts.Node): void {
48
- if (ts.isCallExpression(node) && timedWait(node, bindings)) {
127
+ if (ts.isCallExpression(node) && timedWait(node, bindings, support)) {
49
128
  found.push(node);
50
129
  }
51
130
  ts.forEachChild(node, visit);
@@ -55,7 +134,7 @@ function timedWaits(source: ts.SourceFile): readonly ts.Node[] {
55
134
  }
56
135
 
57
136
  export const waitOnEvents = defineRule({
58
- check: (inputs) => Effect.map(storySources(inputs), (stories) => stories.flatMap((file) => syntaxFindings(file, timedWaits, MESSAGE))),
59
- description: "Stories settle on the engine's own signals, never on sleeps, polling, fake timers or clock adjustments in the story.",
137
+ check: (inputs) => Effect.map(storyWaitSources(inputs), (sources) => sources.flatMap((file) => syntaxFindings(file, timedWaits, MESSAGE))),
138
+ description: "Stories and reachable test-support settle on the engine's own signals; controlled clock advances belong in kit verbs.",
60
139
  id: "tests/wait-on-events",
61
140
  });
@@ -15,7 +15,7 @@ export interface Run {
15
15
 
16
16
  const SOURCE = import.meta.url.endsWith(".ts");
17
17
  const CLI = fileURLToPath(new URL(SOURCE ? "../../cli.ts" : "../../cli.js", import.meta.url));
18
- const OPTIONS = SOURCE ? ["--conditions=source"] : [];
18
+ const OPTIONS = SOURCE ? ["--conditions=@shivaedev/source"] : [];
19
19
 
20
20
  export const CLI_TIMEOUT = 60_000;
21
21
 
@@ -25,7 +25,7 @@ const CHECKS_LOG = "checks.log";
25
25
 
26
26
  const SOURCE_EXPORTS = {
27
27
  "./*.ts": Object.fromEntries([
28
- ["source", "./src/*.ts"],
28
+ ["@shivaedev/source", "./src/*.ts"],
29
29
  ["types", "./dist/*.d.ts"],
30
30
  ["default", "./dist/*.js"],
31
31
  ]),
@@ -4,7 +4,7 @@ import type { SeedFile } from "./tree.ts";
4
4
  export const LIBRARY_MANIFEST = "modules/library/package.json";
5
5
 
6
6
  export const FILE_PATH_EXPORTS = {
7
- "./*.ts": { default: "./dist/*.js", source: "./src/*.ts", types: "./dist/*.d.ts" },
7
+ "./*.ts": { "@shivaedev/source": "./src/*.ts", default: "./dist/*.js", types: "./dist/*.d.ts" },
8
8
  "./package.json": "./package.json",
9
9
  };
10
10
 
@@ -14,10 +14,13 @@ export const exportsWorkspace: SeedFile = {
14
14
  };
15
15
 
16
16
  function sourceFirst(_key: string, value: unknown): unknown {
17
- if (typeof value !== "object" || value === null || !("source" in value)) {
17
+ if (typeof value !== "object" || value === null || !("@shivaedev/source" in value)) {
18
18
  return value;
19
19
  }
20
- return Object.fromEntries([["source", value.source], ...Object.entries(value).filter(([key]) => key !== "source")]);
20
+ return Object.fromEntries([
21
+ ["@shivaedev/source", value["@shivaedev/source"]],
22
+ ...Object.entries(value).filter(([key]) => key !== "@shivaedev/source"),
23
+ ]);
21
24
  }
22
25
 
23
26
  export function packageExports(exports: unknown, path = LIBRARY_MANIFEST): SeedFile {
@@ -90,6 +90,13 @@ export function makeRuleStory() {
90
90
  }),
91
91
  gateOutcome: () => Effect.map(answered(engine), outcomeOf),
92
92
  gateReport: () => Effect.map(answered(engine), (answer) => answer.stdout + answer.stderr),
93
+ gateReports: (prefix: string) =>
94
+ Effect.map(answered(engine), (answer) =>
95
+ answer.stdout
96
+ .split("\n\n")
97
+ .filter((section) => section.startsWith(`error ${prefix}`))
98
+ .join("\n\n"),
99
+ ),
93
100
  locations: () => Effect.map(checked(engine), (findings) => findings.map(locationOf)),
94
101
  messages: () => Effect.map(checked(engine), (findings) => findings.map((finding) => finding.message)),
95
102
  optionIssues: Effect.fn("RuleStory.optionIssues")(function* (rule: RegisteredRule, options: unknown) {
@@ -1 +0,0 @@
1
- {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../../src/rules/stories/program.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,GAAG,EAAE,CAAC,OAAO,CA6B/E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"program.js","sourceRoot":"","sources":["../../../src/rules/stories/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,YAAY,CAAC;AAI5B,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAqC,CAAC;AAElE,MAAM,UAAU,YAAY,CAAC,MAAkB,EAAE,KAAkB;IAClE,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjG,MAAM,OAAO,GAAG,IAAI,GAAG,CACtB,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAC5B,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAChI,CACD,CAAC;IACF,MAAM,OAAO,GAAuB,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAC9E,MAAM,IAAI,GAAoB;QAC7B,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC;QACjC,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QACvC,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;YACvB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC/B,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACvG,CAAC;QACD,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;QACrC,kBAAkB,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CACnC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAClB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;YAC5C,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC;QAChG,CAAC,CAAC;KACH,CAAC;IACF,MAAM,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACrE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACtC,OAAO,OAAO,CAAC;AAChB,CAAC"}